Merge branch 'master' into Hotfix-ZoneLocationsTree
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
commit
747bc4af76
|
@ -9,8 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import FormModelPopup from './FormModelPopup.vue';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
defineProps({ showEntityField: { type: Boolean, default: true } });
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
const { t } = useI18n();
|
||||
const bicInputRef = ref(null);
|
||||
|
@ -18,17 +16,16 @@ const state = useState();
|
|||
|
||||
const customer = computed(() => state.get('customer'));
|
||||
|
||||
const countriesFilter = {
|
||||
fields: ['id', 'name', 'code'],
|
||||
};
|
||||
|
||||
const bankEntityFormData = reactive({
|
||||
name: null,
|
||||
bic: null,
|
||||
countryFk: customer.value?.countryFk,
|
||||
id: null,
|
||||
});
|
||||
|
||||
const countriesFilter = {
|
||||
fields: ['id', 'name', 'code'],
|
||||
};
|
||||
|
||||
const countriesOptions = ref([]);
|
||||
|
||||
const onDataSaved = (...args) => {
|
||||
|
@ -44,7 +41,6 @@ onMounted(async () => {
|
|||
<template>
|
||||
<FetchData
|
||||
url="Countries"
|
||||
:filter="countriesFilter"
|
||||
auto-load
|
||||
@on-fetch="(data) => (countriesOptions = data)"
|
||||
/>
|
||||
|
@ -54,6 +50,7 @@ onMounted(async () => {
|
|||
:title="t('title')"
|
||||
:subtitle="t('subtitle')"
|
||||
:form-initial-data="bankEntityFormData"
|
||||
:filter="countriesFilter"
|
||||
@on-data-saved="onDataSaved"
|
||||
>
|
||||
<template #form-inputs="{ data, validate }">
|
||||
|
@ -85,7 +82,13 @@ onMounted(async () => {
|
|||
:rules="validate('bankEntity.countryFk')"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="showEntityField" class="col">
|
||||
<div
|
||||
v-if="
|
||||
countriesOptions.find((c) => c.id === data.countryFk)?.code ==
|
||||
'ES'
|
||||
"
|
||||
class="col"
|
||||
>
|
||||
<VnInput
|
||||
:label="t('id')"
|
||||
v-model="data.id"
|
||||
|
|
|
@ -77,7 +77,7 @@ const isLoading = ref(false);
|
|||
const hasChanges = ref(false);
|
||||
const originalData = ref();
|
||||
const vnPaginateRef = ref();
|
||||
const formData = ref();
|
||||
const formData = ref([]);
|
||||
const saveButtonRef = ref(null);
|
||||
const watchChanges = ref();
|
||||
const formUrl = computed(() => $props.url);
|
||||
|
|
|
@ -25,7 +25,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'params',
|
||||
default: 'table',
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'params',
|
||||
default: 'table',
|
||||
},
|
||||
vertical: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -325,6 +325,8 @@ function handleOnDataSaved(_) {
|
|||
}
|
||||
|
||||
function handleScroll() {
|
||||
if ($props.crudModel.disableInfiniteScroll) return;
|
||||
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
|
|
|
@ -99,7 +99,13 @@ const mixinRules = [
|
|||
<QIcon
|
||||
name="close"
|
||||
size="xs"
|
||||
v-if="hover && value && !$attrs.disabled && $props.clearable"
|
||||
v-if="
|
||||
hover &&
|
||||
value &&
|
||||
!$attrs.disabled &&
|
||||
!$attrs.readonly &&
|
||||
$props.clearable
|
||||
"
|
||||
@click="
|
||||
() => {
|
||||
value = null;
|
||||
|
|
|
@ -98,7 +98,7 @@ function existSummary(routes) {
|
|||
<slot name="header" :entity="entity" dense>
|
||||
<VnLv :label="`${entity.id} -`" :value="entity.name" />
|
||||
</slot>
|
||||
<slot name="header-right">
|
||||
<slot name="header-right" :entity="entity">
|
||||
<span></span>
|
||||
</slot>
|
||||
</div>
|
||||
|
|
|
@ -49,7 +49,7 @@ const $props = defineProps({
|
|||
},
|
||||
searchUrl: {
|
||||
type: String,
|
||||
default: 'params',
|
||||
default: 'table',
|
||||
},
|
||||
redirect: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -44,7 +44,7 @@ const props = defineProps({
|
|||
},
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
default: 20,
|
||||
},
|
||||
userParams: {
|
||||
type: Object,
|
||||
|
@ -100,7 +100,7 @@ const arrayData = useArrayData(props.dataKey, {
|
|||
const store = arrayData.store;
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.autoLoad) await fetch();
|
||||
if (props.autoLoad && !store.data?.length) await fetch();
|
||||
mounted.value = true;
|
||||
});
|
||||
|
||||
|
@ -115,7 +115,11 @@ watch(
|
|||
|
||||
watch(
|
||||
() => store.data,
|
||||
(data) => emit('onChange', data)
|
||||
(data) => {
|
||||
if (!mounted.value) return;
|
||||
emit('onChange', data);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
|
|
|
@ -45,7 +45,7 @@ const props = defineProps({
|
|||
},
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
default: 20,
|
||||
},
|
||||
userParams: {
|
||||
type: Object,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { defineProps } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
routeName: {
|
||||
|
|
|
@ -270,7 +270,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
const pushUrl = { path: to };
|
||||
if (to.endsWith('/list') || to.endsWith('/'))
|
||||
pushUrl.query = newUrl.query;
|
||||
destroy();
|
||||
else destroy();
|
||||
return router.push(pushUrl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -940,7 +940,7 @@ supplier:
|
|||
basicData:
|
||||
alias: Alias
|
||||
workerFk: Responsible
|
||||
isSerious: Verified
|
||||
isReal: Verified
|
||||
isActive: Active
|
||||
isPayMethodChecked: PayMethod checked
|
||||
note: Notes
|
||||
|
|
|
@ -938,7 +938,7 @@ supplier:
|
|||
basicData:
|
||||
alias: Alias
|
||||
workerFk: Responsable
|
||||
isSerious: Verificado
|
||||
isReal: Verificado
|
||||
isActive: Activo
|
||||
isPayMethodChecked: Método de pago validado
|
||||
note: Notas
|
||||
|
|
|
@ -104,7 +104,7 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="AccountUsers"
|
||||
data-key="AccountList"
|
||||
:expr-builder="exprBuilder"
|
||||
:label="t('account.search')"
|
||||
:info="t('account.searchInfo')"
|
||||
|
@ -112,12 +112,12 @@ const exprBuilder = (param, value) => {
|
|||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<AccountFilter data-key="AccountUsers" />
|
||||
<AccountFilter data-key="AccountList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="AccountUsers"
|
||||
data-key="AccountList"
|
||||
url="VnUsers/preview"
|
||||
:filter="filter"
|
||||
order="id DESC"
|
||||
|
|
|
@ -82,14 +82,14 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="Roles"
|
||||
data-key="AccountRolesList"
|
||||
:expr-builder="exprBuilder"
|
||||
:label="t('role.searchRoles')"
|
||||
:info="t('role.searchInfo')"
|
||||
/>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Roles"
|
||||
data-key="AccountRolesList"
|
||||
:url="`VnRoles`"
|
||||
:create="{
|
||||
urlCreate: 'VnRoles',
|
||||
|
|
|
@ -9,7 +9,7 @@ const { t } = useI18n();
|
|||
<VnCard
|
||||
data-key="Role"
|
||||
:descriptor="RoleDescriptor"
|
||||
search-data-key="AccountRoles"
|
||||
search-data-key="AccountRolesList"
|
||||
:searchbar-props="{
|
||||
url: 'VnRoles',
|
||||
label: t('role.searchRoles'),
|
||||
|
|
|
@ -130,7 +130,7 @@ function cancel() {
|
|||
<template #body-cell-description="{ row, value }">
|
||||
<QTd auto-width align="right" class="link">
|
||||
{{ value }}
|
||||
<ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
|
|
|
@ -23,7 +23,7 @@ defineExpose({ states });
|
|||
|
||||
<template>
|
||||
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -256,10 +256,10 @@ const showBalancePdf = ({ id }) => {
|
|||
{{ toCurrency(balances[rowIndex]?.balance) }}
|
||||
</template>
|
||||
<template #column-description="{ row }">
|
||||
<div class="link" v-if="row.isInvoice">
|
||||
<span class="link" v-if="row.isInvoice" @click.stop>
|
||||
{{ t('bill', { ref: row.description }) }}
|
||||
<InvoiceOutDescriptorProxy :id="row.description" />
|
||||
</div>
|
||||
<InvoiceOutDescriptorProxy :id="row.id" />
|
||||
</span>
|
||||
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||
{{ row.description }}
|
||||
</span>
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
|
||||
import { toCurrency, toPercentage, toDate } from 'src/filters';
|
||||
import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
|
@ -25,16 +25,16 @@ const $props = defineProps({
|
|||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const customer = computed(() => summary.value.entity);
|
||||
const summary = ref();
|
||||
|
||||
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
|
||||
const balanceDue = computed(() => {
|
||||
return (
|
||||
customer.value &&
|
||||
customer.value.defaulters.length &&
|
||||
customer.value.defaulters[0].amount
|
||||
);
|
||||
const amount = defaulterAmount.value;
|
||||
if (!amount || amount < 0) {
|
||||
return null;
|
||||
}
|
||||
return amount;
|
||||
});
|
||||
|
||||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
||||
const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : ''));
|
||||
|
||||
const claimRate = computed(() => {
|
||||
return customer.value.claimsRatio?.claimingRate ?? 0;
|
||||
|
@ -281,7 +281,7 @@ const sumRisk = ({ clientRisks }) => {
|
|||
<VnLv
|
||||
v-if="entity.defaulters"
|
||||
:label="t('customer.summary.balanceDue')"
|
||||
:value="toCurrency(balanceDue)"
|
||||
:value="dashOrCurrency(balanceDue)()"
|
||||
:class="balanceDueWarning"
|
||||
:info="t('customer.summary.balanceDueInfo')"
|
||||
/>
|
||||
|
|
|
@ -28,7 +28,7 @@ const exprBuilder = (param, value) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true" search-url="table">
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -394,16 +394,16 @@ function handleLocation(data, location) {
|
|||
<VnSearchbar
|
||||
:info="t('You can search by customer id or name')"
|
||||
:label="t('Search customer')"
|
||||
data-key="Customer"
|
||||
data-key="CustomerList"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<CustomerFilter data-key="Customer" />
|
||||
<CustomerFilter data-key="CustomerList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Customer"
|
||||
data-key="CustomerList"
|
||||
url="Clients/filter"
|
||||
:create="{
|
||||
urlCreate: 'Clients/createWithUser',
|
||||
|
|
|
@ -122,7 +122,7 @@ const cols = computed(() => [
|
|||
:columns="cols"
|
||||
:right-search="false"
|
||||
:disable-option="{ card: true }"
|
||||
:auto-load="!!$route.query.params"
|
||||
:auto-load="!!$route.query.table"
|
||||
>
|
||||
<template #column-supplierFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
|
|
@ -182,11 +182,11 @@ watchEffect(selectedRows);
|
|||
<VnSearchbar
|
||||
:info="t('youCanSearchByInvoiceReference')"
|
||||
:label="t('searchInvoice')"
|
||||
data-key="invoiceOut"
|
||||
data-key="invoiceOutList"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<InvoiceOutFilter data-key="invoiceOut" />
|
||||
<InvoiceOutFilter data-key="invoiceOutList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnSubToolbar>
|
||||
|
@ -203,7 +203,7 @@ watchEffect(selectedRows);
|
|||
</VnSubToolbar>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="invoiceOut"
|
||||
data-key="invoiceOutList"
|
||||
:url="`${MODEL}/filter`"
|
||||
:create="{
|
||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||
|
|
|
@ -64,8 +64,7 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
label: t('globals.name'),
|
||||
field: 'name',
|
||||
name: 'description',
|
||||
name: 'name',
|
||||
...defaultColumnAttrs,
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
|
@ -426,7 +425,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
:default-save="false"
|
||||
data-key="ItemFixedPrices"
|
||||
url="FixedPrices/filter"
|
||||
:order="['description DESC']"
|
||||
:order="['itemFk DESC', 'name DESC']"
|
||||
save-url="FixedPrices/crud"
|
||||
:user-params="{ warehouseFk: user.warehouseFk }"
|
||||
ref="tableRef"
|
||||
|
@ -441,7 +440,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
selection: 'multiple',
|
||||
}"
|
||||
:crud-model="{
|
||||
paginate: false,
|
||||
disableInfiniteScroll: true,
|
||||
}"
|
||||
v-model:selected="rowsSelected"
|
||||
:row-click="saveOnRowChange"
|
||||
|
@ -480,7 +479,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
<template #column-description="{ row }">
|
||||
<template #column-name="{ row }">
|
||||
<span class="link">
|
||||
{{ row.name }}
|
||||
</span>
|
||||
|
|
|
@ -27,7 +27,7 @@ function exprBuilder(param, value) {
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('salesOrdersTable.dateSend'),
|
||||
label: t('globals.landed'),
|
||||
name: 'dateSend',
|
||||
field: 'dateSend',
|
||||
align: 'left',
|
||||
|
|
|
@ -11,7 +11,6 @@ salesClientsTable:
|
|||
client: Client
|
||||
salesOrdersTable:
|
||||
delete: Delete
|
||||
dateSend: Send date
|
||||
dateMake: Make date
|
||||
client: Client
|
||||
salesPerson: Salesperson
|
||||
|
|
|
@ -11,7 +11,6 @@ salesClientsTable:
|
|||
client: Cliente
|
||||
salesOrdersTable:
|
||||
delete: Eliminar
|
||||
dateSend: Fecha de envío
|
||||
dateMake: Fecha de realización
|
||||
client: Cliente
|
||||
salesPerson: Comercial
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const props = defineProps({
|
||||
tags: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['applyTags']);
|
||||
const { t } = useI18n();
|
||||
|
||||
const tagValues = ref([{}]);
|
||||
const tagOptions = ref([]);
|
||||
const selectedTag = ref(null);
|
||||
|
||||
const applyTags = () => {
|
||||
if (tagValues.value.some((tag) => !tag.value)) return;
|
||||
const tagInfo = {
|
||||
values: [...tagValues.value],
|
||||
tagFk: selectedTag?.value?.id,
|
||||
tagSelection: {
|
||||
name: selectedTag?.value?.name,
|
||||
},
|
||||
};
|
||||
emit('applyTags', tagInfo);
|
||||
};
|
||||
|
||||
const getSelectedTagValues = async (tag) => {
|
||||
if (!tag?.id) return;
|
||||
const filter = {
|
||||
fields: ['value'],
|
||||
order: 'value ASC',
|
||||
limit: 30,
|
||||
};
|
||||
|
||||
const url = `Tags/${tag?.id}/filterValue`;
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
const { data } = await axios.get(url, {
|
||||
params,
|
||||
});
|
||||
tagOptions.value = data;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QForm @submit="applyTags()" class="all-pointer-events">
|
||||
<QCard class="q-pa-sm column q-pa-lg">
|
||||
<VnSelect
|
||||
:label="t('params.tag')"
|
||||
v-model="selectedTag"
|
||||
:options="props.tags"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
dense
|
||||
outlined
|
||||
class="q-mb-md"
|
||||
rounded
|
||||
:emit-value="false"
|
||||
use-input
|
||||
@update:model-value="getSelectedTagValues"
|
||||
/>
|
||||
<div
|
||||
v-for="(value, index) in tagValues"
|
||||
:key="value"
|
||||
class="filter-value column align-left"
|
||||
>
|
||||
<div class="col row q-mb-md">
|
||||
<VnSelect
|
||||
v-if="!selectedTag?.isFree && tagOptions"
|
||||
:label="t('components.itemsFilterPanel.value')"
|
||||
v-model="value.value"
|
||||
:options="tagOptions"
|
||||
option-value="value"
|
||||
option-label="value"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
emit-value
|
||||
use-input
|
||||
:disable="!value || !selectedTag"
|
||||
:is-clearable="false"
|
||||
class="col"
|
||||
/>
|
||||
<VnInput
|
||||
v-else
|
||||
v-model="value.value"
|
||||
:label="t('components.itemsFilterPanel.value')"
|
||||
:disable="!value"
|
||||
is-outlined
|
||||
class="col"
|
||||
/>
|
||||
<QBtn
|
||||
icon="delete"
|
||||
size="md"
|
||||
outlined
|
||||
dense
|
||||
rounded
|
||||
flat
|
||||
class="filter-icon col-2"
|
||||
@click="tagValues.splice(index, 1)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
flat
|
||||
class="filter-icon q-mb-md"
|
||||
size="md"
|
||||
dense
|
||||
@click="tagValues.push({})"
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon="search"
|
||||
type="submit"
|
||||
:label="$t('globals.search')"
|
||||
/>
|
||||
</QCard>
|
||||
</QForm>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.filter-icon {
|
||||
font-size: 24px;
|
||||
color: $primary;
|
||||
padding: 0 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
tag: Tag
|
||||
es:
|
||||
params:
|
||||
tag: Etiqueta
|
||||
</i18n>
|
|
@ -1,30 +1,58 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { onBeforeMount, onMounted, onUnmounted, ref, computed, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import CatalogItem from 'components/ui/CatalogItem.vue';
|
||||
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import CatalogItem from 'src/components/ui/CatalogItem.vue';
|
||||
import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import getParamWhere from 'src/filters/getParamWhere';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const dataKey = 'OrderCatalogList';
|
||||
const arrayData = useArrayData(dataKey);
|
||||
const store = arrayData.store;
|
||||
const showFilter = ref(null);
|
||||
const tags = ref([]);
|
||||
|
||||
let catalogParams = {
|
||||
orderFk: route.params.id,
|
||||
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
const whereParams = getParamWhere(route);
|
||||
if (whereParams) {
|
||||
const formattedWhereParams = {};
|
||||
if (whereParams.and) {
|
||||
whereParams.and.forEach((item) => {
|
||||
Object.assign(formattedWhereParams, item);
|
||||
});
|
||||
} else {
|
||||
Object.assign(formattedWhereParams, whereParams);
|
||||
}
|
||||
|
||||
catalogParams = {
|
||||
...catalogParams,
|
||||
...formattedWhereParams,
|
||||
};
|
||||
} else {
|
||||
showFilter.value = true;
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = true;
|
||||
checkOrderConfirmation();
|
||||
});
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
const catalogParams = {
|
||||
orderFk: route.params.id,
|
||||
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
|
||||
};
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
async function checkOrderConfirmation() {
|
||||
const response = await axios.get(`Orders/${route.params.id}`);
|
||||
|
@ -34,6 +62,7 @@ async function checkOrderConfirmation() {
|
|||
}
|
||||
|
||||
function extractTags(items) {
|
||||
if (!items || !items.length) return;
|
||||
const resultTags = [];
|
||||
(items || []).forEach((item) => {
|
||||
(item.tags || []).forEach((tag) => {
|
||||
|
@ -61,11 +90,20 @@ function extractValueTags(items) {
|
|||
);
|
||||
tagValue.value = resultValueTags;
|
||||
}
|
||||
const autoLoad = computed(() => !!catalogParams.categoryFk);
|
||||
|
||||
watch(
|
||||
() => store.data,
|
||||
(val) => {
|
||||
extractTags(val);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="OrderCatalogList"
|
||||
:data-key="dataKey"
|
||||
:user-params="catalogParams"
|
||||
:static-params="['orderFk', 'orderBy']"
|
||||
:redirect="false"
|
||||
|
@ -74,23 +112,25 @@ function extractValueTags(items) {
|
|||
:info="t('You can search items by name or id')"
|
||||
/>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<QScrollArea v-if="showFilter" class="fit text-grey-8">
|
||||
<OrderCatalogFilter
|
||||
data-key="OrderCatalogList"
|
||||
:data-key="dataKey"
|
||||
:tag-value="tagValue"
|
||||
:tags="tags"
|
||||
:initial-catalog-params="catalogParams"
|
||||
/>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="full-width">
|
||||
<VnPaginate
|
||||
data-key="OrderCatalogList"
|
||||
:data-key="dataKey"
|
||||
url="Orders/CatalogFilter"
|
||||
:limit="50"
|
||||
:user-params="catalogParams"
|
||||
@on-fetch="extractTags"
|
||||
@on-fetch="showFilter = true"
|
||||
:update-router="false"
|
||||
:auto-load="autoLoad"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<div class="catalog-list">
|
||||
|
@ -102,6 +142,7 @@ function extractValueTags(items) {
|
|||
:key="row.id"
|
||||
:item="row"
|
||||
is-catalog
|
||||
class="fill-icon"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
|
@ -9,10 +9,9 @@ import VnSelect from 'components/common/VnSelect.vue';
|
|||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import getParamWhere from 'src/filters/getParamWhere';
|
||||
import CatalogFilterValueDialog from 'src/pages/Order/Card/CatalogFilterValueDialog.vue';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const route = useRoute();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
|
@ -27,13 +26,19 @@ const props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const arrayData = useArrayData(props.dataKey);
|
||||
|
||||
const currentParams = ref({});
|
||||
const categoryList = ref(null);
|
||||
const selectedCategoryFk = ref(getParamWhere(route, 'categoryFk'));
|
||||
const selectedCategoryFk = ref(null);
|
||||
const typeList = ref([]);
|
||||
const selectedTypeFk = ref(null);
|
||||
const selectedTag = ref(null);
|
||||
const tagValues = ref([{}]);
|
||||
const tagOptions = ref([]);
|
||||
const searchByTag = ref(null);
|
||||
|
||||
const vnFilterPanelRef = ref();
|
||||
const orderByList = ref([
|
||||
{ id: 'relevancy DESC, name', name: t('params.relevancy'), priority: 999 },
|
||||
|
@ -48,34 +53,30 @@ const orderWayList = ref([
|
|||
const orderBySelected = ref('relevancy DESC, name');
|
||||
const orderWaySelected = ref('ASC');
|
||||
|
||||
const createValue = (val, done) => {
|
||||
if (val.length > 2) {
|
||||
if (!tagOptions.value.includes(val)) {
|
||||
done(tagOptions.value, 'add-unique');
|
||||
}
|
||||
tagValues.value.push({ value: val });
|
||||
}
|
||||
};
|
||||
const resetCategory = () => {
|
||||
onMounted(() => {
|
||||
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
|
||||
selectedTypeFk.value = getParamWhere(route, 'typeFk');
|
||||
});
|
||||
|
||||
const resetCategory = (params, search) => {
|
||||
selectedCategoryFk.value = null;
|
||||
typeList.value = null;
|
||||
};
|
||||
|
||||
const clearFilter = (key) => {
|
||||
if (key === 'categoryFk') {
|
||||
resetCategory();
|
||||
}
|
||||
params.categoryFk = null;
|
||||
params.typeFk = null;
|
||||
arrayData.store.userFilter = null;
|
||||
removeTagGroupParam(search);
|
||||
};
|
||||
|
||||
const selectCategory = (params, category, search) => {
|
||||
if (params.categoryFk === category?.id) {
|
||||
resetCategory();
|
||||
params.categoryFk = null;
|
||||
} else {
|
||||
resetCategory(params, search);
|
||||
return;
|
||||
}
|
||||
selectedCategoryFk.value = category?.id;
|
||||
params.categoryFk = category?.id;
|
||||
params.typeFk = null;
|
||||
selectedTypeFk.value = null;
|
||||
loadTypes(category?.id);
|
||||
}
|
||||
search();
|
||||
};
|
||||
|
||||
|
@ -86,19 +87,12 @@ const loadTypes = async (categoryFk = selectedCategoryFk.value) => {
|
|||
typeList.value = data;
|
||||
};
|
||||
|
||||
const selectedCategory = computed(() =>
|
||||
(categoryList.value || []).find(
|
||||
const selectedCategory = computed(() => {
|
||||
return (categoryList.value || []).find(
|
||||
(category) => category?.id === selectedCategoryFk.value
|
||||
)
|
||||
);
|
||||
function filterFn(val, update) {
|
||||
update(() => {
|
||||
const needle = val.toLowerCase();
|
||||
tagOptions.value = props.tagValue.filter(
|
||||
(v) => v.toLowerCase().indexOf(needle) > -1
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const selectedType = computed(() => {
|
||||
return (typeList.value || []).find((type) => type?.id === selectedTypeFk.value);
|
||||
});
|
||||
|
@ -114,35 +108,35 @@ function exprBuilder(param, value) {
|
|||
}
|
||||
}
|
||||
|
||||
const applyTagFilter = (params, search) => {
|
||||
if (!tagValues.value?.length) {
|
||||
const applyTags = (tagInfo, params, search) => {
|
||||
if (!tagInfo || !tagInfo.values.length) {
|
||||
params.tagGroups = null;
|
||||
search();
|
||||
return;
|
||||
}
|
||||
if (!params.tagGroups) {
|
||||
params.tagGroups = [];
|
||||
}
|
||||
params.tagGroups.push(
|
||||
JSON.stringify({
|
||||
values: tagValues.value.filter((obj) => Object.keys(obj).length > 0),
|
||||
tagSelection: {
|
||||
...selectedTag.value,
|
||||
orgShowField: selectedTag?.value?.name,
|
||||
},
|
||||
tagFk: selectedTag?.value?.tagFk,
|
||||
})
|
||||
);
|
||||
|
||||
if (!params.tagGroups) params.tagGroups = [];
|
||||
params.tagGroups.push(tagInfo);
|
||||
search();
|
||||
selectedTag.value = null;
|
||||
tagValues.value = [{}];
|
||||
};
|
||||
|
||||
const removeTagChip = (selection, params, search) => {
|
||||
if (params.tagGroups) {
|
||||
params.tagGroups = (params.tagGroups || []).filter(
|
||||
(value) => value !== selection
|
||||
);
|
||||
async function onSearchByTag(value) {
|
||||
if (!value.target.value) return;
|
||||
if (!currentParams.value?.tagGroups) {
|
||||
currentParams.value.tagGroups = [];
|
||||
}
|
||||
|
||||
currentParams.value.tagGroups.push({
|
||||
values: [{ value: value.target.value }],
|
||||
});
|
||||
searchByTag.value = null;
|
||||
}
|
||||
|
||||
const removeTagGroupParam = (search, valIndex) => {
|
||||
if (!valIndex && valIndex !== 0) {
|
||||
currentParams.value.tagGroups = null;
|
||||
} else {
|
||||
currentParams.value.tagGroups.splice(valIndex, 1);
|
||||
}
|
||||
search();
|
||||
};
|
||||
|
@ -164,6 +158,12 @@ const getCategoryClass = (category, params) => {
|
|||
}
|
||||
};
|
||||
|
||||
const clearFilter = (key) => {
|
||||
if (key === 'categoryFk') {
|
||||
resetCategory();
|
||||
}
|
||||
};
|
||||
|
||||
function addOrder(value, field, params) {
|
||||
let { orderBy } = params;
|
||||
orderBy = JSON.parse(orderBy);
|
||||
|
@ -174,22 +174,20 @@ function addOrder(value, field, params) {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
|
||||
<FetchData url="ItemCategories" auto-load @on-fetch="setCategoryList" />
|
||||
<VnFilterPanel
|
||||
ref="vnFilterPanelRef"
|
||||
:data-key="props.dataKey"
|
||||
:hidden-tags="['orderFk', 'orderBy']"
|
||||
:un-removable-params="['orderFk', 'orderBy']"
|
||||
:expr-builder="exprBuilder"
|
||||
:custom-tags="['tagGroups']"
|
||||
@remove="clearFilter"
|
||||
:custom-tags="['tagGroups', 'categoryFk']"
|
||||
:redirect="false"
|
||||
@remove="clearFilter"
|
||||
v-model="currentParams"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<strong v-if="tag.label === 'categoryFk'">
|
||||
{{ t(selectedCategory?.name || '') }}
|
||||
</strong>
|
||||
<strong v-else-if="tag.label === 'typeFk'">
|
||||
<strong v-if="tag.label === 'typeFk'">
|
||||
{{ t(selectedType?.name || '') }}
|
||||
</strong>
|
||||
<div v-else class="q-gutter-x-xs">
|
||||
|
@ -198,24 +196,35 @@ function addOrder(value, field, params) {
|
|||
</div>
|
||||
</template>
|
||||
<template #customTags="{ tags: customTags, params, searchFn }">
|
||||
<template v-for="tag in customTags" :key="tag.label">
|
||||
<template v-if="tag.label === 'tagGroups'">
|
||||
<template v-for="customTag in customTags" :key="customTag.label">
|
||||
<VnFilterPanelChip
|
||||
v-for="chip in tag.value"
|
||||
:key="chip"
|
||||
v-for="(tag, valIndex) in Array.isArray(customTag.value)
|
||||
? customTag.value
|
||||
: 1"
|
||||
:key="valIndex"
|
||||
removable
|
||||
@remove="removeTagChip(chip, params, searchFn)"
|
||||
@remove="
|
||||
customTag.label === 'categoryFk'
|
||||
? resetCategory(params, searchFn)
|
||||
: removeTagGroupParam(searchFn, valIndex)
|
||||
"
|
||||
>
|
||||
<strong> {{ JSON.parse(chip).tagSelection?.name }}: </strong>
|
||||
<span>{{
|
||||
(JSON.parse(chip).values || [])
|
||||
.map((item) => item.value)
|
||||
.join(' | ')
|
||||
}}</span>
|
||||
<strong v-if="customTag.label === 'categoryFk'">
|
||||
{{ t(selectedCategory?.name || '') }}
|
||||
</strong>
|
||||
<strong v-if="tag?.tagSelection?.name" class="q-mr-xs">
|
||||
{{ tag.tagSelection.name }}:
|
||||
</strong>
|
||||
<span>
|
||||
{{
|
||||
(tag?.values || [])
|
||||
.map((item) => `"${item.value}"`)
|
||||
.join(', ')
|
||||
}}
|
||||
</span>
|
||||
</VnFilterPanelChip>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem class="category-filter q-mt-md">
|
||||
<div
|
||||
|
@ -297,91 +306,39 @@ function addOrder(value, field, params) {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<QItem class="q-mt-md">
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('params.tag')"
|
||||
v-model="selectedTag"
|
||||
:options="props.tags || []"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:emit-value="false"
|
||||
use-input
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-for="(value, index) in tagValues"
|
||||
:key="value"
|
||||
class="q-mt-md filter-value"
|
||||
>
|
||||
<FetchData
|
||||
v-if="selectedTag"
|
||||
:url="`Tags/${selectedTag}/filterValue`"
|
||||
limit="30"
|
||||
auto-load
|
||||
@on-fetch="(data) => (tagOptions = data)"
|
||||
/>
|
||||
<VnSelect
|
||||
v-if="!selectedTag"
|
||||
:label="t('params.value')"
|
||||
v-model="value.value"
|
||||
:options="tagOptions || []"
|
||||
option-value="value"
|
||||
option-label="value"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
emit-value
|
||||
use-input
|
||||
class="filter-input"
|
||||
@new-value="createValue"
|
||||
@filter="filterFn"
|
||||
@update:model-value="applyTagFilter(params, searchFn)"
|
||||
/>
|
||||
<VnSelect
|
||||
v-else-if="selectedTag === 1"
|
||||
:label="t('params.value')"
|
||||
v-model="value.value"
|
||||
:options="tagOptions || []"
|
||||
option-value="value"
|
||||
option-label="value"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
emit-value
|
||||
use-input
|
||||
class="filter-input"
|
||||
@new-value="createValue"
|
||||
@update:model-value="applyTagFilter(params, searchFn)"
|
||||
/>
|
||||
<QItem class="q-mt-lg q-pa-none">
|
||||
<VnInput
|
||||
v-else
|
||||
:label="t('params.value')"
|
||||
v-model="value.value"
|
||||
:label="t('components.itemsFilterPanel.value')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
class="filter-input"
|
||||
@keyup.enter="applyTagFilter(params, searchFn)"
|
||||
/>
|
||||
<QIcon
|
||||
name="delete"
|
||||
class="filter-icon"
|
||||
@click="(tagValues || []).splice(index, 1)"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-lg">
|
||||
:is-clearable="false"
|
||||
v-model="searchByTag"
|
||||
@keyup.enter="(val) => onSearchByTag(val, params)"
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="search" />
|
||||
</template>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
shortcut="+"
|
||||
flat
|
||||
class="filter-icon"
|
||||
@click="tagValues.push({})"
|
||||
color="primary"
|
||||
size="md"
|
||||
dense
|
||||
/>
|
||||
<QPopupProxy>
|
||||
<CatalogFilterValueDialog
|
||||
style="display: inline-block"
|
||||
:tags="tags"
|
||||
@apply-tags="
|
||||
($event) => applyTags($event, currentParams, searchFn)
|
||||
"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
</VnInput>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
</template>
|
||||
|
@ -416,23 +373,6 @@ function addOrder(value, field, params) {
|
|||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-icon {
|
||||
font-size: 24px;
|
||||
color: $primary;
|
||||
padding: 0 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.filter-input {
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.filter-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -111,6 +111,7 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Items',
|
||||
sortBy: 'name ASC ',
|
||||
fields: ['id', 'name', 'subName'],
|
||||
},
|
||||
columnField: {
|
||||
|
|
|
@ -126,7 +126,6 @@ const setWireTransfer = async () => {
|
|||
(_, requestResponse) =>
|
||||
onBankEntityCreated(requestResponse, row)
|
||||
"
|
||||
:show-entity-field="false"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
|
|
|
@ -61,8 +61,8 @@ const workersOptions = ref([]);
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<QCheckbox
|
||||
v-model="data.isSerious"
|
||||
:label="t('supplier.basicData.isSerious')"
|
||||
v-model="data.isReal"
|
||||
:label="t('supplier.basicData.isReal')"
|
||||
/>
|
||||
<QCheckbox
|
||||
v-model="data.isActive"
|
||||
|
|
|
@ -38,7 +38,7 @@ const filter = {
|
|||
'payDemFk',
|
||||
'payDay',
|
||||
'isActive',
|
||||
'isSerious',
|
||||
'isReal',
|
||||
'isTrucker',
|
||||
'account',
|
||||
],
|
||||
|
@ -137,7 +137,7 @@ const getEntryQueryParams = (supplier) => {
|
|||
<QTooltip>{{ t('Inactive supplier') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="!supplier.isSerious"
|
||||
v-if="!supplier.isReal"
|
||||
name="vn:supplierfalse"
|
||||
color="primary"
|
||||
size="xs"
|
||||
|
|
|
@ -67,7 +67,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
|
|||
</VnLv>
|
||||
<QCheckbox
|
||||
:label="t('supplier.summary.verified')"
|
||||
v-model="supplier.isSerious"
|
||||
v-model="supplier.isReal"
|
||||
:disable="true"
|
||||
/>
|
||||
<QCheckbox
|
||||
|
|
|
@ -16,12 +16,9 @@ import { useAcl } from 'src/composables/useAcl';
|
|||
import { useValidator } from 'src/composables/useValidator';
|
||||
import { toTimeFormat } from 'filters/date.js';
|
||||
|
||||
const $props = defineProps({
|
||||
formData: {
|
||||
const formData = defineModel({
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['updateForm']);
|
||||
|
@ -40,7 +37,6 @@ const agenciesOptions = ref([]);
|
|||
const zonesOptions = ref([]);
|
||||
const addresses = ref([]);
|
||||
const zoneSelectRef = ref();
|
||||
const formData = ref($props.formData);
|
||||
|
||||
watch(
|
||||
() => formData.value,
|
||||
|
@ -69,75 +65,44 @@ const zoneWhere = computed(() => {
|
|||
: {};
|
||||
});
|
||||
|
||||
const getLanded = async (params) => {
|
||||
try {
|
||||
const validParams =
|
||||
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||
if (!validParams) return;
|
||||
async function getLanded(params) {
|
||||
getDate(`Agencies/getLanded`, params);
|
||||
}
|
||||
|
||||
async function getShipped(params) {
|
||||
getDate(`Agencies/getShipped`, params);
|
||||
}
|
||||
|
||||
async function getDate(query, params) {
|
||||
for (const param in params) {
|
||||
if (!params[param]) return;
|
||||
}
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
const { data } = await axios.get(`Agencies/getLanded`, { params });
|
||||
if (data) {
|
||||
formData.value.zoneFk = data.zoneFk;
|
||||
formData.value.landed = data.landed;
|
||||
formData.value.shipped = params.shipped;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
}
|
||||
};
|
||||
const { data } = await axios.get(query, { params });
|
||||
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
|
||||
const getShipped = async (params) => {
|
||||
try {
|
||||
const validParams =
|
||||
landed.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||
if (!validParams) return;
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
const { data } = await axios.get(`Agencies/getShipped`, { params });
|
||||
if (data) {
|
||||
formData.value.zoneFk = data.zoneFk;
|
||||
formData.value.landed = params.landed;
|
||||
formData.value.shipped = data.shipped;
|
||||
} else {
|
||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
}
|
||||
};
|
||||
if (data.landed) formData.value.landed = data.landed;
|
||||
if (data.shipped) formData.value.shipped = data.shipped;
|
||||
}
|
||||
|
||||
const onChangeZone = async (zoneId) => {
|
||||
try {
|
||||
formData.value.agencyModeFk = null;
|
||||
const { data } = await axios.get(`Zones/${zoneId}`);
|
||||
formData.value.agencyModeFk = data.agencyModeFk;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const onChangeAddress = async (addressId) => {
|
||||
try {
|
||||
formData.value.nickname = null;
|
||||
const { data } = await axios.get(`Addresses/${addressId}`);
|
||||
formData.value.nickname = data.nickname;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const getClientDefaultAddress = async (clientId) => {
|
||||
try {
|
||||
const { data } = await axios.get(`Clients/${clientId}`);
|
||||
if (data) addressId.value = data.defaultAddressFk;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const clientAddressesList = async (value) => {
|
||||
|
@ -189,18 +154,26 @@ const clientId = computed({
|
|||
},
|
||||
});
|
||||
|
||||
const landed = computed({
|
||||
get: () => formData.value?.landed,
|
||||
set: (val) => {
|
||||
formData.value.landed = val;
|
||||
getShipped({
|
||||
landed: val,
|
||||
function addDateParams(obj) {
|
||||
return {
|
||||
...obj,
|
||||
...{
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
async function setLanded(landed) {
|
||||
if (!landed) return;
|
||||
getShipped(addDateParams({ landed }));
|
||||
}
|
||||
|
||||
async function setShipped(shipped) {
|
||||
if (!shipped) return;
|
||||
getLanded(addDateParams({ shipped }));
|
||||
}
|
||||
|
||||
const agencyModeId = computed({
|
||||
get: () => formData.value.agencyModeFk,
|
||||
|
@ -248,21 +221,6 @@ const warehouseId = computed({
|
|||
},
|
||||
});
|
||||
|
||||
const shipped = computed({
|
||||
get: () => formData.value?.shipped,
|
||||
set: (val) => {
|
||||
if (new Date(formData.value?.shipped).toDateString() != val.toDateString())
|
||||
val.setHours(0, 0, 0, 0);
|
||||
formData.value.shipped = val;
|
||||
getLanded({
|
||||
shipped: val,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const onFormModelInit = () => {
|
||||
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
||||
};
|
||||
|
@ -463,18 +421,21 @@ async function getZone(options) {
|
|||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shipped')"
|
||||
@update:model-value="setShipped"
|
||||
/>
|
||||
<VnInputTime
|
||||
:label="t('basicData.shippedHour')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shippedHour')"
|
||||
@update:model-value="setShipped"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('basicData.landed')"
|
||||
v-model="formData.landed"
|
||||
:required="true"
|
||||
:rules="validate('basicData.landed')"
|
||||
@update:model-value="setLanded"
|
||||
/>
|
||||
</VnRow>
|
||||
</QForm>
|
||||
|
|
|
@ -70,7 +70,6 @@ const isFormInvalid = () => {
|
|||
};
|
||||
|
||||
const getPriceDifference = async () => {
|
||||
try {
|
||||
const params = {
|
||||
landed: formData.value.landed,
|
||||
addressId: formData.value.addressFk,
|
||||
|
@ -84,15 +83,10 @@ const getPriceDifference = async () => {
|
|||
params
|
||||
);
|
||||
formData.value.sale = data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
try {
|
||||
if (!formData.value.option)
|
||||
return notify(t('basicData.chooseAnOption'), 'negative');
|
||||
if (!formData.value.option) return notify(t('basicData.chooseAnOption'), 'negative');
|
||||
|
||||
const params = {
|
||||
clientFk: formData.value.clientFk,
|
||||
|
@ -121,9 +115,6 @@ const submit = async () => {
|
|||
const ticketToMove = data.id;
|
||||
notify(t('basicData.unroutedTicket'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: ticketToMove } });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const submitWithNegatives = async () => {
|
||||
|
@ -167,7 +158,7 @@ onBeforeMount(async () => await getTicketData());
|
|||
<TicketBasicDataForm
|
||||
v-if="initialDataLoaded"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
:form-data="formData"
|
||||
v-model="formData"
|
||||
/>
|
||||
</QStep>
|
||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref, toRefs } from 'vue';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
|
@ -23,7 +23,6 @@ const props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
const route = useRoute();
|
||||
|
||||
const { push, currentRoute } = useRouter();
|
||||
const { dialog, notify } = useQuasar();
|
||||
|
@ -31,7 +30,7 @@ const { t } = useI18n();
|
|||
const { openReport, sendEmail } = usePrintService();
|
||||
const ticketSummary = useArrayData('TicketSummary');
|
||||
const { ticket } = toRefs(props);
|
||||
const ticketId = currentRoute.value.params.id;
|
||||
const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
|
||||
const client = ref();
|
||||
const showTransferDialog = ref(false);
|
||||
const showTurnDialog = ref(false);
|
||||
|
@ -68,7 +67,7 @@ const actions = {
|
|||
setWeight: async () => {
|
||||
try {
|
||||
const invoiceIds = (
|
||||
await axios.post(`Tickets/${ticketId}/setWeight`, {
|
||||
await axios.post(`Tickets/${ticketId.value}/setWeight`, {
|
||||
weight: weight.value,
|
||||
})
|
||||
).data;
|
||||
|
@ -86,7 +85,7 @@ const actions = {
|
|||
},
|
||||
remove: async () => {
|
||||
try {
|
||||
await axios.post(`Tickets/${ticketId}/setDeleted`);
|
||||
await axios.post(`Tickets/${ticketId.value}/setDeleted`);
|
||||
|
||||
notify({ message: t('Ticket deleted'), type: 'positive' });
|
||||
notify({
|
||||
|
@ -176,14 +175,14 @@ function showSmsDialog(template, customData) {
|
|||
}
|
||||
|
||||
async function showSmsDialogWithChanges() {
|
||||
const query = `TicketLogs/${ticketId}/getChanges`;
|
||||
const query = `TicketLogs/${ticketId.value}/getChanges`;
|
||||
const response = await axios.get(query);
|
||||
|
||||
showSmsDialog('orderChanges', { changes: response.data });
|
||||
}
|
||||
|
||||
async function sendSms(body) {
|
||||
await axios.post(`Tickets/${ticketId}/sendSms`, body);
|
||||
await axios.post(`Tickets/${ticketId.value}/sendSms`, body);
|
||||
notify({
|
||||
message: 'Notification sent',
|
||||
type: 'positive',
|
||||
|
@ -240,7 +239,7 @@ function makeInvoiceDialog() {
|
|||
}
|
||||
async function makeInvoice() {
|
||||
const params = {
|
||||
ticketsIds: [parseInt(ticketId)],
|
||||
ticketsIds: [parseInt(ticketId.value)],
|
||||
};
|
||||
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
||||
|
||||
|
@ -256,14 +255,17 @@ async function transferClient(client) {
|
|||
clientFk: client,
|
||||
};
|
||||
|
||||
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params);
|
||||
const { data } = await axios.patch(
|
||||
`Tickets/${ticketId.value}/transferClient`,
|
||||
params
|
||||
);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
||||
async function addTurn(day) {
|
||||
const params = {
|
||||
ticketFk: parseInt(ticketId),
|
||||
ticketFk: parseInt(ticketId.value),
|
||||
weekDay: day,
|
||||
agencyModeFk: ticket.value.agencyModeFk,
|
||||
};
|
||||
|
@ -278,7 +280,7 @@ async function addTurn(day) {
|
|||
|
||||
async function createRefund(withWarehouse) {
|
||||
const params = {
|
||||
ticketsIds: [parseInt(ticketId)],
|
||||
ticketsIds: [parseInt(ticketId.value)],
|
||||
withWarehouse: withWarehouse,
|
||||
negative: true,
|
||||
};
|
||||
|
@ -296,7 +298,10 @@ async function changeShippedHour(time) {
|
|||
shipped: time,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params);
|
||||
const { data } = await axios.post(
|
||||
`Tickets/${ticketId.value}/updateEditableTicket`,
|
||||
params
|
||||
);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
@ -313,7 +318,7 @@ function openRecalculateDialog() {
|
|||
}
|
||||
|
||||
async function recalculateComponents() {
|
||||
await axios.post(`Tickets/${ticketId}/recalculateComponents`);
|
||||
await axios.post(`Tickets/${ticketId.value}/recalculateComponents`);
|
||||
notify({
|
||||
message: t('Data saved'),
|
||||
type: 'positive',
|
||||
|
@ -336,11 +341,11 @@ async function handleInvoiceOutData() {
|
|||
}
|
||||
|
||||
async function docuwareDownload() {
|
||||
await axios.get(`Tickets/${ticketId}/docuwareDownload`);
|
||||
await axios.get(`Tickets/${ticketId.value}/docuwareDownload`);
|
||||
}
|
||||
|
||||
async function hasDocuware() {
|
||||
const { data } = await axios.post(`Docuwares/${ticketId}/checkFile`, {
|
||||
const { data } = await axios.post(`Docuwares/${ticketId.value}/checkFile`, {
|
||||
fileCabinet: 'deliveryNote',
|
||||
signed: true,
|
||||
});
|
||||
|
@ -348,7 +353,6 @@ async function hasDocuware() {
|
|||
}
|
||||
|
||||
async function uploadDocuware(force) {
|
||||
console.log('force: ', force);
|
||||
if (!force)
|
||||
return quasar
|
||||
.dialog({
|
||||
|
@ -364,7 +368,7 @@ async function uploadDocuware(force) {
|
|||
|
||||
const { data } = await axios.post(`Docuwares/upload`, {
|
||||
fileCabinet: 'deliveryNote',
|
||||
ticketIds: [parseInt(ticketId)],
|
||||
ticketIds: [parseInt(ticketId.value)],
|
||||
});
|
||||
|
||||
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
|
||||
|
@ -372,11 +376,7 @@ async function uploadDocuware(force) {
|
|||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
:url="
|
||||
route.path.startsWith('/ticket')
|
||||
? `Tickets/${ticketId}/isEditable`
|
||||
: `Tickets/${ticket}/isEditable`
|
||||
"
|
||||
:url="`Tickets/${ticketId}/isEditable`"
|
||||
auto-load
|
||||
@on-fetch="handleFetchData"
|
||||
/>
|
||||
|
@ -397,8 +397,6 @@ async function uploadDocuware(force) {
|
|||
<VnSelect
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="client"
|
||||
:label="t('Client')"
|
||||
auto-load
|
||||
|
|
|
@ -106,6 +106,13 @@ const columns = computed(() => [
|
|||
format: (row) => row?.item?.name,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.size'),
|
||||
name: 'size',
|
||||
format: (row) => row?.item?.size,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.price'),
|
||||
|
@ -614,7 +621,7 @@ watch(
|
|||
}"
|
||||
:create-as-dialog="false"
|
||||
:crud-model="{
|
||||
paginate: false,
|
||||
disableInfiniteScroll: true,
|
||||
}"
|
||||
:default-remove="false"
|
||||
:default-reset="false"
|
||||
|
|
|
@ -20,6 +20,7 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
|||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { notify } = useNotify();
|
||||
|
@ -116,7 +117,8 @@ function toTicketUrl(section) {
|
|||
{{ entity.nickname }}
|
||||
</div>
|
||||
</template>
|
||||
<template #header-right>
|
||||
<template #header-right="{ entity }">
|
||||
<div>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
|
@ -134,6 +136,17 @@ function toTicketUrl(section) {
|
|||
@update:model-value="changeState"
|
||||
/>
|
||||
</QBtnDropdown>
|
||||
<QBtn color="white" dense flat icon="more_vert" round size="md">
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
</QTooltip>
|
||||
<QMenu>
|
||||
<QList>
|
||||
<TicketDescriptorMenu :ticket="entity" />
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QBtn>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<QCard class="vn-one">
|
||||
|
|
|
@ -47,7 +47,7 @@ const getGroupedStates = (data) => {
|
|||
/>
|
||||
<FetchData url="AgencyModes" @on-fetch="(data) => (agencies = data)" auto-load />
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -460,18 +460,18 @@ function setReference(data) {
|
|||
auto-load
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="Ticket"
|
||||
data-key="TicketList"
|
||||
:label="t('Search ticket')"
|
||||
:info="t('You can search by ticket id or alias')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<TicketFilter data-key="Ticket" />
|
||||
<TicketFilter data-key="TicketList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Ticket"
|
||||
data-key="TicketList"
|
||||
url="Tickets/filter"
|
||||
:create="{
|
||||
urlCreate: 'Tickets/new',
|
||||
|
|
|
@ -48,6 +48,7 @@ ticketSale:
|
|||
shipped: Shipped
|
||||
agency: Agency
|
||||
address: Address
|
||||
size: Size
|
||||
advanceTickets:
|
||||
preparation: Preparation
|
||||
origin: Origin
|
||||
|
|
|
@ -184,6 +184,7 @@ ticketSale:
|
|||
shipped: F. Envío
|
||||
agency: Agencia
|
||||
address: Consignatario
|
||||
size: Medida
|
||||
ticketComponents:
|
||||
item: Artículo
|
||||
description: Descripción
|
||||
|
|
|
@ -24,7 +24,7 @@ defineExpose({ states });
|
|||
|
||||
<template>
|
||||
<FetchData url="warehouses" @on-fetch="(data) => (states = data)" auto-load />
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -14,6 +14,7 @@ import WorkerFilter from '../WorkerFilter.vue';
|
|||
url: 'Workers/filter',
|
||||
label: 'Search worker',
|
||||
info: 'You can search by worker id or name',
|
||||
order: 'id DESC',
|
||||
}"
|
||||
:redirect-on-error="true"
|
||||
/>
|
||||
|
|
|
@ -69,7 +69,7 @@ function setNotifications(data) {
|
|||
:default-reset="false"
|
||||
:default-remove="false"
|
||||
:default-save="false"
|
||||
@on-fetch="setNotifications"
|
||||
@on-fetch="(data) => data && setNotifications(data)"
|
||||
search-url="notifications"
|
||||
>
|
||||
<template #body>
|
||||
|
|
|
@ -169,7 +169,7 @@ async function autofillBic(worker) {
|
|||
</script>
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="Worker"
|
||||
data-key="WorkerList"
|
||||
:label="t('Search worker')"
|
||||
:info="t('You can search by worker id or name')"
|
||||
/>
|
||||
|
@ -191,13 +191,13 @@ async function autofillBic(worker) {
|
|||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<WorkerFilter data-key="Worker" />
|
||||
<WorkerFilter data-key="WorkerList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
v-if="defaultPayMethod"
|
||||
ref="tableRef"
|
||||
data-key="Worker"
|
||||
data-key="WorkerList"
|
||||
url="Workers/filter"
|
||||
:create="{
|
||||
urlCreate: 'Workers/new',
|
||||
|
|
|
@ -26,7 +26,7 @@ const exprBuilder = (param, value) => {
|
|||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="Zones"
|
||||
data-key="ZonesList"
|
||||
url="Zones"
|
||||
:filter="{
|
||||
include: { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||
|
|
|
@ -32,7 +32,6 @@ const agencies = ref([]);
|
|||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:hidden-tags="['search']"
|
||||
search-url="table"
|
||||
>
|
||||
<template #tags="{ tag }">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
|
|
@ -139,12 +139,12 @@ onMounted(() => (stateStore.rightDrawer = true));
|
|||
<ZoneSearchbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<ZoneFilterPanel data-key="Zones" />
|
||||
<ZoneFilterPanel data-key="ZonesList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="Zones"
|
||||
data-key="ZonesList"
|
||||
url="Zones"
|
||||
:create="{
|
||||
urlCreate: 'Zones',
|
||||
|
|
|
@ -8,7 +8,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
|||
userFilter: {},
|
||||
userParams: {},
|
||||
url: '',
|
||||
limit: 10,
|
||||
limit: 20,
|
||||
skip: 0,
|
||||
order: '',
|
||||
isLoading: false,
|
||||
|
|
|
@ -5,7 +5,7 @@ import { useRouter } from 'vue-router';
|
|||
import * as vueRouter from 'vue-router';
|
||||
|
||||
describe('useArrayData', () => {
|
||||
const filter = '{"limit":10,"skip":0}';
|
||||
const filter = '{"limit":20,"skip":0}';
|
||||
const params = { supplierFk: 2 };
|
||||
beforeEach(() => {
|
||||
vi.spyOn(useRouter(), 'replace');
|
||||
|
|
Loading…
Reference in New Issue