Merge branch 'master' into Hotfix-VnDmsList
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
295d514457
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
|
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, watch, computed, ref } from 'vue';
|
import { watch, ref, onMounted } from 'vue';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useState } from 'src/composables/useState';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import VnDescriptor from './VnDescriptor.vue';
|
import VnDescriptor from './VnDescriptor.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -20,39 +18,50 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const state = useState();
|
|
||||||
const route = useRoute();
|
|
||||||
let arrayData;
|
let arrayData;
|
||||||
let store;
|
let store;
|
||||||
let entity;
|
const entity = ref();
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
const containerRef = ref(null);
|
||||||
defineExpose({ getData });
|
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onMounted(async () => {
|
||||||
arrayData = useArrayData($props.dataKey, {
|
let isPopup;
|
||||||
|
let el = containerRef.value.$el;
|
||||||
|
while (el) {
|
||||||
|
if (el.classList?.contains('q-menu')) {
|
||||||
|
isPopup = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
el = el.parentElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayData = useArrayData($props.dataKey + (isPopup ? 'Proxy' : ''), {
|
||||||
url: $props.url,
|
url: $props.url,
|
||||||
userFilter: $props.filter,
|
userFilter: $props.filter,
|
||||||
skip: 0,
|
skip: 0,
|
||||||
oneRecord: true,
|
oneRecord: true,
|
||||||
});
|
});
|
||||||
store = arrayData.store;
|
store = arrayData.store;
|
||||||
entity = computed(() => {
|
|
||||||
const data = store.data ?? {};
|
|
||||||
if (data) emit('onFetch', data);
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
|
|
||||||
// It enables to load data only once if the module is the same as the dataKey
|
|
||||||
if (!isSameDataKey.value || !route.params.id) await getData();
|
|
||||||
watch(
|
watch(
|
||||||
() => [$props.url, $props.filter],
|
() => [$props.url, $props.filter],
|
||||||
async () => {
|
async () => {
|
||||||
if (!isSameDataKey.value) await getData();
|
await getData();
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => arrayData.store.data,
|
||||||
|
(newValue) => {
|
||||||
|
entity.value = newValue;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
defineExpose({ getData });
|
||||||
|
const emit = defineEmits(['onFetch']);
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
store.url = $props.url;
|
store.url = $props.url;
|
||||||
store.filter = $props.filter ?? {};
|
store.filter = $props.filter ?? {};
|
||||||
|
@ -60,18 +69,15 @@ async function getData() {
|
||||||
try {
|
try {
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
const { data } = store;
|
const { data } = store;
|
||||||
state.set($props.dataKey, data);
|
|
||||||
emit('onFetch', data);
|
emit('onFetch', data);
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch']);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey">
|
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey" ref="containerRef">
|
||||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,11 +4,6 @@ import AccountSummary from './AccountSummary.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy style="max-width: 10px">
|
<QPopupProxy style="max-width: 10px">
|
||||||
<AccountDescriptor
|
<AccountDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="AccountSummary" />
|
||||||
v-if="$attrs.id"
|
|
||||||
v-bind="$attrs"
|
|
||||||
:summary="AccountSummary"
|
|
||||||
:proxy-render="true"
|
|
||||||
/>
|
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toDateHourMinSec, toPercentage } from 'src/filters';
|
import { toDateHourMinSec, toPercentage } from 'src/filters';
|
||||||
|
@ -9,7 +9,6 @@ import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/Departme
|
||||||
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
|
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||||
import filter from './ClaimFilter.js';
|
import filter from './ClaimFilter.js';
|
||||||
|
|
||||||
|
@ -23,7 +22,6 @@ const $props = defineProps({
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const salixUrl = ref();
|
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
@ -37,10 +35,6 @@ const STATE_COLOR = {
|
||||||
function stateColor(code) {
|
function stateColor(code) {
|
||||||
return STATE_COLOR[code];
|
return STATE_COLOR[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
salixUrl.value = await getUrl('');
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -133,7 +127,7 @@ onMounted(async () => {
|
||||||
size="md"
|
size="md"
|
||||||
icon="assignment"
|
icon="assignment"
|
||||||
color="primary"
|
color="primary"
|
||||||
:href="salixUrl + 'ticket/' + entity.ticketFk + '/sale-tracking'"
|
:to="{ name: 'TicketSaleTracking', params: { id: entity.ticketFk } }"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('claim.saleTracking') }}</QTooltip>
|
<QTooltip>{{ t('claim.saleTracking') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
@ -141,7 +135,7 @@ onMounted(async () => {
|
||||||
size="md"
|
size="md"
|
||||||
icon="visibility"
|
icon="visibility"
|
||||||
color="primary"
|
color="primary"
|
||||||
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'"
|
:to="{ name: 'TicketTracking', params: { id: entity.ticketFk } }"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('claim.ticketTracking') }}</QTooltip>
|
<QTooltip>{{ t('claim.ticketTracking') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -4,11 +4,6 @@ import ClaimSummary from './ClaimSummary.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy style="max-width: 10px">
|
<QPopupProxy style="max-width: 10px">
|
||||||
<ClaimDescriptor
|
<ClaimDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ClaimSummary" />
|
||||||
v-if="$attrs.id"
|
|
||||||
v-bind="$attrs.id"
|
|
||||||
:summary="ClaimSummary"
|
|
||||||
:proxy-render="true"
|
|
||||||
/>
|
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -77,10 +77,10 @@ const isDefaultAddress = (address) => {
|
||||||
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setDefault = (address) => {
|
const setDefault = async (address) => {
|
||||||
const url = `Clients/${route.params.id}`;
|
const url = `Clients/${route.params.id}`;
|
||||||
const payload = { defaultAddressFk: address.id };
|
const payload = { defaultAddressFk: address.id };
|
||||||
axios.patch(url, payload).then((res) => {
|
await axios.patch(url, payload).then((res) => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
client.value.defaultAddressFk = res.data.defaultAddressFk;
|
client.value.defaultAddressFk = res.data.defaultAddressFk;
|
||||||
sortAddresses();
|
sortAddresses();
|
||||||
|
|
|
@ -30,7 +30,6 @@ const $props = defineProps({
|
||||||
:dated="dated"
|
:dated="dated"
|
||||||
:sale-fk="saleFk"
|
:sale-fk="saleFk"
|
||||||
:warehouse-fk="warehouseFk"
|
:warehouse-fk="warehouseFk"
|
||||||
:proxy-render="true"
|
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,11 +4,6 @@ import ParkingSummary from './ParkingSummary.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy style="max-width: 10px">
|
<QPopupProxy style="max-width: 10px">
|
||||||
<ParkingDescriptor
|
<ParkingDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ParkingSummary" />
|
||||||
v-if="$attrs.id"
|
|
||||||
v-bind="$attrs.id"
|
|
||||||
:summary="ParkingSummary"
|
|
||||||
:proxy-render="true"
|
|
||||||
/>
|
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -416,13 +416,6 @@ async function getZone(options) {
|
||||||
:rules="validate('ticketList.shipped')"
|
:rules="validate('ticketList.shipped')"
|
||||||
@update:model-value="setShipped"
|
@update:model-value="setShipped"
|
||||||
/>
|
/>
|
||||||
<VnInputTime
|
|
||||||
:label="t('basicData.shippedHour')"
|
|
||||||
v-model="formData.shipped"
|
|
||||||
:required="true"
|
|
||||||
:rules="validate('basicData.shippedHour')"
|
|
||||||
@update:model-value="setShipped"
|
|
||||||
/>
|
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('basicData.landed')"
|
:label="t('basicData.landed')"
|
||||||
v-model="formData.landed"
|
v-model="formData.landed"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -30,31 +29,29 @@ const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const newTicketFormData = reactive({});
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
||||||
const createTicket = async () => {
|
async function createTicket(formData) {
|
||||||
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
||||||
const params = {
|
const params = {
|
||||||
clientId: $props.ticket.clientFk,
|
clientId: $props.ticket.clientFk,
|
||||||
landed: newTicketFormData.landed,
|
landed: formData.landed,
|
||||||
warehouseId: $props.ticket.warehouseFk,
|
warehouseId: $props.ticket.warehouseFk,
|
||||||
addressId: $props.ticket.addressFk,
|
addressId: $props.ticket.addressFk,
|
||||||
agencyModeId: $props.ticket.agencyModeFk,
|
agencyModeId: $props.ticket.agencyModeFk,
|
||||||
routeId: newTicketFormData.routeFk,
|
routeId: formData.routeFk,
|
||||||
expeditionIds: expeditionIds,
|
expeditionIds: expeditionIds,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
model="expeditionNewTicket"
|
model="expeditionNewTicket"
|
||||||
:form-initial-data="newTicketFormData"
|
:form-initial-data="{}"
|
||||||
:save-fn="createTicket"
|
:save-fn="createTicket"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
|
|
|
@ -89,7 +89,7 @@ const ticketColumns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('advanceTickets.import'),
|
label: t('advanceTickets.import'),
|
||||||
name: 'import',
|
name: 'totalWithVat',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
headerClass: 'horizontal-separator',
|
headerClass: 'horizontal-separator',
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
|
@ -317,7 +317,7 @@ watch(
|
||||||
</QBadge>
|
</QBadge>
|
||||||
<span v-else> {{ dashIfEmpty(row.state) }}</span>
|
<span v-else> {{ dashIfEmpty(row.state) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-import="{ row }">
|
<template #column-totalWithVat="{ row }">
|
||||||
<QBadge
|
<QBadge
|
||||||
:text-color="
|
:text-color="
|
||||||
totalPriceColor(row.totalWithVat) === 'warning'
|
totalPriceColor(row.totalWithVat) === 'warning'
|
||||||
|
|
Loading…
Reference in New Issue