forked from verdnatura/salix-front
More entries corrections
This commit is contained in:
parent
c43e7011a4
commit
93a4409c26
|
@ -8,7 +8,7 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CreateNewCityForm from './CreateNewCityForm.vue';
|
||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||
import VnSelectCreate from 'components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||
import FormModelPopup from './FormModelPopup.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
@ -85,7 +85,7 @@ const onProvinceCreated = async ({ name }, formData) => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('City')"
|
||||
:options="townsLocationOptions"
|
||||
v-model="data.townFk"
|
||||
|
@ -100,12 +100,12 @@ const onProvinceCreated = async ({ name }, formData) => {
|
|||
@on-data-saved="onCityCreated($event, data)"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-xl">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Province')"
|
||||
:options="provincesOptions"
|
||||
hide-selected
|
||||
|
@ -120,7 +120,7 @@ const onProvinceCreated = async ({ name }, formData) => {
|
|||
@on-data-saved="onProvinceCreated($event, data)"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
|
|
|
@ -0,0 +1,241 @@
|
|||
<script setup>
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const emit = defineEmits(['travelSelected']);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const travelFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'agency',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'warehouseOut',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const travelFilterParams = reactive({});
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const agenciesOptions = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const tableRows = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const tableColumns = computed(() => [
|
||||
{
|
||||
label: t('entry.basicData.id'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.warehouseOut'),
|
||||
name: 'warehouseOutFk',
|
||||
field: 'warehouseOutFk',
|
||||
align: 'left',
|
||||
format: (val) =>
|
||||
warehousesOptions.value.find((warehouse) => warehouse.id === val).name,
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.warehouseIn'),
|
||||
name: 'warehouseInFk',
|
||||
field: 'warehouseInFk',
|
||||
align: 'left',
|
||||
format: (val) =>
|
||||
warehousesOptions.value.find((warehouse) => warehouse.id === val).name,
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.shipped'),
|
||||
name: 'shipped',
|
||||
field: 'shipped',
|
||||
align: 'left',
|
||||
format: (val) => toDate(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.landed'),
|
||||
name: 'landed',
|
||||
field: 'landed',
|
||||
align: 'left',
|
||||
format: (val) => toDate(val),
|
||||
},
|
||||
]);
|
||||
|
||||
const fetchResults = async () => {
|
||||
try {
|
||||
let filter = travelFilter;
|
||||
const params = travelFilterParams;
|
||||
const where = {};
|
||||
for (let key in params) {
|
||||
const value = params[key];
|
||||
if (!value) continue;
|
||||
|
||||
switch (key) {
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseInFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'shipped':
|
||||
case 'landed':
|
||||
where[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
filter.where = where;
|
||||
const { data } = await axios.get('Travels', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
tableRows.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching travels');
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
};
|
||||
|
||||
const selectTravel = ({ id }) => {
|
||||
console.log('row:: ', id);
|
||||
emit('travelSelected', id);
|
||||
closeForm();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
order="name"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QForm @submit="fetchResults()" class="all-pointer-events">
|
||||
<QCard class="column" style="padding: 32px; z-index: 100">
|
||||
<span ref="closeButton" class="close-icon" v-close-popup>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
<h1 class="title">{{ t('Filter travels') }}</h1>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.basicData.agency')"
|
||||
:options="agenciesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.agencyModeFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.basicData.warehouseOut')"
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseOutFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.basicData.warehouseIn')"
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseInFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInputDate
|
||||
:label="t('entry.basicData.shipped')"
|
||||
v-model="travelFilterParams.shipped"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInputDate
|
||||
:label="t('entry.basicData.landed')"
|
||||
v-model="travelFilterParams.landed"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:label="t('globals.search')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
</div>
|
||||
<QTable
|
||||
:columns="tableColumns"
|
||||
:rows="tableRows"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:loading="loading"
|
||||
:hide-header="!tableRows || !tableRows.length > 0"
|
||||
:no-data-label="t('Enter a new search')"
|
||||
class="q-mt-lg"
|
||||
@row-click="(_, row) => selectTravel(row)"
|
||||
>
|
||||
<template #body-cell-id="{ row }">
|
||||
<QTd auto-width>
|
||||
<QBtn flat color="blue">{{ row.id }}</QBtn>
|
||||
<TravelDescriptorProxy :id="row.id" />
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</QForm>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Filter travels: Filtro envíos
|
||||
Enter a new search: Introduce una nueva búsqueda
|
||||
</i18n>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
font-size: 17px;
|
||||
font-weight: bold;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
|
@ -20,6 +20,10 @@ const $props = defineProps({
|
|||
type: Array,
|
||||
default: () => ['developer'],
|
||||
},
|
||||
actionIcon: {
|
||||
type: String,
|
||||
default: 'add',
|
||||
},
|
||||
});
|
||||
|
||||
const role = useRole();
|
||||
|
@ -48,9 +52,9 @@ const toggleForm = () => {
|
|||
<template v-if="isAllowedToCreate" #append>
|
||||
<QIcon
|
||||
@click.stop.prevent="toggleForm()"
|
||||
name="add"
|
||||
size="xs"
|
||||
class="add-icon"
|
||||
:name="actionIcon"
|
||||
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
||||
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
|
||||
/>
|
||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
||||
<slot name="form" />
|
||||
|
@ -63,9 +67,14 @@ const toggleForm = () => {
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.add-icon {
|
||||
.default-icon {
|
||||
cursor: pointer;
|
||||
background-color: $primary;
|
||||
color: $primary;
|
||||
border-radius: 50px;
|
||||
|
||||
&.--add-icon {
|
||||
color: var(--vn-text);
|
||||
background-color: $primary;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -322,6 +322,12 @@ export default {
|
|||
booked: 'Booked',
|
||||
raid: 'Raid',
|
||||
excludedFromAvailable: 'Inventory',
|
||||
agency: 'Agency',
|
||||
warehouseOut: 'Warehouse Out',
|
||||
warehouseIn: 'Warehouse In',
|
||||
shipped: 'Shipped',
|
||||
landed: 'Landed',
|
||||
id: 'ID',
|
||||
},
|
||||
buys: {
|
||||
groupingPrice: 'Grouping price',
|
||||
|
|
|
@ -321,6 +321,12 @@ export default {
|
|||
booked: 'Asentado',
|
||||
raid: 'Redada',
|
||||
excludedFromAvailable: 'Inventario',
|
||||
agency: 'Agencia',
|
||||
warehouseOut: 'Alm. salida',
|
||||
warehouseIn: 'Alm. entrada',
|
||||
shipped: 'F. envío',
|
||||
landed: 'F. entrega',
|
||||
id: 'ID',
|
||||
},
|
||||
buys: {
|
||||
groupingPrice: 'Precio grouping',
|
||||
|
|
|
@ -10,7 +10,7 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -63,7 +63,7 @@ const getBankEntities = async () => {
|
|||
<VnInput :label="t('IBAN')" v-model="data.iban" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Swift / BIC')"
|
||||
:options="bankEntitiesOptions"
|
||||
:roles-allowed-to-create="['salesAssistant', 'hr']"
|
||||
|
@ -86,7 +86,7 @@ const getBankEntities = async () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
@ -114,7 +114,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Postcode')"
|
||||
:options="postcodesOptions"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
|
@ -145,7 +145,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
|
|
|
@ -7,7 +7,7 @@ import FetchData from 'components/FetchData.vue';
|
|||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -139,7 +139,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
v-model="data.postcode"
|
||||
:label="t('Postcode')"
|
||||
:rules="validate('Worker.postcode')"
|
||||
|
@ -170,7 +170,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<!-- ciudades -->
|
||||
|
|
|
@ -10,7 +10,7 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||
|
||||
|
@ -113,7 +113,7 @@ const toCustomerConsignees = () => {
|
|||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Postcode')"
|
||||
:options="postcodesOptions"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
|
@ -141,7 +141,7 @@ const toCustomerConsignees = () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<!-- ciudades -->
|
||||
|
@ -223,7 +223,7 @@ const toCustomerConsignees = () => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Customs agent')"
|
||||
:options="customsAgents"
|
||||
hide-selected
|
||||
|
@ -234,7 +234,7 @@ const toCustomerConsignees = () => {
|
|||
<template #form>
|
||||
<CustomsNewCustomsAgent @on-data-saved="refreshData()" />
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
|
|
@ -10,7 +10,7 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||
|
||||
|
@ -168,7 +168,7 @@ const onDataSaved = () => {
|
|||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Postcode')"
|
||||
:options="postcodesOptions"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
|
@ -196,7 +196,7 @@ const onDataSaved = () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<!-- ciudades -->
|
||||
|
@ -278,7 +278,7 @@ const onDataSaved = () => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Customs agent')"
|
||||
:options="customsAgents"
|
||||
hide-selected
|
||||
|
@ -289,7 +289,7 @@ const onDataSaved = () => {
|
|||
<template #form>
|
||||
<CustomsNewCustomsAgent />
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import FilterTravelForm from 'src/components/FilterTravelForm.vue';
|
||||
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
|
@ -18,6 +20,10 @@ const suppliersOptions = ref([]);
|
|||
const travelsOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const currenciesOptions = ref([]);
|
||||
|
||||
const onFilterTravelSelected = (formData, id) => {
|
||||
formData.travelFk = id;
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -82,7 +88,7 @@ const currenciesOptions = ref([]);
|
|||
</VnSelectFilter>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
<VnSelectDialog
|
||||
:label="t('entry.basicData.travel')"
|
||||
v-model="data.travelFk"
|
||||
:options="travelsOptions"
|
||||
|
@ -91,7 +97,13 @@ const currenciesOptions = ref([]);
|
|||
map-options
|
||||
hide-selected
|
||||
:required="true"
|
||||
action-icon="filter_alt"
|
||||
>
|
||||
<template #form>
|
||||
<FilterTravelForm
|
||||
@travel-selected="onFilterTravelSelected(data, $event)"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
|
@ -106,7 +118,7 @@ const currenciesOptions = ref([]);
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
|
|
@ -26,6 +26,7 @@ const { notify } = useNotify();
|
|||
const rowsSelected = ref([]);
|
||||
const entryBuysPaginateRef = ref(null);
|
||||
const packagingsOptions = ref(null);
|
||||
const originalRowDataCopy = ref(null);
|
||||
|
||||
const tableColumnComponents = computed(() => ({
|
||||
item: {
|
||||
|
@ -41,8 +42,9 @@ const tableColumnComponents = computed(() => ({
|
|||
label: col.label,
|
||||
class: 'input-number',
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
packagingFk: {
|
||||
|
@ -56,8 +58,8 @@ const tableColumnComponents = computed(() => ({
|
|||
'hide-selected': true,
|
||||
options: packagingsOptions.value,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'update:modelValue': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'update:modelValue': () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
stickers: {
|
||||
|
@ -68,8 +70,9 @@ const tableColumnComponents = computed(() => ({
|
|||
label: col.label,
|
||||
class: 'input-number',
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
weight: {
|
||||
|
@ -79,8 +82,9 @@ const tableColumnComponents = computed(() => ({
|
|||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
packing: {
|
||||
|
@ -90,8 +94,9 @@ const tableColumnComponents = computed(() => ({
|
|||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
grouping: {
|
||||
|
@ -101,8 +106,9 @@ const tableColumnComponents = computed(() => ({
|
|||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
buyingValue: {
|
||||
|
@ -112,8 +118,9 @@ const tableColumnComponents = computed(() => ({
|
|||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
price2: {
|
||||
|
@ -123,8 +130,9 @@ const tableColumnComponents = computed(() => ({
|
|||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
price3: {
|
||||
|
@ -134,8 +142,9 @@ const tableColumnComponents = computed(() => ({
|
|||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
event: (colField, props) => ({
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
}),
|
||||
},
|
||||
import: {
|
||||
|
@ -217,8 +226,19 @@ const entriesTableColumns = computed(() => {
|
|||
];
|
||||
});
|
||||
|
||||
const saveChange = async (rowData) => {
|
||||
await axios.patch(`Buys/${rowData.id}`, rowData);
|
||||
const copyOriginalRowsData = (rows) => {
|
||||
// el objetivo de esto es guardar los valores iniciales de todas las rows para evitar guardar cambios si la data no cambió al disparar los eventos
|
||||
originalRowDataCopy.value = JSON.parse(JSON.stringify(rows));
|
||||
};
|
||||
|
||||
const saveChange = async (field, { rowIndex, row }) => {
|
||||
try {
|
||||
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
||||
await axios.patch(`Buys/${row.id}`, row);
|
||||
originalRowDataCopy.value[rowIndex][field] = row[field];
|
||||
} catch (err) {
|
||||
console.error('Error saving changes', err);
|
||||
}
|
||||
};
|
||||
|
||||
const openRemoveDialog = async () => {
|
||||
|
@ -311,6 +331,7 @@ const showLockIcon = (groupingMode, mode) => {
|
|||
ref="entryBuysPaginateRef"
|
||||
data-key="EntryBuys"
|
||||
:url="`Entries/${route.params.id}/getBuys`"
|
||||
@on-fetch="copyOriginalRowsData($event)"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
|
@ -334,7 +355,12 @@ const showLockIcon = (groupingMode, mode) => {
|
|||
:is="tableColumnComponents[col.name].component()"
|
||||
v-bind="tableColumnComponents[col.name].props(col)"
|
||||
v-model="props.row[col.field]"
|
||||
v-on="tableColumnComponents[col.name].event(props)"
|
||||
v-on="
|
||||
tableColumnComponents[col.name].event(
|
||||
col.field,
|
||||
props
|
||||
)
|
||||
"
|
||||
>
|
||||
<template
|
||||
v-if="
|
||||
|
|
|
@ -8,7 +8,7 @@ import CrudModel from 'components/CrudModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
@ -105,7 +105,7 @@ onMounted(() => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('worker.create.bankEntity')"
|
||||
v-model="row.bankEntityFk"
|
||||
:options="bankEntitiesOptions"
|
||||
|
@ -129,7 +129,7 @@ onMounted(() => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
|
|
|
@ -7,7 +7,7 @@ import FetchData from 'components/FetchData.vue';
|
|||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
|
||||
|
@ -104,7 +104,7 @@ onMounted(() => {
|
|||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
v-model="data.postalCode"
|
||||
:label="t('supplier.addresses.postcode')"
|
||||
:rules="validate('supplierAddress.postcode')"
|
||||
|
@ -135,7 +135,7 @@ onMounted(() => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
|
|
|
@ -8,7 +8,7 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -173,7 +173,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('supplier.fiscalData.postcode')"
|
||||
v-model="data.postCode"
|
||||
:options="postcodesOptions"
|
||||
|
@ -204,7 +204,7 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
|
|
@ -7,7 +7,7 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
@ -184,7 +184,7 @@ onMounted(async () => {
|
|||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
v-model="data.postcode"
|
||||
:label="t('worker.create.postcode')"
|
||||
:rules="validate('Worker.postcode')"
|
||||
|
@ -215,7 +215,7 @@ onMounted(async () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
|
@ -336,7 +336,7 @@ onMounted(async () => {
|
|||
:rules="validate('Worker.iban')"
|
||||
/>
|
||||
</div>
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('worker.create.bankEntity')"
|
||||
v-model="data.bankEntityFk"
|
||||
:options="bankEntitiesOptions"
|
||||
|
@ -361,7 +361,7 @@ onMounted(async () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
|
|
Loading…
Reference in New Issue