Merge branch 'dev' into 4666-invoiceInCorrection
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2024-02-08 17:30:47 +00:00
commit 2fb1688af4
28 changed files with 1619 additions and 93 deletions

View File

@ -206,6 +206,17 @@ async function togglePinned(item, event) {
<template v-if="$props.source === 'card'"> <template v-if="$props.source === 'card'">
<template v-for="item in items" :key="item.name"> <template v-for="item in items" :key="item.name">
<LeftMenuItem v-if="!item.children" :item="item" /> <LeftMenuItem v-if="!item.children" :item="item" />
<QList v-else>
<QExpansionItem
v-ripple
clickable
:icon="item.icon"
:label="t(item.title)"
:content-inset-level="0.5"
>
<LeftMenuItemGroup :item="item" />
</QExpansionItem>
</QList>
</template> </template>
</template> </template>
</QList> </QList>

View File

@ -135,6 +135,8 @@ export default {
log: 'Log', log: 'Log',
sms: 'Sms', sms: 'Sms',
creditManagement: 'Credit management', creditManagement: 'Credit management',
creditContracts: 'Credit contracts',
creditOpinion: 'Credit opinion',
others: 'Others', others: 'Others',
}, },
list: { list: {

View File

@ -135,6 +135,8 @@ export default {
log: 'Historial', log: 'Historial',
sms: 'Sms', sms: 'Sms',
creditManagement: 'Gestión de crédito', creditManagement: 'Gestión de crédito',
creditContracts: 'Contratos de crédito',
creditOpinion: 'Opinión de crédito',
others: 'Otros', others: 'Otros',
}, },
list: { list: {

View File

@ -1,3 +1,282 @@
<script setup>
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { date, QCheckbox, QBtn, useQuasar } from 'quasar';
import { toCurrency } from 'src/filters';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n();
const route = useRoute();
const quasar = useQuasar();
const stateStore = useStateStore();
const clientRisks = ref(null);
const companiesOptions = ref([]);
const companyId = ref(442);
const rows = ref(null);
const workerId = ref(0);
const receiptsRef = ref(null);
const clientRisksRef = ref(null);
const filterCompanies = { order: ['code'] };
const params = {
clientId: `${route.params.id}`,
companyId: companyId.value,
filter: { limit: 20 },
};
const filter = {
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: `${route.params.id}`, companyFk: companyId.value },
};
const tableColumnComponents = {
payed: {
component: 'span',
props: () => {},
event: () => {},
},
created: {
component: 'span',
props: () => {},
event: () => {},
},
userName: {
component: QBtn,
props: () => ({ flat: true, color: 'blue' }),
event: (prop) => {
workerId.value = prop.row.clientFk;
},
},
description: {
component: 'span',
props: () => {},
event: () => {},
},
bankFk: {
component: 'span',
props: () => {},
event: () => {},
},
debit: {
component: 'span',
props: () => {},
event: () => {},
},
credit: {
component: 'span',
props: () => {},
event: () => {},
},
balance: {
component: 'span',
props: () => {},
event: () => {},
},
isConciliate: {
component: QCheckbox,
props: (prop) => ({
disable: true,
'model-value': Boolean(prop.value),
}),
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
field: 'payed',
format: (value) => date.formatDate(value, 'DD/MM/YYYY'),
label: t('Date'),
name: 'payed',
},
{
align: 'left',
field: 'created',
format: (value) => date.formatDate(value, 'DD/MM/YYYY hh:mm'),
label: t('Creation date'),
name: 'created',
},
{
align: 'left',
field: 'userName',
label: t('Employee'),
name: 'userName',
},
{
align: 'left',
field: 'description',
label: t('Reference'),
name: 'description',
},
{
align: 'left',
field: 'bankFk',
label: t('Bank'),
name: 'bankFk',
},
{
align: 'left',
field: 'debit',
label: t('Debit'),
name: 'debit',
},
{
align: 'left',
field: 'credit',
format: (value) => toCurrency(value),
label: t('Havings'),
name: 'credit',
},
{
align: 'left',
field: (value) => value.debit - value.credit,
format: (value) => toCurrency(value),
label: t('Balance'),
name: 'balance',
},
{
align: 'left',
field: 'isConciliate',
label: t('Conciliated'),
name: 'isConciliate',
},
]);
const getData = () => {
stateStore.rightDrawer = true;
receiptsRef.value?.fetch();
clientRisksRef.value?.fetch();
};
const showNewPaymentDialog = () => {
quasar.dialog({
component: CustomerNewPayment,
componentProps: {
companyId: companyId.value,
totalCredit: clientRisks.value[0]?.amount,
promise: getData,
},
});
};
const updateCompanyId = (id) => {
if (id) companyId.value = id;
getData();
};
</script>
<template> <template>
<div class="flex justify-center">Balance</div> <FetchData
:filter="filterCompanies"
@on-fetch="(data) => (companiesOptions = data)"
auto-load
url="Companies"
/>
<FetchData
:params="params"
@on-fetch="(data) => (rows = data)"
auto-load
ref="receiptsRef"
url="Receipts/filter"
/>
<FetchData
:filter="filter"
@on-fetch="(data) => (clientRisks = data)"
auto-load
ref="clientRisksRef"
url="ClientRisks"
/>
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
v-if="rows?.length"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)"
@click="tableColumnComponents[props.col.name].event(props)"
>
<template v-if="props.col.name !== 'isConciliate'">
{{ props.value }}
</template>
<WorkerDescriptorProxy :id="workerId" />
</component>
</QTr>
</QTd>
</template>
</QTable>
<h5 class="flex justify-center label-color" v-else>
{{ t('globals.noResults') }}
</h5>
<QDrawer :width="256" show-if-above side="right" v-model="stateStore.rightDrawer">
<div class="q-mt-xl q-px-md">
<VnSelectFilter
:label="t('Company')"
:options="companiesOptions"
@update:model-value="updateCompanyId($event)"
hide-selected
option-label="code"
option-value="id"
v-model="companyId"
/>
</div>
<QCard class="q-ma-md q-pa-md q-mt-lg" v-if="rows?.length">
<QCardSection>
<div class="flex justify-center text-subtitle1 text-bold">
{{ t('Total by company') }}
</div>
<div class="flex justify-center">
<div class="q-mr-sm" v-if="clientRisks?.length">
{{ clientRisks[0].company.code }}:
</div>
<div v-if="clientRisks?.length">
{{ toCurrency(clientRisks[0].amount) }}
</div>
</div>
</QCardSection>
</QCard>
</QDrawer>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="showNewPaymentDialog()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New payment') }}
</QTooltip>
</QPageSticky>
</template> </template>
<i18n>
es:
Company: Empresa
Total by company: Total por empresa
New payment: Añadir pago
Date: Fecha
Creation date: Fecha de creación
Employee: Empleado
Reference: Referencia
Bank: Caja
Debit: Debe
Havings: Haber
Balance: Balance
Conciliated: Conciliado
</i18n>

View File

@ -137,21 +137,15 @@ const toCustomerConsigneeEdit = (consigneeId) => {
</div> </div>
</div> </div>
</QCard> </QCard>
<QPageSticky :offset="[18, 18]">
<QBtn
@click.stop="toCustomerConsigneeCreate()"
color="primary"
fab
icon="add"
/>
<QTooltip>
{{ t('New consignee') }}
</QTooltip>
</QPageSticky>
</template> </template>
</VnPaginate> </VnPaginate>
</QCard> </QCard>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerConsigneeCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New consignee') }}
</QTooltip>
</QPageSticky>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -0,0 +1,3 @@
<template>
<div class="flex justify-center">Customer credit contracts</div>
</template>

View File

@ -0,0 +1,3 @@
<template>
<div class="flex justify-center">Customer credit opinion</div>
</template>

View File

@ -1,11 +1,11 @@
<script setup> <script setup>
import { ref, computed, onBeforeMount, onMounted } from 'vue'; import { ref, computed, onBeforeMount } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { date, QBtn } from 'quasar'; import { date, QBtn } from 'quasar';
import { toCurrency, toDate } from 'src/filters'; import { toCurrency } from 'src/filters';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
@ -18,6 +18,7 @@ const stateStore = useStateStore();
const arrayData = ref(null); const arrayData = ref(null);
const workerId = ref(0); const workerId = ref(0);
const rows = computed(() => arrayData.value.store.data);
onBeforeMount(async () => { onBeforeMount(async () => {
const filter = { const filter = {
@ -42,16 +43,6 @@ onBeforeMount(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}); });
onMounted(() => {
const filteredColumns = columns.value.filter(
(col) => col.name !== 'actions' && col.name !== 'customerStatus'
);
allColumnNames.value = filteredColumns.map((col) => col.name);
});
const rows = computed(() => arrayData.value.store.data);
const allColumnNames = ref([]);
const tableColumnComponents = { const tableColumnComponents = {
created: { created: {
component: 'span', component: 'span',

View File

@ -1,3 +1,202 @@
<script setup>
import { ref, computed, onBeforeMount } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { date, QBtn } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
import { toCurrency } from 'src/filters';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const stateStore = useStateStore();
const arrayData = ref(null);
const totalAmount = ref(0);
const workerId = ref(0);
const rows = computed(() => arrayData.value.store.data);
onBeforeMount(async () => {
const filter = {
include: [
{
relation: 'greugeType',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'user',
scope: {
fields: ['id', 'name'],
},
},
],
order: 'shipped DESC, amount',
where: {
clientFk: `${route.params.id}`,
},
limit: 20,
};
arrayData.value = useArrayData('CustomerGreugesCard', {
url: 'greuges',
filter,
});
await arrayData.value.fetch({ append: false });
totalAmount.value = arrayData.value.store.data.reduce((accumulator, currentValue) => {
return accumulator + currentValue.amount;
}, 0);
stateStore.rightDrawer = true;
});
const tableColumnComponents = {
date: {
component: 'span',
props: () => {},
event: () => {},
},
createdBy: {
component: QBtn,
props: () => ({ flat: true, color: 'blue' }),
event: (prop) => {
selectWorkerId(prop.row.clientFk);
},
},
comment: {
component: 'span',
props: () => {},
event: () => {},
},
type: {
component: 'span',
props: () => {},
event: () => {},
},
amount: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
field: 'shipped',
label: t('Date'),
name: 'date',
format: (value) => date.formatDate(value, 'DD/MM/YYYY hh:mm:ss'),
},
{
align: 'left',
field: (value) => value.user.name,
label: t('Created by'),
name: 'createdBy',
},
{
align: 'left',
field: 'description',
label: t('Comment'),
name: 'comment',
},
{
align: 'left',
field: (value) => value.greugeType.name,
label: t('Type'),
name: 'type',
},
{
align: 'left',
field: 'amount',
label: t('Amount'),
name: 'amount',
format: (value) => toCurrency(value),
},
]);
const selectWorkerId = (id) => {
workerId.value = id;
};
const toCustomerGreugeCreate = () => {
router.push({ name: 'CustomerGreugeCreate' });
};
</script>
<template> <template>
<div class="flex justify-center">Greuges</div> <QPage class="column items-center q-pa-md">
<QCard class="full-width" v-if="totalAmount">
<h6 class="flex justify-end q-my-lg q-pr-lg">
<span class="label-color q-mr-md">{{ t('Total') }}:</span>
{{ toCurrency(totalAmount) }}
</h6>
</QCard>
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
v-if="rows?.length"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)"
@click="tableColumnComponents[props.col.name].event(props)"
>
{{ props.value }}
<WorkerDescriptorProxy :id="workerId" />
</component>
</QTr>
</QTd>
</template>
</QTable>
<QCard class="full-width" v-else>
<h5 class="flex justify-center label-color">
{{ t('globals.noResults') }}
</h5>
</QCard>
</QPage>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerGreugeCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New greuge') }}
</QTooltip>
</QPageSticky>
</template> </template>
<style lang="scss">
.consignees-card {
border: 2px solid var(--vn-light-gray);
border-radius: 10px;
padding: 10px;
}
.label-color {
color: var(--vn-label);
}
</style>
<i18n>
es:
Total: Total
Date: Fecha
Created by: Creado por
Comment: Comentario
Type: Tipo
Amount: Importe
New greuge: Nuevo greuge
</i18n>

View File

@ -1,3 +1,262 @@
<script setup>
import { onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const { t } = useI18n();
const route = useRoute();
const stateStore = useStateStore();
const clientLogs = ref(null);
const urlClientLogsEditors = ref(null);
const urlClientLogsModels = ref(null);
const clientLogsModelsOptions = ref([]);
const clientLogsOptions = ref([]);
const clientLogsEditorsOptions = ref([]);
const radioButtonValue = ref('all');
const insert = ref(false);
const update = ref(false);
const deletes = ref(false);
const select = ref(false);
const neq = ref(null);
const inq = ref([]);
const filterClientLogs = {
fields: [
'id',
'originFk',
'userFk',
'action',
'changedModel',
'oldInstance',
'newInstance',
'creationDate',
'changedModel',
'changedModelId',
'changedModelValue',
'description',
],
include: [
{
relation: 'user',
scope: {
fields: ['nickname', 'name', 'image'],
include: { relation: 'worker', scope: { fields: ['id'] } },
},
},
],
order: ['creationDate DESC', 'id DESC'],
limit: 20,
};
const filterClientLogsEditors = {
fields: ['id', 'nickname', 'name', 'image'],
order: 'nickname',
limit: 30,
};
const filterClientLogsModels = { order: ['changedModel'] };
const urlBase = `ClientLogs/${route.params.id}`;
onBeforeMount(() => {
stateStore.rightDrawer = true;
filterClientLogs.where = {
and: [
{ originFk: `${route.params.id}` },
{ userFk: { neq: radioButtonValue.value } },
{ action: { inq: inq.value } },
],
};
urlClientLogsEditors.value = `${urlBase}/editors`;
urlClientLogsModels.value = `${urlBase}/models`;
});
const getClientLogs = async (value, status) => {
if (status === 'neq') {
neq.value = value;
} else {
setInq(value, status);
}
filterClientLogs.where = {
and: [
{ originFk: `${route.params.id}` },
{ userFk: { neq: neq.value } },
{ action: { inq: inq.value } },
],
};
clientLogs.value?.fetch();
};
const setInq = (value, status) => {
if (status) {
if (!inq.value.includes(value)) {
inq.value.push(value);
}
} else {
inq.value = inq.value.filter((item) => item !== value);
}
};
</script>
<template> <template>
<div class="flex justify-center">Log</div> <FetchData
:filter="filterClientLogs"
@on-fetch="(data) => (clientLogsOptions = data)"
auto-load
url="ClientLogs"
ref="clientLogs"
/>
<FetchData
:filter="filterClientLogsEditors"
@on-fetch="(data) => (clientLogsEditorsOptions = data)"
auto-load
:url="urlClientLogsEditors"
/>
<FetchData
:filter="filterClientLogsModels"
@on-fetch="(data) => (clientLogsModelsOptions = data)"
auto-load
:url="urlClientLogsModels"
/>
<h5 class="flex justify-center label-color">
{{ t('globals.noResults') }}
</h5>
<QDrawer :width="256" show-if-above side="right" v-model="stateStore.rightDrawer">
<div class="q-mt-sm q-px-md">
<VnInput :label="t('Search')">
<template #append>
<QIcon name="info" class="cursor-pointer">
<QTooltip>
{{ t('Search by id or concept') }}
</QTooltip>
</QIcon>
</template>
</VnInput>
<VnSelectFilter
:label="t('Entity')"
:options="[]"
class="q-mt-md"
hide-selected
option-label="name"
option-value="id"
/>
<div class="q-mt-lg">
<QRadio
:dark="true"
:label="t('All')"
@update:model-value="getClientLogs($event, 'neq')"
dense
v-model="radioButtonValue"
val="all"
/>
</div>
<div class="q-mt-md">
<QRadio
:dark="true"
:label="t('User')"
@update:model-value="getClientLogs($event, 'neq')"
dense
v-model="radioButtonValue"
val="user"
/>
</div>
<div class="q-mt-md">
<QRadio
:dark="true"
:label="t('System')"
@update:model-value="getClientLogs($event, 'neq')"
dense
v-model="radioButtonValue"
val="system"
/>
</div>
<VnSelectFilter
:label="t('User')"
:options="[]"
class="q-mt-sm"
hide-selected
option-label="name"
option-value="id"
/>
<VnInput :label="t('Changes')" class="q-mt-sm">
<template #append>
<QIcon name="info" class="cursor-pointer">
<QTooltip>
{{ t('Search by changes') }}
</QTooltip>
</QIcon>
</template>
</VnInput>
<div class="q-mt-md">
<QCheckbox
:label="t('Creates')"
@update:model-value="getClientLogs('insert', $event)"
v-model="insert"
/>
</div>
<div>
<QCheckbox
:label="t('Edits')"
@update:model-value="getClientLogs('update', $event)"
v-model="update"
/>
</div>
<div>
<QCheckbox
:label="t('Deletes')"
@update:model-value="getClientLogs('delete', $event)"
v-model="deletes"
/>
</div>
<div>
<QCheckbox
:label="t('Accesses')"
@update:model-value="getClientLogs('select', $event)"
v-model="select"
/>
</div>
<VnInputDate :label="t('Date')" class="q-mt-sm" />
<VnInput :label="t('To')" class="q-mt-md" />
</div>
</QDrawer>
<QPageSticky
:offset="[18, 18]"
v-if="radioButtonValue !== 'all' || insert || update || deletes || select"
>
<QBtn color="primary" fab icon="filter_alt_off" />
<QTooltip>
{{ t('Quit filter') }}
</QTooltip>
</QPageSticky>
</template> </template>
<i18n>
es:
Search: Buscar
Search by id or concept: xxx
Entity: Entidad
All: Todo
User: Usuario
System: Sistema
Changes: Cambios
Search by changes: xxx
Creates: Crea
Edits: Modifica
Deletes: Elimina
Accesses: Accede
Date: Fecha
To: Hasta
Quit filter: Quitar filtro
</i18n>

View File

@ -62,7 +62,7 @@ const toCustomerNoteCreate = () => {
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn <QBtn
@click.stop="toCustomerConsigneeCreate()" @click.stop="toCustomerNoteCreate()"
color="primary" color="primary"
fab fab
icon="add" icon="add"

View File

@ -1,3 +1,157 @@
<script setup>
import { ref, computed, onBeforeMount } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { date, QBtn } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
import { toCurrency } from 'src/filters';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const stateStore = useStateStore();
const arrayData = ref(null);
const workerId = ref(0);
const rows = computed(() => arrayData.value.store.data);
onBeforeMount(async () => {
const filter = {
where: { clientFk: `${route.params.id}` },
order: ['started DESC'],
limit: 20,
};
arrayData.value = useArrayData('CustomerRecoveriesCard', {
url: 'Recoveries',
filter,
});
await arrayData.value.fetch({ append: false });
stateStore.rightDrawer = true;
});
const tableColumnComponents = {
since: {
component: 'span',
props: () => {},
event: () => {},
},
to: {
component: 'span',
props: () => {},
event: () => {},
},
amount: {
component: 'span',
props: () => {},
event: () => {},
},
period: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
field: 'started',
label: t('Since'),
name: 'since',
format: (value) => date.formatDate(value, 'DD/MM/YYYY'),
},
{
align: 'left',
field: 'finished',
label: t('To'),
name: 'to',
format: (value) => date.formatDate(value, 'DD/MM/YYYY'),
},
{
align: 'left',
field: 'amount',
label: t('Amount'),
name: 'amount',
format: (value) => toCurrency(value),
},
{
align: 'left',
field: 'period',
label: t('Period'),
name: 'period',
},
]);
const toCustomerRecoverieCreate = () => {
router.push({ name: 'CustomerRecoverieCreate' });
};
</script>
<template> <template>
<div class="flex justify-center">Recoveries</div> <QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
v-if="rows?.length"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)"
@click="tableColumnComponents[props.col.name].event(props)"
>
{{ props.value }}
<WorkerDescriptorProxy :id="workerId" />
</component>
</QTr>
</QTd>
</template>
</QTable>
<QCard class="full-width" v-else>
<h5 class="flex justify-center label-color">
{{ t('globals.noResults') }}
</h5>
</QCard>
</QPage>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerRecoverieCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New recoverie') }}
</QTooltip>
</QPageSticky>
</template> </template>
<style lang="scss">
.consignees-card {
border: 2px solid var(--vn-light-gray);
border-radius: 10px;
padding: 10px;
}
.label-color {
color: var(--vn-label);
}
</style>
<i18n>
es:
Since: Desde
To: Hasta
Amount: Importe
Period: Periodo
New recoverie: Nuevo recobro
</i18n>

View File

@ -1,3 +1,69 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const route = useRoute();
const filter = { where: { id: `${route.params.id}` } };
</script>
<template> <template>
<div class="flex justify-center">Web access</div> <FormModel
:filter="filter"
:observe-form-changes="false"
:url-update="`Clients/${route.params.id}/updateUser`"
:url="'VnUsers/preview'"
model="client"
>
<template #form="{ data }">
<div
v-for="(item, index) in data"
:key="index"
:class="{
'q-mb-md': index < data.length - 1,
}"
>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox
:label="t('Enable web access')"
v-model="item.active"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('User')" v-model="item.name" />
</div>
<div class="col">
<VnInput :label="t('Recovery email')" v-model="item.email">
<template #append>
<QIcon name="info" class="cursor-pointer">
<QTooltip>{{
t(
'This email is used for user to regain access their account'
)
}}</QTooltip>
</QIcon>
</template>
</VnInput>
</div>
</VnRow>
</div>
</template>
</FormModel>
</template> </template>
<i18n>
es:
Enable web access: Habilitar acceso web
User: Usuario
Recovery email: Correo de recuperacion
This email is used for user to regain access their account: Este correo electrónico se usa para que el usuario recupere el acceso a su cuenta
</i18n>

View File

@ -12,7 +12,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue'; import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue'; import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue'; import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -232,7 +232,7 @@ const toCustomerConsignees = () => {
v-model="data.customsAgentFk" v-model="data.customsAgentFk"
> >
<template #form> <template #form>
<CustomsNewCustomsAgent @on-data-saved="refreshData()" /> <CustomerNewCustomsAgent @on-data-saved="refreshData()" />
</template> </template>
</VnSelectDialog> </VnSelectDialog>
</div> </div>

View File

@ -0,0 +1,93 @@
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const initialData = reactive({
amount: null,
description: null,
greugeTypeFk: null,
shipped: '2001-01-01T11:00:00.000Z',
});
const greugeTypes = ref([]);
onMounted(() => {
initialData.clientFk = `${route.params.id}`;
});
const toCustomerGreuges = () => {
router.push({
name: 'CustomerGreuges',
params: {
id: route.params.id,
},
});
};
</script>
<template>
<fetch-data @on-fetch="(data) => (greugeTypes = data)" auto-load url="greugeTypes" />
<FormModel
:form-initial-data="initialData"
:observe-form-changes="false"
@on-data-saved="toCustomerGreuges()"
model="client"
url-create="Greuges"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Amount')" type="number" v-model="data.amount" />
</div>
<div class="col">
<VnInputDate :label="t('Date')" v-model="data.shipped" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Comment')" v-model="data.description" />
</div>
<div class="col">
<VnSelectFilter
:label="t('Type')"
:options="greugeTypes"
hide-selected
option-label="name"
option-value="id"
v-model="data.greugeTypeFk"
/>
</div>
</VnRow>
</template>
</FormModel>
</template>
<style lang="scss" scoped>
.add-icon {
cursor: pointer;
background-color: $primary;
border-radius: 50px;
}
</style>
<i18n>
es:
Amount: Importe
Date: Fecha
Comment: Comentario
Type: Tipo
</i18n>

View File

@ -0,0 +1,286 @@
<script setup>
import { onBeforeMount, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const route = useRoute();
const $props = defineProps({
companyId: {
type: Number,
required: true,
},
totalCredit: {
type: Number,
required: true,
},
promise: {
type: Function,
required: true,
},
});
const closeButton = ref(null);
const urlCreate = ref([]);
const companyOptions = ref([]);
const bankOptions = ref([]);
const clientFindOne = ref([]);
const deliveredAmount = ref(null);
const amountToReturn = ref(null);
const viewRecipt = ref(true);
const sendEmail = ref(false);
const isLoading = ref(false);
const filterBanks = {
fields: ['id', 'bank', 'accountingTypeFk'],
include: { relation: 'accountingType' },
order: 'id',
limit: 30,
};
const filterClientFindOne = {
fields: ['email'],
where: {
id: `${route.params.id}`,
},
};
const initialData = reactive({
amountPaid: $props.totalCredit,
bankFk: null,
clientFk: `${route.params.id}`,
companyFk: $props.companyId,
compensationAccount: null,
description: null,
email: clientFindOne.value.email,
payed: null,
});
onBeforeMount(() => {
urlCreate.value = `Clients/${route.params.id}/createReceipt`;
});
const setPaymentType = (id) => {
initialData.payed = '2001-01-01T11:00:00.000Z';
if (id === 1) initialData.description = 'Credit card';
if (id === 2) initialData.description = 'Cash';
if (id === 3 || id === 3117) initialData.description = '';
if (id === 4) initialData.description = 'Transfer';
};
const calculateFromAmount = (event) => {
amountToReturn.value = parseFloat(event) * -1 + parseFloat(deliveredAmount.value);
};
const calculateFromDeliveredAmount = (event) => {
amountToReturn.value = parseFloat($props.totalCredit) * -1 + parseFloat(event);
};
const setClientEmail = (data) => {
initialData.email = data.email;
};
const onDataSaved = async () => {
isLoading.value = true;
if ($props.promise) {
try {
await $props.promise();
} finally {
isLoading.value = false;
if (closeButton.value) closeButton.value.click();
}
}
};
</script>
<template>
<QDialog ref="dialogRef">
<fetch-data
@on-fetch="(data) => (companyOptions = data)"
auto-load
url="Companies"
/>
<fetch-data
:filter="filterBanks"
@on-fetch="(data) => (bankOptions = data)"
auto-load
url="Banks"
/>
<fetch-data
:filter="filterClientFindOne"
@on-fetch="setClientEmail"
auto-load
url="Clients/findOne"
/>
<FormModel
:default-actions="false"
:form-initial-data="initialData"
:observe-form-changes="false"
:url-create="urlCreate"
@on-data-saved="onDataSaved()"
>
<template #form="{ data }">
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h5 class="flex justify-center q-mt-xs">
{{ t('New payment') }}
</h5>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInputDate
:label="t('Date')"
:required="true"
v-model="data.payed"
/>
</div>
<div class="col">
<VnSelectFilter
:label="t('Company')"
:options="companyOptions"
:required="true"
hide-selected
option-label="code"
option-value="id"
v-model="data.companyFk"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Bank')"
:options="bankOptions"
:required="true"
@update:model-value="setPaymentType($event)"
hide-selected
option-label="bank"
option-value="id"
v-model="data.bankFk"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt.id }}:&ensp;{{ scope.opt.bank }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
<div class="col">
<VnInput
:label="t('Amount')"
:required="true"
@update:model-value="calculateFromAmount($event)"
type="number"
v-model.number="data.amountPaid"
/>
</div>
</VnRow>
<div class="text-h6" v-if="data.bankFk === 3 || data.bankFk === 3117">
{{ t('Compensation') }}
</div>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col" v-if="data.bankFk === 3 || data.bankFk === 3117">
<VnInput
:label="t('Compensation account')"
v-model="data.compensationAccount"
/>
</div>
<div class="col">
<VnInput
:label="t('Reference')"
:required="true"
v-model="data.description"
/>
</div>
</VnRow>
<div class="q-mt-lg" v-if="data.bankFk === 2">
<div class="text-h6">{{ t('Cash') }}</div>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
:label="t('Delivered amount')"
@update:model-value="calculateFromDeliveredAmount($event)"
type="number"
v-model="deliveredAmount"
/>
</div>
<div class="col">
<VnInput
:label="t('Amount to return')"
disable
type="number"
v-model="amountToReturn"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox v-model="viewRecipt" />
</div>
<div class="col">
<QCheckbox v-model="sendEmail" />
</div>
</VnRow>
</div>
<div class="q-mt-lg row justify-end">
<QBtn
:disabled="isLoading"
:label="t('globals.cancel')"
:loading="isLoading"
class="q-ml-sm"
color="primary"
flat
type="reset"
v-close-popup
/>
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
color="primary"
type="submit"
/>
</div>
</template>
</FormModel>
</QDialog>
</template>
<i18n>
es:
New payment: Añadir pago
Date: Fecha
Company: Empresa
Bank: Caja
Amount: Importe
Reference: Referencia
Cash: Efectivo
Delivered amount: Cantidad entregada
Amount to return: Cantidad a devolver
View recipt: Ver recibido
Send email: Enviar correo
Compensation: Compensación
Compensation account: Cuenta para compensar
</i18n>

View File

@ -32,8 +32,8 @@ const toCustomerNotes = () => {
<FormModel <FormModel
:form-initial-data="initialData" :form-initial-data="initialData"
:observe-form-changes="false" :observe-form-changes="false"
url-create="ClientObservations"
@on-data-saved="toCustomerNotes()" @on-data-saved="toCustomerNotes()"
url-create="ClientObservations"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">

View File

@ -0,0 +1,72 @@
<script setup>
import { onMounted, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const initialData = reactive({
started: '2001-01-01T11:00:00.000Z',
finished: null,
amount: null,
period: null,
});
onMounted(() => {
initialData.clientFk = `${route.params.id}`;
});
const toCustomerRecoveries = () => {
router.push({
name: 'CustomerRecoveries',
params: {
id: route.params.id,
},
});
};
</script>
<template>
<FormModel
:form-initial-data="initialData"
:observe-form-changes="false"
@on-data-saved="toCustomerRecoveries()"
model="client"
url-create="Recoveries"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInputDate :label="t('Since')" v-model="data.started" />
</div>
<div class="col">
<VnInputDate :label="t('To')" v-model="data.finished" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Amount')" type="number" v-model="data.amount" />
</div>
<div class="col">
<VnInput :label="t('Period')" type="number" v-model="data.period" />
</div>
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Since: Desde
To: Hasta
Amount: Importe
Period: Periodo
</i18n>

View File

@ -2,6 +2,7 @@
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, onUnmounted, ref } from 'vue';
import { dashIfEmpty, toDate, toHour } from 'src/filters'; import { dashIfEmpty, toDate, toHour } from 'src/filters';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
@ -15,23 +16,15 @@ import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue'; import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import RouteSummary from 'pages/Route/Card/RouteSummary.vue'; import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import {useSession} from "composables/useSession";
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const { validate } = useValidator(); const { validate } = useValidator();
const session = useSession();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const to = Date.vnNew();
to.setDate(to.getDate() + 1);
to.setHours(0, 0, 0, 0);
const from = Date.vnNew();
from.setDate(from.getDate());
from.setHours(0, 0, 0, 0);
const params = ref({ from, to });
onMounted(() => (stateStore.rightDrawer = true)); onMounted(() => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
@ -150,6 +143,23 @@ const cloneRoutes = () => {
startingDate.value = null; startingDate.value = null;
}; };
const showRouteReport = () => {
const ids = selectedRows.value.map(row => row?.id)
const idString = ids.join(',')
let url;
if (selectedRows.value.length <= 1) {
url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getToken()}`;
} else {
const params = new URLSearchParams({
access_token: session.getToken(),
id: idString
})
url = `api/Routes/downloadZip?${params.toString()}`;
}
window.open(url, '_blank');
}
const markAsServed = () => { const markAsServed = () => {
selectedRows.value.forEach((row) => { selectedRows.value.forEach((row) => {
if (row?.id) { if (row?.id) {
@ -195,7 +205,6 @@ const markAsServed = () => {
autofocus autofocus
/> />
</QCardSection> </QCardSection>
<!-- TODO: Add report -->
<QCardActions align="right"> <QCardActions align="right">
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" /> <QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
<QBtn color="primary" v-close-popup @click="cloneRoutes"> <QBtn color="primary" v-close-popup @click="cloneRoutes">
@ -228,7 +237,15 @@ const markAsServed = () => {
> >
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip> <QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
</QBtn> </QBtn>
<QBtn
icon="cloud_download"
color="primary"
class="q-mr-sm"
:disable="!selectedRows?.length"
@click="showRouteReport"
>
<QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
</QBtn>
<QBtn <QBtn
icon="check" icon="check"
color="primary" color="primary"
@ -515,6 +532,7 @@ es:
Cancel: Cancelar Cancel: Cancelar
Clone: Clonar Clone: Clonar
Mark as served: Marcar como servidas Mark as served: Marcar como servidas
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
Add ticket: Añadir tickets Add ticket: Añadir tickets
Preview: Vista previa Preview: Vista previa
</i18n> </i18n>

View File

@ -21,19 +21,19 @@ function confirmRemove() {
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {
title: t('confirmDeletion'), title: t('Confirm deletion'),
message: t('confirmDeletionMessage'), message: t('Are you sure you want to delete this shelving?'),
promise: remove, promise: remove
}, },
}) })
.onOk(async () => await router.push({ name: 'ShelvingList' }));
} }
async function remove() { async function remove() {
if (!$props.shelving.value.id) { if (!$props.shelving.id) {
return; return;
} }
await axios.delete(`Shelvings/${$props.shelving.value.id}`); await axios.delete(`Shelvings/${$props.shelving.id}`);
await router.push({ name: 'ShelvingList' });
quasar.notify({ quasar.notify({
message: t('globals.dataDeleted'), message: t('globals.dataDeleted'),
type: 'positive', type: 'positive',
@ -45,17 +45,13 @@ async function remove() {
<QItemSection avatar> <QItemSection avatar>
<QIcon name="delete" /> <QIcon name="delete" />
</QItemSection> </QItemSection>
<QItemSection>{{ t('deleteShelving') }}</QItemSection> <QItemSection>{{ t('Delete Shelving') }}</QItemSection>
</QItem> </QItem>
</template> </template>
<i18n> <i18n>
{ es:
"en": { Confirm deletion: Confirmar eliminación
"deleteShelving": "Delete Shelving" Are you sure you want to delete this shelving?: ¿Seguro que quieres eliminar este carro?
}, Delete Shelving: Eliminar carro
"es": {
"deleteShelving": "Eliminar carro"
}
}
</i18n> </i18n>

View File

@ -114,9 +114,11 @@ en:
parkingFk: Parking parkingFk: Parking
userFk: Worker userFk: Worker
isRecyclable: Recyclable isRecyclable: Recyclable
search: Search
es: es:
params: params:
parkingFk: Parking parkingFk: Parking
userFk: Trabajador userFk: Trabajador
isRecyclable: Reciclable isRecyclable: Reciclable
search: Contiene
</i18n> </i18n>

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
@ -10,11 +10,12 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const shelvingId = route.params?.id || null; const shelvingId = route.params?.id || null;
const isNew = Boolean(!shelvingId); const isNew = Boolean(!shelvingId);
const defaultInitialData = { const defaultInitialData = {
parkingFk: null, parkingFk: null,
priority: 0, priority: null,
code: null, code: null,
isRecyclable: false, isRecyclable: false,
}; };
@ -58,6 +59,12 @@ const shelvingFilter = {
{ relation: 'parking' }, { relation: 'parking' },
], ],
}; };
const onSave = (shelving, newShelving) => {
if (isNew) {
router.push({ name: 'ShelvingBasicData', params: { id: newShelving?.id } });
}
};
</script> </script>
<template> <template>
<VnSubToolbar /> <VnSubToolbar />
@ -75,6 +82,7 @@ const shelvingFilter = {
model="shelving" model="shelving"
:auto-load="!isNew" :auto-load="!isNew"
:form-initial-data="defaultInitialData" :form-initial-data="defaultInitialData"
@on-data-saved="onSave"
> >
<template #form="{ data, validate, filter }"> <template #form="{ data, validate, filter }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
@ -107,6 +115,7 @@ const shelvingFilter = {
<div class="col"> <div class="col">
<VnInput <VnInput
v-model="data.priority" v-model="data.priority"
type="number"
:label="t('shelving.basicData.priority')" :label="t('shelving.basicData.priority')"
:rules="validate('Shelving.priority')" :rules="validate('Shelving.priority')"
/> />

View File

@ -7,12 +7,12 @@ const { t } = useI18n();
<template> <template>
<VnSearchbar <VnSearchbar
data-key="ShelvingList" data-key="ShelvingList"
url="Shelvings"
:label="t('Search shelving')" :label="t('Search shelving')"
:info="t('You can search by search reference')" :info="t('You can search by shelving reference')"
/> />
</template> </template>
<style scoped lang="scss"></style>
<i18n> <i18n>
es: es:
Search shelving: Buscar carros Search shelving: Buscar carros

View File

@ -6,6 +6,7 @@ import { useStateStore } from 'stores/useStateStore';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue'; import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
import VnUserLink from "components/ui/VnUserLink.vue";
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -24,7 +25,7 @@ const hideRightDrawer = () => {
if (!isDialog) { if (!isDialog) {
stateStore.rightDrawer = false; stateStore.rightDrawer = false;
} }
} };
onMounted(hideRightDrawer); onMounted(hideRightDrawer);
onUnmounted(hideRightDrawer); onUnmounted(hideRightDrawer);
const filter = { const filter = {
@ -69,9 +70,13 @@ const filter = {
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<QCard class="vn-one"> <QCard class="vn-one">
<div class="header"> <RouterLink
class="header"
:to="{ name: 'ShelvingBasicData', params: { id: entityId } }"
>
{{ t('shelving.pageTitles.basicData') }} {{ t('shelving.pageTitles.basicData') }}
</div> <QIcon name="open_in_new" color="primary" />
</RouterLink>
<VnLv :label="t('shelving.summary.code')" :value="entity.code" /> <VnLv :label="t('shelving.summary.code')" :value="entity.code" />
<VnLv <VnLv
:label="t('shelving.summary.parking')" :label="t('shelving.summary.parking')"
@ -81,10 +86,14 @@ const filter = {
:label="t('shelving.summary.priority')" :label="t('shelving.summary.priority')"
:value="entity.priority" :value="entity.priority"
/> />
<VnLv <VnLv v-if="entity.worker" :label="t('shelving.summary.worker')">
:label="t('shelving.summary.worker')" <template #value>
:value="entity.worker?.user?.nickname" <VnUserLink
/> :name="entity.worker?.user?.nickname"
:worker-id="entity.worker?.id"
/>
</template>
</VnLv>
<VnLv <VnLv
:label="t('shelving.summary.recyclable')" :label="t('shelving.summary.recyclable')"
:value="entity.isRecyclable" :value="entity.isRecyclable"

View File

@ -71,6 +71,7 @@ function exprBuilder(param, value) {
url="Shelvings" url="Shelvings"
:filter="filter" :filter="filter"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:limit="20"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
@ -93,17 +94,10 @@ function exprBuilder(param, value) {
/> />
</template> </template>
<template #actions> <template #actions>
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)"
class="bg-vn-dark"
outline
/>
<QBtn <QBtn
:label="t('components.smartCard.openSummary')" :label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, ShelvingSummary)" @click.stop="viewSummary(row.id, ShelvingSummary)"
color="primary" color="primary"
style="margin-top: 15px"
/> />
</template> </template>
</CardList> </CardList>

View File

@ -254,13 +254,31 @@ export default {
}, },
{ {
path: 'greuges', path: 'greuges',
name: 'CustomerGreuges', name: 'GreugesCard',
meta: { redirect: { name: 'CustomerGreuges' },
title: 'greuges', children: [
icon: 'vn:greuge', {
}, path: '',
component: () => name: 'CustomerGreuges',
import('src/pages/Customer/Card/CustomerGreuges.vue'), meta: {
title: 'greuges',
icon: 'vn:greuge',
},
component: () =>
import('src/pages/Customer/Card/CustomerGreuges.vue'),
},
{
path: 'create',
name: 'CustomerGreugeCreate',
meta: {
title: 'greuge-create',
},
component: () =>
import(
'src/pages/Customer/components/CustomerGreugeCreate.vue'
),
},
],
}, },
{ {
path: 'balance', path: 'balance',
@ -274,13 +292,31 @@ export default {
}, },
{ {
path: 'recoveries', path: 'recoveries',
name: 'CustomerRecoveries', name: 'RecoveriesCard',
meta: { redirect: { name: 'CustomerRecoveries' },
title: 'recoveries', children: [
icon: 'vn:recovery', {
}, path: '',
component: () => name: 'CustomerRecoveries',
import('src/pages/Customer/Card/CustomerRecoveries.vue'), meta: {
title: 'recoveries',
icon: 'vn:recovery',
},
component: () =>
import('src/pages/Customer/Card/CustomerRecoveries.vue'),
},
{
path: 'create',
name: 'CustomerRecoverieCreate',
meta: {
title: 'recoverie-create',
},
component: () =>
import(
'src/pages/Customer/components/CustomerRecoverieCreate.vue'
),
},
],
}, },
{ {
path: 'web-access', path: 'web-access',
@ -316,10 +352,49 @@ export default {
meta: { meta: {
title: 'creditManagement', title: 'creditManagement',
icon: 'paid', icon: 'paid',
menuChildren: [
{
name: 'CustomerCreditContracts',
title: 'creditContracts',
icon: 'paid',
},
{
name: 'CustomerCreditOpinion',
title: 'creditOpinion',
icon: 'paid',
},
],
}, },
component: () => component: () =>
import('src/pages/Customer/Card/CustomerCreditManagement.vue'), import('src/pages/Customer/Card/CustomerCreditManagement.vue'),
children: [
{
path: 'credit-contracts',
name: 'CustomerCreditContracts',
meta: {
title: 'creditContracts',
icon: 'paid',
},
component: () =>
import(
'src/pages/Customer/Card/CustomerCreditContracts.vue'
),
},
{
path: 'credit-opinion',
name: 'CustomerCreditOpinion',
meta: {
title: 'creditOpinion',
icon: 'paid',
},
component: () =>
import(
'src/pages/Customer/Card/CustomerCreditOpinion.vue'
),
},
],
}, },
{ {
path: 'others', path: 'others',
name: 'CustomerOthers', name: 'CustomerOthers',

View File

@ -52,13 +52,20 @@ export const useNavigationStore = defineStore('navigationStore', () => {
function addMenuItem(module, route, parent) { function addMenuItem(module, route, parent) {
const { meta } = route; const { meta } = route;
let { menuChildren = null } = meta;
if (menuChildren)
menuChildren = menuChildren.map(({ name, title, icon }) => ({
name,
icon,
title: `${module}.pageTitles.${title}`,
}));
if (meta && meta.roles && role.hasAny(meta.roles) === false) return; if (meta && meta.roles && role.hasAny(meta.roles) === false) return;
const item = { const item = {
name: route.name, name: route.name,
children: menuChildren,
}; };
if (meta) { if (meta) {
item.title = `${module}.pageTitles.${meta.title}`; item.title = `${module}.pageTitles.${meta.title}`;
item.icon = meta.icon; item.icon = meta.icon;

View File

@ -76,11 +76,13 @@ describe('Leftmenu', () => {
it('should return a proper formated object with two child items', async () => { it('should return a proper formated object with two child items', async () => {
const expectedMenuItem = [ const expectedMenuItem = [
{ {
children: null,
name: 'CustomerList', name: 'CustomerList',
title: 'customer.pageTitles.list', title: 'customer.pageTitles.list',
icon: 'view_list', icon: 'view_list',
}, },
{ {
children: null,
name: 'CustomerCreate', name: 'CustomerCreate',
title: 'customer.pageTitles.createCustomer', title: 'customer.pageTitles.createCustomer',
icon: 'vn:addperson', icon: 'vn:addperson',