Merge branch 'dev' into Fix-TicketSale
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-10-01 09:53:34 +00:00
commit 6e4677848f
13 changed files with 70 additions and 34 deletions

View File

@ -317,8 +317,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>
@ -771,6 +771,16 @@ es:
color: var(--vn-text-color); color: var(--vn-text-color);
} }
.q-table--dark .q-table__bottom,
.q-table--dark thead,
.q-table--dark tr {
border-color: var(--vn-section-color);
}
.q-table__container > div:first-child {
background-color: var(--vn-page-color);
}
.grid-three { .grid-three {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, max-content)); grid-template-columns: repeat(auto-fit, minmax(400px, max-content));

View File

@ -12,6 +12,16 @@ const props = defineProps({
default: null, default: null,
}, },
}); });
const locationProperties = [
'postcode',
(obj) =>
obj.city
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
: null,
(obj) => obj.country?.name,
];
const formatLocation = (obj, properties) => { const formatLocation = (obj, properties) => {
const parts = properties.map((prop) => { const parts = properties.map((prop) => {
if (typeof prop === 'string') { if (typeof prop === 'string') {
@ -29,17 +39,10 @@ const formatLocation = (obj, properties) => {
return filteredParts.join(', '); 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( const modelValue = ref(
props.location ? formatLocation(props.location, locationProperties) : null props.location ? formatLocation(props.location, locationProperties) : null
); );
function showLabel(data) { function showLabel(data) {
const dataProperties = [ const dataProperties = [
'code', 'code',

View File

@ -406,6 +406,7 @@ watch(
:skeleton="false" :skeleton="false"
auto-load auto-load
@on-fetch="setLogTree" @on-fetch="setLogTree"
search-url="logs"
> >
<template #body> <template #body>
<div <div

View File

@ -18,6 +18,7 @@ const contactChannels = ref([]);
const title = ref(); const title = ref();
const handleSalesModelValue = (val) => ({ const handleSalesModelValue = (val) => ({
or: [ or: [
{ id: val },
{ name: val }, { name: val },
{ nickname: { like: '%' + val + '%' } }, { nickname: { like: '%' + val + '%' } },
{ code: { like: `${val}%` } }, { code: { like: `${val}%` } },

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

@ -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

@ -52,7 +52,22 @@ function handleLocation(data, location) {
:url-update="`Suppliers/${route.params.id}/updateFiscalData`" :url-update="`Suppliers/${route.params.id}/updateFiscalData`"
model="supplier" model="supplier"
:filter="{ :filter="{
fields: ['id', 'name', 'city', 'postCode', 'countryFk', 'provinceFk'], fields: [
'id',
'nif',
'city',
'name',
'account',
'postCode',
'countryFk',
'provinceFk',
'sageTaxTypeFk',
'sageWithholdingFk',
'sageTransactionTypeFk',
'supplierActivityFk',
'healthRegister',
'street',
],
include: [ include: [
{ {
relation: 'province', relation: 'province',
@ -146,6 +161,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="{ :location="{
postcode: data.postCode, postcode: data.postCode,

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import RouteDescriptorProxy from 'pages/Route/Card/RouteDescriptorProxy.vue'; import RouteDescriptorProxy from 'pages/Route/Card/RouteDescriptorProxy.vue';
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';
@ -12,6 +12,8 @@ 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';
@ -19,8 +21,7 @@ import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.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({
@ -38,6 +39,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 + '/';
@ -64,15 +67,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);
}
} }
function getNoteValue(description) { function getNoteValue(description) {
@ -125,6 +132,7 @@ function toTicketUrl(section) {
</template> </template>
<template #header-right> <template #header-right>
<QBtnDropdown <QBtnDropdown
ref="stateBtnDropdownRef"
color="black" color="black"
text-color="white" text-color="white"
:label="t('ticket.summary.changeState')" :label="t('ticket.summary.changeState')"
@ -137,7 +145,7 @@ function toTicketUrl(section) {
option-value="code" option-value="code"
hide-dropdown-icon hide-dropdown-icon
focus-on-mount focus-on-mount
@update:model-value="changeState(item.code)" @update:model-value="changeState"
/> />
</QBtnDropdown> </QBtnDropdown>
</template> </template>

View File

@ -214,6 +214,7 @@ async function autofillBic(worker) {
<VnInput v-model="data.name" :label="t('worker.create.webUser')" /> <VnInput v-model="data.name" :label="t('worker.create.webUser')" />
<VnInput <VnInput
v-model="data.email" v-model="data.email"
type="email"
:label="t('worker.create.personalEmail')" :label="t('worker.create.personalEmail')"
/> />
</VnRow> </VnRow>
@ -262,6 +263,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)"

View File

@ -59,7 +59,7 @@ export default {
component: () => import('src/pages/Entry/EntryLatestBuys.vue'), component: () => import('src/pages/Entry/EntryLatestBuys.vue'),
}, },
{ {
path: 'stock-bought', path: 'stock-Bought',
name: 'EntryStockBought', name: 'EntryStockBought',
meta: { meta: {
title: 'reserves', title: 'reserves',