diff --git a/src/pages/Customer/Card/CustomerContacts.vue b/src/pages/Customer/Card/CustomerContacts.vue
index 47ba2eebf..b7aed488c 100644
--- a/src/pages/Customer/Card/CustomerContacts.vue
+++ b/src/pages/Customer/Card/CustomerContacts.vue
@@ -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 () => {
{
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;
+ }
+};
@@ -117,6 +147,7 @@ const onDataSaved = async ({
/>
+
+
+
+
+
+
@@ -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
diff --git a/src/pages/Customer/components/CustomerSamplesPreview.vue b/src/pages/Customer/components/CustomerSamplesPreview.vue
new file mode 100644
index 000000000..a9905cd42
--- /dev/null
+++ b/src/pages/Customer/components/CustomerSamplesPreview.vue
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+ {{ $props.htmlContent }}
+
+
+
+
+
+
+