Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into 7353-hotfix-fixScopeDays

This commit is contained in:
Jorge Penadés 2024-10-14 15:54:08 +02:00
commit 19545ca7e6
22 changed files with 93 additions and 95 deletions

View File

@ -310,7 +310,7 @@ defineExpose({
params, params,
}); });
function handleOnDataSaved(_, res) { function handleOnDataSaved(_) {
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value }); if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
else $props.create.onDataSaved(_); else $props.create.onDataSaved(_);
} }

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, computed } from 'vue'; import { computed } from 'vue';
import { useRole } from 'src/composables/useRole'; import { useRole } from 'src/composables/useRole';
import { useAcl } from 'src/composables/useAcl'; import { useAcl } from 'src/composables/useAcl';

View File

@ -31,7 +31,7 @@ const dialog = ref(null);
<div class="container order-catalog-item overflow-hidden"> <div class="container order-catalog-item overflow-hidden">
<QCard class="card shadow-6"> <QCard class="card shadow-6">
<div class="img-wrapper"> <div class="img-wrapper">
<VnImg :id="item.id" class="image" /> <VnImg :id="item.id" class="image" zoom-resolution="1600x900" />
<div v-if="item.hex && isCatalog" class="item-color-container"> <div v-if="item.hex && isCatalog" class="item-color-container">
<div <div
class="item-color" class="item-color"

View File

@ -56,7 +56,7 @@ const props = defineProps({
}, },
offset: { offset: {
type: Number, type: Number,
default: 0, default: undefined,
}, },
skeleton: { skeleton: {
type: Boolean, type: Boolean,

View File

@ -5,7 +5,8 @@ import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import AccountSummary from './Card/AccountSummary.vue'; import AccountSummary from './Card/AccountSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import AccountFilter from './AccountFilter.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const tableRef = ref(); const tableRef = ref();
@ -18,14 +19,6 @@ const columns = computed(() => [
isId: true, isId: true,
field: 'id', field: 'id',
cardVisible: true, cardVisible: true,
columnFilter: {
component: 'select',
name: 'search',
attrs: {
url: 'VnUsers/preview',
fields: ['id', 'name'],
},
},
}, },
{ {
align: 'left', align: 'left',
@ -36,9 +29,6 @@ const columns = computed(() => [
columnField: { columnField: {
component: null, component: null,
}, },
columnFilter: {
inWhere: true,
},
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -50,9 +40,6 @@ const columns = computed(() => [
columnField: { columnField: {
component: null, component: null,
}, },
columnFilter: {
inWhere: true,
},
cardVisible: true, cardVisible: true,
create: true, create: true,
}, },
@ -105,7 +92,11 @@ const exprBuilder = (param, value) => {
:label="t('account.search')" :label="t('account.search')"
:info="t('account.searchInfo')" :info="t('account.searchInfo')"
/> />
<RightMenu>
<template #right-panel>
<AccountFilter data-key="AccountUsers" />
</template>
</RightMenu>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="AccountUsers" data-key="AccountUsers"
@ -115,6 +106,8 @@ const exprBuilder = (param, value) => {
default-mode="table" default-mode="table"
redirect="account" redirect="account"
:use-model="true" :use-model="true"
:right-search="false"
auto-load
/> />
</template> </template>

View File

@ -10,7 +10,7 @@ const { t } = useI18n();
<VnCard <VnCard
data-key="Account" data-key="Account"
:descriptor="AccountDescriptor" :descriptor="AccountDescriptor"
search-data-key="AccountUsers" search-data-key="AccountList"
:searchbar-props="{ :searchbar-props="{
url: 'VnUsers/preview', url: 'VnUsers/preview',
label: t('account.search'), label: t('account.search'),

View File

@ -9,7 +9,6 @@ import RefundInvoiceForm from 'src/components/RefundInvoiceForm.vue';
import SendEmailDialog from 'components/common/SendEmailDialog.vue'; import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import useNotify from 'src/composables/useNotify'; import useNotify from 'src/composables/useNotify';
import { useSession } from 'src/composables/useSession';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
@ -30,8 +29,6 @@ const $props = defineProps({
const { notify } = useNotify(); const { notify } = useNotify();
const router = useRouter(); const router = useRouter();
const session = useSession();
const token = session.getToken();
const { t } = useI18n(); const { t } = useI18n();
const { openReport, sendEmail } = usePrintService(); const { openReport, sendEmail } = usePrintService();
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();

View File

@ -171,7 +171,6 @@ const insertTag = (rows) => {
<QBtn <QBtn
@click="insertTag(rows)" @click="insertTag(rows)"
class="cursor-pointer" class="cursor-pointer"
:disable="!validRow"
color="primary" color="primary"
flat flat
icon="add" icon="add"

View File

@ -491,9 +491,8 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<QTd> <QTd>
<VnImg <VnImg
size="50x50" size="50x50"
zoom-resolution="1600x900"
:id="row.id" :id="row.id"
height="50px"
width="50px"
class="image" class="image"
/> />
</QTd> </QTd>

View File

@ -130,4 +130,5 @@ function extractValueTags(items) {
<i18n> <i18n>
es: es:
You can search items by name or id: Puedes buscar items por nombre o id You can search items by name or id: Puedes buscar items por nombre o id
Search items: Buscar items
</i18n> </i18n>

View File

@ -247,6 +247,7 @@ function addOrder(value, field, params) {
rounded rounded
emit-value emit-value
use-input use-input
sort-by="name ASC"
:disable="!selectedCategoryFk" :disable="!selectedCategoryFk"
@update:model-value=" @update:model-value="
(value) => { (value) => {

View File

@ -20,8 +20,10 @@ const props = defineProps({
const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 }))); const fields = ref((props.prices || []).map((item) => ({ ...item, quantity: 0 })));
const descriptorData = useArrayData('orderData'); const descriptorData = useArrayData('orderData');
const isLoading = ref(false);
const addToOrder = async () => { const addToOrder = async () => {
if (isLoading.value) return;
isLoading.value = true;
const items = (fields.value || []).filter((item) => Number(item.quantity) > 0); const items = (fields.value || []).filter((item) => Number(item.quantity) > 0);
await axios.post('/OrderRows/addToOrder', { await axios.post('/OrderRows/addToOrder', {
items, items,
@ -30,6 +32,10 @@ const addToOrder = async () => {
notify(t('globals.dataSaved'), 'positive'); notify(t('globals.dataSaved'), 'positive');
emit('added'); emit('added');
descriptorData.fetch({}); descriptorData.fetch({});
isLoading.value = false;
};
const canAddToOrder = () => {
return (fields.value || []).some((item) => Number(item.quantity) > 0);
}; };
</script> </script>
@ -68,7 +74,11 @@ const addToOrder = async () => {
</tbody> </tbody>
</QMarkupTable> </QMarkupTable>
<div class="flex justify-center q-mt-lg"> <div class="flex justify-center q-mt-lg">
<QBtn color="primary" type="submit"> <QBtn
color="primary"
type="submit"
:disable="!isLoading && !canAddToOrder()"
>
{{ t('globals.add') }} {{ t('globals.add') }}
</QBtn> </QBtn>
</div> </div>
@ -81,3 +91,10 @@ const addToOrder = async () => {
width: 200px; width: 200px;
} }
</style> </style>
<i18n>
es:
noAmount: La cantidad no puede ser 0
en:
noAmount: Amount can not be 0
</i18n>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { useRoute, useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
@ -13,12 +13,10 @@ import { reactive } from 'vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute();
const state = useState(); const state = useState();
const ORDER_MODEL = 'order'; const ORDER_MODEL = 'order';
const router = useRouter(); const router = useRouter();
const clientList = ref([]);
const agencyList = ref([]); const agencyList = ref([]);
const addressList = ref([]); const addressList = ref([]);
defineEmits(['confirm', ...useDialogPluginComponent.emits]); defineEmits(['confirm', ...useDialogPluginComponent.emits]);

View File

@ -278,7 +278,11 @@ watch(
> >
<template #column-image="{ row }"> <template #column-image="{ row }">
<div class="image-wrapper"> <div class="image-wrapper">
<VnImg :id="parseInt(row?.item?.image)" class="rounded" /> <VnImg
:id="parseInt(row?.item?.image)"
class="rounded"
zoom-resolution="1600x900"
/>
</div> </div>
</template> </template>
<template #column-id="{ row }"> <template #column-id="{ row }">

View File

@ -99,7 +99,11 @@ const setWireTransfer = async () => {
:key="index" :key="index"
class="row q-gutter-md q-mb-md" class="row q-gutter-md q-mb-md"
> >
<VnInput :label="t('supplier.accounts.iban')" v-model="row.iban"> <VnInput
:label="t('supplier.accounts.iban')"
v-model="row.iban"
:required="true"
>
<template #append> <template #append>
<QIcon name="info" class="cursor-info"> <QIcon name="info" class="cursor-info">
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip> <QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
@ -113,6 +117,7 @@ const setWireTransfer = async () => {
option-label="bic" option-label="bic"
option-value="id" option-value="id"
hide-selected hide-selected
:required="true"
:roles-allowed-to-create="['financial']" :roles-allowed-to-create="['financial']"
> >
<template #form> <template #form>

View File

@ -15,12 +15,12 @@ const route = useRoute();
const agenciesOptions = ref(null); const agenciesOptions = ref(null);
const newAgencyTermForm = reactive({ const newAgencyTermForm = reactive({
agencyFk: null, agencyFk: null,
minimumM3: null, minimumM3: 0,
packagePrice: null, packagePrice: 0,
kmPrice: null, kmPrice: 0,
m3Price: null, m3Price: 0,
routePrice: null, routePrice: null,
minimumKm: null, minimumKm: 0,
supplierFk: route.params.id, supplierFk: route.params.id,
}); });

View File

@ -591,7 +591,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<template #body-cell-picture="{ row }"> <template #body-cell-picture="{ row }">
<QTd> <QTd>
<div class="image-wrapper"> <div class="image-wrapper">
<VnImg :id="row.itemFk" class="rounded" /> <VnImg :id="row.itemFk" class="rounded" zoom-resolution="1600x900" />
</div> </div>
</QTd> </QTd>
</template> </template>

View File

@ -229,22 +229,28 @@ async function changeState(value) {
:url="ticketUrl + 'observation'" :url="ticketUrl + 'observation'"
:text="t('ticket.pageTitles.notes')" :text="t('ticket.pageTitles.notes')"
/> />
<VnLv <QVirtualScroll
v-for="note in entity.notes" :items="entity.notes"
:key="note.id" v-slot="{ item, index }"
:label="note.observationType.description" style="max-height: 300px"
:value="note.description" separator
>
<QItem
:key="index"
class="vn-label-value"
style="
display: inline-block;
padding: unset;
min-height: max-content;
"
>
<span class="label" style="margin-right: 4px">
{{ item.observationType.description }}:</span
>
<span>{{ item.description }}</span>
</QItem></QVirtualScroll
> >
<template #value>
<QInput
v-model="note.description"
filled
type="textarea"
class="notes"
readonly
/>
</template>
</VnLv>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle :text="t('ticket.summary.summaryAmount')" /> <VnTitle :text="t('ticket.summary.summaryAmount')" />

View File

@ -1,13 +1,11 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import TicketTransferForm from './TicketTransferForm.vue'; import TicketTransferForm from './TicketTransferForm.vue';
import { toDateFormat } from 'src/filters/date.js'; import { toDateFormat } from 'src/filters/date.js';
import axios from 'axios';
const $props = defineProps({ const $props = defineProps({
mana: { mana: {
@ -28,13 +26,10 @@ const $props = defineProps({
}, },
}); });
const emit = defineEmits(['refreshData']);
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const QPopupProxyRef = ref(null); const QPopupProxyRef = ref(null);
const transferFormRef = ref(null);
const _transfer = ref(null); const _transfer = ref();
const transferLinesColumns = computed(() => [ const transferLinesColumns = computed(() => [
{ {
@ -85,19 +80,11 @@ const destinationTicketColumns = computed(() => [
}, },
]); ]);
const transferSales = async (ticketId) => { const handleRowClick = (row) => {
const params = { const ticketId = row.id;
ticketId: ticketId, if (transferFormRef.value) {
sales: $props.transfer.sales, transferFormRef.value.transferSales(ticketId);
}; }
const { data } = await axios.post(
`tickets/${$props.ticket.id}/transferSales`,
params
);
if (data && data.id === $props.ticket.id) emit('refreshData');
else router.push({ name: 'TicketSale', params: { id: data.id } });
}; };
onMounted(() => (_transfer.value = $props.transfer)); onMounted(() => (_transfer.value = $props.transfer));
@ -105,9 +92,8 @@ onMounted(() => (_transfer.value = $props.transfer));
<template> <template>
<QPopupProxy ref="QPopupProxyRef"> <QPopupProxy ref="QPopupProxyRef">
<QCard class="q-px-md" style="display: flex"> <QCard class="q-px-md" style="display: flex; width: 80vw">
<QTable <QTable
v-if="transfer.sales"
:rows="transfer.sales" :rows="transfer.sales"
:columns="transferLinesColumns" :columns="transferLinesColumns"
:title="t('Sales to transfer')" :title="t('Sales to transfer')"
@ -121,9 +107,6 @@ onMounted(() => (_transfer.value = $props.transfer));
<VnInput <VnInput
v-model.number="row.quantity" v-model.number="row.quantity"
:clearable="false" :clearable="false"
@keyup.enter="changeQuantity(row)"
@blur="changeQuantity(row)"
@focus="edit.oldQuantity = row.quantity"
style="max-width: 60px" style="max-width: 60px"
/> />
</QTd> </QTd>
@ -137,6 +120,7 @@ onMounted(() => (_transfer.value = $props.transfer));
:title="t('Destination ticket')" :title="t('Destination ticket')"
row-key="id" row-key="id"
class="full-width q-mt-md" class="full-width q-mt-md"
@row-click="(_, row) => handleRowClick(row)"
> >
<template #body-cell-address="{ row }"> <template #body-cell-address="{ row }">
<QTd @click.stop> <QTd @click.stop>
@ -158,10 +142,10 @@ onMounted(() => (_transfer.value = $props.transfer));
</template> </template>
<template #no-data> <template #no-data>
<TicketTransferForm v-bind="$props" /> <TicketTransferForm ref="transferFormRef" v-bind="$props" />
</template> </template>
<template #bottom> <template #bottom>
<TicketTransferForm v-bind="$props" /> <TicketTransferForm ref="transferFormRef" v-bind="$props" />
</template> </template>
</QTable> </QTable>
</QCard> </QCard>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -31,7 +31,7 @@ const emit = defineEmits(['refreshData']);
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const _transfer = ref(null); const _transfer = ref($props.transfer);
const transferSales = async (ticketId) => { const transferSales = async (ticketId) => {
const params = { const params = {
@ -48,11 +48,10 @@ const transferSales = async (ticketId) => {
else router.push({ name: 'TicketSale', params: { id: data.id } }); else router.push({ name: 'TicketSale', params: { id: data.id } });
}; };
onMounted(() => (_transfer.value = $props.transfer)); defineExpose({ transferSales });
</script> </script>
<template> <template>
{{ _transfer }}
<QForm class="q-mt-lg full-width"> <QForm class="q-mt-lg full-width">
<VnInput <VnInput
v-model.number="_transfer.ticketId" v-model.number="_transfer.ticketId"

View File

@ -27,7 +27,6 @@ const initialFormState = reactive({
warehouseId: user.value.warehouseFk, warehouseId: user.value.warehouseFk,
landed: null, landed: null,
}); });
const clientOptions = ref([]);
const agenciesOptions = ref([]); const agenciesOptions = ref([]);
const addressesOptions = ref([]); const addressesOptions = ref([]);
const warehousesOptions = ref([]); const warehousesOptions = ref([]);
@ -111,12 +110,6 @@ const redirectToTicketList = (_, { id }) => {
</script> </script>
<template> <template>
<FetchData
url="Clients"
@on-fetch="(data) => (clientOptions = data)"
:filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }"
auto-load
/>
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
@ -137,7 +130,9 @@ const redirectToTicketList = (_, { id }) => {
<VnSelect <VnSelect
:label="t('ticket.create.client')" :label="t('ticket.create.client')"
v-model="data.clientId" v-model="data.clientId"
:options="clientOptions" url="Clients"
:fields="['id', 'name', 'defaultAddressFk']"
sort-by="id"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

View File

@ -96,7 +96,7 @@ watch(
sort-by="code, townFk" sort-by="code, townFk"
option-value="geoFk" option-value="geoFk"
option-label="code" option-label="code"
option-filter="code" :filter-options="['code', 'geoFk']"
hide-selected hide-selected
dense dense
outlined outlined