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,
});
function handleOnDataSaved(_) {
if (_.onDataSaved) _.onDataSaved(this);
function handleOnDataSaved(_, res) {
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
else $props.create.onDataSaved(_);
}
</script>

View File

@ -12,17 +12,48 @@ const props = defineProps({
default: null,
},
});
const formatLocation = (obj, properties) => {
const parts = properties.map((prop) => {
if (typeof prop === 'string') {
return obj[prop];
} else if (typeof prop === 'function') {
return prop(obj);
}
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
? `${props.location?.postcode}, ${props.location?.city}(${props.location?.province?.name}), ${props.location?.country?.name}`
: null
props.location ? formatLocation(props.location, locationProperties) : null
);
function showLabel(data) {
return `${data.code}, ${data.town}(${data.province}), ${data.country}`;
}
const handleModelValue = (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>
<template>
<VnSelectDialog

View File

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

View File

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

View File

@ -93,6 +93,7 @@ function handleLocation(data, location) {
<VnRow>
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant', 'administrative']"
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
:location="data"
@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';
const route = useRoute();
const { t } = useI18n();
const grafanaUrl = 'https://grafana.verdnatura.es';
const $props = defineProps({
id: {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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