129 lines
5.5 KiB
Vue
129 lines
5.5 KiB
Vue
<script setup>
|
|
import { useI18n } from 'vue-i18n';
|
|
import { onMounted, onUnmounted } from 'vue';
|
|
import { useRouter } from 'vue-router';
|
|
import { useStateStore } from 'stores/useStateStore';
|
|
import { toCurrency, toDate } from 'src/filters';
|
|
import CardList from 'components/ui/CardList.vue';
|
|
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
|
|
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
|
import VnLv from 'components/ui/VnLv.vue';
|
|
import OrderSearchbar from 'pages/Order/Card/OrderSearchbar.vue';
|
|
import OrderFilter from 'pages/Order/Card/OrderFilter.vue';
|
|
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
|
|
const stateStore = useStateStore();
|
|
const router = useRouter();
|
|
const { t } = useI18n();
|
|
const { viewSummary } = useSummaryDialog();
|
|
|
|
onMounted(() => (stateStore.rightDrawer = true));
|
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
|
|
function navigate(id) {
|
|
router.push({ path: `/order/${id}` });
|
|
}
|
|
</script>
|
|
<template>
|
|
<OrderSearchbar />
|
|
<RightMenu>
|
|
<template #right-panel>
|
|
<OrderFilter data-key="OrderList" />
|
|
</template>
|
|
</RightMenu>
|
|
<QPage class="column items-center q-pa-md">
|
|
<div class="vn-card-list">
|
|
<VnPaginate
|
|
data-key="OrderList"
|
|
url="Orders/filter"
|
|
:limit="20"
|
|
:order="['landed DESC', 'clientFk', 'id DESC']"
|
|
:user-params="{ showEmpty: false }"
|
|
:keep-opts="['userParams']"
|
|
auto-load
|
|
>
|
|
<template #body="{ rows }">
|
|
<CardList
|
|
v-for="row of rows"
|
|
:key="row.id"
|
|
:id="row.id"
|
|
:title="`${row?.clientName} (${row?.clientFk})`"
|
|
@click="navigate(row.id)"
|
|
>
|
|
<template #list-items>
|
|
<VnLv
|
|
:label="t('order.field.salesPersonFk')"
|
|
:title-label="t('order.field.salesPersonFk')"
|
|
>
|
|
<template #value>
|
|
<span class="link" @click.stop>
|
|
{{ row?.name || '-' }}
|
|
<WorkerDescriptorProxy :id="row?.salesPersonFk" />
|
|
</span>
|
|
</template>
|
|
</VnLv>
|
|
<VnLv
|
|
:label="t('order.field.clientFk')"
|
|
:title-label="t('order.field.clientFk')"
|
|
>
|
|
<template #value>
|
|
<span class="link" @click.stop>
|
|
{{ row?.clientName || '-' }}
|
|
<CustomerDescriptorProxy :id="row?.clientFk" />
|
|
</span>
|
|
</template>
|
|
</VnLv>
|
|
<VnLv
|
|
:label="t('order.field.isConfirmed')"
|
|
:value="row?.isConfirmed === 1"
|
|
/>
|
|
<VnLv
|
|
:label="t('order.field.created')"
|
|
:value="toDate(row?.created)"
|
|
/>
|
|
<VnLv :label="t('order.field.landed')">
|
|
<template #value>
|
|
<QBadge text-color="black" color="positive" dense>
|
|
{{ toDate(row?.landed) }}
|
|
</QBadge>
|
|
</template>
|
|
</VnLv>
|
|
<VnLv
|
|
:label="t('order.field.hour')"
|
|
:value="row.hourTheoretical || row.hourEffective"
|
|
/>
|
|
<VnLv
|
|
:label="t('order.field.agency')"
|
|
:value="row?.agencyName"
|
|
/>
|
|
<VnLv
|
|
:label="t('order.field.total')"
|
|
:value="toCurrency(row?.total)"
|
|
/>
|
|
</template>
|
|
<template #actions>
|
|
<QBtn
|
|
:label="t('components.smartCard.openSummary')"
|
|
@click.stop="viewSummary(row.id, OrderSummary)"
|
|
color="primary"
|
|
style="margin-top: 15px"
|
|
/>
|
|
</template>
|
|
</CardList>
|
|
</template>
|
|
</VnPaginate>
|
|
</div>
|
|
<QPageSticky :offset="[20, 20]">
|
|
<RouterLink :to="{ name: 'OrderCreate' }">
|
|
<QBtn fab icon="add" color="primary" />
|
|
<QTooltip>
|
|
{{ t('order.list.newOrder') }}
|
|
</QTooltip>
|
|
</RouterLink>
|
|
</QPageSticky>
|
|
</QPage>
|
|
</template>
|