|
@ -1,9 +1,10 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, reactive, computed, onUnmounted, watch } from 'vue';
|
||||
import { ref, reactive, computed, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useQuasar } from 'quasar';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
@ -11,20 +12,30 @@ import { useState } from 'src/composables/useState';
|
|||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const state = useState();
|
||||
const { notify } = useNotify();
|
||||
const tableRef = ref();
|
||||
const editTableCellDialogRef = ref(null);
|
||||
const quasar = useQuasar();
|
||||
const user = state.getUser();
|
||||
const fixedPrices = ref([]);
|
||||
const fixedPricesOriginalData = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
|
||||
// function localUserData() {
|
||||
// state.setUser(user.value);
|
||||
// }
|
||||
|
||||
// const userLocal = localUserData();
|
||||
// console.log('localUserData', userLocal);
|
||||
|
||||
console.log('user', user.value.warehouseFk);
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'name':
|
||||
|
@ -80,6 +91,10 @@ const columns = computed(() => [
|
|||
name: 'description',
|
||||
align: 'left',
|
||||
create: true,
|
||||
columnCreate: {
|
||||
component: 'select',
|
||||
url: 'Items',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.groupingPrice'),
|
||||
|
@ -109,6 +124,9 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
create: true,
|
||||
format: (row) => toDate(row.started),
|
||||
columnCreate: {
|
||||
component: 'date',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.ended'),
|
||||
|
@ -116,6 +134,9 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
create: true,
|
||||
format: (row) => toDate(row.ended),
|
||||
columnCreate: {
|
||||
component: 'date',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.warehouse'),
|
||||
|
@ -148,6 +169,27 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
function confirmRemove(row) {
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('confirmDeletion'),
|
||||
message: t('confirmDeletionMessage'),
|
||||
promise: () => remove(row),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function remove(item) {
|
||||
await axios.post('FixedPrices/filter', {
|
||||
rows: [item.id],
|
||||
});
|
||||
quasar.notify({
|
||||
message: t('globals.dataDeleted'),
|
||||
type: 'positive',
|
||||
});
|
||||
tableRef.value.reload();
|
||||
}
|
||||
// const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||
// return inputType === 'text'
|
||||
// ? {
|
||||
|
@ -213,15 +255,6 @@ const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
|||
// fixedPrices.value.push(lastItemCopy);
|
||||
// };
|
||||
|
||||
// const openEditTableCellDialog = () => {
|
||||
// editTableCellDialogRef.value.show();
|
||||
// };
|
||||
|
||||
// const onEditCellDataSaved = async () => {
|
||||
// rowsSelected.value = [];
|
||||
// await fetchFixedPrices();
|
||||
// };
|
||||
|
||||
// const onWarehousesFetched = (data) => {
|
||||
// warehousesOptions.value = data;
|
||||
// // Actualiza las 'options' del elemento con field 'warehouseFk' en 'editTableFieldsOptions'.
|
||||
|
@ -259,6 +292,7 @@ const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
|||
ref="tableRef"
|
||||
data-key="ItemFixedPrices"
|
||||
url="FixedPrices/filter"
|
||||
:filter="{ where: { warehouseFk: user.warehouseFk } }"
|
||||
:create="{
|
||||
urlCreate: 'PriceFixed',
|
||||
title: 'Create Item',
|
||||
|
@ -273,7 +307,10 @@ const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
|||
>
|
||||
<template #column-description="{ row }">
|
||||
<div class="row column full-width justify-between items-start">
|
||||
{{ row?.name }}
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.name }}
|
||||
<ItemDescriptorProxy class="link" :id="row.itemFk" />
|
||||
</span>
|
||||
<div v-if="row?.subName" class="subName">
|
||||
{{ row?.subName.toUpperCase() }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue