#7283 #7831 itemMigration #553

Merged
carlossa merged 77 commits from 7283-itemMigration into dev 2024-10-25 07:09:13 +00:00
93 changed files with 1330 additions and 646 deletions
Showing only changes of commit dc39dd5a76 - Show all commits

34
src/boot/keyShortcut.js Normal file
View File

@ -0,0 +1,34 @@
export default {
mounted: function (el, binding) {
const shortcut = binding.value ?? '+';
const { key, ctrl, alt, callback } =
typeof shortcut === 'string'
? {
key: shortcut,
ctrl: true,
alt: true,
callback: () =>
document
.querySelector(`button[shortcut="${shortcut}"]`)
?.click(),
}
: binding.value;
const handleKeydown = (event) => {
if (event.key === key && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) {
callback();
}
};
// Attach the event listener to the window
window.addEventListener('keydown', handleKeydown);
el._handleKeydown = handleKeydown;
},
unmounted: function (el) {
if (el._handleKeydown) {
window.removeEventListener('keydown', el._handleKeydown);
}
},
};

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,10 @@
import { boot } from 'quasar/wrappers'; import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin'; import qFormMixin from './qformMixin';
import mainShortcutMixin from './mainShortcutMixin';
import keyShortcut from './keyShortcut';
export default boot(({ app }) => { export default boot(({ app }) => {
app.mixin(qFormMixin); app.mixin(qFormMixin);
app.mixin(mainShortcutMixin);
app.directive('shortcut', keyShortcut);
}); });

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

@ -24,7 +24,13 @@ const pinnedModulesRef = ref();
<template> <template>
<QHeader color="white" elevated> <QHeader color="white" elevated>
<QToolbar class="q-py-sm q-px-md"> <QToolbar class="q-py-sm q-px-md">
<QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat> <QBtn
@click="stateStore.toggleLeftDrawer()"
icon="dock_to_right"
round
dense
flat
>
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}
</QTooltip> </QTooltip>

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

@ -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: [],
@ -607,7 +617,7 @@ defineExpose({
</template> </template>
</CrudModel> </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" shortcut="+" />
<QTooltip> <QTooltip>
{{ createForm.title }} {{ createForm.title }}
</QTooltip> </QTooltip>

View File

@ -37,7 +37,7 @@ const stateStore = useStateStore();
@click="stateStore.toggleRightDrawer()" @click="stateStore.toggleRightDrawer()"
round round
dense dense
icon="menu" icon="dock_to_left"
> >
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}

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

@ -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

@ -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

@ -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(

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

@ -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

@ -253,6 +253,7 @@ input::-webkit-inner-spin-button {
} }
td { td {
font-size: 11pt; font-size: 11pt;
border-top: 1px solid var(--vn-page-color);
border-collapse: collapse; border-collapse: collapse;
} }
} }

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
@ -259,6 +260,7 @@ globals:
ticketsMonitor: Tickets monitor ticketsMonitor: Tickets monitor
clientsActionsMonitor: Clients and actions clientsActionsMonitor: Clients and actions
serial: Serial serial: Serial
medical: Mutual
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now
@ -877,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
@ -956,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:

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
@ -237,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
@ -261,6 +264,7 @@ globals:
ticketsMonitor: Monitor de tickets ticketsMonitor: Monitor de tickets
clientsActionsMonitor: Clientes y acciones 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
@ -878,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
@ -948,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:

View File

@ -5,7 +5,7 @@ const quasar = useQuasar();
</script> </script>
<template> <template>
<QLayout view="hHh LpR fFf"> <QLayout view="hHh LpR fFf" v-shortcut>
<Navbar /> <Navbar />
<RouterView></RouterView> <RouterView></RouterView>
<QFooter v-if="quasar.platform.is.mobile"></QFooter> <QFooter v-if="quasar.platform.is.mobile"></QFooter>

View File

@ -169,7 +169,13 @@ onMounted(async () => await getAccountData(false));
<AccountMailAliasCreateForm @on-submit-create-alias="createMailAlias" /> <AccountMailAliasCreateForm @on-submit-create-alias="createMailAlias" />
</QDialog> </QDialog>
<QPageSticky position="bottom-right" :offset="[18, 18]"> <QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn fab icon="add" color="primary" @click="openCreateMailAliasForm()"> <QBtn
fab
icon="add"
color="primary"
@click="openCreateMailAliasForm()"
shortcut="+"
>
<QTooltip>{{ t('warehouses.add') }}</QTooltip> <QTooltip>{{ t('warehouses.add') }}</QTooltip>
</QBtn> </QBtn>
</QPageSticky> </QPageSticky>

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

@ -218,7 +218,13 @@ const toCustomerAddressEdit = (addressId) => {
</div> </div>
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerAddressCreate()" color="primary" fab icon="add" /> <QBtn
@click.stop="toCustomerAddressCreate()"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip> <QTooltip>
{{ t('New consignee') }} {{ t('New consignee') }}
</QTooltip> </QTooltip>

View File

@ -292,7 +292,13 @@ const showBalancePdf = ({ id }) => {
</template> </template>
</VnTable> </VnTable>
<QPageSticky :offset="[18, 18]" style="z-index: 2"> <QPageSticky :offset="[18, 18]" style="z-index: 2">
<QBtn @click.stop="showNewPaymentDialog()" color="primary" fab icon="add" /> <QBtn
@click.stop="showNewPaymentDialog()"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip> <QTooltip>
{{ t('New payment') }} {{ t('New payment') }}
</QTooltip> </QTooltip>

View File

@ -97,7 +97,12 @@ const title = ref();
:rules="validate('client.salesPersonFk')" :rules="validate('client.salesPersonFk')"
:use-like="false" :use-like="false"
:emit-value="false" :emit-value="false"
@update:model-value="(val) => (title = val?.nickname)" @update:model-value="
(val) => {
title = val?.nickname;
data.salesPersonFk = val?.id;
}
"
> >
<template #prepend> <template #prepend>
<VnAvatar <VnAvatar

View File

@ -193,6 +193,7 @@ const updateData = () => {
color="primary" color="primary"
fab fab
icon="add" icon="add"
shortcut="+"
/> />
<QTooltip> <QTooltip>
{{ t('New contract') }} {{ t('New contract') }}

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

@ -19,8 +19,6 @@ const { t } = useI18n();
const { hasAny } = useRole(); const { hasAny } = useRole();
const isAdministrative = () => hasAny(['administrative']); const isAdministrative = () => hasAny(['administrative']);
const suppliersOptions = ref([]);
const travelsOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const currenciesOptions = ref([]); const currenciesOptions = ref([]);
@ -29,20 +27,6 @@ const onFilterTravelSelected = (formData, id) => {
}; };
</script> </script>
<template> <template>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'nickname'] }"
order="nickname"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData
url="Travels/filter"
:filter="{ fields: ['id', 'warehouseInName'] }"
order="id"
@on-fetch="(data) => (travelsOptions = data)"
auto-load
/>
<FetchData <FetchData
ref="companiesRef" ref="companiesRef"
url="Companies" url="Companies"
@ -71,9 +55,10 @@ const onFilterTravelSelected = (formData, id) => {
<VnSelect <VnSelect
:label="t('entry.basicData.supplier')" :label="t('entry.basicData.supplier')"
v-model="data.supplierFk" v-model="data.supplierFk"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:fields="['id', 'nickname']"
hide-selected hide-selected
:required="true" :required="true"
map-options map-options
@ -92,7 +77,8 @@ const onFilterTravelSelected = (formData, id) => {
<VnSelectDialog <VnSelectDialog
:label="t('entry.basicData.travel')" :label="t('entry.basicData.travel')"
v-model="data.travelFk" v-model="data.travelFk"
:options="travelsOptions" url="Travels/filter"
:fields="['id', 'warehouseInName']"
option-value="id" option-value="id"
option-label="warehouseInName" option-label="warehouseInName"
map-options map-options

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

@ -20,7 +20,6 @@ const props = defineProps({
const currenciesOptions = ref([]); const currenciesOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const suppliersOptions = ref([]);
const stateStore = useStateStore(); const stateStore = useStateStore();
onMounted(async () => { onMounted(async () => {
@ -45,14 +44,6 @@ onMounted(async () => {
@on-fetch="(data) => (currenciesOptions = data)" @on-fetch="(data) => (currenciesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'nickname', 'name'] }"
order="nickname"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -135,9 +126,11 @@ onMounted(async () => {
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
v-model="params.supplierFk" v-model="params.supplierFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="name" option-label="name"
:fields="['id', 'name', 'nickname']"
sort-by="nickname"
hide-selected hide-selected
dense dense
outlined outlined

View File

@ -9,9 +9,6 @@ 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 { useSummaryDialog } from 'src/composables/useSummaryDialog';
import EntrySummary from './Card/EntrySummary.vue'; import EntrySummary from './Card/EntrySummary.vue';
import VnUserLink from 'components/ui/VnUserLink.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue'; import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';

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

@ -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);

View File

@ -13,20 +13,10 @@ import CreateSpecieForm from './CreateSpecieForm.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const itemGenusOptions = ref([]); const itemBotanicalsRef = ref(null);
const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]); const itemBotanicals = ref([]);
let itemBotanicalsForm = reactive({ itemFk: null }); let itemBotanicalsForm = reactive({ itemFk: null });
const onGenusCreated = (response, formData) => {
itemGenusOptions.value = [...itemGenusOptions.value, response];
formData.genusFk = response.id;
};
const onSpecieCreated = (response, formData) => {
itemSpeciesOptions.value = [...itemSpeciesOptions.value, response];
formData.specieFk = response.id;
};
const entityId = computed(() => { const entityId = computed(() => {
return route.params.id; return route.params.id;
}); });
@ -42,18 +32,13 @@ async function handleItemBotanical(data) {
} }
</script> </script>
jsegarra marked this conversation as resolved Outdated

Comentarios?

Comentarios?
<template> <template>
<!-- <FetchData ref="itemBotanicalsRef" @on-fetch="(data) => (itemBotanicals = data)" /> -->
<FetchData <FetchData
url="Genera" ref="itemBotanicalsRef"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }" url="ItemBotanicals"
@on-fetch="(data) => (itemGenusOptions = data)" :filter="{
auto-load where: { itemFk: entityId },
/> }"
<FetchData @on-fetch="(data) => (itemBotanicals = data)"
url="Species"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemSpeciesOptions = data)"
auto-load
/> />
<FormModel <FormModel
url="ItemBotanicals" url="ItemBotanicals"
carlossa marked this conversation as resolved Outdated
Outdated
Review

(data) => itemBotanicalsForm = data

(data) => itemBotanicalsForm = data
@ -68,36 +53,35 @@ async function handleItemBotanical(data) {
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnSelectDialog <VnSelectDialog
ref="genusRef"
:label="t('Genus')" :label="t('Genus')"
v-model="data.genusFk" v-model="data.genusFk"
:options="itemGenusOptions" url="Genera"
option-label="name" option-label="name"
option-value="id" option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
> >
<template #form> <template #form>
<CreateGenusForm <CreateGenusForm
@on-data-saved=" @on-data-saved="(_, res) => (data.genusFk = res.id)"
(_, requestResponse) =>
onGenusCreated(requestResponse, data)
"
/> />
</template> </template>
</VnSelectDialog> </VnSelectDialog>
<VnSelectDialog <VnSelectDialog
:label="t('Species')" :label="t('Species')"
v-model="data.specieFk" v-model="data.specieFk"
:options="itemSpeciesOptions" url="Species"
option-label="name" option-label="name"
option-value="id" option-value="id"
:fields="['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
> >
<template #form> <template #form>
<CreateSpecieForm <CreateSpecieForm
@on-data-saved=" @on-data-saved="(_, res) => (data.specieFk = res.id)"
(_, requestResponse) =>
onSpecieCreated(requestResponse, data)
"
/> />
</template> </template>
</VnSelectDialog> </VnSelectDialog>

View File

@ -3,7 +3,6 @@ import { onMounted, ref, computed, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
@ -24,8 +23,6 @@ const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const rowsSelected = ref([]); const rowsSelected = ref([]);
const parkingsOptions = ref([]);
const shelvingsOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -104,7 +101,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: parkingsOptions.value, url: 'parkings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code', 'option-value': 'code',
'option-label': 'code', 'option-label': 'code',
dense: true, dense: true,
@ -124,7 +123,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: shelvingsOptions.value, url: 'shelvings',
fields: ['code'],
'sort-by': 'code ASC',
'option-value': 'code', 'option-value': 'code',
'option-label': 'code', 'option-label': 'code',
dense: true, dense: true,
@ -188,18 +189,6 @@ onMounted(async () => {
</script> </script>
<template> <template>
<FetchData
url="parkings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (parkingsOptions = data)"
/>
<FetchData
url="shelvings"
:filter="{ fields: ['code'], order: 'code ASC' }"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<template v-if="stateStore.isHeaderMounted()"> <template v-if="stateStore.isHeaderMounted()">
<Teleport to="#st-data"> <Teleport to="#st-data">
<div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222"> <div class="q-pa-md q-mr-lg q-ma-xs" style="border: 2px solid #222">
@ -237,7 +226,6 @@ onMounted(async () => {
</QBtn> </QBtn>
</Teleport> </Teleport>
</template> </template>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
:rows="rows" :rows="rows"

View File

@ -24,6 +24,7 @@ const getSelectedTagValues = async (tag) => {
const filter = { const filter = {
fields: ['value'], fields: ['value'],
order: 'value ASC', order: 'value ASC',
limit: 30,
}; };
const params = { filter: JSON.stringify(filter) }; const params = { filter: JSON.stringify(filter) };
@ -126,7 +127,7 @@ const insertTag = (rows) => {
:key="row.tagFk" :key="row.tagFk"
:label="t('Value')" :label="t('Value')"
v-model="row.value" v-model="row.value"
:options="valueOptionsMap.get(row.tagFk)" :url="`Tags/${row.tagFk}/filterValue`"
option-label="value" option-label="value"
option-value="value" option-value="value"
emit-value emit-value
@ -135,6 +136,7 @@ const insertTag = (rows) => {
:is-clearable="false" :is-clearable="false"
:required="false" :required="false"
:rules="validate('itemTag.tagFk')" :rules="validate('itemTag.tagFk')"
:use-like="false"
/> />
<VnInput <VnInput
v-else-if=" v-else-if="

View File

@ -319,7 +319,199 @@ const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
</div> </div>
<FetchedTags :item="row" :max-length="6" /> <FetchedTags :item="row" :max-length="6" />
</template> </template>
</VnTable> </RightMenu>
<QPage class="column items-center q-pa-md">
<QTable
:rows="fixedPrices"
:columns="columns"
row-key="id"
selection="multiple"
v-model:selected="rowsSelected"
:pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md"
:no-data-label="t('globals.noResults')"
>
<template #top-row="{ cols }">
<QTr>
<QTd />
<QTd
v-for="(col, index) in cols"
:key="index"
style="max-width: 100px"
>
<component
:is="col.columnFilter.component"
v-if="col.columnFilter"
v-model="col.columnFilter.filterValue"
v-bind="col.columnFilter.attrs"
v-on="col.columnFilter.event(col)"
dense
/>
</QTd>
</QTr>
</template>
<template #body-cell-itemId="props">
<QTd>
<VnSelect
url="Items/withName"
hide-selected
option-label="id"
option-value="id"
v-model="props.row.itemFk"
v-on="getRowUpdateInputEvents(props, true, 'select')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QTd>
</template>
<template #body-cell-description="{ row }">
<QTd class="col">
<span class="link">
{{ row.name }}
</span>
<ItemDescriptorProxy :id="row.itemFk" />
<FetchedTags :item="row" />
</QTd>
</template>
<template #body-cell-groupingPrice="props">
<QTd class="col">
<VnInput
v-model.number="props.row.rate2"
v-on="getRowUpdateInputEvents(props)"
>
<template #append></template>
</VnInput>
</QTd>
</template>
<template #body-cell-packingPrice="props">
<QTd class="col">
<VnInput
v-model.number="props.row.rate3"
v-on="getRowUpdateInputEvents(props)"
>
<template #append></template>
</VnInput>
</QTd>
</template>
<template #body-cell-minPrice="props">
<QTd class="col">
<div class="row">
<QCheckbox
class="col"
:model-value="props.row.hasMinPrice"
@update:model-value="updateMinPrice($event, props)"
:false-value="0"
:true-value="1"
:toggle-indeterminate="false"
/>
<VnInput
class="col"
:disable="!props.row.hasMinPrice"
v-model.number="props.row.minPrice"
v-on="getRowUpdateInputEvents(props)"
type="number"
/>
</div>
</QTd>
</template>
<template #body-cell-started="props">
<QTd class="col" style="min-width: 160px">
<VnInputDate
v-model="props.row.started"
v-on="getRowUpdateInputEvents(props, false, 'date')"
v-bind="
isBigger(props.row.started)
? { 'bg-color': 'warning', 'is-outlined': true }
: {}
"
/>
</QTd>
</template>
<template #body-cell-ended="props">
<QTd class="col" style="min-width: 150px">
<VnInputDate
v-model="props.row.ended"
v-on="getRowUpdateInputEvents(props, false, 'date')"
v-bind="
isLower(props.row.ended)
? { 'bg-color': 'warning', 'is-outlined': true }
: {}
"
/>
</QTd>
</template>
<template #body-cell-warehouse="props">
<QTd class="col">
<VnSelect
:options="warehousesOptions"
hide-selected
option-label="name"
option-value="id"
v-model="props.row.warehouseFk"
v-on="getRowUpdateInputEvents(props, false, 'select')"
/>
</QTd>
</template>
<template #body-cell-deleteAction="{ row, rowIndex }">
<QTd class="col">
<QIcon
name="delete"
size="sm"
class="cursor-pointer fill-icon-on-hover"
color="primary"
@click.stop="
openConfirmationModal(
t('This row will be removed'),
t('Do you want to clone this item?'),
() => removePrice(row.id, rowIndex)
)
"
>
<QTooltip class="text-no-wrap">
{{ t('Delete') }}
</QTooltip>
</QIcon>
</QTd>
</template>
<template #bottom-row>
<QTd align="center">
<QIcon
@click.stop="addRow()"
class="fill-icon-on-hover"
color="primary"
name="add_circle"
size="sm"
>
<QTooltip>
{{ t('Add fixed price') }}
</QTooltip>
</QIcon>
</QTd>
</template>
</QTable>
<QPageSticky v-if="rowsSelected.length" :offset="[20, 20]">
<QBtn @click="openEditTableCellDialog()" color="primary" fab icon="edit" />
<QTooltip>
{{ t('Edit fixed price(s)') }}
</QTooltip>
</QPageSticky>
<QDialog ref="editTableCellDialogRef">
<EditTableCellValueForm
edit-url="FixedPrices/editFixedPrice"
:rows="rowsSelected"
:fields-options="editTableFieldsOptions"
@on-data-saved="onEditCellDataSaved()"
/>
</QDialog>
</QPage>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.subName { .subName {

View File

@ -30,7 +30,7 @@ const itemTypesRef = ref(null);
const categoriesOptions = ref([]); const categoriesOptions = ref([]);
const itemTypesOptions = ref([]); const itemTypesOptions = ref([]);
const buyersOptions = ref([]); const buyersOptions = ref([]);
const suppliersOptions = ref([]); const tagOptions = ref([]);
const tagValues = ref([]); const tagValues = ref([]);
const fieldFiltersValues = ref([]); const fieldFiltersValues = ref([]);
const moreFields = ref([]); const moreFields = ref([]);
@ -161,12 +161,6 @@ onMounted(async () => {
@on-fetch="(data) => (buyersOptions = data)" @on-fetch="(data) => (buyersOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC' }"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Tags" url="Tags"
:filter="{ fields: ['id', 'name', 'isFree'] }" :filter="{ fields: ['id', 'name', 'isFree'] }"
@ -261,9 +255,11 @@ onMounted(async () => {
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
v-model="params.supplierFk" v-model="params.supplierFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="name" option-label="name"
:fields="['id', 'name', 'nickname']"
sort-by="name ASC"
hide-selected hide-selected
dense dense
outlined outlined

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { ref, computed, onMounted, watch } from 'vue'; import { ref, computed, onMounted, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
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 { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';

View File

@ -24,7 +24,6 @@ const stateOptions = [
const itemTypesOptions = ref([]); const itemTypesOptions = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const workersOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -72,18 +71,6 @@ const decrement = (paramsObj, key) => {
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Workers/search"
:filter="{
fields: ['id', 'name'],
order: 'name ASC',
}"
:params="{
departmentCodes: ['VT'],
}"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
@ -162,7 +149,10 @@ const decrement = (paramsObj, key) => {
:label="t('params.requesterFk')" :label="t('params.requesterFk')"
v-model="params.requesterFk" v-model="params.requesterFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
:options="workersOptions" url="Workers/search"
:fields="['id', 'name']"
order="name ASC"
:params="{ departmentCodes: ['VT'] }"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

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

@ -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',
@ -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

@ -3,6 +3,7 @@ import { ref } 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 VnFilterPanel from 'components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -15,25 +16,13 @@ const props = defineProps({
const emit = defineEmits(['search']); const emit = defineEmits(['search']);
const workers = ref(); const workers = ref();
const parkings = ref();
function setWorkers(data) { function setWorkers(data) {
workers.value = data; workers.value = data;
} }
function setParkings(data) {
parkings.value = data;
}
</script> </script>
<template> <template>
<FetchData
url="Parkings"
:filter="{ fields: ['id', 'code'] }"
sort-by="code ASC"
@on-fetch="setParkings"
auto-load
/>
<FetchData <FetchData
url="Workers/activeWithInheritedRole" url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }" :filter="{ where: { role: 'salesPerson' } }"
@ -54,44 +43,36 @@ function setParkings(data) {
</template> </template>
<template #body="{ params }"> <template #body="{ params }">
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection v-if="!parkings"> <QItemSection>
<QSkeleton type="QInput" class="full-width" /> <VnSelect
</QItemSection> v-model="params.parkingFk"
<QItemSection v-if="parkings"> url="Parkings"
<QSelect :fields="['id', 'code']"
:label="t('params.parkingFk')"
option-value="id"
option-label="code"
:filter-options="['id', 'code']"
dense dense
outlined outlined
rounded rounded
:label="t('params.parkingFk')" sort-by="code ASC"
v-model="params.parkingFk"
:options="parkings"
option-value="id"
option-label="code"
emit-value
map-options
use-input
:input-debounce="0"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection v-if="!workers"> <QItemSection>
<QSkeleton type="QInput" class="full-width" /> <VnSelect
</QItemSection>
<QItemSection v-if="workers">
<QSelect
dense dense
outlined outlined
rounded rounded
:label="t('params.userFk')" :label="t('params.userFk')"
v-model="params.userFk" v-model="params.userFk"
:options="workers" url="Workers/activeWithInheritedRole"
option-value="id" option-value="id"
option-label="name" option-label="firstName"
emit-value :where="{ role: 'salesPerson' }"
map-options sort-by="firstName ASC"
use-input :use-like="false"
:input-debounce="0"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>

View File

@ -1,12 +1,12 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue'; 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 FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -20,30 +20,6 @@ const defaultInitialData = {
isRecyclable: false, isRecyclable: false,
}; };
const parkingFilter = { fields: ['id', 'code'] };
const parkingList = ref([]);
const parkingListCopy = ref([]);
const setParkingList = (data) => {
parkingList.value = data;
parkingListCopy.value = data;
};
const parkingSelectFilter = {
options: parkingList,
filterFn: (options, value) => {
const search = value.trim().toLowerCase();
if (!search || search === '') {
return parkingListCopy.value;
}
return options.value.filter((option) =>
option.code.toLowerCase().startsWith(search)
);
},
};
const shelvingFilter = { const shelvingFilter = {
include: [ include: [
{ {
@ -68,12 +44,6 @@ const onSave = (shelving, newShelving) => {
</script> </script>
<template> <template>
<VnSubToolbar v-if="isNew" /> <VnSubToolbar v-if="isNew" />
<FetchData
url="Parkings"
:filter="parkingFilter"
@on-fetch="setParkingList"
auto-load
/>
<FormModel <FormModel
:url="isNew ? null : `Shelvings/${entityId}`" :url="isNew ? null : `Shelvings/${entityId}`"
:url-create="isNew ? 'Shelvings' : null" :url-create="isNew ? 'Shelvings' : null"
@ -84,27 +54,22 @@ const onSave = (shelving, newShelving) => {
:form-initial-data="isNew ? defaultInitialData : null" :form-initial-data="isNew ? defaultInitialData : null"
@on-data-saved="onSave" @on-data-saved="onSave"
> >
<template #form="{ data, validate, filter }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnInput <VnInput
v-model="data.code" v-model="data.code"
:label="t('shelving.basicData.code')" :label="t('shelving.basicData.code')"
:rules="validate('Shelving.code')" :rules="validate('Shelving.code')"
/> />
<QSelect <VnSelect
v-model="data.parkingFk" v-model="data.parkingFk"
:options="parkingList" url="Parkings"
option-value="id" option-value="id"
option-label="code" option-label="code"
emit-value :filter-options="['id', 'code']"
:fields="['id', 'code']"
:label="t('shelving.basicData.parking')" :label="t('shelving.basicData.parking')"
map-options
use-input
@filter="
(value, update) => filter(value, update, parkingSelectFilter)
"
:rules="validate('Shelving.parkingFk')" :rules="validate('Shelving.parkingFk')"
:input-debounce="0"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>

View File

@ -87,7 +87,7 @@ function exprBuilder(param, value) {
</div> </div>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<RouterLink :to="{ name: 'ShelvingCreate' }"> <RouterLink :to="{ name: 'ShelvingCreate' }">
<QBtn fab icon="add" color="primary" /> <QBtn fab icon="add" color="primary" shortcut="+" />
<QTooltip> <QTooltip>
{{ t('shelving.list.newShelving') }} {{ t('shelving.list.newShelving') }}
</QTooltip> </QTooltip>

View File

@ -81,7 +81,13 @@ const redirectToUpdateView = (addressData) => {
</VnPaginate> </VnPaginate>
</div> </div>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" /> <QBtn
fab
icon="add"
color="primary"
@click="redirectToCreateView()"
shortcut="+"
/>
<QTooltip> <QTooltip>
{{ t('New address') }} {{ t('New address') }}
</QTooltip> </QTooltip>
@ -93,3 +99,4 @@ const redirectToUpdateView = (addressData) => {
es: es:
New address: Nueva dirección New address: Nueva dirección
</i18n> </i18n>
s

View File

@ -109,7 +109,13 @@ const redirectToCreateView = () => {
</template> </template>
</CrudModel> </CrudModel>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" /> <QBtn
fab
icon="add"
color="primary"
@click="redirectToCreateView()"
shortcut="+"
/>
<QTooltip> <QTooltip>
{{ t('supplier.agencyTerms.addRow') }} {{ t('supplier.agencyTerms.addRow') }}
</QTooltip> </QTooltip>

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

@ -30,7 +30,6 @@ const { t } = useI18n();
const agencyFetchRef = ref(null); const agencyFetchRef = ref(null);
const zonesFetchRef = ref(null); const zonesFetchRef = ref(null);
const clientsOptions = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
@ -273,15 +272,6 @@ const redirectToCustomerAddress = () => {
onMounted(() => onFormModelInit()); onMounted(() => onFormModelInit());
</script> </script>
<template> <template>
<FetchData
url="Clients"
:filter="{
fields: ['id', 'name'],
order: 'id',
}"
@on-fetch="(data) => (clientsOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
@ -317,7 +307,9 @@ onMounted(() => onFormModelInit());
v-model="clientId" v-model="clientId"
option-value="id" option-value="id"
option-label="name" option-label="name"
:options="clientsOptions" url="Clients"
:fields="['id', 'name']"
sort-by="id"
hide-selected hide-selected
map-options map-options
:required="true" :required="true"

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

@ -17,9 +17,7 @@ const { t } = useI18n();
const state = useState(); const state = useState();
const user = state.getUser(); const user = state.getUser();
const stateFetchDataRef = ref(null); const stateFetchDataRef = ref(null);
const statesOptions = ref([]); const statesOptions = ref([]);
const workersOptions = ref([]);
const onStateFkChange = (formData) => (formData.userFk = user.value.id); const onStateFkChange = (formData) => (formData.userFk = user.value.id);
</script> </script>
@ -30,12 +28,6 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
auto-load auto-load
@on-fetch="(data) => (statesOptions = data)" @on-fetch="(data) => (statesOptions = data)"
/> />
<FetchData
url="Workers/search"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
auto-load
@on-fetch="(data) => (workersOptions = data)"
/>
<FormModelPopup <FormModelPopup
:title="t('Create tracking')" :title="t('Create tracking')"
url-create="Tickets/state" url-create="Tickets/state"
@ -57,7 +49,9 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
<VnSelect <VnSelect
:label="t('tracking.worker')" :label="t('tracking.worker')"
v-model="data.userFk" v-model="data.userFk"
:options="workersOptions" url="Workers/search"
fields=" ['id', 'name']"
sort-by="name ASC"
hide-selected hide-selected
option-label="name" option-label="name"
option-value="id" option-value="id"

View File

@ -3,7 +3,6 @@ import { onMounted, ref, computed, onUnmounted, reactive, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import TicketEditManaProxy from './TicketEditMana.vue'; import TicketEditManaProxy from './TicketEditMana.vue';
@ -35,7 +34,6 @@ const selectedExpeditions = ref([]);
const allColumnNames = ref([]); const allColumnNames = ref([]);
const visibleColumns = ref([]); const visibleColumns = ref([]);
const newTicketWithRoute = ref(false); const newTicketWithRoute = ref(false);
const itemsOptions = ref([]);
const exprBuilder = (param, value) => { const exprBuilder = (param, value) => {
switch (param) { switch (param) {
@ -139,7 +137,9 @@ const columns = computed(() => [
filterValue: null, filterValue: null,
event: getInputEvents, event: getInputEvents,
attrs: { attrs: {
options: itemsOptions.value, url: 'Items',
fields: ['id', 'name'],
'sort-by': 'name ASC',
'option-value': 'id', 'option-value': 'id',
'option-label': 'name', 'option-label': 'name',
dense: true, dense: true,
@ -274,12 +274,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</script> </script>
<template> <template>
<FetchData
url="Items"
auto-load
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemsOptions = data)"
/>
<VnSubToolbar> <VnSubToolbar>
<template #st-data> <template #st-data>
<TableVisibleColumns <TableVisibleColumns

View File

@ -252,7 +252,13 @@ const openCreateModal = () => createTicketRequestDialogRef.value.show();
<TicketCreateRequest @on-request-created="crudModelRef.reload()" /> <TicketCreateRequest @on-request-created="crudModelRef.reload()" />
</QDialog> </QDialog>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<QBtn @click="openCreateModal()" color="primary" fab icon="add" /> <QBtn
@click="openCreateModal()"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip class="text-no-wrap"> <QTooltip class="text-no-wrap">
{{ t('purchaseRequest.newRequest') }} {{ t('purchaseRequest.newRequest') }}
</QTooltip> </QTooltip>

View File

@ -38,7 +38,6 @@ const ticketConfig = ref(null);
const isLocked = ref(false); const isLocked = ref(false);
const isTicketEditable = ref(false); const isTicketEditable = ref(false);
const sales = ref([]); const sales = ref([]);
const itemsWithNameOptions = ref([]);
const editableStatesOptions = ref([]); const editableStatesOptions = ref([]);
const selectedSales = ref([]); const selectedSales = ref([]);
const mana = ref(null); const mana = ref(null);
@ -435,12 +434,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
auto-load auto-load
@on-fetch="(data) => (isLocked = data)" @on-fetch="(data) => (isLocked = data)"
/> />
<FetchData
url="Items/withName"
:filter="{ fields: ['id', 'name'], order: 'id DESC' }"
auto-load
@on-fetch="(data) => (itemsWithNameOptions = data)"
/>
<FetchData <FetchData
url="States/editableStates" url="States/editableStates"
:filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }" :filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }"
@ -626,10 +619,12 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</div> </div>
<VnSelect <VnSelect
v-else v-else
:options="itemsWithNameOptions"
hide-selected hide-selected
option-label="name" option-label="name"
option-value="id" option-value="id"
url="Items/withName"
:fields="['id', 'name']"
sort-by="id DESC"
@update:model-value="changeQuantity(row)" @update:model-value="changeQuantity(row)"
v-model="row.itemFk" v-model="row.itemFk"
> >
@ -661,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

@ -26,8 +26,6 @@ const saleTrackingFetchDataRef = ref(null);
const sales = ref([]); const sales = ref([]);
const saleTrackings = ref([]); const saleTrackings = ref([]);
const itemShelvignsSales = ref([]); const itemShelvignsSales = ref([]);
const shelvingsOptions = ref([]);
const parkingsOptions = ref([]);
const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`); const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`);
const oldQuantity = ref(null); const oldQuantity = ref(null);
@ -330,12 +328,6 @@ const qCheckBoxController = (sale, action) => {
auto-load auto-load
@on-fetch="(data) => (sales = data)" @on-fetch="(data) => (sales = data)"
/> />
<FetchData
url="Shelvings"
auto-load
@on-fetch="(data) => (shelvingsOptions = data)"
/>
<FetchData url="Parkings" auto-load @on-fetch="(data) => (parkingsOptions = data)" />
<QTable <QTable
:rows="sales" :rows="sales"
:columns="columns" :columns="columns"
@ -420,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>
@ -500,7 +492,7 @@ const qCheckBoxController = (sale, action) => {
<template #body-cell-shelving="{ row }"> <template #body-cell-shelving="{ row }">
<QTd auto-width> <QTd auto-width>
<VnSelect <VnSelect
:options="shelvingsOptions" url="Shelvings"
hide-selected hide-selected
option-label="code" option-label="code"
option-value="code" option-value="code"
@ -513,7 +505,7 @@ const qCheckBoxController = (sale, action) => {
<template #body-cell-parking="{ row }"> <template #body-cell-parking="{ row }">
<QTd auto-width> <QTd auto-width>
<VnSelect <VnSelect
:options="parkingsOptions" url="Parkings"
hide-selected hide-selected
option-label="code" option-label="code"
option-value="id" option-value="id"

View File

@ -399,7 +399,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

@ -114,7 +114,13 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
<TicketCreateTracking @on-request-created="paginateRef.fetch()" /> <TicketCreateTracking @on-request-created="paginateRef.fetch()" />
</QDialog> </QDialog>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<QBtn @click="openCreateModal()" color="primary" fab icon="add" /> <QBtn
@click="openCreateModal()"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip class="text-no-wrap"> <QTooltip class="text-no-wrap">
{{ t('tracking.addState') }} {{ t('tracking.addState') }}
</QTooltip> </QTooltip>

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

@ -196,6 +196,7 @@ const removeThermograph = async (id) => {
icon="add" icon="add"
color="primary" color="primary"
@click="redirectToThermographForm('create')" @click="redirectToThermographForm('create')"
shortcut="+"
/> />
<QTooltip class="text-no-wrap"> <QTooltip class="text-no-wrap">
{{ t('Add thermograph') }} {{ t('Add thermograph') }}

View File

@ -20,7 +20,6 @@ const props = defineProps({
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const continentsOptions = ref([]); const continentsOptions = ref([]);
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
const suppliersOptions = ref([]);
const warehousesByContinent = ref({}); const warehousesByContinent = ref({});
const add = (paramsObj, key) => { const add = (paramsObj, key) => {
@ -76,12 +75,6 @@ warehouses();
@on-fetch="(data) => (agenciesOptions = data)" @on-fetch="(data) => (agenciesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Suppliers"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -220,7 +213,7 @@ warehouses();
<VnSelect <VnSelect
:label="t('globals.pageTitles.supplier')" :label="t('globals.pageTitles.supplier')"
v-model="params.cargoSupplierFk" v-model="params.cargoSupplierFk"
:options="suppliersOptions" url="Suppliers"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

View File

@ -74,7 +74,7 @@ async function remove(row) {
</VnPaginate> </VnPaginate>
</div> </div>
<QPageSticky position="bottom-right" :offset="[18, 18]"> <QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn @click="create" fab icon="add" color="primary" /> <QBtn @click="create" fab icon="add" color="primary" shortcut="+" />
</QPageSticky> </QPageSticky>
</QPage> </QPage>
</template> </template>

View File

@ -94,7 +94,7 @@ async function remove(row) {
</VnPaginate> </VnPaginate>
</div> </div>
<QPageSticky position="bottom-right" :offset="[18, 18]"> <QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn @click="create" fab icon="add" color="primary" /> <QBtn @click="create" fab icon="add" color="primary" shortcut="+" />
</QPageSticky> </QPageSticky>
</QPage> </QPage>
</template> </template>

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

@ -116,7 +116,7 @@ function reloadData() {
</template> </template>
</VnPaginate> </VnPaginate>
<QPageSticky :offset="[18, 18]"> <QPageSticky :offset="[18, 18]">
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add"> <QBtn @click.stop="dialog.show()" color="primary" fab icon="add" shortcut="+">
<QDialog ref="dialog"> <QDialog ref="dialog">
<FormModelPopup <FormModelPopup
:title="t('Add new device')" :title="t('Add new device')"

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

@ -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');
@ -52,7 +52,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
@click="stateStore.toggleRightDrawer()" @click="stateStore.toggleRightDrawer()"
round round
dense dense
icon="menu" icon="dock_to_left"
> >
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}
@ -102,6 +102,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
color="primary" color="primary"
fab fab
icon="add" icon="add"
shortcut="+"
/> />
<QTooltip class="text-no-wrap"> <QTooltip class="text-no-wrap">
{{ t('eventsInclusionForm.addEvent') }} {{ t('eventsInclusionForm.addEvent') }}

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');
@ -111,7 +111,13 @@ const openCreateWarehouseForm = () => createWarehouseDialogRef.value.show();
<ZoneCreateWarehouse @on-submit-create-warehouse="createZoneWarehouse" /> <ZoneCreateWarehouse @on-submit-create-warehouse="createZoneWarehouse" />
</QDialog> </QDialog>
<QPageSticky position="bottom-right" :offset="[18, 18]"> <QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn fab icon="add" color="primary" @click="openCreateWarehouseForm()"> <QBtn
fab
icon="add"
color="primary"
@click="openCreateWarehouseForm()"
shortcut="+"
>
<QTooltip>{{ t('warehouses.add') }}</QTooltip> <QTooltip>{{ t('warehouses.add') }}</QTooltip>
</QBtn> </QBtn>
</QPageSticky> </QPageSticky>

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"
:filter="{ :create="{
include: { relation: 'agencyMode', scope: { fields: ['name'] } }, urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
formInitialData: {},
}" }"
:limit="20" :user-filter="tableFilter"
:columns="columns"
redirect="zone"
:right-search="false"
auto-load auto-load
> >
<template #body="{ rows }"> <template #more-create-dialog="{ data }">
<div class="q-pa-md"> <VnSelect
<QTable url="AgencyModes"
:rows="rows" v-model="data.agencyModeFk"
:columns="columns" option-value="id"
row-key="clientId" option-label="name"
class="full-width" :label="t('list.agency')"
@row-click="redirectToZoneSummary" />
> <VnInput
<template #header="props"> v-model="data.price"
<QTr :props="props" class="bg"> :label="t('list.price')"
<QTh min="0"
v-for="col in props.cols" type="number"
:key="col.name" required="true"
:props="props" />
> <VnInput
{{ t(col.label) }} v-model="data.bonus"
<QTooltip v-if="col.tooltip">{{ :label="t('list.bonus')"
col.tooltip min="0"
}}</QTooltip> type="number"
</QTh> />
</QTr> <VnInput
v-model="data.travelingDays"
:label="t('list.travelingDays')"
type="number"
min="0"
/>
<VnInputTime v-model="data.hour" :label="t('list.close')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</template> </template>
<template #body-cell="props"> <i18n>
<QTd :props="props"> es:
<QTr :props="props" class="cursor-pointer"> Search zone: Buscar zona
{{ props.value }} You can search zones by id or name: Puedes buscar zonas por id o nombre
</QTr> </i18n>
</QTd>
</template>
<template #body-cell-actions="props">
<QTd :props="props" class="q-gutter-x-sm">
<QIcon
name="vn:clone"
size="sm"
color="primary"
@click.stop="handleClone(props.row.id)"
>
<QTooltip>{{ t('globals.clone') }}</QTooltip>
</QIcon>
<QIcon
name="preview"
size="sm"
color="primary"
@click.stop="
viewSummary(props.row.id, ZoneSummary)
"
>
<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>

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

@ -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();
}); });
}); });

View File

@ -0,0 +1,34 @@
describe('ZoneWarehouse', () => {
const data = {
Warehouse: { val: 'Algemesi', type: 'select' },
};
const deviceProductionField =
'.vn-row > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
const dataError = "ER_DUP_ENTRY: Duplicate entry '2-2' for key 'zoneFk'";
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit(`/#/zone/2/warehouses`);
});
it('should throw an error if the warehouse chosen is already put in the zone', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(deviceProductionField).click();
cy.get(deviceProductionField).type('{upArrow}{enter}');
cy.get('.q-notification__message').should('have.text', dataError);
});
it('should create a warehouse', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(deviceProductionField).click();
cy.fillInForm(data);
cy.get('.q-mt-lg > .q-btn--standard').click();
});
it('should delete a warehouse', () => {
cy.get('tbody > :nth-child(2) > :nth-child(2) > .q-icon').click();
cy.get('.q-card__actions > .q-btn--flat > .q-btn__content').click();
cy.reload();
});
});

View File

@ -105,6 +105,12 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
case 'date': case 'date':
cy.wrap(el).type(val.split('-').join('')); cy.wrap(el).type(val.split('-').join(''));
break; break;
case 'time':
cy.wrap(el).click();
cy.get('.q-time .q-time__clock').contains(val.h).click();
cy.get('.q-time .q-time__clock').contains(val.m).click();
cy.get('.q-time .q-time__link').contains(val.x).click();
break;
default: default:
cy.wrap(el).type(val); cy.wrap(el).type(val);
break; break;