0
0
Fork 0

Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7283-fixItemDescriptor

This commit is contained in:
Carlos Satorres 2024-09-05 12:07:18 +02:00
commit 8fe6fad4a7
102 changed files with 2324 additions and 1416 deletions

View File

@ -113,7 +113,10 @@
- refs #7355 fix lists redirects summary by:carlossa - refs #7355 fix lists redirects summary by:carlossa
- refs #7355 fix roles by:carlossa - refs #7355 fix roles by:carlossa
- refs #7355 fix search exprBuilder by:carlossa - refs #7355 fix search exprBuilder by:carlossa
- refs #7355 fix vnTable by:carlos <<<<<<< HEAD
- # refs #7355 fix vnTable by:carlos
- refs #7355 fix vnTable by:carlossa
> > > > > > > 1b8a72175cc1dbae0590217b03d855bf2ff6d07d
# Version 24.32 - 2024-08-06 # Version 24.32 - 2024-08-06

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "24.34.0", "version": "24.36.0",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",

View File

@ -0,0 +1,38 @@
import routes from 'src/router/modules';
import { useRouter } from 'vue-router';
let isNotified = false;
export default {
created: function () {
const router = useRouter();
const keyBindingMap = routes
.filter((route) => route.meta.keyBinding)
.reduce((map, route) => {
map[route.meta.keyBinding.toLowerCase()] = route.path;
return map;
}, {});
const handleKeyDown = (event) => {
const { ctrlKey, altKey, key } = event;
if (ctrlKey && altKey && keyBindingMap[key] && !isNotified) {
event.preventDefault();
router.push(keyBindingMap[key]);
isNotified = true;
}
};
const handleKeyUp = (event) => {
const { ctrlKey, altKey } = event;
// Resetea la bandera cuando se sueltan las teclas ctrl o alt
if (!ctrlKey || !altKey) {
isNotified = false;
}
};
window.addEventListener('keydown', handleKeyDown);
window.addEventListener('keyup', handleKeyUp);
},
};

View File

@ -1,6 +1,8 @@
import { boot } from 'quasar/wrappers'; import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin'; import qFormMixin from './qformMixin';
import mainShortcutMixin from './mainShortcutMixin';
export default boot(({ app }) => { export default boot(({ app }) => {
app.mixin(qFormMixin); app.mixin(qFormMixin);
app.mixin(mainShortcutMixin);
}); });

View File

@ -22,7 +22,7 @@ const { t } = useI18n();
const { validate } = useValidator(); const { validate } = useValidator();
const { notify } = useNotify(); const { notify } = useNotify();
const route = useRoute(); const route = useRoute();
const myForm = ref(null);
const $props = defineProps({ const $props = defineProps({
url: { url: {
type: String, type: String,
@ -109,11 +109,14 @@ const defaultButtons = computed(() => ({
color: 'primary', color: 'primary',
icon: 'save', icon: 'save',
label: 'globals.save', label: 'globals.save',
click: () => myForm.value.submit(),
type: 'submit',
}, },
reset: { reset: {
color: 'primary', color: 'primary',
icon: 'restart_alt', icon: 'restart_alt',
label: 'globals.reset', label: 'globals.reset',
click: () => reset(),
}, },
...$props.defaultButtons, ...$props.defaultButtons,
})); }));
@ -276,7 +279,14 @@ defineExpose({
</script> </script>
<template> <template>
<div class="column items-center full-width"> <div class="column items-center full-width">
<QForm @submit="save" @reset="reset" class="q-pa-md" id="formModel"> <QForm
ref="myForm"
v-if="formData"
@submit="save"
@reset="reset"
class="q-pa-md"
id="formModel"
>
<QCard> <QCard>
<slot <slot
v-if="formData" v-if="formData"
@ -304,7 +314,7 @@ defineExpose({
:color="defaultButtons.reset.color" :color="defaultButtons.reset.color"
:icon="defaultButtons.reset.icon" :icon="defaultButtons.reset.icon"
flat flat
@click="reset" @click="defaultButtons.reset.click"
:disable="!hasChanges" :disable="!hasChanges"
:title="t(defaultButtons.reset.label)" :title="t(defaultButtons.reset.label)"
/> />
@ -344,7 +354,7 @@ defineExpose({
:label="tMobile('globals.save')" :label="tMobile('globals.save')"
color="primary" color="primary"
icon="save" icon="save"
@click="save" @click="defaultButtons.save.click"
:disable="!hasChanges" :disable="!hasChanges"
:title="t(defaultButtons.save.label)" :title="t(defaultButtons.save.label)"
/> />

View File

@ -0,0 +1,173 @@
<script setup>
import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { useDialogPluginComponent } from 'quasar';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
import VnSelect from 'components/common/VnSelect.vue';
import FormPopup from './FormPopup.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
const $props = defineProps({
invoiceOutData: {
type: Object,
default: () => {},
},
});
const { dialogRef } = useDialogPluginComponent();
const { t } = useI18n();
const router = useRouter();
const { notify } = useNotify();
const rectificativeTypeOptions = ref([]);
const siiTypeInvoiceOutsOptions = ref([]);
const inheritWarehouse = ref(true);
const invoiceParams = reactive({
id: $props.invoiceOutData?.id,
});
const invoiceCorrectionTypesOptions = ref([]);
const refund = async () => {
const params = {
id: invoiceParams.id,
cplusRectificationTypeFk: invoiceParams.cplusRectificationTypeFk,
siiTypeInvoiceOutFk: invoiceParams.siiTypeInvoiceOutFk,
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
};
try {
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
notify(t('Refunded invoice'), 'positive');
const [id] = data?.refundId || [];
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
} catch (err) {
console.error('Error refunding invoice', err);
}
};
</script>
<template>
<FetchData
url="CplusRectificationTypes"
:filter="{ order: 'description' }"
@on-fetch="
(data) => (
(rectificativeTypeOptions = data),
(invoiceParams.cplusRectificationTypeFk = data.filter(
(type) => type.description == 'I Por diferencias'
)[0].id)
)
"
auto-load
/>
<FetchData
url="SiiTypeInvoiceOuts"
:filter="{ where: { code: { like: 'R%' } } }"
@on-fetch="
(data) => (
(siiTypeInvoiceOutsOptions = data),
(invoiceParams.siiTypeInvoiceOutFk = data.filter(
(type) => type.code == 'R4'
)[0].id)
)
"
auto-load
/>
<FetchData
url="InvoiceCorrectionTypes"
@on-fetch="(data) => (invoiceCorrectionTypesOptions = data)"
auto-load
/>
<QDialog ref="dialogRef">
<FormPopup
@on-submit="refund()"
:custom-submit-button-label="t('Accept')"
:default-cancel-button="false"
>
<template #form-inputs>
<VnRow>
<VnSelect
:label="t('Rectificative type')"
:options="rectificativeTypeOptions"
hide-selected
option-label="description"
option-value="id"
v-model="invoiceParams.cplusRectificationTypeFk"
:required="true"
/>
</VnRow>
<VnRow>
<VnSelect
:label="t('Class')"
:options="siiTypeInvoiceOutsOptions"
hide-selected
option-label="description"
option-value="id"
v-model="invoiceParams.siiTypeInvoiceOutFk"
:required="true"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.code }} -
{{ scope.opt?.description }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow>
<VnRow>
<VnSelect
:label="t('Type')"
:options="invoiceCorrectionTypesOptions"
hide-selected
option-label="description"
option-value="id"
v-model="invoiceParams.invoiceCorrectionTypeFk"
:required="true"
/> </VnRow
><VnRow>
<div>
<QCheckbox
:label="t('Inherit warehouse')"
v-model="inheritWarehouse"
/>
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
<QTooltip>{{ t('Inherit warehouse tooltip') }}</QTooltip>
</QIcon>
</div>
</VnRow>
</template>
</FormPopup>
</QDialog>
</template>
<i18n>
en:
Refund invoice: Refund invoice
Rectificative type: Rectificative type
Class: Class
Type: Type
Refunded invoice: Refunded invoice
Inherit warehouse: Inherit the warehouse
Inherit warehouse tooltip: Select this option to inherit the warehouse when refunding the invoice
Accept: Accept
Error refunding invoice: Error refunding invoice
es:
Refund invoice: Abonar factura
Rectificative type: Tipo rectificativa
Class: Clase
Type: Tipo
Refunded invoice: Factura abonada
Inherit warehouse: Heredar el almacén
Inherit warehouse tooltip: Seleccione esta opción para heredar el almacén al abonar la factura.
Accept: Aceptar
Error refunding invoice: Error abonando factura
</i18n>

View File

@ -2,13 +2,12 @@
import { ref, reactive } from 'vue'; import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar, useDialogPluginComponent } from 'quasar';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
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 VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import FormPopup from './FormPopup.vue'; import FormPopup from './FormPopup.vue';
import { useDialogPluginComponent } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
@ -18,19 +17,19 @@ const $props = defineProps({
default: () => {}, default: () => {},
}, },
}); });
const { dialogRef } = useDialogPluginComponent(); const { dialogRef } = useDialogPluginComponent();
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
const { notify } = useNotify(); const { notify } = useNotify();
const checked = ref(true);
const transferInvoiceParams = reactive({
id: $props.invoiceOutData?.id,
refFk: $props.invoiceOutData?.ref,
});
const rectificativeTypeOptions = ref([]); const rectificativeTypeOptions = ref([]);
const siiTypeInvoiceOutsOptions = ref([]); const siiTypeInvoiceOutsOptions = ref([]);
const checked = ref(true);
const transferInvoiceParams = reactive({
id: $props.invoiceOutData?.id,
});
const invoiceCorrectionTypesOptions = ref([]); const invoiceCorrectionTypesOptions = ref([]);
const selectedClient = (client) => { const selectedClient = (client) => {
@ -44,10 +43,9 @@ const makeInvoice = async () => {
const params = { const params = {
id: transferInvoiceParams.id, id: transferInvoiceParams.id,
cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk, cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk,
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk, invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk,
newClientFk: transferInvoiceParams.newClientFk, newClientFk: transferInvoiceParams.newClientFk,
refFk: transferInvoiceParams.refFk,
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
makeInvoice: checked.value, makeInvoice: checked.value,
}; };
@ -74,7 +72,7 @@ const makeInvoice = async () => {
} }
} }
const { data } = await axios.post('InvoiceOuts/transferInvoice', params); const { data } = await axios.post('InvoiceOuts/transfer', params);
notify(t('Transferred invoice'), 'positive'); notify(t('Transferred invoice'), 'positive');
const id = data?.[0]; const id = data?.[0];
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } }); if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });

View File

@ -107,7 +107,7 @@ const orders = ref(parseOrder(routeQuery.filter?.order));
const CrudModelRef = ref({}); const CrudModelRef = ref({});
const showForm = ref(false); const showForm = ref(false);
const splittedColumns = ref({ columns: [] }); const splittedColumns = ref({ columns: [] });
const columnsVisibilitySkiped = ref(); const columnsVisibilitySkipped = ref();
const createForm = ref(); const createForm = ref();
const tableModes = [ const tableModes = [
@ -135,7 +135,7 @@ onMounted(() => {
? CARD_MODE ? CARD_MODE
: $props.defaultMode; : $props.defaultMode;
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
columnsVisibilitySkiped.value = [ columnsVisibilitySkipped.value = [
...splittedColumns.value.columns ...splittedColumns.value.columns
.filter((c) => c.visible == false) .filter((c) => c.visible == false)
.map((c) => c.name), .map((c) => c.name),
@ -178,10 +178,20 @@ function setUserParams(watchedParams, watchedOrder) {
watchedParams = { ...watchedParams, ...where }; watchedParams = { ...watchedParams, ...where };
delete watchedParams.filter; delete watchedParams.filter;
delete params.value?.filter; delete params.value?.filter;
params.value = { ...params.value, ...watchedParams }; params.value = { ...params.value, ...sanitizer(watchedParams) };
orders.value = parseOrder(order); orders.value = parseOrder(order);
} }
function sanitizer(params) {
for (const [key, value] of Object.entries(params)) {
if (typeof value == 'object') {
const param = Object.values(value)[0];
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
}
}
return params;
}
function splitColumns(columns) { function splitColumns(columns) {
splittedColumns.value = { splittedColumns.value = {
columns: [], columns: [],
@ -332,296 +342,280 @@ defineExpose({
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<!-- class in div to fix warn--> <!-- class in div to fix warn-->
<div class="q-px-md">
<CrudModel <CrudModel
v-bind="$attrs" v-bind="$attrs"
:limit="20" :class="$attrs['class'] ?? 'q-px-md'"
ref="CrudModelRef" :limit="20"
@on-fetch="(...args) => emit('onFetch', ...args)" ref="CrudModelRef"
:search-url="searchUrl" @on-fetch="(...args) => emit('onFetch', ...args)"
:disable-infinite-scroll="isTableMode" :search-url="searchUrl"
@save-changes="reload" :disable-infinite-scroll="isTableMode"
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable" @save-changes="reload"
:auto-load="hasParams || $attrs['auto-load']" :has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
> :auto-load="hasParams || $attrs['auto-load']"
<template >
v-for="(_, slotName) in $slots" <template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
#[slotName]="slotData" <slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
:key="slotName" </template>
<template #body="{ rows }">
<QTable
v-bind="table"
class="vnTable"
:columns="splittedColumns.columns"
:rows="rows"
v-model:selected="selected"
:grid="!isTableMode"
table-header-class="bg-header"
card-container-class="grid-three"
flat
:style="isTableMode && `max-height: ${tableHeight}`"
virtual-scroll
@virtual-scroll="
(event) =>
event.index > rows.length - 2 &&
CrudModelRef.vnPaginateRef.paginate()
"
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
@update:selected="emit('update:selected', $event)"
> >
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" /> <template #top-left v-if="!$props.withoutHeader">
</template> <slot name="top-left"></slot>
<template #body="{ rows }"> </template>
<QTable <template #top-right v-if="!$props.withoutHeader">
v-bind="table" <VnVisibleColumn
class="vnTable" v-if="isTableMode"
:columns="splittedColumns.columns" v-model="splittedColumns.columns"
:rows="rows" :table-code="tableCode ?? route.name"
v-model:selected="selected" :skip="columnsVisibilitySkipped"
:grid="!isTableMode" />
table-header-class="bg-header" <QBtnToggle
card-container-class="grid-three" v-model="mode"
flat toggle-color="primary"
:style="isTableMode && `max-height: ${tableHeight}`" class="bg-vn-section-color"
virtual-scroll dense
@virtual-scroll=" :options="tableModes.filter((mode) => !mode.disable)"
(event) => />
event.index > rows.length - 2 && <QBtn
CrudModelRef.vnPaginateRef.paginate() v-if="$props.rightSearch"
" icon="filter_alt"
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)" class="bg-vn-section-color q-ml-md"
@update:selected="emit('update:selected', $event)" dense
> @click="stateStore.toggleRightDrawer()"
<template #top-left v-if="!$props.withoutHeader"> />
<slot name="top-left"></slot> </template>
</template> <template #header-cell="{ col }">
<template #top-right v-if="!$props.withoutHeader"> <QTh v-if="col.visible ?? true">
<VnVisibleColumn <div
v-if="isTableMode" class="column self-start q-ml-xs ellipsis"
v-model="splittedColumns.columns" :class="`text-${col?.align ?? 'left'}`"
:table-code="tableCode ?? route.name" :style="$props.columnSearch ? 'height: 75px' : ''"
:skip="columnsVisibilitySkiped" >
/> <div class="row items-center no-wrap" style="height: 30px">
<QBtnToggle <QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
v-model="mode" <VnTableOrder
toggle-color="primary" v-model="orders[col.orderBy ?? col.name]"
class="bg-vn-section-color" :name="col.orderBy ?? col.name"
dense :label="col?.label"
:options="tableModes"
/>
<QBtn
v-if="$props.rightSearch"
icon="filter_alt"
class="bg-vn-section-color q-ml-md"
dense
@click="stateStore.toggleRightDrawer()"
/>
</template>
<template #header-cell="{ col }">
<QTh v-if="col.visible ?? true">
<div
class="column self-start q-ml-xs ellipsis"
:class="`text-${col?.align ?? 'left'}`"
:style="$props.columnSearch ? 'height: 75px' : ''"
>
<div
class="row items-center no-wrap"
style="height: 30px"
>
<VnTableOrder
v-model="orders[col.orderBy ?? col.name]"
:name="col.orderBy ?? col.name"
:label="col?.label"
:data-key="$attrs['data-key']"
:search-url="searchUrl"
/>
</div>
<VnTableFilter
v-if="$props.columnSearch"
:column="col"
:show-title="true"
:data-key="$attrs['data-key']" :data-key="$attrs['data-key']"
v-model="params[columnName(col)]"
:search-url="searchUrl" :search-url="searchUrl"
class="full-width"
/> />
</div> </div>
</QTh> <VnTableFilter
</template> v-if="$props.columnSearch"
<template #header-cell-tableActions> :column="col"
<QTh auto-width class="sticky" /> :show-title="true"
</template> :data-key="$attrs['data-key']"
<template #body-cell-tableStatus="{ col, row }"> v-model="params[columnName(col)]"
<QTd auto-width :class="getColAlign(col)"> :search-url="searchUrl"
<VnTableChip class="full-width"
:columns="splittedColumns.columnChips" />
</div>
</QTh>
</template>
<template #header-cell-tableActions>
<QTh auto-width class="sticky" />
</template>
<template #body-cell-tableStatus="{ col, row }">
<QTd auto-width :class="getColAlign(col)">
<VnTableChip :columns="splittedColumns.columnChips" :row="row">
<template #afterChip>
<slot name="afterChip" :row="row"></slot>
</template>
</VnTableChip>
</QTd>
</template>
<template #body-cell="{ col, row, rowIndex }">
<!-- Columns -->
<QTd
auto-width
class="no-margin q-px-xs"
:class="[getColAlign(col), col.columnClass]"
v-if="col.visible ?? true"
@click.ctrl="
($event) =>
rowCtrlClickFunction && rowCtrlClickFunction($event, row)
"
>
<slot
:name="`column-${col.name}`"
:col="col"
:row="row"
:row-index="rowIndex"
>
<VnTableColumn
:column="col"
:row="row" :row="row"
> :is-editable="col.isEditable ?? isEditable"
<template #afterChip> v-model="row[col.name]"
<slot name="afterChip" :row="row"></slot> component-prop="columnField"
</template> />
</VnTableChip> </slot>
</QTd> </QTd>
</template> </template>
<template #body-cell="{ col, row, rowIndex }"> <template #body-cell-tableActions="{ col, row }">
<!-- Columns --> <QTd
<QTd auto-width
auto-width :class="getColAlign(col)"
class="no-margin q-px-xs" class="sticky no-padding"
:class="[getColAlign(col), col.columnClass]" @click="stopEventPropagation($event)"
v-if="col.visible ?? true" >
@click.ctrl=" <QBtn
($event) => v-for="(btn, index) of col.actions"
rowCtrlClickFunction && :key="index"
rowCtrlClickFunction($event, row) :title="btn.title"
:icon="btn.icon"
class="q-px-sm"
flat
:class="
btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
"
:style="`visibility: ${
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
}`"
@click="btn.action(row)"
/>
</QTd>
</template>
<template #item="{ row, colsMap }">
<component
:is="$props.redirect ? 'router-link' : 'span'"
:to="`/${$props.redirect}/` + row.id"
>
<QCard
bordered
flat
class="row no-wrap justify-between cursor-pointer"
@click="
(_, row) => {
$props.rowClick && $props.rowClick(row);
}
" "
> >
<slot <QCardSection
:name="`column-${col.name}`" vertical
:col="col" class="no-margin no-padding"
:row="row" :class="colsMap.tableActions ? 'w-80' : 'fit'"
:row-index="rowIndex"
>
<VnTableColumn
:column="col"
:row="row"
:is-editable="col.isEditable ?? isEditable"
v-model="row[col.name]"
component-prop="columnField"
/>
</slot>
</QTd>
</template>
<template #body-cell-tableActions="{ col, row }">
<QTd
auto-width
:class="getColAlign(col)"
class="sticky no-padding"
@click="stopEventPropagation($event)"
>
<QBtn
v-for="(btn, index) of col.actions"
:key="index"
:title="btn.title"
:icon="btn.icon"
class="q-px-sm"
flat
:class="
btn.isPrimary
? 'text-primary-light'
: 'color-vn-text '
"
:style="`visibility: ${
(btn.show && btn.show(row)) ?? true
? 'visible'
: 'hidden'
}`"
@click="btn.action(row)"
/>
</QTd>
</template>
<template #item="{ row, colsMap }">
<component
:is="$props.redirect ? 'router-link' : 'span'"
:to="`/${$props.redirect}/` + row.id"
>
<QCard
bordered
flat
class="row no-wrap justify-between cursor-pointer"
@click="
(_, row) => {
$props.rowClick && $props.rowClick(row);
}
"
> >
<!-- Chips -->
<QCardSection <QCardSection
vertical v-if="splittedColumns.chips.length"
class="no-margin no-padding" class="no-margin q-px-xs q-py-none"
:class="colsMap.tableActions ? 'w-80' : 'fit'"
> >
<!-- Chips --> <VnTableChip
<QCardSection :columns="splittedColumns.chips"
v-if="splittedColumns.chips.length" :row="row"
class="no-margin q-px-xs q-py-none"
> >
<VnTableChip <template #afterChip>
:columns="splittedColumns.chips" <slot name="afterChip" :row="row"></slot>
:row="row" </template>
> </VnTableChip>
<template #afterChip> </QCardSection>
<slot name="afterChip" :row="row"></slot> <!-- Title -->
</template> <QCardSection
</VnTableChip> v-if="splittedColumns.title"
</QCardSection> class="q-pl-sm q-py-none text-primary-light text-bold text-h6 cardEllipsis"
<!-- Title --> >
<QCardSection <span
v-if="splittedColumns.title" :title="row[splittedColumns.title.name]"
class="q-pl-sm q-py-none text-primary-light text-bold text-h6 cardEllipsis" @click="stopEventPropagation($event)"
class="cursor-text"
> >
<span {{ row[splittedColumns.title.name] }}
:title="row[splittedColumns.title.name]" </span>
@click="stopEventPropagation($event)" </QCardSection>
class="cursor-text" <!-- Fields -->
> <QCardSection
{{ row[splittedColumns.title.name] }} class="q-pl-sm q-pr-lg q-py-xs"
</span> :class="$props.cardClass"
</QCardSection> >
<!-- Fields --> <div
<QCardSection v-for="(
class="q-pl-sm q-pr-lg q-py-xs" col, index
:class="$props.cardClass" ) of splittedColumns.cardVisible"
:key="col.name"
class="fields"
> >
<div <VnLv
v-for="( :label="
col, index !col.component && col.label
) of splittedColumns.cardVisible" ? `${col.label}:`
:key="col.name" : ''
class="fields" "
> >
<VnLv <template #value>
:label=" <span
!col.component && col.label @click="stopEventPropagation($event)"
? `${col.label}:` >
: '' <slot
" :name="`column-${col.name}`"
> :col="col"
<template #value> :row="row"
<span :row-index="index"
@click="
stopEventPropagation($event)
"
> >
<slot <VnTableColumn
:name="`column-${col.name}`" :column="col"
:col="col"
:row="row" :row="row"
:row-index="index" :is-editable="false"
> v-model="row[col.name]"
<VnTableColumn component-prop="columnField"
:column="col" :show-label="true"
:row="row" />
:is-editable="false" </slot>
v-model="row[col.name]" </span>
component-prop="columnField" </template>
:show-label="true" </VnLv>
/> </div>
</slot>
</span>
</template>
</VnLv>
</div>
</QCardSection>
</QCardSection> </QCardSection>
<!-- Actions --> </QCardSection>
<QCardSection <!-- Actions -->
v-if="colsMap.tableActions" <QCardSection
class="column flex-center w-10 no-margin q-pa-xs q-gutter-y-xs" v-if="colsMap.tableActions"
@click="stopEventPropagation($event)" class="column flex-center w-10 no-margin q-pa-xs q-gutter-y-xs"
> @click="stopEventPropagation($event)"
<QBtn >
v-for="(btn, index) of splittedColumns.actions <QBtn
.actions" v-for="(btn, index) of splittedColumns.actions
:key="index" .actions"
:title="btn.title" :key="index"
:icon="btn.icon" :title="btn.title"
class="q-pa-xs" :icon="btn.icon"
flat class="q-pa-xs"
:class=" flat
btn.isPrimary :class="
? 'text-primary-light' btn.isPrimary
: 'color-vn-text ' ? 'text-primary-light'
" : 'color-vn-text '
@click="btn.action(row)" "
/> @click="btn.action(row)"
</QCardSection> />
</QCard> </QCardSection>
</component> </QCard>
</template> </component>
</QTable> </template>
</template> </QTable>
</CrudModel> </template>
</div> </CrudModel>
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2"> <QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" /> <QBtn @click="showForm = !showForm" color="primary" fab icon="add" />
<QTooltip> <QTooltip>

View File

@ -8,7 +8,6 @@ import VnSubToolbar from '../ui/VnSubToolbar.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.vue'; import RightMenu from 'components/common/RightMenu.vue';
const props = defineProps({ const props = defineProps({
dataKey: { type: String, required: true }, dataKey: { type: String, required: true },
baseUrl: { type: String, default: undefined }, baseUrl: { type: String, default: undefined },
@ -74,7 +73,7 @@ if (props.baseUrl) {
<QPage> <QPage>
<VnSubToolbar /> <VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]"> <div :class="[useCardSize(), $attrs.class]">
<RouterView /> <RouterView :key="route.fullPath" />
</div> </div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useValidator } from 'src/composables/useValidator';
const emit = defineEmits([ const emit = defineEmits([
'update:modelValue', 'update:modelValue',
@ -27,9 +28,11 @@ const $props = defineProps({
default: true, default: true,
}, },
}); });
const { validations } = useValidator();
const { t } = useI18n(); const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired'); const requiredFieldRule = (val) => validations().required($attrs.required, val);
const vnInputRef = ref(null); const vnInputRef = ref(null);
const value = computed({ const value = computed({
get() { get() {
@ -57,21 +60,22 @@ const focus = () => {
defineExpose({ defineExpose({
focus, focus,
}); });
import { useAttrs } from 'vue';
const $attrs = useAttrs();
const inputRules = [ const mixinRules = [
requiredFieldRule,
...($attrs.rules ?? []),
(val) => { (val) => {
const { min } = vnInputRef.value.$attrs; const { min } = vnInputRef.value.$attrs;
if (!min) return null;
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min }); if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
}, },
]; ];
</script> </script>
<template> <template>
<div <div @mouseover="hover = true" @mouseleave="hover = false">
@mouseover="hover = true"
@mouseleave="hover = false"
:rules="$attrs.required ? [requiredFieldRule] : null"
>
<QInput <QInput
ref="vnInputRef" ref="vnInputRef"
v-model="value" v-model="value"
@ -80,7 +84,7 @@ const inputRules = [
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
@keyup.enter="emit('keyup.enter')" @keyup.enter="emit('keyup.enter')"
:clearable="false" :clearable="false"
:rules="inputRules" :rules="mixinRules"
:lazy-rules="true" :lazy-rules="true"
hide-bottom-space hide-bottom-space
> >

View File

@ -3,7 +3,7 @@ import { onMounted, watch, computed, ref } from 'vue';
import { date } from 'quasar'; import { date } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
const model = defineModel({ type: String }); const model = defineModel({ type: [String, Date] });
const $props = defineProps({ const $props = defineProps({
isOutlined: { isOutlined: {
type: Boolean, type: Boolean,

View File

@ -14,7 +14,7 @@ const props = defineProps({
default: false, default: false,
}, },
}); });
const initialDate = ref(model.value); const initialDate = ref(model.value ?? Date.vnNew());
const { t } = useI18n(); const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired'); const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');

View File

@ -77,6 +77,10 @@ const $props = defineProps({
type: Object, type: Object,
default: null, default: null,
}, },
noOne: {
type: Boolean,
default: false,
},
}); });
const { t } = useI18n(); const { t } = useI18n();
@ -89,6 +93,11 @@ const myOptionsOriginal = ref([]);
const vnSelectRef = ref(); const vnSelectRef = ref();
const dataRef = ref(); const dataRef = ref();
const lastVal = ref(); const lastVal = ref();
const noOneText = t('globals.noOne');
const noOneOpt = ref({
[optionValue.value]: false,
[optionLabel.value]: noOneText,
});
const value = computed({ const value = computed({
get() { get() {
@ -104,9 +113,11 @@ watch(options, (newValue) => {
setOptions(newValue); setOptions(newValue);
}); });
watch(modelValue, (newValue) => { watch(modelValue, async (newValue) => {
if (!myOptions.value.some((option) => option[optionValue.value] == newValue)) if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
fetchFilter(newValue); await fetchFilter(newValue);
if ($props.noOne) myOptions.value.unshift(noOneOpt.value);
}); });
onMounted(() => { onMounted(() => {
@ -169,6 +180,7 @@ async function fetchFilter(val) {
const fetchOptions = { where, include, limit }; const fetchOptions = { where, include, limit };
if (fields) fetchOptions.fields = fields; if (fields) fetchOptions.fields = fields;
if (sortBy) fetchOptions.order = sortBy; if (sortBy) fetchOptions.order = sortBy;
return dataRef.value.fetch(fetchOptions); return dataRef.value.fetch(fetchOptions);
} }
@ -189,6 +201,9 @@ async function filterHandler(val, update) {
} else newOptions = filter(val, myOptionsOriginal.value); } else newOptions = filter(val, myOptionsOriginal.value);
update( update(
() => { () => {
if ($props.noOne && noOneText.toLowerCase().includes(val.toLowerCase()))
newOptions.unshift(noOneOpt.value);
myOptions.value = newOptions; myOptions.value = newOptions;
}, },
(ref) => { (ref) => {

View File

@ -2,10 +2,6 @@
import { computed } from 'vue'; import { computed } from 'vue';
const $props = defineProps({ const $props = defineProps({
maxLength: {
type: Number,
required: true,
},
item: { item: {
type: Object, type: Object,
required: true, required: true,

View File

@ -15,7 +15,7 @@ const props = defineProps({
default: null, default: null,
}, },
message: { message: {
type: String, type: [String, Boolean],
default: null, default: null,
}, },
data: { data: {
@ -35,7 +35,10 @@ defineEmits(['confirm', ...useDialogPluginComponent.emits]);
const { dialogRef, onDialogOK } = useDialogPluginComponent(); const { dialogRef, onDialogOK } = useDialogPluginComponent();
const title = props.title || t('Confirm'); const title = props.title || t('Confirm');
const message = props.message || t('Are you sure you want to continue?'); const message =
props.message ||
(props.message !== false ? t('Are you sure you want to continue?') : false);
const isLoading = ref(false); const isLoading = ref(false);
async function confirm() { async function confirm() {
@ -61,12 +64,12 @@ async function confirm() {
size="xl" size="xl"
v-if="icon" v-if="icon"
/> />
<span class="text-h6 text-grey">{{ title }}</span> <span class="text-h6">{{ title }}</span>
<QSpace /> <QSpace />
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup /> <QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
</QCardSection> </QCardSection>
<QCardSection class="row items-center"> <QCardSection class="row items-center">
<span v-html="message"></span> <span v-if="message !== false" v-html="message" />
<slot name="customHTML"></slot> <slot name="customHTML"></slot>
</QCardSection> </QCardSection>
<QCardActions align="right"> <QCardActions align="right">

View File

@ -24,7 +24,7 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
unRemovableParams: { unremovableParams: {
type: Array, type: Array,
required: false, required: false,
default: () => [], default: () => [],
@ -92,16 +92,18 @@ function setUserParams(watchedParams) {
const order = watchedParams.filter?.order; const order = watchedParams.filter?.order;
delete watchedParams.filter; delete watchedParams.filter;
userParams.value = { ...userParams.value, ...sanitizer(watchedParams) }; userParams.value = sanitizer(watchedParams);
emit('setUserParams', userParams.value, order); emit('setUserParams', userParams.value, order);
} }
watch( watch(
() => [route.query[$props.searchUrl], arrayData.store.userParams], () => route.query[$props.searchUrl],
([newSearchUrl, newUserParams], [oldSearchUrl, oldUserParams]) => { (val, oldValue) => (val || oldValue) && setUserParams(val)
if (newSearchUrl || oldSearchUrl) setUserParams(newSearchUrl); );
if (newUserParams || oldUserParams) setUserParams(newUserParams);
} watch(
() => arrayData.store.userParams,
(val, oldValue) => (val || oldValue) && setUserParams(val)
); );
watch( watch(
@ -148,7 +150,7 @@ async function clearFilters() {
arrayData.reset(['skip', 'filter.skip', 'page']); arrayData.reset(['skip', 'filter.skip', 'page']);
// Filtrar los params no removibles // Filtrar los params no removibles
const removableFilters = Object.keys(userParams.value).filter((param) => const removableFilters = Object.keys(userParams.value).filter((param) =>
$props.unRemovableParams.includes(param) $props.unremovableParams.includes(param)
); );
const newParams = {}; const newParams = {};
// Conservar solo los params que no son removibles // Conservar solo los params que no son removibles
@ -180,10 +182,10 @@ const tagsList = computed(() => {
}); });
const tags = computed(() => { const tags = computed(() => {
return tagsList.value.filter((tag) => !($props.customTags || []).includes(tag.key)); return tagsList.value.filter((tag) => !($props.customTags || []).includes(tag.label));
}); });
const customTags = computed(() => const customTags = computed(() =>
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.key)) tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label))
); );
async function remove(key) { async function remove(key) {
@ -269,7 +271,7 @@ function sanitizer(params) {
<VnFilterPanelChip <VnFilterPanelChip
v-for="chip of tags" v-for="chip of tags"
:key="chip.label" :key="chip.label"
:removable="!unRemovableParams.includes(chip.label)" :removable="!unremovableParams?.includes(chip.label)"
@remove="remove(chip.label)" @remove="remove(chip.label)"
> >
<slot name="tags" :tag="chip" :format-fn="formatValue"> <slot name="tags" :tag="chip" :format-fn="formatValue">

View File

@ -10,6 +10,10 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
class: {
type: String,
default: '',
},
autoLoad: { autoLoad: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -215,7 +219,7 @@ defineExpose({ fetch, addFilter, paginate });
v-if="store.data" v-if="store.data"
@load="onLoad" @load="onLoad"
:offset="offset" :offset="offset"
class="full-width" :class="['full-width', props.class]"
:disable="disableInfiniteScroll || !store.hasMoreData" :disable="disableInfiniteScroll || !store.hasMoreData"
v-bind="$attrs" v-bind="$attrs"
> >

View File

@ -63,17 +63,13 @@ const props = defineProps({
type: String, type: String,
default: '', default: '',
}, },
makeFetch: { whereFilter: {
type: Boolean, type: Function,
default: true, default: undefined,
},
searchUrl: {
type: String,
default: 'params',
}, },
}); });
const searchText = ref(''); const searchText = ref();
let arrayDataProps = { ...props }; let arrayDataProps = { ...props };
if (props.redirect) if (props.redirect)
arrayDataProps = { arrayDataProps = {
@ -107,13 +103,20 @@ async function search() {
const staticParams = Object.entries(store.userParams); const staticParams = Object.entries(store.userParams);
arrayData.reset(['skip', 'page']); arrayData.reset(['skip', 'page']);
if (props.makeFetch) const filter = {
await arrayData.applyFilter({ params: {
params: { ...Object.fromEntries(staticParams),
...Object.fromEntries(staticParams), search: searchText.value,
search: searchText.value, },
}, };
});
if (props.whereFilter) {
filter.filter = {
where: props.whereFilter(searchText.value),
};
delete filter.params.search;
}
await arrayData.applyFilter(filter);
} }
</script> </script>
<template> <template>

View File

@ -7,5 +7,5 @@ export function getDateQBadgeColor(date) {
let comparation = today - timeTicket; let comparation = today - timeTicket;
if (comparation == 0) return 'warning'; if (comparation == 0) return 'warning';
if (comparation < 0) return 'negative'; if (comparation < 0) return 'success';
} }

View File

@ -28,7 +28,7 @@ export function useValidator() {
} }
const { t } = useI18n(); const { t } = useI18n();
const validations = function (validation) { const validations = function (validation = {}) {
return { return {
format: (value) => { format: (value) => {
const { allowNull, with: format, allowBlank } = validation; const { allowNull, with: format, allowBlank } = validation;
@ -40,12 +40,15 @@ export function useValidator() {
if (!isValid) return message; if (!isValid) return message;
}, },
presence: (value) => { presence: (value) => {
let message = `Value can't be empty`; let message = t(`globals.valueCantBeEmpty`);
if (validation.message) if (validation.message)
message = t(validation.message) || validation.message; message = t(validation.message) || validation.message;
return !validator.isEmpty(value ? String(value) : '') || message; return !validator.isEmpty(value ? String(value) : '') || message;
}, },
required: (required, value) => {
return required ? !!value || t('globals.fieldRequired') : null;
},
length: (value) => { length: (value) => {
const options = { const options = {
min: validation.min || validation.is, min: validation.min || validation.is,
@ -71,12 +74,17 @@ export function useValidator() {
return validator.isInt(value) || 'Value should be integer'; return validator.isInt(value) || 'Value should be integer';
return validator.isNumeric(value) || 'Value should be a number'; return validator.isNumeric(value) || 'Value should be a number';
}, },
min: (value, min) => {
if (min >= 0)
if (Math.floor(value) < min) return t('inputMin', { value: min });
},
custom: (value) => validation.bindedFunction(value) || 'Invalid value', custom: (value) => validation.bindedFunction(value) || 'Invalid value',
}; };
}; };
return { return {
validate, validate,
validations,
models, models,
}; };
} }

View File

@ -20,21 +20,21 @@ export function isValidDate(date) {
* Converts a given date to a specific format. * Converts a given date to a specific format.
* *
* @param {number|string|Date} date - The date to be formatted. * @param {number|string|Date} date - The date to be formatted.
* @param {Object} opts - Optional parameters to customize the output format.
* @returns {string} The formatted date as a string in 'dd/mm/yyyy' format. If the provided date is not valid, an empty string is returned. * @returns {string} The formatted date as a string in 'dd/mm/yyyy' format. If the provided date is not valid, an empty string is returned.
* *
* @example * @example
* // returns "02/12/2022" * // returns "02/12/2022"
* toDateFormat(new Date(2022, 11, 2)); * toDateFormat(new Date(2022, 11, 2));
*/ */
export function toDateFormat(date, locale = 'es-ES') { export function toDateFormat(date, locale = 'es-ES', opts = {}) {
if (!isValidDate(date)) { if (!isValidDate(date)) return '';
return '';
} const format = Object.assign(
return new Date(date).toLocaleDateString(locale, { { year: 'numeric', month: '2-digit', day: '2-digit' },
year: 'numeric', opts
month: '2-digit', );
day: '2-digit', return new Date(date).toLocaleDateString(locale, format);
});
} }
/** /**

View File

@ -1,7 +1,7 @@
export default function dateRange(value) { export default function dateRange(value) {
const minHour = new Date(value); const minHour = new Date(value);
minHour.setHours(0, 0, 0, 0); minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(); const maxHour = new Date(value);
maxHour.setHours(23, 59, 59, 59); maxHour.setHours(23, 59, 59, 59);
return [minHour, maxHour]; return [minHour, maxHour];

View File

@ -67,6 +67,7 @@ globals:
allRows: 'All { numberRows } row(s)' allRows: 'All { numberRows } row(s)'
markAll: Mark all markAll: Mark all
requiredField: Required field requiredField: Required field
valueCantBeEmpty: Value cannot be empty
class: clase class: clase
type: Type type: Type
reason: reason reason: reason
@ -94,6 +95,7 @@ globals:
from: From from: From
to: To to: To
notes: Notes notes: Notes
refresh: Refresh
pageTitles: pageTitles:
logIn: Login logIn: Login
summary: Summary summary: Summary
@ -255,7 +257,10 @@ globals:
twoFactor: Two factor twoFactor: Two factor
recoverPassword: Recover password recoverPassword: Recover password
resetPassword: Reset password resetPassword: Reset password
ticketsMonitor: Tickets monitor
clientsActionsMonitor: Clients and actions
serial: Serial serial: Serial
medical: Mutual
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now
@ -269,6 +274,7 @@ globals:
subtitle: Are you sure exit without saving? subtitle: Are you sure exit without saving?
createInvoiceIn: Create invoice in createInvoiceIn: Create invoice in
myAccount: My account myAccount: My account
noOne: No one
errors: errors:
statusUnauthorized: Access denied statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred statusInternalServerError: An internal server error has ocurred
@ -455,6 +461,7 @@ entry:
travelFk: Travel travelFk: Travel
isExcludedFromAvailable: Inventory isExcludedFromAvailable: Inventory
isRaid: Raid isRaid: Raid
invoiceAmount: Import
summary: summary:
commission: Commission commission: Commission
currency: Currency currency: Currency
@ -872,6 +879,7 @@ worker:
timeControl: Time control timeControl: Time control
locker: Locker locker: Locker
balance: Balance balance: Balance
medical: Medical
list: list:
name: Name name: Name
email: Email email: Email
@ -951,6 +959,15 @@ worker:
amount: Importe amount: Importe
remark: Bonficado remark: Bonficado
hasDiploma: Diploma hasDiploma: Diploma
medical:
tableVisibleColumns:
date: Date
time: Hour
center: Formation Center
invoice: Invoice
amount: Amount
isFit: Fit
remark: Observations
imageNotFound: Image not found imageNotFound: Image not found
balance: balance:
tableVisibleColumns: tableVisibleColumns:
@ -1123,9 +1140,12 @@ travel:
agency: Agency agency: Agency
shipped: Shipped shipped: Shipped
landed: Landed landed: Landed
shipHour: Shipment Hour
landHour: Landing Hour
warehouseIn: Warehouse in warehouseIn: Warehouse in
warehouseOut: Warehouse out warehouseOut: Warehouse out
totalEntries: Total entries totalEntries: Total entries
totalEntriesTooltip: Total entries
summary: summary:
confirmed: Confirmed confirmed: Confirmed
entryId: Entry Id entryId: Entry Id

View File

@ -76,6 +76,9 @@ globals:
warehouse: Almacén warehouse: Almacén
company: Empresa company: Empresa
fieldRequired: Campo requerido fieldRequired: Campo requerido
valueCantBeEmpty: El valor no puede estar vacío
Value can't be blank: El valor no puede estar en blanco
Value can't be null: El valor no puede ser nulo
allowedFilesText: 'Tipos de archivo permitidos: { allowedContentTypes }' allowedFilesText: 'Tipos de archivo permitidos: { allowedContentTypes }'
smsSent: SMS enviado smsSent: SMS enviado
confirmDeletion: Confirmar eliminación confirmDeletion: Confirmar eliminación
@ -94,6 +97,7 @@ globals:
from: Desde from: Desde
to: Hasta to: Hasta
notes: Notas notes: Notas
refresh: Actualizar
pageTitles: pageTitles:
logIn: Inicio de sesión logIn: Inicio de sesión
summary: Resumen summary: Resumen
@ -236,7 +240,7 @@ globals:
purchaseRequest: Petición de compra purchaseRequest: Petición de compra
weeklyTickets: Tickets programados weeklyTickets: Tickets programados
formation: Formación formation: Formación
locations: Ubicaciones locations: Localizaciones
warehouses: Almacenes warehouses: Almacenes
roles: Roles roles: Roles
connections: Conexiones connections: Conexiones
@ -257,7 +261,10 @@ globals:
twoFactor: Doble factor twoFactor: Doble factor
recoverPassword: Recuperar contraseña recoverPassword: Recuperar contraseña
resetPassword: Restablecer contraseña resetPassword: Restablecer contraseña
ticketsMonitor: Monitor de tickets
clientsActionsMonitor: Clientes y acciones
serial: Facturas por serie serial: Facturas por serie
medical: Mutua
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora
@ -271,6 +278,7 @@ globals:
subtitle: ¿Seguro que quiere salir sin guardar? subtitle: ¿Seguro que quiere salir sin guardar?
createInvoiceIn: Crear factura recibida createInvoiceIn: Crear factura recibida
myAccount: Mi cuenta myAccount: Mi cuenta
noOne: Nadie
errors: errors:
statusUnauthorized: Acceso denegado statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor statusInternalServerError: Ha ocurrido un error interno del servidor
@ -454,6 +462,7 @@ entry:
travelFk: Envio travelFk: Envio
isExcludedFromAvailable: Inventario isExcludedFromAvailable: Inventario
isRaid: Redada isRaid: Redada
invoiceAmount: Importe
summary: summary:
commission: Comisión commission: Comisión
currency: Moneda currency: Moneda
@ -873,6 +882,8 @@ worker:
timeControl: Control de horario timeControl: Control de horario
locker: Taquilla locker: Taquilla
balance: Balance balance: Balance
formation: Formación
medical: Mutua
list: list:
name: Nombre name: Nombre
email: Email email: Email
@ -943,6 +954,15 @@ worker:
amount: Importe amount: Importe
remark: Bonficado remark: Bonficado
hasDiploma: Diploma hasDiploma: Diploma
medical:
tableVisibleColumns:
date: Fecha
time: Hora
center: Centro de Formación
invoice: Factura
amount: Importe
isFit: Apto
remark: Observaciones
imageNotFound: No se ha encontrado la imagen imageNotFound: No se ha encontrado la imagen
balance: balance:
tableVisibleColumns: tableVisibleColumns:
@ -1100,11 +1120,14 @@ travel:
id: Id id: Id
ref: Referencia ref: Referencia
agency: Agencia agency: Agencia
shipped: Enviado shipped: F.envío
landed: Llegada shipHour: Hora de envío
warehouseIn: Almacén de salida landHour: Hora de llegada
warehouseOut: Almacén de entrada landed: F.entrega
totalEntries: Total de entradas warehouseIn: Alm.salida
warehouseOut: Alm.entrada
totalEntries:
totalEntriesTooltip: Entradas totales
summary: summary:
confirmed: Confirmado confirmed: Confirmado
entryId: Id entrada entryId: Id entrada
@ -1269,6 +1292,7 @@ components:
clone: Clonar clone: Clonar
openCard: Ficha openCard: Ficha
openSummary: Detalles openSummary: Detalles
viewSummary: Vista previa
cardDescriptor: cardDescriptor:
mainList: Listado principal mainList: Listado principal
summary: Resumen summary: Resumen

View File

@ -141,6 +141,7 @@ const deleteAcl = async ({ id }) => {
formInitialData: {}, formInitialData: {},
}" }"
order="id DESC" order="id DESC"
:disable-option="{ card: true }"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
:right-search="true" :right-search="true"

View File

@ -21,24 +21,21 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'id', name: 'id',
label: t('id'), label: t('Id'),
isId: true, isId: true,
field: 'id',
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
name: 'alias', name: 'alias',
label: t('alias'), label: t('Alias'),
field: 'alias',
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'description', name: 'description',
label: t('description'), label: t('Description'),
field: 'description',
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -69,9 +66,17 @@ const columns = computed(() => [
}" }"
order="id DESC" order="id DESC"
:columns="columns" :columns="columns"
:disable-option="{ card: true }"
default-mode="table" default-mode="table"
redirect="account/alias" redirect="account/alias"
:is-editable="true" :is-editable="true"
:use-model="true" :use-model="true"
/> />
</template> </template>
<i18n>
es:
Id: Id
Alias: Alias
Description: Descripción
</i18n>

View File

@ -14,15 +14,23 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'id', name: 'id',
label: t('id'), label: t('Id'),
isId: true, isId: true,
field: 'id', field: 'id',
cardVisible: true, cardVisible: true,
columnFilter: {
component: 'select',
name: 'search',
attrs: {
url: 'VnUsers/preview',
fields: ['id', 'name'],
},
},
}, },
{ {
align: 'left', align: 'left',
name: 'username', name: 'username',
label: t('nickname'), label: t('Nickname'),
isTitle: true, isTitle: true,
component: 'input', component: 'input',
columnField: { columnField: {
@ -37,7 +45,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'name', name: 'name',
label: t('name'), label: t('Name'),
component: 'input', component: 'input',
columnField: { columnField: {
component: null, component: null,
@ -65,6 +73,7 @@ const columns = computed(() => [
title: t('View Summary'), title: t('View Summary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, AccountSummary), action: (row) => viewSummary(row.id, AccountSummary),
isPrimary: true,
}, },
], ],
}, },
@ -108,3 +117,10 @@ const exprBuilder = (param, value) => {
:use-model="true" :use-model="true"
/> />
</template> </template>
<i18n>
es:
Id: Id
Nickname: Nickname
Name: Nombre
</i18n>

View File

@ -15,7 +15,6 @@ const { t } = useI18n();
url: 'VnUsers/preview', url: 'VnUsers/preview',
label: t('account.search'), label: t('account.search'),
info: t('account.searchInfo'), info: t('account.searchInfo'),
searchUrl: 'table',
}" }"
/> />
</template> </template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -12,17 +12,14 @@ const route = useRoute();
const rolesOptions = ref([]); const rolesOptions = ref([]);
const formModelRef = ref(); const formModelRef = ref();
watch(
() => route.params.id,
() => formModelRef.value.reset()
);
</script> </script>
<template> <template>
<FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" /> <FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
<FormModel <FormModel ref="formModelRef" model="AccountPrivileges" url="VnUsers" auto-load>
ref="formModelRef"
model="AccountPrivileges"
:url="`VnUsers/${route.params.id}/privileges`"
:url-create="`VnUsers/${route.params.id}/privileges`"
auto-load
@on-data-saved="formModelRef.fetch()"
>
<template #form="{ data }"> <template #form="{ data }">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<QCheckbox <QCheckbox

View File

@ -21,24 +21,30 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'id', name: 'id',
label: t('id'), label: t('Id'),
isId: true, isId: true,
columnFilter: { columnFilter: {
inWhere: true, inWhere: true,
component: 'select',
name: 'search',
attrs: {
url: 'VnRoles',
fields: ['id', 'name'],
},
}, },
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
name: 'name', name: 'name',
label: t('name'), label: t('Name'),
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{ {
align: 'left', align: 'left',
name: 'description', name: 'description',
label: t('description'), label: t('Description'),
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -51,6 +57,7 @@ const columns = computed(() => [
title: t('View Summary'), title: t('View Summary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, RoleSummary), action: (row) => viewSummary(row.id, RoleSummary),
isPrimary: true,
}, },
], ],
}, },
@ -93,8 +100,16 @@ const exprBuilder = (param, value) => {
}, },
}" }"
order="id ASC" order="id ASC"
:disable-option="{ card: true }"
:columns="columns" :columns="columns"
default-mode="table" default-mode="table"
redirect="account/role" redirect="account/role"
/> />
</template> </template>
<i18n>
es:
Id: Id
Description: Descripción
Name: Nombre
</i18n>

View File

@ -1,11 +1,10 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { onMounted, ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters'; import { toDate, toCurrency } from 'src/filters';
import dashIfEmpty from 'src/filters/dashIfEmpty'; import dashIfEmpty from 'src/filters/dashIfEmpty';
import { getUrl } from 'src/composables/getUrl';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';

View File

@ -79,7 +79,7 @@ const columns = computed(() => [
align: 'left', align: 'left',
label: t('claim.state'), label: t('claim.state'),
format: ({ stateCode }) => format: ({ stateCode }) =>
claimFilterRef.value?.states.find(({code}) => code === stateCode) claimFilterRef.value?.states.find(({ code }) => code === stateCode)
?.description, ?.description,
name: 'stateCode', name: 'stateCode',
chip: { chip: {
@ -100,7 +100,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('Client ticket list'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, ClaimSummary), action: (row) => viewSummary(row.id, ClaimSummary),
}, },

View File

@ -217,7 +217,11 @@ const creditWarning = computed(() => {
/> />
</QCard> </QCard>
<QCard class="vn-one" v-if="entity.account"> <QCard class="vn-one" v-if="entity.account">
<VnTitle :text="t('customer.summary.businessData')" /> <VnTitle
:url="`https://grafana.verdnatura.es/d/adjlxzv5yjt34d/analisis-de-clientes-7c-crm?orgId=1&var-clientFk=${entityId}`"
:text="t('customer.summary.businessData')"
icon="vn:grafana"
/>
<VnLv <VnLv
:label="t('customer.summary.totalGreuge')" :label="t('customer.summary.totalGreuge')"
:value="toCurrency(entity.totalGreuge)" :value="toCurrency(entity.totalGreuge)"

View File

@ -357,7 +357,7 @@ const columns = computed(() => [
isPrimary: true, isPrimary: true,
}, },
{ {
title: t('Client ticket list'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, CustomerSummary), action: (row) => viewSummary(row.id, CustomerSummary),
}, },

View File

@ -423,7 +423,7 @@ const lockIconType = (groupingMode, mode) => {
<span v-if="props.row.item.subName" class="subName"> <span v-if="props.row.item.subName" class="subName">
{{ props.row.item.subName }} {{ props.row.item.subName }}
</span> </span>
<FetchedTags :item="props.row.item" :max-length="5" /> <FetchedTags :item="props.row.item" />
</QTd> </QTd>
</QTr> </QTr>
</template> </template>

View File

@ -319,7 +319,7 @@ const fetchEntryBuys = async () => {
<span v-if="row.item.subName" class="subName"> <span v-if="row.item.subName" class="subName">
{{ row.item.subName }} {{ row.item.subName }}
</span> </span>
<FetchedTags :item="row.item" :max-length="5" /> <FetchedTags :item="row.item" />
</QTd> </QTd>
</QTr> </QTr>
<!-- Esta última row es utilizada para agregar un espaciado y así marcar una diferencia visual entre los diferentes buys --> <!-- Esta última row es utilizada para agregar un espaciado y así marcar una diferencia visual entre los diferentes buys -->

View File

@ -7,11 +7,16 @@ import { useStateStore } from 'stores/useStateStore';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import EntrySummary from './Card/EntrySummary.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
const { viewSummary } = useSummaryDialog();
const entryFilter = { const entryFilter = {
include: [ include: [
{ {
@ -142,6 +147,12 @@ const columns = computed(() => [
create: true, create: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef), format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
}, },
{
align: 'left',
label: t('entry.list.tableVisibleColumns.invoiceAmount'),
name: 'invoiceAmount',
cardVisible: true,
},
{ {
align: 'left', align: 'left',
label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'), label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),
@ -168,6 +179,18 @@ const columns = computed(() => [
inWhere: true, inWhere: true,
}, },
}, },
{
align: 'right',
name: 'tableActions',
actions: [
{
title: t('components.smartCard.viewSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, EntrySummary),
isPrimary: true,
},
],
},
]); ]);
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
@ -201,7 +224,20 @@ onMounted(async () => {
redirect="entry" redirect="entry"
auto-load auto-load
:right-search="false" :right-search="false"
/> >
<template #column-supplierFk="{ row }">
<span class="link" @click.stop>
{{ row.supplierName }}
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template>
<template #column-travelFk="{ row }">
<span class="link" @click.stop>
{{ row.travelRef }}
<TravelDescriptorProxy :id="row.travelFk" />
</span>
</template>
</VnTable>
</template> </template>
<i18n> <i18n>

View File

@ -18,6 +18,7 @@ const { notify } = useNotify();
const { t } = useI18n(); const { t } = useI18n();
const arrayData = useArrayData(); const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
const currency = computed(() => invoiceIn.value?.currency?.code);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const banks = ref([]); const banks = ref([]);
@ -139,9 +140,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd> <QTd>
<VnInputNumber <VnInputNumber
:class="{ :class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code), 'no-pointer-events': !isNotEuro(currency),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="row.foreignValue" v-model="row.foreignValue"
clearable clearable
clear-icon="close" clear-icon="close"
@ -154,9 +155,7 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ {{ toCurrency(getTotalAmount(rows), currency) }}
toCurrency(getTotalAmount(rows), invoiceIn.currency.code)
}}
</QTd> </QTd>
<QTd /> <QTd />
</QTr> </QTr>
@ -208,11 +207,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
:label="t('Foreign value')" :label="t('Foreign value')"
class="full-width" class="full-width"
:class="{ :class="{
'no-pointer-events': !isNotEuro( 'no-pointer-events': !isNotEuro(currency),
invoiceIn.currency.code
),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="props.row.foreignValue" v-model="props.row.foreignValue"
clearable clearable
clear-icon="close" clear-icon="close"

View File

@ -242,11 +242,12 @@ const formatOpt = (row, { model, options }, prop) => {
</template> </template>
<template #body-cell-taxablebase="{ row }"> <template #body-cell-taxablebase="{ row }">
<QTd> <QTd>
{{ currency }}
<VnInputNumber <VnInputNumber
:class="{ :class="{
'no-pointer-events': isNotEuro(invoiceIn.currency.code), 'no-pointer-events': isNotEuro(currency),
}" }"
:disable="isNotEuro(invoiceIn.currency.code)" :disable="isNotEuro(currency)"
label="" label=""
clear-icon="close" clear-icon="close"
v-model="row.taxableBase" v-model="row.taxableBase"
@ -312,9 +313,9 @@ const formatOpt = (row, { model, options }, prop) => {
<QTd> <QTd>
<VnInputNumber <VnInputNumber
:class="{ :class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code), 'no-pointer-events': !isNotEuro(currency),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="row.foreignValue" v-model="row.foreignValue"
/> />
</QTd> </QTd>
@ -361,12 +362,10 @@ const formatOpt = (row, { model, options }, prop) => {
<VnInputNumber <VnInputNumber
:label="t('Taxable base')" :label="t('Taxable base')"
:class="{ :class="{
'no-pointer-events': isNotEuro( 'no-pointer-events': isNotEuro(currency),
invoiceIn.currency.code
),
}" }"
class="full-width" class="full-width"
:disable="isNotEuro(invoiceIn.currency.code)" :disable="isNotEuro(currency)"
clear-icon="close" clear-icon="close"
v-model="props.row.taxableBase" v-model="props.row.taxableBase"
clearable clearable
@ -427,11 +426,9 @@ const formatOpt = (row, { model, options }, prop) => {
:label="t('Foreign value')" :label="t('Foreign value')"
class="full-width" class="full-width"
:class="{ :class="{
'no-pointer-events': !isNotEuro( 'no-pointer-events': !isNotEuro(currency),
invoiceIn.currency.code
),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="props.row.foreignValue" v-model="props.row.foreignValue"
/> />
</QItem> </QItem>

View File

@ -5,6 +5,7 @@ import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import TransferInvoiceForm from 'src/components/TransferInvoiceForm.vue'; import TransferInvoiceForm from 'src/components/TransferInvoiceForm.vue';
import RefundInvoiceForm from 'src/components/RefundInvoiceForm.vue';
import SendEmailDialog from 'components/common/SendEmailDialog.vue'; import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import useNotify from 'src/composables/useNotify'; import useNotify from 'src/composables/useNotify';
@ -141,6 +142,15 @@ const showTransferInvoiceForm = async () => {
}, },
}); });
}; };
const showRefundInvoiceForm = () => {
quasar.dialog({
component: RefundInvoiceForm,
componentProps: {
invoiceOutData: $props.invoiceOutData,
},
});
};
</script> </script>
<template> <template>
@ -229,10 +239,13 @@ const showTransferInvoiceForm = async () => {
<QMenu anchor="top end" self="top start"> <QMenu anchor="top end" self="top start">
<QList> <QList>
<QItem v-ripple clickable @click="refundInvoice(true)"> <QItem v-ripple clickable @click="refundInvoice(true)">
<QItemSection>{{ t('With warehouse') }}</QItemSection> <QItemSection>{{ t('With warehouse, no invoice') }}</QItemSection>
</QItem> </QItem>
<QItem v-ripple clickable @click="refundInvoice(false)"> <QItem v-ripple clickable @click="refundInvoice(false)">
<QItemSection>{{ t('Without warehouse') }}</QItemSection> <QItemSection>{{ t('Without warehouse, no invoice') }}</QItemSection>
</QItem>
<QItem v-ripple clickable @click="showRefundInvoiceForm()">
<QItemSection>{{ t('Invoiced') }}</QItemSection>
</QItem> </QItem>
</QList> </QList>
</QMenu> </QMenu>
@ -255,8 +268,9 @@ es:
As CSV: como CSV As CSV: como CSV
Send PDF: Enviar PDF Send PDF: Enviar PDF
Send CSV: Enviar CSV Send CSV: Enviar CSV
With warehouse: Con almacén With warehouse, no invoice: Con almacén, sin factura
Without warehouse: Sin almacén Without warehouse, no invoice: Sin almacén, sin factura
Invoiced: Facturado
InvoiceOut deleted: Factura eliminada InvoiceOut deleted: Factura eliminada
Confirm deletion: Confirmar eliminación Confirm deletion: Confirmar eliminación
Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura? Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura?

View File

@ -101,7 +101,17 @@ onMounted(async () => {
dense dense
outlined outlined
rounded rounded
/> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} {{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect <VnSelect
:label="t('invoiceOutSerialType')" :label="t('invoiceOutSerialType')"
v-model="formData.serialType" v-model="formData.serialType"

View File

@ -19,7 +19,6 @@ const stateStore = useStateStore();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const tableRef = ref(); const tableRef = ref();
const invoiceOutSerialsOptions = ref([]); const invoiceOutSerialsOptions = ref([]);
const ticketsOptions = ref([]);
const customerOptions = ref([]); const customerOptions = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const hasSelectedCards = computed(() => selectedRows.value.length > 0); const hasSelectedCards = computed(() => selectedRows.value.length > 0);
@ -122,7 +121,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('InvoiceOutSummary'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, InvoiceOutSummary), action: (row) => viewSummary(row.id, InvoiceOutSummary),
}, },
@ -226,10 +225,18 @@ watchEffect(selectedRows);
url="Tickets" url="Tickets"
v-model="data.ticketFk" v-model="data.ticketFk"
:label="t('invoiceOutList.tableVisibleColumns.ticket')" :label="t('invoiceOutList.tableVisibleColumns.ticket')"
:options="ticketsOptions" option-label="id"
option-label="nickname"
option-value="id" option-value="id"
/> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<span class="q-ml-md">O</span> <span class="q-ml-md">O</span>
</div> </div>
<VnSelect <VnSelect

View File

@ -14,8 +14,6 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const itemBotanicalsRef = ref(null); const itemBotanicalsRef = ref(null);
const itemGenusOptions = ref([]);
const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]); const itemBotanicals = ref([]);
let itemBotanicalsForm = reactive({ itemFk: null }); let itemBotanicalsForm = reactive({ itemFk: null });

View File

@ -436,7 +436,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
{{ row.name }} {{ row.name }}
</span> </span>
<ItemDescriptorProxy :id="row.itemFk" /> <ItemDescriptorProxy :id="row.itemFk" />
<FetchedTags :item="row" :max-length="6" /> <FetchedTags :item="row" />
</QTd> </QTd>
</template> </template>
<template #body-cell-groupingPrice="props"> <template #body-cell-groupingPrice="props">

View File

@ -517,7 +517,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<template #body-cell-description="{ row }"> <template #body-cell-description="{ row }">
<QTd class="col"> <QTd class="col">
<span>{{ row.name }} {{ row.subName }}</span> <span>{{ row.name }} {{ row.subName }}</span>
<FetchedTags :item="row" :max-length="6" /> <FetchedTags :item="row" />
</QTd> </QTd>
</template> </template>
<template #body-cell-isActive="{ row }"> <template #body-cell-isActive="{ row }">

View File

@ -1,7 +1,6 @@
<script setup> <script setup>
import { ref, computed, onMounted, onBeforeMount, watch } from 'vue'; import { ref, computed, onMounted, onBeforeMount, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';

View File

@ -0,0 +1,145 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import { toDateFormat } from 'src/filters/date.js';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnRow from 'src/components/ui/VnRow.vue';
import { dateRange } from 'src/filters';
const { t } = useI18n();
const dates = dateRange(Date.vnNew());
const from = ref(dates[0]);
const to = ref(dates[1]);
const filter = computed(() => {
const obj = {};
const formatFrom = setHours(from.value, 'from');
const formatTo = setHours(to.value, 'to');
let stamp;
if (!formatFrom && formatTo) stamp = { lte: formatTo };
else if (formatFrom && !formatTo) stamp = { gte: formatFrom };
else if (formatFrom && formatTo) stamp = { between: [formatFrom, formatTo] };
return Object.assign(obj, { where: { 'v.stamp': stamp } });
});
function exprBuilder(param, value) {
switch (param) {
case 'clientFk':
return { [`c.id`]: value };
case 'salesPersonFk':
return { [`c.${param}`]: value };
}
}
function setHours(date, type) {
if (!date) return null;
const d = new Date(date);
if (type == 'from') d.setHours(0, 0, 0, 0);
else d.setHours(23, 59, 59, 59);
return d;
}
const columns = computed(() => [
{
label: t('salesClientsTable.date'),
name: 'dated',
field: 'dated',
align: 'left',
columnFilter: false,
format: (row) => toDateFormat(row.dated, 'es-ES', { year: '2-digit' }),
},
{
label: t('salesClientsTable.hour'),
name: 'hour',
field: 'hour',
align: 'left',
columnFilter: false,
},
{
label: t('salesClientsTable.salesPerson'),
name: 'salesPersonFk',
field: 'salesPerson',
align: 'left',
columnField: {
component: null,
},
optionFilter: 'firstName',
columnFilter: {
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
sortBy: 'nickname ASC',
where: { role: 'salesPerson' },
useLike: false,
},
},
columnClass: 'no-padding',
},
{
label: t('salesClientsTable.client'),
field: 'clientName',
name: 'clientFk',
align: 'left',
columnField: {
component: null,
},
orderBy: 'c.name',
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
sortBy: 'name ASC',
},
},
columnClass: 'no-padding',
},
]);
</script>
<template>
<VnTable
ref="table"
data-key="SalesMonitorClients"
url="SalesMonitors/clientsFilter"
search-url="SalesMonitorClients"
:order="['dated DESC', 'hour DESC']"
:expr-builder="exprBuilder"
:filter="filter"
:offset="50"
auto-load
:columns="columns"
:right-search="false"
default-mode="table"
:disable-option="{ card: true }"
dense
class="q-px-none"
>
<template #top-left>
<VnRow>
<VnInputDate v-model="from" :label="$t('globals.from')" dense />
<VnInputDate v-model="to" :label="$t('globals.to')" dense />
</VnRow>
</template>
<template #column-salesPersonFk="{ row }">
<span class="link" :title="row.salesPerson" v-text="row.salesPerson" />
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
</template>
<template #column-clientFk="{ row }">
<span class="link" :title="row.clientName" v-text="row.clientName" />
<CustomerDescriptorProxy :id="row.clientFk" />
</template>
</VnTable>
</template>
<style lang="scss" scoped>
.full-width .vn-row > * {
flex: 0.4;
}
</style>

View File

@ -0,0 +1,26 @@
<script setup>
import SalesClientTable from './MonitorClients.vue';
import SalesOrdersTable from './MonitorOrders.vue';
import VnRow from 'src/components/ui/VnRow.vue';
</script>
<template>
<VnRow
class="q-pa-md"
:style="{ 'flex-direction': $q.screen.lt.lg ? 'column' : 'row', gap: '0px' }"
>
<div style="flex: 0.3">
<span
class="q-ml-md text-body1"
v-text="$t('salesMonitor.clientsOnWebsite')"
/>
<SalesClientTable />
</div>
<div style="flex: 0.7">
<span
class="q-ml-md text-body1"
v-text="$t('salesMonitor.recentOrderActions')"
/>
<SalesOrdersTable />
</div>
</VnRow>
</template>

View File

@ -1,90 +0,0 @@
<script setup>
import { onMounted, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import SalesClientTable from './SalesClientsTable.vue';
import SalesOrdersTable from './SalesOrdersTable.vue';
import SalesTicketsTable from './SalesTicketsTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
const { t } = useI18n();
const stateStore = useStateStore();
const expanded = ref(true);
onMounted(async () => {
stateStore.leftDrawer = false;
});
onUnmounted(() => (stateStore.leftDrawer = true));
</script>
<template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<VnSearchbar
data-key="SalesMonitorTickets"
url="SalesMonitors/salesFilter"
:redirect="false"
:label="t('searchBar.label')"
:info="t('searchBar.info')"
/>
</Teleport>
</template>
<QPage class="column items-center q-pa-md">
<QCard class="full-width q-mb-lg">
<QExpansionItem v-model="expanded" dense :duration="150">
<template v-if="!expanded" #header>
<div class="row full-width">
<span class="flex col text-body1">
{{ t('salesMonitor.clientsOnWebsite') }}
</span>
<span class="flex col q-ml-xl text-body1">
{{ t('salesMonitor.recentOrderActions') }}
</span>
</div>
</template>
<template #default>
<div class="expansion-tables-container">
<QCardSection class="col">
<span class="flex col q-mb-sm text-body1">
{{ t('salesMonitor.clientsOnWebsite') }}
</span>
<SalesClientTable />
</QCardSection>
<QCardSection class="col">
<span class="flex col q-mb-sm text-body1">
{{ t('salesMonitor.recentOrderActions') }}
</span>
<SalesOrdersTable />
</QCardSection>
</div>
</template>
</QExpansionItem>
</QCard>
<QCard class="full-width">
<QItem class="justify-between">
<QItemLabel class="col slider-container">
<span class="text-body1"
>{{ t('salesMonitor.ticketsMonitor') }}
</span>
<QCardSection class="col" style="padding-inline: 0"
><SalesTicketsTable />
</QCardSection>
</QItemLabel>
</QItem>
</QCard>
</QPage>
</template>
<style lang="scss" scoped>
.expansion-tables-container {
display: flex;
border-top: 1px solid $color-spacer;
@media (max-width: $breakpoint-md-max) {
flex-direction: column;
}
}
</style>

View File

@ -0,0 +1,203 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js';
import { toCurrency } from 'src/filters';
import { useVnConfirm } from 'composables/useVnConfirm';
import axios from 'axios';
const { t } = useI18n();
const { openConfirmationModal } = useVnConfirm();
const table = ref();
const selectedRows = ref([]);
function exprBuilder(param, value) {
switch (param) {
case 'clientFk':
return { [`c.id`]: value };
case 'salesPersonFk':
return { [`c.salesPersonFk`]: value };
}
}
const columns = computed(() => [
{
label: t('salesOrdersTable.dateSend'),
name: 'dateSend',
field: 'dateSend',
align: 'left',
orderBy: 'date_send',
columnFilter: false,
},
{
label: t('salesOrdersTable.dateMake'),
name: 'dateMake',
field: 'dateMake',
align: 'left',
orderBy: 'date_make',
columnFilter: false,
format: (row) => toDateTimeFormat(row.date_make),
},
{
label: t('salesOrdersTable.client'),
name: 'clientFk',
align: 'left',
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
sortBy: 'name ASC',
},
},
},
{
label: t('salesOrdersTable.agency'),
name: 'agencyName',
align: 'left',
columnFilter: false,
},
{
label: t('salesOrdersTable.salesPerson'),
name: 'salesPersonFk',
align: 'left',
optionFilter: 'firstName',
columnFilter: {
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
sortBy: 'nickname ASC',
where: { role: 'salesPerson' },
useLike: false,
},
},
},
{
label: t('salesOrdersTable.import'),
name: 'import',
field: 'import',
align: 'left',
columnFilter: false,
format: (row) => toCurrency(row.import),
},
]);
const getBadgeColor = (date) => {
const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const orderLanded = new Date(date);
orderLanded.setHours(0, 0, 0, 0);
const difference = today - orderLanded;
if (difference == 0) return 'warning';
if (difference < 0) return 'success';
if (difference > 0) return 'alert';
};
const removeOrders = async () => {
try {
const selectedIds = selectedRows.value.map((row) => row.id);
const params = { deletes: selectedIds };
await axios.post('SalesMonitors/deleteOrders', params);
selectedRows.value = [];
await table.value.reload();
} catch (err) {
console.error('Error deleting orders', err);
}
};
const openTab = (id) =>
window.open(`#/order/${id}/summary`, '_blank', 'noopener, noreferrer');
</script>
<template>
<VnTable
ref="table"
class="q-px-none"
data-key="SalesMonitorOrders"
url="SalesMonitors/ordersFilter"
search-url="SalesMonitorOrders"
order="date_send DESC"
:right-search="false"
:expr-builder="exprBuilder"
auto-load
:columns="columns"
:table="{
'row-key': 'id',
selection: 'multiple',
'hide-bottom': true,
}"
default-mode="table"
:row-click="({ id }) => openTab(id)"
v-model:selected="selectedRows"
:disable-option="{ card: true }"
>
<template #top-left>
<QBtn
icon="refresh"
size="md"
color="primary"
dense
flat
@click="$refs.table.reload()"
>
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
</QBtn>
<QBtn
v-if="selectedRows.length"
icon="delete"
size="md"
dense
flat
color="primary"
@click="
openConfirmationModal(
$t('salesOrdersTable.deleteConfirmTitle'),
$t('salesOrdersTable.deleteConfirmMessage'),
removeOrders
)
"
>
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
</QBtn>
</template>
<template #column-dateSend="{ row }">
<QTd>
<QBadge
:color="getBadgeColor(row.date_send)"
text-color="black"
class="q-pa-sm"
style="font-size: 14px"
>
{{ toDateFormat(row.date_send) }}
</QBadge>
</QTd>
</template>
<template #column-clientFk="{ row }">
<QTd @click.stop>
<span class="link" v-text="row.clientName" :title="row.clientName" />
<CustomerDescriptorProxy :id="row.clientFk" />
</QTd>
</template>
<template #column-salesPersonFk="{ row }">
<QTd @click.stop>
<span class="link" v-text="row.salesPerson" />
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
</QTd>
</template>
</VnTable>
</template>
<style lang="scss" scoped>
.q-td {
max-width: 140px;
}
</style>

View File

@ -1,147 +0,0 @@
<script setup>
import { ref, computed, reactive, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import { toDateFormat } from 'src/filters/date.js';
import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n();
const paginateRef = ref(null);
const workersActiveOptions = ref([]);
const clientsOptions = ref([]);
const from = ref(Date.vnNew());
const to = ref(Date.vnNew());
const dateRange = computed(() => {
const minHour = new Date(from.value);
minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(to.value);
maxHour.setHours(23, 59, 59, 59);
return [minHour, maxHour];
});
const filter = reactive({
where: {
'v.stamp': {
between: dateRange.value,
},
},
});
const refetch = async () => await paginateRef.value.fetch();
watch(dateRange, (val) => {
filter.where['v.stamp'].between = val;
refetch();
});
function exprBuilder(param, value) {
switch (param) {
case 'clientFk':
return { [`c.id`]: value };
case 'salesPersonFk':
return { [`c.${param}`]: value };
}
}
const params = reactive({});
const columns = computed(() => [
{
label: t('salesClientsTable.date'),
name: 'dated',
field: 'dated',
align: 'left',
columnFilter: null,
sortable: true,
format: (row) => toDateFormat(row.dated),
},
{
label: t('salesClientsTable.hour'),
name: 'hour',
field: 'hour',
align: 'left',
sortable: true,
},
{
label: t('salesClientsTable.salesPerson'),
name: 'salesPerson',
field: 'salesPerson',
align: 'left',
sortable: true,
columnField: {
component: null,
},
},
{
label: t('salesClientsTable.client'),
field: 'clientName',
name: 'client',
align: 'left',
sortable: true,
columnField: {
component: null,
},
},
]);
</script>
<template>
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{
fields: ['id', 'nickname'],
order: 'nickname ASC',
where: { role: 'salesPerson' },
}"
auto-load
@on-fetch="(data) => (workersActiveOptions = data)"
/>
<FetchData
url="Clients"
:filter="{
fields: ['id', 'name'],
order: 'name ASC',
}"
auto-load
@on-fetch="(data) => (clientsOptions = data)"
/>
<QCard style="max-height: 380px; overflow-y: scroll">
<VnTable
ref="paginateRef"
data-key="SalesMonitorClients"
url="SalesMonitors/clientsFilter"
:order="['dated DESC', 'hour DESC']"
:limit="6"
:expr-builder="exprBuilder"
:user-params="params"
:filter="filter"
:offset="50"
auto-load
:columns="columns"
:right-search="false"
default-mode="table"
dense
:without-header="true"
>
<template #column-salesPerson="{ row }">
<QTd>
<span class="link">{{ row.salesPerson }}</span>
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
</QTd>
</template>
<template #column-client="{ row }">
<QTd>
<span class="link">{{ row.clientName }}</span>
<CustomerDescriptorProxy :id="row.clientFk" />
</QTd>
</template>
</VnTable>
</QCard>
</template>

View File

@ -1,204 +0,0 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js';
import { toCurrency } from 'src/filters';
import { useVnConfirm } from 'composables/useVnConfirm';
import axios from 'axios';
const { t } = useI18n();
const { openConfirmationModal } = useVnConfirm();
const paginateRef = ref(null);
const workersActiveOptions = ref([]);
const clientsOptions = ref([]);
const selectedRows = ref([]);
const dateRange = (value) => {
const minHour = new Date(value);
minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(value);
maxHour.setHours(23, 59, 59, 59);
return [minHour, maxHour];
};
function exprBuilder(param, value) {
switch (param) {
case 'date_send':
return {
[`o.date_send`]: {
between: dateRange(value),
},
};
case 'clientFk':
return { [`c.id`]: value };
case 'salesPersonFk':
return { [`c.${param}`]: value };
}
}
const columns = computed(() => [
{
label: t('salesOrdersTable.date'),
name: 'date',
field: 'dated',
align: 'left',
sortable: true,
cardVisible: true,
},
{
label: t('salesOrdersTable.client'),
name: 'client',
align: 'left',
sortable: true,
cardVisible: true,
},
{
label: t('salesOrdersTable.salesPerson'),
name: 'salesPerson',
align: 'left',
sortable: true,
cardVisible: true,
},
]);
const getBadgeColor = (date) => {
const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const orderLanded = new Date(date);
orderLanded.setHours(0, 0, 0, 0);
const difference = today - orderLanded;
if (difference == 0) return 'warning';
if (difference < 0) return 'success';
if (difference > 0) return 'alert';
};
const removeOrders = async () => {
try {
const selectedIds = selectedRows.value.map((row) => row.id);
const params = { deletes: selectedIds };
await axios.post('SalesMonitors/deleteOrders', params);
selectedRows.value = [];
await paginateRef.value.fetch();
} catch (err) {
console.error('Error deleting orders', err);
}
};
const redirectToOrderSummary = (orderId) => {
const url = `#/order/${orderId}/summary`;
window.open(url, '_blank');
};
</script>
<template>
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{
fields: ['id', 'nickname'],
order: 'nickname ASC',
where: { role: 'salesPerson' },
}"
auto-load
@on-fetch="(data) => (workersActiveOptions = data)"
/>
<FetchData
url="Clients"
:filter="{
fields: ['id', 'name'],
order: 'name ASC',
}"
auto-load
@on-fetch="(data) => (clientsOptions = data)"
/>
<VnSubToolbar />
<QCard style="max-height: 380px; overflow-y: scroll">
<VnTable
ref="paginateRef"
data-key="SalesMonitorOrders"
url="SalesMonitors/ordersFilter"
order="date_make DESC"
:limit="6"
:right-search="false"
:expr-builder="exprBuilder"
auto-load
:columns="columns"
:table="{
'row-key': 'id',
selection: 'multiple',
'hide-bottom': true,
}"
default-mode="table"
:without-header="false"
@row-click="(_, row) => redirectToOrderSummary(row.id)"
v-model:selected="selectedRows"
>
<template #top-left>
<QBtn
v-if="selectedRows.length > 0"
icon="delete"
size="md"
color="primary"
@click="
openConfirmationModal(
t('salesOrdersTable.deleteConfirmTitle'),
t('salesOrdersTable.deleteConfirmMessage'),
removeOrders
)
"
>
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
</QBtn>
</template>
<template #column-date="{ row }">
<QTd>
<QBadge
:color="getBadgeColor(row.date_send)"
text-color="black"
class="q-pa-sm q-mb-md"
style="font-size: 14px"
>
{{ toDateFormat(row.date_send) }}
</QBadge>
<div>{{ toDateTimeFormat(row.date_make) }}</div>
</QTd>
</template>
<template #column-client="{ row }">
<QTd>
<div class="q-mb-md">
<span class="link">{{ row.clientName }}</span>
<CustomerDescriptorProxy :id="row.clientFk" />
</div>
<span> {{ row.agencyName }}</span>
</QTd>
</template>
<template #column-salesPerson="{ row }">
<QTd>
<div class="q-mb-md">
<span class="link">{{ row.salesPerson }}</span>
<WorkerDescriptorProxy :id="row.salesPersonFk" dense />
</div>
<span>{{ toCurrency(row.import) }}</span>
</QTd>
</template>
</VnTable>
</QCard>
</template>
<style lang="scss" scoped>
.q-td {
color: gray;
}
</style>

View File

@ -0,0 +1,286 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnFilterPanelChip from 'src/components/ui/VnFilterPanelChip.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import FetchData from 'src/components/FetchData.vue';
import { dateRange } from 'src/filters';
defineProps({ dataKey: { type: String, required: true } });
const { t } = useI18n();
const warehouses = ref();
const groupedStates = ref();
const handleScopeDays = (params, days, callback) => {
const [from, to] = dateRange(Date.vnNew());
if (!days) {
Object.assign(params, { from, to, scopeDays: 1 });
} else {
params.from = from;
to.setDate(to.getDate() + days);
params.to = to;
}
if (callback) callback();
};
</script>
<template>
<FetchData url="Warehouses" auto-load @on-fetch="(data) => (warehouses = data)" />
<FetchData
url="AlertLevels"
auto-load
@on-fetch="
(data) =>
(groupedStates = data.map((x) => Object.assign(x, { code: t(x.code) })))
"
/>
<VnFilterPanel
:data-key="dataKey"
:search-button="true"
:hidden-tags="['from', 'to']"
:custom-tags="['scopeDays']"
:unremovable-params="['from', 'to', 'scopeDays']"
>
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong v-text="`${t(`params.${tag.label}`)}:`" />
<span v-text="formatFn(tag.value)" />
</div>
</template>
<template #customTags="{ params, searchFn, formatFn }">
<VnFilterPanelChip
v-if="params.scopeDays"
removable
@remove="handleScopeDays(params, null, searchFn)"
>
<strong v-text="`${t(`params.scopeDays`)}:`" />
<span v-text="formatFn(params.scopeDays)" />
</VnFilterPanelChip>
</template>
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput
:label="t('params.clientFk')"
v-model="params.clientFk"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.orderFk')"
v-model="params.orderFk"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputNumber
:label="t('params.scopeDays')"
v-model="params.scopeDays"
is-outlined
@update:model-value="(val) => handleScopeDays(params, val)"
@remove="(val) => handleScopeDays(params, val)"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.nickname')"
v-model="params.nickname"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
dense
rounded
:label="t('params.salesPersonFk')"
v-model="params.salesPersonFk"
url="Workers/search"
:params="{ departmentCodes: ['VT'] }"
is-outlined
option-value="code"
option-label="name"
:no-one="true"
>
<template #option="{ opt, itemProps }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel
v-if="opt.code"
class="text-grey text-caption"
>
{{ `${opt.nickname}, ${opt.code}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.refFk')"
v-model="params.refFk"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
dense
rounded
:label="t('params.agencyModeFk')"
v-model="params.agencyModeFk"
url="AgencyModes/isActive"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
dense
rounded
:label="t('params.stateFk')"
v-model="params.stateFk"
url="States"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
dense
rounded
:label="t('params.groupedStates')"
v-model="params.alertLevel"
:options="groupedStates"
option-label="code"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
dense
rounded
:label="t('params.warehouseFk')"
v-model="params.warehouseFk"
:options="warehouses"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
dense
rounded
:label="t('params.provinceFk')"
v-model="params.provinceFk"
url="Provinces"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.myTeam')"
v-model="params.myTeam"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.problems')"
v-model="params.problems"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.pending')"
v-model="params.pending"
toggle-indeterminate
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
clientFk: Client id
orderFk: Order id
scopeDays: Days onward
nickname: Nickname
salesPersonFk: Sales person
refFk: Invoice
agencyModeFk: Agency
stateFk: State
groupedStates: Grouped State
warehouseFk: Warehouse
provinceFk: Province
myTeam: My team
problems: With problems
pending: Pending
from: From
to: To
alertLevel: Grouped State
FREE: Free
DELIVERED: Delivered
ON_PREPARATION: On preparation
ON_PREVIOUS: On previous
PACKED: Packed
No one: No one
es:
params:
clientFk: Id cliente
orderFk: Id cesta
scopeDays: Días en adelante
nickname: Nombre mostrado
salesPersonFk: Comercial
refFk: Factura
agencyModeFk: Agencia
stateFk: Estado
groupedStates: Estado agrupado
warehouseFk: Almacén
provinceFk: Provincia
myTeam: Mi equipo
problems: Con problemas
pending: Pendiente
from: Desde
To: Hasta
alertLevel: Estado agrupado
FREE: Libre
DELIVERED: Servido
ON_PREPARATION: En preparación
ON_PREVIOUS: En previa
PACKED: Encajado
</i18n>

View File

@ -0,0 +1,12 @@
<script setup>
import VnSearchbar from 'components/ui/VnSearchbar.vue';
</script>
<template>
<VnSearchbar
data-key="SalesMonitorTickets"
url="SalesMonitors/salesFilter"
:redirect="false"
:label="$t('searchBar.label')"
:info="$t('searchBar.info')"
/>
</template>

View File

@ -1,37 +1,38 @@
<script setup> <script setup>
import { ref, computed, reactive } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue'; import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue'; import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toDateFormat, toTimeFormat } from 'src/filters/date.js'; import { toDateFormat } from 'src/filters/date.js';
import { toCurrency, dateRange } from 'src/filters'; import { toCurrency, dateRange, dashIfEmpty } from 'src/filters';
import RightMenu from 'src/components/common/RightMenu.vue';
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
import MonitorTicketFilter from './MonitorTicketFilter.vue';
const DEFAULT_AUTO_REFRESH = 1000; const DEFAULT_AUTO_REFRESH = 2 * 60 * 1000; // 2min in ms
const { t } = useI18n(); const { t } = useI18n();
const autoRefresh = ref(false); const autoRefresh = ref(false);
const paginateRef = ref(null); const tableRef = ref(null);
const workersActiveOptions = ref([]); const provinceOpts = ref([]);
const provincesOptions = ref([]); const stateOpts = ref([]);
const statesOptions = ref([]); const zoneOpts = ref([]);
const zonesOptions = ref([]);
const visibleColumns = ref([]); const visibleColumns = ref([]);
const allColumnNames = ref([]);
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const [from, to] = dateRange(Date.vnNew());
function exprBuilder(param, value) { function exprBuilder(param, value) {
switch (param) { switch (param) {
case 'stateFk': case 'stateFk':
return { 'ts.stateFk': value }; return { 'ts.stateFk': value };
case 'salesPersonFk': case 'salesPersonFk':
return { 'c.salesPersonFk': value }; return { 'c.salesPersonFk': !value ? null : value };
case 'provinceFk': case 'provinceFk':
return { 'a.provinceFk': value }; return { 'a.provinceFk': value };
case 'theoreticalHour': case 'theoreticalHour':
@ -48,15 +49,12 @@ function exprBuilder(param, value) {
} }
} }
const filter = { order: ['totalProblems DESC'] };
let params = reactive({});
const columns = computed(() => [ const columns = computed(() => [
{ {
label: t('salesTicketsTable.problems'), label: t('salesTicketsTable.problems'),
name: 'problems', name: 'totalProblems',
align: 'left', align: 'left',
sortable: true,
columnFilter: false, columnFilter: false,
attrs: { attrs: {
dense: true, dense: true,
@ -64,13 +62,12 @@ const columns = computed(() => [
}, },
{ {
label: t('salesTicketsTable.identifier'), label: t('salesTicketsTable.identifier'),
name: 'identifier', name: 'id',
field: 'id', field: 'id',
align: 'left', align: 'left',
sortable: true,
columnFilter: { columnFilter: {
component: 'input', component: 'number',
name: 'id', name: 'id',
attrs: { attrs: {
dense: true, dense: true,
@ -79,41 +76,41 @@ const columns = computed(() => [
}, },
{ {
label: t('salesTicketsTable.client'), label: t('salesTicketsTable.client'),
name: 'client', name: 'clientFk',
align: 'left', align: 'left',
field: 'nickname', field: 'nickname',
sortable: true,
columnFilter: { columnFilter: {
component: 'input', component: 'select',
name: 'nickname',
attrs: { attrs: {
dense: true, url: 'Clients',
fields: ['id', 'name', 'nickname'],
sortBy: 'name ASC',
}, },
}, },
}, },
{ {
label: t('salesTicketsTable.salesPerson'), label: t('salesTicketsTable.salesPerson'),
name: 'salesPerson', name: 'salesPersonFk',
field: 'userName', field: 'userName',
align: 'left', align: 'left',
sortable: true, optionFilter: 'firstName',
columnFilter: { columnFilter: {
component: 'select', component: 'select',
name: 'salesPersonFk',
attrs: { attrs: {
options: workersActiveOptions.value, url: 'Workers/activeWithInheritedRole',
'option-value': 'id', fields: ['id', 'name'],
'option-label': 'name', sortBy: 'nickname ASC',
dense: true, where: { role: 'salesPerson' },
useLike: false,
}, },
}, },
}, },
{ {
label: t('salesTicketsTable.date'), label: t('salesTicketsTable.date'),
name: 'date', name: 'shippedDate',
style: { 'max-width': '100px' }, style: { 'max-width': '100px' },
align: 'left', align: 'left',
sortable: true,
columnFilter: { columnFilter: {
component: 'date', component: 'date',
name: 'shippedDate', name: 'shippedDate',
@ -124,61 +121,39 @@ const columns = computed(() => [
}, },
{ {
label: t('salesTicketsTable.theoretical'), label: t('salesTicketsTable.theoretical'),
name: 'theoretical', name: 'theoreticalhour',
field: 'zoneLanding', field: 'zoneLanding',
align: 'left', align: 'left',
sortable: true, format: (row) => row.theoreticalhour,
format: (val) => toTimeFormat(val), columnFilter: false,
columnFilter: {
component: 'input',
name: 'theoreticalHour',
attrs: {
dense: true,
},
},
}, },
{ {
label: t('salesTicketsTable.practical'), label: t('salesTicketsTable.practical'),
name: 'practical', name: 'practicalHour',
field: 'practicalHour', field: 'practicalHour',
align: 'left', align: 'left',
sortable: true, format: (row) => row.practicalHour,
columnFilter: { columnFilter: false,
component: 'input',
name: 'practicalHour',
attrs: {
dense: true,
},
},
}, },
{ {
label: t('salesTicketsTable.preparation'), label: t('salesTicketsTable.preparation'),
name: 'preparation', name: 'preparationHour',
field: 'shipped', field: 'shipped',
align: 'left', align: 'left',
sortable: true, format: (row) => row.preparationHour,
format: (val) => toTimeFormat(val), columnFilter: false,
columnFilter: {
component: 'input',
name: 'shippedDate',
attrs: {
dense: true,
},
},
}, },
{ {
label: t('salesTicketsTable.province'), label: t('salesTicketsTable.province'),
name: 'province', name: 'provinceFk',
field: 'province', field: 'province',
align: 'left', align: 'left',
style: { 'max-width': '100px' }, format: (row) => row.province,
sortable: true,
columnFilter: { columnFilter: {
component: 'select', component: 'select',
name: 'provinceFk', name: 'provinceFk',
attrs: { attrs: {
options: provincesOptions.value, options: provinceOpts.value,
'option-value': 'id', 'option-value': 'id',
'option-label': 'name', 'option-label': 'name',
dense: true, dense: true,
@ -190,12 +165,11 @@ const columns = computed(() => [
name: 'state', name: 'state',
align: 'left', align: 'left',
style: { 'max-width': '100px' }, style: { 'max-width': '100px' },
sortable: true,
columnFilter: { columnFilter: {
component: 'select', component: 'select',
name: 'stateFk', name: 'stateFk',
attrs: { attrs: {
options: statesOptions.value, options: stateOpts.value,
'option-value': 'id', 'option-value': 'id',
'option-label': 'name', 'option-label': 'name',
dense: true, dense: true,
@ -207,10 +181,7 @@ const columns = computed(() => [
name: 'isFragile', name: 'isFragile',
field: 'isFragile', field: 'isFragile',
align: 'left', align: 'left',
sortable: true, columnFilter: false,
columnFilter: {
inWhere: true,
},
attrs: { attrs: {
'checked-icon': 'local_bar', 'checked-icon': 'local_bar',
'unchecked-icon': 'local_bar', 'unchecked-icon': 'local_bar',
@ -220,14 +191,14 @@ const columns = computed(() => [
}, },
{ {
label: t('salesTicketsTable.zone'), label: t('salesTicketsTable.zone'),
name: 'zone', name: 'zoneFk',
align: 'left', align: 'left',
sortable: true,
columnFilter: { columnFilter: {
component: 'select', component: 'select',
name: 'zoneFk', name: 'zoneFk',
attrs: { attrs: {
options: zonesOptions.value, options: zoneOpts.value,
'option-value': 'id', 'option-value': 'id',
'option-label': 'name', 'option-label': 'name',
dense: true, dense: true,
@ -236,13 +207,13 @@ const columns = computed(() => [
}, },
{ {
label: t('salesTicketsTable.total'), label: t('salesTicketsTable.total'),
name: 'total', name: 'totalWithVat',
field: 'totalWithVat', field: 'totalWithVat',
align: 'left', align: 'left',
style: { 'max-width': '75px' }, style: { 'max-width': '75px' },
sortable: true,
columnFilter: { columnFilter: {
component: 'input', component: 'number',
name: 'totalWithVat', name: 'totalWithVat',
attrs: { attrs: {
dense: true, dense: true,
@ -258,7 +229,7 @@ const columns = computed(() => [
title: t('salesTicketsTable.goToLines'), title: t('salesTicketsTable.goToLines'),
icon: 'vn:lines', icon: 'vn:lines',
color: 'priamry', color: 'priamry',
action: (row) => redirectToSales(row.id), action: (row) => openTab(row.id),
isPrimary: true, isPrimary: true,
attrs: { attrs: {
flat: true, flat: true,
@ -297,18 +268,13 @@ let refreshTimer = null;
const autoRefreshHandler = (value) => { const autoRefreshHandler = (value) => {
if (value) if (value)
refreshTimer = setInterval(() => paginateRef.value.fetch(), DEFAULT_AUTO_REFRESH); refreshTimer = setInterval(() => tableRef.value.reload(), DEFAULT_AUTO_REFRESH);
else { else {
clearInterval(refreshTimer); clearInterval(refreshTimer);
refreshTimer = null; refreshTimer = null;
} }
}; };
const redirectToTicketSummary = (id) => {
const url = `#/ticket/${id}/summary`;
window.open(url, '_blank');
};
const stateColors = { const stateColors = {
notice: 'info', notice: 'info',
success: 'positive', success: 'positive',
@ -329,23 +295,10 @@ const formatShippedDate = (date) => {
return toDateFormat(_date); return toDateFormat(_date);
}; };
const redirectToSales = (id) => { const openTab = (id) =>
const url = `#/ticket/${id}/sale`; window.open(`#/ticket/${id}/sale`, '_blank', 'noopener, noreferrer');
window.open(url, '_blank');
};
</script> </script>
<template> <template>
<FetchData
url="Workers/activeWithInheritedRole"
:filter="{
fields: ['id', 'nickname'],
order: 'nickname ASC',
where: { role: 'salesPerson' },
}"
auto-load
@on-fetch="(data) => (workersActiveOptions = data)"
/>
<FetchData <FetchData
url="Provinces" url="Provinces"
:filter="{ :filter="{
@ -353,7 +306,7 @@ const redirectToSales = (id) => {
order: 'name ASC', order: 'name ASC',
}" }"
auto-load auto-load
@on-fetch="(data) => (provincesOptions = data)" @on-fetch="(data) => (provinceOpts = data)"
/> />
<FetchData <FetchData
url="States" url="States"
@ -362,7 +315,7 @@ const redirectToSales = (id) => {
order: 'name ASC', order: 'name ASC',
}" }"
auto-load auto-load
@on-fetch="(data) => (statesOptions = data)" @on-fetch="(data) => (stateOpts = data)"
/> />
<FetchData <FetchData
url="Zones" url="Zones"
@ -371,46 +324,60 @@ const redirectToSales = (id) => {
order: 'name ASC', order: 'name ASC',
}" }"
auto-load auto-load
@on-fetch="(data) => (zonesOptions = data)" @on-fetch="(data) => (zoneOpts = data)"
/> />
<MonitorTicketSearchbar />
<RightMenu>
<template #right-panel>
<MonitorTicketFilter data-key="saleMonitorTickets" />
</template>
</RightMenu>
<VnTable <VnTable
ref="paginateRef" ref="tableRef"
data-key="SalesMonitorTickets" data-key="saleMonitorTickets"
url="SalesMonitors/salesFilter" url="SalesMonitors/salesFilter"
:filter="filter" search-url="saleMonitorTickets"
:limit="20"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:user-params="params"
:offset="50" :offset="50"
:columns="columns" :columns="columns"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:right-search="false" :right-search="false"
default-mode="table" default-mode="table"
auto-load auto-load
@row-click="(_, row) => redirectToTicketSummary(row.id)" :row-click="({ id }) => openTab(id)"
:disable-option="{ card: true }"
:user-params="{ from, to, scopeDays: 1 }"
> >
<template #top-left> <template #top-left>
<TableVisibleColumns <QBtn
:all-columns="allColumnNames" icon="refresh"
table-code="ticketsMonitor" size="md"
labels-traductions-path="salesTicketsTable" color="primary"
@on-config-saved="visibleColumns = [...$event, 'rowActions']" class="q-mr-sm"
/> dense
flat
@click="$refs.tableRef.reload()"
>
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
</QBtn>
<QCheckbox <QCheckbox
v-model="autoRefresh" v-model="autoRefresh"
:label="t('salesTicketsTable.autoRefresh')" :label="$t('salesTicketsTable.autoRefresh')"
@update:model-value="autoRefreshHandler" @update:model-value="autoRefreshHandler"
/> dense
>
<QTooltip>{{ $t('refreshInfo') }}</QTooltip>
</QCheckbox>
</template> </template>
<template #column-problems="{ row }"> <template #column-totalProblems="{ row }">
<QTd class="no-padding" style="max-width: 50px"> <QTd class="no-padding" style="max-width: 60px">
<QIcon <QIcon
v-if="row.isTaxDataChecked === 0" v-if="row.isTaxDataChecked === 0"
name="vn:no036" name="vn:no036"
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ t('salesTicketsTable.noVerifiedData') }}</QTooltip> <QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.hasTicketRequest" v-if="row.hasTicketRequest"
@ -418,7 +385,7 @@ const redirectToSales = (id) => {
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ t('salesTicketsTable.purchaseRequest') }}</QTooltip> <QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.itemShortage" v-if="row.itemShortage"
@ -426,10 +393,10 @@ const redirectToSales = (id) => {
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ t('salesTicketsTable.notVisible') }}</QTooltip> <QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
</QIcon> </QIcon>
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs"> <QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
<QTooltip>{{ t('salesTicketsTable.clientFrozen') }}</QTooltip> <QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.risk" v-if="row.risk"
@ -437,7 +404,9 @@ const redirectToSales = (id) => {
:color="row.hasHighRisk ? 'negative' : 'primary'" :color="row.hasHighRisk ? 'negative' : 'primary'"
size="xs" size="xs"
> >
<QTooltip>{{ t('salesTicketsTable.risk') }}: {{ row.risk }}</QTooltip> <QTooltip
>{{ $t('salesTicketsTable.risk') }}: {{ row.risk }}</QTooltip
>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.hasComponentLack" v-if="row.hasComponentLack"
@ -445,7 +414,7 @@ const redirectToSales = (id) => {
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ t('salesTicketsTable.componentLack') }}</QTooltip> <QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.isTooLittle" v-if="row.isTooLittle"
@ -453,11 +422,11 @@ const redirectToSales = (id) => {
color="primary" color="primary"
size="xs" size="xs"
> >
<QTooltip>{{ t('salesTicketsTable.tooLittle') }}</QTooltip> <QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
</QIcon> </QIcon>
</QTd> </QTd>
</template> </template>
<template #column-identifier="{ row }"> <template #column-id="{ row }">
<QTd class="no-padding"> <QTd class="no-padding">
<span class="link" @click.stop.prevent> <span class="link" @click.stop.prevent>
{{ row.id }} {{ row.id }}
@ -465,19 +434,19 @@ const redirectToSales = (id) => {
</span> </span>
</QTd> </QTd>
</template> </template>
<template #column-client="{ row }"> <template #column-clientFk="{ row }">
<QTd class="no-padding" @click.stop.prevent> <QTd class="no-padding" @click.stop :title="row.nickname">
<span class="link">{{ row.nickname }}</span> <span class="link">{{ row.nickname }}</span>
<CustomerDescriptorProxy :id="row.clientFk" /> <CustomerDescriptorProxy :id="row.clientFk" />
</QTd> </QTd>
</template> </template>
<template #column-salesPerson="{ row }"> <template #column-salesPersonFk="{ row }">
<QTd class="no-padding" @click.stop.prevent> <QTd class="no-padding" @click.stop :title="row.userName">
<span class="link">{{ row.userName }}</span> <span class="link" v-text="dashIfEmpty(row.userName)" />
<WorkerDescriptorProxy :id="row.salesPersonFk" /> <WorkerDescriptorProxy :id="row.salesPersonFk" />
</QTd> </QTd>
</template> </template>
<template #column-date="{ row }"> <template #column-shippedDate="{ row }">
<QTd class="no-padding"> <QTd class="no-padding">
<QBadge <QBadge
v-bind="getBadgeAttrs(row.shippedDate)" v-bind="getBadgeAttrs(row.shippedDate)"
@ -488,6 +457,11 @@ const redirectToSales = (id) => {
</QBadge> </QBadge>
</QTd> </QTd>
</template> </template>
<template #column-provinceFk="{ row }">
<QTd class="no-padding">
<span :title="row.province" v-text="row.province" />
</QTd>
</template>
<template #column-state="{ row }"> <template #column-state="{ row }">
<QTd class="no-padding" @click.stop.prevent> <QTd class="no-padding" @click.stop.prevent>
<div v-if="row.refFk"> <div v-if="row.refFk">
@ -508,17 +482,17 @@ const redirectToSales = (id) => {
<template #column-isFragile="{ row }"> <template #column-isFragile="{ row }">
<QTd class="no-padding"> <QTd class="no-padding">
<QIcon v-if="row.isFragile" name="local_bar" color="primary" size="sm"> <QIcon v-if="row.isFragile" name="local_bar" color="primary" size="sm">
<QTooltip>{{ t('salesTicketsTable.isFragile') }}</QTooltip> <QTooltip>{{ $t('salesTicketsTable.isFragile') }}</QTooltip>
</QIcon> </QIcon>
</QTd> </QTd>
</template> </template>
<template #column-zone="{ row }"> <template #column-zoneFk="{ row }">
<QTd class="no-padding" @click.stop.prevent> <QTd class="no-padding" @click.stop.prevent :title="row.zoneName">
<span class="link">{{ row.zoneName }}</span> <span class="link">{{ row.zoneName }}</span>
<ZoneDescriptorProxy :id="row.zoneFk" /> <ZoneDescriptorProxy :id="row.zoneFk" />
</QTd> </QTd>
</template> </template>
<template #column-total="{ row }"> <template #column-totalWithVat="{ row }">
<QTd class="no-padding"> <QTd class="no-padding">
<QBadge <QBadge
:color="totalPriceColor(row) || 'transparent'" :color="totalPriceColor(row) || 'transparent'"

View File

@ -11,11 +11,14 @@ salesClientsTable:
client: Client client: Client
salesOrdersTable: salesOrdersTable:
delete: Delete delete: Delete
date: Date dateSend: Send date
dateMake: Make date
client: Client client: Client
salesPerson: Salesperson salesPerson: Salesperson
deleteConfirmTitle: Delete selected elements deleteConfirmTitle: Delete selected elements
deleteConfirmMessage: All the selected elements will be deleted. Are you sure you want to continue? deleteConfirmMessage: All the selected elements will be deleted. Are you sure you want to continue?
agency: Agency
import: Import
salesTicketsTable: salesTicketsTable:
autoRefresh: Auto-refresh autoRefresh: Auto-refresh
problems: Problems problems: Problems
@ -43,3 +46,4 @@ salesTicketsTable:
searchBar: searchBar:
label: Search tickets label: Search tickets
info: Search tickets by id or alias info: Search tickets by id or alias
refreshInfo: Toggle auto-refresh every 2 minutes

View File

@ -11,11 +11,14 @@ salesClientsTable:
client: Cliente client: Cliente
salesOrdersTable: salesOrdersTable:
delete: Eliminar delete: Eliminar
date: Fecha dateSend: Fecha de envío
dateMake: Fecha de realización
client: Cliente client: Cliente
salesPerson: Comercial salesPerson: Comercial
deleteConfirmTitle: Eliminar los elementos seleccionados deleteConfirmTitle: Eliminar los elementos seleccionados
deleteConfirmMessage: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar? deleteConfirmMessage: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
agency: Agencia
import: Importe
salesTicketsTable: salesTicketsTable:
autoRefresh: Auto-refresco autoRefresh: Auto-refresco
problems: Problemas problems: Problemas
@ -43,3 +46,4 @@ salesTicketsTable:
searchBar: searchBar:
label: Buscar tickets label: Buscar tickets
info: Buscar tickets por identificador o alias info: Buscar tickets por identificador o alias
refreshInfo: Conmuta el refresco automático cada 2 minutos

View File

@ -380,21 +380,6 @@ function addOrder(value, field, params) {
@click="tagValues.push({})" @click="tagValues.push({})"
/> />
</QItem> </QItem>
<!-- <QItem>
<QItemSection class="q-py-sm">
<QBtn
:label="t('Search')"
class="full-width"
color="primary"
dense
icon="search"
rounded
type="button"
unelevated
@click.stop="applyTagFilter(params, searchFn)"
/>
</QItemSection>
</QItem> -->
<QSeparator /> <QSeparator />
</template> </template>
</VnFilterPanel> </VnFilterPanel>

View File

@ -77,10 +77,6 @@ const addToOrder = async () => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
// .container {
// max-width: 768px;
// width: 100%;
// }
.td { .td {
width: 200px; width: 200px;
} }

View File

@ -14,6 +14,7 @@ import FetchData from 'src/components/FetchData.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import FetchedTags from 'src/components/ui/FetchedTags.vue'; import FetchedTags from 'src/components/ui/FetchedTags.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
const router = useRouter(); const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -280,7 +281,12 @@ watch(
<VnImg :id="parseInt(row?.item?.image)" class="rounded" /> <VnImg :id="parseInt(row?.item?.image)" class="rounded" />
</div> </div>
</template> </template>
<template #column-id="{ row }">
<span class="link" @click.stop>
{{ row?.item?.id }}
<ItemDescriptorProxy :id="row?.item?.id" />
</span>
</template>
<template #column-itemFk="{ row }"> <template #column-itemFk="{ row }">
<div class="row column full-width justify-between items-start"> <div class="row column full-width justify-between items-start">
{{ row?.item?.name }} {{ row?.item?.name }}
@ -288,7 +294,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }} {{ row?.item?.subName.toUpperCase() }}
</div> </div>
</div> </div>
<FetchedTags :item="row?.item" :max-length="6" /> <FetchedTags :item="row?.item" />
</template> </template>
<template #column-amount="{ row }"> <template #column-amount="{ row }">
{{ toCurrency(row.quantity * row.price) }} {{ toCurrency(row.quantity * row.price) }}

View File

@ -10,7 +10,7 @@ const { t } = useI18n();
data-key="OrderList" data-key="OrderList"
url="Orders/filter" url="Orders/filter"
:label="t('Search order')" :label="t('Search order')"
:info="t('You can search orders by reference')" :info="t('Search orders by ticket id')"
/> />
</template> </template>
@ -18,5 +18,5 @@ const { t } = useI18n();
<i18n> <i18n>
es: es:
Search order: Buscar orden Search order: Buscar orden
You can search orders by reference: Puedes buscar por referencia de la orden Search orders by ticket id: Buscar pedido por id ticket
</i18n> </i18n>

View File

@ -192,7 +192,7 @@ const detailsColumns = ref([
</span> </span>
</div> </div>
</div> </div>
<FetchedTags :item="props.row.item" :max-length="5" /> <FetchedTags :item="props.row.item" />
</QTd> </QTd>
<QTd key="quantity" :props="props"> <QTd key="quantity" :props="props">
{{ props.row.quantity }} {{ props.row.quantity }}

View File

@ -2,8 +2,9 @@
import axios from 'axios'; import axios from 'axios';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
@ -58,6 +59,9 @@ const loadVolumes = async (rows) => {
}); });
volumes.value = rows; volumes.value = rows;
}; };
const stateStore = useStateStore();
onMounted(async () => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>
@ -84,6 +88,7 @@ const loadVolumes = async (rows) => {
@on-fetch="(data) => loadVolumes(data)" @on-fetch="(data) => loadVolumes(data)"
:right-search="false" :right-search="false"
:column-search="false" :column-search="false"
:disable-option="{ card: true }"
> >
<template #column-itemFk="{ row }"> <template #column-itemFk="{ row }">
<span class="link"> <span class="link">
@ -92,7 +97,13 @@ const loadVolumes = async (rows) => {
</span> </span>
</template> </template>
<template #column-description="{ row }"> <template #column-description="{ row }">
<FetchedTags :item="row.item" :max-length="5" /> <div class="row column full-width justify-between items-start">
{{ row?.item?.name }}
<div v-if="row?.item?.subName" class="subName">
{{ row?.item?.subName.toUpperCase() }}
</div>
</div>
<FetchedTags :item="row?.item" />
</template> </template>
<template #column-volume="{ rowIndex }"> <template #column-volume="{ rowIndex }">
{{ volumes?.[rowIndex]?.volume }} {{ volumes?.[rowIndex]?.volume }}
@ -121,6 +132,11 @@ const loadVolumes = async (rows) => {
} }
} }
} }
.subName {
color: var(--vn-label-color);
text-transform: uppercase;
}
</style> </style>
<i18n> <i18n>
en: en:

View File

@ -11,6 +11,9 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import OrderSearchbar from './Card/OrderSearchbar.vue'; import OrderSearchbar from './Card/OrderSearchbar.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import OrderFilter from './Card/OrderFilter.vue'; import OrderFilter from './Card/OrderFilter.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
import { toDateTimeFormat } from 'src/filters/date';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -75,7 +78,7 @@ const columns = computed(() => [
label: t('module.created'), label: t('module.created'),
component: 'date', component: 'date',
cardVisible: true, cardVisible: true,
format: (row) => toDate(row?.landed), format: (row) => toDateTimeFormat(row?.landed),
columnField: { columnField: {
component: null, component: null,
}, },
@ -115,6 +118,7 @@ const columns = computed(() => [
}, },
}, },
cardVisible: true, cardVisible: true,
columnClass: 'expand',
}, },
{ {
align: 'left', align: 'left',
@ -132,6 +136,7 @@ const columns = computed(() => [
title: t('InvoiceOutSummary'), title: t('InvoiceOutSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, OrderSummary), action: (row) => viewSummary(row.id, OrderSummary),
isPrimary: true,
}, },
], ],
}, },
@ -154,6 +159,16 @@ async function fetchAgencies({ landed, addressId }) {
}); });
agencyList.value = data; agencyList.value = data;
} }
const getDateColor = (date) => {
const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const timeTicket = new Date(date);
timeTicket.setHours(0, 0, 0, 0);
const comparation = today - timeTicket;
if (comparation == 0) return 'bg-warning';
if (comparation < 0) return 'bg-success';
};
</script> </script>
<template> <template>
<OrderSearchbar /> <OrderSearchbar />
@ -183,6 +198,25 @@ async function fetchAgencies({ landed, addressId }) {
:columns="columns" :columns="columns"
redirect="order" redirect="order"
> >
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row?.clientName }}
<CustomerDescriptorProxy :id="row?.clientFk" />
</span>
</template>
<template #column-salesPersonFk="{ row }">
<span class="link" @click.stop>
{{ row?.name }}
<WorkerDescriptorProxy :id="row?.salesPersonFk" />
</span>
</template>
<template #column-landed="{ row }">
<span v-if="getDateColor(row.landed)">
<QChip :class="getDateColor(row.landed)" dense square>
{{ toDate(row?.landed) }}
</QChip>
</span>
</template>
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnSelect <VnSelect
url="Clients" url="Clients"

View File

@ -217,7 +217,7 @@ const ticketColumns = ref([
<template #body-cell-city="{ value, row }"> <template #body-cell-city="{ value, row }">
<QTd auto-width> <QTd auto-width>
<span <span
class="text-primary cursor-pointer" class="link cursor-pointer"
@click="openBuscaman(entity?.route?.vehicleFk, [row])" @click="openBuscaman(entity?.route?.vehicleFk, [row])"
> >
{{ value }} {{ value }}
@ -226,7 +226,7 @@ const ticketColumns = ref([
</template> </template>
<template #body-cell-client="{ value, row }"> <template #body-cell-client="{ value, row }">
<QTd auto-width> <QTd auto-width>
<span class="text-primary cursor-pointer"> <span class="link cursor-pointer">
{{ value }} {{ value }}
<CustomerDescriptorProxy :id="row?.clientFk" /> <CustomerDescriptorProxy :id="row?.clientFk" />
</span> </span>
@ -234,7 +234,7 @@ const ticketColumns = ref([
</template> </template>
<template #body-cell-ticket="{ value, row }"> <template #body-cell-ticket="{ value, row }">
<QTd auto-width class="text-center"> <QTd auto-width class="text-center">
<span class="text-primary cursor-pointer"> <span class="link cursor-pointer">
{{ value }} {{ value }}
<TicketDescriptorProxy :id="row?.id" /> <TicketDescriptorProxy :id="row?.id" />
</span> </span>

View File

@ -87,6 +87,7 @@ const columns = computed(() => [
label: 'agencyName', label: 'agencyName',
}, },
}, },
columnClass: 'expand',
}, },
{ {
align: 'left', align: 'left',
@ -142,17 +143,9 @@ const columns = computed(() => [
{ {
align: 'center', align: 'center',
name: 'm3', name: 'm3',
label: 'volume', label: t('Volume'),
cardVisible: true, cardVisible: true,
}, columnClass: 'shrink',
{
align: 'left',
name: 'description',
label: t('Description'),
isTitle: true,
create: true,
component: 'input',
field: 'description',
}, },
{ {
align: 'left', align: 'left',
@ -168,12 +161,38 @@ const columns = computed(() => [
component: 'time', component: 'time',
columnFilter: false, columnFilter: false,
}, },
{
align: 'center',
name: 'kmStart',
label: t('KmStart'),
columnClass: 'shrink',
create: true,
visible: false,
},
{
align: 'center',
name: 'kmEnd',
label: t('KmEnd'),
columnClass: 'shrink',
create: true,
visible: false,
},
{
align: 'left',
name: 'description',
label: t('Description'),
isTitle: true,
create: true,
component: 'input',
field: 'description',
},
{ {
align: 'left', align: 'left',
name: 'isOk', name: 'isOk',
label: t('Served'), label: t('Served'),
component: 'checkbox', component: 'checkbox',
columnFilter: false, columnFilter: false,
columnClass: 'shrink',
}, },
{ {
align: 'right', align: 'right',
@ -185,7 +204,7 @@ const columns = computed(() => [
action: (row) => openTicketsDialog(row?.id), action: (row) => openTicketsDialog(row?.id),
}, },
{ {
title: t('Preview'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row?.id, RouteSummary), action: (row) => viewSummary(row?.id, RouteSummary),
}, },
@ -368,10 +387,13 @@ es:
Worker: Trabajador Worker: Trabajador
Agency: Agencia Agency: Agencia
Vehicle: Vehículo Vehicle: Vehículo
Volume: Volumen
Date: Fecha Date: Fecha
Description: Descripción Description: Descripción
Hour started: Hora inicio Hour started: Hora inicio
Hour finished: Hora fin Hour finished: Hora fin
KmStart: Km inicio
KmEnd: Km fin
Served: Servida Served: Servida
newRoute: Nueva Ruta newRoute: Nueva Ruta
Clone Selected Routes: Clonar rutas seleccionadas Clone Selected Routes: Clonar rutas seleccionadas

View File

@ -1,5 +1,6 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { computed } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
@ -10,8 +11,8 @@ import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const shelvingId = route.params?.id || null; const entityId = computed(() => route.params.id ?? null);
const isNew = Boolean(!shelvingId); const isNew = Boolean(!entityId.value);
const defaultInitialData = { const defaultInitialData = {
parkingFk: null, parkingFk: null,
priority: null, priority: null,
@ -42,15 +43,15 @@ const onSave = (shelving, newShelving) => {
}; };
</script> </script>
<template> <template>
<VnSubToolbar /> <VnSubToolbar v-if="isNew" />
<FormModel <FormModel
:url="isNew ? null : `Shelvings/${shelvingId}`" :url="isNew ? null : `Shelvings/${entityId}`"
:url-create="isNew ? 'Shelvings' : null" :url-create="isNew ? 'Shelvings' : null"
:observe-form-changes="!isNew" :observe-form-changes="!isNew"
:filter="shelvingFilter" :filter="shelvingFilter"
model="shelving" model="shelving"
:auto-load="!isNew" :auto-load="!isNew"
:form-initial-data="defaultInitialData" :form-initial-data="isNew ? defaultInitialData : null"
@on-data-saved="onSave" @on-data-saved="onSave"
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">

View File

@ -208,7 +208,7 @@ onMounted(async () => {
<QTd no-hover> <QTd no-hover>
<span>{{ buy.subName }}</span> <span>{{ buy.subName }}</span>
<FetchedTags :item="buy" :max-length="5" /> <FetchedTags :item="buy" />
</QTd> </QTd>
<QTd no-hover> {{ dashIfEmpty(buy.quantity) }}</QTd> <QTd no-hover> {{ dashIfEmpty(buy.quantity) }}</QTd>
<QTd no-hover> {{ dashIfEmpty(buy.price) }}</QTd> <QTd no-hover> {{ dashIfEmpty(buy.price) }}</QTd>

View File

@ -245,7 +245,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<div class="column"> <div class="column">
<span>{{ row.item.name }}</span> <span>{{ row.item.name }}</span>
<span class="color-vn-label">{{ row.item.subName }}</span> <span class="color-vn-label">{{ row.item.subName }}</span>
<FetchedTags :item="row.item" :max-length="6" /> <FetchedTags :item="row.item" />
</div> </div>
</QTd> </QTd>
</template> </template>

View File

@ -310,7 +310,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<div class="column"> <div class="column">
<span>{{ row.item.name }}</span> <span>{{ row.item.name }}</span>
<span class="color-vn-label">{{ row.item.subName }}</span> <span class="color-vn-label">{{ row.item.subName }}</span>
<FetchedTags :item="row.item" :max-length="6" /> <FetchedTags :item="row.item" />
</div> </div>
</QTd> </QTd>
</template> </template>

View File

@ -31,7 +31,6 @@ const actions = {
try { try {
const { data } = await axios.post(`Tickets/cloneAll`, { const { data } = await axios.post(`Tickets/cloneAll`, {
shipped: ticket.value.shipped,
ticketsIds: [ticket.value.id], ticketsIds: [ticket.value.id],
withWarehouse: true, withWarehouse: true,
negative: false, negative: false,

View File

@ -656,7 +656,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<div class="column"> <div class="column">
<span>{{ row.concept }}</span> <span>{{ row.concept }}</span>
<span class="color-vn-label">{{ row.item?.subName }}</span> <span class="color-vn-label">{{ row.item?.subName }}</span>
<FetchedTags v-if="row.item" :item="row.item" :max-length="6" /> <FetchedTags v-if="row.item" :item="row.item" />
<QPopupProxy v-if="row.id && isTicketEditable"> <QPopupProxy v-if="row.id && isTicketEditable">
<VnInput v-model="row.concept" @change="updateConcept(row)" /> <VnInput v-model="row.concept" @change="updateConcept(row)" />
</QPopupProxy> </QPopupProxy>

View File

@ -131,7 +131,11 @@ const createClaim = () => {
onCreateClaimAccepted onCreateClaimAccepted
); );
else else
openConfirmationModal(t('Do you want to create a claim?'), onCreateClaimAccepted); openConfirmationModal(
t('Do you want to create a claim?'),
false,
onCreateClaimAccepted
);
}; };
const onCreateClaimAccepted = async () => { const onCreateClaimAccepted = async () => {

View File

@ -412,7 +412,7 @@ const qCheckBoxController = (sale, action) => {
<span v-if="row.subName" class="color-vn-label"> <span v-if="row.subName" class="color-vn-label">
{{ row.subName }} {{ row.subName }}
</span> </span>
<FetchedTags :item="row" :max-length="6" tag="value" /> <FetchedTags :item="row" tag="value" />
</div> </div>
</QTd> </QTd>
</template> </template>

View File

@ -403,7 +403,6 @@ async function changeState(value) {
<FetchedTags <FetchedTags
class="fetched-tags" class="fetched-tags"
:item="props.row.item" :item="props.row.item"
:max-length="5"
></FetchedTags> ></FetchedTags>
</QTd> </QTd>
<QTd>{{ props.row.price }} </QTd> <QTd>{{ props.row.price }} </QTd>

View File

@ -145,7 +145,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<div class="column"> <div class="column">
<span>{{ row.item.name }}</span> <span>{{ row.item.name }}</span>
<span class="color-vn-label">{{ row.item.subName }}</span> <span class="color-vn-label">{{ row.item.subName }}</span>
<FetchedTags :item="row.item" :max-length="6" /> <FetchedTags :item="row.item" />
</div> </div>
</QTd> </QTd>
</template> </template>

View File

@ -10,6 +10,7 @@ import { computed } from 'vue';
import TravelSummary from './Card/TravelSummary.vue'; import TravelSummary from './Card/TravelSummary.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
@ -46,14 +47,12 @@ const columns = computed(() => [
name: 'id', name: 'id',
label: t('travel.travelList.tableVisibleColumns.id'), label: t('travel.travelList.tableVisibleColumns.id'),
isId: true, isId: true,
field: 'id',
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
name: 'ref', name: 'ref',
label: t('travel.travelList.tableVisibleColumns.ref'), label: t('travel.travelList.tableVisibleColumns.ref'),
field: 'ref',
component: 'input', component: 'input',
columnField: { columnField: {
component: null, component: null,
@ -65,7 +64,6 @@ const columns = computed(() => [
align: 'left', align: 'left',
name: 'agencyModeFk', name: 'agencyModeFk',
label: t('travel.travelList.tableVisibleColumns.agency'), label: t('travel.travelList.tableVisibleColumns.agency'),
field: 'agencyModeFk',
component: 'select', component: 'select',
attrs: { attrs: {
url: 'agencyModes', url: 'agencyModes',
@ -78,37 +76,10 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{
align: 'left',
name: 'shipped',
label: t('travel.travelList.tableVisibleColumns.shipped'),
field: 'shipped',
component: 'date',
columnField: {
component: null,
},
cardVisible: true,
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.shipped)),
},
{
align: 'left',
name: 'landed',
label: t('travel.travelList.tableVisibleColumns.landed'),
field: 'landed',
component: 'date',
columnField: {
component: null,
},
cardVisible: true,
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)),
},
{ {
align: 'left', align: 'left',
name: 'warehouseInFk', name: 'warehouseInFk',
label: t('travel.travelList.tableVisibleColumns.warehouseIn'), label: t('travel.travelList.tableVisibleColumns.warehouseIn'),
field: 'warehouseInFk',
component: 'select', component: 'select',
attrs: { attrs: {
url: 'warehouses', url: 'warehouses',
@ -123,11 +94,28 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{
align: 'left',
name: 'shipped',
label: t('travel.travelList.tableVisibleColumns.shipped'),
component: 'date',
columnField: {
component: null,
},
cardVisible: true,
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.shipped)),
},
{
align: 'left',
name: 'shipmentHour',
label: t('travel.travelList.tableVisibleColumns.shipHour'),
cardVisible: true,
},
{ {
align: 'left', align: 'left',
name: 'warehouseOutFk', name: 'warehouseOutFk',
label: t('travel.travelList.tableVisibleColumns.warehouseOut'), label: t('travel.travelList.tableVisibleColumns.warehouseOut'),
field: 'warehouseOutFk',
component: 'select', component: 'select',
attrs: { attrs: {
url: 'warehouses', url: 'warehouses',
@ -140,12 +128,30 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
{
align: 'left',
name: 'landed',
label: t('travel.travelList.tableVisibleColumns.landed'),
component: 'date',
columnField: {
component: null,
},
cardVisible: true,
create: true,
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)),
},
{
align: 'left',
name: 'landingHour',
label: t('travel.travelList.tableVisibleColumns.landHour'),
cardVisible: true,
},
{ {
align: 'left', align: 'left',
name: 'totalEntries', name: 'totalEntries',
label: t('travel.travelList.tableVisibleColumns.totalEntries'), label: t('travel.travelList.tableVisibleColumns.totalEntries'),
field: 'totalEntries',
component: 'input', component: 'input',
toolTip: t('travel.travelList.tableVisibleColumns.totalEntriesTooltip'),
columnField: { columnField: {
component: null, component: null,
}, },
@ -165,13 +171,15 @@ const columns = computed(() => [
}, },
{ {
title: t('Add entry'), title: t('Add entry'),
icon: 'contact_support', icon: 'vn:ticket',
action: redirectCreateEntryView, action: redirectCreateEntryView,
isPrimary: true,
}, },
{ {
title: t('View Summary'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, TravelSummary), action: (row) => viewSummary(row.id, TravelSummary),
isPrimary: true,
}, },
], ],
}, },
@ -202,12 +210,43 @@ const columns = computed(() => [
redirect="travel" redirect="travel"
:is-editable="false" :is-editable="false"
:use-model="true" :use-model="true"
/> >
<template #column-shipped="{ row }">
<QBadge
text-color="black"
v-if="getDateQBadgeColor(row.shipped)"
:color="getDateQBadgeColor(row.shipped)"
>
{{ toDate(row.shipped) }}
</QBadge>
<span v-else>{{ toDate(row.shipped) }}</span>
<QIcon
name="flight_takeoff"
size="sm"
:class="{ 'is-active': row.isDelivered }"
/>
</template>
<template #column-landed="{ row }">
<QBadge
text-color="black"
v-if="getDateQBadgeColor(row.landed)"
:color="getDateQBadgeColor(row.landed)"
>
{{ toDate(row.landed) }}
</QBadge>
<span v-else>{{ toDate(row.landed) }}</span>
<QIcon
name="flight_land"
size="sm"
:class="{ 'is-active': row.isReceived }"
/>
</template>
</VnTable>
</template> </template>
<i18n> <i18n>
en: en:
addEntry: Add entry Add entry: Add entry
searchByIdOrReference: Search by ID or reference searchByIdOrReference: Search by ID or reference
es: es:
@ -215,4 +254,12 @@ es:
searchByIdOrReference: Buscar por ID o por referencia searchByIdOrReference: Buscar por ID o por referencia
You can search by travel id or name: Buscar por envio por id o nombre You can search by travel id or name: Buscar por envio por id o nombre
Search travel: Buscar envio Search travel: Buscar envio
Clone: Clonar
Add entry: Añadir Entrada
</i18n> </i18n>
<style lang="scss" scoped>
.is-active {
color: #c8e484;
}
</style>

View File

@ -0,0 +1,91 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnTable from 'components/VnTable/VnTable.vue';
const tableRef = ref();
const { t } = useI18n();
const route = useRoute();
const entityId = computed(() => route.params.id);
const columns = [
{
align: 'left',
name: 'date',
label: t('worker.medical.tableVisibleColumns.date'),
create: true,
component: 'date',
},
{
align: 'left',
name: 'time',
label: t('worker.medical.tableVisibleColumns.time'),
create: true,
component: 'time',
attrs: {
timeOnly: true,
},
},
{
align: 'left',
name: 'centerFk',
label: t('worker.medical.tableVisibleColumns.center'),
create: true,
component: 'select',
attrs: {
url: 'medicalCenters',
fields: ['id', 'name'],
},
},
{
align: 'left',
name: 'invoice',
label: t('worker.medical.tableVisibleColumns.invoice'),
create: true,
component: 'input',
},
{
align: 'left',
name: 'amount',
label: t('worker.medical.tableVisibleColumns.amount'),
create: true,
component: 'input',
},
{
align: 'left',
name: 'isFit',
label: t('worker.medical.tableVisibleColumns.isFit'),
create: true,
component: 'checkbox',
},
{
align: 'left',
name: 'remark',
label: t('worker.medical.tableVisibleColumns.remark'),
create: true,
component: 'input',
},
];
</script>
<template>
<VnTable
ref="tableRef"
data-key="WorkerMedical"
:url="`Workers/${entityId}/medicalReview`"
save-url="MedicalReviews/crud"
:create="{
urlCreate: 'medicalReviews',
title: t('Create medicalReview'),
onDataSaved: () => tableRef.reload(),
formInitialData: {
workerFk: entityId,
},
}"
order="date DESC"
:columns="columns"
auto-load
:right-search="false"
:is-editable="true"
:use-model="true"
/>
</template>

View File

@ -10,7 +10,6 @@ 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';
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue'; import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
const route = useRoute(); const route = useRoute();

View File

@ -77,7 +77,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('InvoiceOutSummary'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, WorkerSummary), action: (row) => viewSummary(row.id, WorkerSummary),
}, },

View File

@ -83,6 +83,7 @@ const agencyOptions = ref([]);
:label="t('Price')" :label="t('Price')"
type="number" type="number"
min="0" min="0"
required="true"
clearable clearable
/> />
<VnInput <VnInput
@ -95,7 +96,12 @@ const agencyOptions = ref([]);
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnInput v-model="data.inflation" :label="t('Inflation')" clearable /> <VnInput
v-model="data.inflation"
:label="t('Inflation')"
type="number"
clearable
/>
<QCheckbox <QCheckbox
v-model="data.isVolumetric" v-model="data.isVolumetric"
:label="t('Volumetric')" :label="t('Volumetric')"

View File

@ -2,36 +2,37 @@
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'; import ZoneFilterPanel from '../ZoneFilterPanel.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const routeName = computed(() => route.name); const routeName = computed(() => route.name);
const searchBarDataKeys = {
ZoneWarehouses: 'ZoneWarehouses', function notIsLocations(ifIsFalse, ifIsTrue) {
ZoneSummary: 'ZoneSummary', if (routeName.value != 'ZoneLocations') return ifIsFalse;
ZoneLocations: 'ZoneLocations', return ifIsTrue;
ZoneEvents: 'ZoneEvents', }
};
</script> </script>
<template> <template>
<VnCard <VnCard
data-key="Zone" data-key="zone"
base-url="Zones"
:descriptor="ZoneDescriptor" :descriptor="ZoneDescriptor"
:search-data-key="searchBarDataKeys[routeName]"
:filter-panel="ZoneFilterPanel" :filter-panel="ZoneFilterPanel"
:search-data-key="notIsLocations('ZoneList', 'ZoneLocations')"
:searchbar-props="{ :searchbar-props="{
url: 'Zones', url: 'Zones',
label: t('list.searchZone'), label: notIsLocations(t('list.searchZone'), t('list.searchLocation')),
info: t('list.searchInfo'), info: t('list.searchInfo'),
whereFilter: notIsLocations((value) => {
return /^\d+$/.test(value)
? { id: value }
: { name: { like: `%${value}%` } };
}),
}" }"
> />
<template #searchbar>
<ZoneSearchbar />
</template>
</VnCard>
</template> </template>

View File

@ -8,13 +8,6 @@ import VnConfirm from 'components/ui/VnConfirm.vue';
import axios from 'axios'; import axios from 'axios';
const $props = defineProps({
zone: {
type: Object,
default: () => {},
},
});
const { t } = useI18n(); const { t } = useI18n();
const { push, currentRoute } = useRouter(); const { push, currentRoute } = useRouter();
const zoneId = currentRoute.value.params.id; const zoneId = currentRoute.value.params.id;
@ -22,32 +15,21 @@ const zoneId = currentRoute.value.params.id;
const actions = { const actions = {
clone: async () => { clone: async () => {
const opts = { message: t('Zone cloned'), type: 'positive' }; const opts = { message: t('Zone cloned'), type: 'positive' };
let clonedZoneId;
try { try {
const { data } = await axios.post(`Zones/${zoneId}/clone`, { const { data } = await axios.post(`Zones/${zoneId}/clone`, {});
shipped: $props.zone.value.shipped, notify(opts);
}); push(`/zone/${data.id}/basic-data`);
clonedZoneId = data;
} catch (e) { } catch (e) {
opts.message = t('It was not able to clone the zone'); opts.message = t('It was not able to clone the zone');
opts.type = 'negative'; opts.type = 'negative';
} finally {
notify(opts);
if (clonedZoneId) push({ name: 'ZoneSummary', params: { id: clonedZoneId } });
} }
}, },
remove: async () => { remove: async () => {
try { try {
await axios.post(`Zones/${zoneId}/setDeleted`); await axios.post(`Zones/${zoneId}/deleteZone`);
notify({ message: t('Zone deleted'), type: 'positive' }); notify({ message: t('Zone deleted'), type: 'positive' });
notify({
message: t('You can undo this action within the first hour'),
icon: 'info',
});
push({ name: 'ZoneList' }); push({ name: 'ZoneList' });
} catch (e) { } catch (e) {
notify({ message: e.message, type: 'negative' }); notify({ message: e.message, type: 'negative' });
@ -64,30 +46,31 @@ function openConfirmDialog(callback) {
} }
</script> </script>
<template> <template>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
<QItemSection avatar>
<QIcon name="content_copy" />
</QItemSection>
<QItemSection>{{ t('To clone zone') }}</QItemSection>
</QItem>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable> <QItem @click="openConfirmDialog('remove')" v-ripple clickable>
<QItemSection avatar> <QItemSection avatar>
<QIcon name="delete" /> <QIcon name="delete" />
</QItemSection> </QItemSection>
<QItemSection>{{ t('deleteZone') }}</QItemSection> <QItemSection>{{ t('deleteZone') }}</QItemSection>
</QItem> </QItem>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
<QItemSection avatar>
<QIcon name="content_copy" />
</QItemSection>
<QItemSection>{{ t('cloneZone') }}</QItemSection>
</QItem>
</template> </template>
<i18n> <i18n>
en: en:
deleteZone: Delete zone deleteZone: Delete
cloneZone: Clone
confirmDeletion: Confirm deletion confirmDeletion: Confirm deletion
confirmDeletionMessage: Are you sure you want to delete this zone? confirmDeletionMessage: Are you sure you want to delete this zone?
es: es:
To clone zone: Clonar zone cloneZone: Clonar
deleteZone: Eliminar zona deleteZone: Eliminar
confirmDeletion: Confirmar eliminación confirmDeletion: Confirmar eliminación
confirmDeletionMessage: Seguro que quieres eliminar este zona? confirmDeletionMessage: Seguro que quieres eliminar este zona?
Zone deleted: Zona eliminada
</i18n> </i18n>

View File

@ -58,20 +58,12 @@ const arrayData = useArrayData('ZoneEvents');
const exclusionGeoCreate = async () => { const exclusionGeoCreate = async () => {
try { try {
if (isNew.value) { const params = {
const params = { zoneFk: parseInt(route.params.id),
zoneFk: parseInt(route.params.id), date: dated.value,
date: dated.value, geoIds: tickedNodes.value,
geoIds: tickedNodes.value, };
}; await axios.post('Zones/exclusionGeo', params);
await axios.post('Zones/exclusionGeo', params);
} else {
const params = {
zoneExclusionFk: props.event?.zoneExclusionFk,
geoIds: tickedNodes.value,
};
await axios.post('Zones/updateExclusionGeo', params);
}
await refetchEvents(); await refetchEvents();
} catch (err) { } catch (err) {
console.error('Error creating exclusion geo: ', err); console.error('Error creating exclusion geo: ', err);
@ -85,7 +77,7 @@ const exclusionCreate = async () => {
{ dated: dated.value }, { dated: dated.value },
]); ]);
else else
await axios.put(`Zones/${route.params.id}/exclusions/${props.event?.id}`, { await axios.post(`Zones/${route.params.id}/exclusions`, {
dated: dated.value, dated: dated.value,
}); });
@ -103,8 +95,7 @@ const onSubmit = async () => {
const deleteEvent = async () => { const deleteEvent = async () => {
try { try {
if (!props.event) return; if (!props.event) return;
const exclusionId = props.event?.zoneExclusionFk || props.event?.id; await axios.delete(`Zones/${route.params.id}/exclusions`);
await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
await refetchEvents(); await refetchEvents();
} catch (err) { } catch (err) {
console.error('Error deleting event: ', err); console.error('Error deleting event: ', err);
@ -141,7 +132,11 @@ onMounted(() => {
> >
<template #form-inputs> <template #form-inputs>
<VnRow class="row q-gutter-md q-mb-lg"> <VnRow class="row q-gutter-md q-mb-lg">
<VnInputDate :label="t('eventsInclusionForm.day')" v-model="dated" /> <VnInputDate
:label="t('eventsInclusionForm.day')"
v-model="dated"
:model-value="props.date"
/>
</VnRow> </VnRow>
<div class="column q-gutter-y-sm q-mb-md"> <div class="column q-gutter-y-sm q-mb-md">
<QRadio <QRadio

View File

@ -13,8 +13,8 @@ import { reactive } from 'vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const firstDay = ref(null); const firstDay = ref();
const lastDay = ref(null); const lastDay = ref();
const events = ref([]); const events = ref([]);
const formModeName = ref('include'); const formModeName = ref('include');
@ -44,34 +44,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>
<template v-if="stateStore.isHeaderMounted()"> <Teleport to="#right-panel" v-if="useStateStore().isHeaderMounted()">
<Teleport to="#actions-append"> <ZoneEventsPanel
<div class="row q-gutter-x-sm"> :first-day="firstDay"
<QBtn :last-day="lastDay"
flat :events="events"
@click="stateStore.toggleRightDrawer()" v-model:formModeName="formModeName"
round @open-zone-form="openForm"
dense />
icon="menu" </Teleport>
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
</template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<ZoneEventsPanel
:first-day="firstDay"
:last-day="lastDay"
:events="events"
v-model:formModeName="formModeName"
@open-zone-form="openForm"
/>
</QScrollArea>
</QDrawer>
<QPage class="q-pa-md flex justify-center"> <QPage class="q-pa-md flex justify-center">
<ZoneCalendarGrid <ZoneCalendarGrid
v-model:events="events" v-model:events="events"

View File

@ -1,10 +1,7 @@
<script setup> <script setup>
import { onMounted, ref, computed, watch, onUnmounted } from 'vue'; import { onMounted, ref, computed, watch, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios'; import axios from 'axios';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
@ -30,7 +27,6 @@ const props = defineProps({
const emit = defineEmits(['update:tickedNodes']); const emit = defineEmits(['update:tickedNodes']);
const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const state = useState(); const state = useState();
@ -186,16 +182,6 @@ onUnmounted(() => {
</script> </script>
<template> <template>
<VnInput
v-if="showSearchBar"
v-model="store.userParams.search"
:placeholder="t('globals.search')"
@keydown.enter.prevent="reFetch()"
>
<template #prepend>
<QIcon class="cursor-pointer" name="search" />
</template>
</VnInput>
<QTree <QTree
ref="treeRef" ref="treeRef"
:nodes="nodes" :nodes="nodes"

View File

@ -19,24 +19,14 @@ const exprBuilder = (param, value) => {
agencyModeFk: value, agencyModeFk: value,
}; };
case 'search': case 'search':
if (value) { return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
if (!isNaN(value)) {
return { id: value };
} else {
return {
name: {
like: `%${value}%`,
},
};
}
}
} }
}; };
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
data-key="ZoneList" data-key="Zones"
url="Zones" url="Zones"
:filter="{ :filter="{
include: { relation: 'agencyMode', scope: { fields: ['name'] } }, include: { relation: 'agencyMode', scope: { fields: ['name'] } },

View File

@ -14,7 +14,7 @@ const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const paginateRef = ref(null); const paginateRef = ref();
const createWarehouseDialogRef = ref(null); const createWarehouseDialogRef = ref(null);
const arrayData = useArrayData('ZoneWarehouses'); const arrayData = useArrayData('ZoneWarehouses');

View File

@ -1,47 +1,25 @@
<script setup> <script setup>
import { onMounted, ref, reactive } from 'vue'; import { onMounted, ref, reactive, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { watch } from 'vue'; import FetchData from 'src/components/FetchData.vue';
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const { notify } = useNotify();
const deliveryMethodFk = ref(null); const deliveryMethodFk = ref('delivery');
const deliveryMethods = ref([]); const deliveryMethods = ref({});
const inq = ref([]);
const formData = reactive({}); const formData = reactive({});
const arrayData = useArrayData('ZoneDeliveryDays', { const arrayData = useArrayData('ZoneDeliveryDays', {
url: 'Zones/getEvents', url: 'Zones/getEvents',
}); });
const fetchDeliveryMethods = async (filter) => { const deliveryMethodsConfig = { pickUp: ['PICKUP'], delivery: ['AGENCY', 'DELIVERY'] };
try {
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get('DeliveryMethods', { params });
return data.map((deliveryMethod) => deliveryMethod.id);
} catch (err) {
console.error('Error fetching delivery methods: ', err);
}
};
watch(
() => deliveryMethodFk.value,
async (val) => {
let filter;
if (val === 'pickUp') filter = { where: { code: 'PICKUP' } };
else filter = { where: { code: { inq: ['DELIVERY', 'AGENCY'] } } };
deliveryMethods.value = await fetchDeliveryMethods(filter);
},
{ immediate: true }
);
const fetchData = async (params) => { const fetchData = async (params) => {
try { try {
const { data } = params const { data } = params
@ -62,14 +40,38 @@ const onSubmit = async () => {
}; };
onMounted(async () => { onMounted(async () => {
deliveryMethodFk.value = 'delivery';
formData.geoFk = arrayData.store?.userParams?.geoFk; formData.geoFk = arrayData.store?.userParams?.geoFk;
formData.agencyModeFk = arrayData.store?.userParams?.agencyModeFk; formData.agencyModeFk = arrayData.store?.userParams?.agencyModeFk;
if (formData.geoFk || formData.agencyModeFk) await fetchData(); if (formData.geoFk || formData.agencyModeFk) await fetchData();
}); });
watch(
() => deliveryMethodFk.value,
() => {
inq.value = {
deliveryMethodFk: { inq: deliveryMethods.value[deliveryMethodFk.value] },
};
}
);
</script> </script>
<template> <template>
<FetchData
url="DeliveryMethods"
:fields="['id', 'name', 'deliveryMethodFk']"
@on-fetch="
(data) => {
Object.entries(deliveryMethodsConfig).forEach(([key, value]) => {
deliveryMethods[key] = data
.filter((code) => value.includes(code.code))
.map((method) => method.id);
});
inq = {
deliveryMethodFk: { inq: deliveryMethods[deliveryMethodFk] },
};
}
"
auto-load
/>
<QForm @submit="onSubmit()" class="q-pa-md"> <QForm @submit="onSubmit()" class="q-pa-md">
<div class="column q-gutter-y-sm"> <div class="column q-gutter-y-sm">
<QRadio <QRadio
@ -90,7 +92,7 @@ onMounted(async () => {
:label="t('deliveryPanel.postcode')" :label="t('deliveryPanel.postcode')"
v-model="formData.geoFk" v-model="formData.geoFk"
url="Postcodes/location" url="Postcodes/location"
:fields="['geoFk', 'code', 'townFk']" :fields="['geoFk', 'code', 'townFk', 'countryFk']"
sort-by="code, townFk" sort-by="code, townFk"
option-value="geoFk" option-value="geoFk"
option-label="code" option-label="code"
@ -106,26 +108,35 @@ onMounted(async () => {
<QItemLabel>{{ opt.code }}</QItemLabel> <QItemLabel>{{ opt.code }}</QItemLabel>
<QItemLabel caption <QItemLabel caption
>{{ opt.town?.province?.name }}, >{{ opt.town?.province?.name }},
{{ opt.town?.province?.country?.country }}</QItemLabel {{ opt.town?.province?.country?.name }}</QItemLabel
> >
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>
</VnSelect> </VnSelect>
<VnSelect <VnSelect
:label=" data-key="delivery"
t( v-if="deliveryMethodFk == 'delivery'"
deliveryMethodFk === 'delivery' :label="t('deliveryPanel.agency')"
? 'deliveryPanel.agency'
: 'deliveryPanel.warehouse'
)
"
v-model="formData.agencyModeFk" v-model="formData.agencyModeFk"
url="AgencyModes/isActive" url="AgencyModes/isActive"
:fields="['id', 'name']" :fields="['id', 'name']"
:where="{ :where="inq"
deliveryMethodFk: { inq: deliveryMethods }, sort-by="name ASC"
}" option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/>
<VnSelect
v-else
:label="t('deliveryPanel.warehouse')"
v-model="formData.agencyModeFk"
url="AgencyModes/isActive"
:fields="['id', 'name']"
:where="inq"
sort-by="name ASC" sort-by="name ASC"
option-value="id" option-value="id"
option-label="name" option-label="name"

View File

@ -27,6 +27,7 @@ const agencies = ref([]);
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
:hidden-tags="['search']" :hidden-tags="['search']"
search-url="table"
> >
<template #tags="{ tag }"> <template #tags="{ tag }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">

View File

@ -1,74 +1,120 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { onMounted, computed } from 'vue'; import { computed, ref, onMounted } from 'vue';
import axios from 'axios';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toTimeFormat } from 'src/filters/date'; import { toTimeFormat } from 'src/filters/date';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import axios from 'axios'; import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputTime from 'src/components/common/VnInputTime.vue';
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'; import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const router = useRouter(); const router = useRouter();
const { notify } = useNotify(); const { notify } = useNotify();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const stateStore = useStateStore();
const tableRef = ref();
const warehouseOptions = ref([]);
const redirectToZoneSummary = (event, { id }) => { const tableFilter = {
router.push({ name: 'ZoneSummary', params: { id } }); include: [
{
relation: 'agencyMode',
scope: {
fields: ['id', 'name'],
},
},
],
}; };
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'ID',
label: t('list.id'),
field: (row) => row.id,
sortable: true,
align: 'left', align: 'left',
name: 'id',
label: t('list.id'),
chip: {
condition: () => true,
},
isId: true,
columnFilter: {
inWhere: true,
},
}, },
{ {
align: 'left',
name: 'name', name: 'name',
label: t('list.name'), label: t('list.name'),
field: (row) => row.name, isTitle: true,
sortable: true, create: true,
align: 'left', columnFilter: {
optionLabel: 'name',
optionValue: 'id',
},
}, },
{ {
name: 'agency', align: 'left',
name: 'agencyModeFk',
label: t('list.agency'), label: t('list.agency'),
field: (row) => row?.agencyMode?.name, cardVisible: true,
sortable: true, columnFilter: {
align: 'left', component: 'select',
inWhere: true,
attrs: {
url: 'AgencyModes',
},
},
columnField: {
component: null,
},
format: (row, dashIfEmpty) => dashIfEmpty(row?.agencyMode?.name),
}, },
{ {
name: 'close',
label: t('list.close'),
field: (row) => (row?.hour ? toTimeFormat(row?.hour) : '-'),
sortable: true,
align: 'left', align: 'left',
},
{
name: 'price', name: 'price',
label: t('list.price'), label: t('list.price'),
field: (row) => (row?.price ? toCurrency(row.price) : '-'), cardVisible: true,
sortable: true, format: (row) => toCurrency(row.price),
align: 'left', columnFilter: {
inWhere: true,
},
},
{
align: 'left',
name: 'hour',
label: t('list.close'),
cardVisible: true,
format: (row) => toTimeFormat(row.hour),
hidden: true,
}, },
{ {
name: 'actions',
label: '',
sortable: false,
align: 'right', align: 'right',
name: 'tableActions',
actions: [
{
title: t('list.zoneSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ZoneSummary),
isPrimary: true,
},
{
title: t('globals.clone'),
icon: 'vn:clone',
action: (row) => handleClone(row.id),
isPrimary: true,
},
],
}, },
]); ]);
@ -84,6 +130,7 @@ const handleClone = (id) => {
() => clone(id) () => clone(id)
); );
}; };
onMounted(() => (stateStore.rightDrawer = true)); onMounted(() => (stateStore.rightDrawer = true));
</script> </script>
@ -91,82 +138,72 @@ onMounted(() => (stateStore.rightDrawer = true));
<ZoneSearchbar /> <ZoneSearchbar />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ZoneFilterPanel data-key="ZoneList" :expr-builder="exprBuilder" /> <ZoneFilterPanel data-key="Zones" />
</template> </template>
</RightMenu> </RightMenu>
<QPage class="column items-center q-pa-md"> <VnTable
<div class="vn-card-list"> ref="tableRef"
<VnPaginate data-key="Zones"
data-key="ZoneList" url="Zones"
url="Zones" :create="{
:filter="{ urlCreate: 'Zones',
include: { relation: 'agencyMode', scope: { fields: ['name'] } }, title: t('list.createZone'),
}" onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
:limit="20" formInitialData: {},
auto-load }"
> :user-filter="tableFilter"
<template #body="{ rows }"> :columns="columns"
<div class="q-pa-md"> redirect="zone"
<QTable :right-search="false"
:rows="rows" auto-load
:columns="columns" >
row-key="clientId" <template #more-create-dialog="{ data }">
class="full-width" <VnSelect
@row-click="redirectToZoneSummary" url="AgencyModes"
> v-model="data.agencyModeFk"
<template #header="props"> option-value="id"
<QTr :props="props" class="bg"> option-label="name"
<QTh :label="t('list.agency')"
v-for="col in props.cols" />
:key="col.name" <VnInput
:props="props" v-model="data.price"
> :label="t('list.price')"
{{ t(col.label) }} min="0"
<QTooltip v-if="col.tooltip">{{ type="number"
col.tooltip required="true"
}}</QTooltip> />
</QTh> <VnInput
</QTr> v-model="data.bonus"
</template> :label="t('list.bonus')"
min="0"
<template #body-cell="props"> type="number"
<QTd :props="props"> />
<QTr :props="props" class="cursor-pointer"> <VnInput
{{ props.value }} v-model="data.travelingDays"
</QTr> :label="t('list.travelingDays')"
</QTd> type="number"
</template> min="0"
<template #body-cell-actions="props"> />
<QTd :props="props" class="q-gutter-x-sm"> <VnInputTime v-model="data.hour" :label="t('list.close')" />
<QIcon <VnSelect
name="vn:clone" url="Warehouses"
size="sm" v-model="data.warehouseFK"
color="primary" option-value="id"
@click.stop="handleClone(props.row.id)" option-label="name"
> :label="t('list.warehouse')"
<QTooltip>{{ t('globals.clone') }}</QTooltip> :options="warehouseOptions"
</QIcon> />
<QIcon <QCheckbox
name="preview" v-model="data.isVolumetric"
size="sm" :label="t('list.isVolumetric')"
color="primary" :toggle-indeterminate="false"
@click.stop=" />
viewSummary(props.row.id, ZoneSummary) </template>
" </VnTable>
>
<QTooltip>{{ t('Preview') }}</QTooltip>
</QIcon>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</div>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn :to="{ path: `/zone/create` }" fab icon="add" color="primary">
<QTooltip>{{ t('list.create') }}</QTooltip>
</QBtn>
</QPageSticky>
</QPage>
</template> </template>
<i18n>
es:
Search zone: Buscar zona
You can search zones by id or name: Puedes buscar zonas por id o nombre
</i18n>

View File

@ -18,9 +18,16 @@ list:
create: Create zone create: Create zone
openSummary: Details openSummary: Details
searchZone: Search zones searchZone: Search zones
searchLocation: Search locations
searchInfo: Search zone by id or name searchInfo: Search zone by id or name
confirmCloneTitle: All it's properties will be copied confirmCloneTitle: All it's properties will be copied
confirmCloneSubtitle: Do you want to clone this zone? confirmCloneSubtitle: Do you want to clone this zone?
travelingDays: Traveling days
warehouse: Warehouse
bonus: Bonus
isVolumetric: Volumetric
createZone: Create zone
zoneSummary: Summary
create: create:
name: Name name: Name
warehouse: Warehouse warehouse: Warehouse
@ -30,6 +37,8 @@ create:
price: Price price: Price
bonus: Bonus bonus: Bonus
volumetric: Volumetric volumetric: Volumetric
itemMaxSize: Max m³
inflation: Inflation
summary: summary:
agency: Agency agency: Agency
price: Price price: Price

View File

@ -18,9 +18,16 @@ list:
create: Crear zona create: Crear zona
openSummary: Detalles openSummary: Detalles
searchZone: Buscar zonas searchZone: Buscar zonas
searchLocation: Buscar localizaciones
searchInfo: Buscar zonas por identificador o nombre searchInfo: Buscar zonas por identificador o nombre
confirmCloneTitle: Todas sus propiedades serán copiadas confirmCloneTitle: Todas sus propiedades serán copiadas
confirmCloneSubtitle: ¿Seguro que quieres clonar esta zona? confirmCloneSubtitle: ¿Seguro que quieres clonar esta zona?
travelingDays: Días de viaje
warehouse: Almacén
bonus: Bonus
isVolumetric: Volumétrico
createZone: Crear zona
zoneSummary: Resumen
create: create:
name: Nombre name: Nombre
warehouse: Almacén warehouse: Almacén
@ -30,6 +37,8 @@ create:
price: Precio price: Precio
bonus: Bonificación bonus: Bonificación
volumetric: Volumétrico volumetric: Volumétrico
itemMaxSize: Medida máxima
inflation: Inflación
summary: summary:
agency: Agencia agency: Agencia
price: Precio price: Precio

View File

@ -11,7 +11,7 @@ export default {
component: RouterView, component: RouterView,
redirect: { name: 'MonitorMain' }, redirect: { name: 'MonitorMain' },
menus: { menus: {
main: ['MonitorList'], main: ['MonitorTickets', 'MonitorClientsActions'],
card: [], card: [],
}, },
children: [ children: [
@ -19,16 +19,27 @@ export default {
path: '', path: '',
name: 'MonitorMain', name: 'MonitorMain',
component: () => import('src/components/common/VnSectionMain.vue'), component: () => import('src/components/common/VnSectionMain.vue'),
redirect: { name: 'MonitorList' }, redirect: { name: 'MonitorTickets' },
children: [ children: [
{ {
path: 'list', path: 'tickets',
name: 'MonitorList', name: 'MonitorTickets',
meta: { meta: {
title: 'list', title: 'ticketsMonitor',
icon: 'grid_view', icon: 'vn:ticket',
}, },
component: () => import('src/pages/Monitor/MonitorList.vue'), component: () =>
import('src/pages/Monitor/Ticket/MonitorTickets.vue'),
},
{
path: 'clients-actions',
name: 'MonitorClientsActions',
meta: {
title: 'clientsActionsMonitor',
icon: 'vn:client',
},
component: () =>
import('src/pages/Monitor/MonitorClientsActions.vue'),
}, },
], ],
}, },

View File

@ -7,6 +7,7 @@ export default {
title: 'routes', title: 'routes',
icon: 'vn:delivery', icon: 'vn:delivery',
moduleName: 'Route', moduleName: 'Route',
keyBinding: 'r',
}, },
component: RouterView, component: RouterView,
redirect: { name: 'RouteMain' }, redirect: { name: 'RouteMain' },

View File

@ -25,6 +25,7 @@ export default {
'WorkerLocker', 'WorkerLocker',
'WorkerBalance', 'WorkerBalance',
'WorkerFormation', 'WorkerFormation',
'WorkerMedical',
], ],
}, },
children: [ children: [
@ -196,6 +197,15 @@ export default {
}, },
component: () => import('src/pages/Worker/Card/WorkerFormation.vue'), component: () => import('src/pages/Worker/Card/WorkerFormation.vue'),
}, },
{
name: 'WorkerMedical',
path: 'medical',
meta: {
title: 'medical',
icon: 'medical_information',
},
component: () => import('src/pages/Worker/Card/WorkerMedical.vue'),
},
], ],
}, },
], ],

View File

@ -50,33 +50,6 @@ export default {
}, },
component: () => import('src/pages/Zone/ZoneDeliveryDays.vue'), component: () => import('src/pages/Zone/ZoneDeliveryDays.vue'),
}, },
{
path: 'create',
name: 'ZoneCreate',
meta: {
title: 'zoneCreate',
icon: 'create',
},
component: () => import('src/pages/Zone/ZoneCreate.vue'),
},
{
path: ':id/edit',
name: 'ZoneEdit',
meta: {
title: 'zoneEdit',
icon: 'edit',
},
component: () => import('src/pages/Zone/ZoneCreate.vue'),
},
// {
// path: 'counter',
// name: 'ZoneCounter',
// meta: {
// title: 'zoneCounter',
// icon: 'add_circle',
// },
// component: () => import('src/pages/Zone/ZoneCounter.vue'),
// },
{ {
name: 'ZoneUpcomingDeliveries', name: 'ZoneUpcomingDeliveries',
path: 'upcoming-deliveries', path: 'upcoming-deliveries',

View File

@ -0,0 +1,21 @@
describe('ZoneBasicData', () => {
const notification = '.q-notification__message';
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/zone/4/basic-data');
});
it('should throw an error if the name is empty', () => {
cy.get('.q-card > :nth-child(1)').clear();
cy.get('.q-btn-group > .q-btn--standard').click();
cy.get(notification).should('contains.text', "can't be blank");
});
it("should edit the basicData's zone", () => {
cy.get('.q-card > :nth-child(1)').type(' modified');
cy.get('.q-btn-group > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data saved');
});
});

View File

@ -0,0 +1,38 @@
describe('ZoneCreate', () => {
const notification = '.q-notification__message';
const data = {
Name: { val: 'Zone pickup D' },
Price: { val: '3' },
Bonus: { val: '0' },
'Traveling days': { val: '0' },
Warehouse: { val: 'Algemesi', type: 'select' },
Volumetric: { val: 'true', type: 'checkbox' },
};
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/zone/list');
cy.get('.q-page-sticky > div > .q-btn').click();
});
it('should throw an error if an agency has not been selected', () => {
cy.fillInForm({
...data,
});
cy.get('input[aria-label="Close"]').type('10:00');
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Agency cannot be blank');
});
it('should create a zone', () => {
cy.fillInForm({
...data,
Agency: { val: 'inhouse pickup', type: 'select' },
});
cy.get('input[aria-label="Close"]').type('10:00');
cy.get('.q-mt-lg > .q-btn--standard').click();
cy.get(notification).should('contains.text', 'Data created');
});
});

View File

@ -1,15 +1,18 @@
describe('ZoneList', () => { describe('ZoneList', () => {
beforeEach(() => { beforeEach(() => {
cy.viewport(1920, 1080); cy.viewport(1280, 720);
cy.login('developer'); cy.login('developer');
cy.visit(`/#/zone/list`); cy.visit('/#/zone/list');
}); });
it('should open the details', () => { it('should filter by agency', () => {
cy.get(':nth-child(1) > .text-right > .material-symbols-outlined').click(); cy.get(
':nth-child(1) > .column > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('{downArrow}{enter}');
}); });
it('should redirect to summary', () => {
cy.waitForElement('.q-page'); it('should open the zone summary', () => {
cy.get('tbody > :nth-child(1)').click(); cy.get('input[aria-label="Name"]').type('zone refund');
cy.get('.q-scrollarea__content > .q-btn--standard > .q-btn__content').click();
}); });
}); });

Some files were not shown because too many files have changed in this diff Show More