Merge branch 'master' into hotfix-7366-6943CreditBillingDataAWB
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
621d038133
|
@ -2,7 +2,7 @@
|
|||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useAttrs } from 'vue';
|
||||
import { useRequired } from 'src/composables/useRequired';
|
||||
const { t } = useI18n();
|
||||
|
@ -16,6 +16,14 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.location,
|
||||
(newValue) => {
|
||||
if (!modelValue.value) return;
|
||||
modelValue.value = formatLocation(newValue) ?? null;
|
||||
}
|
||||
);
|
||||
|
||||
const mixinRules = [requiredFieldRule];
|
||||
const locationProperties = [
|
||||
'postcode',
|
||||
|
@ -43,9 +51,7 @@ const formatLocation = (obj, properties = locationProperties) => {
|
|||
return filteredParts.join(', ');
|
||||
};
|
||||
|
||||
const modelValue = computed(() =>
|
||||
props.location ? formatLocation(props.location, locationProperties) : null
|
||||
);
|
||||
const modelValue = ref(props.location ? formatLocation(props.location) : null);
|
||||
|
||||
function showLabel(data) {
|
||||
const dataProperties = [
|
||||
|
|
|
@ -7,7 +7,14 @@ import useNotify from 'src/composables/useNotify.js';
|
|||
import axios from 'axios';
|
||||
|
||||
const { notify } = useNotify();
|
||||
|
||||
const initInvoicing = {
|
||||
invoicing: false,
|
||||
nRequests: 0,
|
||||
nPdfs: 0,
|
||||
totalPdfs: 0,
|
||||
addressIndex: 0,
|
||||
errors: [],
|
||||
};
|
||||
export const useInvoiceOutGlobalStore = defineStore({
|
||||
id: 'invoiceOutGlobal',
|
||||
state: () => ({
|
||||
|
@ -23,16 +30,11 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
addresses: [],
|
||||
minInvoicingDate: null,
|
||||
parallelism: null,
|
||||
invoicing: false,
|
||||
isInvoicing: false,
|
||||
status: null,
|
||||
addressIndex: 0,
|
||||
errors: [],
|
||||
|
||||
printer: null,
|
||||
nRequests: 0,
|
||||
nPdfs: 0,
|
||||
totalPdfs: 0,
|
||||
formData: null,
|
||||
...initInvoicing,
|
||||
}),
|
||||
actions: {
|
||||
async init() {
|
||||
|
@ -117,12 +119,13 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
);
|
||||
throw new Error("There aren't addresses to invoice");
|
||||
}
|
||||
this.invoicing = false;
|
||||
this.status = 'invoicing';
|
||||
this.formData = formData;
|
||||
this.addressIndex = 0;
|
||||
this.errors = [];
|
||||
await this.invoiceClient();
|
||||
this.status = 'invoicing';
|
||||
//reset data
|
||||
for (const key in initInvoicing) {
|
||||
this[key] = initInvoicing[key];
|
||||
}
|
||||
this.invoiceClient();
|
||||
} catch (err) {
|
||||
this.handleError(err);
|
||||
}
|
||||
|
@ -184,7 +187,6 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
async invoiceClient() {
|
||||
if (this.invoicing || this.nRequests >= this.parallelism) return;
|
||||
const address = this.addresses[this.addressIndex];
|
||||
|
||||
if (!address || !this.status || this.status == 'stopping') {
|
||||
this.status = 'stopping';
|
||||
this.invoicing = false;
|
||||
|
@ -192,6 +194,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
}
|
||||
try {
|
||||
this.invoicing = true;
|
||||
this.nRequests++;
|
||||
const params = {
|
||||
clientId: address.clientId,
|
||||
addressId: address.id,
|
||||
|
@ -215,6 +218,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
}
|
||||
} finally {
|
||||
this.invoicing = false;
|
||||
this.nRequests--;
|
||||
this.addressIndex++;
|
||||
this.invoiceClient();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue