WIP
This commit is contained in:
parent
865a13aafa
commit
5511e365aa
|
@ -225,15 +225,19 @@ function getDifferences(obj1, obj2) {
|
|||
delete obj2.$index;
|
||||
|
||||
for (let key in obj1) {
|
||||
if (obj2[key] && obj1[key] !== obj2[key]) {
|
||||
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
|
||||
diff[key] = obj2[key];
|
||||
}
|
||||
}
|
||||
for (let key in obj2) {
|
||||
if (obj1[key] === undefined || obj1[key] !== obj2[key]) {
|
||||
if (
|
||||
obj1[key] === undefined ||
|
||||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
|
||||
) {
|
||||
diff[key] = obj2[key];
|
||||
}
|
||||
}
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
|
|
@ -926,6 +926,15 @@ export default {
|
|||
province: 'Province',
|
||||
mobile: 'Mobile',
|
||||
},
|
||||
agencyTerms: {
|
||||
agencyFk: 'Agency',
|
||||
minimumM3: 'Minimum M3',
|
||||
packagePrice: 'Package Price',
|
||||
kmPrice: 'Km Price',
|
||||
m3Price: 'M3 Price',
|
||||
routePrice: 'Route price',
|
||||
minimumKm: 'Minimum Km',
|
||||
},
|
||||
},
|
||||
travel: {
|
||||
pageTitles: {
|
||||
|
|
|
@ -925,6 +925,15 @@ export default {
|
|||
province: 'Provincia',
|
||||
mobile: 'Móvil',
|
||||
},
|
||||
agencyTerms: {
|
||||
agencyFk: 'Agencia',
|
||||
minimumM3: 'M3 mínimos',
|
||||
packagePrice: 'Precio bulto',
|
||||
kmPrice: 'Precio Km',
|
||||
m3Price: 'Precio M3',
|
||||
routePrice: 'Precio ruta',
|
||||
minimumKm: 'Km mínimos',
|
||||
},
|
||||
},
|
||||
travel: {
|
||||
pageTitles: {
|
||||
|
|
|
@ -1 +1,139 @@
|
|||
<template>Supplier agency term</template>
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const supplierAgencyTermRef = ref(null);
|
||||
const agenciesOptions = ref(null);
|
||||
|
||||
const supplierAgencyFilter = {
|
||||
include: {
|
||||
relation: 'agency',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
where: { supplierFk: route.params.id },
|
||||
};
|
||||
|
||||
const redirectToCreateView = () => {
|
||||
router.push({ name: 'SupplierAgencyTermCreate' });
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (supplierAgencyTermRef.value) supplierAgencyTermRef.value.reload();
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Suppliers/freeAgencies"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<CrudModel
|
||||
ref="supplierAgencyTermRef"
|
||||
data-key="SupplierAgencyTerm"
|
||||
save-url="SupplierAgencyTerms/crud"
|
||||
url="SupplierAgencyTerms"
|
||||
model="SupplierAgencyTerm"
|
||||
primary-key="agencyFk"
|
||||
:filter="supplierAgencyFilter"
|
||||
:default-remove="false"
|
||||
:data-required="{
|
||||
supplierFk: route.params.id,
|
||||
}"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QCard class="q-pa-md">
|
||||
<VnRow
|
||||
v-for="(row, index) in rows"
|
||||
:key="index"
|
||||
class="row q-gutter-md q-mb-md"
|
||||
>
|
||||
<div class="col">
|
||||
<QField :label="t('supplier.agencyTerms.agencyFk')" stack-label>
|
||||
<template #control>
|
||||
<div tabindex="0">
|
||||
{{ row.agency?.name }}
|
||||
</div>
|
||||
</template>
|
||||
</QField>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.minimumM3')"
|
||||
v-model.number="row.minimumM3"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.packagePrice')"
|
||||
v-model.number="row.packagePrice"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.kmPrice')"
|
||||
v-model.number="row.kmPrice"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.m3Price')"
|
||||
v-model.number="row.m3Price"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.routePrice')"
|
||||
v-model.number="row.routePrice"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.minimumKm')"
|
||||
v-model.number="row.minimumKm"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-1 row justify-center items-center">
|
||||
<QIcon
|
||||
name="delete"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="supplierAgencyTermRef.remove([row])"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Remove row') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
||||
<QTooltip>
|
||||
{{ t('supplier.list.newSupplier') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Remove row: Eliminar fila
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const agenciesOptions = ref(null);
|
||||
const newAgencyTermForm = reactive({
|
||||
agencyFk: null,
|
||||
minimumM3: null,
|
||||
packagePrice: null,
|
||||
kmPrice: null,
|
||||
m3Price: null,
|
||||
routePrice: null,
|
||||
minimumKm: null,
|
||||
supplierFk: route.params.id,
|
||||
});
|
||||
|
||||
const onDataSaved = () => {
|
||||
router.push({ name: 'SupplierAgencyTerm' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Suppliers/freeAgencies"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<QPage>
|
||||
<FormModel
|
||||
model="supplierAgencyTerm"
|
||||
:form-initial-data="newAgencyTermForm"
|
||||
url-create="SupplierAgencyTerms"
|
||||
:observe-form-changes="true"
|
||||
@on-data-saved="onDataSaved()"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('supplier.agencyTerms.agencyFk')"
|
||||
v-model="data.agencyFk"
|
||||
:options="agenciesOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
hide-selected
|
||||
rounded
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.minimumM3')"
|
||||
v-model.number="data.minimumM3"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.packagePrice')"
|
||||
v-model.number="data.packagePrice"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.kmPrice')"
|
||||
v-model.number="data.kmPrice"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.m3Price')"
|
||||
v-model.number="data.m3Price"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.routePrice')"
|
||||
v-model.number="data.routePrice"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('supplier.agencyTerms.minimumKm')"
|
||||
v-model.number="data.minimumKm"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="col" />
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</QPage>
|
||||
</template>
|
|
@ -1 +1,36 @@
|
|||
<template>Supplier consumption</template>
|
||||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const suppliersConsumption = ref();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Suppliers/consumption"
|
||||
@on-fetch="(data) => (suppliersConsumption = data)"
|
||||
:filter="{
|
||||
where: { supplierFk: route.params.id },
|
||||
order: ['itemTypeFk', 'itemName', 'itemSize'],
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions">
|
||||
<QBtn color="primary" icon-right="archive" no-caps />
|
||||
</div>
|
||||
</QToolbar>
|
||||
<QPage class="column items-center q-pa-md"> </QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
</i18n>
|
||||
|
|
|
@ -160,6 +160,12 @@ export default {
|
|||
component: () =>
|
||||
import('src/pages/Supplier/Card/SupplierAgencyTerm.vue'),
|
||||
},
|
||||
{
|
||||
path: 'agency-term/create',
|
||||
name: 'SupplierAgencyTermCreate',
|
||||
component: () =>
|
||||
import('src/pages/Supplier/Card/SupplierAgencyTermCreate.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue