forked from verdnatura/salix-front
feat: requested changes in item module
This commit is contained in:
parent
b4a4c4a0a4
commit
4276cefd7a
|
@ -610,6 +610,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
$props.rowClick && $props.rowClick(row);
|
||||
}
|
||||
"
|
||||
style="height: 100%"
|
||||
>
|
||||
<QCardSection
|
||||
vertical
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, onUnmounted, watch } from 'vue';
|
||||
import { ref, onUnmounted, watch, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
|
@ -369,6 +369,10 @@ async function clearFilter() {
|
|||
await applyFilter();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
stateStore.rightDrawer = false;
|
||||
});
|
||||
|
|
|
@ -127,7 +127,6 @@ async function search(evt) {
|
|||
userParams.value = newParams;
|
||||
|
||||
if (!$props.showAll && !Object.values(filter).length) store.data = [];
|
||||
emit('search');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
@ -397,8 +397,8 @@ entry:
|
|||
buys: Buys
|
||||
stickers: Stickers
|
||||
package: Package
|
||||
packing: Packing
|
||||
grouping: Grouping
|
||||
packing: Pack.
|
||||
grouping: Group.
|
||||
buyingValue: Buying value
|
||||
import: Import
|
||||
pvp: PVP
|
||||
|
|
|
@ -400,8 +400,8 @@ entry:
|
|||
buys: Compras
|
||||
stickers: Etiquetas
|
||||
package: Embalaje
|
||||
packing: Packing
|
||||
grouping: Grouping
|
||||
packing: Pack.
|
||||
grouping: Group.
|
||||
buyingValue: Coste
|
||||
import: Importe
|
||||
pvp: PVP
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
import { ref, nextTick } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const itemBarcodeRef = ref(null);
|
||||
|
||||
|
@ -23,6 +26,24 @@ const focusLastInput = () => {
|
|||
if (lastInput) lastInput.focus();
|
||||
});
|
||||
};
|
||||
|
||||
const removeRow = (row) => {
|
||||
itemBarcodeRef.value.remove([row]);
|
||||
};
|
||||
|
||||
const submit = async (rows) => {
|
||||
const params = rows[rows.length - 1];
|
||||
let { data } = await axios.get('ItemBarcodes');
|
||||
const code = params.code;
|
||||
|
||||
if (data.some((codes) => codes.code === code)) {
|
||||
notify(t('Codes can not be repeated'), 'negative');
|
||||
itemBarcodeRef.value.reset();
|
||||
return;
|
||||
}
|
||||
await axios.patch(`ItemBarcodes`, params);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<div class="full-width flex justify-center">
|
||||
|
@ -39,6 +60,7 @@ const focusLastInput = () => {
|
|||
ref="itemBarcodeRef"
|
||||
url="ItemBarcodes"
|
||||
auto-load
|
||||
:save-fn="submit"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QCard class="q-px-lg q-py-md">
|
||||
|
@ -54,7 +76,7 @@ const focusLastInput = () => {
|
|||
focusable-input
|
||||
/>
|
||||
<QIcon
|
||||
@click="itemBarcodeRef.remove([row])"
|
||||
@click="removeRow(row)"
|
||||
class="cursor-pointer q-ml-md"
|
||||
color="primary"
|
||||
name="delete"
|
||||
|
@ -89,4 +111,5 @@ es:
|
|||
Code: Código
|
||||
Remove barcode: Quitar código de barras
|
||||
Add barcode: Añadir código de barras
|
||||
Codes can not be repeated: Los códigos no puden ser repetidos
|
||||
</i18n>
|
||||
|
|
|
@ -70,6 +70,7 @@ const onIntrastatCreated = (response, formData) => {
|
|||
option-label="name"
|
||||
hide-selected
|
||||
map-options
|
||||
required
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, reactive } from 'vue';
|
||||
import { onMounted, ref, computed, reactive, watchEffect } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import axios from 'axios';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
|
||||
|
@ -21,8 +17,9 @@ const route = useRoute();
|
|||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
const rowsSelected = ref([]);
|
||||
const tableRef = ref();
|
||||
const selectedRows = ref([]);
|
||||
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
|
@ -36,6 +33,11 @@ const exprBuilder = (param, value) => {
|
|||
};
|
||||
|
||||
const params = reactive({ itemFk: route.params.id });
|
||||
const filter = reactive({
|
||||
where: {
|
||||
itemFk: route.params.id,
|
||||
},
|
||||
});
|
||||
|
||||
const arrayData = useArrayData('ItemShelvings', {
|
||||
url: 'ItemShelvingPlacementSupplyStocks',
|
||||
|
@ -44,123 +46,69 @@ const arrayData = useArrayData('ItemShelvings', {
|
|||
});
|
||||
const rows = computed(() => arrayData.store.data || []);
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await arrayData.addFilter({ filter: null, params });
|
||||
};
|
||||
|
||||
const getInputEvents = (col) => {
|
||||
return col.columnFilter.type === 'select'
|
||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
||||
: {
|
||||
'keyup.enter': () => applyColumnFilter(col),
|
||||
};
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('shelvings.created'),
|
||||
name: 'created',
|
||||
field: 'created',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
format: (val) => toDateFormat(val),
|
||||
columnFilter: false,
|
||||
format: (row) => toDateFormat(row.created),
|
||||
},
|
||||
|
||||
{
|
||||
label: t('shelvings.item'),
|
||||
name: 'item',
|
||||
field: 'itemFk',
|
||||
name: 'itemFk',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
label: t('shelvings.concept'),
|
||||
name: 'concept',
|
||||
name: 'longName',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: null,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
label: t('shelvings.parking'),
|
||||
name: 'parking',
|
||||
field: 'parking',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => dashIfEmpty(val),
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
url: 'parkings',
|
||||
fields: ['code'],
|
||||
'sort-by': 'code ASC',
|
||||
'option-value': 'code',
|
||||
'option-label': 'code',
|
||||
dense: true,
|
||||
},
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'parkings',
|
||||
fields: ['code'],
|
||||
'sort-by': 'code ASC',
|
||||
'option-value': 'code',
|
||||
'option-label': 'code',
|
||||
dense: true,
|
||||
},
|
||||
columnField: { component: null },
|
||||
},
|
||||
{
|
||||
label: t('shelvings.shelving'),
|
||||
name: 'shelving',
|
||||
field: 'shelving',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => dashIfEmpty(val),
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
url: 'shelvings',
|
||||
fields: ['code'],
|
||||
'sort-by': 'code ASC',
|
||||
'option-value': 'code',
|
||||
'option-label': 'code',
|
||||
dense: true,
|
||||
},
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'shelvings',
|
||||
fields: ['code'],
|
||||
'sort-by': 'code ASC',
|
||||
'option-value': 'code',
|
||||
'option-label': 'code',
|
||||
dense: true,
|
||||
},
|
||||
columnField: { component: null },
|
||||
},
|
||||
{
|
||||
label: t('shelvings.label'),
|
||||
name: 'label',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (_, row) => (row.stock / row.packing).toFixed(2),
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterParamKey: 'label',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
columnFilter: { inWhere: true },
|
||||
format: (row) => (row.stock / row.packing).toFixed(2),
|
||||
},
|
||||
{
|
||||
label: t('shelvings.packing'),
|
||||
field: 'packing',
|
||||
name: 'packing',
|
||||
attrs: { inWhere: true },
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -169,15 +117,16 @@ const totalLabels = computed(() =>
|
|||
);
|
||||
|
||||
const removeLines = async () => {
|
||||
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
||||
const itemShelvingIds = selectedRows.value.map((row) => row.itemShelvingFk);
|
||||
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
||||
rowsSelected.value = [];
|
||||
selectedRows.value = [];
|
||||
notify('shelvings.shelvingsRemoved', 'positive');
|
||||
await arrayData.fetch({ append: false });
|
||||
await tableRef.value.reload();
|
||||
};
|
||||
onMounted(async () => {
|
||||
await arrayData.fetch({ append: false });
|
||||
});
|
||||
watchEffect(selectedRows);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -203,7 +152,7 @@ onMounted(async () => {
|
|||
<QBtn
|
||||
color="primary"
|
||||
icon="delete"
|
||||
:disabled="!rowsSelected.length"
|
||||
:disabled="!hasSelectedCards"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('shelvings.removeConfirmTitle'),
|
||||
|
@ -219,41 +168,27 @@ onMounted(async () => {
|
|||
</Teleport>
|
||||
</template>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="ItemShelving"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
selection="multiple"
|
||||
v-model:selected="rowsSelected"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
:url="`ItemShelvingPlacementSupplyStocks`"
|
||||
:filter="filter"
|
||||
:expr-builder="exprBuilder"
|
||||
:right-search="false"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'itemShelvingFk',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
auto-load
|
||||
>
|
||||
<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-concept="{ row }">
|
||||
<QTd @click.stop>
|
||||
<span class="link">{{ row.longName }}</span>
|
||||
<template #column-longName="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.longName }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QTd>
|
||||
</span>
|
||||
</template>
|
||||
</QTable>
|
||||
</VnTable>
|
||||
</QPage>
|
||||
</template>
|
||||
|
|
|
@ -89,7 +89,7 @@ const getUrl = (id, param) => `#/Item/${id}/${param}`;
|
|||
<QCard class="vn-one">
|
||||
<VnTitle
|
||||
:url="getUrl(entityId, 'basic-data')"
|
||||
:text="t('item.summary.otherData')"
|
||||
:text="t('item.summary.basicData')"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('item.summary.intrastatCode')"
|
||||
|
|
|
@ -8,11 +8,12 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const itemTagsRef = ref(null);
|
||||
const tagOptions = ref([]);
|
||||
|
@ -60,6 +61,39 @@ const insertTag = (rows) => {
|
|||
itemTagsRef.value.formData[itemTagsRef.value.formData.length - 1].priority =
|
||||
getHighestPriority(rows);
|
||||
};
|
||||
|
||||
const submitTags = async (data) => {
|
||||
data.forEach((item, index) => {
|
||||
console.log(`Elemento ${index}:`, item.tag.name); // Muestra el valor de `value`
|
||||
if (!item.value) {
|
||||
console.error(`Elemento ${index} no tiene la propiedad "value".`);
|
||||
}
|
||||
});
|
||||
const tagNameCounts = data.reduce((counts, item) => {
|
||||
const tagName = item.tag.name; // Accede al nombre del tag
|
||||
counts[tagName] = (counts[tagName] || 0) + 1; // Incrementa el contador
|
||||
return counts;
|
||||
}, {});
|
||||
|
||||
// Filtra los nombres duplicados
|
||||
const duplicates = Object.keys(tagNameCounts).filter(
|
||||
(name) => tagNameCounts[name] > 1
|
||||
);
|
||||
|
||||
console.log('Nombres duplicados:', duplicates);
|
||||
|
||||
if (duplicates.length > 0) {
|
||||
notify(t('Tags can not be repeated'), 'negative');
|
||||
itemTagsRef.value.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
const params = {
|
||||
...data,
|
||||
};
|
||||
await axios.patch(`Tags/onSubmit`, params);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -189,3 +223,8 @@ const insertTag = (rows) => {
|
|||
</QPage>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Tags can not be repeated: Las etiquetas no pueden repetirse
|
||||
</i18n>
|
||||
|
|
|
@ -28,7 +28,7 @@ const taxesFilter = {
|
|||
],
|
||||
};
|
||||
|
||||
const ItemTaxRef = ref(null);
|
||||
const ItemTaxRef = ref();
|
||||
const taxesOptions = ref([]);
|
||||
|
||||
const submitTaxes = async (data) => {
|
||||
|
@ -36,7 +36,10 @@ const submitTaxes = async (data) => {
|
|||
id: tax.id,
|
||||
taxClassFk: tax.taxClassFk,
|
||||
}));
|
||||
|
||||
if (payload.some((item) => item.taxClassFk === null)) {
|
||||
notify(t('Tax class cannot be blank'), 'negative');
|
||||
return;
|
||||
}
|
||||
await axios.post(`Items/updateTaxes`, payload);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
};
|
||||
|
|
|
@ -413,7 +413,6 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
save-url="FixedPrices/crud"
|
||||
:user-params="{ warehouseFk: user.warehouseFk }"
|
||||
ref="tableRef"
|
||||
dense
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
auto-load
|
||||
|
|
|
@ -184,7 +184,7 @@ const columns = computed(() => [
|
|||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
label: t('globals.origin'),
|
||||
label: t('item.list.origin'),
|
||||
name: 'origin',
|
||||
align: 'left',
|
||||
component: 'select',
|
||||
|
@ -228,7 +228,8 @@ const columns = computed(() => [
|
|||
},
|
||||
},
|
||||
{
|
||||
label: t('item.list.weightByPiece'),
|
||||
label: t('item.list.weight'),
|
||||
toolTip: t('item.list.weightByPiece'),
|
||||
name: 'weightByPiece',
|
||||
align: 'left',
|
||||
component: 'input',
|
||||
|
@ -322,7 +323,6 @@ const columns = computed(() => [
|
|||
ref="tableRef"
|
||||
data-key="ItemList"
|
||||
url="Items/filter"
|
||||
url-create="Items"
|
||||
:create="{
|
||||
urlCreate: 'Items',
|
||||
title: t('Create Item'),
|
||||
|
@ -333,11 +333,10 @@ const columns = computed(() => [
|
|||
}"
|
||||
:order="['isActive DESC', 'name', 'id']"
|
||||
:columns="columns"
|
||||
auto-load
|
||||
redirect="Item"
|
||||
:is-editable="false"
|
||||
:right-search="false"
|
||||
:filer="itemFilter"
|
||||
:filter="itemFilter"
|
||||
>
|
||||
<template #column-id="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
@ -348,7 +347,7 @@ const columns = computed(() => [
|
|||
<template #column-userName="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.userName }}
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
<WorkerDescriptorProxy :id="row.buyerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-description="{ row }">
|
||||
|
|
|
@ -199,7 +199,17 @@ onMounted(async () => {
|
|||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
t(`params.${scope.opt?.name}`)
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -434,6 +444,13 @@ en:
|
|||
description: Description
|
||||
name: Name
|
||||
id: Id
|
||||
Accessories: Accessories
|
||||
Artificial: Artificial
|
||||
Flower: Flower
|
||||
Fruit: Fruit
|
||||
Green: Green
|
||||
Handmade: Handmade
|
||||
Plant: Plant
|
||||
es:
|
||||
More fields: Más campos
|
||||
params:
|
||||
|
@ -450,4 +467,11 @@ es:
|
|||
description: Descripción
|
||||
name: Nombre
|
||||
id: Id
|
||||
Accessories: Accesorios
|
||||
Artificial: Artificial
|
||||
Flower: Flor
|
||||
Fruit: Fruta
|
||||
Green: Verde
|
||||
Handmade: Hecho a mano
|
||||
Plant: Planta
|
||||
</i18n>
|
||||
|
|
|
@ -5,13 +5,16 @@ import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.v
|
|||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { dashIfEmpty, toCurrency } from 'filters/index';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import ItemRequestDenyForm from './ItemRequestDenyForm.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import ItemRequestFilter from './ItemRequestFilter.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -228,6 +231,11 @@ onMounted(async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<ItemRequestFilter data-key="itemRequest" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="itemRequest"
|
||||
|
@ -239,6 +247,7 @@ onMounted(async () => {
|
|||
auto-load
|
||||
:disable-option="{ card: true }"
|
||||
chip-locale="item.params"
|
||||
:right-search="false"
|
||||
>
|
||||
<template #column-ticketFk="{ row }">
|
||||
<span class="link">
|
||||
|
@ -306,30 +315,28 @@ onMounted(async () => {
|
|||
/>
|
||||
</template>
|
||||
<template #column-denyOptions="{ row, rowIndex }">
|
||||
<QTd class="sticky no-padding">
|
||||
<QIcon
|
||||
v-if="row.response?.length"
|
||||
name="insert_drive_file"
|
||||
color="primary"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ row.response }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.isOk == null"
|
||||
name="thumb_down"
|
||||
color="primary"
|
||||
size="sm"
|
||||
class="fill-icon"
|
||||
@click="showDenyRequestForm(row.id, rowIndex)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Discard') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
<QIcon
|
||||
v-if="row.response?.length"
|
||||
name="insert_drive_file"
|
||||
color="primary"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ row.response }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.isOk == null"
|
||||
name="thumb_down"
|
||||
color="primary"
|
||||
size="sm"
|
||||
class="fill-icon"
|
||||
@click="showDenyRequestForm(row.id, rowIndex)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Discard') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnTable>
|
||||
<QDialog ref="denyFormRef" transition-show="scale" transition-hide="scale">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { dateRange } from 'src/filters';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
|
@ -7,6 +7,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -21,7 +22,8 @@ const stateOptions = [
|
|||
{ code: 'accepted', name: t('accepted') },
|
||||
{ code: 'denied', name: t('denied') },
|
||||
];
|
||||
|
||||
const arrayData = useArrayData(props.dataKey);
|
||||
const fieldFiltersValues = ref([]);
|
||||
const itemTypesOptions = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
|
||||
|
@ -56,6 +58,22 @@ const decrement = (paramsObj, key) => {
|
|||
|
||||
paramsObj[key]--;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
// Fill fieldFiltersValues with existent userParams
|
||||
console.log('arrayData: ', arrayData.store?.userParams);
|
||||
if (arrayData.store?.userParams) {
|
||||
fieldFiltersValues.value = Object.entries(arrayData.store.userParams).map(
|
||||
([key, value]) => ({
|
||||
name: key,
|
||||
value,
|
||||
selectedField: { name: key, label: t(`params.${key}`) },
|
||||
})
|
||||
);
|
||||
}
|
||||
exprBuilder('state', arrayData.store?.userParams?.state);
|
||||
console.log('fieldFiltersValues.value: ', fieldFiltersValues.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -10,7 +10,6 @@ const { t } = useI18n();
|
|||
url="ItemTypes"
|
||||
:label="t('Search item type')"
|
||||
:info="t('Search itemType by id, name or code')"
|
||||
search-url="table"
|
||||
/>
|
||||
</template>
|
||||
<i18n>
|
||||
|
|
|
@ -6,6 +6,7 @@ import VnTable from 'components/VnTable/VnTable.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import ItemTypeFilter from './ItemType/ItemTypeFilter.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
|
@ -31,13 +32,14 @@ const columns = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
name: 'name',
|
||||
label: t('name'),
|
||||
label: t('globals.name'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('worker'),
|
||||
name: 'workerFk',
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
|
@ -45,20 +47,20 @@ const columns = computed(() => [
|
|||
optionLabel: 'nickname',
|
||||
optionValue: 'id',
|
||||
},
|
||||
format: (row) => row.worker?.user?.name,
|
||||
cardVisible: true,
|
||||
visible: true,
|
||||
columnField: {
|
||||
component: 'userLink',
|
||||
attrs: ({ row }) => {
|
||||
return {
|
||||
workerId: row?.worker?.id,
|
||||
name: row.worker?.user?.name,
|
||||
defaultName: true,
|
||||
};
|
||||
},
|
||||
},
|
||||
columnField: { component: null },
|
||||
columnFilter: {
|
||||
name: 'workerFk',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'buyer' },
|
||||
optionFilter: 'firstName',
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
useLike: false,
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -135,24 +137,27 @@ const columns = computed(() => [
|
|||
:columns="columns"
|
||||
auto-load
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
redirect="item/item-type"
|
||||
/>
|
||||
>
|
||||
<template #column-workerFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.worker?.user?.name }}
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
id: Id
|
||||
code: Código
|
||||
name: Nombre
|
||||
worker: Trabajador
|
||||
ItemCategory: Reino
|
||||
Temperature: Temperatura
|
||||
Create ItemTypes: Crear familia
|
||||
en:
|
||||
code: Code
|
||||
name: Name
|
||||
worker: Worker
|
||||
ItemCategory: ItemCategory
|
||||
Temperature: Temperature
|
||||
|
|
|
@ -95,6 +95,15 @@ item:
|
|||
mine: For me
|
||||
state: State
|
||||
myTeam: My team
|
||||
shipped: Shipped
|
||||
description: Description
|
||||
quantity: Quantity
|
||||
price: Price
|
||||
item: Item
|
||||
achieved: Achieved
|
||||
concept: Concept
|
||||
denyOptions: Deny
|
||||
scopeDays: Scope days
|
||||
searchbar:
|
||||
label: Search item
|
||||
descriptor:
|
||||
|
@ -112,7 +121,7 @@ item:
|
|||
title: All its properties will be copied
|
||||
subTitle: Do you want to clone this item?
|
||||
list:
|
||||
id: Identifier
|
||||
id: Id
|
||||
grouping: Grouping
|
||||
packing: Packing
|
||||
description: Description
|
||||
|
@ -122,8 +131,9 @@ item:
|
|||
intrastat: Intrastat
|
||||
isActive: Active
|
||||
size: Size
|
||||
origin: Origin
|
||||
origin: Orig.
|
||||
userName: Buyer
|
||||
weight: Weight
|
||||
weightByPiece: Weight/Piece
|
||||
stemMultiplier: Multiplier
|
||||
producer: Producer
|
||||
|
|
|
@ -97,6 +97,15 @@ item:
|
|||
mine: Para mi
|
||||
state: Estado
|
||||
myTeam: Mi equipo
|
||||
shipped: Enviado
|
||||
description: Descripción
|
||||
quantity: Cantidad
|
||||
price: Precio
|
||||
item: Artículo
|
||||
achieved: Conseguido
|
||||
concept: Concepto
|
||||
denyOptions: Denegado
|
||||
scopeDays: Días en adelante
|
||||
searchbar:
|
||||
label: Buscar artículo
|
||||
descriptor:
|
||||
|
@ -114,7 +123,7 @@ item:
|
|||
title: Todas sus propiedades serán copiadas
|
||||
subTitle: ¿Desea clonar este artículo?
|
||||
list:
|
||||
id: Identificador
|
||||
id: Id
|
||||
grouping: Grouping
|
||||
packing: Packing
|
||||
description: Descripción
|
||||
|
@ -124,7 +133,8 @@ item:
|
|||
intrastat: Intrastat
|
||||
isActive: Activo
|
||||
size: Medida
|
||||
origin: Origen
|
||||
origin: Orig.
|
||||
weight: Peso
|
||||
weightByPiece: Peso (gramos)/tallo
|
||||
userName: Comprador
|
||||
stemMultiplier: Multiplicador
|
||||
|
|
Loading…
Reference in New Issue