refactor(customerAddress): refs #7527 is popup remove /create /edit #1695
src
components/common
i18n/locale
pages
Customer
Card
CustomerAddress.vueCustomerCreditContracts.vueCustomerCreditContractsInsurance.vueCustomerDms.vueCustomerFileManagement.vueCustomerSamples.vue
components
Entry
Ticket/Card/BasicData
Travel
router/modules
test/cypress/integration/customer
|
@ -48,6 +48,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
required: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
deafult: undefined,
|
||||
},
|
||||
});
|
||||
|
||||
const dmsFilter = {
|
||||
|
@ -88,7 +92,6 @@ const dmsFilter = {
|
|||
],
|
||||
},
|
||||
},
|
||||
where: { [$props.filter]: route.params.id },
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -298,6 +301,7 @@ defineExpose({
|
|||
:data-key="$props.model"
|
||||
:url="$props.model"
|
||||
:user-filter="dmsFilter"
|
||||
:filter="{ where: { [filter]: route.params.id } }"
|
||||
:order="['dmsFk DESC']"
|
||||
auto-load
|
||||
@on-fetch="setData"
|
||||
|
|
|
@ -211,12 +211,10 @@ globals:
|
|||
mandates: Mandates
|
||||
contacts: Contacts
|
||||
webPayment: Web payment
|
||||
fileManagement: File management
|
||||
unpaid: Unpaid
|
||||
entries: Entries
|
||||
buys: Buys
|
||||
dms: File management
|
||||
entryCreate: New entry
|
||||
latestBuys: Latest buys
|
||||
reserves: Reserves
|
||||
tickets: Tickets
|
||||
|
|
|
@ -214,12 +214,10 @@ globals:
|
|||
mandates: Mandatos
|
||||
contacts: Contactos
|
||||
webPayment: Pago web
|
||||
fileManagement: Gestión documental
|
||||
unpaid: Impago
|
||||
entries: Entradas
|
||||
buys: Compras
|
||||
dms: Gestión documental
|
||||
entryCreate: Nueva entrada
|
||||
latestBuys: Últimas compras
|
||||
reserves: Reservas
|
||||
tickets: Tickets
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, ref, watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRoute } from 'vue-router';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import CustomerAddressForm from '../components/CustomerAddressForm.vue';
|
||||
import CustomerAddressEdit from '../components/CustomerAddressEdit.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const addresses = ref([]);
|
||||
const client = ref(null);
|
||||
|
||||
const showFormCreate = ref();
|
||||
const showFormEdit = ref();
|
||||
const showFormEditModel = ref();
|
||||
const vnPaginateRef = ref();
|
||||
const addressFilter = {
|
||||
fields: [
|
||||
'id',
|
||||
|
@ -27,6 +31,11 @@ const addressFilter = {
|
|||
'isEqualizated',
|
||||
'isLogifloraAllowed',
|
||||
'postalCode',
|
||||
'agencyModeFk',
|
||||
'longitude',
|
||||
'latitude',
|
||||
'incotermsFk',
|
||||
'customsAgentFk',
|
||||
],
|
||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'id DESC', 'nickname ASC'],
|
||||
include: [
|
||||
|
@ -48,14 +57,15 @@ const addressFilter = {
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'agencyMode',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
const { id } = route.params;
|
||||
getClientData(id);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
(newValue) => {
|
||||
|
@ -65,16 +75,13 @@ watch(
|
|||
);
|
||||
|
||||
const getClientData = async (id) => {
|
||||
try {
|
||||
const { data } = await axios.get(`Clients/${id}`);
|
||||
client.value = data;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
const { data } = await axios.get(`Clients/${id}`);
|
||||
client.value = data;
|
||||
};
|
||||
|
||||
const isDefaultAddress = (address) => {
|
||||
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
||||
address.isDefaultAddress = client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
||||
return address.isDefaultAddress;
|
||||
};
|
||||
|
||||
const setDefault = (address) => {
|
||||
|
@ -88,35 +95,35 @@ const setDefault = (address) => {
|
|||
});
|
||||
};
|
||||
|
||||
const sortAddresses = (data) => {
|
||||
const sortAddresses = async (data) => {
|
||||
await getClientData(route.params.id);
|
||||
if (!client.value || !data) return;
|
||||
addresses.value = data.sort((a, b) => {
|
||||
return isDefaultAddress(b) - isDefaultAddress(a);
|
||||
});
|
||||
openAddressForm();
|
||||
};
|
||||
|
||||
const toCustomerAddressCreate = () => {
|
||||
router.push({ name: 'CustomerAddressCreate' });
|
||||
};
|
||||
|
||||
const toCustomerAddressEdit = (addressId) => {
|
||||
router.push({
|
||||
name: 'CustomerAddressEdit',
|
||||
params: {
|
||||
id: route.params.id,
|
||||
addressId,
|
||||
},
|
||||
});
|
||||
};
|
||||
function openAddressForm() {
|
||||
if (route.query.addressId) {
|
||||
const address = addresses.value.find(
|
||||
(address) => address.id == +route.query.addressId,
|
||||
);
|
||||
if (address) {
|
||||
showFormEdit.value = true;
|
||||
showFormEditModel.value = address;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="vnPaginateRef"
|
||||
@on-fetch="sortAddresses"
|
||||
auto-load
|
||||
data-key="CustomerAddresses"
|
||||
order="id DESC"
|
||||
ref="vnPaginateRef"
|
||||
:filter="addressFilter"
|
||||
:url="`Clients/${route.params.id}/addresses`"
|
||||
/>
|
||||
|
@ -131,7 +138,7 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
'q-mb-md': index < addresses.length - 1,
|
||||
'item-disabled': !item.isActive,
|
||||
}"
|
||||
@click="toCustomerAddressEdit(item.id)"
|
||||
@click="(showFormEdit = !showFormEdit) && (showFormEditModel = item)"
|
||||
>
|
||||
<div class="q-ml-xs q-mr-md flex items-center">
|
||||
<QIcon
|
||||
|
@ -200,19 +207,18 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
v-for="(observation, obIndex) in item.observations"
|
||||
>
|
||||
<div class="text-weight-bold q-mr-sm">
|
||||
{{ observation.observationType.description }}:
|
||||
{{ observation?.observationType?.description }}:
|
||||
</div>
|
||||
<div>{{ observation.description }}</div>
|
||||
<div>{{ observation?.description }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</div>
|
||||
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn
|
||||
@click.stop="toCustomerAddressCreate()"
|
||||
@click.stop="showFormCreate = !showFormCreate"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
|
@ -222,6 +228,28 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
{{ t('New consignee') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
<QDialog v-model="showFormEdit" :full-width="true">
|
||||
<CustomerAddressEdit
|
||||
:id="showFormEditModel.id"
|
||||
v-model="showFormEditModel"
|
||||
@on-data-saved="() => vnPaginateRef.fetch()"
|
||||
/>
|
||||
</QDialog>
|
||||
<QDialog v-model="showFormCreate" :full-width="true">
|
||||
<CustomerAddressForm
|
||||
:is-create="true"
|
||||
:form-initial-data="{
|
||||
isDefaultAddress: false,
|
||||
isActive: true,
|
||||
isEqualizated: false,
|
||||
isLogifloraAllowed: false,
|
||||
}"
|
||||
:observe-form-changes="false"
|
||||
:url-create="`Clients/${route.params.id}/createAddress`"
|
||||
model="client"
|
||||
@on-data-saved="() => vnPaginateRef.fetch()"
|
||||
/>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import CustomerCreditContractsCreate from '../components/CustomerCreditContractsCreate.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
@ -16,6 +17,7 @@ const quasar = useQuasar();
|
|||
|
||||
const vnPaginateRef = ref(null);
|
||||
const showQPageSticky = ref(true);
|
||||
const showForm = ref();
|
||||
|
||||
const filter = {
|
||||
order: 'finished ASC, started DESC',
|
||||
|
@ -36,25 +38,21 @@ const fetch = (data) => {
|
|||
data.forEach((element) => {
|
||||
if (!element.finished) {
|
||||
showQPageSticky.value = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const toCustomerCreditContractsCreate = () => {
|
||||
router.push({ name: 'CustomerCreditContractsCreate' });
|
||||
};
|
||||
|
||||
const openDialog = (item) => {
|
||||
quasar.dialog({
|
||||
component: ModalCloseContract,
|
||||
componentProps: {
|
||||
id: item.id,
|
||||
promise: updateData,
|
||||
promise: async () => {
|
||||
await updateData();
|
||||
showQPageSticky.value = true;
|
||||
},
|
||||
},
|
||||
});
|
||||
updateData();
|
||||
showQPageSticky.value = true;
|
||||
};
|
||||
|
||||
const openViewCredit = (credit) => {
|
||||
|
@ -66,14 +64,14 @@ const openViewCredit = (credit) => {
|
|||
});
|
||||
};
|
||||
|
||||
const updateData = () => {
|
||||
vnPaginateRef.value?.fetch();
|
||||
const updateData = async () => {
|
||||
await vnPaginateRef.value?.fetch();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="full-width flex justify-center">
|
||||
<QCard class="card-width q-pa-lg">
|
||||
<section class="row justify-center">
|
||||
<QCard class="q-pa-lg" style="width: 70%">
|
||||
<VnPaginate
|
||||
:user-filter="filter"
|
||||
@on-fetch="fetch"
|
||||
|
@ -84,100 +82,82 @@ const updateData = () => {
|
|||
url="CreditClassifications"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<div v-if="rows.length">
|
||||
<div v-if="rows.length" class="q-gutter-y-md">
|
||||
<QCard
|
||||
v-for="(item, index) in rows"
|
||||
:key="index"
|
||||
:class="{
|
||||
'customer-card': true,
|
||||
'q-mb-md': index < rows.length - 1,
|
||||
'is-active': !item.finished,
|
||||
}"
|
||||
:class="{ disabled: item.finished }"
|
||||
>
|
||||
<QCardSection
|
||||
class="full-width flex justify-between q-py-none"
|
||||
class="full-width"
|
||||
:class="{ 'row justify-between': $q.screen.gt.md }"
|
||||
>
|
||||
<div class="width-state flex">
|
||||
<div
|
||||
class="flex items-center cursor-pointer q-mr-md"
|
||||
v-if="!item.finished"
|
||||
<div class="width-state row no-wrap">
|
||||
<QIcon
|
||||
:style="{
|
||||
visibility: item.finished
|
||||
? 'hidden'
|
||||
: 'visible',
|
||||
}"
|
||||
@click.stop="openDialog(item)"
|
||||
color="primary"
|
||||
name="lock"
|
||||
size="md"
|
||||
class="fill-icon q-px-md"
|
||||
>
|
||||
<QIcon
|
||||
@click.stop="openDialog(item)"
|
||||
color="primary"
|
||||
name="lock"
|
||||
size="md"
|
||||
class="fill-icon"
|
||||
>
|
||||
<QTooltip>{{ t('Close contract') }}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<QTooltip>{{ t('Close contract') }}</QTooltip>
|
||||
</QIcon>
|
||||
|
||||
<div>
|
||||
<div class="flex q-mb-xs">
|
||||
<div class="q-mr-sm color-vn-label">
|
||||
{{ t('Since') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ toDate(item.started) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="q-mr-sm color-vn-label">
|
||||
{{ t('To') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ toDate(item.finished) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<VnLv
|
||||
:label="t('Since')"
|
||||
:value="toDate(item.started)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('To')"
|
||||
:value="toDate(item.finished)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<QSeparator vertical />
|
||||
|
||||
<div class="width-data flex">
|
||||
<div class="column width-data">
|
||||
<div
|
||||
class="full-width flex justify-between items-center"
|
||||
class="column"
|
||||
v-if="item?.insurances.length"
|
||||
v-for="insurance in item.insurances"
|
||||
:key="insurance.id"
|
||||
>
|
||||
<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">
|
||||
<div class="color-vn-label q-mr-xs">
|
||||
{{ t('Grade') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ item.insurances[0].grade || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="color-vn-label q-mr-xs">
|
||||
{{ t('Date') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ toDate(item.insurances[0].created) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center cursor-pointer">
|
||||
<QIcon
|
||||
@click.stop="openViewCredit(item)"
|
||||
color="primary"
|
||||
name="preview"
|
||||
size="md"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('View credits')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<div
|
||||
:class="{
|
||||
'row q-gutter-x-md': $q.screen.gt.sm,
|
||||
}"
|
||||
class="q-mb-sm"
|
||||
>
|
||||
<VnLv
|
||||
:label="t('Credit')"
|
||||
:value="toCurrency(insurance.credit)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('Grade')"
|
||||
:value="dashIfEmpty(insurance.grade)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('Date')"
|
||||
:value="toDate(insurance.created)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<QBtn
|
||||
@click.stop="openViewCredit(item)"
|
||||
icon="preview"
|
||||
size="md"
|
||||
:title="t('View credits')"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</div>
|
||||
|
@ -187,11 +167,11 @@ const updateData = () => {
|
|||
</template>
|
||||
</VnPaginate>
|
||||
</QCard>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<QPageSticky :offset="[18, 18]" v-if="showQPageSticky">
|
||||
<QBtn
|
||||
@click.stop="toCustomerCreditContractsCreate()"
|
||||
@click.stop="showForm = !showForm"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
|
@ -201,24 +181,25 @@ const updateData = () => {
|
|||
{{ t('New contract') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
|
||||
<QDialog v-model="showForm">
|
||||
<CustomerCreditContractsCreate @on-data-saved="updateData()" />
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.customer-card {
|
||||
border: 2px solid var(--vn-light-gray);
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.is-active {
|
||||
background-color: var(--vn-light-gray);
|
||||
}
|
||||
.width-state {
|
||||
width: 30%;
|
||||
}
|
||||
.width-data {
|
||||
width: 65%;
|
||||
width: 50%;
|
||||
}
|
||||
::v-deep(.label) {
|
||||
margin-right: 5px;
|
||||
}
|
||||
::v-deep(.label)::after {
|
||||
content: ':';
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
<script setup>
|
||||
import { computed, onBeforeMount, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const create = ref(null);
|
||||
const tableRef = ref();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
field: 'created',
|
||||
format: ({ created }) => toDate(created),
|
||||
label: t('Created'),
|
||||
name: 'created',
|
||||
create: true,
|
||||
columnCreate: {
|
||||
component: 'date',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: 'grade',
|
||||
label: t('Grade'),
|
||||
name: 'grade',
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
format: ({ credit }) => toCurrency(credit),
|
||||
label: t('Credit'),
|
||||
name: 'credit',
|
||||
create: true,
|
||||
},
|
||||
]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const query = `CreditClassifications/findOne?filter=${encodeURIComponent(
|
||||
JSON.stringify({
|
||||
fields: ['finished'],
|
||||
where: { id: route.params.creditId },
|
||||
}),
|
||||
)}`;
|
||||
const { data } = await axios(query);
|
||||
create.value = data.finished
|
||||
? false
|
||||
: {
|
||||
urlCreate: 'CreditInsurances',
|
||||
title: t('Create Insurance'),
|
||||
onDataSaved: () => tableRef.value.reload(),
|
||||
formInitialData: {
|
||||
created: Date.vnNew(),
|
||||
creditClassificationFk: route.params.creditId,
|
||||
},
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnTable
|
||||
v-if="create != null"
|
||||
url="CreditInsurances"
|
||||
ref="tableRef"
|
||||
data-key="creditInsurances"
|
||||
:filter="{
|
||||
where: {
|
||||
creditClassificationFk: `${route.params.creditId}`,
|
||||
},
|
||||
order: 'created DESC',
|
||||
}"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
:column-search="false"
|
||||
:disable-option="{ card: true }"
|
||||
:create
|
||||
auto-load
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Created: Fecha creación
|
||||
Grade: Grade
|
||||
Credit: Crédito
|
||||
</i18n>
|
|
@ -0,0 +1,28 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
const arrayData = useArrayData('Customer');
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<VnDmsList
|
||||
v-if="arrayData?.store?.data"
|
||||
model="ClientDms"
|
||||
update-model="Clients"
|
||||
default-dms-code="paymentsLaw"
|
||||
filter="clientFk"
|
||||
:description="
|
||||
t('ClientFileDescription', {
|
||||
clientId: $route.params.id,
|
||||
clientName: arrayData.store.data.socialName,
|
||||
})
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
ClientFileDescription: Payment law from client {clientName} ID {clientId}
|
||||
es:
|
||||
ClientFileDescription: Ley de pagos del cliente {clientName} ID {clientId}
|
||||
</i18n>
|
|
@ -1,269 +0,0 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { QBadge, QBtn, QCheckbox } from 'quasar';
|
||||
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import CustomerFileManagementActions from 'src/pages/Customer/components/CustomerFileManagementActions.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const ClientDmsRef = ref(null);
|
||||
const rows = ref([]);
|
||||
|
||||
const filter = {
|
||||
include: {
|
||||
relation: 'dms',
|
||||
scope: {
|
||||
fields: [
|
||||
'dmsTypeFk',
|
||||
'reference',
|
||||
'hardCopyNumber',
|
||||
'workerFk',
|
||||
'description',
|
||||
'hasFile',
|
||||
'file',
|
||||
'created',
|
||||
],
|
||||
include: [
|
||||
{ relation: 'dmsType', scope: { fields: ['name'] } },
|
||||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id'],
|
||||
include: { relation: 'user', scope: { fields: ['name'] } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
where: { clientFk: route.params.id },
|
||||
order: ['dmsFk DESC'],
|
||||
limit: 20,
|
||||
};
|
||||
|
||||
const tableColumnComponents = {
|
||||
id: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
type: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
order: {
|
||||
component: QBadge,
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
reference: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
description: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
original: {
|
||||
component: QCheckbox,
|
||||
props: (prop) => ({
|
||||
disable: true,
|
||||
'model-value': Boolean(prop.value),
|
||||
}),
|
||||
event: () => {},
|
||||
},
|
||||
file: {
|
||||
component: QBtn,
|
||||
props: () => ({ flat: true }),
|
||||
event: ({ row }) => downloadFile(row.dmsFk),
|
||||
},
|
||||
employee: {
|
||||
component: QBtn,
|
||||
props: () => ({ flat: true }),
|
||||
event: () => {},
|
||||
},
|
||||
created: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
actions: {
|
||||
component: CustomerFileManagementActions,
|
||||
props: (prop) => ({
|
||||
id: prop.row.dmsFk,
|
||||
promise: setData,
|
||||
}),
|
||||
event: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.id,
|
||||
label: t('Id'),
|
||||
name: 'id',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.dmsType.name,
|
||||
label: t('Type'),
|
||||
name: 'type',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.hardCopyNumber,
|
||||
label: t('Order'),
|
||||
name: 'order',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.reference,
|
||||
label: t('Reference'),
|
||||
name: 'reference',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.description,
|
||||
label: t('Description'),
|
||||
name: 'description',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.hasFile,
|
||||
label: t('Original'),
|
||||
name: 'original',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.file,
|
||||
label: t('File'),
|
||||
name: 'file',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: ({ dms }) => dms.worker.user.name,
|
||||
label: t('Employee'),
|
||||
name: 'employee',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: (value) => value.dms.created,
|
||||
label: t('Created'),
|
||||
name: 'created',
|
||||
format: (value) => toDateTimeFormat(value),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
field: 'actions',
|
||||
label: '',
|
||||
name: 'actions',
|
||||
},
|
||||
]);
|
||||
|
||||
const setData = () => {
|
||||
ClientDmsRef.value.fetch();
|
||||
};
|
||||
|
||||
const toCustomerFileManagementCreate = () => {
|
||||
router.push({ name: 'CustomerFileManagementCreate' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="ClientDmsRef"
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (rows = data)"
|
||||
auto-load
|
||||
url="ClientDms"
|
||||
/>
|
||||
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:pagination="{ rowsPerPage: 12 }"
|
||||
:rows="rows"
|
||||
class="full-width q-mt-md"
|
||||
row-key="id"
|
||||
v-if="rows?.length"
|
||||
>
|
||||
<template #body-cell="props">
|
||||
<QTd :props="props">
|
||||
<QTr :props="props" class="cursor-pointer">
|
||||
<component
|
||||
:is="
|
||||
props.col.name === 'order' && !props.value
|
||||
? 'span'
|
||||
: tableColumnComponents[props.col.name].component
|
||||
"
|
||||
@click="tableColumnComponents[props.col.name].event(props)"
|
||||
class="col-content"
|
||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
||||
>
|
||||
<template v-if="props.col.name !== 'original'">
|
||||
<span
|
||||
:class="{
|
||||
link:
|
||||
props.col.name === 'employee' ||
|
||||
props.col.name === 'file',
|
||||
}"
|
||||
>
|
||||
{{ props.value }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<WorkerDescriptorProxy
|
||||
:id="props.row.dms.workerFk"
|
||||
v-if="props.col.name === 'employee'"
|
||||
/>
|
||||
</component>
|
||||
</QTr>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
|
||||
<h5 class="flex justify-center color-vn-label" v-else>
|
||||
{{ t('globals.noResults') }}
|
||||
</h5>
|
||||
</QPage>
|
||||
|
||||
<QPageSticky :offset="[18, 18]">
|
||||
<QBtn
|
||||
@click.stop="toCustomerFileManagementCreate()"
|
||||
color="primary"
|
||||
fab
|
||||
v-shortcut="'+'"
|
||||
icon="add"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('Upload file') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Id: Id
|
||||
Type: Tipo
|
||||
Order: Orden
|
||||
Reference: Referencia
|
||||
Description: Descripción
|
||||
Original: Original
|
||||
File: Fichero
|
||||
Employee: Empleado
|
||||
Created: Fecha creación
|
||||
Upload file: Subir fichero
|
||||
</i18n>
|
|
@ -20,9 +20,7 @@ const filter = {
|
|||
{ relation: 'user', scope: { fields: ['id', 'name'] } },
|
||||
{ relation: 'company', scope: { fields: ['code'] } },
|
||||
],
|
||||
where: { clientFk: route.params.id },
|
||||
order: ['created DESC'],
|
||||
limit: 20,
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -76,7 +74,8 @@ const tableRef = ref();
|
|||
ref="tableRef"
|
||||
data-key="ClientSamples"
|
||||
auto-load
|
||||
:filter="filter"
|
||||
:user-filter="filter"
|
||||
:filter="{ where: { clientFk: route.params.id } }"
|
||||
url="ClientSamples"
|
||||
:columns="columns"
|
||||
:pagination="{ rowsPerPage: 12 }"
|
||||
|
|
|
@ -4,16 +4,14 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import CustomerAddressForm from './CustomerAddressForm.vue';
|
||||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
@ -22,31 +20,31 @@ const quasar = useQuasar();
|
|||
const urlUpdate = ref('');
|
||||
const agencyModes = ref([]);
|
||||
const incoterms = ref([]);
|
||||
const customsAgents = ref([]);
|
||||
const observationTypes = ref([]);
|
||||
const notes = ref([]);
|
||||
const customsAgents = ref([]);
|
||||
let originalNotes = [];
|
||||
const deletes = ref([]);
|
||||
|
||||
const model = defineModel({ type: Object });
|
||||
const notes = ref(model.value.observations || []);
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
onBeforeMount(() => {
|
||||
urlUpdate.value = `Clients/${route.params.id}/updateAddress/${route.params.addressId}`;
|
||||
urlUpdate.value = `Clients/${route.params.id}/updateAddress/${$props.id}`;
|
||||
});
|
||||
|
||||
const getData = async (observations) => {
|
||||
observationTypes.value = observations;
|
||||
|
||||
if (observationTypes.value.length) {
|
||||
const filter = {
|
||||
fields: ['id', 'addressFk', 'observationTypeFk', 'description'],
|
||||
where: { addressFk: `${route.params.addressId}` },
|
||||
};
|
||||
const { data } = await axios.get('AddressObservations', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
|
||||
if (data.length) {
|
||||
originalNotes = data;
|
||||
notes.value = originalNotes
|
||||
if (notes.value.length) {
|
||||
originalNotes = JSON.parse(JSON.stringify(notes.value));
|
||||
notes.value = notes.value
|
||||
.map((observation) => {
|
||||
const type = observationTypes.value.find(
|
||||
(type) => type.id === observation.observationTypeFk,
|
||||
|
@ -56,7 +54,7 @@ const getData = async (observations) => {
|
|||
$isNew: false,
|
||||
$oldData: null,
|
||||
$orgIndex: null,
|
||||
addressFk: `${route.params.addressId}`,
|
||||
addressFk: `${$props.id}`,
|
||||
description: observation.description,
|
||||
id: observation.id,
|
||||
observationTypeFk: type.id,
|
||||
|
@ -68,22 +66,6 @@ const getData = async (observations) => {
|
|||
}
|
||||
};
|
||||
|
||||
const addNote = () => {
|
||||
notes.value.push({
|
||||
$isNew: true,
|
||||
$oldData: null,
|
||||
$orgIndex: null,
|
||||
addressFk: `${route.params.addressId}`,
|
||||
description: '',
|
||||
observationTypeFk: '',
|
||||
});
|
||||
};
|
||||
|
||||
const deleteNote = (id, index) => {
|
||||
deletes.value.push(id);
|
||||
notes.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const updateAddress = async (data) => {
|
||||
await axios.patch(urlUpdate.value, data);
|
||||
};
|
||||
|
@ -116,8 +98,9 @@ function cleanPayload(payload) {
|
|||
async function updateAll({ data, payload }) {
|
||||
await updateObservations(payload);
|
||||
await updateAddress(data);
|
||||
toCustomerAddress();
|
||||
emit('onDataSaved');
|
||||
}
|
||||
|
||||
function getPayload() {
|
||||
return {
|
||||
creates: notes.value.filter((note) => note.$isNew),
|
||||
|
@ -162,23 +145,21 @@ async function handleDialog(data) {
|
|||
}
|
||||
}
|
||||
|
||||
const toCustomerAddress = () => {
|
||||
notes.value = [];
|
||||
deletes.value = [];
|
||||
router.push({
|
||||
name: 'CustomerAddress',
|
||||
params: {
|
||||
id: route.params.id,
|
||||
},
|
||||
const addNote = () => {
|
||||
notes.value.push({
|
||||
$isNew: true,
|
||||
$oldData: null,
|
||||
$orgIndex: null,
|
||||
addressFk: `${$props.id}`,
|
||||
description: '',
|
||||
observationTypeFk: '',
|
||||
});
|
||||
};
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
data.postalCode = code;
|
||||
data.city = town;
|
||||
data.provinceFk = provinceFk;
|
||||
data.countryFk = countryFk;
|
||||
}
|
||||
|
||||
const deleteNote = (id, index) => {
|
||||
deletes.value.push(id);
|
||||
notes.value.splice(index, 1);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -194,207 +175,76 @@ function handleLocation(data, location) {
|
|||
url="CustomsAgents"
|
||||
/>
|
||||
<FetchData @on-fetch="getData" auto-load url="ObservationTypes" />
|
||||
|
||||
<FormModel
|
||||
:observe-form-changes="false"
|
||||
<CustomerAddressForm
|
||||
:url-update="urlUpdate"
|
||||
:url="`Addresses/${route.params.addressId}`"
|
||||
:form-initial-data="model"
|
||||
:save-fn="handleDialog"
|
||||
auto-load
|
||||
>
|
||||
<template #moreActions>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
@click="toCustomerAddress"
|
||||
color="primary"
|
||||
flat
|
||||
icon="close"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<QCheckbox :label="t('Enabled')" v-model="data.isActive" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<QCheckbox
|
||||
:label="t('Is equalizated')"
|
||||
v-model="data.isEqualizated"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QCheckbox
|
||||
:label="t('Is Loginflora allowed')"
|
||||
v-model="data.isLogifloraAllowed"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput :label="t('Street')" clearable v-model="data.street" />
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnLocation
|
||||
:rules="validate('Worker.postcode')"
|
||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||
:location="{
|
||||
postcode: data.postalCode,
|
||||
city: data.city,
|
||||
province: data.province,
|
||||
country: data.province?.country,
|
||||
}"
|
||||
@update:model-value="(location) => handleLocation(data, location)"
|
||||
></VnLocation>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Agency')"
|
||||
:options="agencyModes"
|
||||
:rules="validate('route.agencyFk')"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="data.agencyModeFk"
|
||||
/>
|
||||
</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>
|
||||
<VnSelect
|
||||
:label="t('Incoterms')"
|
||||
:options="incoterms"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
v-model="data.incotermsFk"
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('Customs agent')"
|
||||
:options="customsAgents"
|
||||
hide-selected
|
||||
option-label="fiscalName"
|
||||
option-value="id"
|
||||
v-model="data.customsAgentFk"
|
||||
:tooltip="t('New customs agent')"
|
||||
<template #more-form="{ validate }">
|
||||
<div class="column">
|
||||
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>
|
||||
<VnRow
|
||||
v-if="!isPopup"
|
||||
:key="index"
|
||||
class="row q-gutter-md q-mb-md"
|
||||
v-for="(note, index) in notes"
|
||||
>
|
||||
<template #form>
|
||||
<CustomerNewCustomsAgent />
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInputNumber
|
||||
:label="t('Longitude')"
|
||||
clearable
|
||||
v-model="data.longitude"
|
||||
:decimal-places="7"
|
||||
:positive="false"
|
||||
/>
|
||||
<VnInputNumber
|
||||
:label="t('Latitude')"
|
||||
clearable
|
||||
v-model="data.latitude"
|
||||
:decimal-places="7"
|
||||
:positive="false"
|
||||
/>
|
||||
</VnRow>
|
||||
<h4 class="q-mb-xs">{{ t('Notes') }}</h4>
|
||||
<VnRow
|
||||
:key="index"
|
||||
class="row q-gutter-md q-mb-md"
|
||||
v-for="(note, index) in notes"
|
||||
>
|
||||
<VnSelect
|
||||
:label="t('Observation type')"
|
||||
:options="observationTypes"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="note.observationTypeFk"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
:rules="validate('route.description')"
|
||||
clearable
|
||||
v-model="note.description"
|
||||
/>
|
||||
<QIcon
|
||||
:style="{ flex: 0, 'align-self': $q.screen.gt.xs ? 'end' : 'center' }"
|
||||
@click.stop="deleteNote(note.id, index)"
|
||||
class="cursor-pointer"
|
||||
<VnSelect
|
||||
:label="t('Observation type')"
|
||||
:options="observationTypes"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="note.observationTypeFk"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
:rules="validate('route.description')"
|
||||
clearable
|
||||
v-model="note.description"
|
||||
/>
|
||||
<QIcon
|
||||
:style="{
|
||||
flex: 0,
|
||||
'align-self': $q.screen.gt.xs ? 'end' : 'center',
|
||||
}"
|
||||
@click.stop="deleteNote(note.id, index)"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Remove note') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</VnRow>
|
||||
<QBtn
|
||||
@click.stop="addNote()"
|
||||
icon="add"
|
||||
v-shortcut="'+'"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
style="width: 10%"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Remove note') }}
|
||||
{{ t('Add note') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</VnRow>
|
||||
<QBtn
|
||||
@click.stop="addNote()"
|
||||
class="cursor-pointer add-icon q-mt-md"
|
||||
flat
|
||||
icon="add"
|
||||
v-shortcut="'+'"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add note') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QBtn>
|
||||
</div>
|
||||
</template>
|
||||
</FormModel>
|
||||
</CustomerAddressForm>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.add-icon {
|
||||
background-color: $primary;
|
||||
border-radius: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Enabled: Activo
|
||||
Is equalizated: Recargo de equivalencia
|
||||
Is Loginflora allowed: Compra directa en Holanda
|
||||
Consignee: Consignatario
|
||||
Street: Dirección fiscal
|
||||
Postcode: Código postal
|
||||
City: Población
|
||||
Province: Provincia
|
||||
Agency: Agencia
|
||||
Phone: Teléfono
|
||||
Mobile: Movíl
|
||||
Incoterms: Incoterms
|
||||
Customs agent: Agente de aduanas
|
||||
New customs agent: Nuevo agente de aduanas
|
||||
Notes: Notas
|
||||
Observation type: Tipo de observación
|
||||
Description: Descripción
|
||||
Add note: Añadir nota
|
||||
Remove note: Eliminar nota
|
||||
Longitude: Longitud
|
||||
Latitude: Latitud
|
||||
confirmTicket: ¿Desea modificar también los estados de todos los tickets que están a punto de ser servidos?
|
||||
confirmDeletionMessage: Si le das a aceptar, se modificaran todas las notas de los ticket a futuro
|
||||
en:
|
||||
confirmTicket: Do you also want to modify the states of all the tickets that are about to be served?
|
||||
confirmDeletionMessage: If you click accept, all the notes of the future tickets will be modified
|
||||
es:
|
||||
Notes: Notas
|
||||
Observation type: Tipo de observación
|
||||
Description: Descripción
|
||||
Add note: Añadir nota
|
||||
Remove note: Eliminar nota
|
||||
confirmTicket: ¿Desea modificar también los estados de todos los tickets que están a punto de ser servidos?
|
||||
confirmDeletionMessage: Si le das a aceptar, se modificaran todas las notas de los ticket a futuro
|
||||
en:
|
||||
confirmTicket: Do you also want to modify the states of all the tickets that are about to be served?
|
||||
confirmDeletionMessage: If you click accept, all the notes of the future tickets will be modified
|
||||
</i18n>
|
||||
|
|
|
@ -1,36 +1,35 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onBeforeMount, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const formInitialData = reactive({ isDefaultAddress: false });
|
||||
|
||||
const urlUpdate = ref('');
|
||||
const agencyModes = ref([]);
|
||||
const incoterms = ref([]);
|
||||
const customsAgents = ref([]);
|
||||
|
||||
const toCustomerAddress = () => {
|
||||
router.push({
|
||||
name: 'CustomerAddress',
|
||||
params: {
|
||||
id: route.params.id,
|
||||
},
|
||||
});
|
||||
};
|
||||
const $props = defineProps({
|
||||
isCreate: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
onBeforeMount(() => {
|
||||
urlUpdate.value = `Clients/${route.params.id}/updateAddress/${route.params.addressId}`;
|
||||
});
|
||||
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
data.postalCode = code;
|
||||
|
@ -38,33 +37,21 @@ function handleLocation(data, location) {
|
|||
data.provinceFk = provinceFk;
|
||||
data.countryFk = countryFk;
|
||||
}
|
||||
|
||||
function onAgentCreated({ id, fiscalName }, data) {
|
||||
customsAgents.value.push({ id, fiscalName });
|
||||
data.customsAgentFk = id;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (customsAgents = data)"
|
||||
auto-load
|
||||
url="CustomsAgents"
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (agencyModes = data)"
|
||||
auto-load
|
||||
url="AgencyModes/isActive"
|
||||
/>
|
||||
<FetchData @on-fetch="(data) => (incoterms = data)" auto-load url="Incoterms" />
|
||||
|
||||
<FormModel
|
||||
:form-initial-data="formInitialData"
|
||||
:observe-form-changes="false"
|
||||
:url-create="`Clients/${route.params.id}/createAddress`"
|
||||
@on-data-saved="toCustomerAddress()"
|
||||
model="client"
|
||||
>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (customsAgents = data)"
|
||||
auto-load
|
||||
url="CustomsAgents"
|
||||
/>
|
||||
<FormModelPopup v-bind="$attrs" v-on="$attrs" :reload="false">
|
||||
<template #moreActions>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
|
@ -74,34 +61,47 @@ function onAgentCreated({ id, fiscalName }, data) {
|
|||
icon="close"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #form="{ data, validate }">
|
||||
<QCheckbox :label="t('Default')" v-model="data.isDefaultAddress" />
|
||||
|
||||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('Consignee')"
|
||||
required
|
||||
clearable
|
||||
v-model="data.nickname"
|
||||
<QCheckbox
|
||||
:label="t('Default')"
|
||||
v-model="data.isDefaultAddress"
|
||||
checked-icon="star"
|
||||
unchecked-icon="star"
|
||||
indeterminate-icon="star"
|
||||
size="lg"
|
||||
color="primary"
|
||||
:class="{ 'fill-icon': !!data.isDefaultAddress }"
|
||||
/>
|
||||
|
||||
<VnInput
|
||||
:label="t('Street address')"
|
||||
clearable
|
||||
v-model="data.street"
|
||||
required
|
||||
<QCheckbox :label="t('Enabled')" v-model="data.isActive" />
|
||||
<QCheckbox
|
||||
:label="t('Is equalizated')"
|
||||
v-model="data.isEqualizated"
|
||||
data-cy="isEqualizated_form"
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('Is Loginflora allowed')"
|
||||
v-model="data.isLogifloraAllowed"
|
||||
/>
|
||||
</VnRow>
|
||||
|
||||
<VnLocation
|
||||
:rules="validate('Worker.postcode')"
|
||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||
v-model="data.location"
|
||||
@update:model-value="(location) => handleLocation(data, location)"
|
||||
/>
|
||||
|
||||
<div class="row justify-between q-gutter-md q-mb-md">
|
||||
<VnRow>
|
||||
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
|
||||
<VnInput :label="t('Street')" clearable v-model="data.street" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnLocation
|
||||
:rules="validate('Worker.postcode')"
|
||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||
:location="{
|
||||
postcode: data.postalCode,
|
||||
city: data.city,
|
||||
province: data.province,
|
||||
country: data.province?.country,
|
||||
}"
|
||||
@update:model-value="(location) => handleLocation(data, location)"
|
||||
></VnLocation>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Agency')"
|
||||
:options="agencyModes"
|
||||
|
@ -110,17 +110,10 @@ function onAgentCreated({ id, fiscalName }, data) {
|
|||
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>
|
||||
|
||||
<VnInput :label="t('Phone')" clearable v-model="data.phone" />
|
||||
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Incoterms')"
|
||||
|
@ -130,23 +123,17 @@ function onAgentCreated({ id, fiscalName }, data) {
|
|||
option-value="code"
|
||||
v-model="data.incotermsFk"
|
||||
/>
|
||||
|
||||
<VnSelectDialog
|
||||
url="CustomsAgents"
|
||||
:label="t('Customs agent')"
|
||||
:options="customsAgents"
|
||||
hide-selected
|
||||
option-label="fiscalName"
|
||||
option-value="id"
|
||||
v-model="data.customsAgentFk"
|
||||
:tooltip="t('Create a new expense')"
|
||||
:tooltip="t('New customs agent')"
|
||||
>
|
||||
<template #form>
|
||||
<CustomerNewCustomsAgent
|
||||
@on-data-saved="
|
||||
(requestResponse) => onAgentCreated(requestResponse, data)
|
||||
"
|
||||
/>
|
||||
<CustomerNewCustomsAgent />
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</VnRow>
|
||||
|
@ -166,13 +153,13 @@ function onAgentCreated({ id, fiscalName }, data) {
|
|||
:positive="false"
|
||||
/>
|
||||
</VnRow>
|
||||
<slot name="more-form" :validate />
|
||||
</template>
|
||||
</FormModel>
|
||||
</FormModelPopup>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.add-icon {
|
||||
cursor: pointer;
|
||||
background-color: $primary;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
@ -180,9 +167,11 @@ function onAgentCreated({ id, fiscalName }, data) {
|
|||
|
||||
<i18n>
|
||||
es:
|
||||
Default: Predeterminado
|
||||
Enabled: Activo
|
||||
Is equalizated: Recargo de equivalencia
|
||||
Is Loginflora allowed: Compra directa en Holanda
|
||||
Consignee: Consignatario
|
||||
Street address: Dirección postal
|
||||
Street: Dirección fiscal
|
||||
Postcode: Código postal
|
||||
City: Población
|
||||
Province: Provincia
|
||||
|
@ -191,6 +180,17 @@ es:
|
|||
Mobile: Movíl
|
||||
Incoterms: Incoterms
|
||||
Customs agent: Agente de aduanas
|
||||
New customs agent: Nuevo agente de aduanas
|
||||
Notes: Notas
|
||||
Observation type: Tipo de observación
|
||||
Description: Descripción
|
||||
Add note: Añadir nota
|
||||
Remove note: Eliminar nota
|
||||
Longitude: Longitud
|
||||
Latitude: Latitud
|
||||
confirmTicket: ¿Desea modificar también los estados de todos los tickets que están a punto de ser servidos?
|
||||
confirmDeletionMessage: Si le das a aceptar, se modificaran todas las notas de los ticket a futuro
|
||||
en:
|
||||
confirmTicket: Do you also want to modify the states of all the tickets that are about to be served?
|
||||
confirmDeletionMessage: If you click accept, all the notes of the future tickets will be modified
|
||||
</i18n>
|
|
@ -3,44 +3,29 @@ import { reactive, computed } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const routeId = computed(() => route.params.id);
|
||||
const router = useRouter();
|
||||
|
||||
const initialData = reactive({
|
||||
started: Date.vnNew(),
|
||||
clientFk: routeId.value,
|
||||
});
|
||||
|
||||
const toCustomerCreditContracts = () => {
|
||||
router.push({ name: 'CustomerCreditContracts' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModel
|
||||
<FormModelPopup
|
||||
v-on="$attrs"
|
||||
:form-initial-data="initialData"
|
||||
:observe-form-changes="false"
|
||||
url-create="creditClassifications/createWithInsurance"
|
||||
@on-data-saved="toCustomerCreditContracts()"
|
||||
>
|
||||
<template #moreActions>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
@click="toCustomerCreditContracts"
|
||||
color="primary"
|
||||
flat
|
||||
icon="close"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #form="{ data }">
|
||||
<template #form-inputs="{ data }">
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
|
@ -63,7 +48,7 @@ const toCustomerCreditContracts = () => {
|
|||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</FormModelPopup>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const filter = {
|
||||
where: {
|
||||
creditClassificationFk: `${route.params.creditId}`,
|
||||
},
|
||||
limit: 20,
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
field: 'created',
|
||||
format: ({ created }) => toDate(created),
|
||||
label: t('Created'),
|
||||
name: 'created',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: 'grade',
|
||||
label: t('Grade'),
|
||||
name: 'grade',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
format: ({ credit }) => toCurrency(credit),
|
||||
label: t('Credit'),
|
||||
name: 'credit',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnTable
|
||||
url="CreditInsurances"
|
||||
ref="tableRef"
|
||||
data-key="creditInsurances"
|
||||
:filter="filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
:column-search="false"
|
||||
:disable-option="{ card: true }"
|
||||
auto-load
|
||||
></VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Created: Fecha creación
|
||||
Grade: Grade
|
||||
Credit: Crédito
|
||||
</i18n>
|
|
@ -1,96 +0,0 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
|
||||
import CustomerFileManagementDelete from 'src/pages/Customer/components/CustomerFileManagementDelete.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
promise: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const setDownloadFile = () => downloadFile($props.id);
|
||||
|
||||
const toCustomerFileManagementEdit = () => {
|
||||
router.push({
|
||||
name: 'CustomerFileManagementEdit',
|
||||
params: {
|
||||
id: route.params.id,
|
||||
dmsId: $props.id,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const showCustomerFileManagementDeleteDialog = () => {
|
||||
quasar.dialog({
|
||||
component: CustomerFileManagementDelete,
|
||||
componentProps: {
|
||||
id: $props.id,
|
||||
promise: setData,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const setData = () => {
|
||||
$props.promise();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<QIcon
|
||||
@click.stop="setDownloadFile"
|
||||
color="primary"
|
||||
name="cloud_download"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('actionFile', { action: t('globals.download') }) }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
@click.stop="toCustomerFileManagementEdit"
|
||||
class="q-ml-md"
|
||||
color="primary"
|
||||
name="edit"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('actionFile', { action: t('globals.edit') }) }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
@click.stop="showCustomerFileManagementDeleteDialog"
|
||||
class="q-ml-md"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('actionFile', { action: t('globals.remove') }) }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
actionFile: '{action} file'
|
||||
es:
|
||||
actionFile: '{action} fichero'
|
||||
</i18n>
|
|
@ -1,260 +0,0 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const { notify } = useNotify();
|
||||
const { t } = useI18n();
|
||||
const { validate } = useValidator();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
|
||||
const filterFindOne = { where: { code: 'paymentsLaw' } };
|
||||
const filterCompanies = { order: ['code'] };
|
||||
const filterWarehouses = { order: ['name'] };
|
||||
|
||||
const inputFileRef = ref();
|
||||
const client = ref({});
|
||||
const findOne = ref([]);
|
||||
const allowedContentTypes = ref([]);
|
||||
const optionsCompanies = ref([]);
|
||||
const optionsWarehouses = ref([]);
|
||||
const optionsDmsTypes = ref([]);
|
||||
const isLoading = ref(false);
|
||||
const dms = ref({
|
||||
hasFile: false,
|
||||
});
|
||||
|
||||
onBeforeMount(() => {
|
||||
const { companyFk, warehouseFk } = user.value;
|
||||
dms.value.reference = route.params.id;
|
||||
dms.value.companyId = companyFk;
|
||||
dms.value.warehouseId = warehouseFk;
|
||||
});
|
||||
|
||||
watch([client, findOne], ([newClient, newFindOne]) => {
|
||||
dms.value.description = t('clientFileDescription', {
|
||||
dmsTypeName: newFindOne.name?.toUpperCase(),
|
||||
clientName: newClient.name?.toUpperCase(),
|
||||
clientId: newClient.id,
|
||||
});
|
||||
dms.value.dmsTypeId = newFindOne.id;
|
||||
});
|
||||
|
||||
const saveData = async () => {
|
||||
try {
|
||||
const formData = new FormData();
|
||||
const files = dms.value.files;
|
||||
|
||||
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');
|
||||
}
|
||||
};
|
||||
|
||||
const toCustomerFileManagement = () => {
|
||||
router.push({ name: 'CustomerFileManagement' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (client = data)"
|
||||
auto-load
|
||||
:url="`Clients/${route.params.id}/getCard`"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterFindOne"
|
||||
@on-fetch="(data) => (findOne = data)"
|
||||
auto-load
|
||||
url="DmsTypes/findOne"
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (allowedContentTypes = data)"
|
||||
auto-load
|
||||
url="DmsContainers/allowedContentTypes"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterCompanies"
|
||||
@on-fetch="(data) => (optionsCompanies = data)"
|
||||
auto-load
|
||||
url="Companies"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterWarehouses"
|
||||
@on-fetch="(data) => (optionsWarehouses = data)"
|
||||
auto-load
|
||||
url="Warehouses"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterWarehouses"
|
||||
@on-fetch="(data) => (optionsDmsTypes = data)"
|
||||
auto-load
|
||||
url="DmsTypes"
|
||||
/>
|
||||
|
||||
<Teleport to="#st-actions">
|
||||
<QBtnGroup push class="q-gutter-x-sm">
|
||||
<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>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Reference')"
|
||||
clearable
|
||||
v-model="dms.reference"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Company')"
|
||||
:options="optionsCompanies"
|
||||
:rules="validate('entry.companyFk')"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
v-model="dms.companyId"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Warehouse')"
|
||||
:options="optionsWarehouses"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="dms.warehouseId"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Type')"
|
||||
:options="optionsDmsTypes"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="dms.dmsTypeId"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
:rules="validate('route.description')"
|
||||
clearable
|
||||
type="textarea"
|
||||
v-model="dms.description"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<QFile
|
||||
ref="inputFileRef"
|
||||
class="required"
|
||||
:label="t('File')"
|
||||
v-model="dms.files"
|
||||
multiple
|
||||
:accept="allowedContentTypes.join(',')"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="vn:attach"
|
||||
flat
|
||||
round
|
||||
padding="xs"
|
||||
@click="inputFileRef.pickFiles()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Select a file') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn icon="info" flat round padding="xs">
|
||||
<QTooltip max-width="30rem">
|
||||
{{
|
||||
`${t(
|
||||
'Allowed content types'
|
||||
)}: ${allowedContentTypes.join(', ')}`
|
||||
}}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QFile>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<QCheckbox
|
||||
:label="t('Generate identifier for original file')"
|
||||
v-model="dms.hasFile"
|
||||
/>
|
||||
</QForm>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}'
|
||||
es:
|
||||
Reference: Referencia
|
||||
Company: Empresa
|
||||
Warehouse: Almacén
|
||||
Type: Tipo
|
||||
Description: Descripción
|
||||
clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}'
|
||||
File: Fichero
|
||||
Select a file: Selecciona un fichero
|
||||
Allowed content types: Tipos de archivo permitidos
|
||||
Generate identifier for original file: Generar identificador para archivo original
|
||||
</i18n>
|
|
@ -1,82 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import axios from 'axios';
|
||||
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
promise: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { dialogRef } = useDialogPluginComponent();
|
||||
const { notify } = useNotify();
|
||||
const { t } = useI18n();
|
||||
|
||||
const closeButton = ref(null);
|
||||
|
||||
const isLoading = ref(false);
|
||||
|
||||
const deleteDms = async () => {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
await axios.post(`ClientDms/${$props.id}/removeFile`);
|
||||
if ($props.promise) await $props.promise();
|
||||
notify('globals.dataDeleted', 'positive');
|
||||
} catch (error) {
|
||||
notify(error.message, 'negative');
|
||||
} finally {
|
||||
closeButton.value.click();
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef">
|
||||
<QCard class="q-pa-md q-mb-md">
|
||||
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
|
||||
<QCardSection>
|
||||
<div class="mt-1 text-h6">{{ t('This file will be deleted') }}</div>
|
||||
<div>{{ t('Are you sure you want to continue?') }}</div>
|
||||
</QCardSection>
|
||||
|
||||
<QCardActions class="flex justify-end">
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('globals.cancel')"
|
||||
:loading="isLoading"
|
||||
class="q-mr-xl"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('globals.save')"
|
||||
:loading="isLoading"
|
||||
@click.stop="deleteDms"
|
||||
color="primary"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
This file will be deleted: Este fichero va a ser borrado
|
||||
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
||||
</i18n>
|
|
@ -1,237 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const { notify } = useNotify();
|
||||
const { t } = useI18n();
|
||||
const { validate } = useValidator();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const filterCompanies = { order: ['code'] };
|
||||
const filterWarehouses = { order: ['name'] };
|
||||
|
||||
const inputFileRef = ref();
|
||||
const allowedContentTypes = ref([]);
|
||||
const optionsCompanies = ref([]);
|
||||
const optionsWarehouses = ref([]);
|
||||
const optionsDmsTypes = ref([]);
|
||||
const isLoading = ref(false);
|
||||
const dms = ref({
|
||||
hasFile: true,
|
||||
});
|
||||
|
||||
const setCurrentDms = (data) => {
|
||||
dms.value.reference = data.reference;
|
||||
dms.value.companyId = data.companyFk;
|
||||
dms.value.warehouseId = data.warehouseFk;
|
||||
dms.value.dmsTypeId = data.dmsTypeFk;
|
||||
dms.value.description = data.description;
|
||||
};
|
||||
|
||||
const saveData = async () => {
|
||||
try {
|
||||
const formData = new FormData();
|
||||
const files = dms.value.files;
|
||||
|
||||
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');
|
||||
}
|
||||
};
|
||||
|
||||
const toCustomerFileManagement = () => {
|
||||
router.push({ name: 'CustomerFileManagement' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData :url="`Dms/${route.params.dmsId}`" @on-fetch="setCurrentDms" auto-load />
|
||||
<FetchData
|
||||
@on-fetch="(data) => (allowedContentTypes = data)"
|
||||
auto-load
|
||||
url="DmsContainers/allowedContentTypes"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterCompanies"
|
||||
@on-fetch="(data) => (optionsCompanies = data)"
|
||||
auto-load
|
||||
url="Companies"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterWarehouses"
|
||||
@on-fetch="(data) => (optionsWarehouses = data)"
|
||||
auto-load
|
||||
url="Warehouses"
|
||||
/>
|
||||
<FetchData
|
||||
:filter="filterWarehouses"
|
||||
@on-fetch="(data) => (optionsDmsTypes = data)"
|
||||
auto-load
|
||||
url="DmsTypes"
|
||||
/>
|
||||
|
||||
<Teleport to="#st-actions">
|
||||
<QBtnGroup push class="q-gutter-x-sm">
|
||||
<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>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Reference')"
|
||||
clearable
|
||||
v-model="dms.reference"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Company')"
|
||||
:options="optionsCompanies"
|
||||
:rules="validate('entry.companyFk')"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
v-model="dms.companyId"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Warehouse')"
|
||||
:options="optionsWarehouses"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="dms.warehouseId"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Type')"
|
||||
:options="optionsDmsTypes"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="dms.dmsTypeId"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
:rules="validate('route.description')"
|
||||
clearable
|
||||
type="textarea"
|
||||
v-model="dms.description"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<QFile
|
||||
ref="inputFileRef"
|
||||
class="required"
|
||||
:label="t('File')"
|
||||
v-model="dms.files"
|
||||
multiple
|
||||
:accept="allowedContentTypes.join(',')"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="vn:attach"
|
||||
flat
|
||||
round
|
||||
padding="xs"
|
||||
@click="inputFileRef.pickFiles()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Select a file') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn icon="info" flat round padding="xs">
|
||||
<QTooltip max-width="30rem">
|
||||
{{
|
||||
`${t(
|
||||
'Allowed content types'
|
||||
)}: ${allowedContentTypes.join(', ')}`
|
||||
}}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QFile>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<QCheckbox
|
||||
:label="t('Generate identifier for original file')"
|
||||
v-model="dms.hasFile"
|
||||
disable
|
||||
/>
|
||||
</QForm>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}'
|
||||
es:
|
||||
Reference: Referencia
|
||||
Company: Empresa
|
||||
Warehouse: Almacén
|
||||
Type: Tipo
|
||||
Description: Descripción
|
||||
clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}'
|
||||
File: Fichero
|
||||
Select a file: Selecciona un fichero
|
||||
Allowed content types: Tipos de archivo permitidos
|
||||
Generate identifier for original file: Generar identificador para archivo original
|
||||
</i18n>
|
|
@ -29,7 +29,7 @@ const saveData = async () => {
|
|||
finished: timestamp,
|
||||
};
|
||||
await axios.patch(`CreditClassifications/${$props.id}`, payload);
|
||||
$props.promise();
|
||||
await $props.promise();
|
||||
closeButton.value.click();
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { toDate } from 'src/filters';
|
||||
import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue';
|
||||
|
||||
const state = useState();
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const user = state.getUser();
|
||||
const newEntryForm = reactive({
|
||||
supplierFk: null,
|
||||
travelFk: Number(route.query?.travelFk) || null,
|
||||
companyFk: user.value.companyFk || null,
|
||||
});
|
||||
const travelsOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
|
||||
const redirectToEntryBasicData = (_, { id }) => {
|
||||
router.push({ name: 'EntryBasicData', params: { id } });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Travels/filter"
|
||||
:filter="{ fields: ['id', 'warehouseInName'] }"
|
||||
order="id"
|
||||
@on-fetch="(data) => (travelsOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="companiesRef"
|
||||
url="Companies"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
order="code"
|
||||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
url="Entries/filter"
|
||||
custom-route-redirect-name="EntrySummary"
|
||||
data-key="Entry"
|
||||
:label="t('Search entries')"
|
||||
:info="t('You can search by entry reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<FormModel
|
||||
url-create="Entries"
|
||||
model="entry"
|
||||
:form-initial-data="newEntryForm"
|
||||
@on-data-saved="redirectToEntryBasicData"
|
||||
>
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnSelectSupplier
|
||||
class="full-width"
|
||||
v-model="data.supplierFk"
|
||||
hide-selected
|
||||
:required="true"
|
||||
:rules="validate('entry.supplierFk')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Travel')"
|
||||
class="full-width"
|
||||
v-model="data.travelFk"
|
||||
:options="travelsOptions"
|
||||
option-value="id"
|
||||
option-label="warehouseInName"
|
||||
map-options
|
||||
hide-selected
|
||||
:required="true"
|
||||
:rules="validate('entry.travelFk')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
>{{ scope.opt?.agencyModeName }} -
|
||||
{{ scope.opt?.warehouseInName }} ({{
|
||||
toDate(scope.opt?.shipped)
|
||||
}}) → {{ scope.opt?.warehouseOutName }} ({{
|
||||
toDate(scope.opt?.landed)
|
||||
}})</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Company')"
|
||||
class="full-width"
|
||||
v-model="data.companyFk"
|
||||
:options="companiesOptions"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
map-options
|
||||
hide-selected
|
||||
:required="true"
|
||||
:rules="validate('entry.companyFk')"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Travel: Envío
|
||||
Company: Empresa
|
||||
</i18n>
|
|
@ -218,8 +218,9 @@ const onFormModelInit = () => {
|
|||
|
||||
const redirectToCustomerAddress = () => {
|
||||
router.push({
|
||||
name: 'CustomerAddressEditCard',
|
||||
params: { id: clientId.value, addressId: addressId.value },
|
||||
name: 'CustomerAddress',
|
||||
params: { id: clientId.value },
|
||||
query: { addressId: addressId.value },
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -82,7 +82,10 @@ const deleteTravel = async (id) => {
|
|||
<QItem v-ripple clickable>
|
||||
<QItemSection>
|
||||
<RouterLink
|
||||
:to="{ name: 'EntryCreate', query: { travelFk: travel.id } }"
|
||||
:to="{
|
||||
name: 'EntryList',
|
||||
query: { createForm: JSON.stringify({ travelFk: travel.id }) },
|
||||
}"
|
||||
class="color-vn-text"
|
||||
>
|
||||
{{ t('travel.summary.AddEntry') }}
|
||||
|
|
|
@ -38,7 +38,10 @@ const redirectToCreateView = (queryParams) => {
|
|||
};
|
||||
|
||||
const redirectCreateEntryView = (travelData) => {
|
||||
router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } });
|
||||
router.push({
|
||||
name: 'EntryList',
|
||||
query: { createForm: JSON.stringify({ travelFk: travelData.id }) },
|
||||
});
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
|
|
|
@ -75,33 +75,6 @@ const customerCard = {
|
|||
component: () =>
|
||||
import('src/pages/Customer/Card/CustomerAddress.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'CustomerAddressCreate',
|
||||
meta: {
|
||||
title: 'address-create',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Customer/components/CustomerAddressCreate.vue'),
|
||||
},
|
||||
{
|
||||
path: ':addressId',
|
||||
name: 'CustomerAddressEditCard',
|
||||
redirect: { name: 'CustomerAddressEdit' },
|
||||
children: [
|
||||
{
|
||||
path: 'edit',
|
||||
name: 'CustomerAddressEdit',
|
||||
meta: {
|
||||
title: 'addressEdit',
|
||||
},
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/components/CustomerAddressEdit.vue'
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -212,20 +185,12 @@ const customerCard = {
|
|||
'src/pages/Customer/Card/CustomerCreditContracts.vue'
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'CustomerCreditContractsCreate',
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/components/CustomerCreditContractsCreate.vue'
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'insurance/:creditId',
|
||||
name: 'CustomerCreditContractsInsurance',
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/components/CustomerCreditContractsInsurance.vue'
|
||||
'src/pages/Customer/Card/CustomerCreditContractsInsurance.vue'
|
||||
),
|
||||
},
|
||||
],
|
||||
|
@ -274,9 +239,9 @@ const customerCard = {
|
|||
icon: 'vn:onlinepayment',
|
||||
},
|
||||
{
|
||||
name: 'CustomerFileManagement',
|
||||
title: 'fileManagement',
|
||||
icon: 'Upload',
|
||||
name: 'CustomerDms',
|
||||
title: 'dms',
|
||||
icon: 'cloud_upload',
|
||||
},
|
||||
{
|
||||
name: 'CustomerUnpaid',
|
||||
|
@ -309,14 +274,6 @@ const customerCard = {
|
|||
component: () =>
|
||||
import('src/pages/Customer/Card/CustomerSamples.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'CustomerSamplesCreate',
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/components/CustomerSamplesCreate.vue'
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -356,47 +313,12 @@ const customerCard = {
|
|||
import('src/pages/Customer/Card/CustomerWebPayment.vue'),
|
||||
},
|
||||
{
|
||||
path: 'file-management',
|
||||
name: 'CustomerFileManagement',
|
||||
path: 'dms',
|
||||
name: 'CustomerDms',
|
||||
meta: {
|
||||
title: 'fileManagement',
|
||||
title: 'dms',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Customer/Card/CustomerFileManagement.vue'),
|
||||
},
|
||||
{
|
||||
path: 'file-management',
|
||||
name: 'CustomerFileManagementCard',
|
||||
redirect: { name: 'CustomerFileManagement' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'CustomerFileManagement',
|
||||
meta: {
|
||||
title: 'fileManagement',
|
||||
},
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/Card/CustomerFileManagement.vue'
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'CustomerFileManagementCreate',
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/components/CustomerFileManagementCreate.vue'
|
||||
),
|
||||
},
|
||||
{
|
||||
path: ':dmsId/edit',
|
||||
name: 'CustomerFileManagementEdit',
|
||||
component: () =>
|
||||
import(
|
||||
'src/pages/Customer/components/CustomerFileManagementEdit.vue'
|
||||
),
|
||||
},
|
||||
],
|
||||
component: () => import('src/pages/Customer/Card/CustomerDms.vue'),
|
||||
},
|
||||
{
|
||||
path: 'unpaid',
|
||||
|
|
|
@ -114,15 +114,6 @@ export default {
|
|||
entryCard,
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'EntryCreate',
|
||||
meta: {
|
||||
title: 'entryCreate',
|
||||
icon: 'add',
|
||||
},
|
||||
component: () => import('src/pages/Entry/EntryCreate.vue'),
|
||||
},
|
||||
{
|
||||
path: 'my',
|
||||
name: 'EntrySupplier',
|
||||
|
|
|
@ -9,18 +9,18 @@ describe('Client consignee', () => {
|
|||
cy.get('.q-card').should('be.visible');
|
||||
});
|
||||
|
||||
it('check as equalizated', function () {
|
||||
it('check as equalizated', () => {
|
||||
cy.get('.q-card__section > .address-card').then(($el) => {
|
||||
let addressCards_before = $el.length;
|
||||
const addressCards_before = $el.length;
|
||||
|
||||
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||
const addressName = 'test';
|
||||
cy.dataCy('Consignee_input').type(addressName);
|
||||
cy.dataCy('Location_select').click();
|
||||
cy.getOption();
|
||||
cy.dataCy('Street address_input').type('TEST ADDRESS');
|
||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||
cy.location('href').should('contain', '#/customer/1107/address');
|
||||
cy.dataCy('Street_input').type('TEST ADDRESS');
|
||||
cy.saveCard();
|
||||
|
||||
cy.get('.q-card__section > .address-card').should(
|
||||
'have.length',
|
||||
addressCards_before + 1,
|
||||
|
@ -33,13 +33,11 @@ describe('Client consignee', () => {
|
|||
.should('contain', addressName)
|
||||
.click();
|
||||
});
|
||||
cy.get(
|
||||
'.q-card > :nth-child(1) > :nth-child(2) > .q-checkbox > .q-checkbox__inner',
|
||||
)
|
||||
cy.get('[data-cy="isEqualizated_form"] > .q-checkbox__inner')
|
||||
.should('have.class', 'q-checkbox__inner--falsy')
|
||||
.click();
|
||||
|
||||
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content').click();
|
||||
cy.saveCard();
|
||||
cy.get(
|
||||
':nth-child(2) > :nth-child(2) > .flex > .q-mr-lg > .q-checkbox__inner',
|
||||
).should('have.class', 'q-checkbox__inner--truthy');
|
||||
|
|
Loading…
Reference in New Issue