0
0
Fork 0

Solucion a comentarios 34

This commit is contained in:
carlosfonseca 2024-03-12 16:24:27 -05:00
parent 5ff90d127b
commit 38d3d49ecb
19 changed files with 313 additions and 409 deletions

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\cmari\Downloads\Salix-font1.68.zip

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\cmari\Downloads\Salix-font1.68.zip

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\cmari\Downloads\Salix-font1.68.zip

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\cmari\Downloads\Salix-font1.68.zip

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\cmari\Downloads\Salix-font1.68.zip

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\cmari\Downloads\Salix-font1.68.zip

View File

@ -1,3 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=C:\Users\cmari\Downloads\Salix-font1.68.zip

View File

@ -176,11 +176,11 @@ export default {
securedCredit: 'Secured credit',
payMethod: 'Pay method',
debt: 'Debt',
isDisabled: 'Customer is disabled',
isFrozen: 'Customer is frozen',
webAccountInactive: 'Web account inactive',
isFrozen: 'Customer frozen',
hasDebt: 'Customer has debt',
notChecked: 'Customer not checked',
isDisabled: 'Customer inactive',
notChecked: 'Customer no checked',
webAccountInactive: 'Web account inactive',
noWebAccess: 'Web access is disabled',
businessType: 'Business type',
passwordRequirements:

View File

@ -175,11 +175,11 @@ export default {
securedCredit: 'Crédito asegurado',
payMethod: 'Método de pago',
debt: 'Riesgo',
isDisabled: 'El cliente está desactivado',
isFrozen: 'El cliente está congelado',
isFrozen: 'Cliente congelado',
hasDebt: 'Cliente con riesgo',
isDisabled: 'Cliente inactivo',
notChecked: 'Cliente no comprobado',
webAccountInactive: 'Sin acceso web',
hasDebt: 'El cliente tiene riesgo',
notChecked: 'El cliente no está comprobado',
noWebAccess: 'El acceso web está desactivado',
businessType: 'Tipo de negocio',
passwordRequirements:

View File

@ -46,62 +46,6 @@ const filter = {
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
};
const tableColumnComponents = {
date: {
component: 'span',
props: () => {},
event: () => {},
},
creationDate: {
component: 'span',
props: () => {},
event: () => {},
},
employee: {
component: QBtn,
props: () => ({ flat: true, color: 'blue', noCaps: true }),
event: () => {},
},
reference: {
component: 'div',
props: () => {},
event: () => {},
},
bank: {
component: 'span',
props: () => {},
event: () => {},
},
debit: {
component: 'span',
props: () => {},
event: () => {},
},
havings: {
component: 'span',
props: () => {},
event: () => {},
},
balance: {
component: 'span',
props: () => {},
event: () => {},
},
conciliated: {
component: QCheckbox,
props: (prop) => ({
disable: true,
'model-value': Boolean(prop.value),
}),
event: () => {},
},
actions: {
component: 'div',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
@ -151,8 +95,8 @@ const columns = computed(() => [
},
{
align: 'left',
field: (value) => value.debit - value.credit,
format: (value) => toCurrency(value),
field: 'balance',
format: (value) => value && toCurrency(value),
label: t('Balance'),
name: 'balance',
},
@ -190,6 +134,16 @@ const getData = () => {
};
const onFetch = (data) => {
if (clientRisks.value?.length && data.length) {
data[0].balance = clientRisks.value[0]?.amount || 0;
data.reduce((prev, curr) => {
const netMovement = prev.debit - prev.credit;
curr.balance = prev.balance - netMovement;
return curr;
});
}
receiptsData.value = data;
};
@ -213,10 +167,10 @@ const updateCompanyId = (id) => {
getData();
};
const saveFieldValue = async (event) => {
const saveFieldValue = async (row) => {
try {
const payload = { description: event.value };
await axios.patch(`Receipts/${event.key}`, payload);
const payload = { description: row.description };
await axios.patch(`Receipts/${row.id}`, payload);
} catch (err) {
return err;
}
@ -228,13 +182,6 @@ const sendEmailAction = () => {
</script>
<template>
<FetchData
:filter="filterCompanies"
@on-fetch="(data) => (companiesOptions = data)"
auto-load
url="Companies"
/>
<FetchData
:filter="filter"
@on-fetch="(data) => (clientRisks = data)"
@ -242,6 +189,12 @@ const sendEmailAction = () => {
ref="clientRisksRef"
url="ClientRisks"
/>
<FetchData
:filter="filterCompanies"
@on-fetch="(data) => (companiesOptions = data)"
auto-load
url="Companies"
/>
<VnPaginate
auto-load
@ -261,61 +214,46 @@ const sendEmailAction = () => {
class="full-width q-mt-md"
row-key="id"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
class="col-content"
v-bind="
tableColumnComponents[props.col.name].props(props)
"
@click="
tableColumnComponents[props.col.name].event(props)
"
>
<template
v-if="
props.col.name !== 'conciliated' &&
props.col.name !== 'reference' &&
props.col.name !== 'actions'
"
>
{{ props.value }}
<template #body-cell-employee="{ row }">
<QTd auto-width @click.stop>
<QBtn color="blue" flat no-caps>{{ row.userName }}</QBtn>
<WorkerDescriptorProxy :id="row.clientFk" />
</QTd>
</template>
<template v-if="props.col.name === 'reference'">
<div v-if="props.row.isInvoice">
<template #body-cell-reference="{ row }">
<QTd auto-width @click.stop v-if="row.isInvoice">
<QBtn color="blue" dense flat>
{{ t('bill', { ref: props.value }) }}
{{ t('bill', { ref: row.description }) }}
</QBtn>
<InvoiceOutDescriptorProxy
:id="props.row.id"
v-if="props.col.name === 'reference'"
/>
</div>
<InvoiceOutDescriptorProxy :id="row.id" />
</QTd>
<QTd v-else>
<VnInput
@keyup.enter="saveFieldValue(props)"
@keyup.enter="saveFieldValue(row)"
autofocus
clearable
dense
v-model="props.row.description"
v-else
v-model="row.description"
/>
</QTd>
</template>
<template
v-if="
props.col.name === 'actions' &&
props.row.isCompensation
"
>
<template #body-cell-conciliated="{ row }">
<QTd align="center">
<QCheckbox :model-value="row.isConciliate === 1" />
</QTd>
</template>
<template #body-cell-actions="{ row }">
<QTd align="center">
<QIcon
@click.stop="showDialog = true"
class="q-ml-md"
color="primary"
name="add"
size="sm"
v-if="row.isCompensation"
>
<QTooltip>
{{ t('Send compensation') }}
@ -345,9 +283,7 @@ const sendEmailAction = () => {
}}
</div>
</QCardSection>
<QCardActions
class="flex justify-end q-mb-sm"
>
<QCardActions class="flex justify-end q-mb-sm">
<QBtn
:label="t('globals.cancel')"
color="primary"
@ -363,14 +299,6 @@ const sendEmailAction = () => {
</QCardActions>
</QCard>
</QDialog>
</template>
<WorkerDescriptorProxy
:id="props.row.clientFk"
v-if="props.col.name === 'userName'"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>

View File

@ -92,9 +92,12 @@ const updateData = () => {
'is-active': !item.finished,
}"
>
<QCardSection class="flex q-py-none">
<QCardSection
class="full-width flex justify-between q-py-none"
>
<div class="width-state flex">
<div
class="flex items-center q-ml-md cursor-pointer"
class="flex items-center cursor-pointer q-mr-md"
v-if="!item.finished"
>
<QIcon
@ -102,12 +105,13 @@ const updateData = () => {
color="primary"
name="lock"
size="md"
style="font-variation-settings: 'FILL' 1"
>
<QTooltip>{{ t('Close contract') }}</QTooltip>
</QIcon>
</div>
<div class="q-ml-lg">
<div>
<div class="flex q-mb-xs">
<div class="q-mr-sm color-vn-label">
{{ t('Since') }}:
@ -125,25 +129,25 @@ const updateData = () => {
</div>
</div>
</div>
</QCardSection>
</div>
<QSeparator class="q-mx-lg" vertical />
<QSeparator vertical />
<div class="flex">
<div class="width-data flex">
<div
class="flex items-center"
class="full-width flex justify-between items-center"
v-if="item?.insurances.length"
>
<div class="flex q-mr-xl">
<div class="q-mr-sm color-vn-label">
<div class="flex">
<div class="color-vn-label q-mr-xs">
{{ t('Credit') }}:
</div>
<div class="text-weight-bold">
{{ item.insurances[0].credit }}
</div>
</div>
<div class="flex q-mr-xl">
<div class="q-mr-sm color-vn-label">
<div class="flex">
<div class="color-vn-label q-mr-xs">
{{ t('Grade') }}:
</div>
<div class="text-weight-bold">
@ -151,28 +155,28 @@ const updateData = () => {
</div>
</div>
<div class="flex">
<div class="q-mr-sm color-vn-label">
<div class="color-vn-label q-mr-xs">
{{ t('Date') }}:
</div>
<div class="text-weight-bold">
{{ toDate(item.insurances[0].created) }}
</div>
</div>
</div>
<div
class="flex items-center q-ml-lg q-mr-md cursor-pointer"
>
<div class="flex items-center cursor-pointer">
<QIcon
@click.stop="openViewCredit(item)"
color="primary"
name="preview"
size="md"
>
<QTooltip>{{ t('View credits') }}</QTooltip>
<QTooltip>{{
t('View credits')
}}</QTooltip>
</QIcon>
</div>
</div>
</div>
</QCardSection>
</QCard>
</div>
<h5 class="flex justify-center color-vn-label" v-else>
@ -207,6 +211,12 @@ const updateData = () => {
.is-active {
background-color: var(--vn-light-gray);
}
.width-state {
width: 30%;
}
.width-data {
width: 65%;
}
</style>
<i18n>

View File

@ -95,7 +95,6 @@ const columns = computed(() => [
/>
<FormModel
:form-initial-data="{}"
:observe-form-changes="false"
:url-create="`Clients/${route.params.id}/setRating`"
>

View File

@ -139,26 +139,17 @@ const onSubmit = async () => {
<QCard class="card-width q-pa-lg">
<QCardSection>
<QForm>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Enable web access')" v-model="active" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<div class="q-px-sm">
<VnInput :label="t('User')" clearable v-model="name" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
:label="t('Recovery email')"
:rules="validate('client.email')"
clearable
type="email"
v-model="email"
class="q-mt-sm"
>
<template #append>
<QIcon name="info" class="cursor-pointer">
@ -171,7 +162,6 @@ const onSubmit = async () => {
</template>
</VnInput>
</div>
</VnRow>
</QForm>
</QCardSection>
</QCard>

View File

@ -84,36 +84,23 @@ function handleLocation(data, location) {
</template>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Default')" v-model="data.isDefaultAddress" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
</div>
<div class="col">
<VnInput
:label="t('Street address')"
clearable
v-model="data.street"
/>
</div>
<VnInput :label="t('Street address')" clearable v-model="data.street" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
@update:model-value="(location) => handleLocation(data, location)"
></VnLocation>
</div>
<div class="col">
/>
<div class="row justify-between q-gutter-md q-mb-md">
<VnSelectFilter
:label="t('Agency')"
:options="agencyModes"
@ -122,18 +109,18 @@ function handleLocation(data, location) {
option-label="name"
option-value="id"
v-model="data.agencyModeFk"
class="col"
/>
<VnInput class="col" :label="t('Phone')" clearable v-model="data.phone" />
<VnInput
class="col"
:label="t('Mobile')"
clearable
v-model="data.mobile"
/>
</div>
<div class="col">
<VnInput :label="t('Phone')" clearable v-model="data.phone" />
</div>
<div class="col">
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Incoterms')"
:options="incoterms"
@ -142,8 +129,7 @@ function handleLocation(data, location) {
option-value="code"
v-model="data.incotermsFk"
/>
</div>
<div class="col">
<VnSelectDialog
:label="t('Customs agent')"
:options="customsAgents"
@ -156,7 +142,6 @@ function handleLocation(data, location) {
<CustomerNewCustomsAgent @on-data-saved="refreshData()" />
</template>
</VnSelectDialog>
</div>
</VnRow>
</template>
</FormModel>

View File

@ -25,7 +25,6 @@ const toCustomerCreditContracts = () => {
<FormModel
:form-initial-data="initialData"
:observe-form-changes="false"
:default-actions="true"
url-create="creditClassifications/createWithInsurance"
@on-data-saved="toCustomerCreditContracts()"
>

View File

@ -1,15 +1,22 @@
<script setup>
import { reactive } from 'vue';
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const initialData = ref({});
const setClient = (data) => {
console.log(data.credit);
initialData.value.credit = data.credit;
};
const toCustomerCredits = () => {
router.push({
name: 'CustomerCredits',
@ -21,8 +28,15 @@ const toCustomerCredits = () => {
</script>
<template>
<FetchData
:filter="filter"
@on-fetch="setClient"
auto-load
:url="`Clients/${route.params.id}/getCard`"
/>
<FormModel
:form-initial-data="{}"
:form-initial-data="initialData"
:observe-form-changes="false"
:url-update="`/Clients/${route.params.id}`"
@on-data-saved="toCustomerCredits()"
@ -38,15 +52,12 @@ const toCustomerCredits = () => {
</template>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
:label="t('Credit')"
clearable
type="number"
v-model.number="data.credit"
/>
</div>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -57,18 +57,21 @@ watch([client, findOne], ([newClient, newFindOne]) => {
const saveData = async () => {
try {
const formData = new FormData();
const files = dms.value.files;
if (dms.value.files) {
for (let i = 0; i < dms.value.files.length; i++)
formData.append(dms.value.files[i].name, dms.value.files[i]);
dms.value.hasFileAttached = true;
if (files && files.length > 0) {
for (let file of files) {
formData.append(file.name, file);
}
dms.value.hasFileAttached = true;
const url = `clients/${route.params.id}/uploadFile`;
await axios.post(url, formData, {
params: dms.value,
});
notify('globals.dataSaved', 'positive');
toCustomerFileManagement();
}
} catch (error) {
notify(error.message, 'negative');
}

View File

@ -43,20 +43,21 @@ const setCurrentDms = (data) => {
const saveData = async () => {
try {
const formData = new FormData();
const files = dms.value.files;
if (dms.value.files) {
for (let i = 0; i < dms.value.files.length; i++)
formData.append(dms.value.files[i].name, dms.value.files[i]);
dms.value.hasFileAttached = true;
if (files && files.length > 0) {
for (let file of files) {
formData.append(file.name, file);
}
dms.value.hasFileAttached = true;
const url = `dms/${route.params.dmsId}/updateFile`;
await axios.post(url, formData, {
params: dms.value,
});
notify('globals.dataSaved', 'positive');
toCustomerFileManagement();
}
} catch (error) {
notify(error.message, 'negative');
}

View File

@ -17,7 +17,6 @@ const onDataSaved = (dataSaved) => {
<template>
<FormModelPopup
:form-initial-data="{}"
:title="t('New customs agent')"
@on-data-saved="onDataSaved($event)"
model="customer"