115 lines
4.5 KiB
Vue
115 lines
4.5 KiB
Vue
<script setup>
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useRouter } from 'vue-router';
|
|
import { useStateStore } from 'stores/useStateStore';
|
|
import { toDate } from 'filters/index';
|
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
import AccountFilter from './AccountFilter.vue';
|
|
import VnLv from 'src/components/ui/VnLv.vue';
|
|
import CardList from 'src/components/ui/CardList.vue';
|
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
|
import AccountSummary from './Card/AccountSummary.vue';
|
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
|
|
|
const stateStore = useStateStore();
|
|
const router = useRouter();
|
|
const { t } = useI18n();
|
|
const { viewSummary } = useSummaryDialog();
|
|
|
|
const STATE_COLOR = {
|
|
pending: 'warning',
|
|
managed: 'info',
|
|
resolved: 'positive',
|
|
};
|
|
function getApiUrl() {
|
|
return new URL(window.location).origin;
|
|
}
|
|
function stateColor(code) {
|
|
return STATE_COLOR[code];
|
|
}
|
|
function navigate(event, id) {
|
|
if (event.ctrlKey || event.metaKey)
|
|
return window.open(`${getApiUrl()}/#/account/${id}/summary`);
|
|
router.push({ path: `/account/${id}` });
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
|
<QScrollArea class="fit text-grey-8">
|
|
<AccountFilter data-key="AccountList" />
|
|
</QScrollArea>
|
|
</QDrawer>
|
|
<QPage class="column items-center q-pa-md">
|
|
<div class="vn-card-list">
|
|
<VnPaginate
|
|
data-key="AccountList"
|
|
url="Accounts/filter"
|
|
:order="['priority ASC', 'created DESC']"
|
|
auto-load
|
|
>
|
|
<template #body="{ rows }">
|
|
<CardList
|
|
:id="row.id"
|
|
:key="row.id"
|
|
:title="row.clientName"
|
|
@click="navigate($event, row.id)"
|
|
v-for="row of rows"
|
|
>
|
|
<template #list-items>
|
|
<VnLv :label="t('account.list.customer')">
|
|
<template #value>
|
|
<span class="link" @click.stop>
|
|
{{ row.clientName }}
|
|
</span>
|
|
</template>
|
|
</VnLv>
|
|
<VnLv :label="t('account.list.assignedTo')">
|
|
<template #value>
|
|
<span @click.stop>
|
|
<VnUserLink
|
|
:name="row.workerName"
|
|
:worker-id="row.workerFk"
|
|
/>
|
|
</span>
|
|
</template>
|
|
</VnLv>
|
|
<VnLv
|
|
:label="t('account.list.created')"
|
|
:value="toDate(row.created)"
|
|
/>
|
|
<VnLv :label="t('account.list.state')">
|
|
<template #value>
|
|
<QBadge
|
|
text-color="black"
|
|
:color="stateColor(row.stateCode)"
|
|
dense
|
|
>
|
|
{{ row.stateDescription }}
|
|
</QBadge>
|
|
</template>
|
|
</VnLv>
|
|
</template>
|
|
<template #actions>
|
|
<QBtn
|
|
:label="t('globals.description')"
|
|
@click.stop
|
|
outline
|
|
style="margin-top: 15px"
|
|
>
|
|
<CustomerDescriptorProxy :id="row.clientFk" />
|
|
</QBtn>
|
|
<QBtn
|
|
:label="t('components.smartCard.openSummary')"
|
|
@click.stop="viewSummary(row.id, AccountSummary)"
|
|
color="primary"
|
|
style="margin-top: 15px"
|
|
/>
|
|
</template>
|
|
</CardList>
|
|
</template>
|
|
</VnPaginate>
|
|
</div>
|
|
</QPage>
|
|
</template>
|