8231_testToMaster_2448 #997
|
@ -1,9 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, reactive, computed, onUnmounted, watch } from 'vue';
|
import { ref, reactive, computed, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
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 VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
@ -11,20 +12,30 @@ import { useState } from 'src/composables/useState';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
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 { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const editTableCellDialogRef = ref(null);
|
const quasar = useQuasar();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const fixedPrices = ref([]);
|
const fixedPrices = ref([]);
|
||||||
const fixedPricesOriginalData = ref([]);
|
const fixedPricesOriginalData = ref([]);
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const rowsSelected = 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) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'name':
|
case 'name':
|
||||||
|
@ -80,6 +91,10 @@ const columns = computed(() => [
|
||||||
name: 'description',
|
name: 'description',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
create: true,
|
create: true,
|
||||||
|
columnCreate: {
|
||||||
|
component: 'select',
|
||||||
|
url: 'Items',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.groupingPrice'),
|
label: t('item.fixedPrice.groupingPrice'),
|
||||||
|
@ -109,6 +124,9 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
create: true,
|
create: true,
|
||||||
format: (row) => toDate(row.started),
|
format: (row) => toDate(row.started),
|
||||||
|
columnCreate: {
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.ended'),
|
label: t('item.fixedPrice.ended'),
|
||||||
|
@ -116,6 +134,9 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
create: true,
|
create: true,
|
||||||
format: (row) => toDate(row.ended),
|
format: (row) => toDate(row.ended),
|
||||||
|
columnCreate: {
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.warehouse'),
|
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') => {
|
// const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||||
// return inputType === 'text'
|
// return inputType === 'text'
|
||||||
// ? {
|
// ? {
|
||||||
|
@ -213,15 +255,6 @@ const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
||||||
// fixedPrices.value.push(lastItemCopy);
|
// fixedPrices.value.push(lastItemCopy);
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// const openEditTableCellDialog = () => {
|
|
||||||
// editTableCellDialogRef.value.show();
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const onEditCellDataSaved = async () => {
|
|
||||||
// rowsSelected.value = [];
|
|
||||||
// await fetchFixedPrices();
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const onWarehousesFetched = (data) => {
|
// const onWarehousesFetched = (data) => {
|
||||||
// warehousesOptions.value = data;
|
// warehousesOptions.value = data;
|
||||||
// // Actualiza las 'options' del elemento con field 'warehouseFk' en 'editTableFieldsOptions'.
|
// // Actualiza las 'options' del elemento con field 'warehouseFk' en 'editTableFieldsOptions'.
|
||||||
|
@ -259,6 +292,7 @@ const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="ItemFixedPrices"
|
data-key="ItemFixedPrices"
|
||||||
url="FixedPrices/filter"
|
url="FixedPrices/filter"
|
||||||
|
:filter="{ where: { warehouseFk: user.warehouseFk } }"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'PriceFixed',
|
urlCreate: 'PriceFixed',
|
||||||
title: 'Create Item',
|
title: 'Create Item',
|
||||||
|
@ -273,7 +307,10 @@ const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
||||||
>
|
>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<div class="row column full-width justify-between items-start">
|
<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">
|
<div v-if="row?.subName" class="subName">
|
||||||
{{ row?.subName.toUpperCase() }}
|
{{ row?.subName.toUpperCase() }}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue