fix: solve conflicts from master to test
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2024-09-30 15:00:05 +02:00
parent e5eb1d7663
commit 2302e22f11
12 changed files with 86 additions and 63 deletions

View File

@ -310,8 +310,8 @@ defineExpose({
params, params,
}); });
function handleOnDataSaved(_) { function handleOnDataSaved(_, res) {
if (_.onDataSaved) _.onDataSaved(this); if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
else $props.create.onDataSaved(_); else $props.create.onDataSaved(_);
} }
</script> </script>

View File

@ -12,17 +12,48 @@ const props = defineProps({
default: null, default: null,
}, },
}); });
const modelValue = ref( const formatLocation = (obj, properties) => {
props.location const parts = properties.map((prop) => {
? `${props.location?.postcode}, ${props.location?.city}(${props.location?.province?.name}), ${props.location?.country?.name}` if (typeof prop === 'string') {
: null return obj[prop];
); } else if (typeof prop === 'function') {
function showLabel(data) { return prop(obj);
return `${data.code}, ${data.town}(${data.province}), ${data.country}`;
} }
return null;
});
const filteredParts = parts.filter(
(part) => part !== null && part !== undefined && part !== ''
);
return filteredParts.join(', ');
};
const locationProperties = [
'postcode',
(obj) =>
obj.city
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
: null,
(obj) => obj.country?.name,
];
const modelValue = ref(
props.location ? formatLocation(props.location, locationProperties) : null
);
const handleModelValue = (data) => { const handleModelValue = (data) => {
emit('update:model-value', data); emit('update:model-value', data);
}; };
function showLabel(data) {
const dataProperties = [
'code',
(obj) => (obj.town ? `${obj.town}(${obj.province})` : null),
'country',
];
return formatLocation(data, dataProperties);
}
</script> </script>
<template> <template>
<VnSelectDialog <VnSelectDialog

View File

@ -1076,7 +1076,7 @@ item:
producer: Producer producer: Producer
landed: Landed landed: Landed
fixedPrice: fixedPrice:
itemId: Item ID itemFk: Item ID
groupingPrice: Grouping price groupingPrice: Grouping price
packingPrice: Packing price packingPrice: Packing price
hasMinPrice: Has min price hasMinPrice: Has min price

View File

@ -1061,7 +1061,7 @@ item:
producer: Productor producer: Productor
landed: F. entrega landed: F. entrega
fixedPrice: fixedPrice:
itemId: ID Artículo itemFk: ID Artículo
groupingPrice: Precio grouping groupingPrice: Precio grouping
packingPrice: Precio packing packingPrice: Precio packing
hasMinPrice: Tiene precio mínimo hasMinPrice: Tiene precio mínimo

View File

@ -93,6 +93,7 @@ function handleLocation(data, location) {
<VnRow> <VnRow>
<VnLocation <VnLocation
:rules="validate('Worker.postcode')" :rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant', 'administrative']"
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]" :acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:location="data" :location="data"
@update:model-value="(location) => handleLocation(data, location)" @update:model-value="(location) => handleLocation(data, location)"

View File

@ -13,6 +13,7 @@ import VnTitle from 'src/components/common/VnTitle.vue';
import VnRow from 'src/components/ui/VnRow.vue'; import VnRow from 'src/components/ui/VnRow.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const grafanaUrl = 'https://grafana.verdnatura.es';
const $props = defineProps({ const $props = defineProps({
id: { id: {

View File

@ -429,10 +429,9 @@ function handleLocation(data, location) {
:params="{ :params="{
departmentCodes: ['VT', 'shopping'], departmentCodes: ['VT', 'shopping'],
}" }"
option-label="nickname"
option-value="id"
:fields="['id', 'nickname']" :fields="['id', 'nickname']"
sort-by="nickname ASC" sort-by="nickname ASC"
:use-like="false"
emit-value emit-value
auto-load auto-load
> >

View File

@ -3,7 +3,6 @@ import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { toCurrency, toDate, dateRange } from 'filters/index'; import { toCurrency, toDate, dateRange } from 'filters/index';
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue'; import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
@ -11,7 +10,6 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue'; import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue'; import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n(); const { t } = useI18n();
@ -192,11 +190,6 @@ function exprBuilder(param, value) {
</script> </script>
<template> <template>
<RightMenu>
<template #right-panel>
<CustomerNotificationsFilter data-key="CustomerDefaulter" />
</template>
</RightMenu>
<VnSubToolbar> <VnSubToolbar>
<template #st-data> <template #st-data>
<CustomerBalanceDueTotal :amount="balanceDueTotal" /> <CustomerBalanceDueTotal :amount="balanceDueTotal" />

View File

@ -36,23 +36,23 @@ const user = state.getUser();
const fixedPrices = ref([]); const fixedPrices = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const itemFixedPriceFilterRef = ref(); const itemFixedPriceFilterRef = ref();
const params = reactive({}); const params = reactive({});
const defaultColumnAttrs = {
align: 'left',
sortable: true,
};
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
params.warehouseFk = user.value.warehouseFk; params.warehouseFk = user.value.warehouseFk;
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
const defaultColumnAttrs = {
align: 'left',
sortable: true,
};
const columns = computed(() => [ const columns = computed(() => [
{ {
label: t('item.fixedPrice.itemId'), label: t('item.fixedPrice.itemFk'),
name: 'itemId', name: 'itemFk',
...defaultColumnAttrs, ...defaultColumnAttrs,
isId: true, isId: true,
cardVisible: true, cardVisible: true,
@ -426,7 +426,7 @@ function handleOnDataSave({ CrudModelRef }) {
:default-save="false" :default-save="false"
data-key="ItemFixedPrices" data-key="ItemFixedPrices"
url="FixedPrices/filter" url="FixedPrices/filter"
:order="['itemFk ASC']" :order="['description DESC']"
save-url="FixedPrices/crud" save-url="FixedPrices/crud"
:user-params="{ warehouseFk: user.warehouseFk }" :user-params="{ warehouseFk: user.warehouseFk }"
ref="tableRef" ref="tableRef"
@ -460,7 +460,7 @@ function handleOnDataSave({ CrudModelRef }) {
<QCheckbox flat v-model="scope.selected" /> <QCheckbox flat v-model="scope.selected" />
</template> </template>
<template #column-itemId="props"> <template #column-itemFk="props">
<VnSelect <VnSelect
style="max-width: 100px" style="max-width: 100px"
url="Items/withName" url="Items/withName"

View File

@ -84,6 +84,7 @@ function handleLocation(data, location) {
<VnRow> <VnRow>
<VnLocation <VnLocation
:rules="validate('Worker.postcode')" :rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]" :acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:location=" :location="
data.postalCode data.postalCode

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { onMounted, ref, computed } from 'vue'; import { onMounted, ref, computed } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import { dashIfEmpty, toDate, toCurrency } from 'src/filters'; import { dashIfEmpty, toDate, toCurrency } from 'src/filters';
@ -11,13 +11,15 @@ import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescripto
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import useNotify from 'src/composables/useNotify.js';
import { useArrayData } from 'composables/useArrayData';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const { notify } = useNotify();
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
@ -35,6 +37,8 @@ const ticket = computed(() => summaryRef.value?.entity);
const editableStates = ref([]); const editableStates = ref([]);
const ticketUrl = ref(); const ticketUrl = ref();
const grafanaUrl = 'https://grafana.verdnatura.es'; const grafanaUrl = 'https://grafana.verdnatura.es';
const stateBtnDropdownRef = ref();
const descriptorData = useArrayData('ticketData');
onMounted(async () => { onMounted(async () => {
ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/'; ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/';
@ -61,15 +65,19 @@ function isEditable() {
} }
async function changeState(value) { async function changeState(value) {
if (!ticket.value.id) return; try {
stateBtnDropdownRef.value.hide();
const formData = { const formData = {
ticketFk: ticket.value.id, ticketFk: entityId.value,
code: value, code: value,
}; };
await axios.post(`Tickets/state`, formData); await axios.post(`Tickets/state`, formData);
router.go(route.fullPath); notify('globals.dataSaved', 'positive');
summaryRef.value?.fetch();
descriptorData.fetch({});
} catch (err) {
console.error('Error changing ticket state', err);
}
} }
</script> </script>
@ -94,33 +102,21 @@ async function changeState(value) {
</template> </template>
<template #header-right> <template #header-right>
<QBtnDropdown <QBtnDropdown
side ref="stateBtnDropdownRef"
top
color="black" color="black"
text-color="white" text-color="white"
:label="t('ticket.summary.changeState')" :label="t('ticket.summary.changeState')"
:disable="!isEditable()" :disable="!isEditable()"
> >
<QList> <VnSelect
<QVirtualScroll :options="editableStates"
style="max-height: 300px" hide-selected
:items="editableStates" option-label="name"
separator option-value="code"
v-slot="{ item, index }" hide-dropdown-icon
> focus-on-mount
<QItem @update:model-value="changeState"
:key="index" />
dense
clickable
v-close-popup
@click="changeState(item.code)"
>
<QItemSection>
<QItemLabel>{{ item.name }}</QItemLabel>
</QItemSection>
</QItem>
</QVirtualScroll>
</QList>
</QBtnDropdown> </QBtnDropdown>
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">

View File

@ -262,6 +262,7 @@ async function autofillBic(worker) {
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnLocation <VnLocation
:roles-allowed-to-create="['deliveryAssistant']"
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]" :acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:options="postcodesOptions" :options="postcodesOptions"
@update:model-value="(location) => handleLocation(data, location)" @update:model-value="(location) => handleLocation(data, location)"