parent
d8b80cfa6d
commit
1c8eabe293
|
@ -1,20 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
|
|
||||||
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
|
||||||
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
||||||
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -40,9 +38,8 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const { openCloneDialog } = cloneItem();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const warehouseConfig = ref(null);
|
const warehouseConfig = ref(null);
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
|
@ -96,29 +93,6 @@ const updateStock = async () => {
|
||||||
const openRegularizeStockForm = () => {
|
const openRegularizeStockForm = () => {
|
||||||
regularizeStockFormDialog.value.show();
|
regularizeStockFormDialog.value.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
const cloneItem = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axios.post(`Items/${entityId.value}/clone`);
|
|
||||||
router.push({ name: 'ItemTags', params: { id: data.id } });
|
|
||||||
} catch (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>
|
||||||
|
@ -144,7 +118,7 @@ const openCloneDialog = async () => {
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable @click="openCloneDialog()">
|
<QItem v-ripple clickable @click="openCloneDialog(entityId)">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('globals.clone') }}
|
{{ t('globals.clone') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -1,27 +1,24 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import axios from 'axios';
|
|
||||||
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
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 ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
const entityId = computed(() => route.params.id);
|
|
||||||
|
|
||||||
|
const entityId = computed(() => route.params.id);
|
||||||
|
const { openCloneDialog } = cloneItem();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
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: [
|
||||||
|
@ -297,29 +294,6 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const cloneItem = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axios.post(`Items/${entityId.value}/clone`);
|
|
||||||
router.push({ name: 'ItemTags', params: { id: data.id } });
|
|
||||||
} catch (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>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
import { computed, ref, onMounted } from 'vue';
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
|
||||||
|
export function cloneItem() {
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
const cloneItem = async (entityId) => {
|
||||||
|
const { id } = entityId;
|
||||||
|
try {
|
||||||
|
const { data } = await axios.post(`Items/${id ?? entityId}/clone`);
|
||||||
|
router.push({ name: 'ItemTags', params: { id: data.id } });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error cloning item');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const openCloneDialog = async (entityId) => {
|
||||||
|
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(entityId);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return { openCloneDialog };
|
||||||
|
}
|
Loading…
Reference in New Issue