0
0
Fork 0

Solucion a comentarios 19

This commit is contained in:
carlosfonseca 2024-02-22 13:49:06 -05:00
parent 9ae0874ccf
commit 2c70a73b8e
5 changed files with 27 additions and 14 deletions

View File

@ -67,7 +67,7 @@ body.body--dark {
} }
.card-width { .card-width {
width: 800px; width: 770px;
} }
.vn-card-list { .vn-card-list {

View File

@ -6,7 +6,6 @@ import { useRoute, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();

View File

@ -46,11 +46,11 @@ onMounted(() => {
</div> </div>
<div class="col-1 row justify-center items-center"> <div class="col-1 row justify-center items-center">
<QIcon <QIcon
name="delete" @click="customerContactsRef.remove([row])"
size="sm"
class="cursor-pointer" class="cursor-pointer"
color="primary" color="primary"
@click="customerContactsRef.remove([row])" name="delete"
size="sm"
> >
<QTooltip> <QTooltip>
{{ t('Remove contact') }} {{ t('Remove contact') }}
@ -60,11 +60,11 @@ onMounted(() => {
</VnRow> </VnRow>
<VnRow> <VnRow>
<QIcon <QIcon
name="add" @click="customerContactsRef.insert()"
size="sm"
class="cursor-pointer" class="cursor-pointer"
color="primary" color="primary"
@click="customerContactsRef.insert()" name="add"
size="sm"
> >
<QTooltip> <QTooltip>
{{ t('Add contact') }} {{ t('Add contact') }}

View File

@ -126,7 +126,7 @@ const columns = computed(() => [
</template> </template>
</FormModel> </FormModel>
<div class="full-width flex justify-center"> <div class="full-width flex justify-center" v-if="rows.length">
<QTable <QTable
:columns="columns" :columns="columns"
:pagination="{ rowsPerPage: 0 }" :pagination="{ rowsPerPage: 0 }"
@ -156,6 +156,10 @@ const columns = computed(() => [
</template> </template>
</QTable> </QTable>
</div> </div>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
</template> </template>
<i18n> <i18n>

View File

@ -30,6 +30,7 @@ const incoterms = ref([]);
const customsAgents = ref([]); const customsAgents = ref([]);
const observationTypes = ref([]); const observationTypes = ref([]);
const notes = ref([]); const notes = ref([]);
const deletes = ref([]);
onBeforeMount(() => { onBeforeMount(() => {
urlUpdate.value = `Clients/${route.params.id}/updateAddress/${route.params.addressId}`; urlUpdate.value = `Clients/${route.params.id}/updateAddress/${route.params.addressId}`;
@ -68,6 +69,7 @@ const getData = async (observations) => {
$orgIndex: null, $orgIndex: null,
addressFk: `${route.params.addressId}`, addressFk: `${route.params.addressId}`,
description: observation.description, description: observation.description,
id: observation.id,
observationTypeFk: type.id, observationTypeFk: type.id,
} }
: null; : null;
@ -88,15 +90,23 @@ const addNote = () => {
}); });
}; };
const deleteNote = (index) => { const deleteNote = (id, index) => {
deletes.value.push(id);
notes.value.splice(index, 1); notes.value.splice(index, 1);
}; };
const onDataSaved = async () => { const onDataSaved = async () => {
const payload = { let payload = {};
creates: notes.value, const creates = notes.value.filter((note) => note.$isNew);
}; if (creates.length) {
payload.creates = creates;
}
if (deletes.value.length) {
payload.deletes = deletes.value;
}
await axios.post('AddressObservations/crud', payload); await axios.post('AddressObservations/crud', payload);
notes.value = [];
deletes.value = [];
toCustomerAddress(); toCustomerAddress();
}; };
@ -347,7 +357,7 @@ const toCustomerAddress = () => {
</div> </div>
<div class="flex items-center"> <div class="flex items-center">
<QIcon <QIcon
@click.stop="deleteNote(index)" @click.stop="deleteNote(note.id, index)"
class="cursor-pointer" class="cursor-pointer"
color="primary" color="primary"
name="delete" name="delete"