2023-08-08 12:24:51 +00:00
|
|
|
<script setup>
|
2024-06-21 08:47:09 +00:00
|
|
|
import { onBeforeMount, onMounted, computed, ref } from 'vue';
|
2023-08-08 12:24:51 +00:00
|
|
|
import { useI18n } from 'vue-i18n';
|
2023-09-01 10:11:56 +00:00
|
|
|
import { Notify } from 'quasar';
|
2024-06-17 08:46:51 +00:00
|
|
|
import axios from 'axios';
|
2023-08-08 12:24:51 +00:00
|
|
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
|
|
|
import { useSession } from 'src/composables/useSession';
|
|
|
|
import { toDate } from 'filters/index';
|
|
|
|
import CmrFilter from './CmrFilter.vue';
|
2023-08-30 10:53:18 +00:00
|
|
|
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
|
|
|
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
2024-06-03 12:11:40 +00:00
|
|
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
2024-06-21 08:47:09 +00:00
|
|
|
import { useStateStore } from 'src/stores/useStateStore';
|
2023-08-08 12:24:51 +00:00
|
|
|
|
2024-07-03 07:33:04 +00:00
|
|
|
import VnTable from 'components/VnTable/VnTable.vue';
|
|
|
|
|
2023-08-08 12:24:51 +00:00
|
|
|
const { t } = useI18n();
|
2024-02-26 06:11:33 +00:00
|
|
|
const { getTokenMultimedia } = useSession();
|
|
|
|
const token = getTokenMultimedia();
|
2024-06-21 08:47:09 +00:00
|
|
|
const state = useStateStore();
|
2023-09-01 10:11:56 +00:00
|
|
|
const selected = ref([]);
|
2024-06-03 14:30:59 +00:00
|
|
|
const warehouses = ref([]);
|
2023-08-08 12:24:51 +00:00
|
|
|
|
|
|
|
const columns = computed(() => [
|
|
|
|
{
|
|
|
|
name: 'cmrFk',
|
|
|
|
label: t('route.cmr.list.cmrFk'),
|
|
|
|
field: (row) => row.cmrFk,
|
|
|
|
sortable: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'hasCmrDms',
|
|
|
|
label: t('route.cmr.list.hasCmrDms'),
|
|
|
|
field: (row) => row.hasCmrDms,
|
2023-08-09 12:26:13 +00:00
|
|
|
align: 'center',
|
2023-08-08 12:24:51 +00:00
|
|
|
sortable: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'ticketFk',
|
|
|
|
label: t('route.cmr.list.ticketFk'),
|
|
|
|
field: (row) => row.ticketFk,
|
|
|
|
sortable: true,
|
|
|
|
},
|
2023-09-01 10:11:56 +00:00
|
|
|
{
|
|
|
|
name: 'routeFkFk',
|
|
|
|
label: t('route.cmr.list.routeFk'),
|
|
|
|
field: (row) => row.routeFk,
|
|
|
|
sortable: true,
|
|
|
|
},
|
2023-08-08 12:24:51 +00:00
|
|
|
{
|
|
|
|
name: 'clientFk',
|
|
|
|
label: t('route.cmr.list.clientFk'),
|
|
|
|
field: (row) => row.clientFk,
|
|
|
|
sortable: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'country',
|
|
|
|
label: t('route.cmr.list.country'),
|
|
|
|
field: (row) => row.country,
|
2023-08-09 12:26:13 +00:00
|
|
|
align: 'left',
|
2023-08-08 12:24:51 +00:00
|
|
|
sortable: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'shipped',
|
|
|
|
label: t('route.cmr.list.shipped'),
|
|
|
|
field: (row) => toDate(row.shipped),
|
2023-08-09 12:26:13 +00:00
|
|
|
align: 'center',
|
2023-08-08 12:24:51 +00:00
|
|
|
sortable: true,
|
|
|
|
},
|
2024-06-03 14:30:59 +00:00
|
|
|
{
|
|
|
|
name: 'warehouseFk',
|
|
|
|
label: t('globals.warehouse'),
|
|
|
|
field: ({ warehouseFk }) => warehouseFk,
|
|
|
|
align: 'center',
|
|
|
|
sortable: true,
|
|
|
|
},
|
2023-08-30 10:53:18 +00:00
|
|
|
{
|
|
|
|
name: 'icons',
|
|
|
|
align: 'center',
|
|
|
|
field: (row) => row.cmrFk,
|
|
|
|
},
|
2023-08-08 12:24:51 +00:00
|
|
|
]);
|
2024-06-17 08:46:51 +00:00
|
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
|
|
const { data } = await axios.get('Warehouses');
|
|
|
|
warehouses.value = data;
|
|
|
|
});
|
2024-06-21 08:47:09 +00:00
|
|
|
|
|
|
|
onMounted(() => (state.rightDrawer = true));
|
|
|
|
|
2023-09-01 10:11:56 +00:00
|
|
|
function getApiUrl() {
|
2023-08-10 12:10:57 +00:00
|
|
|
return new URL(window.location).origin;
|
|
|
|
}
|
2023-09-01 10:11:56 +00:00
|
|
|
function getCmrUrl(value) {
|
|
|
|
return `${getApiUrl()}/api/Routes/${value}/cmr?access_token=${token}`;
|
|
|
|
}
|
|
|
|
function downloadPdfs() {
|
|
|
|
if (!selected.value.length) {
|
|
|
|
Notify.create({
|
|
|
|
message: t('globals.noSelectedRows'),
|
|
|
|
type: 'warning',
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let cmrs = [];
|
|
|
|
for (let value of selected.value) cmrs.push(value.cmrFk);
|
|
|
|
// prettier-ignore
|
|
|
|
return window.open(`${getApiUrl()}/api/Routes/downloadCmrsZip?ids=${cmrs.join(',')}&access_token=${token}`);
|
2023-08-30 10:53:18 +00:00
|
|
|
}
|
2023-08-08 12:24:51 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
2024-07-03 07:33:04 +00:00
|
|
|
<VnTable
|
|
|
|
ref="tableRef"
|
|
|
|
data-key="CmrList"
|
|
|
|
url="Routes/cmrs"
|
|
|
|
order="cmrFk DESC"
|
|
|
|
:columns="columns"
|
|
|
|
:right-search="true"
|
|
|
|
:use-model="true"
|
|
|
|
/>
|
2023-08-08 12:24:51 +00:00
|
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.list {
|
|
|
|
padding-top: 15px;
|
|
|
|
padding-bottom: 15px;
|
2023-09-01 10:11:56 +00:00
|
|
|
max-width: 1000px;
|
2023-08-08 12:24:51 +00:00
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.grid-style-transition {
|
|
|
|
transition: transform 0.28s, background-color 0.28s;
|
|
|
|
}
|
|
|
|
#true {
|
2023-08-09 10:02:15 +00:00
|
|
|
background-color: $positive;
|
2023-08-08 12:24:51 +00:00
|
|
|
}
|
|
|
|
#false {
|
2023-08-09 10:02:15 +00:00
|
|
|
background-color: $negative;
|
2023-08-08 12:24:51 +00:00
|
|
|
}
|
2024-06-17 08:46:51 +00:00
|
|
|
:deep(.q-table th) {
|
|
|
|
max-width: 80px;
|
|
|
|
}
|
|
|
|
:deep(.q-table th:nth-child(3)) {
|
|
|
|
max-width: 100px;
|
|
|
|
}
|
2023-08-10 12:10:57 +00:00
|
|
|
</style>
|