forked from verdnatura/salix-front
refs #6664 popup
This commit is contained in:
parent
ceeba871ce
commit
f2006663b7
|
@ -2,6 +2,7 @@
|
|||
import { ref } from 'vue';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -28,6 +29,7 @@ const props = defineProps({
|
|||
required: false,
|
||||
default: null,
|
||||
},
|
||||
callbackFn: Function,
|
||||
});
|
||||
|
||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||
|
@ -37,12 +39,17 @@ const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
|||
const title = props.title || t('Confirm');
|
||||
const message = props.message || t('Are you sure you want to continue?');
|
||||
const isLoading = ref(false);
|
||||
|
||||
onMounted(() => {
|
||||
if (props.callbackFn) props.callbackFn();
|
||||
});
|
||||
async function confirm() {
|
||||
let html = null;
|
||||
html = document.getElementById(props.data.inputId);
|
||||
isLoading.value = true;
|
||||
if (props.promise) {
|
||||
try {
|
||||
await props.promise(props.data);
|
||||
if (html) await props.promise({ ...props.data, return: html.value });
|
||||
else await props.promise(props.data);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
@ -66,7 +73,7 @@ async function confirm() {
|
|||
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
|
||||
</QCardSection>
|
||||
<QCardSection class="row items-center">
|
||||
<span v-html="message"></span>
|
||||
<span id="spanHTML" v-html="message"></span>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn
|
||||
|
|
|
@ -37,6 +37,7 @@ const marker_labels = [
|
|||
{ value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.summary.company') },
|
||||
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.summary.person') },
|
||||
];
|
||||
const portesMultiplicator = ref();
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
|
@ -140,22 +141,27 @@ async function regularizeClaim() {
|
|||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('confirmGreuges'),
|
||||
message: t('confirmGreugesMessage'),
|
||||
message: `
|
||||
<input class="q-field__native q-m-md" type="number" placeholder="1" id="multiplicatorValue" name="multiplicatorValue" min="0" max="50"/>
|
||||
`,
|
||||
data: { inputId: 'multiplicatorValue' },
|
||||
promise: onUpdateGreugeAccept,
|
||||
},
|
||||
})
|
||||
.onOk(async () => await onUpdateGreugeAccept());
|
||||
}
|
||||
}
|
||||
|
||||
async function onUpdateGreugeAccept() {
|
||||
async function onUpdateGreugeAccept({ return: multiplicatorValue }) {
|
||||
const greugeTypeFreightId = (
|
||||
await axios.get(`GreugeTypes/findOne`, {
|
||||
filter: { where: { code: 'freightPickUp' } },
|
||||
})
|
||||
).data.id;
|
||||
const freightPickUpPrice = (await axios.get(`GreugeConfigs/findOne`)).data
|
||||
.freightPickUpPrice;
|
||||
|
||||
const freightPickUpPrice =
|
||||
(await axios.get(`GreugeConfigs/findOne`)).data.freightPickUpPrice *
|
||||
+multiplicatorValue;
|
||||
console.log(freightPickUpPrice);
|
||||
await axios.post(`Greuges`, {
|
||||
clientFk: claim.value.clientFk,
|
||||
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
|
||||
|
|
Loading…
Reference in New Issue