Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7283-itemMigration
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
477984076b
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { watch, computed, ref, nextTick } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { date } from 'quasar';
|
||||
|
||||
|
@ -14,13 +14,13 @@ const props = defineProps({
|
|||
default: false,
|
||||
},
|
||||
});
|
||||
const initialDate = ref(model.value);
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||
|
||||
const dateFormat = 'HH:mm';
|
||||
const isPopupOpen = ref();
|
||||
const hover = ref();
|
||||
const inputRef = ref();
|
||||
|
||||
const styleAttrs = computed(() => {
|
||||
return props.isOutlined
|
||||
|
@ -50,7 +50,8 @@ const formattedTime = computed({
|
|||
}
|
||||
if (!props.timeOnly) {
|
||||
const [hh, mm] = time.split(':');
|
||||
const date = new Date(model.value ? model.value : null);
|
||||
|
||||
const date = new Date(model.value ? model.value : initialDate.value);
|
||||
date.setHours(hh, mm, 0);
|
||||
time = date?.toISOString();
|
||||
}
|
||||
|
@ -62,37 +63,10 @@ const formattedTime = computed({
|
|||
function dateToTime(newDate) {
|
||||
return date.formatDate(new Date(newDate), dateFormat);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => model.value,
|
||||
(val) => (formattedTime.value = val),
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => formattedTime.value,
|
||||
async (val) => {
|
||||
let position = 3;
|
||||
const input = inputRef.value?.getNativeElement();
|
||||
if (!val || !input) return;
|
||||
|
||||
let [hh, mm] = val.split(':');
|
||||
hh = parseInt(hh);
|
||||
if (hh >= 10 || mm != '00') return;
|
||||
|
||||
await nextTick();
|
||||
await nextTick();
|
||||
if (!hh) position = 0;
|
||||
input.setSelectionRange(position, position);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
ref="inputRef"
|
||||
class="vn-input-time"
|
||||
mask="##:##"
|
||||
placeholder="--:--"
|
||||
|
@ -102,7 +76,7 @@ watch(
|
|||
style="min-width: 100px"
|
||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||
@click="isPopupOpen = false"
|
||||
@focus="inputRef.getNativeElement().setSelectionRange(0, 0)"
|
||||
type="time"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
|
@ -149,6 +123,11 @@ watch(
|
|||
border-style: solid;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
:deep(input[type='time']::-webkit-calendar-picker-indicator) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Open time: Abrir tiempo
|
||||
|
|
|
@ -73,6 +73,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
params: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -153,9 +157,14 @@ async function fetchFilter(val) {
|
|||
? optionValue.value
|
||||
: optionFilter.value ?? optionLabel.value);
|
||||
|
||||
const defaultWhere = $props.useLike
|
||||
? { [key]: { like: `%${val}%` } }
|
||||
: { [key]: val };
|
||||
let defaultWhere = {};
|
||||
if ($props.filterOptions.length) {
|
||||
defaultWhere = $props.filterOptions.reduce((obj, prop) => {
|
||||
if (!obj.or) obj.or = [];
|
||||
obj.or.push({ [prop]: getVal(val) });
|
||||
return obj;
|
||||
}, {});
|
||||
} else defaultWhere = { [key]: getVal(val) };
|
||||
const where = { ...(val ? defaultWhere : {}), ...$props.where };
|
||||
const fetchOptions = { where, include, limit };
|
||||
if (fields) fetchOptions.fields = fields;
|
||||
|
@ -194,6 +203,8 @@ async function filterHandler(val, update) {
|
|||
function nullishToTrue(value) {
|
||||
return value ?? true;
|
||||
}
|
||||
|
||||
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -205,6 +216,7 @@ function nullishToTrue(value) {
|
|||
:limit="limit"
|
||||
:sort-by="sortBy"
|
||||
:fields="fields"
|
||||
:params="params"
|
||||
/>
|
||||
<QSelect
|
||||
v-model="value"
|
||||
|
|
|
@ -202,7 +202,7 @@ function formatValue(value) {
|
|||
|
||||
function sanitizer(params) {
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
if (typeof value == 'object') {
|
||||
if (value && typeof value === 'object') {
|
||||
const param = Object.values(value)[0];
|
||||
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ async function search() {
|
|||
<QForm @submit="search" id="searchbarForm">
|
||||
<VnInput
|
||||
id="searchbar"
|
||||
v-model="searchText"
|
||||
v-model.trim="searchText"
|
||||
:placeholder="t(props.label)"
|
||||
dense
|
||||
standout
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { watch, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { date } from 'quasar';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import VnAvatar from '../ui/VnAvatar.vue';
|
||||
|
|
|
@ -103,10 +103,6 @@ select:-webkit-autofill {
|
|||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.card-width {
|
||||
width: 770px;
|
||||
}
|
||||
|
||||
.vn-card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
|
@ -268,3 +264,10 @@ input::-webkit-inner-spin-button {
|
|||
max-width: 400px;
|
||||
}
|
||||
}
|
||||
.edit-photo-btn {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: 12px;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
@ -255,6 +255,7 @@ globals:
|
|||
twoFactor: Two factor
|
||||
recoverPassword: Recover password
|
||||
resetPassword: Reset password
|
||||
serial: Serial
|
||||
created: Created
|
||||
worker: Worker
|
||||
now: Now
|
||||
|
@ -690,6 +691,7 @@ invoiceOut:
|
|||
chooseValidClient: Choose a valid client
|
||||
chooseValidCompany: Choose a valid company
|
||||
chooseValidPrinter: Choose a valid printer
|
||||
chooseValidSerialType: Choose a serial type
|
||||
fillDates: Invoice date and the max date should be filled
|
||||
invoiceDateLessThanMaxDate: Invoice date can not be less than max date
|
||||
invoiceWithFutureDate: Exists an invoice with a future date
|
||||
|
|
|
@ -257,6 +257,7 @@ globals:
|
|||
twoFactor: Doble factor
|
||||
recoverPassword: Recuperar contraseña
|
||||
resetPassword: Restablecer contraseña
|
||||
serial: Facturas por serie
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
now: Ahora
|
||||
|
@ -696,6 +697,7 @@ invoiceOut:
|
|||
chooseValidClient: Selecciona un cliente válido
|
||||
chooseValidCompany: Selecciona una empresa válida
|
||||
chooseValidPrinter: Selecciona una impresora válida
|
||||
chooseValidSerialType: Selecciona una tipo de serie válida
|
||||
fillDates: La fecha de la factura y la fecha máxima deben estar completas
|
||||
invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima
|
||||
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||
|
|
|
@ -6,7 +6,6 @@ import axios from 'axios';
|
|||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
|
@ -24,7 +23,6 @@ const stateStore = useStateStore();
|
|||
const quasar = useQuasar();
|
||||
|
||||
const tableRef = ref();
|
||||
const rolesOptions = ref([]);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
|
|
|
@ -72,7 +72,7 @@ const hasAccount = ref(false);
|
|||
</VnImg>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('account.card.nickname')" :value="entity.nickname" />
|
||||
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
||||
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
const quasar = useQuasar();
|
||||
const $props = defineProps({
|
||||
hasAccount: {
|
||||
type: Boolean,
|
||||
|
@ -35,7 +32,7 @@ async function updateStatusAccount(active) {
|
|||
|
||||
account.value.hasAccount = active;
|
||||
const status = active ? 'enable' : 'disable';
|
||||
quasar.notify({
|
||||
notify({
|
||||
message: t(`account.card.${status}Account.success`),
|
||||
type: 'positive',
|
||||
});
|
||||
|
@ -44,19 +41,11 @@ async function updateStatusUser(active) {
|
|||
await axios.patch(`VnUsers/${entityId.value}`, { active });
|
||||
account.value.active = active;
|
||||
const status = active ? 'activate' : 'deactivate';
|
||||
quasar.notify({
|
||||
notify({
|
||||
message: t(`account.card.actions.${status}User.success`),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
function setPassword() {
|
||||
quasar.dialog({
|
||||
component: CustomerChangePassword,
|
||||
componentProps: {
|
||||
id: entityId.value,
|
||||
},
|
||||
});
|
||||
}
|
||||
const showSyncDialog = ref(false);
|
||||
const syncPassword = ref(null);
|
||||
const shouldSyncPassword = ref(false);
|
||||
|
@ -66,20 +55,11 @@ async function sync() {
|
|||
await axios.patch(`Accounts/${account.value.name}/sync`, {
|
||||
params,
|
||||
});
|
||||
quasar.notify({
|
||||
notify({
|
||||
message: t('account.card.actions.sync.success'),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
|
||||
const removeAccount = async () => {
|
||||
try {
|
||||
await axios.delete(`VnUsers/${account.value.id}`);
|
||||
notify(t('Account removed'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error deleting user', error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<VnConfirm
|
||||
|
@ -112,24 +92,6 @@ const removeAccount = async () => {
|
|||
/>
|
||||
</template>
|
||||
</VnConfirm>
|
||||
<!-- <QItem v-ripple clickable @click="setPassword">
|
||||
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="!account.hasAccount"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('account.card.actions.enableAccount.title'),
|
||||
t('account.card.actions.enableAccount.subtitle'),
|
||||
() => updateStatusAccount(true)
|
||||
)
|
||||
"
|
||||
>
|
||||
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
|
||||
</QItem> -->
|
||||
|
||||
<QItem
|
||||
v-if="account.hasAccount"
|
||||
v-ripple
|
||||
|
@ -178,10 +140,4 @@ const removeAccount = async () => {
|
|||
</QItem>
|
||||
|
||||
<QSeparator />
|
||||
<!-- <QItem @click="removeAccount(id)" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="delete" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('account.card.actions.delete.name') }}</QItemSection>
|
||||
</QItem> -->
|
||||
</template>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
|
@ -12,17 +12,14 @@ const route = useRoute();
|
|||
|
||||
const rolesOptions = ref([]);
|
||||
const formModelRef = ref();
|
||||
watch(
|
||||
() => route.params.id,
|
||||
() => formModelRef.value.reset()
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
|
||||
<FormModel
|
||||
ref="formModelRef"
|
||||
model="AccountPrivileges"
|
||||
:url="`VnUsers/${route.params.id}/privileges`"
|
||||
:url-create="`VnUsers/${route.params.id}/privileges`"
|
||||
auto-load
|
||||
@on-data-saved="formModelRef.fetch()"
|
||||
>
|
||||
<FormModel ref="formModelRef" model="AccountPrivileges" url="VnUsers" auto-load>
|
||||
<template #form="{ data }">
|
||||
<div class="q-gutter-y-sm">
|
||||
<QCheckbox
|
||||
|
|
|
@ -48,7 +48,7 @@ const filter = {
|
|||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
</QCardSection>
|
||||
<VnLv :label="t('account.card.nickname')" :value="account.nickname" />
|
||||
<VnLv :label="t('account.card.nickname')" :value="account.name" />
|
||||
<VnLv :label="t('account.card.role')" :value="account.role.name" />
|
||||
</QCard>
|
||||
</template>
|
||||
|
|
|
@ -4,11 +4,9 @@ import { computed, ref } from 'vue';
|
|||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import RoleSummary from './Card/RoleSummary.vue';
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
|
|
@ -36,8 +36,6 @@ const $props = defineProps({
|
|||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const ClaimStates = ref([]);
|
||||
const claimUrl = ref();
|
||||
const salixUrl = ref();
|
||||
const claimDmsRef = ref();
|
||||
const claimDms = ref([]);
|
||||
const multimediaDialog = ref();
|
||||
|
@ -152,11 +150,6 @@ const developmentColumns = ref([
|
|||
},
|
||||
]);
|
||||
|
||||
onMounted(async () => {
|
||||
salixUrl.value = await getUrl('');
|
||||
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
|
||||
});
|
||||
|
||||
async function getClaimDms() {
|
||||
claimDmsFilter.value.where = { claimFk: entityId.value };
|
||||
await claimDmsRef.value.fetch();
|
||||
|
@ -177,10 +170,15 @@ function openDialog(dmsId) {
|
|||
multimediaSlide.value = dmsId;
|
||||
multimediaDialog.value = true;
|
||||
}
|
||||
|
||||
async function changeState(value) {
|
||||
await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value });
|
||||
router.go(route.fullPath);
|
||||
}
|
||||
|
||||
function claimUrl(section) {
|
||||
return '#/claim/' + entityId.value + '/' + section;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -234,7 +232,7 @@ async function changeState(value) {
|
|||
<template #body="{ entity: { claim, salesClaimed, developments } }">
|
||||
<QCard class="vn-one" v-if="$route.name != 'ClaimSummary'">
|
||||
<VnTitle
|
||||
:url="`#/claim/${entityId}/basic-data`"
|
||||
:url="claimUrl('basic-data')"
|
||||
:text="t('globals.pageTitles.basicData')"
|
||||
/>
|
||||
<VnLv :label="t('claim.created')" :value="toDate(claim.created)" />
|
||||
|
@ -275,7 +273,7 @@ async function changeState(value) {
|
|||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-two">
|
||||
<VnTitle :url="`#/claim/${entityId}/notes`" :text="t('claim.notes')" />
|
||||
<VnTitle :url="claimUrl('notes')" :text="t('claim.notes')" />
|
||||
<ClaimNotes
|
||||
:id="entityId"
|
||||
:add-note="false"
|
||||
|
@ -284,7 +282,7 @@ async function changeState(value) {
|
|||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-two" v-if="claimDms?.length">
|
||||
<VnTitle :url="`#/claim/${entityId}/photos`" :text="t('claim.photos')" />
|
||||
<VnTitle :url="claimUrl('photos')" :text="t('claim.photos')" />
|
||||
<div class="container max-container-height" style="overflow: auto">
|
||||
<div
|
||||
class="multimedia-container"
|
||||
|
@ -326,7 +324,7 @@ async function changeState(value) {
|
|||
</div>
|
||||
</QCard>
|
||||
<QCard class="vn-max" v-if="salesClaimed.length > 0">
|
||||
<VnTitle :url="`#/claim/${entityId}/lines`" :text="t('claim.details')" />
|
||||
<VnTitle :url="claimUrl('lines')" :text="t('claim.details')" />
|
||||
<QTable
|
||||
:columns="detailsColumns"
|
||||
:rows="salesClaimed"
|
||||
|
@ -365,7 +363,7 @@ async function changeState(value) {
|
|||
</QTable>
|
||||
</QCard>
|
||||
<QCard class="vn-max" v-if="developments.length > 0">
|
||||
<VnTitle :url="claimUrl + 'development'" :text="t('claim.development')" />
|
||||
<VnTitle :url="claimUrl('development')" :text="t('claim.development')" />
|
||||
<QTable
|
||||
:columns="developmentColumns"
|
||||
:rows="developments"
|
||||
|
@ -390,7 +388,7 @@ async function changeState(value) {
|
|||
</QTable>
|
||||
</QCard>
|
||||
<QCard class="vn-max">
|
||||
<VnTitle :url="claimUrl + 'action'" :text="t('claim.actions')" />
|
||||
<VnTitle :url="claimUrl('action')" :text="t('claim.actions')" />
|
||||
<div id="slider-container" class="q-px-xl q-py-md">
|
||||
<QSlider
|
||||
v-model="claim.responsibility"
|
||||
|
|
|
@ -78,6 +78,9 @@ const columns = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
label: t('claim.state'),
|
||||
format: ({ stateCode }) =>
|
||||
claimFilterRef.value?.states.find(({code}) => code === stateCode)
|
||||
?.description,
|
||||
name: 'stateCode',
|
||||
chip: {
|
||||
condition: () => true,
|
||||
|
|
|
@ -42,7 +42,7 @@ claim:
|
|||
pickup: Recoger
|
||||
null: No
|
||||
agency: Agencia
|
||||
delivery: Entrega
|
||||
delivery: Reparto
|
||||
fileDescription: 'ID de reclamación {claimId} del cliente {clientName} con ID {clientId}'
|
||||
noData: 'No hay imágenes/videos, haz clic aquí o arrastra y suelta el archivo'
|
||||
dragDrop: Arrastra y suelta aquí
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<script setup>
|
||||
import { ref, computed, onBeforeMount } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import InvoiceInSerialFilter from './InvoiceInSerialFilter.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const cols = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'serial',
|
||||
label: t('Serial'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'pending',
|
||||
label: t('Pending'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'total',
|
||||
label: 'Total',
|
||||
columnFilter: false,
|
||||
},
|
||||
]);
|
||||
|
||||
const daysAgo = ref();
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const tableParam = useRoute().query.table;
|
||||
|
||||
if (tableParam) daysAgo.value = JSON.parse(tableParam).daysAgo;
|
||||
else
|
||||
daysAgo.value = (
|
||||
await axios.get('InvoiceInConfigs/findOne', {
|
||||
params: { filter: { fields: ['daysAgo'] } },
|
||||
})
|
||||
).data?.daysAgo;
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<InvoiceInSerialFilter data-key="InvoiceInSerial" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
v-if="!isNaN(daysAgo)"
|
||||
data-key="InvoiceInSerial"
|
||||
url="InvoiceIns/getSerial"
|
||||
:columns="cols"
|
||||
:right-search="false"
|
||||
:user-params="{ daysAgo }"
|
||||
:disable-option="{ card: true }"
|
||||
auto-load
|
||||
/>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Serial: Serie
|
||||
Pending: Pendiente
|
||||
</i18n>
|
|
@ -0,0 +1,53 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
defineProps({ dataKey: { type: String, required: true } });
|
||||
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputNumber
|
||||
v-model="params.daysAgo"
|
||||
:label="t('params.daysAgo')"
|
||||
outlined
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.serial"
|
||||
:label="t('params.serial')"
|
||||
outlined
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
daysAgo: Last days
|
||||
serial: serial
|
||||
es:
|
||||
params:
|
||||
daysAgo: Últimos días
|
||||
serial: serie
|
||||
</i18n>
|
|
@ -222,7 +222,7 @@ const showTransferInvoiceForm = async () => {
|
|||
<QItemSection>{{ t('Generate PDF invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('Refund...') }}</QItemSection>
|
||||
<QItemSection>{{ t('Refund') }}</QItemSection>
|
||||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
</QItemSection>
|
||||
|
@ -250,7 +250,7 @@ es:
|
|||
Delete invoice: Eliminar factura
|
||||
Book invoice: Asentar factura
|
||||
Generate PDF invoice: Generar PDF factura
|
||||
Refund...: Abono
|
||||
Refund: Abono
|
||||
As PDF: como PDF
|
||||
As CSV: como CSV
|
||||
Send PDF: Enviar PDF
|
||||
|
|
|
@ -94,11 +94,13 @@ const selectCustomerId = (id) => {
|
|||
};
|
||||
|
||||
const statusText = computed(() => {
|
||||
return status.value === 'invoicing'
|
||||
? `${t(`status.${status.value}`)} ${
|
||||
addresses.value[getAddressNumber.value]?.clientId
|
||||
}`
|
||||
: t(`status.${status.value}`);
|
||||
const baseStatus = t(`status.${status.value}`);
|
||||
const clientId =
|
||||
status.value === 'invoicing'
|
||||
? addresses.value[getAddressNumber.value]?.clientId || ''
|
||||
: '';
|
||||
|
||||
return clientId ? `${baseStatus} ${clientId}`.trim() : baseStatus;
|
||||
});
|
||||
|
||||
onMounted(() => (stateStore.rightDrawer = true));
|
||||
|
|
|
@ -20,21 +20,25 @@ const { initialDataLoading, formInitialData, invoicing, status } =
|
|||
const { makeInvoice, setStatusValue } = invoiceOutGlobalStore;
|
||||
|
||||
const clientsToInvoice = ref('all');
|
||||
|
||||
const companiesOptions = ref([]);
|
||||
|
||||
const printersOptions = ref([]);
|
||||
const serialTypesOptions = ref([]);
|
||||
|
||||
const clientsOptions = ref([]);
|
||||
const handleInvoiceOutSerialsFetch = (data) => {
|
||||
serialTypesOptions.value = Array.from(
|
||||
new Set(data.map((item) => item.type).filter((type) => type))
|
||||
);
|
||||
};
|
||||
|
||||
const formData = ref({});
|
||||
|
||||
const optionsInitialData = computed(() => {
|
||||
return (
|
||||
companiesOptions.value.length > 0 &&
|
||||
printersOptions.value.length > 0 &&
|
||||
clientsOptions.value.length > 0
|
||||
);
|
||||
const optionsArrays = [
|
||||
companiesOptions.value,
|
||||
printersOptions.value,
|
||||
serialTypesOptions.value,
|
||||
];
|
||||
return optionsArrays.every((arr) => arr.length > 0);
|
||||
});
|
||||
|
||||
const getStatus = computed({
|
||||
|
@ -48,7 +52,7 @@ const getStatus = computed({
|
|||
|
||||
onMounted(async () => {
|
||||
await invoiceOutGlobalStore.init();
|
||||
formData.value = formInitialData.value.invoiceDate;
|
||||
formData.value = { invoiceDate: formInitialData.value.invoiceDate };
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -59,8 +63,11 @@ onMounted(async () => {
|
|||
auto-load
|
||||
/>
|
||||
<FetchData url="Printers" @on-fetch="(data) => (printersOptions = data)" auto-load />
|
||||
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
|
||||
|
||||
<FetchData
|
||||
url="invoiceOutSerials"
|
||||
@on-fetch="handleInvoiceOutSerialsFetch"
|
||||
auto-load
|
||||
/>
|
||||
<QForm
|
||||
v-if="!initialDataLoading && optionsInitialData"
|
||||
@submit="makeInvoice(formData, clientsToInvoice)"
|
||||
|
@ -87,7 +94,7 @@ onMounted(async () => {
|
|||
v-if="clientsToInvoice === 'one'"
|
||||
:label="t('client')"
|
||||
v-model="formData.clientId"
|
||||
:options="clientsOptions"
|
||||
url="Clients"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -95,6 +102,17 @@ onMounted(async () => {
|
|||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('invoiceOutSerialType')"
|
||||
v-model="formData.serialType"
|
||||
:options="serialTypesOptions"
|
||||
option-value="type"
|
||||
option-label="type"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInputDate
|
||||
v-model="formData.invoiceDate"
|
||||
:label="t('invoiceDate')"
|
||||
|
@ -109,9 +127,7 @@ onMounted(async () => {
|
|||
:label="t('company')"
|
||||
v-model="formData.companyFk"
|
||||
:options="companiesOptions"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
|
@ -120,9 +136,6 @@ onMounted(async () => {
|
|||
:label="t('printer')"
|
||||
v-model="formData.printer"
|
||||
:options="printersOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
|
@ -168,6 +181,7 @@ en:
|
|||
printer: Printer
|
||||
invoiceOut: Invoice out
|
||||
client: Client
|
||||
invoiceOutSerialType: Serial Type
|
||||
stop: Stop
|
||||
|
||||
es:
|
||||
|
@ -179,5 +193,6 @@ es:
|
|||
printer: Impresora
|
||||
invoiceOut: Facturar
|
||||
client: Cliente
|
||||
invoiceOutSerialType: Tipo de Serie
|
||||
stop: Parar
|
||||
</i18n>
|
||||
|
|
|
@ -198,7 +198,7 @@ watchEffect(selectedRows);
|
|||
:url="`${MODEL}/filter`"
|
||||
:create="{
|
||||
urlCreate: 'InvoiceOuts/createManualInvoice',
|
||||
title: t('Create Manual Invoice'),
|
||||
title: t('Create manual invoice'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {
|
||||
active: true,
|
||||
|
@ -275,10 +275,12 @@ en:
|
|||
fileAllowed: Successful download of CSV file
|
||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||
createInvoice: Make invoice
|
||||
Create manual invoice: Create manual invoice
|
||||
es:
|
||||
searchInvoice: Buscar factura emitida
|
||||
fileDenied: El navegador denegó la descarga de archivos...
|
||||
fileAllowed: Descarga exitosa de archivo CSV
|
||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||
createInvoice: Crear factura
|
||||
Create manual invoice: Crear factura manual
|
||||
</i18n>
|
||||
|
|
|
@ -16,7 +16,6 @@ const route = useRoute();
|
|||
const { t } = useI18n();
|
||||
|
||||
const itemTypesOptions = ref([]);
|
||||
const itemsWithNameOptions = ref([]);
|
||||
const intrastatsOptions = ref([]);
|
||||
const expensesOptions = ref([]);
|
||||
|
||||
|
|
|
@ -138,14 +138,6 @@ en:
|
|||
</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;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted, reactive } from 'vue';
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
|
@ -11,18 +9,14 @@ import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.v
|
|||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { toDateFormat, toTimeFormat } from 'src/filters/date.js';
|
||||
import { toCurrency, dateRange } from 'src/filters';
|
||||
|
||||
const DEFAULT_AUTO_REFRESH = 1000;
|
||||
const { t } = useI18n();
|
||||
const autoRefresh = ref(false);
|
||||
const router = useRouter();
|
||||
const paginateRef = ref(null);
|
||||
const workersActiveOptions = ref([]);
|
||||
const provincesOptions = ref([]);
|
||||
|
@ -57,46 +51,6 @@ function exprBuilder(param, value) {
|
|||
const filter = { order: ['totalProblems DESC'] };
|
||||
let params = reactive({});
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await paginateRef.value.addFilter(null, params);
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getInputEvents = (col) => {
|
||||
return col.columnFilter.type === 'select' || col.columnFilter.type === 'date'
|
||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
||||
: {
|
||||
'keyup.enter': () => applyColumnFilter(col),
|
||||
};
|
||||
};
|
||||
|
||||
const fetchParams = ($params = {}) => {
|
||||
const excludedParams = ['search', 'clientFk', 'orderFk', 'refFk', 'scopeDays'];
|
||||
|
||||
const hasExcludedParams = excludedParams.some((param) => {
|
||||
return $params && $params[param] != undefined;
|
||||
});
|
||||
const hasParams = Object.entries($params).length;
|
||||
if (!hasParams || !hasExcludedParams) $params.scopeDays = 1;
|
||||
|
||||
if (typeof $params.scopeDays === 'number') {
|
||||
const from = Date.vnNew();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
|
||||
const to = new Date(from.getTime());
|
||||
to.setDate(to.getDate() + $params.scopeDays);
|
||||
to.setHours(23, 59, 59, 999);
|
||||
|
||||
Object.assign($params, { from, to });
|
||||
}
|
||||
return { tableOrder: 'totalProblems DESC', ...$params };
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('salesTicketsTable.problems'),
|
||||
|
@ -379,13 +333,6 @@ const redirectToSales = (id) => {
|
|||
const url = `#/ticket/${id}/sale`;
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
|
||||
// onMounted(async () => {
|
||||
// const filteredColumns = columns.value.filter((col) => col.name !== 'rowActions');
|
||||
// allColumnNames.value = filteredColumns.map((col) => col.name);
|
||||
// params = fetchParams();
|
||||
// await paginateRef.value.addFilter(null, params);
|
||||
// });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -268,7 +268,6 @@ onMounted(async () => {
|
|||
stateStore.rightDrawer = true;
|
||||
const filteredColumns = columns.value.filter((col) => col.name !== 'history');
|
||||
allColumnNames.value = filteredColumns.map((col) => col.name);
|
||||
// await expeditionsArrayData.fetch({ append: false });
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
|
|
@ -11,7 +11,6 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
|||
import TicketEditManaProxy from './TicketEditMana.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import TicketSaleMoreActions from './TicketSaleMoreActions.vue';
|
||||
import TicketTransfer from './TicketTransfer.vue';
|
||||
|
|
|
@ -153,14 +153,22 @@ const setReserved = async (reserved) => {
|
|||
};
|
||||
|
||||
const createRefund = async (withWarehouse) => {
|
||||
if (!props.sales) return;
|
||||
if (!props.ticket) return;
|
||||
|
||||
const salesIds = props.sales.map((sale) => sale.id);
|
||||
const params = { salesIds: salesIds, withWarehouse: withWarehouse, negative: true };
|
||||
const { data } = await axios.post('Sales/clone', params);
|
||||
const [refundTicket] = data;
|
||||
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
||||
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
const params = {
|
||||
ticketsIds: [props.ticket.id],
|
||||
withWarehouse: withWarehouse,
|
||||
negative: true,
|
||||
};
|
||||
|
||||
try {
|
||||
const { data } = await axios.post('Tickets/cloneAll', params);
|
||||
const [refundTicket] = data;
|
||||
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
||||
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -244,7 +252,7 @@ const createRefund = async (withWarehouse) => {
|
|||
</QItem>
|
||||
<QItem clickable v-ripple>
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ t('Refund...') }}</QItemLabel>
|
||||
<QItemLabel>{{ t('Refund') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
|
@ -279,7 +287,7 @@ es:
|
|||
Add claim: Crear reclamación
|
||||
Mark as reserved: Marcar como reservado
|
||||
Unmark as reserved: Desmarcar como reservado
|
||||
Refund...: Abono...
|
||||
Refund: Abono
|
||||
with warehouse: con almacén
|
||||
without warehouse: sin almacén
|
||||
Claim out of time: Reclamación fuera de plazo
|
||||
|
|
|
@ -82,7 +82,9 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
|
|||
data-key="TicketTracking"
|
||||
:filter="paginateFilter"
|
||||
url="TicketTrackings"
|
||||
auto-load
|
||||
auto-load
|
||||
order="created DESC"
|
||||
:limit="0"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
|
|
|
@ -448,7 +448,7 @@ const handleCloseProgressDialog = () => {
|
|||
const handleCancelProgress = () => (cancelProgress.value = true);
|
||||
|
||||
onMounted(async () => {
|
||||
let today = Date.vnNew();
|
||||
let today = Date.vnNew().toISOString();
|
||||
const tomorrow = new Date(today);
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
userParams.dateFuture = tomorrow;
|
||||
|
|
|
@ -55,7 +55,7 @@ onMounted(async () => await getItemPackingTypes());
|
|||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:hidden-tags="['search']"
|
||||
:unremovable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']"
|
||||
:un-removable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
@ -70,7 +70,6 @@ onMounted(async () => await getItemPackingTypes());
|
|||
v-model="params.dateFuture"
|
||||
:label="t('params.dateFuture')"
|
||||
is-outlined
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -80,7 +79,6 @@ onMounted(async () => await getItemPackingTypes());
|
|||
v-model="params.dateToAdvance"
|
||||
:label="t('params.dateToAdvance')"
|
||||
is-outlined
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -8,6 +8,8 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import TicketFutureFilter from './TicketFutureFilter.vue';
|
||||
|
||||
import { dashIfEmpty, toCurrency } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
@ -37,9 +39,9 @@ const exprBuilder = (param, value) => {
|
|||
return { liters: value };
|
||||
case 'lines':
|
||||
return { lines: value };
|
||||
case 'ipt':
|
||||
case 'iptColFilter':
|
||||
return { ipt: { like: `%${value}%` } };
|
||||
case 'futureIpt':
|
||||
case 'futureIptColFilter':
|
||||
return { futureIpt: { like: `%${value}%` } };
|
||||
case 'totalWithVat':
|
||||
return { totalWithVat: value };
|
||||
|
@ -47,8 +49,8 @@ const exprBuilder = (param, value) => {
|
|||
};
|
||||
|
||||
const userParams = reactive({
|
||||
futureDated: Date.vnNew(),
|
||||
originDated: Date.vnNew(),
|
||||
futureDated: Date.vnNew().toISOString(),
|
||||
originDated: Date.vnNew().toISOString(),
|
||||
warehouseFk: user.value.warehouseFk,
|
||||
});
|
||||
|
||||
|
@ -83,6 +85,8 @@ const getInputEvents = (col) => {
|
|||
};
|
||||
};
|
||||
|
||||
const tickets = computed(() => store.data);
|
||||
|
||||
const ticketColumns = computed(() => [
|
||||
{
|
||||
label: t('futureTickets.problems'),
|
||||
|
@ -121,7 +125,7 @@ const ticketColumns = computed(() => [
|
|||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'ipt',
|
||||
filterParamKey: 'iptColFilter',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
|
@ -214,7 +218,7 @@ const ticketColumns = computed(() => [
|
|||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
filterParamKey: 'futureIpt',
|
||||
filterParamKey: 'futureIptColFilter',
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
|
@ -305,9 +309,14 @@ onMounted(async () => {
|
|||
</QBtn>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<TicketFutureFilter data-key="FutureTickets" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="store.data"
|
||||
:rows="tickets"
|
||||
:columns="ticketColumns"
|
||||
row-key="id"
|
||||
selection="multiple"
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const warehousesOptions = ref([]);
|
||||
const itemPackingTypes = ref([]);
|
||||
const stateOptions = ref([]);
|
||||
|
||||
const getItemPackingTypes = async () => {
|
||||
try {
|
||||
const filter = {
|
||||
where: { isActive: true },
|
||||
};
|
||||
const { data } = await axios.get('ItemPackingTypes', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
itemPackingTypes.value = data.map((ipt) => ({
|
||||
description: t(ipt.description),
|
||||
code: ipt.code,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
const getGroupedStates = async () => {
|
||||
try {
|
||||
const { data } = await axios.get('AlertLevels');
|
||||
stateOptions.value = data.map((state) => ({
|
||||
id: state.id,
|
||||
name: t(`futureTickets.${state.code}`),
|
||||
code: state.code,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
getItemPackingTypes();
|
||||
getGroupedStates();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:hidden-tags="['search']"
|
||||
:un-removable-params="['warehouseFk', 'originDated', 'futureDated']"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.originDated"
|
||||
:label="t('params.originDated')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.futureDated"
|
||||
:label="t('params.futureDated')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.litersMax')"
|
||||
v-model="params.litersMax"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.linesMax')"
|
||||
v-model="params.linesMax"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('params.ipt')"
|
||||
v-model="params.ipt"
|
||||
:options="itemPackingTypes"
|
||||
option-value="code"
|
||||
option-label="description"
|
||||
:info="t('iptInfo')"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('params.futureIpt')"
|
||||
v-model="params.futureIpt"
|
||||
:options="itemPackingTypes"
|
||||
option-value="code"
|
||||
option-label="description"
|
||||
:info="t('iptInfo')"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('params.state')"
|
||||
v-model="params.state"
|
||||
:options="stateOptions"
|
||||
option-value="code"
|
||||
option-label="name"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('params.futureState')"
|
||||
v-model="params.futureState"
|
||||
:options="stateOptions"
|
||||
option-value="code"
|
||||
option-label="name"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.problems')"
|
||||
v-model="params.problems"
|
||||
:toggle-indeterminate="false"
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('params.warehouseFk')"
|
||||
v-model="params.warehouseFk"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
iptInfo: IPT
|
||||
params:
|
||||
originDated: Origin date
|
||||
futureDated: Destination date
|
||||
futureIpt: Destination IPT
|
||||
ipt: Origin IPT
|
||||
warehouseFk: Warehouse
|
||||
litersMax: Max liters
|
||||
linesMax: Max lines
|
||||
state: Origin grouped state
|
||||
futureState: Destination grouped state
|
||||
problems: With problems
|
||||
es:
|
||||
Horizontal: Horizontal
|
||||
Vertical: Vertical
|
||||
iptInfo: Encajado
|
||||
params:
|
||||
originDated: Fecha origen
|
||||
futureDated: Fecha destino
|
||||
futureIpt: IPT destino
|
||||
ipt: IPT Origen
|
||||
warehouseFk: Almacén
|
||||
litersMax: Litros máx.
|
||||
linesMax: Líneas máx.
|
||||
state: Estado agrupado origen
|
||||
futureState: Estado agrupado destino
|
||||
problems: Con problemas
|
||||
</i18n>
|
|
@ -93,6 +93,11 @@ futureTickets:
|
|||
moveTicketSuccess: Tickets moved successfully!
|
||||
searchInfo: Search future tickets by date
|
||||
futureTicket: Future tickets
|
||||
FREE: Free
|
||||
ON_PREVIOUS: ON_PREVIOUS
|
||||
ON_PREPARATION: On preparation
|
||||
PACKED: Packed
|
||||
DELIVERED: Delivered
|
||||
expedition:
|
||||
id: Expedition
|
||||
item: Item
|
||||
|
|
|
@ -140,6 +140,11 @@ futureTickets:
|
|||
moveTicketSuccess: Tickets movidos correctamente
|
||||
searchInfo: Buscar tickets por fecha
|
||||
futureTicket: Tickets a futuro
|
||||
FREE: Libre
|
||||
ON_PREVIOUS: ON_PREVIOUS
|
||||
ON_PREPARATION: En preparación
|
||||
PACKED: Encajado
|
||||
DELIVERED: Servido
|
||||
ticketSale:
|
||||
id: Id
|
||||
visible: Visible
|
||||
|
|
|
@ -152,7 +152,7 @@ const getEventAttrs = (timestamp) => {
|
|||
|
||||
if (isFestive) {
|
||||
attrs.class = '--festive';
|
||||
attrs.label = event.absenceId ?? timestamp.day;
|
||||
attrs.label = timestamp.day;
|
||||
} else attrs.class = `--${type}`;
|
||||
|
||||
return attrs;
|
||||
|
|
|
@ -10,6 +10,7 @@ import useCardDescription from 'src/composables/useCardDescription';
|
|||
import { useState } from 'src/composables/useState';
|
||||
import axios from 'axios';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
import EditPictureForm from 'components/EditPictureForm.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -18,6 +19,7 @@ const $props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
});
|
||||
const image = ref(null);
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -25,6 +27,10 @@ const state = useState();
|
|||
const user = state.getUser();
|
||||
const changePasswordFormDialog = ref(null);
|
||||
const cardDescriptorRef = ref(null);
|
||||
const showEditPhotoForm = ref(false);
|
||||
const toggleEditPictureForm = () => {
|
||||
showEditPhotoForm.value = !showEditPhotoForm.value;
|
||||
};
|
||||
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
|
@ -99,7 +105,9 @@ const handleExcluded = async () => {
|
|||
|
||||
workerExcluded.value = !workerExcluded.value;
|
||||
};
|
||||
|
||||
const handlePhotoUpdated = (evt = false) => {
|
||||
image.value.reload(evt);
|
||||
};
|
||||
const refetch = async () => await cardDescriptorRef.value.getData();
|
||||
</script>
|
||||
<template>
|
||||
|
@ -144,27 +152,49 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
|||
</QItem>
|
||||
</template>
|
||||
<template #before>
|
||||
<VnImg
|
||||
:id="parseInt(entityId)"
|
||||
collection="user"
|
||||
resolution="520x520"
|
||||
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:claims" />
|
||||
</div>
|
||||
<div class="text-grey-5" style="opacity: 0.4">
|
||||
{{ t('worker.imageNotFound') }}
|
||||
<div class="relative-position">
|
||||
<VnImg
|
||||
ref="image"
|
||||
:id="parseInt(entityId)"
|
||||
collection="user"
|
||||
resolution="520x520"
|
||||
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:claims" />
|
||||
</div>
|
||||
<div class="text-grey-5" style="opacity: 0.4">
|
||||
{{ t('worker.imageNotFound') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</VnImg>
|
||||
</template> </VnImg
|
||||
><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="user"
|
||||
:id="entityId"
|
||||
@close-form="toggleEditPictureForm()"
|
||||
@on-photo-uploaded="handlePhotoUpdated"
|
||||
/>
|
||||
</QDialog>
|
||||
</QBtn>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />
|
||||
|
|
|
@ -93,7 +93,6 @@ const filter = {
|
|||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('worker.list.email')" :value="worker.user.email" copy />
|
||||
<VnLv :label="t('worker.summary.boss')" link>
|
||||
<template #value>
|
||||
<VnUserLink
|
||||
|
@ -139,29 +138,25 @@ const filter = {
|
|||
/>
|
||||
<VnLv :label="t('worker.summary.fi')" :value="worker.fi" />
|
||||
<VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" />
|
||||
<VnRow class="q-mt-sm" wrap>
|
||||
<VnLv
|
||||
:label="t('worker.summary.isFreelance')"
|
||||
:value="worker.isFreelance"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('worker.summary.isSsDiscounted')"
|
||||
:value="worker.isSsDiscounted"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('worker.summary.hasMachineryAuthorized')"
|
||||
:value="worker.hasMachineryAuthorized"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('worker.summary.isDisable')"
|
||||
:value="worker.isDisable"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnLv
|
||||
:label="t('worker.summary.isFreelance')"
|
||||
:value="worker.isFreelance"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('worker.summary.isSsDiscounted')"
|
||||
:value="worker.isSsDiscounted"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('worker.summary.hasMachineryAuthorized')"
|
||||
:value="worker.hasMachineryAuthorized"
|
||||
/>
|
||||
<VnLv :label="t('worker.summary.isDisable')" :value="worker.isDisable" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<VnTitle :text="t('worker.summary.userData')" />
|
||||
<VnLv :label="t('worker.summary.userId')" :value="worker.user.id" />
|
||||
<VnLv :label="t('worker.card.name')" :value="worker.user.nickname" />
|
||||
<VnLv :label="t('worker.list.email')" :value="worker.user.email" copy />
|
||||
<VnLv :label="t('worker.summary.role')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
|
|
|
@ -34,6 +34,10 @@ const weekdayStore = useWeekdayStore();
|
|||
const weekDays = ref([]);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { getWeekOfYear } = date;
|
||||
const defaultDate = computed(() => {
|
||||
const timestamp = route.query.timestamp;
|
||||
return timestamp ? new Date(timestamp * 1000) : Date.vnNew();
|
||||
});
|
||||
|
||||
const workerTimeFormDialogRef = ref(null);
|
||||
const workerTimeReasonFormDialogRef = ref(null);
|
||||
|
@ -56,7 +60,7 @@ const workerTimeFormProps = reactive({
|
|||
// 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 selectedDateFormatted = ref(toDateString(defaultDate.value));
|
||||
|
||||
const arrayData = useArrayData('workerData');
|
||||
|
||||
|
@ -423,7 +427,7 @@ onBeforeMount(() => {
|
|||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await setDate(Date.vnNew());
|
||||
await setDate(defaultDate.value);
|
||||
await getMailStates(selectedDate.value);
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
@ -547,9 +551,12 @@ onMounted(async () => {
|
|||
<QTd
|
||||
v-for="(day, index) in props.cols"
|
||||
:key="index"
|
||||
style="padding: 20px 16px !important"
|
||||
:style="{
|
||||
padding: '20px 16px !important',
|
||||
'vertical-align': 'baseline',
|
||||
}"
|
||||
>
|
||||
<div class="full-height full-width column items-center">
|
||||
<div class="full-width column items-center">
|
||||
<WorkerTimeHourChip
|
||||
v-for="(hour, ind) in day.dayData?.hours"
|
||||
:key="ind"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { onBeforeMount, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import { useUserConfig } from 'src/composables/useUserConfig';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
@ -14,15 +13,25 @@ import FetchData from 'components/FetchData.vue';
|
|||
import FormModel from 'components/FormModel.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import VnRadio from 'src/components/common/VnRadio.vue';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
const { t } = useI18n();
|
||||
const user = useState().getUser();
|
||||
|
||||
const companiesOptions = ref([]);
|
||||
const workersOptions = ref([]);
|
||||
const payMethodsOptions = ref([]);
|
||||
const bankEntitiesOptions = ref([]);
|
||||
const formData = ref({ isFreelance: false });
|
||||
const defaultPayMethod = ref(0);
|
||||
const formData = ref({ companyFk: user.value.companyFk, isFreelance: false });
|
||||
const defaultPayMethod = ref();
|
||||
|
||||
onBeforeMount(async () => {
|
||||
defaultPayMethod.value = (
|
||||
await axios.get('WorkerConfigs/findOne', {
|
||||
params: { field: ['payMethodFk'] },
|
||||
})
|
||||
).data.payMethodFk;
|
||||
formData.value.payMethodFk = defaultPayMethod.value;
|
||||
});
|
||||
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
|
@ -32,16 +41,32 @@ function handleLocation(data, location) {
|
|||
data.countryFk = countryFk;
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const userInfo = await useUserConfig().fetch();
|
||||
formData.value.companyFk = userInfo.companyFk;
|
||||
function generateCodeUser(worker) {
|
||||
if (!worker.firstName || !worker.lastNames) return;
|
||||
|
||||
const { data } = await axios.get('WorkerConfigs/findOne', {
|
||||
params: { field: ['payMethodFk'] },
|
||||
});
|
||||
defaultPayMethod.value = data.payMethodFk;
|
||||
formData.value.payMethodFk = defaultPayMethod.value;
|
||||
});
|
||||
const totalName = worker.firstName.concat(' ' + worker.lastNames).toLowerCase();
|
||||
const totalNameArray = totalName.split(' ');
|
||||
let newCode = '';
|
||||
|
||||
for (let part of totalNameArray) newCode += part.charAt(0);
|
||||
|
||||
worker.code = newCode.toUpperCase().slice(0, 3);
|
||||
worker.name = totalNameArray[0] + newCode.slice(1);
|
||||
|
||||
if (!worker.companyFk) worker.companyFk = user.companyFk;
|
||||
}
|
||||
|
||||
async function autofillBic(worker) {
|
||||
if (!worker || !worker.iban) return;
|
||||
|
||||
let bankEntityId = parseInt(worker.iban.substr(4, 4));
|
||||
let filter = { where: { id: bankEntityId } };
|
||||
|
||||
const { data } = await axios.get(`BankEntities`, { params: { filter } });
|
||||
const hasData = data && data[0];
|
||||
if (hasData) worker.bankEntityFk = data[0].id;
|
||||
else if (!hasData) worker.bankEntityFk = undefined;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -49,11 +74,6 @@ onBeforeMount(async () => {
|
|||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Workers/search"
|
||||
@on-fetch="(data) => (workersOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Paymethods"
|
||||
@on-fetch="(data) => (payMethodsOptions = data)"
|
||||
|
@ -93,11 +113,13 @@ onBeforeMount(async () => {
|
|||
v-model="data.firstName"
|
||||
:label="t('worker.create.name')"
|
||||
:rules="validate('Worker.firstName')"
|
||||
@update:model-value="generateCodeUser(data)"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.lastNames"
|
||||
:label="t('worker.create.lastName')"
|
||||
:rules="validate('Worker.lastNames')"
|
||||
@update:model-value="generateCodeUser(data)"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.code"
|
||||
|
@ -130,7 +152,7 @@ onBeforeMount(async () => {
|
|||
<VnSelect
|
||||
:label="t('worker.create.boss')"
|
||||
v-model="data.bossFk"
|
||||
:options="workersOptions"
|
||||
url="Workers/search"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -204,6 +226,7 @@ onBeforeMount(async () => {
|
|||
:label="t('worker.create.iban')"
|
||||
:rules="validate('Worker.iban')"
|
||||
:disable="formData.isFreelance"
|
||||
@update:model-value="autofillBic(data)"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
|
@ -221,6 +244,8 @@ onBeforeMount(async () => {
|
|||
:roles-allowed-to-create="['salesAssistant', 'hr']"
|
||||
:rules="validate('Worker.bankEntity')"
|
||||
:disable="formData.isFreelance"
|
||||
@update:model-value="autofillBic(data)"
|
||||
:filter-options="['bic', 'name']"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { onBeforeMount, computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
@ -16,16 +16,19 @@ import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
|||
import FetchData from 'src/components/FetchData.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import WorkerFilter from './WorkerFilter.vue';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import axios from 'axios';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const companiesOptions = ref([]);
|
||||
const workersOptions = ref([]);
|
||||
const payMethodsOptions = ref([]);
|
||||
const bankEntitiesOptions = ref([]);
|
||||
const postcodesOptions = ref([]);
|
||||
|
||||
const user = useState().getUser();
|
||||
const defaultPayMethod = ref();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -82,6 +85,14 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
defaultPayMethod.value = (
|
||||
await axios.get('WorkerConfigs/findOne', {
|
||||
params: { field: ['payMethodFk'] },
|
||||
})
|
||||
).data?.payMethodFk;
|
||||
});
|
||||
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
data.postcode = code;
|
||||
|
@ -98,6 +109,31 @@ function uppercaseStreetModel(data) {
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
function generateCodeUser(worker) {
|
||||
if (!worker.firstName || !worker.lastNames) return;
|
||||
|
||||
const totalName = worker.firstName.concat(' ' + worker.lastNames).toLowerCase();
|
||||
const totalNameArray = totalName.split(' ');
|
||||
let newCode = '';
|
||||
|
||||
for (let part of totalNameArray) newCode += part.charAt(0);
|
||||
|
||||
worker.code = newCode.toUpperCase().slice(0, 3);
|
||||
worker.name = totalNameArray[0] + newCode.slice(1);
|
||||
|
||||
if (!worker.companyFk) worker.companyFk = user.companyFk;
|
||||
}
|
||||
|
||||
async function autofillBic(worker) {
|
||||
if (!worker || !worker.iban) return;
|
||||
|
||||
let bankEntityId = parseInt(worker.iban.substr(4, 4));
|
||||
let filter = { where: { id: bankEntityId } };
|
||||
|
||||
const { data } = await axios.get(`BankEntities`, { params: { filter } });
|
||||
worker.bankEntityFk = data?.[0]?.id ?? undefined;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSearchbar
|
||||
|
@ -110,11 +146,6 @@ function uppercaseStreetModel(data) {
|
|||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Workers/search"
|
||||
@on-fetch="(data) => (workersOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Paymethods"
|
||||
@on-fetch="(data) => (payMethodsOptions = data)"
|
||||
|
@ -131,6 +162,7 @@ function uppercaseStreetModel(data) {
|
|||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
v-if="defaultPayMethod"
|
||||
ref="tableRef"
|
||||
data-key="Worker"
|
||||
url="Workers/filter"
|
||||
|
@ -139,6 +171,8 @@ function uppercaseStreetModel(data) {
|
|||
title: t('Create worker'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {
|
||||
payMethodFk: defaultPayMethod,
|
||||
companyFk: user.companyFk,
|
||||
isFreelance: false,
|
||||
},
|
||||
}"
|
||||
|
@ -149,7 +183,7 @@ function uppercaseStreetModel(data) {
|
|||
auto-load
|
||||
>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<div class="q-pa-lg full-width" style="max-width: 1200px">
|
||||
<div class="q-pa-lg full-width">
|
||||
<VnRadio
|
||||
v-model="data.isFreelance"
|
||||
:val="false"
|
||||
|
@ -163,10 +197,16 @@ function uppercaseStreetModel(data) {
|
|||
@update:model-value="delete data.payMethodFk"
|
||||
/>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.firstName" :label="t('worker.create.name')" />
|
||||
<VnInput
|
||||
next
|
||||
v-model="data.firstName"
|
||||
:label="t('worker.create.name')"
|
||||
@update:model-value="generateCodeUser(data)"
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.lastNames"
|
||||
:label="t('worker.create.lastName')"
|
||||
@update:model-value="generateCodeUser(data)"
|
||||
/>
|
||||
<VnInput v-model="data.code" :label="t('worker.create.code')" />
|
||||
</VnRow>
|
||||
|
@ -189,7 +229,7 @@ function uppercaseStreetModel(data) {
|
|||
<VnSelect
|
||||
:label="t('worker.create.boss')"
|
||||
v-model="data.bossFk"
|
||||
:options="workersOptions"
|
||||
url="Workers/search"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -254,6 +294,7 @@ function uppercaseStreetModel(data) {
|
|||
v-model="data.iban"
|
||||
:label="t('worker.create.iban')"
|
||||
:disable="data.isFreelance"
|
||||
@update:model-value="autofillBic(data)"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
|
@ -272,6 +313,8 @@ function uppercaseStreetModel(data) {
|
|||
hide-selected
|
||||
:roles-allowed-to-create="['salesAssistant', 'hr']"
|
||||
:disable="data.isFreelance"
|
||||
@update:model-value="autofillBic(data)"
|
||||
:filter-options="['bic', 'name']"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
|
|
|
@ -10,11 +10,6 @@ const { t } = useI18n();
|
|||
const route = useRoute();
|
||||
|
||||
const routeName = computed(() => route.name);
|
||||
const customRouteRedirectName = computed(() => {
|
||||
if (routeName.value === 'ZoneLocations') return null;
|
||||
return routeName.value;
|
||||
});
|
||||
const searchbarMakeFetch = computed(() => routeName.value !== 'ZoneEvents');
|
||||
const searchBarDataKeys = {
|
||||
ZoneWarehouses: 'ZoneWarehouses',
|
||||
ZoneSummary: 'ZoneSummary',
|
||||
|
|
|
@ -11,7 +11,7 @@ export default {
|
|||
component: RouterView,
|
||||
redirect: { name: 'InvoiceInMain' },
|
||||
menus: {
|
||||
main: ['InvoiceInList'],
|
||||
main: ['InvoiceInList', 'InvoiceInSerial'],
|
||||
card: [
|
||||
'InvoiceInBasicData',
|
||||
'InvoiceInVat',
|
||||
|
@ -37,6 +37,16 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/InvoiceIn/InvoiceInList.vue'),
|
||||
},
|
||||
{
|
||||
path: 'serial',
|
||||
name: 'InvoiceInSerial',
|
||||
meta: {
|
||||
title: 'serial',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () =>
|
||||
import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
|
||||
},
|
||||
{
|
||||
path: 'create',
|
||||
name: 'InvoiceInCreare',
|
||||
|
|
|
@ -19,6 +19,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
maxShipped: null,
|
||||
clientId: null,
|
||||
printer: null,
|
||||
serialType: null,
|
||||
},
|
||||
addresses: [],
|
||||
minInvoicingDate: null,
|
||||
|
@ -100,6 +101,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
maxShipped: new Date(formData.maxShipped),
|
||||
clientId: formData.clientId ? formData.clientId : null,
|
||||
companyFk: formData.companyFk,
|
||||
serialType: formData.serialType,
|
||||
};
|
||||
|
||||
this.validateMakeInvoceParams(params, clientsToInvoice);
|
||||
|
@ -152,7 +154,13 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
);
|
||||
throw new Error('Invoice date in the future');
|
||||
}
|
||||
|
||||
if (!params.serialType) {
|
||||
notify(
|
||||
'invoiceOut.globalInvoices.errors.chooseValidSerialType',
|
||||
'negative'
|
||||
);
|
||||
throw new Error('Invalid Serial Type');
|
||||
}
|
||||
if (!params.companyFk) {
|
||||
notify('invoiceOut.globalInvoices.errors.chooseValidCompany', 'negative');
|
||||
throw new Error('Invalid company');
|
||||
|
@ -180,6 +188,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
invoiceDate: new Date(formData.invoiceDate),
|
||||
maxShipped: new Date(formData.maxShipped),
|
||||
companyFk: formData.companyFk,
|
||||
serialType: formData.serialType,
|
||||
};
|
||||
|
||||
this.status = 'invoicing';
|
||||
|
@ -191,12 +200,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
this.addressIndex++;
|
||||
this.isInvoicing = false;
|
||||
} catch (err) {
|
||||
if (
|
||||
err &&
|
||||
err.response &&
|
||||
err.response.status >= 400 &&
|
||||
err.response.status < 500
|
||||
) {
|
||||
if (err?.response?.status >= 400 && err?.response?.status < 500) {
|
||||
this.invoiceClientError(address, err.response?.data?.error?.message);
|
||||
return;
|
||||
} else {
|
||||
|
@ -243,7 +247,7 @@ export const useInvoiceOutGlobalStore = defineStore({
|
|||
params,
|
||||
});
|
||||
|
||||
if (data.data && data.data.error) throw new Error();
|
||||
if (data?.data?.error) throw new Error();
|
||||
|
||||
const status = exportFile('negativeBases.csv', data, {
|
||||
encoding: 'windows-1252',
|
||||
|
|
|
@ -10,12 +10,13 @@ describe('Route', () => {
|
|||
|
||||
it('Route list create route', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.get('input[name="description"]').eq(1).type('routeTestOne{enter}');
|
||||
cy.get('input[name="description"]').type('routeTestOne{enter}');
|
||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||
cy.url().should('include', '/summary');
|
||||
});
|
||||
|
||||
it('Route list search and edit', () => {
|
||||
cy.get('#searchbar input').type('{enter}');
|
||||
cy.get('input[name="description"]').type('routeTestOne{enter}');
|
||||
cy.get('.q-table tr')
|
||||
.its('length')
|
||||
|
|
|
@ -2,6 +2,9 @@ describe('WorkerCreate', () => {
|
|||
const externalRadio = '.q-radio:nth-child(2)';
|
||||
const notification = '.q-notification__message';
|
||||
const developerBossId = 120;
|
||||
const payMethodCross =
|
||||
'.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)';
|
||||
const saveBtn = '.q-mt-lg > .q-btn--standard';
|
||||
|
||||
const internal = {
|
||||
Fi: { val: '78457139E' },
|
||||
|
@ -36,7 +39,8 @@ describe('WorkerCreate', () => {
|
|||
|
||||
it('should throw an error if a pay method has not been selected', () => {
|
||||
cy.fillInForm(internal);
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
cy.get(payMethodCross).click();
|
||||
cy.get(saveBtn).click();
|
||||
cy.get(notification).should('contains.text', 'Payment method is required');
|
||||
});
|
||||
|
||||
|
@ -45,14 +49,14 @@ describe('WorkerCreate', () => {
|
|||
...internal,
|
||||
'Pay method': { val: 'PayMethod one', type: 'select' },
|
||||
});
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
cy.get(saveBtn).click();
|
||||
cy.get(notification).should('contains.text', 'Data created');
|
||||
});
|
||||
|
||||
it('should create an external', () => {
|
||||
cy.get(externalRadio).click();
|
||||
cy.fillInForm(external);
|
||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
||||
cy.get(saveBtn).click();
|
||||
cy.get(notification).should('contains.text', 'Data created');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue