Solucion a comentarios 13
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
d0cf13d0af
commit
bb10714824
|
@ -231,7 +231,7 @@ export default {
|
||||||
businessType: 'Tipo de negocio',
|
businessType: 'Tipo de negocio',
|
||||||
contact: 'Contacto',
|
contact: 'Contacto',
|
||||||
youCanSaveMultipleEmails:
|
youCanSaveMultipleEmails:
|
||||||
'Puedeguardar varios correos electrónicos encadenandolos mediante comas sin espacios, ejemplo: user@dominio.com,user2@dominio.com siendo el primer correo electrónico el principal',
|
'Puede guardar varios correos electrónicos encadenandolos mediante comas sin espacios, ejemplo: user@dominio.com,user2@dominio.com siendo el primer correo electrónico el principal',
|
||||||
email: 'Email',
|
email: 'Email',
|
||||||
phone: 'Teléfono',
|
phone: 'Teléfono',
|
||||||
mobile: 'Móvil',
|
mobile: 'Móvil',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, reactive, ref } from 'vue';
|
import { onBeforeMount, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
@ -14,10 +14,9 @@ const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
let notes = reactive([]);
|
|
||||||
let deletes = reactive([]);
|
|
||||||
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
let notes = ref([]);
|
||||||
|
let deletes = ref([]);
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
getData();
|
getData();
|
||||||
|
@ -31,7 +30,7 @@ const getData = async () => {
|
||||||
const { data } = await axios.get('ClientContacts', {
|
const { data } = await axios.get('ClientContacts', {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
notes.length = 0;
|
notes.value.length = 0;
|
||||||
data.forEach((element) => {
|
data.forEach((element) => {
|
||||||
element.isNew = false;
|
element.isNew = false;
|
||||||
addNote(element);
|
addNote(element);
|
||||||
|
@ -39,33 +38,36 @@ const getData = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const addNote = ({ id, name, phone, isNew }) => {
|
const addNote = ({ id, name, phone, isNew }) => {
|
||||||
if (!notes.some((note) => note.id === id)) {
|
notes.value.push({
|
||||||
notes.push({
|
id,
|
||||||
id,
|
$isNew: isNew,
|
||||||
$isNew: isNew,
|
name,
|
||||||
name,
|
phone,
|
||||||
phone,
|
$oldData: null,
|
||||||
$oldData: null,
|
$orgIndex: null,
|
||||||
$orgIndex: null,
|
clientFk: Number(route.params.id),
|
||||||
clientFk: route.params.id,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteNote = (note, index) => {
|
const deleteNote = (note, index) => {
|
||||||
deletes.push(note.id);
|
deletes.value.push(note.id);
|
||||||
notes.splice(index, 1);
|
notes.value.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const payload = {
|
let payload = {};
|
||||||
creates: notes.filter((element) => element.$isNew) || null,
|
const creates = notes.value.filter((element) => element.$isNew);
|
||||||
deletes: deletes || null,
|
if (creates.length) {
|
||||||
};
|
payload.creates = creates;
|
||||||
|
}
|
||||||
|
if (deletes.value.length) {
|
||||||
|
payload.deletes = deletes.value;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await axios.post('ClientContacts/crud', payload);
|
await axios.post('ClientContacts/crud', payload);
|
||||||
notes = [];
|
notes.value = [];
|
||||||
|
deletes.value = [];
|
||||||
notify('globals.dataCreated', 'positive');
|
notify('globals.dataCreated', 'positive');
|
||||||
await getData();
|
await getData();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ const refreshData = () => {
|
||||||
>
|
>
|
||||||
<template #body-cell="props">
|
<template #body-cell="props">
|
||||||
<QTd :props="props">
|
<QTd :props="props">
|
||||||
<QTr :props="props" class="cursor-pointer">
|
<QTr :props="props">
|
||||||
<component
|
<component
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
:is="tableColumnComponents[props.col.name].component"
|
||||||
@click="tableColumnComponents[props.col.name].event(props)"
|
@click="tableColumnComponents[props.col.name].event(props)"
|
||||||
|
|
|
@ -31,7 +31,6 @@ const setClientsConfirmTransaction = async () => {
|
||||||
<div v-if="!$props?.transaction?.isConfirmed">
|
<div v-if="!$props?.transaction?.isConfirmed">
|
||||||
<QIcon
|
<QIcon
|
||||||
@click.stop="setClientsConfirmTransaction"
|
@click.stop="setClientsConfirmTransaction"
|
||||||
class="cursor-pointer"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
name="check"
|
name="check"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
@ -43,5 +42,5 @@ const setClientsConfirmTransaction = async () => {
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Confirm transaction: Transacción confirmada
|
Confirm transaction: Confirmar transacción
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue