diff --git a/src/pages/Item/ItemList.vue b/src/pages/Item/ItemList.vue index 9baf3061a..773cb0771 100644 --- a/src/pages/Item/ItemList.vue +++ b/src/pages/Item/ItemList.vue @@ -11,6 +11,7 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import ItemSummary from '../Item/Card/ItemSummary.vue'; +import VnPaginate from 'components/ui/VnPaginate.vue'; import { useStateStore } from 'stores/useStateStore'; import { toDate, toCurrency } from 'src/filters'; @@ -18,13 +19,16 @@ import { useSession } from 'composables/useSession'; import { dashIfEmpty } from 'src/filters'; import { useArrayData } from 'composables/useArrayData'; import { useSummaryDialog } from 'src/composables/useSummaryDialog'; +import { useVnConfirm } from 'composables/useVnConfirm'; +import axios from 'axios'; const router = useRouter(); -const session = useSession(); -const token = session.getToken(); +const { getTokenMultimedia } = useSession(); +const token = getTokenMultimedia(); const stateStore = useStateStore(); const { t } = useI18n(); const { viewSummary } = useSummaryDialog(); +const { openConfirmationModal } = useVnConfirm(); const itemTypesOptions = ref([]); const originsOptions = ref([]); @@ -66,13 +70,6 @@ const exprBuilder = (param, value) => { }; const params = reactive({}); -const arrayData = useArrayData('ItemList', { - url: 'Items/filter', - order: ['isActive DESC', 'name', 'id'], - exprBuilder: exprBuilder, -}); -const store = arrayData.store; -const rows = computed(() => store.data); // const getInputEvents = (col) => { // return col.columnFilter.type === 'select' @@ -389,15 +386,25 @@ const redirectToItemSummary = (id) => { // } // }; -const cloneRow = () => { - console.log('cloneRow'); +const cloneItem = async (itemFk) => { + try { + console.log('cloneRow: ', itemFk); + const { data } = await axios.post(`Items/${itemFk}/clone`); + if (!data) return; + router.push({ name: 'ItemTags', params: { id: data.id } }); + } catch (err) { + console.error('Error cloning row', err); + } +}; + +const test = (ev) => { + console.log('test: ', ev); }; onMounted(async () => { stateStore.rightDrawer = true; const filteredColumns = columns.value.filter((col) => col.name !== 'picture'); allColumnNames.value = filteredColumns.map((col) => col.name); - await arrayData.fetch({ append: false }); }); onUnmounted(() => (stateStore.rightDrawer = false)); @@ -440,23 +447,29 @@ onUnmounted(() => (stateStore.rightDrawer = false));
- - - - - - - - - - + + - + {{ t('New item') }} @@ -553,4 +575,8 @@ onUnmounted(() => (stateStore.rightDrawer = false)); es: New item: Nuevo artículo + 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? + Clone: Clonar + Preview: Vista previa