salix-front/src/pages/Route/Cmr/CmrList.vue

130 lines
3.9 KiB
Vue
Raw Normal View History

<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'components/ui/VnPaginate.vue';
import { useSession } from 'src/composables/useSession';
import { toDate } from 'filters/index';
import CmrFilter from './CmrFilter.vue';
const stateStore = useStateStore();
const { t } = useI18n();
const session = useSession();
2023-08-09 12:26:13 +00:00
const token = session.getToken();
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',
sortable: true,
2023-08-10 05:49:57 +00:00
headerStyle: 'padding-left: 35px',
},
{
name: 'ticketFk',
label: t('route.cmr.list.ticketFk'),
field: (row) => row.ticketFk,
sortable: true,
},
{
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',
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',
sortable: true,
2023-08-10 05:49:57 +00:00
headerStyle: 'padding-left: 33px',
},
]);
2023-08-10 05:49:57 +00:00
function getProjectUrl() {
return ((new URL(window.location)).origin);
};
</script>
<template>
<div class="column items-center">
<div class="list">
<VnPaginate
data-key="CmrList"
:url="`Routes/getExternalCmrs`"
order="cmrFk DESC"
limit="null"
auto-load
>
<template #body="{ rows }">
<QTable
2023-08-10 05:49:57 +00:00
:columns="columns"
:rows="rows"
:dense="$q.screen.lt.md"
:pagination="{ rowsPerPage: null }"
hide-pagination
:grid="$q.screen.lt.md"
auto-load
>
2023-08-09 12:26:13 +00:00
<template #top>
2023-08-09 10:02:15 +00:00
{{ t('route.cmr.list.total', [rows.length]) }}
</template>
<template #body-cell-cmrFk="{ value }">
<QTd align="right" class="text-primary">
2023-08-10 05:49:57 +00:00
<a :href="`${getProjectUrl()}/api/Routes/${value}/cmr?access_token=${token}`" target="_blank">
<span class="text-primary">{{ value }}</span>
</a>
</QTd>
</template>
<template #body-cell-hasCmrDms="{ value }">
2023-08-09 10:02:15 +00:00
<QTd align="center">
2023-08-10 05:49:57 +00:00
<QBadge
:id="(value) ? 'true' : 'false'"
:label="(value)
? t('route.cmr.list.true')
: t('route.cmr.list.false')"
/>
</QTd>
</template>
</QTable>
</template>
</VnPaginate>
</div>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<CmrFilter data-key="CmrList" />
</QScrollArea>
</QDrawer>
</div>
</template>
<style lang="scss" scoped>
.list {
padding-top: 15px;
padding-bottom: 15px;
max-width: 900px;
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;
}
#false {
2023-08-09 10:02:15 +00:00
background-color: $negative;
}
2023-08-10 05:49:57 +00:00
</style>