0
0
Fork 0

Solucion a comentarios 11

This commit is contained in:
carlosfonseca 2024-02-16 13:12:57 -05:00
parent 17a0afda73
commit ebd1ee07f4
15 changed files with 267 additions and 151 deletions

View File

@ -154,6 +154,7 @@ export default {
customerId: 'Claim ID', customerId: 'Claim ID',
salesPerson: 'Sales person', salesPerson: 'Sales person',
credit: 'Credit', credit: 'Credit',
risk: 'Risk',
securedCredit: 'Secured credit', securedCredit: 'Secured credit',
payMethod: 'Pay method', payMethod: 'Pay method',
debt: 'Debt', debt: 'Debt',

View File

@ -153,6 +153,7 @@ export default {
customerId: 'ID cliente', customerId: 'ID cliente',
salesPerson: 'Comercial', salesPerson: 'Comercial',
credit: 'Crédito', credit: 'Crédito',
risk: 'Riesgo',
securedCredit: 'Crédito asegurado', securedCredit: 'Crédito asegurado',
payMethod: 'Método de pago', payMethod: 'Método de pago',
debt: 'Riesgo', debt: 'Riesgo',

View File

@ -77,9 +77,20 @@ const onSubmit = async () => {
</script> </script>
<template> <template>
<Teleport to="#st-actions">
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
@click="onSubmit"
color="primary"
icon="save"
/>
</Teleport>
<QCard class="q-pa-lg"> <QCard class="q-pa-lg">
<QCardSection> <QCardSection>
<QForm @submit.prevent="onSubmit"> <QForm>
<VnRow <VnRow
:key="index" :key="index"
class="row q-gutter-md q-mb-md" class="row q-gutter-md q-mb-md"
@ -113,28 +124,16 @@ const onSubmit = async () => {
</div> </div>
</VnRow> </VnRow>
<div class="flex justify-between q-mt-xl"> <QIcon
<div class="flex items-center"> @click.stop="addNote({ name: '', phone: '', isNew: true })"
<QIcon class="cursor-pointer add-icon q-mt-lg"
@click.stop="addNote({ name: '', phone: '', isNew: true })" name="add"
class="cursor-pointer add-icon" size="sm"
name="add" >
size="sm" <QTooltip>
> {{ t('Add contact') }}
<QTooltip> </QTooltip>
{{ t('Add contact') }} </QIcon>
</QTooltip>
</QIcon>
</div>
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
:disabled="isLoading"
:loading="isLoading"
/>
</div>
</QForm> </QForm>
</QCardSection> </QCardSection>
</QCard> </QCard>

View File

@ -57,7 +57,21 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
/> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('customer.card.credit')" :value="toCurrency(entity.credit)" /> <VnLv
:label="t('customer.card.credit')"
:value="toCurrency(entity.credit)"
class="col-11"
/>
<div class="row">
<VnLv
:label="t('customer.card.risk')"
:value="toCurrency(entity.debt)"
class="col-11"
/>
<QIcon name="info" size="xs" class="col-1 color-vn-label">
<QTooltip>{{ t('info') }}</QTooltip>
</QIcon>
</div>
<VnLv <VnLv
:label="t('customer.card.securedCredit')" :label="t('customer.card.securedCredit')"
:value="toCurrency(entity.creditInsurance)" :value="toCurrency(entity.creditInsurance)"
@ -155,11 +169,13 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
{ {
"en": { "en": {
"ticketList": "Customer ticket list", "ticketList": "Customer ticket list",
"invoiceOutList": "Customer invoice out list" "invoiceOutList": "Customer invoice out list",
"info": "Invoices minus payments plus orders not yet"
}, },
"es": { "es": {
"ticketList": "Listado de tickets del cliente", "ticketList": "Listado de tickets del cliente",
"invoiceOutList": "Listado de facturas del cliente" "invoiceOutList": "Listado de facturas del cliente",
"info": "Facturas menos recibos mas pedidos sin facturar"
} }
} }
</i18n> </i18n>

View File

@ -45,16 +45,17 @@ const showChangePasswordDialog = () => {
componentProps: { componentProps: {
id: route.params.id, id: route.params.id,
userPasswords: userPasswords.value, userPasswords: userPasswords.value,
promise: getData, promise: usersPreviewRef.value.fetch(),
}, },
}); });
}; };
const getData = (data) => { const setInitialData = () => {
active.value = data[0].active; if (user.value.length) {
email.value = data[0].email; active.value = user.value[0].active;
name.value = data[0].name; email.value = user.value[0].email;
user.value = data[0]; name.value = user.value[0].name;
}
}; };
const onSubmit = async () => { const onSubmit = async () => {
@ -80,7 +81,12 @@ const onSubmit = async () => {
<template> <template>
<FetchData <FetchData
:filter="filter" :filter="filter"
@on-fetch="getData" @on-fetch="
(data) => {
user = data;
setInitialData();
}
"
auto-load auto-load
ref="usersPreviewRef" ref="usersPreviewRef"
url="VnUsers/preview" url="VnUsers/preview"
@ -96,9 +102,42 @@ const onSubmit = async () => {
url="UserPasswords" url="UserPasswords"
/> />
<Teleport to="#st-actions">
<QBtnGroup push class="q-gutter-x-sm">
<QBtn
:disabled="isLoading"
:label="t('globals.reset')"
:loading="isLoading"
@click="setInitialData"
color="primary"
flat
icon="restart_alt"
type="reset"
/>
<QBtn
:disabled="isLoading"
:label="t('Change password')"
:loading="isLoading"
@click.stop="showChangePasswordDialog()"
color="primary"
flat
icon="edit"
v-if="canChangePassword"
/>
<QBtn
:disabled="isLoading || !dataChanges"
:label="t('globals.save')"
:loading="isLoading"
@click="onSubmit"
color="primary"
icon="save"
/>
</QBtnGroup>
</Teleport>
<QCard class="q-pa-lg"> <QCard class="q-pa-lg">
<QCardSection> <QCardSection>
<QForm @submit.prevent="onSubmit"> <QForm>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<QCheckbox :label="t('Enable web access')" v-model="active" /> <QCheckbox :label="t('Enable web access')" v-model="active" />
@ -129,35 +168,6 @@ const onSubmit = async () => {
</VnInput> </VnInput>
</div> </div>
</VnRow> </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('Change password')"
:loading="isLoading"
@click.stop="showChangePasswordDialog()"
class="q-mr-sm"
color="primary"
v-if="canChangePassword"
/>
<QBtn
:disabled="isLoading || !dataChanges"
:label="t('globals.save')"
:loading="isLoading"
color="primary"
type="submit"
/>
</div>
</QForm> </QForm>
</QCardSection> </QCardSection>
</QCard> </QCard>

View File

@ -95,6 +95,16 @@ const toCustomerAddress = () => {
@on-data-saved="toCustomerAddress()" @on-data-saved="toCustomerAddress()"
model="client" model="client"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerAddress"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { onBeforeMount, 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, useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
@ -16,6 +16,7 @@ import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCus
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const townsFetchDataRef = ref(null); const townsFetchDataRef = ref(null);
const postcodeFetchDataRef = ref(null); const postcodeFetchDataRef = ref(null);
@ -91,11 +92,21 @@ const deleteNote = (index) => {
notes.value.splice(index, 1); notes.value.splice(index, 1);
}; };
const onDataSaved = () => { const onDataSaved = async () => {
const payload = { const payload = {
creates: notes.value, creates: notes.value,
}; };
axios.post('AddressObservations/crud', payload); await axios.post('AddressObservations/crud', payload);
toCustomerAddress();
};
const toCustomerAddress = () => {
router.push({
name: 'CustomerAddress',
params: {
id: route.params.id,
},
});
}; };
</script> </script>
@ -138,6 +149,16 @@ const onDataSaved = () => {
auto-load auto-load
model="client" model="client"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerAddress"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">

View File

@ -16,8 +16,8 @@ const initialData = reactive({
clientFK: Number(route.params.id), clientFK: Number(route.params.id),
}); });
const onDataSaved = () => { const toCustomerCreditContracts = () => {
router.push({ name: 'CustomerCreditContractsCreate' }); router.push({ name: 'CustomerCreditContracts' });
}; };
</script> </script>
@ -27,8 +27,18 @@ const onDataSaved = () => {
:observe-form-changes="false" :observe-form-changes="false"
:default-actions="true" :default-actions="true"
url-create="creditClassifications/createWithInsurance" url-create="creditClassifications/createWithInsurance"
@on-data-saved="onDataSaved()" @on-data-saved="toCustomerCreditContracts()"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerCreditContracts"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">

View File

@ -31,6 +31,16 @@ const toCustomerCredits = () => {
:url-update="`/Clients/${route.params.id}`" :url-update="`/Clients/${route.params.id}`"
@on-data-saved="toCustomerCredits()" @on-data-saved="toCustomerCredits()"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerCredits"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">

View File

@ -26,6 +26,7 @@ const filterFindOne = { where: { code: 'paymentsLaw' } };
const filterCompanies = { order: ['code'] }; const filterCompanies = { order: ['code'] };
const filterWarehouses = { order: ['name'] }; const filterWarehouses = { order: ['name'] };
const inputFileRef = ref();
const client = ref({}); const client = ref({});
const findOne = ref([]); const findOne = ref([]);
const allowedContentTypes = ref([]); const allowedContentTypes = ref([]);
@ -67,13 +68,15 @@ const saveData = async () => {
params: dms.value, params: dms.value,
}); });
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
router.push({ name: 'CustomerFileManagement' }); toCustomerFileManagement();
} catch (error) { } catch (error) {
notify(error.message, 'negative'); notify(error.message, 'negative');
} }
}; };
const inputFileRef = ref(); const toCustomerFileManagement = () => {
router.push({ name: 'CustomerFileManagement' });
};
</script> </script>
<template> <template>
@ -112,9 +115,31 @@ const inputFileRef = ref();
url="DmsTypes" url="DmsTypes"
/> />
<QForm> <Teleport to="#st-actions">
<QCard class="q-pa-lg"> <QBtnGroup push class="q-gutter-x-sm">
<QCardSection> <QBtn
:disabled="isLoading"
:label="t('globals.cancel')"
:loading="isLoading"
@click="toCustomerFileManagement"
color="primary"
flat
icon="close"
/>
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
@click.stop="saveData"
color="primary"
icon="save"
/>
</QBtnGroup>
</Teleport>
<QCard class="q-pa-lg">
<QCardSection>
<QForm>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnInput <VnInput
@ -210,27 +235,9 @@ const inputFileRef = ref();
:label="t('Generate identifier for original file')" :label="t('Generate identifier for original file')"
v-model="dms.hasFile" v-model="dms.hasFile"
/> />
</QCardSection> </QForm>
</QCardSection>
<QCardActions class="flex justify-end"> </QCard>
<QBtn
:disabled="isLoading"
:label="t('globals.cancel')"
:loading="isLoading"
class="q-mr-xl"
color="primary"
flat
/>
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
color="primary"
@click.stop="saveData"
/>
</QCardActions>
</QCard>
</QForm>
</template> </template>
<i18n> <i18n>

View File

@ -22,6 +22,7 @@ const router = useRouter();
const filterCompanies = { order: ['code'] }; const filterCompanies = { order: ['code'] };
const filterWarehouses = { order: ['name'] }; const filterWarehouses = { order: ['name'] };
const inputFileRef = ref();
const allowedContentTypes = ref([]); const allowedContentTypes = ref([]);
const optionsCompanies = ref([]); const optionsCompanies = ref([]);
const optionsWarehouses = ref([]); const optionsWarehouses = ref([]);
@ -55,13 +56,15 @@ const saveData = async () => {
}); });
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
router.push({ name: 'CustomerFileManagement' }); toCustomerFileManagement();
} catch (error) { } catch (error) {
notify(error.message, 'negative'); notify(error.message, 'negative');
} }
}; };
const inputFileRef = ref(); const toCustomerFileManagement = () => {
router.push({ name: 'CustomerFileManagement' });
};
</script> </script>
<template> <template>
@ -90,9 +93,31 @@ const inputFileRef = ref();
url="DmsTypes" url="DmsTypes"
/> />
<QForm> <Teleport to="#st-actions">
<QCard class="q-pa-lg"> <QBtnGroup push class="q-gutter-x-sm">
<QCardSection> <QBtn
:disabled="isLoading"
:label="t('globals.cancel')"
:loading="isLoading"
@click="toCustomerFileManagement"
color="primary"
flat
icon="close"
/>
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
@click.stop="saveData"
color="primary"
icon="save"
/>
</QBtnGroup>
</Teleport>
<QCard class="q-pa-lg">
<QCardSection>
<QForm>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnInput <VnInput
@ -189,27 +214,9 @@ const inputFileRef = ref();
v-model="dms.hasFile" v-model="dms.hasFile"
disable disable
/> />
</QCardSection> </QForm>
</QCardSection>
<QCardActions class="flex justify-end"> </QCard>
<QBtn
:disabled="isLoading"
:label="t('globals.cancel')"
:loading="isLoading"
class="q-mr-xl"
color="primary"
flat
/>
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
color="primary"
@click.stop="saveData"
/>
</QCardActions>
</QCard>
</QForm>
</template> </template>
<i18n> <i18n>

View File

@ -47,6 +47,16 @@ const toCustomerGreuges = () => {
model="client" model="client"
url-create="Greuges" url-create="Greuges"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerGreuges"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">

View File

@ -35,6 +35,16 @@ const toCustomerNotes = () => {
@on-data-saved="toCustomerNotes()" @on-data-saved="toCustomerNotes()"
url-create="ClientObservations" url-create="ClientObservations"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerNotes"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">

View File

@ -41,6 +41,16 @@ const toCustomerRecoveries = () => {
model="client" model="client"
url-create="Recoveries" url-create="Recoveries"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerRecoveries"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">

View File

@ -94,7 +94,7 @@ const onDataSaved = async ({
recipient, recipient,
replyTo, replyTo,
}); });
router.push({ name: 'CustomerSamples' }); toCustomerSamples();
}; };
const getPreview = async () => { const getPreview = async () => {
@ -122,6 +122,10 @@ const getPreview = async () => {
return error; return error;
} }
}; };
const toCustomerSamples = () => {
router.push({ name: 'CustomerSamples' });
};
</script> </script>
<template> <template>
@ -151,13 +155,31 @@ const getPreview = async () => {
/> />
<FormModel <FormModel
:default-actions="false"
:form-initial-data="initialData" :form-initial-data="initialData"
:observe-form-changes="false" :observe-form-changes="false"
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
model="client" model="client"
url-create="ClientSamples" url-create="ClientSamples"
> >
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerSamples"
color="primary"
flat
icon="close"
/>
<QBtn
:disabled="isLoading || !sampleType.hasPreview"
:label="t('Preview')"
:loading="isLoading"
@click.stop="getPreview()"
color="primary"
flat
icon="preview"
/>
</template>
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
@ -266,34 +288,6 @@ const getPreview = async () => {
/> />
</div> </div>
</VnRow> </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 || !sampleType.hasPreview"
:label="t('Preview')"
:loading="isLoading"
@click.stop="getPreview()"
class="q-mr-sm"
color="primary"
/>
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
color="primary"
type="submit"
/>
</div>
</template> </template>
</FormModel> </FormModel>
</template> </template>