diff --git a/src/boot/qformMixin.js b/src/boot/qformMixin.js index fc7852369b..8d009dbeac 100644 --- a/src/boot/qformMixin.js +++ b/src/boot/qformMixin.js @@ -8,7 +8,7 @@ export default { // TODO: AUTOFOCUS IS NOT FOCUSING const that = this; this.$el.addEventListener('keyup', function (evt) { - if (evt.key === 'Enter') { + if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) { const input = evt.target; if (input.type == 'textarea' && evt.shiftKey) { evt.preventDefault(); diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index d3d6708f0b..c656fcb2f9 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -25,7 +25,6 @@ const townsFetchDataRef = ref(false); const townFilter = ref({}); const countriesRef = ref(false); -const provincesFetchDataRef = ref(false); const provincesOptions = ref([]); const townsOptions = ref([]); const town = ref({}); @@ -71,9 +70,6 @@ async function setProvince(id, data) { await fetchTowns(); } async function onProvinceCreated(data) { - await provincesFetchDataRef.value.fetch({ - where: { countryFk: postcodeFormData.countryFk }, - }); postcodeFormData.provinceFk = data.id; } function provinceByCountry(countryFk = postcodeFormData.countryFk) { @@ -92,7 +88,6 @@ function setTown(newTown, data) { data.countryFk = newTown?.province?.countryFk ?? newTown; } async function onCityCreated(newTown, formData) { - await provincesFetchDataRef.value.fetch(); newTown.province = provincesOptions.value.find( (province) => province.id === newTown.provinceFk ); @@ -125,14 +120,6 @@ async function filterTowns(name) { diff --git a/src/pages/Item/ItemType/Card/ItemTypeSummary.vue b/src/pages/Item/ItemType/Card/ItemTypeSummary.vue index c51d59e137..9ba774ca46 100644 --- a/src/pages/Item/ItemType/Card/ItemTypeSummary.vue +++ b/src/pages/Item/ItemType/Card/ItemTypeSummary.vue @@ -78,29 +78,32 @@ async function setItemTypeData(data) { {{ t('globals.summary.basicData') }} - - - - + + + + - + - - + + diff --git a/src/pages/Item/ItemType/locale/en.yml b/src/pages/Item/ItemType/locale/en.yml index 575d5e4027..99c6791f2e 100644 --- a/src/pages/Item/ItemType/locale/en.yml +++ b/src/pages/Item/ItemType/locale/en.yml @@ -1,16 +1,17 @@ -shared: - code: Code - name: Name - worker: Worker - category: Category - temperature: Temperature - life: Life - itemPackingType: Item packing type - maxRefs: Maximum references - fragile: Fragile -summary: - id: id - life: Life - promo: Promo - itemPackingType: Item packing type - isUnconventionalSize: Is unconventional size +itemType: + shared: + code: Code + name: Name + worker: Worker + category: Category + temperature: Temperature + life: Life + itemPackingType: Item packing type + maxRefs: Maximum references + fragile: Fragile + summary: + id: id + life: Life + promo: Promo + itemPackingType: Item packing type + isUnconventionalSize: Is unconventional size diff --git a/src/pages/Item/ItemType/locale/es.yml b/src/pages/Item/ItemType/locale/es.yml index 93f8b0d0e0..c91fb40583 100644 --- a/src/pages/Item/ItemType/locale/es.yml +++ b/src/pages/Item/ItemType/locale/es.yml @@ -1,16 +1,17 @@ -shared: - code: Código - name: Nombre - worker: Trabajador - category: Reino - temperature: Temperatura - life: Vida - itemPackingType: Tipo de embalaje - maxRefs: Referencias máximas - fragile: Frágil -summary: - id: id - life: Vida - promo: Promoción - itemPackingType: Tipo de embalaje - isUnconventionalSize: Es de tamaño poco convencional +itemType: + shared: + code: Código + name: Nombre + worker: Trabajador + category: Reino + temperature: Temperatura + life: Vida + itemPackingType: Tipo de embalaje + maxRefs: Referencias máximas + fragile: Frágil + summary: + id: id + life: Vida + promo: Promoción + itemPackingType: Tipo de embalaje + isUnconventionalSize: Es de tamaño poco convencional diff --git a/src/pages/Route/RouteExtendedList.vue b/src/pages/Route/RouteExtendedList.vue index dbf646935a..38e907ce04 100644 --- a/src/pages/Route/RouteExtendedList.vue +++ b/src/pages/Route/RouteExtendedList.vue @@ -223,10 +223,10 @@ function navigate(id) { router.push({ path: `/route/${id}` }); } -const cloneRoutes = () => { +const cloneRoutes = async () => { if (!selectedRows.value.length || !startingDate.value) return; - axios.post('Routes/clone', { - created: startingDate.value, + await axios.post('Routes/clone', { + dated: startingDate.value, ids: selectedRows.value.map((row) => row?.id), }); startingDate.value = null; @@ -274,7 +274,6 @@ const openTicketsDialog = (id) => {

{{ t('route.Select the starting date') }}

- -import { ref, computed, onMounted, onUnmounted, watch } from 'vue'; +import { ref, computed, onMounted, onUnmounted, nextTick } from 'vue'; import { useI18n } from 'vue-i18n'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; @@ -10,37 +10,15 @@ import { useStateStore } from 'stores/useStateStore'; import { toCurrency } from 'filters/index'; import { useRole } from 'src/composables/useRole'; -const $props = defineProps({ - formData: { - type: Object, - required: true, - }, - haveNegatives: { - type: Boolean, - required: true, - default: false, - }, -}); - -const emit = defineEmits(['updateForm', 'update:haveNegatives']); +const haveNegatives = defineModel('haveNegatives', { type: Boolean, required: true }); +const formData = defineModel({ type: Object, required: true }); const stateStore = useStateStore(); const { t } = useI18n(); const { hasAny } = useRole(); -const _ticketData = ref($props.formData); const ticketUpdateActions = ref(null); -const haveNegatives = computed({ - get: () => $props.haveNegatives, - set: (val) => emit('update:haveNegatives', val), -}); -const rows = computed(() => _ticketData.value?.sale?.items || []); - -watch( - () => _ticketData.value, - (val) => emit('updateForm', val), - { deep: true } -); +const rows = computed(() => formData.value?.sale?.items || []); const columns = computed(() => [ { @@ -57,24 +35,28 @@ const columns = computed(() => [ align: 'left', hidden: true, }, + { + name: 'subName', + align: 'left', + required: true, + }, { label: t('basicData.movable'), name: 'movable', - align: 'left', }, { required: true, label: t('basicData.quantity'), name: 'quantity', field: 'quantity', - align: 'left', + classes: 'number', }, { required: true, label: t('basicData.pricePPU'), name: 'price', field: 'price', - align: 'left', + classes: 'number', format: (val) => toCurrency(val), }, { @@ -82,7 +64,7 @@ const columns = computed(() => [ label: t('basicData.newPricePPU'), name: 'newPrice', field: (row) => row.component.newPrice, - align: 'left', + classes: 'number', format: (val) => toCurrency(val), }, { @@ -90,14 +72,15 @@ const columns = computed(() => [ label: t('basicData.difference'), name: 'difference', field: (row) => row.component.difference, - align: 'left', + classes: 'number', format: (val) => toCurrency(val), + autoWidth: true, }, ]); const loadDefaultTicketAction = () => { const isSalesAssistant = hasAny(['salesAssistant']); - _ticketData.value.option = isSalesAssistant ? 'mana' : 'renewPrices'; + formData.value.option = isSalesAssistant ? 'mana' : 'renewPrices'; }; const totalPrice = computed(() => { @@ -115,24 +98,25 @@ const totalDifference = computed(() => { return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0); }); const showMovableColumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : [])); -const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences); -const ticketHaveNegatives = () => { +const haveDifferences = computed(() => formData.value.sale?.haveDifferences); +async function ticketHaveNegatives() { let _haveNegatives = false; let haveNotNegatives = false; - _ticketData.value.withoutNegatives = false; - _ticketData.value?.sale?.items.forEach((item) => { + formData.value.withoutNegatives = false; + formData.value?.sale?.items.forEach((item) => { if (item.quantity > item.movable) _haveNegatives = true; else haveNotNegatives = true; }); haveNegatives.value = _haveNegatives && haveNotNegatives && haveDifferences.value; - if (haveNegatives.value) _ticketData.value.withoutNegatives = true; -}; + await nextTick(); + if (haveNegatives.value) formData.value.withoutNegatives = true; +} -onMounted(() => { +onMounted(async () => { stateStore.rightDrawer = true; loadDefaultTicketAction(); - ticketHaveNegatives(); + await ticketHaveNegatives(); }); onUnmounted(() => (stateStore.rightDrawer = false)); @@ -191,7 +175,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); horizontal > (stateStore.rightDrawer = false)); @@ -225,7 +209,7 @@ onUnmounted(() => (stateStore.rightDrawer = false)); :columns="columns" row-key="id" :pagination="{ rowsPerPage: 0 }" - class="full-width q-mt-md" + class="full-width" :no-data-label="t('globals.noResults')" flat > @@ -238,21 +222,27 @@ onUnmounted(() => (stateStore.rightDrawer = false)); -