0
0
Fork 0

Merge branch '7172-fixClaimBasicData' of https://gitea.verdnatura.es/verdnatura/salix-front into 7172-fixClaimBasicData

This commit is contained in:
Carlos Satorres 2024-04-29 09:49:32 +02:00
commit abd1f72340
33 changed files with 1486 additions and 39 deletions

View File

@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import axios from 'axios';
@ -207,7 +207,7 @@ const removeTag = (index, params, search) => {
</QItem>
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.typeFk')"
v-model="params.typeFk"
:options="itemTypesOptions"
@ -235,7 +235,7 @@ const removeTag = (index, params, search) => {
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</VnSelect>
</QItemSection>
</QItem>
<QSeparator />
@ -246,7 +246,7 @@ const removeTag = (index, params, search) => {
class="q-mt-md filter-value"
>
<QItemSection class="col">
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.tag')"
v-model="value.selectedTag"
:options="tagOptions"
@ -261,7 +261,7 @@ const removeTag = (index, params, search) => {
/>
</QItemSection>
<QItemSection class="col">
<VnSelectFilter
<VnSelect
v-if="!value?.selectedTag?.isFree && value.valueOptions"
:label="t('components.itemsFilterPanel.value')"
v-model="value.value"

View File

@ -91,9 +91,15 @@ globals:
basicData: Basic data
log: Logs
parkingList: Parkings list
agencyList: Agencies list
agency: Agency
workCenters: Work centers
modes: Modes
created: Created
worker: Worker
now: Now
name: Name
new: New
errors:
statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred
@ -1126,6 +1132,9 @@ item:
wasteBreakdown: Waste breakdown
itemCreate: New item
log: Log
tax: Tax
barcode: Barcode
botanical: Botanical
descriptor:
item: Item
buyer: Buyer

View File

@ -91,9 +91,15 @@ globals:
basicData: Datos básicos
log: Historial
parkingList: Listado de parkings
agencyList: Listado de agencias
agency: Agencia
workCenters: Centros de trabajo
modes: Modos
created: Fecha creación
worker: Trabajador
now: Ahora
name: Nombre
new: Nuevo
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor

View File

@ -0,0 +1,79 @@
<script setup>
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CardList from 'src/components/ui/CardList.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const router = useRouter();
const stateStore = useStateStore();
function navigate(id) {
router.push({ path: `/agency/${id}` });
}
function exprBuilder(param, value) {
if (!value) return;
if (param !== 'search') return;
if (!isNaN(value)) return { id: value };
return { name: { like: `%${value}%` } };
}
</script>
<template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<VnSearchbar
:info="t('You can search by name')"
:label="t('Search agency')"
data-key="AgencyList"
url="Agencies"
/>
</Teleport>
</template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="AgencyList"
url="Agencies"
order="name"
:expr-builder="exprBuilder"
auto-load
>
<template #body="{ rows }">
<CardList
:id="row.id"
:key="row.id"
:title="row.name"
@click="navigate(row.id)"
v-for="row of rows"
>
<template #list-items>
<QCheckbox
:label="t('isOwn')"
v-model="row.isOwn"
:disable="true"
/>
<QCheckbox
:label="t('isAnyVolumeAllowed')"
v-model="row.isAnyVolumeAllowed"
:disable="true"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -0,0 +1,52 @@
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const route = useRoute();
const routeId = route.params?.id || null;
const warehouses = ref([]);
</script>
<template>
<FetchData
url="warehouses"
sort-by="name"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<FormModel :url="`Agencies/${routeId}`" model="agency" auto-load>
<template #form="{ data }">
<VnRow>
<VnInput v-model="data.name" :label="t('globals.name')" />
</VnRow>
<VnRow>
<VnSelect
v-model="data.warehouseFk"
option-value="id"
option-label="name"
:label="t('globals.warehouse')"
:options="warehouses"
use-input
input-debounce="0"
:is-clearable="false"
/>
</VnRow>
<VnRow>
<QCheckbox :label="t('agency.isOwn')" v-model="data.isOwn" />
</VnRow>
<VnRow>
<QCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="data.isAnyVolumeAllowed"
/>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -0,0 +1,35 @@
<script setup>
import { onMounted, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import AgencyDescriptor from 'pages/Agency/Card/AgencyDescriptor.vue';
import VnCard from 'components/common/VnCard.vue';
const route = useRoute();
const arrayData = useArrayData('Agency', {
url: `Agencies/${route.params.id}`,
});
const { store } = arrayData;
onMounted(async () => await arrayData.fetch({ append: false }));
watch(
() => route.params.id,
async (newId) => {
if (newId) {
store.url = `Agencies/${newId}`;
await arrayData.fetch({ append: false });
}
}
);
</script>
<template>
<VnCard
data-key="Agency"
base-url="Agencies"
:descriptor="AgencyDescriptor"
searchbar-data-key="AgencyList"
searchbar-url="Agencies"
searchbar-label="agency.searchBar.label"
searchbar-info="agency.searchBar.info"
/>
</template>

View File

@ -0,0 +1,35 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue';
const props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const { t } = useI18n();
const { params } = useRoute();
const entityId = computed(() => props.id || params.id);
const { store } = useArrayData('Parking');
const card = computed(() => store.data);
</script>
<template>
<CardDescriptor
module="Agency"
data-key="Agency"
:url="`Agencies/${entityId}`"
:title="card?.name"
:subtitle="props.id"
>
<template #body="{ entity: agency }">
<VnLv :label="t('globals.name')" :value="agency.name" />
</template>
</CardDescriptor>
</template>

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Agency" url="/AgencyLogs" />
</template>

View File

@ -0,0 +1,60 @@
<script setup>
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardList from 'src/components/ui/CardList.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
const { t } = useI18n();
const route = useRoute();
const routeId = route.params.id;
</script>
<template>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="AgencyModes"
:url="`AgencyModes`"
:filter="{ where: { agencyFk: routeId } }"
order="name"
auto-load
>
<template #body="{ rows }">
<CardList
:id="row.id"
:key="row.id"
:title="row.name"
v-for="row of rows"
>
<template #list-items>
<VnLv
:label="t('globals.description')"
:value="row?.description"
/>
<VnLv
:label="t('deliveryMethod')"
:value="row?.deliveryMethodFk"
/>
<VnLv label="m3" :value="row?.m3" />
<VnLv :label="t('inflation')" :value="row?.inflation" />
<VnLv :label="t('globals.code')" :value="row?.code" />
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<i18n>
es:
isOwn: Tiene propietario
isAnyVolumeAllowed: Permite cualquier volumen
Search agency: Buscar agencia
You can search by name: Puedes buscar por nombre
deliveryMethod: Método de entrega
inflation: Inflación
en:
isOwn: Has owner
isAnyVolumeAllowed: Allows any volume
</i18n>

View File

@ -0,0 +1,55 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const $props = defineProps({
id: {
type: Number,
default: 0,
},
});
const { params } = useRoute();
const { t } = useI18n();
const entityId = computed(() => $props.id || params.id);
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
</script>
<template>
<div class="q-pa-md">
<CardSummary :url="`Agencies/${entityId}`">
<template #header="{ entity: agency }">{{ agency.name }}</template>
<template #body="{ entity: agency }">
<QCard class="vn-one">
<QCardSection class="q-pa-none">
<VnTitle
:url="`#/agency/${entityId}/basic-data`"
:text="t('globals.pageTitles.basicData')"
/>
</QCardSection>
<VnLv :label="t('globals.name')" :value="agency.name" />
<QCheckbox
:label="t('agency.isOwn')"
v-model="agency.isOwn"
:disable="true"
/>
<QCheckbox
:label="t('agency.isAnyVolumeAllowed')"
v-model="agency.isAnyVolumeAllowed"
:disable="true"
/>
</QCard>
</template>
</CardSummary>
</div>
</template>

View File

@ -0,0 +1,136 @@
<script setup>
import axios from 'axios';
import { useQuasar } from 'quasar';
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue';
import FormModelPopup from 'src/components/FormModelPopup.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const route = useRoute();
const paginate = ref();
const dialog = ref();
const routeId = computed(() => route.params.id);
const quasar = useQuasar();
const initialData = computed(() => {
return {
agencyFk: routeId.value,
workCenterFk: null,
};
});
async function deleteWorCenter(id) {
try {
await axios.delete(`AgencyWorkCenters/${id}`).then(async () => {
quasar.notify({
message: t('agency.notification.removeItem'),
type: 'positive',
});
});
} catch (error) {
quasar.notify({
message: t('agency.notification.removeItemError'),
type: 'error',
});
}
paginate.value.fetch();
}
</script>
<template>
<div class="centerCard">
<FetchData
url="workCenters"
sort-by="name"
@on-fetch="(data) => (warehouses = data)"
auto-load
/>
<VnPaginate
ref="paginate"
data-key="AgencyWorkCenters"
url="AgencyWorkCenters"
:filter="{ where: { agencyFk: routeId } }"
order="id"
auto-load
>
<template #body="{ rows }">
<QCard
flat
bordered
:key="row.id"
v-for="row of rows"
class="card q-pa-md q-mb-sm"
>
<QItem>
<QItemSection side-left>
<VnLv :value="row?.workCenter?.name" icon="delete" />
</QItemSection>
<QItemSection side>
<QBtn
@click.stop="deleteWorCenter(row.id)"
icon="delete"
color="primary"
round
flat
/>
</QItemSection>
</QItem>
</QCard>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add">
<QDialog ref="dialog">
<FormModelPopup
:title="t('Add work center')"
url-create="AgencyWorkCenters"
model="AgencyWorkCenter"
:form-initial-data="initialData"
@on-data-saved="paginate.fetch()"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnSelect
v-model="data.workCenterFk"
option-value="id"
option-label="name"
:label="t('workCenter')"
:options="warehouses"
use-input
input-debounce="0"
:is-clearable="false"
/>
</VnRow>
</template>
</FormModelPopup>
</QDialog>
</QBtn>
<QTooltip>
{{ t('globals.new') }}
</QTooltip>
</QPageSticky>
</template>
<style lang="scss" scoped>
.centerCard {
padding: 5%;
width: 100%;
max-width: 50%;
margin: 0 auto;
}
</style>
<i18n>
es:
workCenter removed successfully: Centro de trabajo eliminado correctamente
This workCenter is already assigned to this agency: Este workCenter ya está asignado a esta agencia
Add work center: Añadir centro de trabajo
workCenter: Centro de trabajo
</i18n>

View File

@ -0,0 +1,11 @@
agency:
isOwn: Own
isAnyVolumeAllowed: Any volume allowed
notification:
removeItemError: Error removing agency
removeItem: WorkCenter removed successfully
pageTitles:
agency: Agency
searchBar:
info: You can search by agency code
label: Search agency...

View File

@ -0,0 +1,12 @@
agency:
isOwn: Propio
isAnyVolumeAllowed: Cualquier volumen
removeItem: Agencia eliminada correctamente
notification:
removeItemError: Error al eliminar la agencia
removeItem: Centro de trabajo eliminado correctamente
pageTitles:
agency: Agencia
searchBar:
info: Puedes buscar por nombre o id
label: Buscar agencia...

View File

@ -149,6 +149,15 @@ const states = ref();
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
v-model="params.myTeam"
:label="t('myTeam')"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QSeparator />
<QExpansionItem :label="t('More options')" expand-separator>
<!-- <QItem>
@ -192,6 +201,7 @@ en:
claimResponsibleFk: Responsible
claimStateFk: State
created: Created
myTeam: My team
es:
params:
search: Contiene
@ -211,4 +221,5 @@ es:
Item: Artículo
Created: Creada
More options: Más opciones
myTeam: Mi equipo
</i18n>

View File

@ -13,7 +13,6 @@ const router = useRouter();
const initialData = ref({});
const setClient = (data) => {
console.log(data.credit);
initialData.value.credit = data.credit;
};

View File

@ -0,0 +1,50 @@
<script setup>
import { reactive, ref, onMounted, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'src/components/common/VnInput.vue';
import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from 'components/FormModelPopup.vue';
const { t } = useI18n();
const emit = defineEmits(['onDataSaved']);
const genusInputRef = ref(null);
const genusFormData = reactive({});
const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
};
onMounted(async () => {
await nextTick();
genusInputRef.value.focus();
});
</script>
<template>
<FormModelPopup
url-create="genera"
model="itemGenus"
:title="t('New genus')"
:form-initial-data="genusFormData"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
ref="genusInputRef"
:label="t('Latin genus name')"
v-model="data.name"
:required="true"
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New genus: Nuevo genus
Latin genus name: Nombre del genus en latín
</i18n>

View File

@ -0,0 +1,50 @@
<script setup>
import { reactive, ref, onMounted, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'src/components/common/VnInput.vue';
import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from 'components/FormModelPopup.vue';
const { t } = useI18n();
const emit = defineEmits(['onDataSaved']);
const specieInputRef = ref(null);
const specieFormData = reactive({});
const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
};
onMounted(async () => {
await nextTick();
specieInputRef.value.focus();
});
</script>
<template>
<FormModelPopup
url-create="species"
model="itemSpecie"
:title="t('New species')"
:form-initial-data="specieFormData"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
ref="specieInputRef"
:label="t('Latin species name')"
v-model="data.name"
:required="true"
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New species: Nueva especie
Latin species name: Nombre de la especie en latín
</i18n>

View File

@ -1 +1,94 @@
<template>Item barcode</template>
<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CrudModel from 'src/components/CrudModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
const route = useRoute();
const { t } = useI18n();
const itemBarcodeRef = ref(null);
const insertRow = () => {
itemBarcodeRef.value.insert();
focusLastInput();
};
const focusLastInput = () => {
nextTick(() => {
const inputs = document.querySelectorAll('[focusable-input]');
const lastInput = inputs[inputs.length - 1];
if (lastInput) lastInput.focus();
});
};
onMounted(async () => {
if (itemBarcodeRef.value) itemBarcodeRef.value.reload();
});
</script>
<template>
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<CrudModel
:data-required="{ itemFk: route.params.id }"
:default-remove="false"
:filter="{
fields: ['id', 'itemFk', 'code'],
where: { itemFk: route.params.id },
}"
data-key="ItemBarcodes"
model="ItemBarcodes"
ref="itemBarcodeRef"
url="ItemBarcodes"
>
<template #body="{ rows }">
<QCard class="q-px-lg q-py-md">
<div
v-for="(row, index) in rows"
:key="index"
class="q-mb-md full-width row items-center no-wrap"
>
<VnInput
:label="t('Code')"
v-model="row.code"
class="full-width"
focusable-input
/>
<QIcon
@click="itemBarcodeRef.remove([row])"
class="cursor-pointer q-ml-md"
color="primary"
name="delete"
size="sm"
>
<QTooltip class="text-no-wrap">
{{ t('Remove barcode') }}
</QTooltip>
</QIcon>
</div>
<QIcon
@click="insertRow()"
class="cursor-pointer fill-icon-on-hover"
color="primary"
name="add_circle"
size="sm"
>
<QTooltip>
{{ t('Add barcode') }}
</QTooltip>
</QIcon>
</QCard>
</template>
</CrudModel>
</QPage>
</div>
</template>
<i18n>
es:
Code: Código
Remove barcode: Quitar código de barras
Add barcode: Añadir código de barras
</i18n>

View File

@ -1 +1,114 @@
<template>Item Botanical</template>
<script setup>
import { ref, onMounted, reactive, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateGenusForm from './CreateGenusForm.vue';
import CreateSpecieForm from './CreateSpecieForm.vue';
const route = useRoute();
const { t } = useI18n();
const itemBotanicalsRef = ref(null);
const itemGenusOptions = ref([]);
const itemSpeciesOptions = ref([]);
const itemBotanicals = ref([]);
let itemBotanicalsForm = reactive({ itemFk: null });
const onGenusCreated = (response, formData) => {
itemGenusOptions.value = [...itemGenusOptions.value, response];
formData.genusFk = response.id;
};
const onSpecieCreated = (response, formData) => {
itemSpeciesOptions.value = [...itemSpeciesOptions.value, response];
formData.specieFk = response.id;
};
const entityId = computed(() => {
return route.params.id;
});
onMounted(async () => {
itemBotanicalsForm.itemFk = entityId.value;
itemBotanicals.value = await itemBotanicalsRef.value.fetch();
if (itemBotanicals.value.length > 0)
Object.assign(itemBotanicalsForm, itemBotanicals.value[0]);
});
</script>
<template>
<FetchData
ref="itemBotanicalsRef"
url="ItemBotanicals"
:filter="{
where: { itemFk: entityId },
}"
@on-fetch="(data) => (itemBotanicals = data)"
/>
<FetchData
url="Genera"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemGenusOptions = data)"
auto-load
/>
<FetchData
url="Species"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (itemSpeciesOptions = data)"
auto-load
/>
<FormModel
url-update="ItemBotanicals"
model="entry"
auto-load
:form-initial-data="itemBotanicalsForm"
:clear-store-on-unmount="false"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectDialog
:label="t('Genus')"
v-model="data.genusFk"
:options="itemGenusOptions"
option-label="name"
option-value="id"
hide-selected
>
<template #form>
<CreateGenusForm
@on-data-saved="
(_, requestResponse) =>
onGenusCreated(requestResponse, data)
"
/>
</template>
</VnSelectDialog>
<VnSelectDialog
:label="t('Species')"
v-model="data.specieFk"
:options="itemSpeciesOptions"
option-label="name"
option-value="id"
hide-selected
>
<template #form>
<CreateSpecieForm
@on-data-saved="
(_, requestResponse) =>
onSpecieCreated(requestResponse, data)
"
/>
</template>
</VnSelectDialog>
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Genus: Genus
Species: Especie
</i18n>

View File

@ -177,14 +177,27 @@ const openCloneDialog = async () => {
<VnLv :label="t('item.descriptor.buyer')">
<template #value>
<span class="link">
{{ t('item.descriptor.buyer') }}
{{ entity.itemType?.worker?.user?.name }}
<WorkerDescriptorProxy :id="entity.itemType?.worker?.id" />
</span>
</template>
</VnLv>
<VnLv :label="t('item.descriptor.color')" :value="entity.value5"> </VnLv>
<VnLv :label="t('item.descriptor.color')" :value="entity.value6" />
<VnLv :label="t('item.descriptor.stems')" :value="entity.value7" />
<VnLv
v-if="entity.value5"
:label="t('item.descriptor.color')"
:value="entity.value5"
>
</VnLv>
<VnLv
v-if="entity.value6"
:label="t('item.descriptor.category')"
:value="entity.value6"
/>
<VnLv
v-if="entity.value7"
:label="t('item.descriptor.stems')"
:value="entity.value7"
/>
</template>
<template #actions="{}">
<QCardActions class="row justify-center">

View File

@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
@ -178,7 +178,7 @@ const columns = computed(() => [
name: 'warehouse',
...defaultColumnAttrs,
columnFilter: {
component: VnSelectFilter,
component: VnSelect,
type: 'select',
filterValue: null,
event: getColumnInputEvents,
@ -434,7 +434,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<template #body-cell-itemId="props">
<QTd>
<VnSelectFilter
<VnSelect
:options="itemsWithNameOptions"
hide-selected
option-label="id"
@ -450,7 +450,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</VnSelect>
</QTd>
</template>
<template #body-cell-description="{ row }">
@ -531,7 +531,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</template>
<template #body-cell-warehouse="props">
<QTd class="col">
<VnSelectFilter
<VnSelect
:options="warehousesOptions"
hide-selected
option-label="name"

View File

@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import VnSelect from 'components/common/VnSelect.vue';
import ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
const { t } = useI18n();
@ -35,7 +35,7 @@ const itemTypeWorkersOptions = ref([]);
<template #body="{ params, searchFn }">
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.buyerFk')"
v-model="params.buyerFk"
:options="itemTypeWorkersOptions"
@ -51,7 +51,7 @@ const itemTypeWorkersOptions = ref([]);
</QItem>
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('components.itemsFilterPanel.warehouseFk')"
v-model="params.warehouseFk"
:options="warehousesOptions"

View File

@ -12,6 +12,7 @@ import ItemDescriptorProxy from '../Item/Card/ItemDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import ItemSummary from '../Item/Card/ItemSummary.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import ItemListFilter from './ItemListFilter.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDateFormat } from 'src/filters/date.js';
@ -69,7 +70,7 @@ const exprBuilder = (param, value) => {
}
};
const params = reactive({});
const params = reactive({ isFloramondo: false, isActive: true });
const applyColumnFilter = async (col) => {
try {
@ -442,6 +443,11 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<ItemListFilter data-key="ItemList" />
</QScrollArea>
</QDrawer>
<QPage class="column items-center q-pa-md">
<VnPaginate
ref="paginateRef"

View File

@ -0,0 +1,460 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { onMounted } from 'vue';
import { useStateStore } from 'stores/useStateStore';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QCheckbox } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import { useValidator } from 'src/composables/useValidator';
import axios from 'axios';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const stateStore = useStateStore();
const validationsStore = useValidator();
const itemTypesRef = ref(null);
const categoriesOptions = ref([]);
const itemTypesOptions = ref([]);
const buyersOptions = ref([]);
const suppliersOptions = ref([]);
const tagValues = ref([]);
const fieldFiltersValues = ref([]);
const moreFields = ref([]);
const arrayData = useArrayData(props.dataKey);
const itemTypesFilter = {
fields: ['id', 'name', 'categoryFk'],
include: 'category',
order: 'name ASC',
where: {},
};
const onCategoryChange = async (categoryFk, search) => {
if (!categoryFk) {
itemTypesFilter.where.categoryFk = null;
delete itemTypesFilter.where.categoryFk;
} else {
itemTypesFilter.where.categoryFk = categoryFk;
}
search();
await itemTypesRef.value.fetch();
};
const getSelectedTagValues = async (tag) => {
try {
tag.value = null;
const filter = {
fields: ['value'],
order: 'value ASC',
};
const params = { filter: JSON.stringify(filter) };
const { data } = await axios.get(`Tags/${tag.selectedTag.id}/filterValue`, {
params,
});
tag.valueOptions = data;
} catch (err) {
console.error('Error getting selected tag values');
}
};
const applyTags = (params, search) => {
params.tags = tagValues.value
.filter((tag) => tag.selectedTag && tag.value)
.map((tag) => ({
tagFk: tag.selectedTag.id,
tagName: tag.selectedTag.name,
value: tag.value,
}));
search();
};
const removeTag = (index, params, search) => {
(tagValues.value || []).splice(index, 1);
applyTags(params, search);
};
const applyFieldFilters = (params) => {
fieldFiltersValues.value.forEach((fieldFilter) => {
if (
fieldFilter.selectedField &&
(fieldFilter.value !== null ||
fieldFilter.value !== '' ||
fieldFilter.value !== undefined)
) {
params[fieldFilter.name] = fieldFilter.value;
}
});
arrayData.applyFilter({ params });
};
const removeFieldFilter = (index, params, search) => {
delete params[fieldFiltersValues.value[index].name];
(fieldFiltersValues.value || []).splice(index, 1);
applyFieldFilters(params, search);
};
onMounted(async () => {
stateStore.rightDrawer = true;
if (arrayData.store?.userParams?.categoryFk)
itemTypesFilter.where.categoryFk = arrayData.store?.userParams?.categoryFk;
await itemTypesRef.value.fetch();
const { models } = validationsStore;
const properties = models.Item?.properties || {};
const _moreFields = ['id', 'description', 'name', 'isActive'];
_moreFields.forEach((field) => {
let prop = properties[field];
const label = t(`params.${field}`);
moreFields.value.push({
name: field,
label,
type: prop ? prop.type : null,
});
});
// Fill fieldFiltersValues with existent userParams
if (arrayData.store?.userParams) {
fieldFiltersValues.value = Object.entries(arrayData.store?.userParams)
.filter(([key, value]) => value && _moreFields.includes(key))
.map(([key, value]) => ({
name: key,
value,
selectedField: moreFields.value.find((field) => field.name === key),
}));
}
});
</script>
<template>
<FetchData
url="ItemCategories"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (categoriesOptions = data)"
auto-load
/>
<FetchData
ref="itemTypesRef"
url="ItemTypes"
:filter="itemTypesFilter"
@on-fetch="(data) => (itemTypesOptions = data)"
/>
<FetchData
url="TicketRequests/getItemTypeWorker"
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC' }"
@on-fetch="(data) => (buyersOptions = data)"
auto-load
/>
<FetchData
url="Suppliers"
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC' }"
@on-fetch="(data) => (suppliersOptions = data)"
auto-load
/>
<FetchData
url="Tags"
:filter="{ fields: ['id', 'name', 'isFree'] }"
auto-load
@on-fetch="(data) => (tagOptions = data)"
/>
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:hidden-tags="tagValues.length === 0 ? ['tags'] : []"
>
<template #tags="{ tag, formatFn }">
<div>
<strong>{{ t(`params.${tag.label}`) }}</strong>
<span v-if="tag.label !== 'tags'">: {{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
v-model="params.search"
:label="t('params.search')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.categoryFk')"
v-model="params.categoryFk"
@update:model-value="
($event) => onCategoryChange($event, searchFn)
"
:options="categoriesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.typeFk')"
v-model="params.typeFk"
@update:model-value="searchFn()"
:options="itemTypesOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>{{
scope.opt?.category?.name
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.buyerFk')"
v-model="params.buyerFk"
@update:model-value="searchFn()"
:options="buyersOptions"
option-value="id"
option-label="nickname"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('params.supplierFk')"
v-model="params.supplierFk"
@update:model-value="searchFn()"
:options="suppliersOptions"
option-value="id"
option-label="name"
hide-selected
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{
scope.opt?.name + ': ' + scope.opt?.nickname
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<!-- Tags filter -->
<QItem class="row items-center">
<QItemLabel>
{{ t('params.tags') }}
</QItemLabel>
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="tagValues.push({})"
/>
</QItem>
<QItem
v-for="(tag, index) in tagValues"
:key="index"
class="row items-center"
>
<QItemSection class="col">
<VnSelect
:label="t('params.tag')"
v-model="tag.selectedTag"
:options="tagOptions"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="getSelectedTagValues(tag)"
/>
</QItemSection>
<QItemSection class="col">
<VnSelect
v-if="!tag?.selectedTag?.isFree && tag.valueOptions"
:label="t('params.tag')"
v-model="tag.value"
:options="tag.valueOptions || []"
option-value="value"
option-label="value"
dense
outlined
rounded
emit-value
use-input
:disable="!tag"
:is-clearable="false"
@update:model-value="applyTags(params, searchFn)"
/>
<VnInput
v-else
v-model="tag.value"
:label="t('params.value')"
:disable="!tag"
is-outlined
:is-clearable="false"
@keydown.enter.prevent="applyTags(params, searchFn)"
/>
</QItemSection>
<QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeTag(index, params, searchFn)"
/>
</QItem>
<!-- Filter fields -->
<QItem class="row items-center">
<QItemLabel>
{{ t('More fields') }}
</QItemLabel>
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="fieldFiltersValues.push({})"
/>
</QItem>
<QItem
v-for="(fieldFilter, index) in fieldFiltersValues"
:key="index"
class="row items-center"
>
<QItemSection class="col">
<VnSelect
:label="t('params.tag')"
:model-value="fieldFilter.selectedField"
:options="moreFields"
option-label="label"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="
($event) => {
fieldFilter.name = $event.name;
fieldFilter.value = null;
fieldFilter.selectedField = $event;
}
"
/>
</QItemSection>
<QItemSection class="col">
<QCheckbox
v-if="fieldFilter.selectedField?.type === 'boolean'"
v-model="fieldFilter.value"
:label="t('params.value')"
@update:model-value="applyFieldFilters(params, searchFn)"
/>
<VnInput
v-else
v-model="fieldFilter.value"
:label="t('params.value')"
:disable="!fieldFilter.selectedField"
is-outlined
@keydown.enter="applyFieldFilters(params, searchFn)"
/>
</QItemSection>
<QIcon
name="delete"
class="fill-icon-on-hover q-ml-xs"
size="sm"
color="primary"
@click="removeFieldFilter(index, params, searchFn)"
/>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.isFloramondo')"
v-model="params.isFloramondo"
toggle-indeterminate
@update:model-value="searchFn()"
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
search: General search
categoryFk: Category
typeFk: Type
buyerFk: Buyer
supplierFk: Supplier
tags: Tags
tag: Tag
value: Value
isFloramondo: Floramondo
isActive: Active
description: Description
name: Name
id: Id
es:
More fields: Más campos
params:
search: Búsqueda general
categoryFk: Reino
typeFk: Tipo
buyerFk: Comprador
supplierFk: Proveedor
tags: Etiquetas
tag: Etiqueta
value: Valor
isFloramondo: Floramondo
isActive: Activo
description: Descripción
name: Nombre
id: Id
</i18n>

View File

@ -3,7 +3,7 @@ import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
@ -126,7 +126,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
v-model="params.attenderFk"
:label="t('params.attenderFk')"
@update:model-value="searchFn()"
@ -151,7 +151,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('params.warehouseFk')"
v-model="params.warehouseFk"
@update:model-value="searchFn()"
@ -167,7 +167,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('params.requesterFk')"
v-model="params.requesterFk"
@update:model-value="searchFn()"
@ -190,7 +190,7 @@ const decrement = (paramsObj, key) => {
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</VnSelect>
</QItemSection>
</QItem>
<QCard bordered>
@ -261,7 +261,7 @@ const decrement = (paramsObj, key) => {
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
<VnSelect
:label="t('params.state')"
v-model="params.state"
@update:model-value="searchFn()"

View File

@ -73,7 +73,6 @@ const fetchAddresses = async (formData) => {
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
console.log();
} catch (err) {
console.error(`Error fetching addresses`, err);
return err.response;

View File

@ -0,0 +1,88 @@
import { RouterView } from 'vue-router';
export default {
path: '/agency',
name: 'Agency',
meta: {
title: 'agency',
icon: 'garage_home',
moduleName: 'Agency',
},
component: RouterView,
redirect: { name: 'AgencyCard' },
menus: {
main: [],
card: ['AgencyBasicData', 'AgencyModes', 'AgencyWorkCenters', 'AgencyLog'],
},
children: [
{
path: '/agency/:id',
name: 'AgencyCard',
component: () => import('src/pages/Agency/Card/AgencyCard.vue'),
redirect: { name: 'AgencySummary' },
children: [
{
name: 'AgencySummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'view_list',
},
component: () => import('src/pages/Agency/Card/AgencySummary.vue'),
},
{
name: 'AgencyBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Agency/Card/AgencyBasicData.vue'),
},
{
path: 'workCenter',
name: 'AgencyWorkCenterCard',
redirect: { name: 'AgencyWorkCenters' },
children: [
{
path: '',
name: 'AgencyWorkCenters',
meta: {
icon: 'apartment',
title: 'workCenters',
},
component: () =>
import('src/pages/Agency/Card/AgencyWorkcenter.vue'),
},
],
},
{
path: 'modes',
name: 'AgencyModesCard',
redirect: { name: 'AgencyModes' },
children: [
{
path: '',
name: 'AgencyModes',
meta: {
icon: 'format_list_bulleted',
title: 'modes',
},
component: () =>
import('src/pages/Agency/Card/AgencyModes.vue'),
},
],
},
{
name: 'AgencyLog',
path: 'log',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Agency/Card/AgencyLog.vue'),
},
],
},
],
};

View File

@ -15,6 +15,7 @@ import Department from './department';
import Entry from './entry';
import roadmap from './roadmap';
import Parking from './parking';
import Agency from './agency';
export default [
Item,
@ -34,4 +35,5 @@ export default [
Entry,
roadmap,
Parking,
Agency,
];

View File

@ -121,15 +121,6 @@ export default {
},
component: () => import('src/pages/Item/Card/ItemTax.vue'),
},
{
path: 'botanical',
name: 'ItemBotanical',
meta: {
title: 'botanical',
icon: 'vn:botanical',
},
component: () => import('src/pages/Item/Card/ItemBotanical.vue'),
},
{
path: 'barcode',
name: 'ItemBarcode',
@ -157,6 +148,15 @@ export default {
},
component: () => import('src/pages/Item/Card/ItemLog.vue'),
},
{
path: 'botanical',
name: 'ItemBotanical',
meta: {
title: 'botanical',
icon: 'vn:botanical',
},
component: () => import('src/pages/Item/Card/ItemBotanical.vue'),
},
],
},
],

View File

@ -11,7 +11,7 @@ export default {
component: RouterView,
redirect: { name: 'RouteMain' },
menus: {
main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList'],
main: ['RouteList', 'RouteAutonomous', 'RouteRoadmap', 'CmrList', 'AgencyList'],
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
},
children: [
@ -75,6 +75,21 @@ export default {
},
component: () => import('src/pages/Route/Cmr/CmrList.vue'),
},
{
path: '/agency',
redirect: { name: 'AgencyList' },
children: [
{
path: 'list',
name: 'AgencyList',
meta: {
title: 'agencyList',
icon: 'view_list',
},
component: () => import('src/pages/Agency/AgencyList.vue'),
},
],
},
],
},
{

View File

@ -15,6 +15,7 @@ import order from 'src/router/modules/order';
import entry from 'src/router/modules/entry';
import roadmap from 'src/router/modules/roadmap';
import parking from 'src/router/modules/parking';
import agency from 'src/router/modules/agency';
const routes = [
{
@ -71,6 +72,7 @@ const routes = [
roadmap,
entry,
parking,
agency,
{
path: '/:catchAll(.*)*',
name: 'NotFound',

View File

@ -0,0 +1,50 @@
describe('AgencyWorkCenter', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/agency`);
});
it('assign workCenter', () => {
cy.visit(`/#/agency`);
cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click();
cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click();
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-btn--standard > .q-btn__content > .block').click();
cy.get('.q-notification__message').should('have.text', 'Data created');
});
it('delete workCenter', () => {
cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click();
cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click();
cy.get('.q-item__section--side > .q-btn > .q-btn__content > .q-icon').click();
cy.get('.q-notification__message').should(
'have.text',
'WorkCenter removed successfully'
);
});
it('error on duplicate workCenter', () => {
cy.visit(`/#/agency`);
cy.get(':nth-child(1) > :nth-child(1) > .card-list-body > .list-items').click();
cy.get('[href="#/agency/11/workCenter"] > .q-item__section--main').click();
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-btn--standard > .q-btn__content > .block').click();
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get(
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container'
).type('workCenterOne{enter}');
cy.get('.q-btn--standard > .q-btn__content > .block').click();
cy.get(
':nth-child(2) > .q-notification__wrapper > .q-notification__content > .q-notification__message'
).should('have.text', 'This workCenter is already assigned to this agency');
});
});

View File

@ -1 +1 @@
// This file will be run before each test file
// This file will be run before each test file, don't delete or vitest will not work.