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