parent
d8b80cfa6d
commit
1c8eabe293
|
@ -1,20 +1,18 @@
|
|||
<script setup>
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
||||
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import axios from 'axios';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -40,9 +38,8 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { openCloneDialog } = cloneItem();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const warehouseConfig = ref(null);
|
||||
const entityId = computed(() => {
|
||||
|
@ -96,29 +93,6 @@ const updateStock = async () => {
|
|||
const openRegularizeStockForm = () => {
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
@ -144,7 +118,7 @@ const openCloneDialog = async () => {
|
|||
</QDialog>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="openCloneDialog()">
|
||||
<QItem v-ripple clickable @click="openCloneDialog(entityId)">
|
||||
<QItemSection>
|
||||
{{ t('globals.clone') }}
|
||||
</QItemSection>
|
||||
|
|
|
@ -1,27 +1,24 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
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 VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import axios from 'axios';
|
||||
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
||||
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);
|
||||
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||
|
||||
const entityId = computed(() => route.params.id);
|
||||
const { openCloneDialog } = cloneItem();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const route = useRoute();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const itemFilter = {
|
||||
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>
|
||||
|
||||
<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