0
0
Fork 0

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

This commit is contained in:
William Buezas 2024-04-29 10:32:53 -03:00
commit 1b619055eb
8 changed files with 601 additions and 14 deletions

View File

@ -199,8 +199,9 @@ es:
templates: templates:
pendingPayment: 'Su pedido está pendiente de pago. pendingPayment: 'Su pedido está pendiente de pago.
Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias.' Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias.'
minAmount: 'Es necesario un importe mínimo de 50 (Sin IVA) en su pedido minAmount: 'Te recordamos que tu pedido {orderId} es inferior a 50.
{ orderId } con llegada { landing } para recibirlo sin portes adicionales.' Te recomendamos amplíes para no generar costes extra, provocarán un incremento de tu tarifa.
¡Un saludo!'
orderChanges: 'Pedido {orderId} con llegada estimada día { landing }: { changes }' orderChanges: 'Pedido {orderId} con llegada estimada día { landing }: { changes }'
en: Inglés en: Inglés
es: Español es: Español

View File

@ -41,6 +41,7 @@ const workers = ref([]);
const workersCopy = ref([]); const workersCopy = ref([]);
const claimStates = ref([]); const claimStates = ref([]);
const claimStatesCopy = ref([]); const claimStatesCopy = ref([]);
const optionsList = ref([]);
function setWorkers(data) { function setWorkers(data) {
workers.value = data; workers.value = data;
@ -51,9 +52,9 @@ function setClaimStates(data) {
claimStates.value = data; claimStates.value = data;
claimStatesCopy.value = data; claimStatesCopy.value = data;
} }
let optionsList;
async function getEnumValues() { async function getEnumValues() {
optionsList = [{ id: null, description: t('claim.basicData.null') }]; optionsList.value = [{ id: null, description: t('claim.basicData.null') }];
const { data } = await axios.get(`Applications/get-enum-values`, { const { data } = await axios.get(`Applications/get-enum-values`, {
params: { params: {
schema: 'vn', schema: 'vn',
@ -62,8 +63,9 @@ async function getEnumValues() {
}, },
}); });
for (let value of data) for (let value of data)
optionsList.push({ id: value, description: t(`claim.basicData.${value}`) }); optionsList.value.push({ id: value, description: t(`claim.basicData.${value}`) });
} }
getEnumValues(); getEnumValues();
const workerFilter = { const workerFilter = {

View File

@ -149,6 +149,15 @@ const states = ref();
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.myTeam"
:label="t('myTeam')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QSeparator /> <QSeparator />
<QExpansionItem :label="t('More options')" expand-separator> <QExpansionItem :label="t('More options')" expand-separator>
<!-- <QItem> <!-- <QItem>
@ -192,6 +201,7 @@ en:
claimResponsibleFk: Responsible claimResponsibleFk: Responsible
claimStateFk: State claimStateFk: State
created: Created created: Created
myTeam: My team
es: es:
params: params:
search: Contiene search: Contiene
@ -211,4 +221,5 @@ es:
Item: Artículo Item: Artículo
Created: Creada Created: Creada
More options: Más opciones More options: Más opciones
myTeam: Mi equipo
</i18n> </i18n>

View File

@ -180,10 +180,13 @@ function handleLocation(data, location) {
:rules="validate('Worker.postcode')" :rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']" :roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions" :options="postcodesOptions"
v-model="data.location" v-model="data.postalCode"
@update:model-value="(location) => handleLocation(data, location)" @update:model-value="(location) => handleLocation(data, location)"
></VnLocation> ></VnLocation>
</div> </div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('Agency')" :label="t('Agency')"
@ -202,7 +205,6 @@ function handleLocation(data, location) {
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" /> <VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelect <VnSelect
@ -229,7 +231,6 @@ function handleLocation(data, location) {
</VnSelectDialog> </VnSelectDialog>
</div> </div>
</VnRow> </VnRow>
<h4 class="q-mb-xs">{{ t('Notes') }}</h4> <h4 class="q-mb-xs">{{ t('Notes') }}</h4>
<VnRow <VnRow
:key="index" :key="index"

View File

@ -1 +1,94 @@
<template>Item barcode</template> <script setup>
import { ref, onMounted, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CrudModel from 'src/components/CrudModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
const route = useRoute();
const { t } = useI18n();
const itemBarcodeRef = ref(null);
const insertRow = () => {
itemBarcodeRef.value.insert();
focusLastInput();
};
const focusLastInput = () => {
nextTick(() => {
const inputs = document.querySelectorAll('[focusable-input]');
const lastInput = inputs[inputs.length - 1];
if (lastInput) lastInput.focus();
});
};
onMounted(async () => {
if (itemBarcodeRef.value) itemBarcodeRef.value.reload();
});
</script>
<template>
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<CrudModel
:data-required="{ itemFk: route.params.id }"
:default-remove="false"
:filter="{
fields: ['id', 'itemFk', 'code'],
where: { itemFk: route.params.id },
}"
data-key="ItemBarcodes"
model="ItemBarcodes"
ref="itemBarcodeRef"
url="ItemBarcodes"
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">
<div
v-for="(row, index) in rows"
:key="index"
class="q-mb-md full-width row items-center no-wrap"
>
<VnInput
:label="t('Code')"
v-model="row.code"
class="full-width"
focusable-input
/>
<QIcon
@click="itemBarcodeRef.remove([row])"
class="cursor-pointer q-ml-md"
color="primary"
name="delete"
size="sm"
>
<QTooltip class="text-no-wrap">
{{ t('Remove barcode') }}
</QTooltip>
</QIcon>
</div>
<QIcon
@click="insertRow()"
class="cursor-pointer fill-icon-on-hover"
color="primary"
name="add_circle"
size="sm"
>
<QTooltip>
{{ t('Add barcode') }}
</QTooltip>
</QIcon>
</QCard>
</template>
</CrudModel>
</QPage>
</div>
</template>
<i18n>
es:
Code: Código
Remove barcode: Quitar código de barras
Add barcode: Añadir código de barras
</i18n>

View File

@ -177,14 +177,27 @@ const openCloneDialog = async () => {
<VnLv :label="t('item.descriptor.buyer')"> <VnLv :label="t('item.descriptor.buyer')">
<template #value> <template #value>
<span class="link"> <span class="link">
{{ t('item.descriptor.buyer') }} {{ entity.itemType?.worker?.user?.name }}
<WorkerDescriptorProxy :id="entity.itemType?.worker?.id" /> <WorkerDescriptorProxy :id="entity.itemType?.worker?.id" />
</span> </span>
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('item.descriptor.color')" :value="entity.value5"> </VnLv> <VnLv
<VnLv :label="t('item.descriptor.color')" :value="entity.value6" /> v-if="entity.value5"
<VnLv :label="t('item.descriptor.stems')" :value="entity.value7" /> :label="t('item.descriptor.color')"
:value="entity.value5"
>
</VnLv>
<VnLv
v-if="entity.value6"
:label="t('item.descriptor.category')"
:value="entity.value6"
/>
<VnLv
v-if="entity.value7"
:label="t('item.descriptor.stems')"
:value="entity.value7"
/>
</template> </template>
<template #actions="{}"> <template #actions="{}">
<QCardActions class="row justify-center"> <QCardActions class="row justify-center">

View File

@ -12,6 +12,7 @@ import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import ItemSummary from '../Item/Card/ItemSummary.vue'; import ItemSummary from '../Item/Card/ItemSummary.vue';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import ItemListFilter from './ItemListFilter.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { toDateFormat } from 'src/filters/date.js'; import { toDateFormat } from 'src/filters/date.js';
@ -69,7 +70,7 @@ const exprBuilder = (param, value) => {
} }
}; };
const params = reactive({}); const params = reactive({ isFloramondo: false, isActive: true });
const applyColumnFilter = async (col) => { const applyColumnFilter = async (col) => {
try { try {
@ -442,6 +443,11 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<QSpace /> <QSpace />
<div id="st-actions"></div> <div id="st-actions"></div>
</QToolbar> </QToolbar>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<ItemListFilter data-key="ItemList" />
</QScrollArea>
</QDrawer>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<VnPaginate <VnPaginate
ref="paginateRef" ref="paginateRef"

View File

@ -0,0 +1,460 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { onMounted } from 'vue';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QCheckbox } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import { useValidator } from 'src/composables/useValidator';
import axios from 'axios';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const stateStore = useStateStore();
const validationsStore = useValidator();
const itemTypesRef = ref(null);
const categoriesOptions = ref([]);
const itemTypesOptions = ref([]);
const buyersOptions = ref([]);
const suppliersOptions = ref([]);
const tagValues = ref([]);
const fieldFiltersValues = ref([]);
const moreFields = ref([]);
const arrayData = useArrayData(props.dataKey);
const itemTypesFilter = {
fields: ['id', 'name', 'categoryFk'],
include: 'category',
order: 'name ASC',
where: {},
};
const onCategoryChange = async (categoryFk, search) => {
if (!categoryFk) {
itemTypesFilter.where.categoryFk = null;
delete itemTypesFilter.where.categoryFk;
} else {
itemTypesFilter.where.categoryFk = categoryFk;
}
search();
await itemTypesRef.value.fetch();
};
const getSelectedTagValues = async (tag) => {
try {
tag.value = null;
const filter = {
fields: ['value'],
order: 'value ASC',
};
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`Tags/${tag.selectedTag.id}/filterValue`, {
params,
});
tag.valueOptions = data;
} catch (err) {
console.error('Error getting selected tag values');
}
};
const applyTags = (params, search) => {
params.tags = tagValues.value
.filter((tag) => tag.selectedTag && tag.value)
.map((tag) => ({
tagFk: tag.selectedTag.id,
tagName: tag.selectedTag.name,
value: tag.value,
}));
search();
};
const removeTag = (index, params, search) => {
(tagValues.value || []).splice(index, 1);
applyTags(params, search);
};
const applyFieldFilters = (params) => {
fieldFiltersValues.value.forEach((fieldFilter) => {
if (
fieldFilter.selectedField &&
(fieldFilter.value !== null ||
fieldFilter.value !== '' ||
fieldFilter.value !== undefined)
) {
params[fieldFilter.name] = fieldFilter.value;
}
});
arrayData.applyFilter({ params });
};
const removeFieldFilter = (index, params, search) => {
delete params[fieldFiltersValues.value[index].name];
(fieldFiltersValues.value || []).splice(index, 1);
applyFieldFilters(params, search);
};
onMounted(async () => {
stateStore.rightDrawer = true;
if (arrayData.store?.userParams?.categoryFk)
itemTypesFilter.where.categoryFk = arrayData.store?.userParams?.categoryFk;
await itemTypesRef.value.fetch();
const { models } = validationsStore;
const properties = models.Item?.properties || {};
const _moreFields = ['id', 'description', 'name', 'isActive'];
_moreFields.forEach((field) => {
let prop = properties[field];
const label = t(`params.${field}`);
moreFields.value.push({
name: field,
label,
type: prop ? prop.type : null,
});
});
// Fill fieldFiltersValues with existent userParams
if (arrayData.store?.userParams) {
fieldFiltersValues.value = Object.entries(arrayData.store?.userParams)
.filter(([key, value]) => value && _moreFields.includes(key))
.map(([key, value]) => ({
name: key,
value,
selectedField: moreFields.value.find((field) => field.name === key),
}));
}
});
</script>
<template>
<FetchData
url="ItemCategories"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (categoriesOptions = data)"
auto-load
/>
<FetchData
ref="itemTypesRef"
url="ItemTypes"
:filter="itemTypesFilter"
@on-fetch="(data) => (itemTypesOptions = data)"
/>
<FetchData
url="TicketRequests/getItemTypeWorker"
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC' }"
@on-fetch="(data) => (buyersOptions = data)"
auto-load
/>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC' }"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData
url="Tags"
:filter="{ fields: ['id', 'name', 'isFree'] }"
auto-load
@on-fetch="(data) => (tagOptions = data)"
/>
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:hidden-tags="tagValues.length === 0 ? ['tags'] : []"
>
<template #tags="{ tag, formatFn }">
<div>
<strong>{{ t(`params.${tag.label}`) }}</strong>
<span v-if="tag.label !== 'tags'">: {{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
v-model="params.search"
:label="t('params.search')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.categoryFk')"
v-model="params.categoryFk"
@update:model-value="
($event) => onCategoryChange($event, searchFn)
"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.typeFk')"
v-model="params.typeFk"
@update:model-value="searchFn()"
:options="itemTypesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>{{
scope.opt?.category?.name
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.buyerFk')"
v-model="params.buyerFk"
@update:model-value="searchFn()"
:options="buyersOptions"
option-value="id"
option-label="nickname"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.supplierFk')"
v-model="params.supplierFk"
@update:model-value="searchFn()"
:options="suppliersOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{
scope.opt?.name + ': ' + scope.opt?.nickname
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<!-- Tags filter -->
<QItem class="row items-center">
<QItemLabel>
{{ t('params.tags') }}
</QItemLabel>
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="tagValues.push({})"
/>
</QItem>
<QItem
v-for="(tag, index) in tagValues"
:key="index"
class="row items-center"
>
<QItemSection class="col">
<VnSelect
:label="t('params.tag')"
v-model="tag.selectedTag"
:options="tagOptions"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="getSelectedTagValues(tag)"
/>
</QItemSection>
<QItemSection class="col">
<VnSelect
v-if="!tag?.selectedTag?.isFree && tag.valueOptions"
:label="t('params.tag')"
v-model="tag.value"
:options="tag.valueOptions || []"
option-value="value"
option-label="value"
dense
outlined
rounded
emit-value
use-input
:disable="!tag"
:is-clearable="false"
@update:model-value="applyTags(params, searchFn)"
/>
<VnInput
v-else
v-model="tag.value"
:label="t('params.value')"
:disable="!tag"
is-outlined
:is-clearable="false"
@keydown.enter.prevent="applyTags(params, searchFn)"
/>
</QItemSection>
<QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeTag(index, params, searchFn)"
/>
</QItem>
<!-- Filter fields -->
<QItem class="row items-center">
<QItemLabel>
{{ t('More fields') }}
</QItemLabel>
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="fieldFiltersValues.push({})"
/>
</QItem>
<QItem
v-for="(fieldFilter, index) in fieldFiltersValues"
:key="index"
class="row items-center"
>
<QItemSection class="col">
<VnSelect
:label="t('params.tag')"
:model-value="fieldFilter.selectedField"
:options="moreFields"
option-label="label"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="
($event) => {
fieldFilter.name = $event.name;
fieldFilter.value = null;
fieldFilter.selectedField = $event;
}
"
/>
</QItemSection>
<QItemSection class="col">
<QCheckbox
v-if="fieldFilter.selectedField?.type === 'boolean'"
v-model="fieldFilter.value"
:label="t('params.value')"
@update:model-value="applyFieldFilters(params, searchFn)"
/>
<VnInput
v-else
v-model="fieldFilter.value"
:label="t('params.value')"
:disable="!fieldFilter.selectedField"
is-outlined
@keydown.enter="applyFieldFilters(params, searchFn)"
/>
</QItemSection>
<QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeFieldFilter(index, params, searchFn)"
/>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.isFloramondo')"
v-model="params.isFloramondo"
toggle-indeterminate
@update:model-value="searchFn()"
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
search: General search
categoryFk: Category
typeFk: Type
buyerFk: Buyer
supplierFk: Supplier
tags: Tags
tag: Tag
value: Value
isFloramondo: Floramondo
isActive: Active
description: Description
name: Name
id: Id
es:
More fields: Más campos
params:
search: Búsqueda general
categoryFk: Reino
typeFk: Tipo
buyerFk: Comprador
supplierFk: Proveedor
tags: Etiquetas
tag: Etiqueta
value: Valor
isFloramondo: Floramondo
isActive: Activo
description: Descripción
name: Nombre
id: Id
</i18n>