8231_testToMaster_2448 #997

Merged
alexm merged 400 commits from 8231_testToMaster_2448 into master 2024-11-26 06:28:29 +00:00
2 changed files with 46 additions and 13 deletions
Showing only changes of commit f3a6209189 - Show all commits

View File

@ -134,10 +134,10 @@ es:
Regularize stock: Regularizar stock Regularize stock: Regularizar stock
All it's properties will be copied: Todas sus propiedades serán copiadas All it's properties will be copied: Todas sus propiedades serán copiadas
Do you want to clone this item?: ¿Desea clonar este artículo? Do you want to clone this item?: ¿Desea clonar este artículo?
warehouseText: Calculated on the warehouse of { warehouseName } warehouseText: Calculado sobre el almacén de { warehouseName }
en: en:
warehouseText: Calculado sobre el almacén de { warehouseName } warehouseText: Calculated on the warehouse of { warehouseName }
</i18n> </i18n>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -11,6 +11,9 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import ItemSummary from '../Item/Card/ItemSummary.vue'; import ItemSummary from '../Item/Card/ItemSummary.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
import VnConfirm from 'src/components/ui/VnConfirm.vue';
import { useQuasar } from 'quasar';
const entityId = computed(() => route.params.id); const entityId = computed(() => route.params.id);
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -18,6 +21,7 @@ const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
const route = useRoute(); const route = useRoute();
const quasar = useQuasar();
const itemFilter = { const itemFilter = {
include: [ include: [
@ -53,10 +57,12 @@ const columns = computed(() => [
id: row?.id, id: row?.id,
zoomResolution: '1600x900', zoomResolution: '1600x900',
zoom: true, zoom: true,
class: 'rounded',
}; };
}, },
}, },
columnFilter: false, columnFilter: false,
cardVisible: true,
}, },
{ {
label: t('item.list.id'), label: t('item.list.id'),
@ -66,6 +72,7 @@ const columns = computed(() => [
chip: { chip: {
condition: () => true, condition: () => true,
}, },
cardVisible: true,
}, },
{ {
label: t('item.list.grouping'), label: t('item.list.grouping'),
@ -93,6 +100,7 @@ const columns = computed(() => [
columnFilter: { columnFilter: {
name: 'search', name: 'search',
}, },
cardVisible: true,
}, },
{ {
label: t('item.list.stems'), label: t('item.list.stems'),
@ -102,6 +110,7 @@ const columns = computed(() => [
component: 'number', component: 'number',
inWhere: true, inWhere: true,
}, },
cardVisible: true,
}, },
{ {
label: t('item.list.size'), label: t('item.list.size'),
@ -111,6 +120,7 @@ const columns = computed(() => [
component: 'number', component: 'number',
inWhere: true, inWhere: true,
}, },
cardVisible: true,
}, },
{ {
label: t('item.list.typeName'), label: t('item.list.typeName'),
@ -172,6 +182,7 @@ const columns = computed(() => [
component: null, component: null,
}, },
create: true, create: true,
cardVisible: true,
}, },
{ {
label: t('item.list.origin'), label: t('item.list.origin'),
@ -197,6 +208,7 @@ const columns = computed(() => [
component: null, component: null,
}, },
create: true, create: true,
cardVisible: true,
}, },
{ {
label: t('item.list.userName'), label: t('item.list.userName'),
@ -270,13 +282,14 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('Clone item'), title: t('globals.clone'),
icon: 'vn:clone', icon: 'vn:clone',
action: cloneItem, action: openCloneDialog,
isPrimary: true, isPrimary: true,
}, },
{ {
title: t('view Summary'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, ItemSummary), action: (row) => viewSummary(row.id, ItemSummary),
isPrimary: true, isPrimary: true,
@ -285,21 +298,34 @@ const columns = computed(() => [
}, },
]); ]);
const cloneItem = async (itemFk) => { const cloneItem = async () => {
try { try {
const { data } = await axios.post(`Items/${itemFk.id}/clone`); const { data } = await axios.post(`Items/${entityId.value}/clone`);
if (!data) return;
router.push({ name: 'ItemTags', params: { id: data.id } }); router.push({ name: 'ItemTags', params: { id: data.id } });
} catch (err) { } catch (err) {
console.error('Error cloning item', err); console.error('Error cloning item');
} }
}; };
const openCloneDialog = async () => {
quasar
.dialog({
component: VnConfirm,
componentProps: {
title: t('All its properties will be copied'),
message: t('Do you want to clone this item?'),
},
})
.onOk(async () => {
await cloneItem();
});
};
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
data-key="ItemList" data-key="ItemList"
:label="t('Search Item')" :label="t('item.searchbar.label')"
:info="t('You can search by id')" :info="t('You can search by id')"
/> />
<VnTable <VnTable
@ -309,19 +335,25 @@ const cloneItem = async (itemFk) => {
url-create="Items" url-create="Items"
:create="{ :create="{
urlCreate: 'Items', urlCreate: 'Items',
title: 'Create Item', title: t('Create Item'),
onDataSaved: () => tableRef.redirect(), onDataSaved: () => tableRef.redirect(),
formInitialData: { formInitialData: {
editorFk: entityId, editorFk: entityId,
}, },
}" }"
order="id ASC" :order="['isActive DESC', 'name', 'id']"
:columns="columns" :columns="columns"
auto-load auto-load
redirect="Item" redirect="Item"
:is-editable="false" :is-editable="false"
:filer="itemFilter" :filer="itemFilter"
> >
<template #column-id="{ row }">
<span class="link" @click.stop>
{{ row.id }}
<ItemDescriptorProxy :id="row.id" />
</span>
</template>
<template #column-userName="{ row }"> <template #column-userName="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.userName }} {{ row.userName }}
@ -349,7 +381,8 @@ const cloneItem = async (itemFk) => {
<i18n> <i18n>
es: es:
New item: Nuevo artículo New item: Nuevo artículo
All it's properties will be copied: Todas sus propiedades serán copiadas All its properties will be copied: Todas sus propiedades serán copiadas
Do you want to clone this item?: ¿Desea clonar este artículo? Do you want to clone this item?: ¿Desea clonar este artículo?
Preview: Vista previa Preview: Vista previa
Regularize stock: Regularizar stock
</i18n> </i18n>