fix: refs #7283 #7283 bugs
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-10-22 12:00:11 +02:00
parent 29a7f3b2fe
commit f3a6209189
2 changed files with 46 additions and 13 deletions

View File

@ -134,10 +134,10 @@ es:
Regularize stock: Regularizar stock
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?
warehouseText: Calculated on the warehouse of { warehouseName }
warehouseText: Calculado sobre el almacén de { warehouseName }
en:
warehouseText: Calculado sobre el almacén de { warehouseName }
warehouseText: Calculated on the warehouse of { warehouseName }
</i18n>
<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 ItemSummary from '../Item/Card/ItemSummary.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 { viewSummary } = useSummaryDialog();
@ -18,6 +21,7 @@ const router = useRouter();
const { t } = useI18n();
const tableRef = ref();
const route = useRoute();
const quasar = useQuasar();
const itemFilter = {
include: [
@ -53,10 +57,12 @@ const columns = computed(() => [
id: row?.id,
zoomResolution: '1600x900',
zoom: true,
class: 'rounded',
};
},
},
columnFilter: false,
cardVisible: true,
},
{
label: t('item.list.id'),
@ -66,6 +72,7 @@ const columns = computed(() => [
chip: {
condition: () => true,
},
cardVisible: true,
},
{
label: t('item.list.grouping'),
@ -93,6 +100,7 @@ const columns = computed(() => [
columnFilter: {
name: 'search',
},
cardVisible: true,
},
{
label: t('item.list.stems'),
@ -102,6 +110,7 @@ const columns = computed(() => [
component: 'number',
inWhere: true,
},
cardVisible: true,
},
{
label: t('item.list.size'),
@ -111,6 +120,7 @@ const columns = computed(() => [
component: 'number',
inWhere: true,
},
cardVisible: true,
},
{
label: t('item.list.typeName'),
@ -172,6 +182,7 @@ const columns = computed(() => [
component: null,
},
create: true,
cardVisible: true,
},
{
label: t('item.list.origin'),
@ -197,6 +208,7 @@ const columns = computed(() => [
component: null,
},
create: true,
cardVisible: true,
},
{
label: t('item.list.userName'),
@ -270,13 +282,14 @@ const columns = computed(() => [
name: 'tableActions',
actions: [
{
title: t('Clone item'),
title: t('globals.clone'),
icon: 'vn:clone',
action: cloneItem,
action: openCloneDialog,
isPrimary: true,
},
{
title: t('view Summary'),
title: t('components.smartCard.viewSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ItemSummary),
isPrimary: true,
@ -285,21 +298,34 @@ const columns = computed(() => [
},
]);
const cloneItem = async (itemFk) => {
const cloneItem = async () => {
try {
const { data } = await axios.post(`Items/${itemFk.id}/clone`);
if (!data) return;
const { data } = await axios.post(`Items/${entityId.value}/clone`);
router.push({ name: 'ItemTags', params: { id: data.id } });
} 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>
<template>
<VnSearchbar
data-key="ItemList"
:label="t('Search Item')"
:label="t('item.searchbar.label')"
:info="t('You can search by id')"
/>
<VnTable
@ -309,19 +335,25 @@ const cloneItem = async (itemFk) => {
url-create="Items"
:create="{
urlCreate: 'Items',
title: 'Create Item',
title: t('Create Item'),
onDataSaved: () => tableRef.redirect(),
formInitialData: {
editorFk: entityId,
},
}"
order="id ASC"
:order="['isActive DESC', 'name', 'id']"
:columns="columns"
auto-load
redirect="Item"
:is-editable="false"
:filer="itemFilter"
>
<template #column-id="{ row }">
<span class="link" @click.stop>
{{ row.id }}
<ItemDescriptorProxy :id="row.id" />
</span>
</template>
<template #column-userName="{ row }">
<span class="link" @click.stop>
{{ row.userName }}
@ -349,7 +381,8 @@ const cloneItem = async (itemFk) => {
<i18n>
es:
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?
Preview: Vista previa
Regularize stock: Regularizar stock
</i18n>