forked from verdnatura/salix-front
feat: remove cli warnings
This commit is contained in:
parent
b5dcc865e0
commit
19eb770893
|
@ -303,7 +303,7 @@ defineExpose({
|
||||||
CrudModelRef,
|
CrudModelRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleOnDataSaved(_, res) {
|
function handleOnDataSaved(_) {
|
||||||
if (_.onDataSaved) _.onDataSaved(this);
|
if (_.onDataSaved) _.onDataSaved(this);
|
||||||
else $props.create.onDataSaved(_);
|
else $props.create.onDataSaved(_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ const $props = defineProps({
|
||||||
|
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
const acl = useAcl();
|
const acl = useAcl();
|
||||||
const showForm = ref(false);
|
|
||||||
|
|
||||||
const isAllowedToCreate = computed(() => {
|
const isAllowedToCreate = computed(() => {
|
||||||
if ($props.acls.length) return acl.hasAny($props.acls);
|
if ($props.acls.length) return acl.hasAny($props.acls);
|
||||||
|
|
|
@ -151,7 +151,10 @@ watch(
|
||||||
clearable
|
clearable
|
||||||
type="number"
|
type="number"
|
||||||
v-model="amount"
|
v-model="amount"
|
||||||
/>
|
autofocus
|
||||||
|
>
|
||||||
|
<template #append>€</template></VnInput
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QForm>
|
</QForm>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, reactive, ref } from 'vue';
|
import { computed, onBeforeMount, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -17,9 +17,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import FormPopup from 'src/components/FormPopup.vue';
|
import FormPopup from 'src/components/FormPopup.vue';
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
|
||||||
|
|
||||||
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
||||||
|
|
||||||
|
@ -31,17 +29,17 @@ const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const stateStore = useStateStore();
|
|
||||||
const { sendEmail } = usePrintService();
|
const { sendEmail } = usePrintService();
|
||||||
const client = ref({});
|
|
||||||
const hasChanged = ref(false);
|
const hasChanged = ref(false);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const optionsClientsAddressess = ref([]);
|
const addressess = ref([]);
|
||||||
const optionsCompanies = ref([]);
|
const companies = ref([]);
|
||||||
const optionsEmailUsers = ref([]);
|
const optionsEmailUsers = ref([]);
|
||||||
const optionsSamplesVisible = ref([]);
|
const optionsSamplesVisible = ref([]);
|
||||||
const sampleType = ref({ hasPreview: false });
|
const sampleType = ref({ hasPreview: false });
|
||||||
|
const initialData = reactive({});
|
||||||
|
const entityId = computed(() => route.params.id);
|
||||||
|
const customer = computed(() => state.get('customer'));
|
||||||
const filterEmailUsers = { where: { userFk: user.value.id } };
|
const filterEmailUsers = { where: { userFk: user.value.id } };
|
||||||
const filterClientsAddresses = {
|
const filterClientsAddresses = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -63,14 +61,13 @@ const filterSamplesVisible = {
|
||||||
],
|
],
|
||||||
order: ['description'],
|
order: ['description'],
|
||||||
};
|
};
|
||||||
const initialData = reactive({});
|
|
||||||
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const { data } = await axios.get(`Clients/1/getCard`);
|
initialData.clientFk = customer.value.id;
|
||||||
client.value = data;
|
initialData.recipient = customer.value.email;
|
||||||
initialData.clientFk = route.params?.id;
|
initialData.recipientId = customer.value.id;
|
||||||
initialData.recipient = data.email;
|
|
||||||
initialData.recipientId = data.id;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const setEmailUser = (data) => {
|
const setEmailUser = (data) => {
|
||||||
|
@ -80,7 +77,7 @@ const setEmailUser = (data) => {
|
||||||
|
|
||||||
const setClientsAddresses = (data) => {
|
const setClientsAddresses = (data) => {
|
||||||
initialData.addressId = data[0].id;
|
initialData.addressId = data[0].id;
|
||||||
optionsClientsAddressess.value = data;
|
addressess.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setSampleType = (sampleId) => {
|
const setSampleType = (sampleId) => {
|
||||||
|
@ -93,20 +90,6 @@ const setSampleType = (sampleId) => {
|
||||||
initialData.companyId = companyFk;
|
initialData.companyId = companyFk;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setInitialData = () => {
|
|
||||||
hasChanged.value = false;
|
|
||||||
|
|
||||||
initialData.addressId = optionsClientsAddressess.value[0].id;
|
|
||||||
initialData.companyFk = null;
|
|
||||||
initialData.from = null;
|
|
||||||
initialData.recipient = client.value.email;
|
|
||||||
initialData.recipientId = client.value.id;
|
|
||||||
initialData.replyTo = optionsEmailUsers.value[0]?.email;
|
|
||||||
initialData.typeFk = '';
|
|
||||||
|
|
||||||
sampleType.value = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
const validateMessage = () => {
|
const validateMessage = () => {
|
||||||
if (!initialData.recipient) return 'Email cannot be blank';
|
if (!initialData.recipient) return 'Email cannot be blank';
|
||||||
if (!sampleType.value) return 'Choose a sample';
|
if (!sampleType.value) return 'Choose a sample';
|
||||||
|
@ -125,14 +108,14 @@ const setParams = (params) => {
|
||||||
const getPreview = async () => {
|
const getPreview = async () => {
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
recipientId: route.params.id,
|
recipientId: entityId,
|
||||||
};
|
};
|
||||||
const validationMessage = validateMessage();
|
const validationMessage = validateMessage();
|
||||||
if (validationMessage) return notify(t(validationMessage), 'negative');
|
if (validationMessage) return notify(t(validationMessage), 'negative');
|
||||||
|
|
||||||
setParams(params);
|
setParams(params);
|
||||||
|
|
||||||
const path = `${sampleType.value.model}/${route.params.id}/${sampleType.value.code}-html`;
|
const path = `${sampleType.value.model}/${entityId.value}/${sampleType.value.code}-html`;
|
||||||
const { data } = await axios.get(path, { params });
|
const { data } = await axios.get(path, { params });
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
@ -173,7 +156,6 @@ const getSamples = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getSamples();
|
|
||||||
const onDataSaved = async () => {
|
const onDataSaved = async () => {
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -183,7 +165,7 @@ const onDataSaved = async () => {
|
||||||
};
|
};
|
||||||
setParams(params);
|
setParams(params);
|
||||||
const samplesData = await getSamples();
|
const samplesData = await getSamples();
|
||||||
const path = `${samplesData.model}/${route.params.id}/${samplesData.code}-email`;
|
const path = `${samplesData.model}/${entityId.value}/${samplesData.code}-email`;
|
||||||
await sendEmail(path, params);
|
await sendEmail(path, params);
|
||||||
onDialogOK(params);
|
onDialogOK(params);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -210,13 +192,13 @@ const toCustomerSamples = () => {
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
:filter="filterClientsAddresses"
|
:filter="filterClientsAddresses"
|
||||||
:url="`Clients/${route.params.id}/addresses`"
|
:url="`Clients/${entityId}/addresses`"
|
||||||
@on-fetch="setClientsAddresses"
|
@on-fetch="setClientsAddresses"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
:filter="filterCompanies"
|
:filter="filterCompanies"
|
||||||
@on-fetch="(data) => (optionsCompanies = data)"
|
@on-fetch="(data) => (companies = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Companies"
|
url="Companies"
|
||||||
/>
|
/>
|
||||||
|
@ -306,7 +288,7 @@ const toCustomerSamples = () => {
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Company')"
|
:label="t('Company')"
|
||||||
:options="optionsCompanies"
|
:options="companies"
|
||||||
:rules="validate('entry.companyFk')"
|
:rules="validate('entry.companyFk')"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="code"
|
option-label="code"
|
||||||
|
@ -319,7 +301,7 @@ const toCustomerSamples = () => {
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Address')"
|
:label="t('Address')"
|
||||||
:options="optionsClientsAddressess"
|
:options="addressess"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
Loading…
Reference in New Issue