Solucion a comentarios 6
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
c0a9835e80
commit
d0e98010a5
|
@ -15,6 +15,7 @@ const route = useRoute();
|
|||
const { notify } = useNotify();
|
||||
|
||||
let notes = reactive([]);
|
||||
let deletes = reactive([]);
|
||||
|
||||
const isLoading = ref(false);
|
||||
|
||||
|
@ -51,14 +52,16 @@ const addNote = ({ id, name, phone, isNew }) => {
|
|||
}
|
||||
};
|
||||
|
||||
const deleteNote = (index) => {
|
||||
const deleteNote = (note, index) => {
|
||||
deletes.push(note.id);
|
||||
notes.splice(index, 1);
|
||||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
isLoading.value = true;
|
||||
const payload = {
|
||||
creates: notes.filter((element) => element.$isNew),
|
||||
creates: notes.filter((element) => element.$isNew) || null,
|
||||
deletes: deletes || null,
|
||||
};
|
||||
try {
|
||||
await axios.post('ClientContacts/crud', payload);
|
||||
|
@ -91,7 +94,7 @@ const onSubmit = async () => {
|
|||
|
||||
<div class="flex items-center">
|
||||
<QIcon
|
||||
@click.stop="deleteNote(index)"
|
||||
@click.stop="deleteNote(note, index)"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
|
@ -13,8 +14,10 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const state = useState();
|
||||
|
@ -57,6 +60,7 @@ onBeforeMount(async () => {
|
|||
initialData.companyFk = companyFk;
|
||||
initialData.companyId = companyFk;
|
||||
initialData.recipient = data.email;
|
||||
initialData.recipientId = data.id;
|
||||
});
|
||||
|
||||
const setEmailUser = (data) => {
|
||||
|
@ -88,6 +92,32 @@ const onDataSaved = async ({
|
|||
});
|
||||
router.push({ name: 'CustomerSamples' });
|
||||
};
|
||||
|
||||
const getPreview = async () => {
|
||||
const { addressId, companyId, recipientId } = initialData;
|
||||
const path = `Clients/${route.params.id}/incoterms-authorization-html`;
|
||||
const params = {
|
||||
addressId,
|
||||
companyId,
|
||||
recipientId,
|
||||
};
|
||||
const queryParams = Object.keys(params)
|
||||
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
|
||||
.join('&');
|
||||
const url = `${path}?${queryParams}`;
|
||||
|
||||
try {
|
||||
const { data } = await axios.get(url);
|
||||
quasar.dialog({
|
||||
component: CustomerSamplesPreview,
|
||||
componentProps: {
|
||||
htmlContent: data,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -117,6 +147,7 @@ const onDataSaved = async ({
|
|||
/>
|
||||
|
||||
<FormModel
|
||||
:default-actions="false"
|
||||
:form-initial-data="initialData"
|
||||
:observe-form-changes="false"
|
||||
@on-data-saved="onDataSaved"
|
||||
|
@ -226,6 +257,34 @@ const onDataSaved = async ({
|
|||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('globals.cancel')"
|
||||
:loading="isLoading"
|
||||
class="q-mr-sm"
|
||||
color="primary"
|
||||
flat
|
||||
type="reset"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('Preview')"
|
||||
:loading="isLoading"
|
||||
@click.stop="getPreview()"
|
||||
class="q-mr-sm"
|
||||
color="primary"
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading || canChangePassword"
|
||||
:label="t('globals.save')"
|
||||
:loading="isLoading"
|
||||
color="primary"
|
||||
type="submit"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</FormModel>
|
||||
</template>
|
||||
|
@ -240,4 +299,5 @@ es:
|
|||
Since: Desde
|
||||
Its only used when sample is sent: Se utiliza únicamente cuando se envía la plantilla
|
||||
To who should the recipient replay?: ¿A quien debería responder el destinatario?
|
||||
Preview: Vista previa
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
|
||||
const { dialogRef } = useDialogPluginComponent();
|
||||
|
||||
const closeButton = ref(null);
|
||||
|
||||
const $props = defineProps({
|
||||
htmlContent: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef">
|
||||
<QCard class="q-pa-lg">
|
||||
<QCardSection>
|
||||
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
<div>{{ $props.htmlContent }}</div>
|
||||
<template>
|
||||
<div v-html="$props.htmlContent"></div>
|
||||
</template>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
Loading…
Reference in New Issue