fix: refs #6346 fix list and create #404

Merged
jon merged 15 commits from 6346-fixWagonModule into dev 2024-09-13 06:16:05 +00:00
72 changed files with 818 additions and 1294 deletions
Showing only changes of commit 8ceee6f182 - Show all commits

View File

@ -35,7 +35,9 @@ function stopEventPropagation(event) {
dense dense
square square
> >
<span v-if="!col.chip.icon">{{ row[col.name] }}</span> <span v-if="!col.chip.icon">
{{ col.format ? col.format(row) : row[col.name] }}
</span>
<QIcon v-else :name="col.chip.icon" color="primary-light" /> <QIcon v-else :name="col.chip.icon" color="primary-light" />
</QChip> </QChip>
</span> </span>

View File

@ -147,7 +147,7 @@ const col = computed(() => {
} }
if ( if (
(newColumn.name.startsWith('is') || newColumn.name.startsWith('has')) && (newColumn.name.startsWith('is') || newColumn.name.startsWith('has')) &&
!newColumn.component newColumn.component == null
) )
newColumn.component = 'checkbox'; newColumn.component = 'checkbox';
if ($props.default && !newColumn.component) newColumn.component = $props.default; if ($props.default && !newColumn.component) newColumn.component = $props.default;

View File

@ -75,6 +75,7 @@ const components = {
attrs: { attrs: {
...defaultAttrs, ...defaultAttrs,
clearable: true, clearable: true,
type: 'number',
}, },
forceAttrs, forceAttrs,
}, },

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
const model = defineModel({ type: Object, required: true }); const model = defineModel({ type: Object });
const $props = defineProps({ const $props = defineProps({
name: { name: {
type: String, type: String,
@ -56,7 +56,7 @@ defineExpose({ orderBy });
<span :title="label">{{ label }}</span> <span :title="label">{{ label }}</span>
<QChip <QChip
v-if="name" v-if="name"
:label="!vertical && model?.index" :label="!vertical ? model?.index : ''"
:icon=" :icon="
(model?.index || hover) && !vertical (model?.index || hover) && !vertical
? model?.direction == 'DESC' ? model?.direction == 'DESC'

View File

@ -37,6 +37,10 @@ const $props = defineProps({
type: [Function, Boolean], type: [Function, Boolean],
default: null, default: null,
}, },
rowCtrlClick: {
type: [Function, Boolean],
default: null,
},
redirect: { redirect: {
type: String, type: String,
default: null, default: null,
@ -92,9 +96,9 @@ const route = useRoute();
const router = useRouter(); const router = useRouter();
const quasar = useQuasar(); const quasar = useQuasar();
const DEFAULT_MODE = 'card'; const CARD_MODE = 'card';
const TABLE_MODE = 'table'; const TABLE_MODE = 'table';
const mode = ref(DEFAULT_MODE); const mode = ref(CARD_MODE);
const selected = ref([]); const selected = ref([]);
const hasParams = ref(false); const hasParams = ref(false);
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}'); const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
@ -114,7 +118,7 @@ const tableModes = [
{ {
icon: 'grid_view', icon: 'grid_view',
title: t('grid view'), title: t('grid view'),
value: DEFAULT_MODE, value: CARD_MODE,
disable: $props.disableOption?.card, disable: $props.disableOption?.card,
}, },
]; ];
@ -124,7 +128,10 @@ onBeforeMount(() => {
}); });
onMounted(() => { onMounted(() => {
mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode; mode.value =
quasar.platform.is.mobile && !$props.disableOption?.card
? CARD_MODE
: $props.defaultMode;
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
columnsVisibilitySkiped.value = [ columnsVisibilitySkiped.value = [
...splittedColumns.value.columns ...splittedColumns.value.columns
@ -171,13 +178,17 @@ function splitColumns(columns) {
}; };
for (const col of columns) { for (const col of columns) {
if (col.name == 'tableActions') splittedColumns.value.actions = col; if (col.name == 'tableActions') {
col.orderBy = false;
splittedColumns.value.actions = col;
}
if (col.chip) splittedColumns.value.chips.push(col); if (col.chip) splittedColumns.value.chips.push(col);
if (col.isTitle) splittedColumns.value.title = col; if (col.isTitle) splittedColumns.value.title = col;
if (col.create) splittedColumns.value.create.push(col); if (col.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.cardVisible.push(col); if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false; if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true }; if ($props.useModel && col.columnFilter != false)
col.columnFilter = { ...col.columnFilter, inWhere: true };
splittedColumns.value.columns.push(col); splittedColumns.value.columns.push(col);
} }
// Status column // Status column
@ -202,6 +213,16 @@ const rowClickFunction = computed(() => {
return () => {}; return () => {};
}); });
const rowCtrlClickFunction = computed(() => {
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
if ($props.redirect)
return (evt, { id }) => {
stopEventPropagation(evt);
window.open(`/#/${$props.redirect}/${id}`, '_blank');
};
return () => {};
});
function redirectFn(id) { function redirectFn(id) {
router.push({ path: `/${$props.redirect}/${id}` }); router.push({ path: `/${$props.redirect}/${id}` });
} }
@ -212,6 +233,7 @@ function stopEventPropagation(event) {
} }
function reload(params) { function reload(params) {
selected.value = [];
CrudModelRef.value.reload(params); CrudModelRef.value.reload(params);
} }
@ -263,7 +285,9 @@ defineExpose({
<template #body> <template #body>
<div <div
class="row no-wrap flex-center" class="row no-wrap flex-center"
v-for="col of splittedColumns.columns" v-for="col of splittedColumns.columns.filter(
(c) => c.columnFilter ?? true
)"
:key="col.id" :key="col.id"
> >
<VnTableFilter <VnTableFilter
@ -273,6 +297,10 @@ defineExpose({
:search-url="searchUrl" :search-url="searchUrl"
/> />
<VnTableOrder <VnTableOrder
v-if="
col?.columnFilter !== false &&
col?.name !== 'tableActions'
"
v-model="orders[col.name]" v-model="orders[col.name]"
:name="col.orderBy ?? col.name" :name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"
@ -361,7 +389,7 @@ defineExpose({
/> />
</template> </template>
<template #header-cell="{ col }"> <template #header-cell="{ col }">
<QTh v-if="col.visible ?? true" auto-width> <QTh v-if="col.visible ?? true">
<div <div
class="column self-start q-ml-xs ellipsis" class="column self-start q-ml-xs ellipsis"
:class="`text-${col?.align ?? 'left'}`" :class="`text-${col?.align ?? 'left'}`"
@ -386,6 +414,7 @@ defineExpose({
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"
v-model="params[columnName(col)]" v-model="params[columnName(col)]"
:search-url="searchUrl" :search-url="searchUrl"
class="full-width"
/> />
</div> </div>
</QTh> </QTh>
@ -410,8 +439,13 @@ defineExpose({
<QTd <QTd
auto-width auto-width
class="no-margin q-px-xs" class="no-margin q-px-xs"
:class="[getColAlign(col), col.class, col.columnField?.class]" :class="[getColAlign(col), col.columnClass]"
v-if="col.visible ?? true" v-if="col.visible ?? true"
@click.ctrl="
($event) =>
rowCtrlClickFunction &&
rowCtrlClickFunction($event, row)
"
> >
<slot :name="`column-${col.name}`" :col="col" :row="row"> <slot :name="`column-${col.name}`" :col="col" :row="row">
<VnTableColumn <VnTableColumn
@ -433,6 +467,7 @@ defineExpose({
> >
<QBtn <QBtn
v-for="(btn, index) of col.actions" v-for="(btn, index) of col.actions"
v-show="btn.show ? btn.show(row) : true"
:key="index" :key="index"
:title="btn.title" :title="btn.title"
:icon="btn.icon" :icon="btn.icon"

View File

@ -17,15 +17,17 @@ const $props = defineProps({
}, },
}); });
let mixed;
const componentArray = computed(() => { const componentArray = computed(() => {
if (typeof $props.prop === 'object') return [$props.prop]; if (typeof $props.prop === 'object') return [$props.prop];
return $props.prop; return $props.prop;
}); });
function mix(toComponent) { function mix(toComponent) {
if (mixed) return mixed;
const { component, attrs, event } = toComponent; const { component, attrs, event } = toComponent;
const customComponent = $props.components[component]; const customComponent = $props.components[component];
return { mixed = {
component: customComponent?.component ?? component, component: customComponent?.component ?? component,
attrs: { attrs: {
...toValueAttrs(attrs), ...toValueAttrs(attrs),
@ -35,6 +37,7 @@ function mix(toComponent) {
}, },
event: event ?? customComponent?.event, event: event ?? customComponent?.event,
}; };
return mixed;
} }
function toValueAttrs(attrs) { function toValueAttrs(attrs) {

View File

@ -1,8 +1,16 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import { onMounted } from 'vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const $props = defineProps({
leftDrawer: {
type: Boolean,
default: true,
},
});
onMounted(() => (stateStore.leftDrawer = $props.leftDrawer));
</script> </script>
<template> <template>

View File

@ -27,7 +27,7 @@ const $props = defineProps({
}, },
url: { url: {
type: String, type: String,
default: '', default: null,
}, },
filterOptions: { filterOptions: {
type: [Array], type: [Array],
@ -113,7 +113,7 @@ function setOptions(data) {
} }
function filter(val, options) { function filter(val, options) {
const search = val.toString().toLowerCase(); const search = val?.toString()?.toLowerCase();
if (!search) return options; if (!search) return options;

View File

@ -1,18 +1,28 @@
<script setup>
defineProps({ wrap: { type: Boolean, default: false } });
</script>
<template> <template>
<div class="vn-row q-gutter-md q-mb-md"> <div class="vn-row q-gutter-md q-mb-md" :class="{ wrap }">
<slot></slot> <slot />
</div> </div>
</template> </template>
<style lang="scss" scopped> <style lang="scss" scoped>
.vn-row { .vn-row {
display: flex; display: flex;
> * { &.wrap {
flex: 1; flex-wrap: wrap;
}
&:not(.wrap) {
> :slotted(*) {
flex: 1;
}
} }
} }
@media screen and (max-width: 800px) { @media screen and (max-width: 800px) {
.vn-row { .vn-row {
flex-direction: column; &:not(.wrap) {
flex-direction: column;
}
} }
} }
</style> </style>

View File

@ -233,27 +233,23 @@ input::-webkit-inner-spin-button {
} }
.q-table { .q-table {
thead, th,
tbody { td {
th { padding: 1px 10px 1px 10px;
.q-select { max-width: 100px;
max-width: 120px; div span {
}
}
td {
padding: 1px 10px 1px 10px;
max-width: 100px;
div span {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.expand { overflow: hidden;
max-width: 400px; white-space: nowrap;
} text-overflow: ellipsis;
}
.shrink {
max-width: 75px;
}
.expand {
max-width: 400px;
} }
} }

View File

@ -44,7 +44,7 @@ const columns = computed(() => [
fields: ['id', 'name'], fields: ['id', 'name'],
}, },
}, },
class: 'expand', columnClass: 'expand',
}, },
{ {
align: 'left', align: 'left',

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,13 +1,14 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue';
import { useStateStore } from 'src/stores/useStateStore';
const { t } = useI18n(); const { t } = useI18n();
</script> </script>
<template> <template>
<h5 class="flex justify-center color-vn-label"> <Teleport to="#right-panel" v-if="useStateStore().isHeaderMounted()">
{{ t('Enter a new search') }} <CustomerConsumptionFilter data-key="CustomerConsumption" />
</h5> </Teleport>
</template> </template>
<i18n> <i18n>

View File

@ -0,0 +1,91 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QItem } from 'quasar';
import VnSelect from 'src/components/common/VnSelect.vue';
import { QItemSection } from 'quasar';
const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } });
</script>
<template>
<VnFilterPanel :data-key="dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput
:label="t('params.item')"
v-model="params.itemId"
is-outlined
lazy-rules
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.buyerId"
url="TicketRequests/getItemTypeWorker"
:label="t('params.buyer')"
option-value="id"
option-label="nickname"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<!--It's required to include the relation category !! There's 413 records in production-->
<QItemSection>
<VnSelect
v-model="params.typeId"
url="ItemTypes"
:label="t('params.type')"
option-label="name"
option-value="id"
dense
outlined
rounded
>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
url="ItemCategories"
:label="t('params.category')"
option-label="name"
option-value="id"
v-model="params.categoryId"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
item: Item id
buyer: Buyer
type: Type
category: Category
es:
params:
item: Id artículo
buyer: Comprador
type: Tipo
category: Categoría
</i18n>

View File

@ -1,20 +1,14 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { QBtn } from 'quasar'; import { QBtn } from 'quasar';
import { toCurrency, toDateHourMin } from 'src/filters'; import { toCurrency, toDateHourMin } from 'src/filters';
import VnTable from 'components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const rows = ref([]);
const filter = { const filter = {
include: [ include: [
@ -26,113 +20,63 @@ const filter = {
}, },
}, },
], ],
where: { clientFk: route.params.id }, where: { clientFk: +route.params.id },
order: ['created DESC'], order: ['created DESC'],
limit: 20, limit: 20,
}; };
const tableColumnComponents = {
created: {
component: 'span',
props: () => {},
event: () => {},
},
employee: {
component: QBtn,
props: () => ({ flat: true, color: 'blue', noCaps: true }),
event: () => {},
},
amount: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
field: 'created',
label: t('Since'),
name: 'created', name: 'created',
format: (value) => toDateHourMin(value), label: t('Since'),
format: ({ created }) => toDateHourMin(created),
}, },
{ {
align: 'left', align: 'left',
field: (value) => value.worker.user.name,
label: t('Employee'), label: t('Employee'),
name: 'employee', name: 'employee',
}, },
{ {
align: 'left', align: 'left',
field: 'amount',
label: t('Credit'), label: t('Credit'),
name: 'amount', name: 'amount',
format: (value) => toCurrency(value), format: ({ amount }) => toCurrency(amount),
}, },
]); ]);
const toCustomerCreditCreate = () => {
router.push({ name: 'CustomerCreditCreate' });
};
</script> </script>
<template> <template>
<FetchData <!-- Column titles are missing -->
:filter="filter" <VnTable
@on-fetch="(data) => (rows = data)" ref="tableRef"
auto-load data-key="ClientCredit"
url="ClientCredits" url="ClientCredits"
/> :filter="filter"
:columns="columns"
<div class="full-width flex justify-center"> default-mode="table"
<QCard class="card-width q-pa-lg"> auto-load
<QTable :right-search="false"
:columns="columns" :is-editable="false"
:pagination="{ rowsPerPage: 12 }" :use-model="true"
:rows="rows" :column-search="false"
class="full-width q-mt-md" :disable-option="{ card: true }"
row-key="id" >
v-if="rows?.length" <template #column-employee="{ row }">
> <VnUserLink :name="row?.worker?.user?.name" :worker-id="row.worker?.id" />
<template #body-cell="props"> </template>
<QTd :props="props"> </VnTable>
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
@click="
tableColumnComponents[props.col.name].event(props)
"
class="rounded-borders q-pa-sm"
v-bind="
tableColumnComponents[props.col.name].props(props)
"
>
{{ props.value }}
<WorkerDescriptorProxy
:id="props.row.workerFk"
v-if="props.col.name === 'employee'"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
</QCard>
</div>
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerCreditCreate()" color="primary" fab icon="add" /> <QBtn
@click.stop="$router.push({ name: 'CustomerCreditCreate' })"
color="primary"
fab
icon="add"
/>
<QTooltip> <QTooltip>
{{ t('New credit') }} {{ t('New credit') }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
</template> </template>
<i18n> <i18n>
es: es:
Since: Desde Since: Desde

View File

@ -9,7 +9,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CustomerSummaryTable from 'src/pages/Customer/components/CustomerSummaryTable.vue'; import CustomerSummaryTable from 'src/pages/Customer/components/CustomerSummaryTable.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
import VnRow from 'src/components/ui/VnRow.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -131,41 +131,33 @@ const creditWarning = computed(() => {
:url="`#/customer/${entityId}/fiscal-data`" :url="`#/customer/${entityId}/fiscal-data`"
:text="t('customer.summary.fiscalData')" :text="t('customer.summary.fiscalData')"
/> />
<QCheckbox <VnRow>
:label="t('customer.summary.isEqualizated')" <VnLv
v-model="entity.isEqualizated" :label="t('customer.summary.isEqualizated')"
:disable="true" :value="entity.isEqualizated"
/> />
<QCheckbox <VnLv
:label="t('customer.summary.isActive')" :label="t('customer.summary.isActive')"
v-model="entity.isActive" :value="entity.isActive"
:disable="true" />
/> </VnRow>
<QCheckbox <VnRow>
:label="t('customer.summary.invoiceByAddress')" <VnLv
v-model="entity.hasToInvoiceByAddress" :label="t('customer.summary.verifiedData')"
:disable="true" :value="entity.isTaxDataChecked"
/> />
<QCheckbox <VnLv
:label="t('customer.summary.verifiedData')" :label="t('customer.summary.hasToInvoice')"
v-model="entity.isTaxDataChecked" :value="entity.hasToInvoice"
:disable="true" />
/> </VnRow>
<QCheckbox <VnRow>
:label="t('customer.summary.hasToInvoice')" <VnLv
v-model="entity.hasToInvoice" :label="t('customer.summary.notifyByEmail')"
:disable="true" :value="entity.isToBeMailed"
/> />
<QCheckbox <VnLv :label="t('customer.summary.vies')" :value="entity.isVies" />
:label="t('customer.summary.notifyByEmail')" </VnRow>
v-model="entity.isToBeMailed"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.vies')"
v-model="entity.isVies"
:disable="true"
/>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle <VnTitle
@ -178,23 +170,18 @@ const creditWarning = computed(() => {
/> />
<VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" /> <VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" />
<VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" /> <VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" />
<QCheckbox <VnRow class="q-mt-sm" wrap>
style="padding: 0" <VnLv :label="t('customer.summary.hasLcr')" :value="entity.hasLcr" />
:label="t('customer.summary.hasLcr')" <VnLv
v-model="entity.hasLcr" :label="t('customer.summary.hasCoreVnl')"
:disable="true" :value="entity.hasCoreVnl"
/> />
<QCheckbox
:label="t('customer.summary.hasCoreVnl')"
v-model="entity.hasCoreVnl"
:disable="true"
/>
<QCheckbox <VnLv
:label="t('customer.summary.hasB2BVnl')" :label="t('customer.summary.hasB2BVnl')"
v-model="entity.hasSepaVnl" :value="entity.hasSepaVnl"
:disable="true" />
/> </VnRow>
</QCard> </QCard>
<QCard class="vn-one" v-if="entity.defaultAddress"> <QCard class="vn-one" v-if="entity.defaultAddress">
<VnTitle <VnTitle

View File

@ -42,9 +42,7 @@ const columns = computed(() => [
name: 'name', name: 'name',
isTitle: true, isTitle: true,
create: true, create: true,
columnField: { columnClass: 'expand',
class: 'expand',
},
}, },
{ {
align: 'left', align: 'left',
@ -52,9 +50,7 @@ const columns = computed(() => [
label: t('customer.extendedList.tableVisibleColumns.socialName'), label: t('customer.extendedList.tableVisibleColumns.socialName'),
isTitle: true, isTitle: true,
create: true, create: true,
columnField: { columnClass: 'expand',
class: 'expand',
},
}, },
{ {
align: 'left', align: 'left',
@ -136,9 +132,7 @@ const columns = computed(() => [
columnFilter: { columnFilter: {
inWhere: true, inWhere: true,
}, },
columnField: { columnClass: 'expand',
class: 'expand',
},
}, },
{ {
align: 'left', align: 'left',

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,9 +1,8 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox, useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { toCurrency, toDate, dateRange } from 'filters/index'; import { toCurrency, toDate, dateRange } from 'filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue'; import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue'; import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
@ -11,8 +10,9 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue'; import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
import axios from 'axios'; import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();
@ -21,175 +21,139 @@ const dataRef = ref(null);
const balanceDueTotal = ref(0); const balanceDueTotal = ref(0);
const selected = ref([]); const selected = ref([]);
const tableColumnComponents = {
clientFk: {
component: QBtn,
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
},
isWorker: {
component: QCheckbox,
props: (prop) => ({
disable: true,
'model-value': Boolean(prop.value),
}),
event: () => {},
},
salesPerson: {
component: QBtn,
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
},
departmentName: {
component: 'span',
props: () => {},
event: () => {},
},
country: {
component: 'span',
props: () => {},
event: () => {},
},
payMethod: {
component: 'span',
props: () => {},
event: () => {},
},
balance: {
component: 'span',
props: () => {},
event: () => {},
},
author: {
component: QBtn,
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
},
lastObservation: {
component: 'span',
props: () => {},
event: () => {},
},
date: {
component: 'span',
props: () => {},
event: () => {},
},
credit: {
component: 'span',
props: () => {},
event: () => {},
},
from: {
component: 'span',
props: () => {},
event: () => {},
},
finished: {
component: QCheckbox,
props: (prop) => ({
disable: true,
'model-value': prop.value,
}),
event: () => {},
},
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
field: 'clientName',
label: t('Client'),
name: 'clientFk', name: 'clientFk',
sortable: true, label: t('Client'),
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
},
},
}, },
{ {
align: 'left', align: 'left',
field: ({ isWorker }) => Boolean(isWorker),
label: t('Is worker'),
name: 'isWorker', name: 'isWorker',
label: t('Is worker'),
}, },
{ {
align: 'left', align: 'left',
field: 'salesPersonName', name: 'salesPersonFk',
label: t('Salesperson'), label: t('Salesperson'),
name: 'salesPerson', columnFilter: {
sortable: true, component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
where: { role: 'salesPerson' },
useLike: false,
optionValue: 'id',
optionLabel: 'name',
optionFilter: 'firstName',
},
},
}, },
{ {
align: 'left', align: 'left',
field: 'departmentName', name: 'departmentFk',
label: t('Department'), label: t('Department'),
name: 'departmentName', columnFilter: {
sortable: true, component: 'select',
attrs: {
url: 'Departments',
fields: ['id', 'name'],
},
},
}, },
{ {
align: 'left', align: 'left',
field: 'country', name: 'countryFk',
label: t('Country'), label: t('Country'),
name: 'country', format: ({ country }) => country,
sortable: true, columnFilter: {
component: 'select',
attrs: {
url: 'Countries',
fields: ['id', 'name'],
},
},
}, },
{ {
align: 'left', align: 'left',
field: 'payMethod',
label: t('P. Method'),
name: 'payMethod', name: 'payMethod',
sortable: true, label: t('P. Method'),
tooltip: t('Pay method'), columnFilter: {
component: 'select',
attrs: {
url: 'Paymethods',
},
},
}, },
{ {
align: 'left', align: 'left',
field: ({ amount }) => toCurrency(amount), name: 'amount',
label: t('Balance D.'), label: t('Balance D.'),
name: 'balance', format: ({ amount }) => toCurrency(amount),
sortable: true,
tooltip: t('Balance due'),
}, },
{ {
align: 'left', align: 'left',
field: 'workerName', name: 'workerFk',
label: t('Author'), label: t('Author'),
name: 'author',
sortable: true,
tooltip: t('Worker who made the last observation'), tooltip: t('Worker who made the last observation'),
columnFilter: {
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
useLike: false,
optionValue: 'id',
optionLabel: 'name',
optionFilter: 'firstName',
},
},
}, },
{ {
align: 'left', align: 'left',
field: 'observation', name: 'observation',
label: t('Last observation'), label: t('Last observation'),
name: 'lastObservation', columnClass: 'expand',
sortable: true,
}, },
{ {
align: 'left', align: 'left',
field: ({ created }) => toDate(created), name: 'created',
label: t('L. O. Date'), label: t('L. O. Date'),
name: 'date', format: ({ created }) => toDate(created),
sortable: true,
tooltip: t('Last observation date'), tooltip: t('Last observation date'),
columnFilter: {
component: 'date',
},
}, },
{ {
align: 'left', align: 'left',
field: ({ creditInsurance }) => toCurrency(creditInsurance), name: 'creditInsurance',
format: ({ creditInsurance }) => toCurrency(creditInsurance),
label: t('Credit I.'), label: t('Credit I.'),
name: 'credit',
sortable: true,
tooltip: t('Credit insurance'), tooltip: t('Credit insurance'),
columnFilter: {
component: 'number',
},
}, },
{ {
align: 'left', align: 'left',
field: ({ defaulterSinced }) => toDate(defaulterSinced), name: 'defaulterSinced',
format: ({ defaulterSinced }) => toDate(defaulterSinced),
label: t('From'), label: t('From'),
name: 'from', columnFilter: {
sortable: true, component: 'date',
},
}, },
{ {
align: 'left', align: 'left',
field: 'finished',
label: t('Has recovery'), label: t('Has recovery'),
name: 'finished', name: 'hasRecovery',
}, },
]); ]);
@ -198,22 +162,12 @@ const viewAddObservation = (rowsSelected) => {
component: CustomerDefaulterAddObservation, component: CustomerDefaulterAddObservation,
componentProps: { componentProps: {
clients: rowsSelected, clients: rowsSelected,
promise: async () => await dataRef.value.fetch(), promise: async () => await dataRef.value.reload(),
}, },
}); });
}; };
const onFetch = async (data) => { const onFetch = async (data) => {
const recoveryData = await axios.get('Recoveries');
const recoveries = recoveryData.data.map(({ clientFk, finished }) => ({
clientFk,
finished,
}));
data.forEach((item) => {
const recovery = recoveries.find(({ clientFk }) => clientFk === item.clientFk);
item.finished = recovery?.finished === null;
});
balanceDueTotal.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0); balanceDueTotal.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
}; };
@ -229,7 +183,7 @@ function exprBuilder(param, value) {
case 'payMethod': case 'payMethod':
case 'salesPersonFk': case 'salesPersonFk':
return { [`d.${param}`]: value }; return { [`d.${param}`]: value };
case 'date': case 'created':
return { 'd.created': { between: dateRange(value) } }; return { 'd.created': { between: dateRange(value) } };
case 'defaulterSinced': case 'defaulterSinced':
return { 'd.defaulterSinced': { between: dateRange(value) } }; return { 'd.defaulterSinced': { between: dateRange(value) } };
@ -246,123 +200,64 @@ function exprBuilder(param, value) {
<VnSubToolbar> <VnSubToolbar>
<template #st-data> <template #st-data>
<CustomerBalanceDueTotal :amount="balanceDueTotal" /> <CustomerBalanceDueTotal :amount="balanceDueTotal" />
<div class="flex items-center q-ml-lg"> </template>
<QBtn <template #st-actions>
color="primary" <QBtn
icon="vn:notes" color="primary"
:disabled="!selected.length" icon="vn:notes"
@click.stop="viewAddObservation(selected)" :disabled="!selected.length"
> @click.stop="viewAddObservation(selected)"
<QTooltip>{{ t('Add observation') }}</QTooltip> >
</QBtn> <QTooltip>{{ t('Add observation') }}</QTooltip>
</div> </QBtn>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<QPage class="column items-center q-pa-md"> <VnTable
<VnPaginate ref="dataRef"
ref="dataRef" data-key="CustomerDefaulter"
@on-fetch="onFetch" url="Defaulters/filter"
data-key="CustomerDefaulter" :expr-builder="exprBuilder"
:filter="filter" :columns="columns"
:expr-builder="exprBuilder" @on-fetch="onFetch"
auto-load :use-model="true"
url="Defaulters/filter" :table="{
> 'row-key': 'clientFk',
<template #body="{ rows }"> selection: 'multiple',
<div class="q-pa-md"> }"
<QTable v-model:selected="selected"
:columns="columns" :disable-option="{ card: true }"
:rows="rows" auto-load
class="full-width" :order="['amount DESC']"
row-key="clientFk" >
selection="multiple" <template #column-clientFk="{ row }">
v-model:selected="selected" <span class="link" @click.stop>
> {{ row.clientName }}
<template #header="props"> <CustomerDescriptorProxy :id="row.clientFk" />
<QTr :props="props" class="bg" style="min-height: 200px"> </span>
<QTh> </template>
<QCheckbox v-model="props.selected" /> <template #column-observation="{ row }">
</QTh> <VnInput type="textarea" v-model="row.observation" readonly dense rows="2" />
<QTh </template>
v-for="col in props.cols" <template #column-salesPersonFk="{ row }">
:key="col.name" <span class="link" @click.stop>
:props="props" {{ row.salesPersonName }}
> <WorkerDescriptorProxy :id="row.salesPersonFk" />
{{ t(col.label) }} </span>
<QTooltip v-if="col.tooltip">{{ </template>
col.tooltip <template #column-departmentFk="{ row }">
}}</QTooltip> <span class="link" @click.stop>
</QTh> {{ row.departmentName }}
</QTr> <DepartmentDescriptorProxy :id="row.departmentFk" />
</template> </span>
</template>
<template #body-cell="props"> <template #column-workerFk="{ row }">
<QTd :props="props"> <span class="link" @click.stop>
<QTr :props="props" class="cursor-pointer"> {{ row.workerName }}
<component <WorkerDescriptorProxy :id="row.workerFk" />
:is=" </span>
tableColumnComponents[props.col.name] </template>
.component </VnTable>
"
class="col-content"
v-bind="
tableColumnComponents[props.col.name].props(
props
)
"
@click="
tableColumnComponents[props.col.name].event(
props
)
"
>
<template v-if="typeof props.value !== 'boolean'">
<div
v-if="
props.col.name === 'lastObservation'
"
>
<VnInput
type="textarea"
v-model="props.value"
readonly
dense
rows="2"
/>
</div>
<div v-else>{{ props.value }}</div>
</template>
<WorkerDescriptorProxy
:id="props.row.salesPersonFk"
v-if="props.col.name === 'salesPerson'"
/>
<WorkerDescriptorProxy
:id="props.row.workerFk"
v-if="props.col.name === 'author'"
/>
<CustomerDescriptorProxy
:id="props.row.clientFk"
v-if="props.col.name === 'client'"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</QPage>
</template> </template>
<style lang="scss" scoped>
.col-content {
border-radius: 4px;
padding: 6px;
}
</style>
<i18n> <i18n>
es: es:
Add observation: Añadir observación Add observation: Añadir observación

View File

@ -1,92 +1,92 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn } from 'quasar';
import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CustomerNotificationsCampaignConsumption from './CustomerNotificationsCampaignConsumption.vue'; import CustomerNotificationsCampaignConsumption from './CustomerNotificationsCampaignConsumption.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n(); const { t } = useI18n();
const dataKey = 'CustomerNotifications';
const selected = ref([]); const selected = ref([]);
const selectedCustomerId = ref(0);
const tableColumnComponents = {
id: {
component: QBtn,
props: () => ({ flat: true, color: 'blue' }),
event: (prop) => selectCustomerId(prop.row.id),
},
socialName: {
component: 'span',
props: () => {},
event: () => {},
},
city: {
component: 'span',
props: () => {},
event: () => {},
},
phone: {
component: 'span',
props: () => {},
event: () => {},
},
email: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
field: 'id',
label: t('Identifier'), label: t('Identifier'),
name: 'id', name: 'id',
columnClass: 'shrink',
}, },
{ {
align: 'left', align: 'left',
field: 'socialName',
label: t('Social name'), label: t('Social name'),
name: 'socialName', name: 'socialName',
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'socialName'],
optionLabel: 'socialName',
},
},
columnClass: 'expand',
isTitle: true,
}, },
{ {
align: 'left', align: 'left',
field: 'city',
label: t('City'), label: t('City'),
name: 'city', name: 'city',
columnFilter: {
component: 'select',
attrs: {
url: 'Towns',
},
},
cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
field: 'phone',
label: t('Phone'), label: t('Phone'),
name: 'phone', name: 'phone',
cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
field: 'email',
label: t('Email'), label: t('Email'),
name: 'email', name: 'email',
cardVisible: true,
},
{
align: 'left',
name: 'fi',
label: t('Fi'),
visible: false,
},
{
align: 'left',
name: 'postcode',
label: t('Postcode'),
visible: false,
},
{
align: 'left',
label: t('customer.extendedList.tableVisibleColumns.salesPersonFk'),
name: 'salesPersonFk',
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
where: { role: 'salesPerson' },
optionFilter: 'firstName',
useLike: false,
},
visible: false,
}, },
]); ]);
const selectCustomerId = (id) => {
selectedCustomerId.value = id;
};
</script> </script>
<template> <template>
<RightMenu>
<template #right-panel>
<CustomerNotificationsFilter data-key="CustomerNotifications" />
</template>
</RightMenu>
<VnSubToolbar class="justify-end"> <VnSubToolbar class="justify-end">
<template #st-data> <template #st-actions>
<CustomerNotificationsCampaignConsumption <CustomerNotificationsCampaignConsumption
:selected-rows="selected.length > 0" :selected-rows="selected.length > 0"
:clients="selected" :clients="selected"
@ -94,51 +94,26 @@ const selectCustomerId = (id) => {
/> />
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<QPage class="column items-center q-pa-md"> <VnTable
<VnPaginate data-key="CustomerNotifications" url="Clients" auto-load> :data-key="dataKey"
<template #body="{ rows }"> url="Clients"
<div class="q-pa-md"> :table="{
<QTable 'row-key': 'id',
:columns="columns" selection: 'multiple',
:rows="rows" }"
class="full-width q-mt-md" v-model:selected="selected"
row-key="id" :right-search="true"
selection="multiple" :columns="columns"
v-model:selected="selected" :use-model="true"
> auto-load
<template #body-cell="props"> >
<QTd :props="props"> <template #column-id="{ row }">
<QTr :props="props" class="cursor-pointer"> <span class="link">
<component {{ row.id }}
:is=" <CustomerDescriptorProxy :id="row.id" />
tableColumnComponents[props.col.name] </span>
.component </template>
" </VnTable>
class="col-content"
v-bind="
tableColumnComponents[props.col.name].props(
props
)
"
@click="
tableColumnComponents[props.col.name].event(
props
)
"
>
{{ props.value }}
<CustomerDescriptorProxy
:id="selectedCustomerId"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</QPage>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,145 +0,0 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'components/common/VnSelect.vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const cities = ref();
const clients = ref();
</script>
<template>
<FetchData
:filter="{ where: { role: 'socialName' } }"
@on-fetch="(data) => (clients = data)"
auto-load
url="Clients"
/>
<FetchData @on-fetch="(data) => (cities = data)" auto-load url="Towns" />
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem class="q-mb-sm q-mt-sm">
<QItemSection>
<VnInput
:label="t('Identifier')"
clearable
is-outlined
v-model="params.identifier"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="!clients">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="clients">
<VnSelect
:input-debounce="0"
:label="t('Social name')"
:options="clients"
@update:model-value="searchFn()"
dense
emit-value
hide-selected
map-options
option-label="socialName"
option-value="socialName"
outlined
rounded
use-input
v-model="params.socialName"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="!cities">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="cities">
<VnSelect
:input-debounce="0"
:label="t('City')"
:options="cities"
@update:model-value="searchFn()"
dense
emit-value
hide-selected
map-options
option-label="name"
option-value="name"
outlined
rounded
use-input
v-model="params.city"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Phone')"
clearable
is-outlined
v-model="params.phone"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Email')"
clearable
is-outlined
type="email"
v-model="params.email"
/>
</QItemSection>
</QItem>
<QSeparator />
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
identifier: Identifier
socialName: Social name
city: City
phone: Phone
email: Email
es:
params:
identifier: Identificador
socialName: Razón social
city: Población
phone: Teléfono
email: Email
Identifier: Identificador
Social name: Razón social
City: Población
Phone: Teléfono
Email: Email
</i18n>

View File

@ -1,19 +1,18 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { ref, computed } from 'vue'; import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useArrayData } from 'composables/useArrayData'; import { toDate, toCurrency } from 'filters/index';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import { toDate, toCurrency } from 'filters/index';
import CustomerPaymentsFilter from './CustomerPaymentsFilter.vue'; import CustomerPaymentsFilter from './CustomerPaymentsFilter.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const arrayData = useArrayData('CustomerTransactions');
async function confirm(transaction) { async function confirm(transaction) {
quasar quasar
@ -36,59 +35,73 @@ async function confirmTransaction({ id }) {
}); });
} }
const grid = ref(false);
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'id', name: 'id',
label: t('Transaction ID'), label: t('Transaction ID'),
field: (row) => row.id, isTitle: true,
sortable: true,
},
{
name: 'customerId',
label: t('Customer ID'),
field: (row) => row.clientFk,
align: 'right',
sortable: true,
},
{
name: 'customer',
label: t('Customer Name'),
field: (row) => row.customerName,
},
{
name: 'state',
label: t('State'),
field: (row) => row.isConfirmed,
format: (value) => (value ? t('Confirmed') : t('Unconfirmed')),
align: 'left', align: 'left',
sortable: true, columnFilter: {
inWhere: true,
alias: 't',
},
columnClass: 'shrink',
}, },
{ {
name: 'dated', align: 'left',
name: 'clientFk',
label: t('Customer'),
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
},
},
columnClass: 'expand',
cardVisible: true,
},
{
name: 'isConfirmed',
label: t('State'),
align: 'left',
format: ({ isConfirmed }) => (isConfirmed ? t('Confirmed') : t('Unconfirmed')),
chip: {
condition: () => true,
color: ({ isConfirmed }) => (isConfirmed ? 'bg-positive' : 'bg-primary'),
},
visible: false,
},
{
name: 'created',
label: t('Dated'), label: t('Dated'),
field: (row) => toDate(row.created), format: ({ created }) => toDate(created),
sortable: true, columnFilter: false,
cardVisible: true,
}, },
{ {
name: 'amount', name: 'amount',
label: t('Amount'), label: t('Amount'),
field: (row) => row.amount, format: ({ amount }) => toCurrency(amount),
format: (value) => toCurrency(value), columnFilter: {
sortable: true, component: 'number',
},
cardVisible: true,
}, },
{ {
name: 'actions', align: 'right',
label: t('Actions'), name: 'tableActions',
grid: false, actions: [
{
title: t('Confirm transaction'),
icon: 'check',
action: (row) => confirm(row),
show: ({ isConfirmed }) => !isConfirmed,
isPrimary: true,
},
],
}, },
]); ]);
const isLoading = computed(() => arrayData.isLoading.value);
function stateColor(row) {
if (row.isConfirmed) return 'positive';
return 'primary';
}
</script> </script>
<template> <template>
@ -97,158 +110,22 @@ function stateColor(row) {
<CustomerPaymentsFilter data-key="CustomerTransactions" /> <CustomerPaymentsFilter data-key="CustomerTransactions" />
</template> </template>
</RightMenu> </RightMenu>
<QPage class="column items-center q-pa-md customer-payments"> <VnTable
<div class="vn-card-list"> data-key="CustomerTransactions"
<QToolbar class="q-pa-none justify-end"> url="Clients/transactions"
<QBtn order="created DESC"
@click="arrayData.refresh()" :columns="columns"
:loading="isLoading" :right-search="false"
icon="refresh" auto-load
color="primary" >
class="q-mr-sm" <template #column-clientFk="{ row }">
round <span class="link">
dense {{ row.clientFk }} -
/> {{ row.customerName }}
<QBtn @click="grid = !grid" icon="list" color="primary" round dense> <CustomerDescriptorProxy :id="row.clientFk" />
<QTooltip>{{ t('Change view') }}</QTooltip> </span>
</QBtn> </template>
</QToolbar> </VnTable>
<VnPaginate
data-key="CustomerTransactions"
url="Clients/transactions"
order="created DESC"
:limit="20"
:offset="50"
:auto-load="!!$route?.query.params"
>
<template #body="{ rows }">
<QTable
:dense="$q.screen.lt.md"
:columns="columns"
:rows="rows"
row-key="id"
:grid="grid || $q.screen.lt.sm"
class="q-mt-xs custom-table"
>
<template #body-cell-actions="{ row }">
<QTd auto-width class="text-center">
<QBtn
v-if="!row.isConfirmed"
icon="check"
@click="confirm(row)"
color="primary"
size="md"
round
flat
dense
>
<QTooltip>{{ t('Confirm transaction') }}</QTooltip>
</QBtn>
</QTd>
</template>
<template #body-cell-id="{ row }">
<QTd auto-width align="right">
<span>
{{ row.id }}
</span>
</QTd>
</template>
<template #body-cell-customerId="{ row }">
<QTd align="right">
<span class="link">
{{ row.clientFk }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</QTd>
</template>
<template #body-cell-customer="{ row }">
<QTd auto-width align="left" :title="row.customerName">
<span>
{{ row.customerName }}
</span>
</QTd>
</template>
<template #body-cell-state="{ row }">
<QTd auto-width class="text-center">
<QBadge text-color="black" :color="stateColor(row)">
{{
row.isConfirmed
? t('Confirmed')
: t('Unconfirmed')
}}
</QBadge>
</QTd>
</template>
<template #item="{ cols, row }">
<div class="q-mb-md col-12">
<QCard class="q-pa-none">
<QItem class="q-pa-none items-start">
<QItemSection class="q-pa-none">
<QList>
<template
v-for="col of cols"
:key="col.name"
>
<QItem
v-if="col.grid !== false"
class="q-pa-none"
>
<QItemSection>
<QItemLabel caption>
{{ col.label }}
</QItemLabel>
<QItemLabel
v-if="col.name == 'state'"
>
<QBadge
text-color="black"
:color="
stateColor(row)
"
>
{{ col.value }}
</QBadge>
</QItemLabel>
<QItemLabel
v-if="col.name != 'state'"
>
{{ col.value }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</QList>
</QItemSection>
<template v-if="!row.isConfirmed">
<QSeparator vertical />
<QCardActions
vertical
class="justify-between"
>
<QBtn
icon="check"
@click="confirm(row)"
color="primary"
size="md"
round
flat
dense
>
<QTooltip>
{{ t('Confirm transaction') }}
</QTooltip>
</QBtn>
</QCardActions>
</template>
</QItem>
</QCard>
</div>
</template>
</QTable>
</template>
</VnPaginate>
</div>
</QPage>
</template> </template>
<style lang="scss"> <style lang="scss">
@ -269,14 +146,11 @@ es:
Web Payments: Pagos Web Web Payments: Pagos Web
Confirm transaction: Confirmar transacción Confirm transaction: Confirmar transacción
Transaction ID: ID transacción Transaction ID: ID transacción
Customer ID: ID cliente Customer: cliente
Customer Name: Nombre cliente
State: Estado State: Estado
Dated: Fecha Dated: Fecha
Amount: Importe Amount: Importe
Actions: Acciones
Confirmed: Confirmada Confirmed: Confirmada
Unconfirmed: Sin confirmar Unconfirmed: Sin confirmar
Change view: Cambiar vista
Payment confirmed: Pago confirmado Payment confirmed: Pago confirmado
</i18n> </i18n>

View File

@ -11,10 +11,12 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const { dialogRef } = useDialogPluginComponent(); const { dialogRef } = useDialogPluginComponent();
const state = useState();
const user = state.getUser();
const $props = defineProps({ const $props = defineProps({
companyId: { companyId: {
@ -55,12 +57,12 @@ const filterClientFindOne = {
id: route.params.id, id: route.params.id,
}, },
}; };
const initialData = reactive({ const initialData = reactive({
amountPaid: $props.totalCredit, amountPaid: $props.totalCredit,
clientFk: route.params.id, clientFk: route.params.id,
companyFk: $props.companyId, companyFk: $props.companyId,
email: clientFindOne.value.email, email: clientFindOne.value.email,
bankFk: user.value.localBankFk,
}); });
onBeforeMount(() => { onBeforeMount(() => {

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, onUnmounted } from 'vue'; import { onMounted, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
@ -15,12 +15,13 @@ const columns = [
{ {
align: 'center', align: 'center',
label: t('entry.latestBuys.tableVisibleColumns.image'), label: t('entry.latestBuys.tableVisibleColumns.image'),
name: 'image', name: 'itemFk',
columnField: { columnField: {
component: VnImg, component: VnImg,
attrs: (id) => { attrs: (id) => {
return { return {
id, id,
size: '50x50',
width: '50px', width: '50px',
}; };
}, },
@ -169,6 +170,7 @@ const columns = [
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)), format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
}, },
]; ];
const tableRef = ref();
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
@ -191,6 +193,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
redirect="entry" redirect="entry"
:row-click="({ entryFk }) => tableRef.redirect(entryFk)"
auto-load auto-load
:right-search="false" :right-search="false"
/> />

View File

@ -1,18 +0,0 @@
<script setup>
import LeftMenu from 'src/components/LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,18 +0,0 @@
<script setup>
import LeftMenu from 'src/components/LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,18 +0,0 @@
<script setup>
import LeftMenu from 'src/components/LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -3,7 +3,7 @@ import { onBeforeMount, onMounted, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { toDate } from 'filters/index'; import { toDate, toDateHourMin } from 'filters/index';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
import axios from 'axios'; import axios from 'axios';
@ -30,53 +30,69 @@ const columns = computed(() => [
isId: true, isId: true,
}, },
{ {
align: 'left', align: 'center',
name: 'hasCmrDms', name: 'hasCmrDms',
label: t('route.cmr.list.hasCmrDms'), label: t('route.cmr.list.hasCmrDms'),
component: 'checkbox', component: 'checkbox',
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left',
label: t('route.cmr.list.ticketFk'), label: t('route.cmr.list.ticketFk'),
name: 'ticketFk', name: 'ticketFk',
}, },
{ {
align: 'left',
label: t('route.cmr.list.routeFk'), label: t('route.cmr.list.routeFk'),
name: 'routeFk', name: 'routeFk',
}, },
{ {
align: 'left',
label: t('route.cmr.list.clientFk'), label: t('route.cmr.list.clientFk'),
name: 'clientFk', name: 'clientFk',
}, },
{ {
align: 'left', align: 'right',
label: t('route.cmr.list.country'), label: t('route.cmr.list.country'),
name: 'country', name: 'countryFk',
cardVisible: true, cardVisible: true,
},
{
align: 'center',
label: t('route.cmr.list.shipped'),
name: 'shipped',
cardVisible: true,
component: 'date',
columnFilter: {
alias: 'c',
inWhere: true,
},
format: ({ date }) => toDate(date),
},
{
align: 'center',
name: 'warehouseFk',
label: t('globals.warehouse'),
component: 'select',
attrs: { attrs: {
options: warehouses.value, url: 'countries',
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
}, },
columnFilter: {
inWhere: true,
component: 'select',
},
format: ({ countryName }) => countryName,
}, },
{ {
align: 'right', align: 'right',
label: t('route.cmr.list.shipped'),
name: 'shipped',
cardVisible: true,
columnFilter: {
component: 'date',
inWhere: true,
},
format: ({ shipped }) => toDateHourMin(shipped),
},
{
align: 'right',
name: 'warehouseFk',
label: t('globals.warehouse'),
columnFilter: {
component: 'select',
},
attrs: {
options: warehouses.value,
},
format: ({ warehouseName }) => warehouseName,
},
{
align: 'center',
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
@ -153,7 +169,7 @@ function downloadPdfs() {
</template> </template>
<template #column-clientFk="{ row }"> <template #column-clientFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.ticketFk }} {{ row.clientFk }}
<CustomerDescriptorProxy :id="row.clientFk" /> <CustomerDescriptorProxy :id="row.clientFk" />
</span> </span>
</template> </template>

View File

@ -36,23 +36,20 @@ const tableRef = ref();
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'id', name: 'routeFk',
label: 'Id', label: 'Id',
chip: { chip: {
condition: () => true, condition: () => true,
}, },
isId: true, isId: true,
columnFilter: false,
}, },
{ {
align: 'left', align: 'left',
name: 'created', name: 'created',
label: t('Date'), label: t('Date'),
component: 'date', columnFilter: false,
columnFilter: { format: ({ created }) => toDate(created),
alias: 'c',
inWhere: true,
},
format: ({ date }) => toDate(date),
}, },
{ {
align: 'left', align: 'left',
@ -66,40 +63,63 @@ const columns = computed(() => [
label: t('Agency agreement'), label: t('Agency agreement'),
cardVisible: true, cardVisible: true,
}, },
{
align: 'left',
name: 'to',
label: t('To'),
visible: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{
align: 'left',
name: 'from',
label: t('From'),
visible: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{ {
align: 'left', align: 'left',
name: 'packages', name: 'packages',
label: t('Packages'), label: t('Packages'),
columnFilter: false,
}, },
{ {
align: 'left', align: 'left',
name: 'm3', name: 'm3',
label: 'm³', label: 'm³',
cardVisible: true, cardVisible: true,
columnFilter: { columnFilter: false,
inWhere: true,
},
}, },
{ {
align: 'left', align: 'left',
name: 'kmTotal', name: 'kmTotal',
label: t('Km'), label: t('Km'),
cardVisible: true, cardVisible: true,
columnFilter: false,
}, },
{ {
align: 'left', align: 'left',
name: 'price', name: 'price',
label: t('Price'), label: t('Price'),
columnFilter: false,
}, },
{ {
align: 'left', align: 'left',
name: 'invoiceInFk', name: 'invoiceInFk',
label: t('Received'), label: t('Received'),
columnFilter: false,
}, },
{ {
align: 'left', align: 'left',
name: 'supplierName', name: 'supplierName',
label: t('Autonomous'), label: t('Autonomous'),
columnFilter: false,
}, },
{ {
align: 'right', align: 'right',

View File

@ -24,7 +24,6 @@ const selectedRows = ref([]);
const tableRef = ref([]); const tableRef = ref([]);
const confirmationDialog = ref(false); const confirmationDialog = ref(false);
const startingDate = ref(null); const startingDate = ref(null);
const refreshKey = ref(0);
const router = useRouter(); const router = useRouter();
const routeFilter = { const routeFilter = {
include: [ include: [
@ -45,9 +44,7 @@ const columns = computed(() => [
condition: () => true, condition: () => true,
}, },
isId: true, isId: true,
columnFilter: { columnFilter: false,
name: 'search',
},
}, },
{ {
align: 'left', align: 'left',
@ -65,6 +62,9 @@ const columns = computed(() => [
label: 'workerUserName', label: 'workerUserName',
}, },
}, },
columnFilter: {
inWhere: true,
},
useLike: false, useLike: false,
cardVisible: true, cardVisible: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef), format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
@ -102,18 +102,38 @@ const columns = computed(() => [
label: 'vehiclePlateNumber', label: 'vehiclePlateNumber',
}, },
}, },
columnFilter: {
inWhere: true,
},
}, },
{ {
align: 'left', align: 'left',
name: 'created', name: 'created',
label: t('Date'), label: t('Date'),
columnFilter: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{
align: 'left',
name: 'to',
label: t('To'),
visible: false,
cardVisible: true,
create: true,
component: 'date',
format: ({ date }) => toDate(date),
},
{
align: 'left',
name: 'from',
label: t('From'),
visible: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
component: 'date', component: 'date',
columnFilter: {
alias: 'c',
inWhere: true,
},
format: ({ date }) => toDate(date), format: ({ date }) => toDate(date),
}, },
{ {
@ -136,18 +156,21 @@ const columns = computed(() => [
name: 'started', name: 'started',
label: t('hourStarted'), label: t('hourStarted'),
component: 'time', component: 'time',
columnFilter: false,
}, },
{ {
align: 'left', align: 'left',
name: 'finished', name: 'finished',
label: t('hourFinished'), label: t('hourFinished'),
component: 'time', component: 'time',
columnFilter: false,
}, },
{ {
align: 'left', align: 'left',
name: 'isOk', name: 'isOk',
label: t('Served'), label: t('Served'),
component: 'checkbox', component: 'checkbox',
columnFilter: false,
}, },
{ {
align: 'right', align: 'right',
@ -183,8 +206,8 @@ const cloneRoutes = () => {
created: startingDate.value, created: startingDate.value,
ids: selectedRows.value.map((row) => row?.id), ids: selectedRows.value.map((row) => row?.id),
}); });
tableRef.value.reload();
startingDate.value = null; startingDate.value = null;
tableRef.value.reload();
}; };
const showRouteReport = () => { const showRouteReport = () => {
@ -220,7 +243,7 @@ const openTicketsDialog = (id) => {
id, id,
}, },
}) })
.onOk(() => refreshKey.value++); .onOk(() => tableRef.value.reload());
}; };
</script> </script>
@ -249,6 +272,7 @@ const openTicketsDialog = (id) => {
</QDialog> </QDialog>
<VnSubToolbar /> <VnSubToolbar />
<VnTable <VnTable
class="route-list"
ref="tableRef" ref="tableRef"
data-key="RouteList" data-key="RouteList"
url="Routes/filter" url="Routes/filter"
@ -266,7 +290,6 @@ const openTicketsDialog = (id) => {
}" }"
save-url="Routes/crud" save-url="Routes/crud"
:disable-option="{ card: true }" :disable-option="{ card: true }"
:use-model="true"
table-height="85vh" table-height="85vh"
v-model:selected="selectedRows" v-model:selected="selectedRows"
:table="{ :table="{
@ -332,6 +355,8 @@ en:
hourStarted: Started hour hourStarted: Started hour
hourFinished: Finished hour hourFinished: Finished hour
es: es:
From: Desde
To: Hasta
Worker: Trabajador Worker: Trabajador
Agency: Agencia Agency: Agencia
Vehicle: Vehículo Vehicle: Vehículo

View File

@ -1,19 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
import { onMounted } from 'vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore();
onMounted(() => (stateStore.leftDrawer = false));
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -2,7 +2,7 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import { toDate } from 'filters/index'; import { toDate, toDateHourMin } from 'filters/index';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useSummaryDialog } from 'composables/useSummaryDialog'; import { useSummaryDialog } from 'composables/useSummaryDialog';
import toCurrency from 'filters/toCurrency'; import toCurrency from 'filters/toCurrency';
@ -43,10 +43,9 @@ const columns = computed(() => [
label: t('ETD'), label: t('ETD'),
component: 'date', component: 'date',
columnFilter: { columnFilter: {
alias: 'c',
inWhere: true, inWhere: true,
}, },
format: ({ date }) => toDate(date), format: ({ created }) => toDate(created),
cardVisible: true, cardVisible: true,
}, },
{ {
@ -200,6 +199,12 @@ function confirmRemove() {
}" }"
:disable-option="{ card: true }" :disable-option="{ card: true }"
> >
<template #column-etd="{ row }">
{{ toDateHourMin(row.etd) }}
</template>
<template #column-supplierFk="{ row }">
{{ row.supplierFk }}
</template>
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnInputDate v-model="data.etd" /> <VnInputDate v-model="data.etd" />
<VnInputTime v-model="data.etd" /> <VnInputTime v-model="data.etd" />

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -152,7 +152,7 @@ function getUrl(section) {
/> />
<VnLv <VnLv
:label="t('supplier.summary.country')" :label="t('supplier.summary.country')"
:value="supplier.country?.country" :value="supplier.country?.name"
dash dash
/> />
</QCard> </QCard>

View File

@ -3,8 +3,6 @@ import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import RightMenu from 'components/common/RightMenu.vue';
import SupplierListFilter from './SupplierListFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
@ -21,75 +19,70 @@ const columns = computed(() => [
label: t('supplier.list.tableVisibleColumns.name'), label: t('supplier.list.tableVisibleColumns.name'),
name: 'socialName', name: 'socialName',
create: true, create: true,
component: 'input', columnFilter: {
columnField: { name: 'nickname',
component: null,
}, },
}, },
{ {
align: 'left', align: 'left',
label: t('supplier.list.tableVisibleColumns.nif'), label: t('supplier.list.tableVisibleColumns.nif'),
name: 'nif', name: 'nif',
component: 'input',
columnField: {
component: null,
},
}, },
{ {
align: 'left', align: 'left',
label: t('supplier.list.tableVisibleColumns.nickname'), label: t('supplier.list.tableVisibleColumns.nickname'),
name: 'alias', name: 'alias',
component: 'input', columnFilter: {
columnField: { name: 'nickname',
component: null,
}, },
}, },
{ {
align: 'left', align: 'left',
label: t('supplier.list.tableVisibleColumns.account'), label: t('supplier.list.tableVisibleColumns.account'),
name: 'account', name: 'account',
component: 'input', columnFilter: false,
columnField: {
component: null,
},
}, },
{ {
align: 'left', align: 'left',
label: t('supplier.list.tableVisibleColumns.payMethod'), label: t('supplier.list.tableVisibleColumns.payMethod'),
name: 'payMethod', name: 'payMethod',
component: 'select', columnFilter: false,
attrs: {
url: 'payMethods',
fields: ['id', 'name'],
},
columnField: {
component: null,
},
}, },
{ {
align: 'left', align: 'left',
label: t('supplier.list.tableVisibleColumns.payDay'), label: t('supplier.list.tableVisibleColumns.payDay'),
name: 'payDat', name: 'payDay',
component: 'input', columnFilter: false,
columnField: { },
component: null, {
align: 'left',
name: 'countryFk',
label: t('customer.extendedList.tableVisibleColumns.countryFk'),
component: 'select',
attrs: {
url: 'Countries',
}, },
visible: false,
},
{
align: 'left',
label: t('customer.extendedList.tableVisibleColumns.provinceFk'),
name: 'provinceFk',
component: 'select',
attrs: {
url: 'Provinces',
},
visible: false,
}, },
]); ]);
</script> </script>
<template> <template>
<VnSearchbar data-key="SuppliersList" :limit="20" :label="t('Search suppliers')" /> <VnSearchbar data-key="SuppliersList" :limit="20" :label="t('Search suppliers')" />
<RightMenu>
<template #right-panel>
<SupplierListFilter data-key="SuppliersList" />
</template>
</RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="SuppliersList" data-key="SuppliersList"
url="Suppliers/filter" url="Suppliers/filter"
save-url="Suppliers/crud"
redirect="supplier" redirect="supplier"
:create="{ :create="{
urlCreate: 'Suppliers/newSupplier', urlCreate: 'Suppliers/newSupplier',
@ -100,8 +93,6 @@ const columns = computed(() => [
order="id ASC" order="id ASC"
:columns="columns" :columns="columns"
auto-load auto-load
:right-search="false"
:use-model="true"
/> />
</template> </template>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -10,6 +10,7 @@ import CardSummary from 'components/ui/CardSummary.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue'; import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue';
import VnRow from 'src/components/ui/VnRow.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -133,30 +134,24 @@ const filter = {
/> />
<VnLv :label="t('worker.summary.fi')" :value="worker.fi" /> <VnLv :label="t('worker.summary.fi')" :value="worker.fi" />
<VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" /> <VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" />
<QCheckbox <VnRow class="q-mt-sm" wrap>
class="padding-none" <VnLv
:label="t('worker.summary.isFreelance')" :label="t('worker.summary.isFreelance')"
v-model="worker.isFreelance" :value="worker.isFreelance"
:disable="true" />
/> <VnLv
<QCheckbox :label="t('worker.summary.isSsDiscounted')"
class="padding-none" :value="worker.isSsDiscounted"
:label="t('worker.summary.isSsDiscounted')" />
v-model="worker.isSsDiscounted" <VnLv
:disable="true" :label="t('worker.summary.hasMachineryAuthorized')"
/> :value="worker.hasMachineryAuthorized"
<QCheckbox />
class="padding-none" <VnLv
:label="t('worker.summary.hasMachineryAuthorized')" :label="t('worker.summary.isDisable')"
v-model="worker.hasMachineryAuthorized" :value="worker.isDisable"
:disable="true" />
/> </VnRow>
<QCheckbox
class="padding-none"
:label="t('worker.summary.isDisable')"
v-model="worker.isDisable"
:disable="true"
/>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle :text="t('worker.summary.userData')" /> <VnTitle :text="t('worker.summary.userData')" />

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -2,9 +2,9 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { computed } from 'vue'; import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue'; import VnCard from 'components/common/VnCard.vue';
import ZoneDescriptor from './ZoneDescriptor.vue'; import ZoneDescriptor from './ZoneDescriptor.vue';
import ZoneSearchbar from './ZoneSearchbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -33,5 +33,9 @@ const searchBarDataKeys = {
:search-make-fetch="searchbarMakeFetch" :search-make-fetch="searchbarMakeFetch"
:searchbar-label="t('list.searchZone')" :searchbar-label="t('list.searchZone')"
:searchbar-info="t('list.searchInfo')" :searchbar-info="t('list.searchInfo')"
/> >
<template #searchbar>
<ZoneSearchbar />
</template>
</VnCard>
</template> </template>

View File

@ -1,11 +1,8 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'src/components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore();
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -49,12 +46,4 @@ const exprBuilder = (param, value) => {
:info="t('list.searchInfo')" :info="t('list.searchInfo')"
custom-route-redirect-name="ZoneSummary" custom-route-redirect-name="ZoneSummary"
/> />
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template> </template>

View File

@ -3,6 +3,7 @@ import { ref } from 'vue';
import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue'; import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue';
import ZoneCalendarGrid from './ZoneCalendarGrid.vue'; import ZoneCalendarGrid from './ZoneCalendarGrid.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const firstDay = ref(null); const firstDay = ref(null);
const lastDay = ref(null); const lastDay = ref(null);
@ -10,6 +11,7 @@ const events = ref([]);
</script> </script>
<template> <template>
<ZoneSearchbar />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ZoneDeliveryPanel /> <ZoneDeliveryPanel />

View File

@ -15,6 +15,7 @@ import { useStateStore } from 'stores/useStateStore';
import axios from 'axios'; import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue'; import ZoneFilterPanel from './ZoneFilterPanel.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -87,6 +88,7 @@ onMounted(() => (stateStore.rightDrawer = true));
</script> </script>
<template> <template>
<ZoneSearchbar />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ZoneFilterPanel data-key="ZoneList" :expr-builder="exprBuilder" /> <ZoneFilterPanel data-key="ZoneList" :expr-builder="exprBuilder" />

View File

@ -7,6 +7,7 @@ import FetchData from 'components/FetchData.vue';
import { toDateFormat } from 'src/filters/date.js'; import { toDateFormat } from 'src/filters/date.js';
import { useWeekdayStore } from 'src/stores/useWeekdayStore'; import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const weekdayStore = useWeekdayStore(); const weekdayStore = useWeekdayStore();
@ -52,6 +53,7 @@ onMounted(() => weekdayStore.initStore());
@on-fetch="(data) => (details = data)" @on-fetch="(data) => (details = data)"
auto-load auto-load
/> />
<ZoneSearchbar />
<VnSubToolbar /> <VnSubToolbar />
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QCard class="full-width q-pa-md"> <QCard class="full-width q-pa-md">

View File

@ -29,7 +29,7 @@ export default {
{ {
path: '', path: '',
name: 'SupplierMain', name: 'SupplierMain',
component: () => import('src/pages/Supplier/SupplierMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'SupplierList' }, redirect: { name: 'SupplierList' },
children: [ children: [
{ {

View File

@ -34,7 +34,7 @@ export default {
{ {
path: '', path: '',
name: 'AccountMain', name: 'AccountMain',
component: () => import('src/pages/Account/AccountMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'AccountList' }, redirect: { name: 'AccountList' },
children: [ children: [
{ {

View File

@ -26,7 +26,7 @@ export default {
{ {
name: 'ClaimMain', name: 'ClaimMain',
path: '', path: '',
component: () => import('src/pages/Claim/ClaimMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'ClaimList' }, redirect: { name: 'ClaimList' },
children: [ children: [
{ {

View File

@ -38,7 +38,7 @@ export default {
{ {
path: '', path: '',
name: 'CustomerMain', name: 'CustomerMain',
component: () => import('src/pages/Customer/CustomerMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'CustomerList' }, redirect: { name: 'CustomerList' },
children: [ children: [
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '', path: '',
name: 'EntryMain', name: 'EntryMain',
component: () => import('src/pages/Entry/EntryMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'EntryList' }, redirect: { name: 'EntryList' },
children: [ children: [
{ {

View File

@ -25,7 +25,7 @@ export default {
{ {
path: '', path: '',
name: 'InvoiceInMain', name: 'InvoiceInMain',
component: () => import('src/pages/InvoiceIn/InvoiceInMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'InvoiceInList' }, redirect: { name: 'InvoiceInList' },
children: [ children: [
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '', path: '',
name: 'InvoiceOutMain', name: 'InvoiceOutMain',
component: () => import('src/pages/InvoiceOut/InvoiceOutMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'InvoiceOutList' }, redirect: { name: 'InvoiceOutList' },
children: [ children: [
{ {

View File

@ -35,7 +35,7 @@ export default {
{ {
path: '', path: '',
name: 'ItemMain', name: 'ItemMain',
component: () => import('src/pages/Item/ItemMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'ItemList' }, redirect: { name: 'ItemList' },
children: [ children: [
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '', path: '',
name: 'MonitorMain', name: 'MonitorMain',
component: () => import('src/pages/Monitor/MonitorMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'MonitorList' }, redirect: { name: 'MonitorList' },
children: [ children: [
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '', path: '',
name: 'OrderMain', name: 'OrderMain',
component: () => import('src/pages/Order/OrderMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'OrderList' }, redirect: { name: 'OrderList' },
children: [ children: [
{ {

View File

@ -18,7 +18,10 @@ export default {
{ {
path: '/route', path: '/route',
name: 'RouteMain', name: 'RouteMain',
component: () => import('src/pages/Route/RouteMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
props: {
leftDrawer: false,
},
redirect: { name: 'RouteList' }, redirect: { name: 'RouteList' },
children: [ children: [
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '', path: '',
name: 'ShelvingMain', name: 'ShelvingMain',
component: () => import('src/pages/Shelving/ShelvingMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'ShelvingList' }, redirect: { name: 'ShelvingList' },
children: [ children: [
{ {

View File

@ -35,7 +35,7 @@ export default {
{ {
name: 'TicketMain', name: 'TicketMain',
path: '', path: '',
component: () => import('src/pages/Ticket/TicketMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'TicketList' }, redirect: { name: 'TicketList' },
children: [ children: [
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '', path: '',
name: 'TravelMain', name: 'TravelMain',
component: () => import('src/pages/Travel/TravelMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'TravelList' }, redirect: { name: 'TravelList' },
children: [ children: [
{ {

View File

@ -18,7 +18,7 @@ export default {
{ {
path: '/wagon', path: '/wagon',
name: 'WagonMain', name: 'WagonMain',
component: () => import('src/pages/Wagon/WagonMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'WagonList' }, redirect: { name: 'WagonList' },
children: [ children: [
{ {
@ -62,7 +62,7 @@ export default {
{ {
path: '/wagon/type', path: '/wagon/type',
name: 'WagonTypeMain', name: 'WagonTypeMain',
component: () => import('src/pages/Wagon/WagonMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'WagonTypeList' }, redirect: { name: 'WagonTypeList' },
children: [ children: [
{ {

View File

@ -31,7 +31,7 @@ export default {
{ {
path: '', path: '',
name: 'WorkerMain', name: 'WorkerMain',
component: () => import('src/pages/Worker/WorkerMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'WorkerList' }, redirect: { name: 'WorkerList' },
children: [ children: [
{ {

View File

@ -29,7 +29,7 @@ export default {
{ {
path: '/zone', path: '/zone',
name: 'ZoneMain', name: 'ZoneMain',
component: () => import('src/pages/Zone/ZoneMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'ZoneList' }, redirect: { name: 'ZoneList' },
children: [ children: [
{ {

View File

@ -0,0 +1,13 @@
describe('RoadMap', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/roadmap`);
});
it('Route list create roadmap and redirect', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get('input[name="name"]').eq(1).type('roadMapTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary');
});
});

View File

@ -4,12 +4,28 @@ describe('Route', () => {
cy.login('developer'); cy.login('developer');
cy.visit(`/#/route/list`); cy.visit(`/#/route/list`);
}); });
const getVnSelect =
'> :nth-child(1) > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
const getRowColumn = (row, column) => `:nth-child(${row}) > :nth-child(${column})`;
it('Route list create route', () => { it('Route list create route', () => {
cy.visit(`/#/route/list`);
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get('input[name="description"]').eq(1).type('routeTestOne{enter}'); cy.get('input[name="description"]').eq(1).type('routeTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created'); cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary'); cy.url().should('include', '/summary');
}); });
it('Route list search and edit', () => {
cy.get('input[name="description"]').type('routeTestOne{enter}');
cy.get('.q-table tr')
.its('length')
.then((rowCount) => {
expect(rowCount).to.be.greaterThan(0);
});
cy.get(getRowColumn(1, 3) + getVnSelect).type('{downArrow}{enter}');
cy.get(getRowColumn(1, 4) + getVnSelect).type('{downArrow}{enter}');
cy.get(getRowColumn(1, 5) + getVnSelect).type('{downArrow}{enter}');
cy.get('button[title="Save"]').click();
cy.get('.q-notification__message').should('have.text', 'Data created');
});
}); });

View File

@ -0,0 +1,15 @@
describe('ZoneDeliveryDays', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/delivery-days`);
});
it('should query for the day', () => {
cy.get('.q-form > .q-btn > .q-btn__content').click();
cy.get('.q-notification__message').should(
'have.text',
'No service for the specified zone'
);
});
});

View File

@ -0,0 +1,15 @@
describe('ZoneList', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/zone/list`);
});
it('should open the details', () => {
cy.get(':nth-child(1) > .text-right > .material-symbols-outlined').click();
});
it('should redirect to summary', () => {
cy.waitForElement('.q-page');
cy.get('tbody > :nth-child(1)').click();
});
});

View File

@ -0,0 +1,9 @@
describe('ZoneUpcomingDeliveries', () => {
beforeEach(() => {
cy.login('developer');
cy.viewport(1920, 1080);
cy.visit(`/#/zone/upcoming-deliveries`);
});
it('should show the page', () => {});
});

View File

@ -35,18 +35,4 @@ describe('CustomerPayments', () => {
); );
}); });
}); });
describe('stateColor()', () => {
it('should return "positive" when isConfirmed property is truthy', async () => {
const result = await vm.stateColor({ isConfirmed: true });
expect(result).toEqual('positive');
});
it('should return "primary" when isConfirmed property is falsy', async () => {
const result = await vm.stateColor({ isConfirmed: false });
expect(result).toEqual('primary');
});
});
}); });