This commit is contained in:
William Buezas 2024-01-25 08:53:24 -03:00
parent 41605db454
commit c43e7011a4
11 changed files with 90 additions and 19 deletions

View File

@ -67,3 +67,13 @@ body.body--dark {
.q-field.required .q-field__label:after { .q-field.required .q-field__label:after {
content: ' *'; content: ' *';
} }
input[type='number'] {
-moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
}

View File

@ -266,6 +266,7 @@ export default {
buys: 'Buys', buys: 'Buys',
notes: 'Notes', notes: 'Notes',
log: 'Log', log: 'Log',
create: 'Create',
}, },
list: { list: {
newEntry: 'New entry', newEntry: 'New entry',

View File

@ -265,6 +265,7 @@ export default {
buys: 'Compras', buys: 'Compras',
notes: 'Notas', notes: 'Notas',
log: 'Historial', log: 'Historial',
create: 'Crear',
}, },
list: { list: {
newEntry: 'Nueva entrada', newEntry: 'Nueva entrada',

View File

@ -163,8 +163,9 @@ const currenciesOptions = ref([]);
:label="t('entry.basicData.observation')" :label="t('entry.basicData.observation')"
type="textarea" type="textarea"
v-model="data.observation" v-model="data.observation"
:maxlength="45"
counter
fill-input fill-input
autogrow
/> />
</div> </div>
</VnRow> </VnRow>

View File

@ -256,6 +256,33 @@ const deleteBuys = async () => {
const importBuys = () => { const importBuys = () => {
router.push({ name: 'EntryBuysImport' }); router.push({ name: 'EntryBuysImport' });
}; };
const toggleGroupingMode = async (buy, mode) => {
try {
const grouping = 1;
const packing = 2;
const groupingMode = mode === 'grouping' ? grouping : packing;
const newGroupingMode = buy.groupingMode === groupingMode ? 0 : groupingMode;
const params = {
groupingMode: newGroupingMode,
};
await axios.patch(`Buys/${buy.id}`, params);
buy.groupingMode = newGroupingMode;
} catch (err) {
console.error('Error toggling grouping mode');
}
};
const showLockIcon = (groupingMode, mode) => {
if (mode === 'packing') {
return groupingMode === 2 ? 'lock' : 'lock_open';
} else {
return groupingMode === 1 ? 'lock' : 'lock_open';
}
};
</script> </script>
<template> <template>
@ -309,6 +336,25 @@ const importBuys = () => {
v-model="props.row[col.field]" v-model="props.row[col.field]"
v-on="tableColumnComponents[col.name].event(props)" v-on="tableColumnComponents[col.name].event(props)"
> >
<template
v-if="
col.name === 'grouping' || col.name === 'packing'
"
#append
>
<QBtn
:icon="
showLockIcon(props.row.groupingMode, col.name)
"
@click="toggleGroupingMode(props.row, col.name)"
class="cursor-pointer"
size="sm"
flat
dense
unelevated
push
/>
</template>
<template <template
v-if="col.name === 'item' || col.name === 'import'" v-if="col.name === 'item' || col.name === 'import'"
> >
@ -381,6 +427,7 @@ const importBuys = () => {
</QTable> </QTable>
</template> </template>
</VnPaginate> </VnPaginate>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<QBtn fab icon="upload" color="primary" @click="importBuys()" /> <QBtn fab icon="upload" color="primary" @click="importBuys()" />
<QTooltip class="text-no-wrap"> <QTooltip class="text-no-wrap">

View File

@ -16,6 +16,7 @@ const stateStore = useStateStore();
<Teleport to="#searchbar"> <Teleport to="#searchbar">
<VnSearchbar <VnSearchbar
data-key="EntryList" data-key="EntryList"
url="Entries/filter"
:label="t('Search entries')" :label="t('Search entries')"
:info="t('You can search by entry reference')" :info="t('You can search by entry reference')"
/> />

View File

@ -111,13 +111,6 @@ const showEntryReport = () => {
<QItem v-ripple clickable @click="showEntryReport(entity)"> <QItem v-ripple clickable @click="showEntryReport(entity)">
<QItemSection>{{ t('Show entry report') }}</QItemSection> <QItemSection>{{ t('Show entry report') }}</QItemSection>
</QItem> </QItem>
<QItem v-ripple clickable>
<QItemSection>
<RouterLink :to="{ name: 'EntryList' }" class="color-vn-text">
{{ t('Go to module index') }}
</RouterLink>
</QItemSection>
</QItem>
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv <VnLv

View File

@ -49,6 +49,7 @@ onMounted(() => {
:label="t('entry.notes.observationType')" :label="t('entry.notes.observationType')"
v-model="row.observationTypeFk" v-model="row.observationTypeFk"
:options="entryObservationsOptions" :options="entryObservationsOptions"
:disable="!!row.id"
option-label="description" option-label="description"
option-value="id" option-value="id"
hide-selected hide-selected

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
@ -9,20 +9,27 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useState } from 'src/composables/useState';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
const state = useState();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const user = state.getUser();
const newEntryForm = reactive({ const newEntryForm = reactive({
supplierFk: null, supplierFk: null,
travelFk: route.query?.travelFk || null, travelFk: route.query?.travelFk || null,
companyFk: null, companyFk: user.value.companyFk || null,
}); });
const suppliersOptions = ref([]); const suppliersOptions = ref([]);
const travelsOptionsOptions = ref([]); const travelsOptionsOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const redirectToEntryBasicData = (_, { id }) => {
router.push({ name: 'EntryBasicData', params: { id } });
};
</script> </script>
<template> <template>
@ -48,12 +55,14 @@ const companiesOptions = ref([]);
@on-fetch="(data) => (companiesOptions = data)" @on-fetch="(data) => (companiesOptions = data)"
auto-load auto-load
/> />
<!-- Agregar searchbar de entries -->
<QPage> <QPage>
<VnSubToolbar /> <VnSubToolbar />
<FormModel url-create="Entries" model="entry" :form-initial-data="newEntryForm"> <FormModel
url-create="Entries"
model="entry"
:form-initial-data="newEntryForm"
@on-data-saved="redirectToEntryBasicData"
>
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter <VnSelectFilter

View File

@ -53,7 +53,7 @@ const suppliersOptions = ref([]);
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
<template #body="{ params }"> <template #body="{ params, searchFn }">
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -95,6 +95,7 @@ const suppliersOptions = ref([]);
<VnSelectFilter <VnSelectFilter
:label="t('params.companyFk')" :label="t('params.companyFk')"
v-model="params.companyFk" v-model="params.companyFk"
@update:model-value="searchFn()"
:options="companiesOptions" :options="companiesOptions"
option-value="id" option-value="id"
option-label="code" option-label="code"
@ -110,6 +111,7 @@ const suppliersOptions = ref([]);
<VnSelectFilter <VnSelectFilter
:label="t('params.currencyFk')" :label="t('params.currencyFk')"
v-model="params.currencyFk" v-model="params.currencyFk"
@update:model-value="searchFn()"
:options="currenciesOptions" :options="currenciesOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
@ -125,6 +127,7 @@ const suppliersOptions = ref([]);
<VnSelectFilter <VnSelectFilter
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
v-model="params.supplierFk" v-model="params.supplierFk"
@update:model-value="searchFn()"
:options="suppliersOptions" :options="suppliersOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
@ -149,8 +152,9 @@ const suppliersOptions = ref([]);
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
:label="t('params.created')" :label="t('params.created')"
is-outlined
v-model="params.created" v-model="params.created"
@update:model-value="searchFn()"
is-outlined
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -158,8 +162,9 @@ const suppliersOptions = ref([]);
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
:label="t('params.from')" :label="t('params.from')"
is-outlined
v-model="params.from" v-model="params.from"
@update:model-value="searchFn()"
is-outlined
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -167,8 +172,9 @@ const suppliersOptions = ref([]);
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
:label="t('params.to')" :label="t('params.to')"
is-outlined
v-model="params.to" v-model="params.to"
@update:model-value="searchFn()"
is-outlined
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>

View File

@ -14,6 +14,7 @@ const stateStore = useStateStore();
<Teleport to="#searchbar"> <Teleport to="#searchbar">
<VnSearchbar <VnSearchbar
data-key="EntryList" data-key="EntryList"
url="Entries/filter"
:label="t('Search entries')" :label="t('Search entries')"
:info="t('You can search by entry reference')" :info="t('You can search by entry reference')"
/> />