forked from verdnatura/salix-front
Merge remote-tracking branch 'mindshore/feature/ItemsSummary' into feature/ItemRequests
This commit is contained in:
commit
e65ffb63c9
14490
pnpm-lock.yaml
14490
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,12 @@
|
|||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ref, markRaw } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import { QCheckbox } from 'quasar';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
@ -28,11 +31,16 @@ const $props = defineProps({
|
|||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const formData = reactive({
|
||||
field: null,
|
||||
newValue: null,
|
||||
});
|
||||
const inputs = {
|
||||
input: markRaw(VnInput),
|
||||
number: markRaw(VnInput),
|
||||
date: markRaw(VnInputDate),
|
||||
checkbox: markRaw(QCheckbox),
|
||||
select: markRaw(VnSelectFilter),
|
||||
};
|
||||
|
||||
const newValue = ref(null);
|
||||
const selectedField = ref(null);
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
|
||||
|
@ -47,8 +55,8 @@ const submitData = async () => {
|
|||
isLoading.value = true;
|
||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
||||
const payload = {
|
||||
field: formData.field,
|
||||
newValue: formData.newValue,
|
||||
field: selectedField.value.field,
|
||||
newValue: newValue.value,
|
||||
lines: rowsToEdit,
|
||||
};
|
||||
|
||||
|
@ -75,19 +83,20 @@ const closeForm = () => {
|
|||
<span class="countLines">{{ ` ${rows.length} ` }}</span>
|
||||
<span class="title">{{ t('buy(s)') }}</span>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Field to edit')"
|
||||
:options="fieldsOptions"
|
||||
hide-selected
|
||||
option-label="label"
|
||||
option-value="field"
|
||||
v-model="formData.field"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput :label="t('Value')" v-model="formData.newValue" />
|
||||
</div>
|
||||
<VnSelectFilter
|
||||
:label="t('Field to edit')"
|
||||
:options="fieldsOptions"
|
||||
hide-selected
|
||||
option-label="label"
|
||||
v-model="selectedField"
|
||||
/>
|
||||
<component
|
||||
:is="inputs[selectedField?.component || 'input']"
|
||||
v-bind="selectedField?.attrs || {}"
|
||||
v-model="newValue"
|
||||
:label="t('Value')"
|
||||
style="width: 200px"
|
||||
/>
|
||||
</VnRow>
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
|
|
|
@ -102,7 +102,7 @@ onMounted(async () => {
|
|||
});
|
||||
|
||||
onBeforeRouteLeave((to, from, next) => {
|
||||
if (hasChanges.value)
|
||||
if (hasChanges.value && $props.observeFormChanges)
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
|
|
|
@ -56,14 +56,6 @@ const closeForm = () => {
|
|||
<p>{{ subtitle }}</p>
|
||||
<slot name="form-inputs" />
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
v-if="defaultSubmitButton"
|
||||
:label="customSubmitButtonLabel || t('globals.save')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<QBtn
|
||||
v-if="defaultCancelButton"
|
||||
:label="t('globals.cancel')"
|
||||
|
@ -74,6 +66,14 @@ const closeForm = () => {
|
|||
:loading="isLoading"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
v-if="defaultSubmitButton"
|
||||
:label="customSubmitButtonLabel || t('globals.save')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
<slot name="customButtons" />
|
||||
</div>
|
||||
</QCard>
|
||||
|
|
|
@ -0,0 +1,359 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
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 VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
customTags: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
exprBuilder: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const itemCategories = ref([]);
|
||||
const selectedCategoryFk = ref(null);
|
||||
const selectedTypeFk = ref(null);
|
||||
const itemTypesOptions = ref([]);
|
||||
const suppliersOptions = ref([]);
|
||||
const tagOptions = ref([]);
|
||||
const tagValues = ref([]);
|
||||
|
||||
const categoryList = computed(() => {
|
||||
return (itemCategories.value || [])
|
||||
.filter((category) => category.display)
|
||||
.map((category) => ({
|
||||
...category,
|
||||
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
||||
}));
|
||||
});
|
||||
|
||||
const selectedCategory = computed(() =>
|
||||
(itemCategories.value || []).find(
|
||||
(category) => category?.id === selectedCategoryFk.value
|
||||
)
|
||||
);
|
||||
|
||||
const selectedType = computed(() => {
|
||||
return (itemTypesOptions.value || []).find(
|
||||
(type) => type?.id === selectedTypeFk.value
|
||||
);
|
||||
});
|
||||
|
||||
const selectCategory = async (params, categoryId, search) => {
|
||||
if (params.categoryFk === categoryId) {
|
||||
resetCategory(params);
|
||||
search();
|
||||
return;
|
||||
}
|
||||
selectedCategoryFk.value = categoryId;
|
||||
params.categoryFk = categoryId;
|
||||
await fetchItemTypes(categoryId);
|
||||
search();
|
||||
};
|
||||
|
||||
const resetCategory = (params) => {
|
||||
selectedCategoryFk.value = null;
|
||||
itemTypesOptions.value = null;
|
||||
if (params) {
|
||||
params.categoryFk = null;
|
||||
params.typeFk = null;
|
||||
}
|
||||
};
|
||||
|
||||
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 fetchItemTypes = async (id) => {
|
||||
try {
|
||||
const filter = {
|
||||
fields: ['id', 'name', 'categoryFk'],
|
||||
where: { categoryFk: id },
|
||||
include: 'category',
|
||||
order: 'name ASC',
|
||||
};
|
||||
const { data } = await axios.get('ItemTypes', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
itemTypesOptions.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching item types', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getCategoryClass = (category, params) => {
|
||||
if (category.id === params?.categoryFk) {
|
||||
return 'active';
|
||||
}
|
||||
};
|
||||
|
||||
const getSelectedTagValues = async (tag) => {
|
||||
try {
|
||||
tag.value = null;
|
||||
const filter = {
|
||||
fields: ['value'],
|
||||
order: 'value ASC',
|
||||
limit: 30,
|
||||
};
|
||||
|
||||
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 removeTag = (index, params, search) => {
|
||||
(tagValues.value || []).splice(index, 1);
|
||||
applyTags(params, search);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="ItemCategories"
|
||||
limit="30"
|
||||
auto-load
|
||||
@on-fetch="(data) => (itemCategories = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Suppliers"
|
||||
limit="30"
|
||||
auto-load
|
||||
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC', limit: 30 }"
|
||||
@on-fetch="(data) => (suppliersOptions = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Tags"
|
||||
:filter="{ fields: ['id', 'name', 'isFree'] }"
|
||||
auto-load
|
||||
limit="30"
|
||||
@on-fetch="(data) => (tagOptions = data)"
|
||||
/>
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:expr-builder="exprBuilder"
|
||||
:custom-tags="customTags"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<strong v-if="tag.label === 'categoryFk'">
|
||||
{{ t(selectedCategory?.name || '') }}
|
||||
</strong>
|
||||
<strong v-else-if="tag.label === 'typeFk'">
|
||||
{{ t(selectedType?.name || '') }}
|
||||
</strong>
|
||||
<div v-else class="q-gutter-x-xs">
|
||||
<strong>{{ t(`components.itemsFilterPanel.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #customTags="{ tags, params }">
|
||||
<template v-for="tag in tags" :key="tag.label">
|
||||
<VnFilterPanelChip
|
||||
v-for="chip in tag.value"
|
||||
:key="chip"
|
||||
removable
|
||||
@remove="removeTagChip(chip, params, searchFn)"
|
||||
>
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ chip.tagName }}: </strong>
|
||||
<span>"{{ chip.value }}"</span>
|
||||
</div>
|
||||
</VnFilterPanelChip>
|
||||
</template>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem class="category-filter q-mt-md">
|
||||
<QBtn
|
||||
dense
|
||||
flat
|
||||
round
|
||||
v-for="category in categoryList"
|
||||
:key="category.name"
|
||||
:class="['category', getCategoryClass(category, params)]"
|
||||
:icon="category.icon"
|
||||
@click="selectCategory(params, category.id, searchFn)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t(category.name) }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QItem>
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('components.itemsFilterPanel.typeFk')"
|
||||
v-model="params.typeFk"
|
||||
:options="itemTypesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
use-input
|
||||
:disable="!selectedCategoryFk"
|
||||
@update:model-value="
|
||||
(value) => {
|
||||
selectedTypeFk = value;
|
||||
searchFn();
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.categoryName }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<slot name="body" :params="params" :search-fn="searchFn" />
|
||||
<QItem
|
||||
v-for="(value, index) in tagValues"
|
||||
:key="value"
|
||||
class="q-mt-md filter-value"
|
||||
>
|
||||
<QItemSection class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('components.itemsFilterPanel.tag')"
|
||||
v-model="value.selectedTag"
|
||||
:options="tagOptions"
|
||||
option-label="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:emit-value="false"
|
||||
use-input
|
||||
:is-clearable="false"
|
||||
@update:model-value="getSelectedTagValues(value)"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection class="col">
|
||||
<VnSelectFilter
|
||||
v-if="!value?.selectedTag?.isFree && value.valueOptions"
|
||||
:label="t('components.itemsFilterPanel.value')"
|
||||
v-model="value.value"
|
||||
:options="value.valueOptions || []"
|
||||
option-value="value"
|
||||
option-label="value"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
emit-value
|
||||
use-input
|
||||
:disable="!value"
|
||||
:is-clearable="false"
|
||||
@update:model-value="applyTags(params, searchFn)"
|
||||
/>
|
||||
<VnInput
|
||||
v-else
|
||||
v-model="value.value"
|
||||
:label="t('components.itemsFilterPanel.value')"
|
||||
:disable="!value"
|
||||
is-outlined
|
||||
:is-clearable="false"
|
||||
@keyup.enter="applyTags(params, searchFn)"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QIcon
|
||||
name="delete"
|
||||
class="fill-icon-on-hover q-px-xs"
|
||||
color="primary"
|
||||
size="sm"
|
||||
@click="removeTag(index, params, searchFn)"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-lg">
|
||||
<QIcon
|
||||
name="add_circle"
|
||||
class="fill-icon-on-hover q-px-xs"
|
||||
color="primary"
|
||||
size="sm"
|
||||
@click="tagValues.push({})"
|
||||
/>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.category-filter {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
|
||||
.category {
|
||||
padding: 8px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
font-size: 1.4rem;
|
||||
background-color: var(--vn-accent-color);
|
||||
|
||||
&.active {
|
||||
background-color: $primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
supplier: Supplier
|
||||
from: From
|
||||
to: To
|
||||
active: Is active
|
||||
visible: Is visible
|
||||
floramondo: Is floramondo
|
||||
salesPersonFk: Buyer
|
||||
categoryFk: Category
|
||||
|
||||
es:
|
||||
params:
|
||||
supplier: Proveedor
|
||||
from: Desde
|
||||
to: Hasta
|
||||
active: Activo
|
||||
visible: Visible
|
||||
floramondo: Floramondo
|
||||
salesPersonFk: Comprador
|
||||
categoryFk: Categoría
|
||||
</i18n>
|
|
@ -54,6 +54,7 @@ const onDataSaved = (data) => {
|
|||
<QInput
|
||||
:label="t('Type the visible quantity')"
|
||||
v-model.number="data.quantity"
|
||||
autofocus
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, computed } from 'vue';
|
||||
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
|
||||
const props = defineProps({
|
||||
dataKey: { type: String, required: true },
|
||||
baseUrl: { type: String, default: undefined },
|
||||
customUrl: { type: String, default: undefined },
|
||||
filter: { type: Object, default: () => {} },
|
||||
descriptor: { type: Object, required: true },
|
||||
searchbarDataKey: { type: String, default: undefined },
|
||||
searchbarUrl: { type: String, default: undefined },
|
||||
searchbarLabel: { type: String, default: '' },
|
||||
searchbarInfo: { type: String, default: '' },
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const url = computed(() => {
|
||||
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`;
|
||||
return props.customUrl;
|
||||
});
|
||||
|
||||
const arrayData = useArrayData(props.dataKey, {
|
||||
url: url.value,
|
||||
filter: props.filter,
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
||||
await arrayData.fetch({ append: false });
|
||||
});
|
||||
|
||||
if (props.baseUrl) {
|
||||
onBeforeRouteUpdate(async (to, from) => {
|
||||
if (to.params.id !== from.params.id) {
|
||||
arrayData.store.url = `${props.baseUrl}/${route.params.id}`;
|
||||
await arrayData.fetch({ append: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Teleport
|
||||
to="#searchbar"
|
||||
v-if="stateStore.isHeaderMounted() && props.searchbarDataKey"
|
||||
>
|
||||
<VnSearchbar
|
||||
:data-key="props.searchbarDataKey"
|
||||
:url="props.searchbarUrl"
|
||||
:label="t(props.searchbarLabel)"
|
||||
:info="t(props.searchbarInfo)"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<component :is="descriptor" />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="[useCardSize(), $attrs.class]">
|
||||
<RouterView />
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
</template>
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, useSlots, watch, computed, ref } from 'vue';
|
||||
import { onBeforeMount, watch, computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
|
@ -38,7 +38,6 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const state = useState();
|
||||
const slots = useSlots();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const arrayData = useArrayData($props.dataKey || $props.module, {
|
||||
|
@ -47,7 +46,7 @@ const arrayData = useArrayData($props.dataKey || $props.module, {
|
|||
skip: 0,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
const entity = computed(() =>Array.isArray( store.data) ? store.data[0] : store.data);
|
||||
const entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
|
||||
const isLoading = ref(false);
|
||||
|
||||
defineExpose({
|
||||
|
@ -55,14 +54,12 @@ defineExpose({
|
|||
});
|
||||
onBeforeMount(async () => {
|
||||
await getData();
|
||||
watch(
|
||||
() => $props.url,
|
||||
async () => await getData()
|
||||
);
|
||||
watch($props, async () => await getData());
|
||||
});
|
||||
|
||||
async function getData() {
|
||||
store.url = $props.url;
|
||||
store.filter = $props.filter ?? {};
|
||||
isLoading.value = true;
|
||||
try {
|
||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||
|
@ -117,7 +114,7 @@ const emit = defineEmits(['onFetch']);
|
|||
icon="more_vert"
|
||||
round
|
||||
size="md"
|
||||
:class="{ invisible: !slots.menu }"
|
||||
:class="{ invisible: !$slots.menu }"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
|
|
|
@ -15,7 +15,7 @@ const props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
entityId: {
|
||||
type: Number,
|
||||
type: [Number, String],
|
||||
default: null,
|
||||
},
|
||||
dataKey: {
|
||||
|
@ -32,7 +32,7 @@ const arrayData = useArrayData(props.dataKey || route.meta.moduleName, {
|
|||
skip: 0,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
const entity = computed(() => Array.isArray(store.data) ? store.data[0] : store.data);
|
||||
const entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
|
||||
const isLoading = ref(false);
|
||||
|
||||
defineExpose({
|
||||
|
@ -48,9 +48,10 @@ onBeforeMount(async () => {
|
|||
|
||||
async function fetch() {
|
||||
store.url = props.url;
|
||||
store.filter = props.filter ?? {};
|
||||
isLoading.value = true;
|
||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||
emit('onFetch', data);
|
||||
emit('onFetch', Array.isArray(data) ? data[0] : data);
|
||||
isLoading.value = false;
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -12,12 +12,23 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
viewCustomization: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
// El objetivo de asignar las clases de personalización desde el wrapper es no tener conflictos entre vistas que usen el mismo componente
|
||||
const viewCustomizationClasses = {
|
||||
workerCalendar: 'worker-calendar-customizations',
|
||||
};
|
||||
|
||||
const containerClasses = computed(() => {
|
||||
const classes = ['main-container-background'];
|
||||
if (viewCustomizationClasses[$props.viewCustomization])
|
||||
classes.push(viewCustomizationClasses[$props.viewCustomization]);
|
||||
if ($props.bordered) classes.push('--bordered');
|
||||
if ($props.transparentBackground) classes.push('transparent-background');
|
||||
else classes.push($q.dark.isActive ? '--dark' : '--light');
|
||||
|
@ -33,6 +44,47 @@ const containerClasses = computed(() => {
|
|||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
@import '../../css/quasar.variables.scss';
|
||||
|
||||
:root {
|
||||
// Cambia los colores del día actual del calendario por los de salix
|
||||
--calendar-border-current-dark: #84d0e2 2px solid;
|
||||
--calendar-border-current: #84d0e2 2px solid;
|
||||
--calendar-current-color-dark: #84d0e2;
|
||||
// Colores de fondo del calendario en dark mode
|
||||
--calendar-outside-background-dark: #222;
|
||||
--calendar-background-dark: #222;
|
||||
}
|
||||
|
||||
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
|
||||
.q-dark div .q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
|
||||
background-color: $primary !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
|
||||
background-color: $primary !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.q-calendar-month__head--weekday {
|
||||
// Transforma los nombres de los días de la semana a mayúsculas
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.transparent-background {
|
||||
--calendar-background-dark: transparent;
|
||||
--calendar-background: transparent;
|
||||
--calendar-outside-background-dark: transparent;
|
||||
}
|
||||
|
||||
.q-calendar__button {
|
||||
&:hover {
|
||||
background-color: var(--vn-accent-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.main-container-background {
|
||||
--calendar-current-background-dark: transparent;
|
||||
|
||||
|
@ -45,14 +97,64 @@ const containerClasses = computed(() => {
|
|||
}
|
||||
|
||||
&.--bordered {
|
||||
border: 1px solid black;
|
||||
border: 1px solid #222;
|
||||
}
|
||||
}
|
||||
|
||||
.transparent-background {
|
||||
--calendar-background-dark: transparent;
|
||||
--calendar-background: transparent;
|
||||
--calendar-outside-background-dark: transparent;
|
||||
.worker-calendar-customizations {
|
||||
.q-calendar__button {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
font-size: 13px;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--vn-accent-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.q-calendar-month__week--days > div:nth-child(6),
|
||||
.q-calendar-month__week--days > div:nth-child(7) {
|
||||
// Cambia el color de los días sábado y domingo
|
||||
color: #777777;
|
||||
}
|
||||
|
||||
.q-calendar-month__week--wrapper {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.q-calendar-month__workweek {
|
||||
height: 32px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.q-calendar__button--bordered {
|
||||
color: $info !important;
|
||||
}
|
||||
|
||||
.q-calendar-month__day--content {
|
||||
position: absolute;
|
||||
top: 1;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.q-outside .calendar-event {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.q-calendar-month__workweek,
|
||||
.q-calendar-month__head--workweek,
|
||||
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
|
||||
text-transform: capitalize;
|
||||
color: #777;
|
||||
font-weight: bold;
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-container {
|
||||
|
|
|
@ -131,13 +131,6 @@ async function search() {
|
|||
/>
|
||||
</template>
|
||||
<template #append>
|
||||
<QIcon
|
||||
v-if="searchText !== ''"
|
||||
name="close"
|
||||
@click="searchText = ''"
|
||||
class="cursor-pointer"
|
||||
/>
|
||||
|
||||
<QIcon
|
||||
v-if="props.info && $q.screen.gt.xs"
|
||||
name="info"
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
<script setup>
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const actions = ref(null);
|
||||
const data = ref(null);
|
||||
const opts = { subtree: true, childList: true, attributes: true };
|
||||
const hasContent = ref(false);
|
||||
|
||||
onMounted(() => {
|
||||
stateStore.toggleSubToolbar();
|
||||
actions.value = document.querySelector('#st-actions');
|
||||
data.value = document.querySelector('#st-data');
|
||||
|
||||
if (!actions.value && !data.value) return;
|
||||
|
||||
// Check if there's content to display
|
||||
const observer = new MutationObserver(
|
||||
() =>
|
||||
(hasContent.value =
|
||||
actions.value.childNodes.length + data.value.childNodes.length)
|
||||
);
|
||||
if (actions.value) observer.observe(actions.value, opts);
|
||||
if (data.value) observer.observe(data.value, opts);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
@ -14,7 +30,10 @@ onUnmounted(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QToolbar class="bg-vn-section-color justify-end sticky">
|
||||
<QToolbar
|
||||
class="justify-end sticky"
|
||||
v-show="hasContent || $slots['st-actions'] || $slots['st-data']"
|
||||
>
|
||||
<slot name="st-data">
|
||||
<div id="st-data"></div>
|
||||
</slot>
|
||||
|
|
|
@ -151,9 +151,10 @@ export function useArrayData(key, userOptions) {
|
|||
delete store.userParams[param];
|
||||
delete params[param];
|
||||
if (store.filter?.where) {
|
||||
delete store.filter.where[
|
||||
Object.keys(exprBuilder ? exprBuilder(param) : param)[0]
|
||||
];
|
||||
const key = Object.keys(
|
||||
exprBuilder && exprBuilder(param) ? exprBuilder(param) : param
|
||||
);
|
||||
if (key[0]) delete store.filter.where[key[0]];
|
||||
if (Object.keys(store.filter.where).length === 0) {
|
||||
delete store.filter.where;
|
||||
}
|
||||
|
|
|
@ -141,6 +141,19 @@ select:-webkit-autofill {
|
|||
background-color: var(--vn-section-color);
|
||||
}
|
||||
|
||||
.q-checkbox {
|
||||
& .q-checkbox__label {
|
||||
color: var(--vn-text-color);
|
||||
}
|
||||
& .q-checkbox__inner {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
}
|
||||
|
||||
.tr-header {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
|
||||
.q-chip,
|
||||
.q-notification__message,
|
||||
.q-notification__icon {
|
||||
|
@ -175,13 +188,6 @@ input::-webkit-inner-spin-button {
|
|||
-moz-appearance: none;
|
||||
}
|
||||
|
||||
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
|
||||
.q-dark div .q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
|
||||
background-color: $primary !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
|
||||
background-color: $primary !important;
|
||||
color: white !important;
|
||||
.q-scrollarea__content {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
|
|
@ -91,3 +91,42 @@ export function toDateTimeFormat(date, showSeconds = false) {
|
|||
second: showSeconds ? '2-digit' : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts seconds to a formatted string representing hours and minutes (hh:mm).
|
||||
* @param {number} seconds - The number of seconds to convert.
|
||||
* @param {boolean} includeHSuffix - Optional parameter indicating whether to include "h." after the hour.
|
||||
* @returns {string} A string representing the time in the format "hh:mm" with optional "h." suffix.
|
||||
*/
|
||||
export function secondsToHoursMinutes(seconds, includeHSuffix = true) {
|
||||
if (!seconds) return includeHSuffix ? '00:00 h.' : '00:00';
|
||||
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
const remainingMinutes = seconds % 3600;
|
||||
const minutes = Math.floor(remainingMinutes / 60);
|
||||
const formattedHours = hours < 10 ? '0' + hours : hours;
|
||||
const formattedMinutes = minutes < 10 ? '0' + minutes : minutes;
|
||||
|
||||
// Append "h." if includeHSuffix is true
|
||||
const suffix = includeHSuffix ? ' h.' : '';
|
||||
// Return formatted string
|
||||
return formattedHours + ':' + formattedMinutes + suffix;
|
||||
}
|
||||
|
||||
export function getTimeDifferenceWithToday(date) {
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
date = new Date(date);
|
||||
date.setHours(0, 0, 0, 0);
|
||||
|
||||
return today - date;
|
||||
}
|
||||
|
||||
export function isLower(date) {
|
||||
return getTimeDifferenceWithToday(date) > 0;
|
||||
}
|
||||
|
||||
export function isBigger(date) {
|
||||
return getTimeDifferenceWithToday(date) < 0;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ globals:
|
|||
reset: Reset
|
||||
close: Close
|
||||
cancel: Cancel
|
||||
clone: Clone
|
||||
confirm: Confirm
|
||||
assign: Assign
|
||||
back: Back
|
||||
|
@ -83,6 +84,7 @@ globals:
|
|||
selectFile: Select a file
|
||||
copyClipboard: Copy on clipboard
|
||||
salesPerson: SalesPerson
|
||||
send: Send
|
||||
code: Code
|
||||
pageTitles:
|
||||
summary: Summary
|
||||
|
@ -811,6 +813,7 @@ worker:
|
|||
pbx: Private Branch Exchange
|
||||
log: Log
|
||||
calendar: Calendar
|
||||
timeControl: Time control
|
||||
list:
|
||||
name: Name
|
||||
email: Email
|
||||
|
@ -1119,6 +1122,7 @@ item:
|
|||
tags: Tags
|
||||
create: Create
|
||||
buyRequest: Buy requests
|
||||
fixedPrice: Fixed prices
|
||||
wasteBreakdown: Waste breakdown
|
||||
itemCreate: New item
|
||||
descriptor:
|
||||
|
@ -1148,6 +1152,15 @@ item:
|
|||
stemMultiplier: Multiplier
|
||||
producer: Producer
|
||||
landed: Landed
|
||||
fixedPrice:
|
||||
itemId: Item ID
|
||||
groupingPrice: Grouping price
|
||||
packingPrice: Packing price
|
||||
hasMinPrice: Has min price
|
||||
minPrice: Min price
|
||||
started: Started
|
||||
ended: Ended
|
||||
warehouse: Warehouse
|
||||
create:
|
||||
name: Name
|
||||
tag: Tag
|
||||
|
@ -1166,8 +1179,57 @@ item:
|
|||
achieved: 'Achieved'
|
||||
concept: 'Concept'
|
||||
state: 'State'
|
||||
summary:
|
||||
basicData: 'Basic data'
|
||||
otherData: 'Other data'
|
||||
description: 'Description'
|
||||
tax: 'Tax'
|
||||
tags: 'Tags'
|
||||
botanical: 'Botanical'
|
||||
barcode: 'Barcode'
|
||||
name: 'Nombre'
|
||||
completeName: 'Nombre completo'
|
||||
family: 'Familia'
|
||||
size: 'Medida'
|
||||
origin: 'Origen'
|
||||
stems: 'Tallos'
|
||||
multiplier: 'Multiplicador'
|
||||
buyer: 'Comprador'
|
||||
doPhoto: 'Do photo'
|
||||
intrastatCode: 'Código intrastat'
|
||||
intrastat: 'Intrastat'
|
||||
ref: 'Referencia'
|
||||
relevance: 'Relevancia'
|
||||
weight: 'Peso (gramos)/tallo'
|
||||
units: 'Unidades/caja'
|
||||
expense: 'Gasto'
|
||||
generic: 'Genérico'
|
||||
recycledPlastic: 'Plástico reciclado'
|
||||
nonRecycledPlastic: 'Plástico no reciclado'
|
||||
minSalesQuantity: 'Cantidad mínima de venta'
|
||||
genus: 'Genus'
|
||||
specie: 'Specie'
|
||||
components:
|
||||
topbar: {}
|
||||
itemsFilterPanel:
|
||||
typeFk: Type
|
||||
tag: Tag
|
||||
value: Value
|
||||
# ItemFixedPriceFilter
|
||||
buyerFk: Buyer
|
||||
warehouseFk: Warehouse
|
||||
started: From
|
||||
ended: To
|
||||
mine: For me
|
||||
hasMinPrice: Minimum price
|
||||
# LatestBuysFilter
|
||||
salesPersonFk: Buyer
|
||||
supplierFk: Supplier
|
||||
from: From
|
||||
to: To
|
||||
active: Is active
|
||||
visible: Is visible
|
||||
floramondo: Is floramondo
|
||||
userPanel:
|
||||
copyToken: Token copied to clipboard
|
||||
settings: Settings
|
||||
|
|
|
@ -28,6 +28,7 @@ globals:
|
|||
reset: Restaurar
|
||||
close: Cerrar
|
||||
cancel: Cancelar
|
||||
clone: Clonar
|
||||
confirm: Confirmar
|
||||
assign: Asignar
|
||||
back: Volver
|
||||
|
@ -83,6 +84,7 @@ globals:
|
|||
selectFile: Seleccione un fichero
|
||||
copyClipboard: Copiar en portapapeles
|
||||
salesPerson: Comercial
|
||||
send: Enviar
|
||||
code: Código
|
||||
pageTitles:
|
||||
summary: Resumen
|
||||
|
@ -809,6 +811,7 @@ worker:
|
|||
pbx: Centralita
|
||||
log: Historial
|
||||
calendar: Calendario
|
||||
timeControl: Control de horario
|
||||
list:
|
||||
name: Nombre
|
||||
email: Email
|
||||
|
@ -1116,9 +1119,14 @@ item:
|
|||
list: Listado
|
||||
diary: Histórico
|
||||
tags: Etiquetas
|
||||
fixedPrice: Precios fijados
|
||||
buyRequest: Peticiones de compra
|
||||
wasteBreakdown: Deglose de mermas
|
||||
itemCreate: Nuevo artículo
|
||||
basicData: 'Datos básicos'
|
||||
tax: 'IVA'
|
||||
botanical: 'Botánico'
|
||||
barcode: 'Código de barras'
|
||||
descriptor:
|
||||
item: Artículo
|
||||
buyer: Comprador
|
||||
|
@ -1146,6 +1154,15 @@ item:
|
|||
stemMultiplier: Multiplicador
|
||||
producer: Productor
|
||||
landed: F. entrega
|
||||
fixedPrice:
|
||||
itemId: ID Artículo
|
||||
groupingPrice: Precio grouping
|
||||
packingPrice: Precio packing
|
||||
hasMinPrice: Tiene precio mínimo
|
||||
minPrice: Precio min
|
||||
started: Inicio
|
||||
ended: Fin
|
||||
warehouse: Almacén
|
||||
create:
|
||||
name: Nombre
|
||||
tag: Etiqueta
|
||||
|
@ -1153,6 +1170,36 @@ item:
|
|||
type: Tipo
|
||||
intrastat: Intrastat
|
||||
origin: Origen
|
||||
summary:
|
||||
basicData: 'Datos básicos'
|
||||
otherData: 'Otros datos'
|
||||
description: 'Descripción'
|
||||
tax: 'IVA'
|
||||
tags: 'Etiquetas'
|
||||
botanical: 'Botánico'
|
||||
barcode: 'Código de barras'
|
||||
name: 'Nombre'
|
||||
completeName: 'Nombre completo'
|
||||
family: 'Familia'
|
||||
size: 'Medida'
|
||||
origin: 'Origen'
|
||||
stems: 'Tallos'
|
||||
multiplier: 'Multiplicador'
|
||||
buyer: 'Comprador'
|
||||
doPhoto: 'Hacer foto'
|
||||
intrastatCode: 'Código intrastat'
|
||||
intrastat: 'Intrastat'
|
||||
ref: 'Referencia'
|
||||
relevance: 'Relevancia'
|
||||
weight: 'Peso (gramos)/tallo'
|
||||
units: 'Unidades/caja'
|
||||
expense: 'Gasto'
|
||||
generic: 'Genérico'
|
||||
recycledPlastic: 'Plástico reciclado'
|
||||
nonRecycledPlastic: 'Plástico no reciclado'
|
||||
minSalesQuantity: 'Cantidad mínima de venta'
|
||||
genus: 'Genus'
|
||||
specie: 'Specie'
|
||||
buyRequest:
|
||||
ticketId: 'ID Ticket'
|
||||
shipped: 'F. envío'
|
||||
|
@ -1166,6 +1213,25 @@ item:
|
|||
state: 'Estado'
|
||||
components:
|
||||
topbar: {}
|
||||
itemsFilterPanel:
|
||||
typeFk: Tipo
|
||||
tag: Etiqueta
|
||||
value: Valor
|
||||
# ItemFixedPriceFilter
|
||||
buyerFk: Comprador
|
||||
warehouseFk: Almacén
|
||||
started: Desde
|
||||
ended: Hasta
|
||||
mine: Para mi
|
||||
hasMinPrice: Precio mínimo
|
||||
# LatestBuysFilter
|
||||
salesPersonFk: Comprador
|
||||
supplierFk: Proveedor
|
||||
from: Desde
|
||||
to: Hasta
|
||||
active: Activo
|
||||
visible: Visible
|
||||
floramondo: Floramondo
|
||||
userPanel:
|
||||
copyToken: Token copiado al portapapeles
|
||||
settings: Configuración
|
||||
|
|
|
@ -1,46 +1,15 @@
|
|||
<script setup>
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import ClaimDescriptor from './ClaimDescriptor.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
data-key="ClaimList"
|
||||
url="Claims/filter"
|
||||
:label="t('Search claim')"
|
||||
:info="t('You can search by claim id or customer name')"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<ClaimDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="Claim"
|
||||
base-url="Claims"
|
||||
:descriptor="ClaimDescriptor"
|
||||
searchbar-data-key="ClaimList"
|
||||
searchbar-url="Claims/filter"
|
||||
searchbar-label="Search claim"
|
||||
searchbar-info="You can search by claim id or customer name"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search claim: Buscar reclamación
|
||||
You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente
|
||||
Details: Detalles
|
||||
Notes: Notas
|
||||
Action: Acción
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Search claim: Buscar reclamación
|
||||
You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente
|
|
@ -1,43 +1,15 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import CustomerDescriptor from './CustomerDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
data-key="CustomerList"
|
||||
url="Clients/filter"
|
||||
:label="t('Search customer')"
|
||||
:info="t('You can search by customer id or name')"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<CustomerDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="Client"
|
||||
base-url="Clients"
|
||||
:descriptor="CustomerDescriptor"
|
||||
searchbar-data-key="CustomerList"
|
||||
searchbar-url="Clients/filter"
|
||||
searchbar-label="Search customer"
|
||||
searchbar-info="You can search by customer id or name"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search customer: Buscar cliente
|
||||
You can search by customer id or name: Puedes buscar por id o nombre del cliente
|
||||
</i18n>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Search customer: Buscar cliente
|
||||
You can search by customer id or name: Puedes buscar por id o nombre del cliente
|
||||
customerFilter:
|
||||
filter:
|
||||
name: Nombre
|
||||
|
|
|
@ -1,26 +1,13 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import DepartmentDescriptor from 'pages/Department/Card/DepartmentDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<DepartmentDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
|
||||
<div class="q-pa-md column items-center">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
class="q-pa-md column items-center"
|
||||
v-bind="{ ...$attrs }"
|
||||
data-key="Department"
|
||||
base-url="Departments"
|
||||
:descriptor="DepartmentDescriptor"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -27,6 +27,7 @@ onMounted(async () => {
|
|||
|
||||
<template>
|
||||
<CardSummary
|
||||
data-key="DepartmentSummary"
|
||||
ref="summary"
|
||||
:url="`Departments/${entityId}`"
|
||||
class="full-width"
|
||||
|
|
|
@ -1,48 +1,15 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import EntryDescriptor from './EntryDescriptor.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="EntryList"
|
||||
url="Entries/filter"
|
||||
:label="t('Search entries')"
|
||||
:info="t('You can search by entry reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<EntryDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="Entry"
|
||||
base-url="Entries"
|
||||
:descriptor="EntryDescriptor"
|
||||
searchbar-data-key="EntryList"
|
||||
searchbar-url="Entries/filter"
|
||||
searchbar-label="Search entries"
|
||||
searchbar-info="You can search by entry reference"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search entries: Buscar entradas
|
||||
You can search by entry reference: Puedes buscar por referencia de la entrada
|
||||
</i18n>
|
||||
|
|
|
@ -650,7 +650,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QToolbar>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<EntryLatestBuysFilter data-key="EntryLatestBuys" :tags="tags" />
|
||||
<EntryLatestBuysFilter data-key="EntryLatestBuys" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
|
|
|
@ -1,141 +1,26 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
||||
defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const itemCategories = ref([]);
|
||||
const selectedCategoryFk = ref(null);
|
||||
const selectedTypeFk = ref(null);
|
||||
const itemTypesOptions = ref([]);
|
||||
const itemTypeWorkersOptions = ref([]);
|
||||
const suppliersOptions = ref([]);
|
||||
const tagOptions = ref([]);
|
||||
const tagValues = ref([]);
|
||||
|
||||
const categoryList = computed(() => {
|
||||
return (itemCategories.value || [])
|
||||
.filter((category) => category.display)
|
||||
.map((category) => ({
|
||||
...category,
|
||||
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
||||
}));
|
||||
});
|
||||
|
||||
const selectedCategory = computed(() =>
|
||||
(itemCategories.value || []).find(
|
||||
(category) => category?.id === selectedCategoryFk.value
|
||||
)
|
||||
);
|
||||
|
||||
const selectedType = computed(() => {
|
||||
return (itemTypesOptions.value || []).find(
|
||||
(type) => type?.id === selectedTypeFk.value
|
||||
);
|
||||
});
|
||||
|
||||
const selectCategory = async (params, categoryId, search) => {
|
||||
if (params.categoryFk === categoryId) {
|
||||
resetCategory(params);
|
||||
search();
|
||||
return;
|
||||
}
|
||||
selectedCategoryFk.value = categoryId;
|
||||
params.categoryFk = categoryId;
|
||||
await fetchItemTypes(categoryId);
|
||||
search();
|
||||
};
|
||||
|
||||
const resetCategory = (params) => {
|
||||
selectedCategoryFk.value = null;
|
||||
itemTypesOptions.value = null;
|
||||
if (params) {
|
||||
params.categoryFk = null;
|
||||
params.typeFk = null;
|
||||
}
|
||||
};
|
||||
|
||||
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 fetchItemTypes = async (id) => {
|
||||
try {
|
||||
const filter = {
|
||||
fields: ['id', 'name', 'categoryFk'],
|
||||
where: { categoryFk: id },
|
||||
include: 'category',
|
||||
order: 'name ASC',
|
||||
};
|
||||
const { data } = await axios.get('ItemTypes', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
itemTypesOptions.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching item types', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getCategoryClass = (category, params) => {
|
||||
if (category.id === params?.categoryFk) {
|
||||
return 'active';
|
||||
}
|
||||
};
|
||||
|
||||
const getSelectedTagValues = async (tag) => {
|
||||
try {
|
||||
tag.value = null;
|
||||
const filter = {
|
||||
fields: ['value'],
|
||||
order: 'value ASC',
|
||||
limit: 30,
|
||||
};
|
||||
|
||||
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 removeTag = (index, params, search) => {
|
||||
(tagValues.value || []).splice(index, 1);
|
||||
applyTags(params, search);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="ItemCategories"
|
||||
limit="30"
|
||||
auto-load
|
||||
@on-fetch="(data) => (itemCategories = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="TicketRequests/getItemTypeWorker"
|
||||
limit="30"
|
||||
|
@ -150,102 +35,12 @@ const removeTag = (index, params, search) => {
|
|||
:filter="{ fields: ['id', 'name', 'nickname'], order: 'name ASC', limit: 30 }"
|
||||
@on-fetch="(data) => (suppliersOptions = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Tags"
|
||||
:filter="{ fields: ['id', 'name', 'isFree'] }"
|
||||
auto-load
|
||||
limit="30"
|
||||
@on-fetch="(data) => (tagOptions = data)"
|
||||
/>
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:expr-builder="exprBuilder"
|
||||
:custom-tags="['tags']"
|
||||
@init="onFilterInit"
|
||||
@remove="clearFilter"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<strong v-if="tag.label === 'categoryFk'">
|
||||
{{ t(selectedCategory?.name || '') }}
|
||||
</strong>
|
||||
<strong v-else-if="tag.label === 'typeFk'">
|
||||
{{ t(selectedType?.name || '') }}
|
||||
</strong>
|
||||
<div v-else class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #customTags="{ tags: customTags, params }">
|
||||
<template v-for="tag in customTags" :key="tag.label">
|
||||
<VnFilterPanelChip
|
||||
v-for="chip in tag.value"
|
||||
:key="chip"
|
||||
removable
|
||||
@remove="removeTagChip(chip, params, searchFn)"
|
||||
>
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ chip.tagName }}: </strong>
|
||||
<span>"{{ chip.value }}"</span>
|
||||
</div>
|
||||
</VnFilterPanelChip>
|
||||
</template>
|
||||
</template>
|
||||
<ItemsFilterPanel :data-key="dataKey" :custom-tags="['tags']">
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem class="category-filter q-mt-md">
|
||||
<QBtn
|
||||
dense
|
||||
flat
|
||||
round
|
||||
v-for="category in categoryList"
|
||||
:key="category.name"
|
||||
:class="['category', getCategoryClass(category, params)]"
|
||||
:icon="category.icon"
|
||||
@click="selectCategory(params, category.id, searchFn)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t(category.name) }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QItem>
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.typeFk')"
|
||||
v-model="params.typeFk"
|
||||
:options="itemTypesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
use-input
|
||||
:disable="!selectedCategoryFk"
|
||||
@update:model-value="
|
||||
(value) => {
|
||||
selectedTypeFk = value;
|
||||
searchFn();
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.categoryName }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.salesPersonFk')"
|
||||
:label="t('components.itemsFilterPanel.salesPersonFk')"
|
||||
v-model="params.salesPersonFk"
|
||||
:options="itemTypeWorkersOptions"
|
||||
option-value="id"
|
||||
|
@ -261,7 +56,7 @@ const removeTag = (index, params, search) => {
|
|||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.supplier')"
|
||||
:label="t('components.itemsFilterPanel.supplierFk')"
|
||||
v-model="params.supplierFk"
|
||||
:options="suppliersOptions"
|
||||
option-value="id"
|
||||
|
@ -288,7 +83,7 @@ const removeTag = (index, params, search) => {
|
|||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.from')"
|
||||
:label="t('components.itemsFilterPanel.from')"
|
||||
v-model="params.from"
|
||||
is-outlined
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -298,7 +93,7 @@ const removeTag = (index, params, search) => {
|
|||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.to')"
|
||||
:label="t('components.itemsFilterPanel.to')"
|
||||
v-model="params.to"
|
||||
is-outlined
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -308,7 +103,7 @@ const removeTag = (index, params, search) => {
|
|||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.active')"
|
||||
:label="t('components.itemsFilterPanel.active')"
|
||||
v-model="params.active"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -316,7 +111,7 @@ const removeTag = (index, params, search) => {
|
|||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.visible')"
|
||||
:label="t('components.itemsFilterPanel.visible')"
|
||||
v-model="params.visible"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -326,149 +121,13 @@ const removeTag = (index, params, search) => {
|
|||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.floramondo')"
|
||||
:label="t('components.itemsFilterPanel.floramondo')"
|
||||
v-model="params.floramondo"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QItem
|
||||
v-for="(value, index) in tagValues"
|
||||
:key="value"
|
||||
class="q-mt-md filter-value"
|
||||
>
|
||||
<QItemSection class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('params.tag')"
|
||||
v-model="value.selectedTag"
|
||||
:options="tagOptions"
|
||||
option-label="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:emit-value="false"
|
||||
use-input
|
||||
:is-clearable="false"
|
||||
@update:model-value="getSelectedTagValues(value)"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection class="col">
|
||||
<VnSelectFilter
|
||||
v-if="!value?.selectedTag?.isFree && value.valueOptions"
|
||||
:label="t('params.value')"
|
||||
v-model="value.value"
|
||||
:options="value.valueOptions || []"
|
||||
option-value="value"
|
||||
option-label="value"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
emit-value
|
||||
use-input
|
||||
:disable="!value"
|
||||
:is-clearable="false"
|
||||
class="filter-input"
|
||||
@update:model-value="applyTags(params, searchFn)"
|
||||
/>
|
||||
<VnInput
|
||||
v-else
|
||||
v-model="value.value"
|
||||
:label="t('params.value')"
|
||||
:disable="!value"
|
||||
is-outlined
|
||||
class="filter-input"
|
||||
:is-clearable="false"
|
||||
@keyup.enter="applyTags(params, searchFn)"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QIcon
|
||||
name="delete"
|
||||
class="filter-icon"
|
||||
@click="removeTag(index, params, searchFn)"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem class="q-mt-lg">
|
||||
<QIcon
|
||||
name="add_circle"
|
||||
class="filter-icon"
|
||||
@click="tagValues.push({})"
|
||||
/>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</ItemsFilterPanel>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.category-filter {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
|
||||
.category {
|
||||
padding: 8px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
font-size: 1.4rem;
|
||||
background-color: var(--vn-accent-color);
|
||||
|
||||
&.active {
|
||||
background-color: $primary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-icon {
|
||||
font-size: 24px;
|
||||
color: $primary;
|
||||
padding: 0 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.filter-input {
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.filter-value {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
supplier: Supplier
|
||||
from: From
|
||||
to: To
|
||||
active: Is active
|
||||
visible: Is visible
|
||||
floramondo: Is floramondo
|
||||
salesPersonFk: Buyer
|
||||
categoryFk: Category
|
||||
typeFk: Type
|
||||
tag: Tag
|
||||
value: Value
|
||||
es:
|
||||
params:
|
||||
supplier: Proveedor
|
||||
from: Desde
|
||||
to: Hasta
|
||||
active: Activo
|
||||
visible: Visible
|
||||
floramondo: Floramondo
|
||||
salesPersonFk: Comprador
|
||||
categoryFk: Categoría
|
||||
typeFk: Tipo
|
||||
tag: Etiqueta
|
||||
value: Valor
|
||||
Plant: Planta
|
||||
Flower: Flor
|
||||
Handmade: Confección
|
||||
Green: Verde
|
||||
Accessories: Complemento
|
||||
Fruit: Fruta
|
||||
</i18n>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Search entries: Buscar entradas
|
||||
You can search by entry reference: Puedes buscar por referencia de la entrada
|
||||
entryList:
|
||||
list:
|
||||
inventoryEntry: Es inventario
|
||||
|
|
|
@ -1,18 +1,6 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { onMounted, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
|
@ -21,69 +9,25 @@ const filter = {
|
|||
scope: {
|
||||
include: {
|
||||
relation: 'contacts',
|
||||
scope: {
|
||||
where: {
|
||||
email: { neq: null },
|
||||
},
|
||||
},
|
||||
scope: { where: { email: { neq: null } } },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'invoiceInDueDay',
|
||||
},
|
||||
{
|
||||
relation: 'company',
|
||||
},
|
||||
{
|
||||
relation: 'currency',
|
||||
},
|
||||
{ relation: 'invoiceInDueDay' },
|
||||
{ relation: 'company' },
|
||||
{ relation: 'currency' },
|
||||
],
|
||||
};
|
||||
const arrayData = useArrayData('InvoiceIn', {
|
||||
url: `InvoiceIns/${route.params.id}`,
|
||||
filter,
|
||||
});
|
||||
|
||||
onMounted(async () => await arrayData.fetch({ append: false }));
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async (newId, oldId) => {
|
||||
if (newId) {
|
||||
arrayData.store.url = `InvoiceIns/${newId}`;
|
||||
await arrayData.fetch({ append: false });
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
data-key="InvoiceInList"
|
||||
url="InvoiceIns/filter"
|
||||
:label="t('Search invoice')"
|
||||
:info="t('You can search by invoice reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<InvoiceInDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="InvoiceIn"
|
||||
base-url="InvoiceIns"
|
||||
:filter="filter"
|
||||
:descriptor="InvoiceInDescriptor"
|
||||
searchbar-data-key="InvoiceInList"
|
||||
searchbar-url="InvoiceIns/filter"
|
||||
searchbar-label="Search invoice"
|
||||
searchbar-info="You can search by invoice reference"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search invoice: Buscar factura recibida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||
</i18n>
|
||||
|
|
|
@ -7,7 +7,6 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
||||
import VnCurrency from 'src/components/common/VnCurrency.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -70,19 +69,15 @@ const suppliersRef = ref();
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('From')"
|
||||
v-model="params.from"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate :label="t('From')" v-model="params.from" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -114,33 +109,33 @@ const suppliersRef = ref();
|
|||
</QItem>
|
||||
<QExpansionItem :label="t('More options')" expand-separator>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.fi')"
|
||||
v-model="params.fi"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.serialNumber')"
|
||||
v-model="params.serialNumber"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.fi')"
|
||||
v-model="params.fi"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.serialNumber')"
|
||||
v-model="params.serialNumber"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Search invoice: Buscar factura recibida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
|
@ -1,43 +1,15 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
data-key="InvoiceOutList"
|
||||
url="InvoiceOuts/filter"
|
||||
:label="t('Search invoice')"
|
||||
:info="t('You can search by invoice reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<InvoiceOutDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="InvoiceOut"
|
||||
base-url="InvoiceOuts"
|
||||
:descriptor="InvoiceOutDescriptor"
|
||||
searchbar-data-key="InvoiceOutList"
|
||||
searchbar-url="InvoiceOuts/filter"
|
||||
searchbar-label="Search invoice"
|
||||
searchbar-info="You can search by invoice reference"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search invoice: Buscar factura emitida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||
</i18n>
|
||||
|
|
|
@ -138,7 +138,7 @@ const ticketsColumns = ref([
|
|||
<VnTitle :text="t('invoiceOut.summary.taxBreakdown')" />
|
||||
<QTable :columns="taxColumns" :rows="invoiceOut.taxesBreakdown" flat>
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTr class="tr-header" :props="props">
|
||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
|
@ -149,6 +149,18 @@ const ticketsColumns = ref([
|
|||
<QCard class="vn-three">
|
||||
<VnTitle :text="t('invoiceOut.summary.tickets')" />
|
||||
<QTable v-if="tickets" :columns="ticketsColumns" :rows="tickets" flat>
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTh
|
||||
class="tr-header"
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body-cell-item="{ value }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
|
@ -159,7 +171,7 @@ const ticketsColumns = ref([
|
|||
</template>
|
||||
<template #body-cell-quantity="{ value, row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary" dense>
|
||||
<QBtn class="no-uppercase" flat color="primary" dense>
|
||||
{{ value }}
|
||||
<CustomerDescriptorProxy :id="row.id" />
|
||||
</QBtn>
|
||||
|
@ -170,3 +182,8 @@ const ticketsColumns = ref([
|
|||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.no-uppercase {
|
||||
text-transform: none;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -119,8 +119,8 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
label: t('invoiceOut.negativeBases.comercial'),
|
||||
field: 'workerSocialName',
|
||||
name: 'comercial',
|
||||
field: 'workerName',
|
||||
name: 'worker',
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
@ -181,9 +181,11 @@ const downloadCSV = async () => {
|
|||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-comercial="{ row }">
|
||||
<template #body-cell-worker="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat dense color="blue">{{ row.comercialName }}</QBtn>
|
||||
<QBtn class="no-uppercase" flat dense color="blue">{{
|
||||
row.workerName
|
||||
}}</QBtn>
|
||||
<WorkerDescriptorProxy :id="row.comercialId" />
|
||||
</QTd>
|
||||
</template>
|
||||
|
@ -211,6 +213,9 @@ const downloadCSV = async () => {
|
|||
border-radius: 4px;
|
||||
padding: 6px;
|
||||
}
|
||||
.no-uppercase {
|
||||
text-transform: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Search invoice: Buscar factura emitida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
|
@ -0,0 +1 @@
|
|||
<template>Item barcode</template>
|
|
@ -0,0 +1 @@
|
|||
<template>Item Botanical</template>
|
|
@ -1,28 +1,7 @@
|
|||
<script setup>
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import ItemDescriptor from './ItemDescriptor.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<ItemDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard data-key="Item" base-url="Items" :descriptor="ItemDescriptor" />
|
||||
</template>
|
||||
|
|
|
@ -9,7 +9,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
|
|||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
||||
import EditPictureForm from 'components/EditPictureForm.vue';
|
||||
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
||||
|
||||
import { useState } from 'src/composables/useState';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
|
@ -50,12 +50,10 @@ const entityId = computed(() => {
|
|||
});
|
||||
const image = ref(null);
|
||||
const regularizeStockFormDialog = ref(null);
|
||||
const editPhotoFormDialog = ref(null);
|
||||
const item = ref(null);
|
||||
const available = ref(null);
|
||||
const visible = ref(null);
|
||||
const _warehouseFk = ref(null);
|
||||
const warehouseText = ref(null);
|
||||
const salixUrl = ref();
|
||||
const warehouseFk = computed({
|
||||
get() {
|
||||
|
@ -63,14 +61,9 @@ const warehouseFk = computed({
|
|||
},
|
||||
set(val) {
|
||||
_warehouseFk.value = val;
|
||||
if (val) {
|
||||
updateStock();
|
||||
getWarehouseName(val);
|
||||
}
|
||||
if (val) updateStock();
|
||||
},
|
||||
});
|
||||
const showWarehouseIconTooltip = ref(true);
|
||||
const showEditPhotoForm = ref(false);
|
||||
|
||||
onMounted(async () => {
|
||||
await getItemAvatar();
|
||||
|
@ -90,26 +83,6 @@ const setData = (entity) => {
|
|||
data.value = useCardDescription(entity.name, entity.id);
|
||||
};
|
||||
|
||||
const getWarehouseName = async (warehouseFk) => {
|
||||
try {
|
||||
showWarehouseIconTooltip.value = false;
|
||||
|
||||
const filter = {
|
||||
where: { id: warehouseFk },
|
||||
};
|
||||
|
||||
const { data } = await axios.get('Warehouses/findOne', { filter });
|
||||
|
||||
warehouseText.value = t('item.descriptor.warehouseText', {
|
||||
warehouseName: data.name,
|
||||
});
|
||||
|
||||
showWarehouseIconTooltip.value = true;
|
||||
} catch (err) {
|
||||
console.error('Error finding warehouse');
|
||||
}
|
||||
};
|
||||
|
||||
const updateStock = async () => {
|
||||
try {
|
||||
available.value = null;
|
||||
|
@ -135,10 +108,6 @@ const openRegularizeStockForm = () => {
|
|||
regularizeStockFormDialog.value.show();
|
||||
};
|
||||
|
||||
const toggleEditPictureForm = () => {
|
||||
showEditPhotoForm.value = !showEditPhotoForm.value;
|
||||
};
|
||||
|
||||
const cloneItem = async () => {
|
||||
try {
|
||||
const { data } = await axios.post(`Items/${entityId.value}/clone`);
|
||||
|
@ -193,79 +162,16 @@ const openCloneDialog = async () => {
|
|||
</QItem>
|
||||
<QItem v-ripple clickable @click="openCloneDialog()">
|
||||
<QItemSection>
|
||||
{{ t('Clone') }}
|
||||
{{ t('globals.clone') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
<template #before>
|
||||
<div class="relative-position">
|
||||
<QImg :src="image" spinner-color="primary" class="photo">
|
||||
<template #error>
|
||||
<div
|
||||
class="absolute-full picture text-center q-pa-md flex flex-center"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="text-grey-5"
|
||||
style="opacity: 0.4; font-size: 5vh"
|
||||
>
|
||||
<QIcon name="vn:item" />
|
||||
</div>
|
||||
<div class="text-grey-5" style="opacity: 0.4">
|
||||
{{ t('item.descriptor.item') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</QImg>
|
||||
<QBtn
|
||||
color="primary"
|
||||
size="lg"
|
||||
round
|
||||
class="edit-photo-btn"
|
||||
@click="toggleEditPictureForm()"
|
||||
>
|
||||
<QIcon name="edit" size="sm" />
|
||||
<QDialog ref="editPhotoFormDialog" v-model="showEditPhotoForm">
|
||||
<EditPictureForm
|
||||
collection="catalog"
|
||||
:id="entityId"
|
||||
@close-form="toggleEditPictureForm()"
|
||||
@on-photo-uploaded="getItemAvatar()"
|
||||
/>
|
||||
</QDialog>
|
||||
</QBtn>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="row justify-between items-center full-width bg-primary"
|
||||
style="height: 54px"
|
||||
>
|
||||
<div class="col column items-center">
|
||||
<span class="text-uppercase color-vn-white" style="font-size: 11px">
|
||||
{{ t('item.descriptor.visible') }}
|
||||
</span>
|
||||
<span class="text-weight-bold text-h5 color-vn-white">{{
|
||||
visible
|
||||
}}</span>
|
||||
</div>
|
||||
<div
|
||||
class="col column items-center separation-borders"
|
||||
style="font-size: 11px"
|
||||
>
|
||||
<span class="text-uppercase color-vn-white">
|
||||
{{ t('item.descriptor.available') }}
|
||||
</span>
|
||||
<span class="text-weight-bold text-h5 color-vn-white">{{
|
||||
available
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="col column items-center justify-center">
|
||||
<QIcon name="info" class="cursor-pointer color-vn-white" size="md">
|
||||
<QTooltip>{{ warehouseText }}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</div>
|
||||
<ItemDescriptorImage
|
||||
:entity-id="entityId"
|
||||
:visible="visible"
|
||||
:available="available"
|
||||
/>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('item.descriptor.buyer')">
|
||||
|
@ -307,7 +213,6 @@ const openCloneDialog = async () => {
|
|||
<i18n>
|
||||
es:
|
||||
Regularize stock: Regularizar stock
|
||||
Clone: Clonar
|
||||
All it's properties will be copied: Todas sus propiedades serán copiadas
|
||||
Do you want to clone this item?: ¿Desea clonar este artículo?
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import EditPictureForm from 'components/EditPictureForm.vue';
|
||||
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import axios from 'axios';
|
||||
|
||||
const $props = defineProps({
|
||||
visible: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
available: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
entityId: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
showEditButton: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
|
||||
const image = ref(null);
|
||||
const editPhotoFormDialog = ref(null);
|
||||
const showEditPhotoForm = ref(false);
|
||||
const warehouseName = ref(null);
|
||||
|
||||
const getItemAvatar = async () => {
|
||||
const token = getTokenMultimedia();
|
||||
const timeStamp = `timestamp=${Date.now()}`;
|
||||
image.value = `/api/Images/catalog/200x200/${$props.entityId}/download?access_token=${token}&${timeStamp}`;
|
||||
};
|
||||
|
||||
const toggleEditPictureForm = () => {
|
||||
showEditPhotoForm.value = !showEditPhotoForm.value;
|
||||
};
|
||||
|
||||
const getItemConfigs = async () => {
|
||||
const { data } = await axios.get('ItemConfigs/findOne');
|
||||
if (!data) return;
|
||||
await getWarehouseName(data.warehouseFk);
|
||||
return data;
|
||||
};
|
||||
|
||||
const getWarehouseName = async (warehouseFk) => {
|
||||
const filter = {
|
||||
where: { id: warehouseFk },
|
||||
};
|
||||
|
||||
const { data } = await axios.get('Warehouses/findOne', { filter });
|
||||
if (!data) return;
|
||||
warehouseName.value = data.name;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
getItemAvatar();
|
||||
getItemConfigs();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative-position">
|
||||
<QImg :src="image" spinner-color="primary" style="min-height: 256px">
|
||||
<template #error>
|
||||
<div class="absolute-full picture text-center q-pa-md flex flex-center">
|
||||
<div>
|
||||
<div class="text-grey-5" style="opacity: 0.4; font-size: 5vh">
|
||||
<QIcon name="vn:item" />
|
||||
</div>
|
||||
<div class="text-grey-5" style="opacity: 0.4">
|
||||
{{ t('item.descriptor.item') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</QImg>
|
||||
<QBtn
|
||||
v-if="showEditButton"
|
||||
color="primary"
|
||||
size="lg"
|
||||
round
|
||||
class="edit-photo-btn"
|
||||
@click="toggleEditPictureForm()"
|
||||
>
|
||||
<QIcon name="edit" size="sm" />
|
||||
<QDialog ref="editPhotoFormDialog" v-model="showEditPhotoForm">
|
||||
<EditPictureForm
|
||||
collection="catalog"
|
||||
:id="entityId"
|
||||
@close-form="toggleEditPictureForm()"
|
||||
@on-photo-uploaded="getItemAvatar()"
|
||||
/>
|
||||
</QDialog>
|
||||
</QBtn>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="row justify-between items-center full-width bg-primary"
|
||||
style="height: 54px"
|
||||
>
|
||||
<div class="col column items-center">
|
||||
<span class="text-uppercase color-vn-white" style="font-size: 11px">
|
||||
{{ t('item.descriptor.visible') }}
|
||||
</span>
|
||||
<span class="text-weight-bold text-h5 color-vn-white">{{ visible }}</span>
|
||||
</div>
|
||||
<div class="col column items-center separation-borders" style="font-size: 11px">
|
||||
<span class="text-uppercase color-vn-white">
|
||||
{{ t('item.descriptor.available') }}
|
||||
</span>
|
||||
<span class="text-weight-bold text-h5 color-vn-white">{{ available }}</span>
|
||||
</div>
|
||||
<div class="col column items-center justify-center">
|
||||
<QIcon name="info" class="cursor-pointer color-vn-white" size="md">
|
||||
<QTooltip>{{
|
||||
t('warehouseText', {
|
||||
warehouseName: warehouseName,
|
||||
})
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Regularize stock: Regularizar stock
|
||||
All it's properties will be copied: Todas sus propiedades serán copiadas
|
||||
Do you want to clone this item?: ¿Desea clonar este artículo?
|
||||
warehouseText: Calculated on the warehouse of { warehouseName }
|
||||
|
||||
en:
|
||||
warehouseText: Calculado sobre el almacén de { warehouseName }
|
||||
</i18n>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.edit-photo-btn {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: 12px;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.separation-borders {
|
||||
border-left: 1px solid $white;
|
||||
border-right: 1px solid $white;
|
||||
}
|
||||
</style>
|
|
@ -1 +1,228 @@
|
|||
<template>Item summary</template>
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const roleState = useRole();
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
|
||||
const isBuyer = computed(() => {
|
||||
return roleState.hasAny(['buyer']);
|
||||
});
|
||||
|
||||
const isReplenisher = computed(() => {
|
||||
return roleState.hasAny(['replenisher']);
|
||||
});
|
||||
|
||||
const isAdministrative = computed(() => {
|
||||
return roleState.hasAny(['administrative']);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`Items/${entityId}/getSummary`"
|
||||
:entity-id="entityId"
|
||||
data-key="ItemSummary"
|
||||
>
|
||||
<template #header-left>
|
||||
<router-link
|
||||
v-if="route.name !== 'ItemSummary'"
|
||||
:to="{ name: 'ItemSummary', params: { id: entityId } }"
|
||||
class="header link"
|
||||
>
|
||||
<QIcon name="open_in_new" color="white" size="sm" />
|
||||
</router-link>
|
||||
</template>
|
||||
<template #header="{ entity: { item } }">
|
||||
{{ item.id }} - {{ item.name }}
|
||||
</template>
|
||||
<template #body="{ entity: { item, tags, visible, available, botanical } }">
|
||||
<QCard class="vn-one photo">
|
||||
<ItemDescriptorImage
|
||||
:entity-id="entityId"
|
||||
:visible="visible"
|
||||
:available="available"
|
||||
:show-edit-button="false"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<component
|
||||
:is="isBuyer ? 'router-link' : 'span'"
|
||||
:to="{ name: 'ItemBasicData', params: { id: entityId } }"
|
||||
class="header"
|
||||
:class="{ 'header-link': isBuyer }"
|
||||
>
|
||||
{{ t('item.summary.basicData') }}
|
||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
||||
</component>
|
||||
<VnLv :label="t('item.summary.name')" :value="item.name" />
|
||||
<VnLv :label="t('item.summary.completeName')" :value="item.longName" />
|
||||
<VnLv :label="t('item.summary.family')" :value="item.itemType.name" />
|
||||
<VnLv :label="t('item.summary.size')" :value="item.size" />
|
||||
<VnLv :label="t('item.summary.origin')" :value="item.origin.name" />
|
||||
<VnLv :label="t('item.summary.stems')" :value="item.stems" />
|
||||
<VnLv
|
||||
:label="t('item.summary.multiplier')"
|
||||
:value="item.stemMultiplier"
|
||||
/>
|
||||
|
||||
<VnLv :label="t('item.summary.buyer')">
|
||||
<template #value>
|
||||
<VnUserLink
|
||||
:name="item.itemType.worker.user.name"
|
||||
:worker-id="item.itemType.worker.id"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :info="t('Este artículo necesita una foto')">
|
||||
<template #value>
|
||||
<QCheckbox
|
||||
:label="t('item.summary.doPhoto')"
|
||||
v-model="item.isPhotoRequested"
|
||||
:disable="true"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<component
|
||||
:is="isBuyer ? 'router-link' : 'span'"
|
||||
:to="{ name: 'ItemBasicData', params: { id: entityId } }"
|
||||
class="header"
|
||||
:class="{ 'header-link': isBuyer }"
|
||||
>
|
||||
{{ t('item.summary.otherData') }}
|
||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
||||
</component>
|
||||
<VnLv
|
||||
:label="t('item.summary.intrastatCode')"
|
||||
:value="item.intrastat.id"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('item.summary.intrastat')"
|
||||
:value="item.intrastat.description"
|
||||
/>
|
||||
<VnLv :label="t('item.summary.ref')" :value="item.comment" />
|
||||
<VnLv :label="t('item.summary.relevance')" :value="item.relevancy" />
|
||||
<VnLv :label="t('item.summary.weight')" :value="item.weightByPiece" />
|
||||
<VnLv :label="t('item.summary.units')" :value="item.packingOut" />
|
||||
<VnLv :label="t('item.summary.expense')" :value="item.expense.name" />
|
||||
<VnLv :label="t('item.summary.generic')" :value="item.genericFk" />
|
||||
<VnLv
|
||||
:label="t('item.summary.recycledPlastic')"
|
||||
:value="item.recycledPlastic"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('item.summary.nonRecycledPlastic')"
|
||||
:value="item.nonRecycledPlastic"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('item.summary.minSalesQuantity')"
|
||||
:value="item.minQuantity"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<component
|
||||
:is="isBuyer || isReplenisher ? 'router-link' : 'span'"
|
||||
:to="{ name: 'ItemTags', params: { id: entityId } }"
|
||||
class="header"
|
||||
:class="{ 'header-link': isBuyer || isReplenisher }"
|
||||
>
|
||||
{{ t('item.summary.tags') }}
|
||||
<QIcon v-if="isBuyer || isReplenisher" name="open_in_new" />
|
||||
</component>
|
||||
<VnLv
|
||||
v-for="(tag, index) in tags"
|
||||
:key="index"
|
||||
:label="`${tag.priority} ${tag.tag.name}`"
|
||||
:value="tag.value"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one" v-if="item.description">
|
||||
<component
|
||||
:is="isBuyer ? 'router-link' : 'span'"
|
||||
:to="{ name: 'ItemBasicData', params: { id: entityId } }"
|
||||
class="header"
|
||||
:class="{ 'header-link': isBuyer }"
|
||||
>
|
||||
{{ t('item.summary.description') }}
|
||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
||||
</component>
|
||||
<p>
|
||||
{{ item.description }}
|
||||
</p>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<component
|
||||
:is="isBuyer || isAdministrative ? 'router-link' : 'span'"
|
||||
:to="{ name: 'ItemTax', params: { id: entityId } }"
|
||||
class="header"
|
||||
:class="{ 'header-link': isBuyer || isAdministrative }"
|
||||
>
|
||||
{{ t('item.summary.tax') }}
|
||||
<QIcon v-if="isBuyer || isAdministrative" name="open_in_new" />
|
||||
</component>
|
||||
<VnLv
|
||||
v-for="(tax, index) in item.taxes"
|
||||
:key="index"
|
||||
:label="tax.country.country"
|
||||
:value="tax.taxClass.description"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<component
|
||||
:is="isBuyer ? 'router-link' : 'span'"
|
||||
:to="{ name: 'ItemBotanical', params: { id: entityId } }"
|
||||
class="header"
|
||||
:class="{ 'header-link': isBuyer }"
|
||||
>
|
||||
{{ t('item.summary.botanical') }}
|
||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
||||
</component>
|
||||
<VnLv :label="t('item.summary.genus')" :value="botanical?.genus?.name" />
|
||||
<VnLv
|
||||
:label="t('item.summary.specie')"
|
||||
:value="botanical?.specie?.name"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<component
|
||||
:is="isBuyer || isReplenisher ? 'router-link' : 'span'"
|
||||
:to="{ name: 'ItemBarcode', params: { id: entityId } }"
|
||||
class="header"
|
||||
:class="{ 'header-link': isBuyer || isReplenisher }"
|
||||
>
|
||||
{{ t('item.summary.barcode') }}
|
||||
<QIcon v-if="isBuyer || isReplenisher" name="open_in_new" />
|
||||
</component>
|
||||
<p v-for="(barcode, index) in item.itemBarcode" :key="index">
|
||||
{{ barcode.code }}
|
||||
</p>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
Este artículo necesita una foto: Este artículo necesita una foto
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<template>Item tax</template>
|
|
@ -0,0 +1,605 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, reactive, computed, onUnmounted, watch } from 'vue';
|
||||
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 VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
|
||||
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
|
||||
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { isLower, isBigger } from 'src/filters/date.js';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const state = useState();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const editTableCellDialogRef = ref(null);
|
||||
const user = state.getUser();
|
||||
const fixedPrices = ref([]);
|
||||
const fixedPricesOriginalData = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const itemsWithNameOptions = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'name':
|
||||
return { 'i.name': { like: `%${value}%` } };
|
||||
case 'itemFk':
|
||||
case 'warehouseFk':
|
||||
case 'rate2':
|
||||
case 'rate3':
|
||||
param = `fp.${param}`;
|
||||
return { [param]: value };
|
||||
case 'minPrice':
|
||||
param = `i.${param}`;
|
||||
return { [param]: value };
|
||||
}
|
||||
};
|
||||
|
||||
const params = reactive({});
|
||||
const arrayData = useArrayData('ItemFixedPrices', {
|
||||
url: 'FixedPrices/filter',
|
||||
userParams: params,
|
||||
order: ['itemFk'],
|
||||
exprBuilder: exprBuilder,
|
||||
});
|
||||
const store = arrayData.store;
|
||||
|
||||
const fetchFixedPrices = async () => {
|
||||
await arrayData.fetch({ append: false });
|
||||
};
|
||||
|
||||
const onFixedPricesFetched = (data) => {
|
||||
fixedPrices.value = data;
|
||||
// el objetivo de guardar una copia de las rows es evitar guardar cambios si la data no cambió al disparar los eventos
|
||||
fixedPricesOriginalData.value = JSON.parse(JSON.stringify(data));
|
||||
};
|
||||
|
||||
watch(
|
||||
() => store.data,
|
||||
(data) => onFixedPricesFetched(data)
|
||||
);
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await arrayData.addFilter({ params });
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getColumnInputEvents = (col) => {
|
||||
return col.columnFilter.type === 'select'
|
||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
||||
: {
|
||||
'keyup.enter': () => applyColumnFilter(col),
|
||||
};
|
||||
};
|
||||
|
||||
const defaultColumnFilter = {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterValue: null,
|
||||
event: getColumnInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
};
|
||||
|
||||
const defaultColumnAttrs = {
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('item.fixedPrice.itemId'),
|
||||
name: 'itemId',
|
||||
field: 'itemFk',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: {
|
||||
...defaultColumnFilter,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('globals.description'),
|
||||
field: 'name',
|
||||
name: 'description',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: {
|
||||
...defaultColumnFilter,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.groupingPrice'),
|
||||
field: 'rate2',
|
||||
name: 'groupingPrice',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: {
|
||||
...defaultColumnFilter,
|
||||
},
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.packingPrice'),
|
||||
field: 'rate3',
|
||||
name: 'packingPrice',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: {
|
||||
...defaultColumnFilter,
|
||||
},
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
|
||||
{
|
||||
label: t('item.fixedPrice.minPrice'),
|
||||
field: 'minPrice',
|
||||
name: 'minPrice',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: {
|
||||
...defaultColumnFilter,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.started'),
|
||||
field: 'started',
|
||||
name: 'started',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.ended'),
|
||||
field: 'ended',
|
||||
name: 'ended',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: null,
|
||||
},
|
||||
|
||||
{
|
||||
label: t('item.fixedPrice.warehouse'),
|
||||
field: 'warehouseFk',
|
||||
name: 'warehouse',
|
||||
...defaultColumnAttrs,
|
||||
columnFilter: {
|
||||
component: VnSelectFilter,
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getColumnInputEvents,
|
||||
attrs: {
|
||||
options: warehousesOptions.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{ name: 'deleteAction', align: 'center' },
|
||||
]);
|
||||
|
||||
const editTableFieldsOptions = [
|
||||
{
|
||||
field: 'rate2',
|
||||
label: t('item.fixedPrice.groupingPrice'),
|
||||
component: 'input',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'rate3',
|
||||
label: t('item.fixedPrice.packingPrice'),
|
||||
component: 'input',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'minPrice',
|
||||
label: t('item.fixedPrice.minPrice'),
|
||||
component: 'input',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'hasMinPrice',
|
||||
label: t('item.fixedPrice.hasMinPrice'),
|
||||
component: 'checkbox',
|
||||
attrs: {
|
||||
'false-value': 0,
|
||||
'true-value': 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'started',
|
||||
label: t('item.fixedPrice.started'),
|
||||
component: 'date',
|
||||
},
|
||||
{
|
||||
field: 'ended',
|
||||
label: t('item.fixedPrice.ended'),
|
||||
component: 'date',
|
||||
},
|
||||
{
|
||||
field: 'warehouseFk',
|
||||
label: t('item.fixedPrice.warehouse'),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
options: [],
|
||||
'option-label': 'name',
|
||||
'option-value': 'id',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||
return inputType === 'text'
|
||||
? {
|
||||
'keyup.enter': () => upsertPrice(props, resetMinPrice),
|
||||
blur: () => upsertPrice(props, resetMinPrice),
|
||||
}
|
||||
: { 'update:modelValue': () => upsertPrice(props, resetMinPrice) };
|
||||
};
|
||||
|
||||
const validations = (row, rowIndex, col) => {
|
||||
const isNew = !row.id;
|
||||
// Si la row no tiene id significa que fue agregada con addRow y no se ha guardado en la base de datos
|
||||
// Si isNew es falso no se checkea si el valor es igual a la original
|
||||
if (!isNew)
|
||||
if (fixedPricesOriginalData.value[rowIndex][col.field] == row[col.field])
|
||||
return false;
|
||||
|
||||
const requiredFields = ['itemFk', 'started', 'ended', 'rate2', 'rate3'];
|
||||
return requiredFields.every(
|
||||
(field) => row[field] !== null && row[field] !== undefined
|
||||
);
|
||||
};
|
||||
|
||||
const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
||||
if (!validations(row, rowIndex, col)) return;
|
||||
|
||||
try {
|
||||
if (resetMinPrice) row.hasMinPrice = 0;
|
||||
|
||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||
row = data;
|
||||
fixedPricesOriginalData.value[rowIndex][col.field] = row[col.field];
|
||||
} catch (err) {
|
||||
console.error('Error editing price', err);
|
||||
}
|
||||
};
|
||||
|
||||
const addRow = () => {
|
||||
if (!fixedPrices.value || fixedPrices.value.length === 0) {
|
||||
fixedPrices.value = [];
|
||||
|
||||
const today = Date.vnNew();
|
||||
const millisecsInDay = 86400000;
|
||||
const daysInWeek = 7;
|
||||
const nextWeek = new Date(today.getTime() + daysInWeek * millisecsInDay);
|
||||
|
||||
const newPrice = {
|
||||
started: today,
|
||||
ended: nextWeek,
|
||||
hasMinPrice: 0,
|
||||
};
|
||||
|
||||
fixedPricesOriginalData.value.push({ ...newPrice });
|
||||
fixedPrices.value.push({ ...newPrice });
|
||||
return;
|
||||
}
|
||||
|
||||
const lastItemCopy = JSON.parse(
|
||||
JSON.stringify(fixedPrices.value[fixedPrices.value.length - 1])
|
||||
);
|
||||
const { id, ...restOfItem } = lastItemCopy;
|
||||
fixedPricesOriginalData.value.push(restOfItem);
|
||||
fixedPrices.value.push(restOfItem);
|
||||
};
|
||||
|
||||
const openEditTableCellDialog = () => {
|
||||
editTableCellDialogRef.value.show();
|
||||
};
|
||||
|
||||
const onEditCellDataSaved = async () => {
|
||||
rowsSelected.value = [];
|
||||
await fetchFixedPrices();
|
||||
};
|
||||
|
||||
const onWarehousesFetched = (data) => {
|
||||
warehousesOptions.value = data;
|
||||
// Actualiza las 'options' del elemento con field 'warehouseFk' en 'editTableFieldsOptions'.
|
||||
const warehouseField = editTableFieldsOptions.find(
|
||||
(field) => field.field === 'warehouseFk'
|
||||
);
|
||||
warehouseField.attrs.options = data;
|
||||
};
|
||||
|
||||
const removePrice = async (id, rowIndex) => {
|
||||
try {
|
||||
await axios.delete(`FixedPrices/${id}`);
|
||||
fixedPrices.value.splice(rowIndex, 1);
|
||||
fixedPricesOriginalData.value.splice(rowIndex, 1);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error removing price', err);
|
||||
}
|
||||
};
|
||||
|
||||
const updateMinPrice = async (value, props) => {
|
||||
// El checkbox hasMinPrice se encuentra en la misma columna que el input hasMinPrice
|
||||
// Por lo tanto le mandamos otro objeto con las mismas propiedades pero con el campo 'field' cambiado
|
||||
props.row.hasMinPrice = value;
|
||||
await upsertPrice({
|
||||
row: props.row,
|
||||
col: { field: 'hasMinPrice' },
|
||||
rowIndex: props.rowIndex,
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
params.warehouseFk = user.value.warehouseFk;
|
||||
await fetchFixedPrices();
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
:filter="{ order: ['name'] }"
|
||||
auto-load
|
||||
@on-fetch="(data) => onWarehousesFetched(data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Items/withName"
|
||||
:filter="{ fields: ['id', 'name'], order: 'id DESC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (itemsWithNameOptions = data)"
|
||||
/>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#actions-append">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<QBtn
|
||||
flat
|
||||
@click="stateStore.toggleRightDrawer()"
|
||||
round
|
||||
dense
|
||||
icon="menu"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.collapseMenu') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<ItemFixedPriceFilter
|
||||
data-key="ItemFixedPrices"
|
||||
:warehouses-options="warehousesOptions"
|
||||
/>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="fixedPrices"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
selection="multiple"
|
||||
v-model:selected="rowsSelected"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #top-row="{ cols }">
|
||||
<QTr>
|
||||
<QTd />
|
||||
<QTd
|
||||
v-for="(col, index) in cols"
|
||||
:key="index"
|
||||
style="max-width: 100px"
|
||||
>
|
||||
<component
|
||||
:is="col.columnFilter.component"
|
||||
v-if="col.columnFilter"
|
||||
v-model="col.columnFilter.filterValue"
|
||||
v-bind="col.columnFilter.attrs"
|
||||
v-on="col.columnFilter.event(col)"
|
||||
dense
|
||||
/>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
|
||||
<template #body-cell-itemId="props">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
:options="itemsWithNameOptions"
|
||||
hide-selected
|
||||
option-label="id"
|
||||
option-value="id"
|
||||
v-model="props.row.itemFk"
|
||||
v-on="getRowUpdateInputEvents(props, true, 'select')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
||||
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd class="col">
|
||||
<span class="link">
|
||||
{{ row.name }}
|
||||
</span>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
<fetched-tags :item="row" :max-length="6" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-groupingPrice="props">
|
||||
<QTd class="col">
|
||||
<VnInput
|
||||
v-model.number="props.row.rate2"
|
||||
v-on="getRowUpdateInputEvents(props)"
|
||||
>
|
||||
<template #append>€</template>
|
||||
</VnInput>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-packingPrice="props">
|
||||
<QTd class="col">
|
||||
<VnInput
|
||||
v-model.number="props.row.rate3"
|
||||
v-on="getRowUpdateInputEvents(props)"
|
||||
>
|
||||
<template #append>€</template>
|
||||
</VnInput>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-minPrice="props">
|
||||
<QTd class="col">
|
||||
<div class="row">
|
||||
<QCheckbox
|
||||
class="col"
|
||||
:model-value="props.row.hasMinPrice"
|
||||
@update:model-value="updateMinPrice($event, props)"
|
||||
:false-value="0"
|
||||
:true-value="1"
|
||||
:toggle-indeterminate="false"
|
||||
/>
|
||||
<VnInput
|
||||
class="col"
|
||||
:disable="!props.row.hasMinPrice"
|
||||
v-model.number="props.row.minPrice"
|
||||
v-on="getRowUpdateInputEvents(props)"
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-started="props">
|
||||
<QTd class="col" style="min-width: 160px">
|
||||
<VnInputDate
|
||||
v-model="props.row.started"
|
||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
||||
v-bind="
|
||||
isBigger(props.row.started)
|
||||
? { 'bg-color': 'warning', 'is-outlined': true }
|
||||
: {}
|
||||
"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-ended="props">
|
||||
<QTd class="col" style="min-width: 150px">
|
||||
<VnInputDate
|
||||
v-model="props.row.ended"
|
||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
||||
v-bind="
|
||||
isLower(props.row.ended)
|
||||
? { 'bg-color': 'warning', 'is-outlined': true }
|
||||
: {}
|
||||
"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-warehouse="props">
|
||||
<QTd class="col">
|
||||
<VnSelectFilter
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="props.row.warehouseFk"
|
||||
v-on="getRowUpdateInputEvents(props, false, 'select')"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-deleteAction="{ row, rowIndex }">
|
||||
<QTd class="col">
|
||||
<QIcon
|
||||
name="delete"
|
||||
size="sm"
|
||||
class="cursor-pointer fill-icon-on-hover"
|
||||
color="primary"
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('This row will be removed'),
|
||||
t('Do you want to clone this item?'),
|
||||
() => removePrice(row.id, rowIndex)
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('Delete') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #bottom-row>
|
||||
<QTd align="center">
|
||||
<QIcon
|
||||
@click.stop="addRow()"
|
||||
class="fill-icon-on-hover"
|
||||
color="primary"
|
||||
name="add_circle"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add fixed price') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<QPageSticky v-if="rowsSelected.length > 0" :offset="[20, 20]">
|
||||
<QBtn @click="openEditTableCellDialog()" color="primary" fab icon="edit" />
|
||||
<QTooltip>
|
||||
{{ t('Edit fixed price(s)') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
<QDialog ref="editTableCellDialogRef">
|
||||
<EditTableCellValueForm
|
||||
edit-url="FixedPrices/editFixedPrice"
|
||||
:rows="rowsSelected"
|
||||
:fields-options="editTableFieldsOptions"
|
||||
@on-data-saved="onEditCellDataSaved()"
|
||||
/>
|
||||
</QDialog>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Add fixed price: Añadir precio fijado
|
||||
Edit fixed price(s): Editar precio(s) fijado(s)
|
||||
This row will be removed: Esta linea se eliminará
|
||||
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
||||
Delete: Eliminar
|
||||
</i18n>
|
|
@ -0,0 +1,108 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
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 ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
warehousesOptions: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const itemTypeWorkersOptions = ref([]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="TicketRequests/getItemTypeWorker"
|
||||
limit="30"
|
||||
auto-load
|
||||
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC', limit: 30 }"
|
||||
@on-fetch="(data) => (itemTypeWorkersOptions = data)"
|
||||
/>
|
||||
<ItemsFilterPanel :data-key="dataKey" :custom-tags="['tags']">
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('components.itemsFilterPanel.buyerFk')"
|
||||
v-model="params.buyerFk"
|
||||
:options="itemTypeWorkersOptions"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
use-input
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('components.itemsFilterPanel.warehouseFk')"
|
||||
v-model="params.warehouseFk"
|
||||
:options="warehousesOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
use-input
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('components.itemsFilterPanel.started')"
|
||||
v-model="params.started"
|
||||
is-outlined
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-md">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('components.itemsFilterPanel.ended')"
|
||||
v-model="params.ended"
|
||||
is-outlined
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('components.itemsFilterPanel.mine')"
|
||||
v-model="params.mine"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('components.itemsFilterPanel.hasMinPrice')"
|
||||
v-model="params.hasMinPrice"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</ItemsFilterPanel>
|
||||
</template>
|
|
@ -538,7 +538,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Clone') }}
|
||||
{{ t('globals.clone') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
|
@ -572,6 +572,5 @@ es:
|
|||
New item: Nuevo artículo
|
||||
All it's properties will be copied: Todas sus propiedades serán copiadas
|
||||
Do you want to clone this item?: ¿Desea clonar este artículo?
|
||||
Clone: Clonar
|
||||
Preview: Vista previa
|
||||
</i18n>
|
||||
|
|
|
@ -1,23 +1,7 @@
|
|||
<script setup>
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<OrderDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<RouterView></RouterView>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard data-key="Order" base-url="Orders" :descriptor="OrderDescriptor" />
|
||||
</template>
|
||||
|
|
|
@ -4,7 +4,6 @@ import { useRoute } from 'vue-router';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
|
@ -28,7 +27,6 @@ const filter = {
|
|||
@on-fetch="(data) => (sectors = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnSubToolbar />
|
||||
<FormModel :url="`Parkings/${parkingId}`" model="parking" :filter="filter" auto-load>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
|
|
|
@ -1,57 +1,21 @@
|
|||
<script setup>
|
||||
import { onMounted, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import ParkingDescriptor from 'pages/Parking/Card/ParkingDescriptor.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const filter = {
|
||||
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
|
||||
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
|
||||
};
|
||||
|
||||
const arrayData = useArrayData('Parking', {
|
||||
url: `Parkings/${route.params.id}`,
|
||||
filter,
|
||||
});
|
||||
const { store } = arrayData;
|
||||
onMounted(async () => await arrayData.fetch({ append: false }));
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async (newId) => {
|
||||
if (newId) {
|
||||
store.url = `Parkings/${newId}`;
|
||||
store.filter = filter;
|
||||
await arrayData.fetch({ append: false });
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
:info="t('parking.searchBar.info')"
|
||||
:label="t('parking.searchBar.label')"
|
||||
data-key="Parking"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<ParkingDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<RouterView></RouterView>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="Parking"
|
||||
base-url="Parkings"
|
||||
:filter="filter"
|
||||
:descriptor="ParkingDescriptor"
|
||||
searchbar-data-key="ParkingList"
|
||||
searchbar-url="Parkings"
|
||||
searchbar-label="parking.searchBar.label"
|
||||
searchbar-info="parking.searchBar.info"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -11,9 +11,9 @@ const $props = defineProps({
|
|||
default: 0,
|
||||
},
|
||||
});
|
||||
const { params } = useRoute();
|
||||
const router = useRoute();
|
||||
const { t } = useI18n();
|
||||
const entityId = computed(() => $props.id || params.id);
|
||||
const entityId = computed(() => $props.id || router.params.id);
|
||||
|
||||
const filter = {
|
||||
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
|
||||
|
|
|
@ -1,22 +1,7 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import RouteDescriptor from 'pages/Route/Card/RouteDescriptor.vue';
|
||||
// import ShelvingDescriptor from 'pages/Shelving/Card/ShelvingDescriptor.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<RouteDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<RouterView></RouterView>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard data-key="Route" base-url="Routes" :descriptor="RouteDescriptor" />
|
||||
</template>
|
||||
|
|
|
@ -213,7 +213,7 @@ const openTicketsDialog = (id) => {
|
|||
<QCardActions align="right">
|
||||
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||
{{ t('Clone') }}
|
||||
{{ t('globals.clone') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
@ -510,7 +510,6 @@ es:
|
|||
Select the starting date: Seleccione la fecha de inicio
|
||||
Stating date: Fecha de inicio
|
||||
Cancel: Cancelar
|
||||
Clone: Clonar
|
||||
Mark as served: Marcar como servidas
|
||||
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
||||
Add ticket: Añadir tickets
|
||||
|
|
|
@ -176,7 +176,7 @@ function navigateToRoadmapSummary(event, row) {
|
|||
<QCardActions align="right">
|
||||
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
||||
<QBtn color="primary" v-close-popup @click="cloneSelection">
|
||||
{{ t('Clone') }}
|
||||
{{ t('globals.clone') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -251,7 +251,7 @@ const openSmsDialog = async () => {
|
|||
<QCardActions align="right">
|
||||
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||
{{ t('Clone') }}
|
||||
{{ t('globals.clone') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -1,21 +1,7 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import ShelvingDescriptor from 'pages/Shelving/Card/ShelvingDescriptor.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<ShelvingDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<RouterView></RouterView>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard data-key="Shelving" base-url="Shelvings" :descriptor="ShelvingDescriptor" />
|
||||
</template>
|
||||
|
|
|
@ -1,73 +1,14 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import SupplierDescriptor from './SupplierDescriptor.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="SuppliersList"
|
||||
url="Suppliers/filter"
|
||||
:limit="20"
|
||||
:label="t('Search suppliers')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<SupplierDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="Supplier"
|
||||
base-url="Suppliers"
|
||||
:descriptor="SupplierDescriptor"
|
||||
searchbar-data-key="SupplierList"
|
||||
searchbar-url="Suppliers/filter"
|
||||
searchbar-label="Search suppliers"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-scrollarea__content {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.descriptor {
|
||||
max-width: 256px;
|
||||
|
||||
h5 {
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.q-card__actions {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#descriptor-skeleton .q-card__actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search suppliers: Buscar proveedores
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Search suppliers: Buscar proveedores
|
|
@ -1,73 +1,15 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import TicketDescriptor from './TicketDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
data-key="TicketList"
|
||||
url="Tickets/filter"
|
||||
:label="t('Search ticket')"
|
||||
:info="t('You can search by ticket id or alias')"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<TicketDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="Ticket"
|
||||
base-url="Tickets"
|
||||
:descriptor="TicketDescriptor"
|
||||
searchbar-data-key="TicketList"
|
||||
searchbar-url="Tickets/filter"
|
||||
searchbar-label="Search ticket"
|
||||
searchbar-info="You can search by ticket id or alias"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-scrollarea__content {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.descriptor {
|
||||
max-width: 256px;
|
||||
|
||||
h5 {
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.q-card__actions {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#descriptor-skeleton .q-card__actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search ticket: Buscar ticket
|
||||
You can search by ticket id or alias: Puedes buscar por id o alias del ticket
|
||||
</i18n>
|
||||
|
|
|
@ -91,8 +91,8 @@ async function changeState(value) {
|
|||
>
|
||||
<template #header="{ entity }">
|
||||
<div>
|
||||
Ticket #{{ entity.id }} - {{ entity.client.name }} ({{
|
||||
entity.client.id
|
||||
Ticket #{{ entity.id }} - {{ entity.client?.name }} ({{
|
||||
entity.client?.id
|
||||
}}) -
|
||||
{{ entity.nickname }}
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Search ticket: Buscar ticket
|
||||
You can search by ticket id or alias: Puedes buscar por id o alias del ticket
|
|
@ -1,55 +1,7 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import TravelDescriptor from './TravelDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<TravelDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard data-key="Travel" base-url="Travels" :descriptor="TravelDescriptor" />
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-scrollarea__content {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.descriptor {
|
||||
max-width: 256px;
|
||||
|
||||
h5 {
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.q-card__actions {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#descriptor-skeleton .q-card__actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,32 +1,6 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useRoute } from 'vue-router';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard data-key="Wagon" base-url="Wagons" />
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search customer: Buscar cliente
|
||||
You can search by customer id or name: Puedes buscar por id o nombre del cliente
|
||||
</i18n>
|
||||
|
|
|
@ -178,6 +178,7 @@ watch(_year, (newValue) => {
|
|||
class="outline"
|
||||
bordered
|
||||
transparent-background
|
||||
view-customization="workerCalendar"
|
||||
>
|
||||
<template #header>
|
||||
<span class="full-width text-center text-body1 q-py-sm">{{
|
||||
|
@ -222,58 +223,6 @@ watch(_year, (newValue) => {
|
|||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
@import '../../../css/quasar.variables.scss';
|
||||
:root {
|
||||
// Cambia los colores del día actual del calendario por los de salix
|
||||
--calendar-border-current-dark: #84d0e2 2px solid;
|
||||
--calendar-border-current: #84d0e2 2px solid;
|
||||
--calendar-current-color-dark: #ec8916;
|
||||
}
|
||||
|
||||
.q-calendar__button {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
font-size: 13px;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--vn-accent-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.q-calendar-month__week--days > div:nth-child(6),
|
||||
.q-calendar-month__week--days > div:nth-child(7) {
|
||||
// Cambia el color de los días sábado y domingo
|
||||
color: #777777;
|
||||
}
|
||||
|
||||
.q-calendar-month__week--wrapper {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.q-calendar-month__workweek {
|
||||
height: 32px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.q-calendar__button--bordered {
|
||||
color: $info !important;
|
||||
}
|
||||
|
||||
.q-calendar-month__day--content {
|
||||
position: absolute;
|
||||
top: 1;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.q-outside .calendar-event {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.calendar-event {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
@ -296,15 +245,6 @@ watch(_year, (newValue) => {
|
|||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
.q-calendar-month__workweek,
|
||||
.q-calendar-month__head--workweek,
|
||||
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
|
||||
text-transform: capitalize;
|
||||
color: #777;
|
||||
font-weight: bold;
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -1,44 +1,18 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import WorkerDescriptor from './WorkerDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import useCardSize from 'src/composables/useCardSize';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const filter = { where: {} };
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
data-key="WorkerList"
|
||||
url="Workers/filter"
|
||||
:label="t('Search worker')"
|
||||
:info="t('You can search by worker id or name')"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<WorkerDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
|
||||
<div :class="useCardSize()">
|
||||
<RouterView></RouterView>
|
||||
</div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
<VnCard
|
||||
data-key="Worker"
|
||||
custom-url="Workers/Summary"
|
||||
:descriptor="WorkerDescriptor"
|
||||
:filter="filter"
|
||||
searchbar-data-key="WorkerList"
|
||||
searchbar-url="Workers/filter"
|
||||
searchbar-label="Search worker"
|
||||
searchbar-info="You can search by worker id or name"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search worker: Buscar trabajador
|
||||
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<script setup>
|
||||
defineProps({
|
||||
color: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
avatarClass: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
selected: {
|
||||
type: Boolean,
|
||||
default: undefined,
|
||||
},
|
||||
});
|
||||
defineEmits(['update:selected']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QChip
|
||||
class="text-white q-ma-none"
|
||||
:selected="selected"
|
||||
:style="{ backgroundColor: selected ? color : 'black' }"
|
||||
@update:selected="$emit('update:selected', $event)"
|
||||
>
|
||||
<QAvatar
|
||||
:color="color"
|
||||
:class="avatarClass"
|
||||
:style="{ backgroundColor: color }"
|
||||
/>
|
||||
<slot />
|
||||
</QChip>
|
||||
</template>
|
|
@ -31,7 +31,9 @@ const entityId = computed(() => {
|
|||
});
|
||||
|
||||
const worker = ref();
|
||||
const filter = { where: { id: entityId } };
|
||||
const filter = computed(() => {
|
||||
return { where: { id: entityId.value } };
|
||||
});
|
||||
|
||||
const sip = ref(null);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import CardSummary from 'components/ui/CardSummary.vue';
|
|||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||
|
||||
const { params } = useRoute();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -20,18 +20,25 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const entityId = computed(() => $props.id || params.id);
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const workerUrl = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
|
||||
});
|
||||
|
||||
const filter = { where: { id: entityId.value } };
|
||||
const filter = computed(() => {
|
||||
return { where: { id: entityId.value } };
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary ref="summary" :url="`Workers/summary`" :filter="filter">
|
||||
<CardSummary
|
||||
data-key="workerData"
|
||||
ref="summary"
|
||||
:url="`Workers/summary`"
|
||||
:filter="filter"
|
||||
>
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.id }} - {{ entity.firstName }} {{ entity.lastName }}</div>
|
||||
</template>
|
||||
|
@ -41,7 +48,7 @@ const filter = { where: { id: entityId.value } };
|
|||
:url="workerUrl + `basic-data`"
|
||||
:text="t('worker.summary.basicData')"
|
||||
/>
|
||||
<VnLv :label="t('worker.card.name')" :value="worker.user.nickname" />
|
||||
<VnLv :label="t('worker.card.name')" :value="worker.user?.nickname" />
|
||||
<VnLv
|
||||
:label="t('worker.list.department')"
|
||||
:value="worker.department?.department?.name"
|
||||
|
|
|
@ -0,0 +1,659 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue';
|
||||
import WorkerTimeForm from 'pages/Worker/Card/WorkerTimeForm.vue';
|
||||
import WorkerTimeReasonForm from 'pages/Worker/Card/WorkerTimeReasonForm.vue';
|
||||
import WorkerDateLabel from './WorkerDateLabel.vue';
|
||||
import WorkerTimeControlCalendar from 'pages/Worker/Card/WorkerTimeControlCalendar.vue';
|
||||
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toTimeFormat, secondsToHoursMinutes } from 'filters/date.js';
|
||||
import toDateString from 'filters/toDateString.js';
|
||||
import { date } from 'quasar';
|
||||
|
||||
const route = useRoute();
|
||||
const { t, locale } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const { hasAny } = useRole();
|
||||
const _state = useState();
|
||||
const user = _state.getUser();
|
||||
const stateStore = useStateStore();
|
||||
const weekdayStore = useWeekdayStore();
|
||||
const weekDays = ref([]);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { getWeekOfYear } = date;
|
||||
|
||||
const workerTimeFormDialogRef = ref(null);
|
||||
const workerTimeReasonFormDialogRef = ref(null);
|
||||
const workerHoursRef = ref(null);
|
||||
const selectedDate = ref(null);
|
||||
const startOfWeek = ref(null);
|
||||
const endOfWeek = ref(null);
|
||||
const selectedWeekNumber = ref(null);
|
||||
const state = ref(null);
|
||||
const reason = ref(null);
|
||||
const canResend = ref(null);
|
||||
const weekTotalHours = ref(null);
|
||||
const workerTimeControlMails = ref([]);
|
||||
const workerTimeFormProps = reactive({
|
||||
dated: null,
|
||||
entryId: null,
|
||||
entryCode: null,
|
||||
});
|
||||
|
||||
// Array utilizado por QCalendar para seleccionar un rango de fechas
|
||||
const selectedCalendarDates = ref([]);
|
||||
// Date formateada para bindear al componente QDate
|
||||
const selectedDateFormatted = ref(toDateString(Date.vnNew()));
|
||||
|
||||
const arrayData = useArrayData('workerData');
|
||||
|
||||
const worker = computed(() => arrayData.store?.data);
|
||||
|
||||
const isHr = computed(() => hasAny(['hr']));
|
||||
|
||||
const isHimSelf = computed(() => user.value.id === Number(route.params.id));
|
||||
|
||||
const columns = computed(() => {
|
||||
return weekdayStore.getLocales?.map((day, index) => {
|
||||
const obj = {
|
||||
label: day.locale,
|
||||
formattedDate: getHeaderFormattedDate(weekDays.value[index]?.dated),
|
||||
name: day.name,
|
||||
align: 'center',
|
||||
colIndex: index,
|
||||
dayData: weekDays.value[index],
|
||||
};
|
||||
return obj;
|
||||
});
|
||||
});
|
||||
|
||||
const getHeaderFormattedDate = (date) => {
|
||||
const newDate = new Date(date);
|
||||
const day = String(newDate.getDate()).padStart(2, '0');
|
||||
const monthName = newDate.toLocaleString(locale.value, { month: 'long' });
|
||||
return `${day} ${monthName}`;
|
||||
};
|
||||
|
||||
const formattedWeekTotalHours = computed(() =>
|
||||
secondsToHoursMinutes(weekTotalHours.value)
|
||||
);
|
||||
|
||||
const onInputChange = async (date) => {
|
||||
if (!date) return;
|
||||
|
||||
const { year, month, day } = date.scope.timestamp;
|
||||
const _date = new Date(year, month - 1, day);
|
||||
setDate(_date);
|
||||
};
|
||||
|
||||
const setDate = async (date) => {
|
||||
if (!date) return;
|
||||
selectedDate.value = date;
|
||||
selectedDate.value.setHours(0, 0, 0, 0);
|
||||
|
||||
const newStartOfWeek = getStartOfWeek(selectedDate.value); // Obtener el día de inicio de la semana a partir de la fecha seleccionada
|
||||
const newEndOfWeek = getEndOfWeek(newStartOfWeek); // Obtener el fin de la semana a partir de la fecha de inicio de la semana
|
||||
|
||||
startOfWeek.value = newStartOfWeek;
|
||||
endOfWeek.value = newEndOfWeek;
|
||||
selectedWeekNumber.value = getWeekOfYear(newStartOfWeek); // Asignar el número de la semana del año
|
||||
|
||||
getWeekDates(newStartOfWeek, newEndOfWeek);
|
||||
|
||||
await nextTick(); // Esperar actualización del DOM y luego fetchear data necesaria
|
||||
await fetchHours();
|
||||
await fetchWeekData();
|
||||
};
|
||||
|
||||
// Función para obtener el inicio de la semana a partir de una fecha
|
||||
const getStartOfWeek = (selectedDate) => {
|
||||
const dayOfWeek = selectedDate.getDay(); // Obtener el día de la semana de la fecha seleccionada
|
||||
const startOfWeek = new Date(selectedDate);
|
||||
startOfWeek.setDate(selectedDate.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1)); // Calcular el inicio de la semana
|
||||
return startOfWeek;
|
||||
};
|
||||
|
||||
// Función para obtener el fin de la semana a partir del inicio de la semana
|
||||
const getEndOfWeek = (startOfWeek) => {
|
||||
const endOfWeek = new Date(startOfWeek);
|
||||
endOfWeek.setHours(23, 59, 59, 59);
|
||||
endOfWeek.setDate(startOfWeek.getDate() + 6); // Calcular el fin de la semana sumando 6 días al inicio de la semana
|
||||
return endOfWeek;
|
||||
};
|
||||
|
||||
// Función para obtener las fechas de la semana seleccionada
|
||||
const getWeekDates = (startOfWeek, endOfWeek) => {
|
||||
selectedCalendarDates.value = [];
|
||||
weekDays.value = []; // Limpiar la información de las fechas seleccionadas previamente
|
||||
let currentDate = new Date(startOfWeek);
|
||||
|
||||
while (currentDate <= endOfWeek) {
|
||||
// Iterar sobre los días de la semana
|
||||
selectedCalendarDates.value.push(toDateString(currentDate)); // Agregar fecha formateada para el array de fechas bindeado al componente QCalendar
|
||||
weekDays.value.push({ dated: new Date(currentDate.getTime()) }); // Agregar el día de la semana al array información de días de la semana
|
||||
currentDate = new Date(currentDate.setDate(currentDate.getDate() + 1)); // Avanzar al siguiente día
|
||||
}
|
||||
};
|
||||
|
||||
const workerHoursFilter = computed(() => ({
|
||||
where: {
|
||||
and: [{ timed: { gte: startOfWeek.value } }, { timed: { lte: endOfWeek.value } }],
|
||||
},
|
||||
}));
|
||||
|
||||
const getWorkedHours = async (from, to) => {
|
||||
weekTotalHours.value = null;
|
||||
let _weekTotalHours = 0;
|
||||
let params = {
|
||||
from: from,
|
||||
id: route.params.id,
|
||||
to: to,
|
||||
};
|
||||
|
||||
const { data } = await axios.get(`Workers/${route.params.id}/getWorkedHours`, {
|
||||
params,
|
||||
});
|
||||
|
||||
const workDays = data;
|
||||
const map = new Map();
|
||||
|
||||
for (const workDay of workDays) {
|
||||
workDay.dated = new Date(workDay.dated);
|
||||
map.set(workDay.dated, workDay);
|
||||
_weekTotalHours += workDay.workedHours;
|
||||
}
|
||||
|
||||
for (const weekDay of weekDays.value) {
|
||||
const workDay = workDays.find((day) => {
|
||||
let from = new Date(day.dated);
|
||||
from.setHours(0, 0, 0, 0);
|
||||
|
||||
let to = new Date(day.dated);
|
||||
to.setHours(23, 59, 59, 59);
|
||||
|
||||
return weekDay.dated >= from && weekDay.dated <= to;
|
||||
});
|
||||
|
||||
if (workDay) {
|
||||
weekDay.expectedHours = workDay.expectedHours;
|
||||
weekDay.workedHours = workDay.workedHours;
|
||||
}
|
||||
}
|
||||
weekTotalHours.value = _weekTotalHours;
|
||||
};
|
||||
|
||||
const getAbsences = async () => {
|
||||
const params = {
|
||||
workerFk: route.params.id,
|
||||
businessFk: null,
|
||||
year: startOfWeek.value.getFullYear(),
|
||||
};
|
||||
|
||||
const { data } = await axios.get('Calendars/absences', { params });
|
||||
if (data) addEvents(data);
|
||||
};
|
||||
|
||||
const addEvents = (data) => {
|
||||
const events = {};
|
||||
|
||||
const addEvent = (day, event) => {
|
||||
events[new Date(day).getTime()] = event;
|
||||
};
|
||||
|
||||
if (data.holidays) {
|
||||
data.holidays.forEach((holiday) => {
|
||||
const holidayDetail = holiday.detail && holiday.detail.description;
|
||||
const holidayType = holiday.type && holiday.type.name;
|
||||
const holidayName = holidayDetail || holidayType;
|
||||
|
||||
addEvent(holiday.dated, {
|
||||
name: holidayName,
|
||||
color: '#ff0',
|
||||
});
|
||||
});
|
||||
}
|
||||
if (data.absences) {
|
||||
data.absences.forEach((absence) => {
|
||||
const type = absence.absenceType;
|
||||
addEvent(absence.dated, {
|
||||
name: type.name,
|
||||
color: type.rgb,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
weekDays.value.forEach((day) => {
|
||||
const timestamp = day.dated.getTime();
|
||||
if (events[timestamp]) day.event = events[timestamp];
|
||||
});
|
||||
};
|
||||
|
||||
const fetchHours = async () => {
|
||||
try {
|
||||
await workerHoursRef.value.fetch();
|
||||
await getWorkedHours(startOfWeek.value, endOfWeek.value);
|
||||
await getAbsences();
|
||||
} catch (err) {
|
||||
console.error('Error fetching worker hours');
|
||||
}
|
||||
};
|
||||
|
||||
const fetchWorkerTimeControlMails = async (filter) => {
|
||||
try {
|
||||
const { data } = await axios.get('WorkerTimeControlMails', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching worker time control mails');
|
||||
}
|
||||
};
|
||||
|
||||
const fetchWeekData = async () => {
|
||||
try {
|
||||
const filter = {
|
||||
where: {
|
||||
workerFk: route.params.id,
|
||||
year: selectedDate.value ? selectedDate.value?.getFullYear() : null,
|
||||
week: selectedWeekNumber.value,
|
||||
},
|
||||
};
|
||||
|
||||
const data = await fetchWorkerTimeControlMails(filter);
|
||||
if (!data.length) {
|
||||
state.value = null;
|
||||
} else {
|
||||
const [mail] = data;
|
||||
state.value = mail.state;
|
||||
reason.value = mail.reason;
|
||||
}
|
||||
|
||||
await canBeResend();
|
||||
} catch (err) {
|
||||
console.error('Error fetching week data');
|
||||
}
|
||||
};
|
||||
|
||||
const canBeResend = async () => {
|
||||
canResend.value = false;
|
||||
|
||||
const filter = {
|
||||
where: {
|
||||
year: selectedDate.value.getFullYear(),
|
||||
week: selectedWeekNumber.value,
|
||||
},
|
||||
limit: 1,
|
||||
};
|
||||
|
||||
const data = await fetchWorkerTimeControlMails(filter);
|
||||
if (data.length) canResend.value = true;
|
||||
};
|
||||
|
||||
const setHours = (data) => {
|
||||
for (const weekDay of weekDays.value) {
|
||||
if (data) {
|
||||
let day = weekDay.dated.getDay();
|
||||
weekDay.hours = data
|
||||
.filter((hour) => new Date(hour.timed).getDay() == day)
|
||||
.sort((a, b) => new Date(a.timed) - new Date(b.timed));
|
||||
} else weekDay.hours = null;
|
||||
}
|
||||
};
|
||||
|
||||
const getFinishTime = () => {
|
||||
if (!weekDays.value || weekDays.value.length === 0) return;
|
||||
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
let todayInWeek = weekDays.value.find(
|
||||
(day) => day.dated.getTime() === today.getTime()
|
||||
);
|
||||
|
||||
if (todayInWeek && todayInWeek.hours && todayInWeek.hours.length) {
|
||||
const remainingTime = todayInWeek.workedHours
|
||||
? (todayInWeek.expectedHours - todayInWeek.workedHours) * 1000
|
||||
: null;
|
||||
const lastKnownEntry = todayInWeek.hours[todayInWeek.hours.length - 1];
|
||||
const lastKnownTime = new Date(lastKnownEntry.timed).getTime();
|
||||
const finishTimeStamp =
|
||||
lastKnownTime && remainingTime ? lastKnownTime + remainingTime : null;
|
||||
|
||||
if (finishTimeStamp) return toTimeFormat(finishTimeStamp) + ' h.';
|
||||
}
|
||||
};
|
||||
|
||||
const updateData = async () => {
|
||||
await fetchHours();
|
||||
await getMailStates(selectedDate.value);
|
||||
};
|
||||
|
||||
const getMailStates = async (date) => {
|
||||
const params = {
|
||||
month: date.getMonth() + 1,
|
||||
year: date.getFullYear(),
|
||||
};
|
||||
|
||||
const { data } = await axios.get(
|
||||
`WorkerTimeControls/${route.params.id}/getMailStates`,
|
||||
{ params }
|
||||
);
|
||||
workerTimeControlMails.value = data;
|
||||
};
|
||||
|
||||
const showWorkerTimeForm = (propValue, formType) => {
|
||||
const isEditForm = formType === 'edit';
|
||||
|
||||
workerTimeFormProps.entryId = isEditForm ? propValue.id : null;
|
||||
workerTimeFormProps.entryCode = isEditForm ? propValue.entryCode : null;
|
||||
workerTimeFormProps.dated = isEditForm ? null : propValue;
|
||||
|
||||
workerTimeFormDialogRef.value.show();
|
||||
};
|
||||
|
||||
const showReasonForm = () => {
|
||||
workerTimeReasonFormDialogRef.value.show();
|
||||
};
|
||||
|
||||
const updateWorkerTimeControlMail = async (state, reason) => {
|
||||
try {
|
||||
const params = {
|
||||
workerId: Number(route.params.id),
|
||||
year: selectedDate.value.getFullYear(),
|
||||
week: selectedWeekNumber.value,
|
||||
state,
|
||||
};
|
||||
|
||||
if (reason) params.reason = reason;
|
||||
|
||||
await axios.post('WorkerTimeControls/updateWorkerTimeControlMail', params);
|
||||
await getMailStates(selectedDate.value);
|
||||
await fetchWeekData();
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error updating worker time control mail');
|
||||
}
|
||||
};
|
||||
|
||||
const isSatisfied = async () => {
|
||||
await updateWorkerTimeControlMail('CONFIRMED');
|
||||
};
|
||||
|
||||
const isUnsatisfied = async (reason) => {
|
||||
if (!reason) {
|
||||
notify(t('You must indicate a reason', 'negative'));
|
||||
return;
|
||||
}
|
||||
updateWorkerTimeControlMail('REVISE', reason);
|
||||
};
|
||||
|
||||
const resendEmail = async () => {
|
||||
try {
|
||||
const params = {
|
||||
recipient: worker.value?.user?.email,
|
||||
week: selectedWeekNumber.value,
|
||||
year: selectedDate.value.getFullYear(),
|
||||
workerId: Number(route.params.id),
|
||||
state: 'SENDED',
|
||||
};
|
||||
await axios.post('WorkerTimeControls/weekly-hour-hecord-email', params);
|
||||
await getMailStates(selectedDate.value);
|
||||
notify(t('Email sended'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error sending email');
|
||||
}
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
weekdayStore.initStore();
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await setDate(Date.vnNew());
|
||||
await getMailStates(selectedDate.value);
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="workerHoursRef"
|
||||
url="WorkerTimeControls/filter"
|
||||
:filter="workerHoursFilter"
|
||||
:params="{
|
||||
workerFk: route.params.id,
|
||||
}"
|
||||
@on-fetch="(data) => setHours(data)"
|
||||
/>
|
||||
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
|
||||
<div>
|
||||
<QBtnGroup push class="q-gutter-x-sm" flat>
|
||||
<QBtn
|
||||
v-if="isHimSelf && state"
|
||||
:label="t('Satisfied')"
|
||||
color="primary"
|
||||
type="submit"
|
||||
:disabled="state == 'CONFIRMED'"
|
||||
@click="isSatisfied()"
|
||||
/>
|
||||
<QBtn
|
||||
v-if="isHimSelf && state"
|
||||
:label="t('Not satisfied')"
|
||||
color="primary"
|
||||
type="submit"
|
||||
:disabled="state == 'REVISE'"
|
||||
@click="showReasonForm()"
|
||||
style="margin-left: 1px"
|
||||
/>
|
||||
</QBtnGroup>
|
||||
<QBtnGroup push class="q-gutter-x-sm" flat style="margin-left: 0px">
|
||||
<QBtn
|
||||
v-if="reason && state && (isHimSelf || isHr)"
|
||||
:label="t('Reason')"
|
||||
color="primary"
|
||||
type="submit"
|
||||
@click="showReasonForm()"
|
||||
/>
|
||||
<QBtn
|
||||
v-if="isHr && state !== 'CONFIRMED' && canResend"
|
||||
:label="state ? t('Resend') : t('globals.send')"
|
||||
color="primary"
|
||||
type="submit"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('Send time control email'),
|
||||
t('Are you sure you want to send it?'),
|
||||
resendEmail
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ state ? t('Resend') : t('globals.send') }}
|
||||
{{ t('email of this week to the user') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QBtnGroup>
|
||||
</div>
|
||||
</Teleport>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#actions-append">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<QBtn
|
||||
flat
|
||||
@click="stateStore.toggleRightDrawer()"
|
||||
round
|
||||
dense
|
||||
icon="menu"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.collapseMenu') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="260" class="q-pa-md">
|
||||
<div class="q-pa-md q-mb-md" style="border: 2px solid #222">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('Hours') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<div>
|
||||
<span class="details-label">{{ t('Total semana') }} </span>
|
||||
<span>: {{ formattedWeekTotalHours }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="details-label">{{ t('Termina a las') }}: </span>
|
||||
<span>{{ dashIfEmpty(getFinishTime()) }}</span>
|
||||
</div>
|
||||
</QCardSection>
|
||||
</div>
|
||||
<WorkerTimeControlCalendar
|
||||
v-model:model-value="selectedDateFormatted"
|
||||
:selected-dates="selectedCalendarDates"
|
||||
:active-date="false"
|
||||
:worker-time-control-mails="workerTimeControlMails"
|
||||
@click-date="onInputChange"
|
||||
@on-moved="getMailStates"
|
||||
/>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center">
|
||||
<QTable :columns="columns" :rows="['']" hide-bottom class="full-width">
|
||||
<template #header="props">
|
||||
<QTr :props="props" no-hover>
|
||||
<QTh
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
auto-width
|
||||
style="vertical-align: top"
|
||||
>
|
||||
<div class="column-title-container">
|
||||
<span class="text-primary">{{ t(col.label) }}</span>
|
||||
<span class="q-mb-xs">{{ col.formattedDate }}</span>
|
||||
<WorkerDateLabel
|
||||
v-if="col.dayData?.event"
|
||||
:color="col.dayData.event.color"
|
||||
>
|
||||
<span>
|
||||
{{ col.dayData.event.name }}
|
||||
</span>
|
||||
</WorkerDateLabel>
|
||||
</div>
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body="props">
|
||||
<QTr no-hover>
|
||||
<QTd
|
||||
v-for="(day, index) in props.cols"
|
||||
:key="index"
|
||||
style="padding: 20px 16px !important"
|
||||
>
|
||||
<div class="full-height full-width column items-center">
|
||||
<WorkerTimeHourChip
|
||||
v-for="(hour, ind) in day.dayData?.hours"
|
||||
:key="ind"
|
||||
:hour="hour.timed"
|
||||
:manual="hour.manual"
|
||||
:direction="hour.direction"
|
||||
:id="hour.id"
|
||||
@on-hour-entry-deleted="updateData()"
|
||||
@show-worker-time-form="
|
||||
showWorkerTimeForm(
|
||||
{ id: hour.id, entryCode: hour.direction },
|
||||
'edit'
|
||||
)
|
||||
"
|
||||
class="hour-chip"
|
||||
/>
|
||||
</div>
|
||||
</QTd>
|
||||
</QTr>
|
||||
<QTr no-hover>
|
||||
<QTd v-for="(day, index) in props.cols" :key="index">
|
||||
<div class="column items-center justify-center">
|
||||
<span class="q-mb-md text-sm text-body1">
|
||||
{{ secondsToHoursMinutes(day.dayData?.workedHours) }}
|
||||
</span>
|
||||
<QIcon
|
||||
name="add_circle"
|
||||
color="primary"
|
||||
class="fill-icon cursor-pointer"
|
||||
size="sm"
|
||||
@click="showWorkerTimeForm(day.dayData?.dated, 'create')"
|
||||
>
|
||||
<QTooltip>{{ t('Add time') }}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
<QDialog ref="workerTimeFormDialogRef">
|
||||
<WorkerTimeForm v-bind="workerTimeFormProps" @on-data-saved="updateData()" />
|
||||
</QDialog>
|
||||
<QDialog ref="workerTimeReasonFormDialogRef">
|
||||
<WorkerTimeReasonForm
|
||||
@on-submit="isUnsatisfied($event)"
|
||||
:reason="reason"
|
||||
:is-him-self="isHimSelf"
|
||||
/>
|
||||
</QDialog>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.column-title-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.details-label {
|
||||
color: var(--vn-label);
|
||||
}
|
||||
|
||||
.hour-chip {
|
||||
margin-bottom: 16px;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Hours: Horas
|
||||
Total semana: Total semana
|
||||
Termina a las: Termina a las
|
||||
Add time: Añadir hora
|
||||
Reason: Motivo
|
||||
Not satisfied: No conforme
|
||||
Satisfied: Conforme
|
||||
Resend: Reenviar
|
||||
email of this week to the user: email de esta semana al usuario
|
||||
Email sended: Email enviado
|
||||
Send time control email: Enviar email control horario
|
||||
Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
|
||||
You must indicate a reason: Debes indicar un motivo
|
||||
</i18n>
|
|
@ -0,0 +1,171 @@
|
|||
<script setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
|
||||
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
selectedDates: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
showNavigation: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
activeDate: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
workerTimeControlMails: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'clickDate', 'onMoved']);
|
||||
|
||||
const { locale } = useI18n();
|
||||
|
||||
const calendarRef = ref(null);
|
||||
|
||||
const stateClasses = {
|
||||
CONFIRMED: {
|
||||
className: 'confirmed',
|
||||
title: 'Conforme',
|
||||
},
|
||||
REVISE: {
|
||||
className: 'revise',
|
||||
title: 'No conforme',
|
||||
},
|
||||
SENDED: {
|
||||
className: 'sended',
|
||||
title: 'Pendiente',
|
||||
},
|
||||
};
|
||||
|
||||
const value = computed({
|
||||
get: () => $props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val),
|
||||
});
|
||||
|
||||
const formattedNavigationLabel = computed(() => {
|
||||
const [year, month, day] = $props.modelValue.split('-');
|
||||
const date = new Date(year, month - 1, day);
|
||||
const _month = date.toLocaleString(locale.value, { month: 'long' });
|
||||
return `${_month.charAt(0).toUpperCase() + _month.slice(1)} ${year}`;
|
||||
});
|
||||
|
||||
const workerTimeControlMailsMap = computed(() => {
|
||||
if (!$props.workerTimeControlMails || !$props.workerTimeControlMails.length)
|
||||
return new Map();
|
||||
|
||||
const map = new Map();
|
||||
$props.workerTimeControlMails.forEach((mail) => map.set(mail.week, mail.state));
|
||||
return map;
|
||||
});
|
||||
|
||||
const onPrev = () => {
|
||||
calendarRef.value.prev();
|
||||
};
|
||||
|
||||
const onNext = () => {
|
||||
calendarRef.value.next();
|
||||
};
|
||||
|
||||
const clickDate = (ev) => {
|
||||
emit('clickDate', ev);
|
||||
};
|
||||
|
||||
const onMoved = (ev) => {
|
||||
emit('onMoved', new Date(ev.year, ev.month - 1, ev.day));
|
||||
};
|
||||
|
||||
const workWeeksElements = ref([]);
|
||||
|
||||
watch(
|
||||
() => $props.workerTimeControlMails,
|
||||
() => {
|
||||
getWorkWeekElements();
|
||||
paintWorkWeeks();
|
||||
}
|
||||
);
|
||||
|
||||
const getWorkWeekElements = () => {
|
||||
workWeeksElements.value = document.getElementsByClassName(
|
||||
'q-calendar-month__workweek'
|
||||
);
|
||||
};
|
||||
|
||||
const paintWorkWeeks = async () => {
|
||||
for (var i = 0; i < workWeeksElements.value.length; i++) {
|
||||
const element = workWeeksElements.value[i];
|
||||
const week = Number(element.innerHTML);
|
||||
const weekState = workerTimeControlMailsMap.value.get(week);
|
||||
const { className, title } = stateClasses[weekState] || {};
|
||||
|
||||
element.classList.remove('confirmed', 'revise', 'sended');
|
||||
|
||||
if (className) {
|
||||
element.classList.add(className);
|
||||
element.setAttribute('title', title);
|
||||
} else {
|
||||
element.removeAttribute('title');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QCalendarMonthWrapper>
|
||||
<template #header>
|
||||
<div class="row items-center full-width">
|
||||
<QIcon name="arrow_back_ios" class="nav-arrow col" @click="onPrev" />
|
||||
<span class="col-6 text-no-wrap text-center text-subtitle1">{{
|
||||
formattedNavigationLabel
|
||||
}}</span>
|
||||
<QIcon name="arrow_forward_ios" class="nav-arrow col" @click="onNext" />
|
||||
</div>
|
||||
</template>
|
||||
<template #calendar>
|
||||
<QCalendarMonth
|
||||
ref="calendarRef"
|
||||
v-model="value"
|
||||
show-work-weeks
|
||||
:weekdays="[1, 2, 3, 4, 5, 6, 0]"
|
||||
:selected-dates="selectedDates"
|
||||
:locale="locale"
|
||||
mini-mode
|
||||
enable-outside-days
|
||||
class="q-py-sm"
|
||||
no-active-date
|
||||
@click-date="clickDate"
|
||||
@moved="onMoved"
|
||||
/>
|
||||
</template>
|
||||
</QCalendarMonthWrapper>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.confirmed {
|
||||
color: #97b92f;
|
||||
}
|
||||
|
||||
.revise {
|
||||
color: #f61e1e;
|
||||
}
|
||||
|
||||
.sended {
|
||||
color: #d19b25;
|
||||
}
|
||||
|
||||
.nav-arrow {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,109 @@
|
|||
<script setup>
|
||||
import { reactive, ref, computed, onBeforeMount } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
entryId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
entryCode: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
dated: {
|
||||
type: Date,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
let workerHourEntry = reactive({});
|
||||
|
||||
const entryDirections = [
|
||||
{ code: 'in', description: t('Entrada') },
|
||||
{ code: 'middle', description: t('Intermedio') },
|
||||
{ code: 'out', description: t('Salida') },
|
||||
];
|
||||
|
||||
const closeButton = ref(null);
|
||||
|
||||
const onDataSaved = () => {
|
||||
emit('onDataSaved');
|
||||
closeForm();
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
};
|
||||
|
||||
const isEditMode = computed(() => !!$props.entryId);
|
||||
|
||||
const title = computed(() => (isEditMode.value ? t('Edit entry') : t('Add time')));
|
||||
|
||||
const urlCreate = computed(() =>
|
||||
isEditMode.value
|
||||
? `WorkerTimeControls/${$props.entryId}/updateTimeEntry`
|
||||
: `WorkerTimeControls/${route.params.id}/addTimeEntry`
|
||||
);
|
||||
|
||||
onBeforeMount(() => {
|
||||
workerHourEntry = isEditMode.value
|
||||
? { direction: $props.entryCode }
|
||||
: {
|
||||
timed: new Date($props.dated),
|
||||
workerFk: route.params.id,
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModelPopup
|
||||
:form-initial-data="workerHourEntry"
|
||||
:observe-form-changes="false"
|
||||
:default-actions="false"
|
||||
:title="title"
|
||||
:url-create="urlCreate"
|
||||
@on-data-saved="onDataSaved()"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnInputTime
|
||||
v-if="!isEditMode"
|
||||
:label="t('Hour')"
|
||||
v-model="data.timed"
|
||||
autofocus
|
||||
:required="true"
|
||||
:is-clearable="false"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
:label="t('Type')"
|
||||
v-model="data.direction"
|
||||
:options="entryDirections"
|
||||
option-value="code"
|
||||
option-label="description"
|
||||
hide-selected
|
||||
:required="true"
|
||||
/>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Add time: Añadir hora
|
||||
Edit entry: Editar entrada
|
||||
Hour: Hora
|
||||
Type: Tipo
|
||||
Entrada: Entrada
|
||||
Intermedio: Intermedio
|
||||
Salida: Salida
|
||||
</i18n>
|
|
@ -0,0 +1,143 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { computed } from 'vue';
|
||||
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { toTimeFormat } from 'filters/date.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
manual: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
hour: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
direction: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onHourEntryDeleted', 'showWorkerTimeForm']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
const directionIconTooltip = computed(() => {
|
||||
const tooltipDictionary = {
|
||||
in: t('Entrada'),
|
||||
out: t('Salida'),
|
||||
};
|
||||
return tooltipDictionary[$props.direction] || null;
|
||||
});
|
||||
|
||||
const directionIconName = computed(() => {
|
||||
const tooltipDictionary = {
|
||||
in: 'arrow_forward',
|
||||
out: 'arrow_back',
|
||||
};
|
||||
return tooltipDictionary[$props.direction] || null;
|
||||
});
|
||||
|
||||
const deleteHourEntry = async () => {
|
||||
try {
|
||||
const { data } = await axios.post(
|
||||
`WorkerTimeControls/${$props.id}/deleteTimeEntry`
|
||||
);
|
||||
|
||||
if (!data) return;
|
||||
emit('onHourEntryDeleted');
|
||||
notify('Entry removed', 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting hour entry');
|
||||
}
|
||||
};
|
||||
|
||||
const showWorkerTimeForm = () => emit('showWorkerTimeForm');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="row items-center no-wrap">
|
||||
<QIcon class="direction-icon" :name="directionIconName" size="sm">
|
||||
<QTooltip>{{ directionIconTooltip }}</QTooltip>
|
||||
</QIcon>
|
||||
<QBadge
|
||||
rounded
|
||||
class="chip"
|
||||
:class="{ '--manual': manual }"
|
||||
@click="showWorkerTimeForm()"
|
||||
>
|
||||
<QIcon name="edit" size="sm" class="fill-icon">
|
||||
<QTooltip>{{ t('Edit') }}</QTooltip></QIcon
|
||||
>
|
||||
<span class="q-px-sm text-subtitle2 text-weight-regular">{{
|
||||
toTimeFormat(hour)
|
||||
}}</span>
|
||||
<QIcon
|
||||
v-if="manual"
|
||||
name="cancel"
|
||||
class="remove-icon"
|
||||
size="sm"
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('This time entry will be deleted'),
|
||||
t('Are you sure you want to delete this entry?'),
|
||||
deleteHourEntry
|
||||
)
|
||||
"
|
||||
/>
|
||||
</QBadge>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.chip {
|
||||
height: 28px;
|
||||
cursor: pointer;
|
||||
opacity: 0.8;
|
||||
color: #eee;
|
||||
background-color: #222;
|
||||
|
||||
&.--manual {
|
||||
color: var(--vn-accent-color);
|
||||
background-color: $primary;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.direction-icon {
|
||||
color: var(--vn-label-color);
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.remove-icon {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
font-variation-settings: 'FILL' 1;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Entrada: Entrada
|
||||
Salida: Salida
|
||||
Edit: Editar
|
||||
This time entry will be deleted: Se eliminará la hora fichada
|
||||
Are you sure you want to delete this entry?: ¿Seguro que quieres eliminarla?
|
||||
Entry removed: Fichada borrada
|
||||
</i18n>
|
|
@ -0,0 +1,52 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FormPopup from 'components/FormPopup.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
reason: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
isHimSelf: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onSubmit']);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const closeButton = ref(null);
|
||||
const reasonFormData = ref($props.reason);
|
||||
|
||||
const onSubmit = () => {
|
||||
emit('onSubmit', reasonFormData.value);
|
||||
closeForm();
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormPopup @on-submit="onSubmit()">
|
||||
<template #form-inputs>
|
||||
<QInput
|
||||
:label="t('Reason')"
|
||||
v-model="reasonFormData"
|
||||
type="textarea"
|
||||
autogrow
|
||||
:disable="!isHimSelf"
|
||||
/>
|
||||
</template>
|
||||
</FormPopup>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Reason: Motivo
|
||||
</i18n>
|
|
@ -0,0 +1,2 @@
|
|||
Search worker: Buscar trabajador
|
||||
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
|
|
@ -10,8 +10,15 @@ export default {
|
|||
component: RouterView,
|
||||
redirect: { name: 'ItemMain' },
|
||||
menus: {
|
||||
main: ['ItemList', 'WasteBreakdown', 'ItemRequest'],
|
||||
card: ['ItemBasicData'],
|
||||
main: ['ItemList', 'WasteBreakdown', 'ItemFixedPrice', 'ItemRequest'],
|
||||
card: [
|
||||
'ItemBasicData',
|
||||
'ItemDiary',
|
||||
'ItemTags',
|
||||
'ItemTax',
|
||||
'ItemBotanical',
|
||||
'ItemBarcode',
|
||||
],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
@ -29,6 +36,15 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Item/ItemList.vue'),
|
||||
},
|
||||
{
|
||||
path: 'fixed-price',
|
||||
name: 'ItemFixedPrice',
|
||||
meta: {
|
||||
title: 'fixedPrice',
|
||||
icon: 'vn:fixedPrice',
|
||||
},
|
||||
component: () => import('src/pages/Item/ItemFixedPrice.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'ItemCreate',
|
||||
|
@ -76,24 +92,6 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Item/Card/ItemSummary.vue'),
|
||||
},
|
||||
{
|
||||
path: 'diary',
|
||||
name: 'ItemDiary',
|
||||
meta: {
|
||||
title: 'diary',
|
||||
icon: 'vn:transaction',
|
||||
},
|
||||
component: () => import('src/pages/Item/Card/ItemDiary.vue'),
|
||||
},
|
||||
{
|
||||
path: 'tags',
|
||||
name: 'ItemTags',
|
||||
meta: {
|
||||
title: 'Tags',
|
||||
icon: 'vn:tags',
|
||||
},
|
||||
component: () => import('src/pages/Item/Card/ItemTags.vue'),
|
||||
},
|
||||
{
|
||||
path: 'basic-data',
|
||||
name: 'ItemBasicData',
|
||||
|
@ -103,6 +101,52 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Item/Card/ItemBasicData.vue'),
|
||||
},
|
||||
|
||||
{
|
||||
path: 'tags',
|
||||
name: 'ItemTags',
|
||||
meta: {
|
||||
title: 'tags',
|
||||
icon: 'vn:tags',
|
||||
},
|
||||
component: () => import('src/pages/Item/Card/ItemTags.vue'),
|
||||
},
|
||||
{
|
||||
path: 'tax',
|
||||
name: 'ItemTax',
|
||||
meta: {
|
||||
title: 'tax',
|
||||
icon: 'vn:tax',
|
||||
},
|
||||
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',
|
||||
meta: {
|
||||
title: 'barcode',
|
||||
icon: 'vn:barcode',
|
||||
},
|
||||
component: () => import('src/pages/Item/Card/ItemBarcode.vue'),
|
||||
},
|
||||
{
|
||||
path: 'diary',
|
||||
name: 'ItemDiary',
|
||||
meta: {
|
||||
title: 'diary',
|
||||
icon: 'vn:transaction',
|
||||
},
|
||||
component: () => import('src/pages/Item/Card/ItemDiary.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -21,6 +21,7 @@ export default {
|
|||
'WorkerLog',
|
||||
'WorkerCalendar',
|
||||
'WorkerDms',
|
||||
'WorkerTimeControl',
|
||||
],
|
||||
departmentCard: ['BasicData'],
|
||||
},
|
||||
|
@ -156,6 +157,16 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Worker/Card/WorkerCalendar.vue'),
|
||||
},
|
||||
{
|
||||
name: 'WorkerTimeControl',
|
||||
path: 'time-control',
|
||||
meta: {
|
||||
title: 'timeControl',
|
||||
icon: 'access_time',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
@ -60,11 +60,13 @@ export const useWeekdayStore = defineStore('weekdayStore', () => {
|
|||
// El día de mañana esto permitirá ordenar los weekdays en base a el locale si se lo desea reemplazando localeOrder.es por localeOrder[locale]
|
||||
const locales = [];
|
||||
for (let code of localeOrder.es) {
|
||||
const weekDay = weekdaysMap[code];
|
||||
const locale = t(`weekdays.${weekdaysMap[code].code}`);
|
||||
const obj = {
|
||||
...weekdaysMap[code],
|
||||
locale: t(`weekdays.${weekdaysMap[code].code}`),
|
||||
localeChar: t(`weekdays.${weekdaysMap[code].code}`).substr(0, 1),
|
||||
localeAbr: t(`weekdays.${weekdaysMap[code].code}`).substr(0, 3),
|
||||
...weekDay,
|
||||
locale,
|
||||
localeChar: locale.substr(0, 1),
|
||||
localeAbr: locale.substr(0, 3),
|
||||
};
|
||||
locales.push(obj);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue