0
0
Fork 0

Merge branch 'dev' into 7884-AddLabelerField

This commit is contained in:
Jon Elias 2024-09-20 08:24:39 +00:00
commit d7fb8bdaf5
55 changed files with 309 additions and 231 deletions

View File

@ -2,9 +2,15 @@ import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin';
import mainShortcutMixin from './mainShortcutMixin';
import keyShortcut from './keyShortcut';
import useNotify from 'src/composables/useNotify.js';
const { notify } = useNotify();
export default boot(({ app }) => {
app.mixin(qFormMixin);
app.mixin(mainShortcutMixin);
app.directive('shortcut', keyShortcut);
app.config.errorHandler = function (err) {
console.error(err);
notify('globals.error', 'negative', 'error');
};
});

View File

@ -297,11 +297,12 @@ const removeTag = (index, params, search) => {
/>
</QItem>
<QItem class="q-mt-lg">
<QIcon
name="add_circle"
<QBtn
icon="add_circle"
shortcut="+"
flat
class="fill-icon-on-hover q-px-xs"
color="primary"
size="sm"
@click="tagValues.push({})"
/>
</QItem>

View File

@ -69,10 +69,7 @@ const $props = defineProps({
type: Boolean,
default: false,
},
disableInfiniteScroll: {
type: Boolean,
default: false,
},
hasSubToolbar: {
type: Boolean,
default: null,
@ -305,6 +302,7 @@ defineExpose({
redirect: redirectFn,
selected,
CrudModelRef,
params,
});
function handleOnDataSaved(_) {
@ -372,9 +370,7 @@ function handleOnDataSaved(_) {
ref="CrudModelRef"
@on-fetch="(...args) => emit('onFetch', ...args)"
:search-url="searchUrl"
:disable-infinite-scroll="
$attrs['disableInfiniteScroll'] ? isTableMode : !disableInfiniteScroll
"
:disable-infinite-scroll="isTableMode"
@save-changes="reload"
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']"
@ -394,7 +390,7 @@ function handleOnDataSaved(_) {
card-container-class="grid-three"
flat
:style="isTableMode && `max-height: ${tableHeight}`"
:virtual-scroll="!isTableMode"
:virtual-scroll="isTableMode"
@virtual-scroll="
(event) =>
event.index > rows.length - 2 &&

View File

@ -400,7 +400,14 @@ defineExpose({
/>
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn fab color="primary" icon="add" @click="showFormDialog()" class="fill-icon">
<QBtn
fab
color="primary"
icon="add"
shortcut="+"
@click="showFormDialog()"
class="fill-icon"
>
<QTooltip>
{{ t('Upload file') }}
</QTooltip>

View File

@ -0,0 +1,52 @@
<script setup>
import { onBeforeMount, ref, useAttrs } from 'vue';
import axios from 'axios';
import VnSelect from 'components/common/VnSelect.vue';
const { schema, table, column, translation, defaultOptions } = defineProps({
schema: {
type: String,
default: 'vn',
},
table: {
type: String,
required: true,
},
column: {
type: String,
required: true,
},
translation: {
type: Function,
default: null,
},
defaultOptions: {
type: Array,
default: () => [],
},
});
const $attrs = useAttrs();
const options = ref([]);
onBeforeMount(async () => {
options.value = [].concat(defaultOptions);
const { data } = await axios.get(`Applications/get-enum-values`, {
params: { schema, table, column },
});
for (const value of data)
options.value.push({
[$attrs['option-value'] ?? 'id']: value,
[$attrs['option-label'] ?? 'name']: translation ? translation(value) : value,
});
});
</script>
<template>
<VnSelect
v-bind="$attrs"
:options="options"
:key="options.length"
:input-debounce="0"
/>
</template>

View File

@ -268,6 +268,7 @@ input::-webkit-inner-spin-button {
max-width: 400px;
}
}
.edit-photo-btn {
position: absolute;
right: 12px;
@ -280,3 +281,10 @@ input::-webkit-inner-spin-button {
color: var(--vn-label-color);
text-transform: uppercase;
}
.q-date {
&__today {
border: 2px solid $info;
color: $info;
}
}

View File

@ -104,6 +104,7 @@ globals:
ticket: Ticket
campaign: Campaign
weight: Weight
error: Ups! Something went wrong
pageTitles:
logIn: Login
addressEdit: Update address

View File

@ -106,6 +106,7 @@ globals:
ticket: Ticket
campaign: Campaña
weight: Peso
error: ¡Ups! Algo salió mal
pageTitles:
logIn: Inicio de sesión
addressEdit: Modificar consignatario

View File

@ -2,6 +2,7 @@
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { ref, watch } from 'vue';
@ -24,7 +25,7 @@ watch(
<template>
<FormModel
ref="formModelRef"
:url="`VnUsers/preview`"
url="VnUsers/preview"
:url-update="`VnUsers/${route.params.id}/update-user`"
:filter="accountFilter"
model="Accounts"
@ -43,6 +44,15 @@ watch(
option-value="code"
option-label="code"
/>
<VnSelectEnum
schema="account"
table="user"
column="twoFactor"
v-model="data.twoFactor"
:label="t('account.card.twoFactor')"
option-value="code"
option-label="code"
/>
</div>
</template>
</FormModel>

View File

@ -142,7 +142,13 @@ const redirectToRoleSummary = (id) =>
<SubRoleCreateForm @on-submit-create-subrole="createSubRole" />
</QDialog>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn fab icon="add" color="primary" @click="openCreateSubRoleForm()">
<QBtn
fab
icon="add"
shortcut="+"
color="primary"
@click="openCreateSubRoleForm()"
>
<QTooltip>{{ t('warehouses.add') }}</QTooltip>
</QBtn>
</QPageSticky>

View File

@ -35,6 +35,7 @@ account:
willDeactivated: User will be deactivated
activated: User activated!
deactivated: User deactivated!
twoFactor: Two factor
actions:
setPassword: Set password
disableAccount:

View File

@ -32,6 +32,7 @@ account:
activated: ¡Usuario activado!
deactivated: ¡Usuario desactivado!
newUser: Nuevo usuario
twoFactor: Doble factor
privileges:
delegate: Puede delegar privilegios
actions:

View File

@ -3,58 +3,18 @@ import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import axios from 'axios';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
const route = useRoute();
const { t } = useI18n();
const claimStates = ref([]);
const claimStatesCopy = ref([]);
const optionsList = ref([]);
const workersOptions = ref([]);
function setClaimStates(data) {
claimStates.value = data;
claimStatesCopy.value = data;
}
async function getEnumValues() {
optionsList.value = [{ id: null, description: t('claim.null') }];
const { data } = await axios.get(`Applications/get-enum-values`, {
params: {
schema: 'vn',
table: 'claim',
column: 'pickup',
},
});
for (let value of data)
optionsList.value.push({ id: value, description: t(`claim.${value}`) });
}
getEnumValues();
const statesFilter = {
options: claimStates,
filterFn: (options, value) => {
const search = value.toLowerCase();
if (value === '') return claimStatesCopy.value;
return options.value.filter((row) => {
const description = row.description.toLowerCase();
return description.indexOf(search) > -1;
});
},
};
</script>
<template>
<FetchData
@ -70,7 +30,7 @@ const statesFilter = {
auto-load
:reload="true"
>
<template #form="{ data, validate, filter }">
<template #form="{ data, validate }">
<VnRow>
<VnInput
v-model="data.client.name"
@ -101,20 +61,14 @@ const statesFilter = {
/>
</template>
</VnSelect>
<QSelect
<VnSelect
v-model="data.claimStateFk"
:options="claimStates"
option-value="id"
option-label="description"
emit-value
url="ClaimStates"
:label="t('claim.state')"
map-options
use-input
@filter="(value, update) => filter(value, update, statesFilter)"
option-label="description"
:rules="validate('claim.claimStateFk')"
:input-debounce="0"
>
</QSelect>
/>
</VnRow>
<VnRow>
<QInput
@ -123,16 +77,14 @@ const statesFilter = {
:rules="validate('claim.packages')"
type="number"
/>
<QSelect
<VnSelectEnum
v-model="data.pickup"
:options="optionsList"
option-value="id"
option-label="description"
emit-value
:label="t('claim.pickup')"
map-options
use-input
:input-debounce="0"
table="claim"
column="pickup"
option-label="description"
:translation="(value) => t(`claim.${value}`)"
:default-options="[{ id: null, description: t('claim.null') }]"
/>
</VnRow>
</template>

View File

@ -317,7 +317,7 @@ async function saveWhenHasChanges() {
</div>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn fab color="primary" icon="add" @click="showImportDialog()" />
<QBtn fab color="primary" shortcut="+" icon="add" @click="showImportDialog()" />
</QPageSticky>
</template>

View File

@ -246,7 +246,13 @@ function onDrag() {
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<label for="fileInput">
<QBtn fab @click="inputFile.nativeEl.click()" icon="add" color="primary">
<QBtn
fab
@click="inputFile.nativeEl.click()"
shortcut="+"
icon="add"
color="primary"
>
<QInput
ref="inputFile"
type="file"

View File

@ -56,17 +56,18 @@ const customerContactsRef = ref(null);
</div>
</VnRow>
<VnRow>
<QIcon
<QBtn
@click="customerContactsRef.insert()"
class="cursor-pointer"
color="primary"
name="add"
size="sm"
flat
icon="add"
shortcut="+"
>
<QTooltip>
{{ t('Add contact') }}
</QTooltip>
</QIcon>
</QBtn>
</VnRow>
</QCard>
</template>

View File

@ -236,6 +236,7 @@ const toCustomerFileManagementCreate = () => {
@click.stop="toCustomerFileManagementCreate()"
color="primary"
fab
shortcut="+"
icon="add"
/>
<QTooltip>

View File

@ -99,7 +99,13 @@ const tableRef = ref();
</VnTable>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerSamplesCreate()" color="primary" fab icon="add" />
<QBtn
@click.stop="toCustomerSamplesCreate()"
color="primary"
fab
icon="add"
shortcut="+"
/>
<QTooltip>
{{ t('Send sample') }}
</QTooltip>

View File

@ -272,16 +272,17 @@ function handleLocation(data, location) {
</div>
</VnRow>
<QIcon
<QBtn
@click.stop="addNote()"
class="cursor-pointer add-icon q-mt-md"
name="add"
size="sm"
flat
icon="add"
shortcut="+"
>
<QTooltip>
{{ t('Add note') }}
</QTooltip>
</QIcon>
</QBtn>
</template>
</FormModel>
</template>

View File

@ -35,6 +35,7 @@ const filter = {
],
where: { clientFk: route.params.id },
order: ['shipped DESC', 'id'],
limit: 30,
};
const columns = computed(() => [
@ -149,7 +150,6 @@ const setShippedColor = (date) => {
auto-load
order="shipped DESC, id"
:disable-option="{ card: true, table: true }"
limit="5"
class="full-width"
:disable-infinite-scroll="true"
>

View File

@ -138,7 +138,13 @@ const columns = computed(() => [
</template>
</CrudModel>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn fab color="primary" icon="add" @click="entryObservationsRef.insert()" />
<QBtn
fab
color="primary"
icon="add"
shortcut="+"
@click="entryObservationsRef.insert()"
/>
</QPageSticky>
</template>
<i18n>

View File

@ -281,6 +281,7 @@ async function onSubmit() {
v-else
icon="add_circle"
round
shortcut="+"
padding="xs"
@click="setCreateDms()"
>

View File

@ -230,7 +230,7 @@ async function insert() {
</template>
</CrudModel>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn color="primary" icon="add" size="lg" round @click="insert" />
<QBtn color="primary" icon="add" shortcut="+" size="lg" round @click="insert" />
</QPageSticky>
</template>
<style lang="scss" scoped>

View File

@ -224,6 +224,7 @@ const formatOpt = (row, { model, options }, prop) => {
<QBtn
color="primary"
icon="add"
shortcut="+"
size="lg"
round
@click="invoiceInFormRef.insert()"

View File

@ -405,6 +405,7 @@ const formatOpt = (row, { model, options }, prop) => {
color="primary"
icon="add"
size="lg"
shortcut="+"
round
@click="invoiceInFormRef.insert()"
>

View File

@ -65,17 +65,18 @@ const focusLastInput = () => {
</QTooltip>
</QIcon>
</div>
<QIcon
<QBtn
@click="insertRow()"
class="cursor-pointer fill-icon-on-hover"
color="primary"
name="add_circle"
size="sm"
icon="add_circle"
shortcut="+"
flat
>
<QTooltip>
{{ t('Add barcode') }}
</QTooltip>
</QIcon>
</QBtn>
</QCard>
</template>
</CrudModel>

View File

@ -168,19 +168,20 @@ const insertTag = (rows) => {
</div>
</VnRow>
<VnRow class="justify-center items-center">
<QIcon
<QBtn
@click="insertTag(rows)"
class="cursor-pointer"
:disable="!validRow"
color="primary"
name="add"
size="sm"
flat
icon="add"
shortcut="+"
style="flex: 0"
>
<QTooltip>
{{ t('itemTags.addTag') }}
</QTooltip>
</QIcon>
</QBtn>
</VnRow>
</QCard>
</template>

View File

@ -212,6 +212,7 @@ const decrement = (paramsObj, key) => {
flat
dense
size="12px"
shortcut="+"
@click="add(params, 'scopeDays')"
/>
<QBtn

View File

@ -11,7 +11,7 @@ import FetchData from 'src/components/FetchData.vue';
import { dateRange } from 'src/filters';
defineProps({ dataKey: { type: String, required: true } });
const { t } = useI18n();
const { t, te } = useI18n();
const warehouses = ref();
const groupedStates = ref();
@ -26,6 +26,12 @@ const handleScopeDays = (params, days, callback) => {
}
if (callback) callback();
};
const getLocale = (label) => {
const param = label.split('.').at(-1);
const globalLocale = `globals.params.${param}`;
return te(globalLocale) ? t(globalLocale) : t(`params.${param}`);
};
</script>
<template>
<FetchData url="Warehouses" auto-load @on-fetch="(data) => (warehouses = data)" />
@ -43,10 +49,11 @@ const handleScopeDays = (params, days, callback) => {
:hidden-tags="['from', 'to', 'search']"
:custom-tags="['scopeDays']"
:unremovable-params="['from', 'to', 'scopeDays']"
search-url="saleMonitorTickets"
>
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong v-text="`${t(`params.${tag.label}`)}:`" />
<strong v-text="`${getLocale(tag.label)}:`" />
<span v-text="formatFn(tag.value)" />
</div>
</template>
@ -110,7 +117,7 @@ const handleScopeDays = (params, days, callback) => {
url="Workers/search"
:params="{ departmentCodes: ['VT'] }"
is-outlined
option-value="code"
option-value="id"
option-label="name"
:no-one="true"
>

View File

@ -374,8 +374,10 @@ function addOrder(value, field, params) {
/>
</QItem>
<QItem class="q-mt-lg">
<QIcon
name="add_circle"
<QBtn
icon="add_circle"
shortcut="+"
flat
class="filter-icon"
@click="tagValues.push({})"
/>

View File

@ -88,7 +88,7 @@ async function deleteWorCenter(id) {
</VnPaginate>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add">
<QBtn @click.stop="dialog.show()" color="primary" fab shortcut="+" icon="add">
<QDialog ref="dialog">
<FormModelPopup
:title="t('Add work center')"

View File

@ -103,8 +103,8 @@ es:
Roadmap: Troncal
ETD date: Fecha ETD
ETD hour: Hora ETD
Tractor plate: Matrícula tractor
Trailer plate: Matrícula trailer
Tractor plate: Matrícula tractora
Trailer plate: Matrícula remolque
Carrier: Transportista
Price: Precio
Driver name: Nombre del conductor

View File

@ -164,8 +164,8 @@ en:
to: To
es:
params:
tractorPlate: Matrícula del tractor
trailerPlate: Matrícula del trailer
tractorPlate: Matrícula tractora
trailerPlate: Matrícula remolque
supplierFk: Transportista
price: Precio
driverName: Nombre del conductor
@ -174,8 +174,8 @@ es:
to: Hasta
From: Desde
To: Hasta
Tractor Plate: Matrícula del tractor
Trailer Plate: Matrícula del trailer
Tractor Plate: Matrícula tractora
Trailer Plate: Matrícula remolque
Carrier: Transportista
Price: Precio
Driver name: Nombre del conductor

View File

@ -65,9 +65,10 @@ const updateDefaultStop = (data) => {
</div>
</QCardSection>
<QCardSection>
<QIcon
name="add"
size="sm"
<QBtn
flat
icon="add"
shortcut="+"
class="cursor-pointer"
color="primary"
@click="roadmapStopsCrudRef.insert()"
@ -75,7 +76,7 @@ const updateDefaultStop = (data) => {
<QTooltip>
{{ t('Add stop') }}
</QTooltip>
</QIcon>
</QBtn>
</QCardSection>
</QCard>
</template>

View File

@ -149,8 +149,8 @@ const filter = {
<i18n>
es:
Carrier: Transportista
Tractor Plate: Matrícula tractor
Trailer Plate: Matrícula trailer
Tractor Plate: Matrícula tractora
Trailer Plate: Matrícula remolque
Phone: Teléfono
Worker: Trabajador
Observations: Observaciones

View File

@ -237,4 +237,5 @@ es:
Price: Precio
Observations: Observaciones
Preview: Vista previa
Select the estimated date of departure (ETD): Selecciona la fecha estimada de salida
</i18n>

View File

@ -396,7 +396,7 @@ const openSmsDialog = async () => {
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="openTicketsDialog">
<QBtn fab icon="add" shortcut="+" color="primary" @click="openTicketsDialog">
<QTooltip>
{{ t('Add ticket') }}
</QTooltip>

View File

@ -102,9 +102,7 @@ const setWireTransfer = async () => {
<VnInput :label="t('supplier.accounts.iban')" v-model="row.iban">
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{
t('components.iban_tooltip')
}}</QTooltip>
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
</QIcon>
</template>
</VnInput>
@ -165,9 +163,10 @@ const setWireTransfer = async () => {
</div>
</VnRow>
<VnRow>
<QIcon
name="add"
size="sm"
<QBtn
flat
icon="add"
shortcut="+"
class="cursor-pointer"
color="primary"
@click="supplierAccountRef.insert()"
@ -175,7 +174,7 @@ const setWireTransfer = async () => {
<QTooltip>
{{ t('Add account') }}
</QTooltip>
</QIcon>
</QBtn>
</VnRow>
</QCard>
</template>

View File

@ -84,9 +84,10 @@ const insertRow = () => {
</VnRow>
</QCardSection>
<VnRow>
<QIcon
name="add"
size="sm"
<QBtn
flat
icon="add"
shortcut="+"
class="cursor-pointer"
color="primary"
@click="insertRow()"
@ -94,7 +95,7 @@ const insertRow = () => {
<QTooltip>
{{ t('Add contact') }}
</QTooltip>
</QIcon>
</QBtn>
</VnRow>
</QCard>
</template>

View File

@ -109,7 +109,7 @@ const getEntryQueryParams = (supplier) => {
:subtitle="data.subtitle"
:filter="filter"
@on-fetch="setData"
data-key="supplier"
data-key="supplierDescriptor"
:summary="$props.summary"
>
<template #body="{ entity }">

View File

@ -19,8 +19,8 @@ const sageTransactionTypesOptions = ref([]);
const supplierActivitiesOptions = ref([]);
function handleLocation(data, location) {
const { town, label, provinceFk, countryFk } = location ?? {};
data.postCode = label;
const { town, code, provinceFk, countryFk } = location ?? {};
data.postCode = code;
data.city = town;
data.provinceFk = provinceFk;
data.countryFk = countryFk;

View File

@ -87,17 +87,18 @@ watch(
</QIcon>
</div>
<VnRow v-if="observationTypes.length > rows.length">
<QIcon
name="add_circle"
<QBtn
icon="add_circle"
shortcut="+"
flat
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="ticketNotesCrudRef.insert()"
>
<QTooltip>
{{ t('ticketNotes.addNote') }}
</QTooltip>
</QIcon>
</QBtn>
</VnRow>
</QCard>
</template>

View File

@ -114,17 +114,20 @@ watch(
</QTooltip>
</QIcon>
</div>
<QIcon
name="add_circle"
class="fill-icon-on-hover q-ml-md"
size="sm"
color="primary"
@click="ticketPackagingsCrudRef.insert()"
>
<QTooltip>
{{ t('package.addPackage') }}
</QTooltip>
</QIcon>
<VnRow>
<QBtn
icon="add_circle"
shortcut="+"
flat
class="fill-icon-on-hover q-ml-md"
color="primary"
@click="ticketPackagingsCrudRef.insert()"
>
<QTooltip>
{{ t('package.addPackage') }}
</QTooltip>
</QBtn>
</VnRow>
</QCard>
</template>
</CrudModel>

View File

@ -735,6 +735,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
size="md"
round
flat
shortcut="+"
:disable="!isTicketEditable"
@click="insertRow()"
>
@ -746,7 +747,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTable>
<QPageSticky :offset="[20, 20]">
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" />
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" shortcut="+" />
<QTooltip class="text-no-wrap">
{{ t('Add item to basket') }}
</QTooltip>

View File

@ -184,6 +184,12 @@ const columns = computed(() => [
</template>
</CrudModel>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn fab color="primary" icon="add" @click="ticketServiceCrudRef.insert()" />
<QBtn
fab
color="primary"
icon="add"
@click="ticketServiceCrudRef.insert()"
shortcut="+"
/>
</QPageSticky>
</template>

View File

@ -112,6 +112,7 @@ warehouses();
<template #append>
<QBtn
icon="add"
shortcut="+"
flat
dense
size="12px"

View File

@ -11,6 +11,9 @@ import TravelSummary from './Card/TravelSummary.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { toDate } from 'src/filters';
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
import { dateRange } from 'src/filters';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
const { viewSummary } = useSummaryDialog();
const router = useRouter();
const { t } = useI18n();
@ -24,11 +27,27 @@ const $props = defineProps({
},
});
const entityId = computed(() => $props.id || route.params.id);
onMounted(async () => {
stateStore.rightDrawer = true;
handleScopeDays();
});
const cloneTravel = (travelData) => {
const stringifiedTravelData = JSON.stringify(travelData);
redirectToCreateView(stringifiedTravelData);
};
function handleScopeDays(days = 7) {
days = +days;
tableRef.value.params.scopeDays = days;
const [landedFrom, landedTo] = dateRange(Date.vnNew());
landedTo.setDate(landedTo.getDate() + days);
tableRef.value.params.landedFrom = landedFrom;
tableRef.value.params.landedTo = landedTo;
}
const redirectToCreateView = (queryParams) => {
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
};
@ -37,10 +56,6 @@ const redirectCreateEntryView = (travelData) => {
router.push({ name: 'EntryCreate', query: { travelFk: travelData.id } });
};
onMounted(async () => {
stateStore.rightDrawer = true;
});
const columns = computed(() => [
{
align: 'left',
@ -241,6 +256,17 @@ const columns = computed(() => [
:class="{ 'is-active': row.isReceived }"
/>
</template>
<template #moreFilterPanel="{ params }">
<VnInputNumber
:label="t('params.scopeDays')"
v-model.number="params.scopeDays"
@keyup.enter="(evt) => handleScopeDays(evt.target.value)"
@remove="handleScopeDays()"
class="q-px-xs q-pr-lg"
filled
dense
/>
</template>
</VnTable>
</template>

View File

@ -103,7 +103,7 @@ async function remove(row) {
url-create="WagonTypes"
model="WagonType"
:form-initial-data="initialData"
@on-data-saved="window.location.reload()"
@on-data-saved="tableRef.reload()"
auto-load
>
<template #form-inputs="{ data }">

View File

@ -5,7 +5,7 @@ import { useArrayData } from 'src/composables/useArrayData';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import VnTable from 'src/components/VnTable/VnTable.vue';
import { computed } from 'vue';
import { computed, ref } from 'vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
@ -14,7 +14,7 @@ const arrayData = useArrayData('WagonList');
const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
const tableRef = ref();
const filter = {
include: {
relation: 'type',
@ -107,9 +107,7 @@ async function remove(row) {
:create="{
urlCreate: 'Wagons',
title: t('Create new wagon'),
onDataSaved: () => {
window.location.reload();
},
onDataSaved: () => tableRef.reload(),
formInitialData: {},
}"
>

View File

@ -152,7 +152,11 @@ const refetch = async () => await cardDescriptorRef.value.getData();
</template>
<template #body="{ entity }">
<VnLv :label="t('worker.card.user')" :value="entity.user?.name" />
<VnLv :label="t('worker.card.email')" :value="entity.user?.email" copy />
<VnLv
:label="t('worker.card.email')"
:value="entity.user?.emailUser?.email"
copy
/>
<VnLv
:label="t('worker.list.department')"
:value="entity.department ? entity.department.department.name : null"

View File

@ -1,9 +1,9 @@
<script setup>
import { ref, onMounted, computed } from 'vue';
import { ref, onBeforeMount, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { dashIfEmpty, toDate } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CardSummary from 'components/ui/CardSummary.vue';
@ -11,6 +11,7 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import RoleDescriptorProxy from 'src/pages/Account/Role/Card/RoleDescriptorProxy.vue';
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
import { useRole } from 'src/composables/useRole';
const route = useRoute();
const { t } = useI18n();
@ -23,64 +24,27 @@ const $props = defineProps({
});
const entityId = computed(() => $props.id || route.params.id);
const workerUrl = ref();
const basicDataUrl = ref(null);
const isHr = computed(() => useRole().hasAny(['hr']));
const advancedSummary = ref();
onMounted(async () => {
workerUrl.value = (await getUrl('')) + `worker/${entityId.value}/`;
onBeforeMount(async () => {
if (isHr.value) {
advancedSummary.value = (
await axios.get('Workers/advancedSummary', {
params: { filter: { where: { id: entityId.value } } },
})
).data[0];
basicDataUrl.value = `#/worker/${entityId.value}/basic-data`;
}
});
const filter = {
include: [
{
relation: 'user',
scope: {
fields: ['name', 'nickname', 'roleFk'],
include: [
{
relation: 'role',
scope: {
fields: ['name'],
},
},
{
relation: 'emailUser',
scope: {
fields: ['email'],
},
},
],
},
},
{
relation: 'department',
scope: {
include: {
relation: 'department',
scope: {
fields: ['name'],
},
},
},
},
{
relation: 'boss',
},
{
relation: 'client',
},
{
relation: 'sip',
},
],
};
</script>
<template>
<CardSummary
ref="summary"
:url="`Workers/${entityId}`"
:filter="filter"
:url="`Workers/summary`"
:filter="{ where: { id: entityId } }"
data-key="WorkerSummary"
>
<template #header="{ entity }">
@ -88,10 +52,7 @@ const filter = {
</template>
<template #body="{ entity: worker }">
<QCard class="vn-one">
<VnTitle
:url="`#/worker/${entityId}/basic-data`"
:text="t('worker.summary.basicData')"
/>
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
<VnLv :label="t('worker.card.name')" :value="worker.user?.nickname" />
<VnLv :label="t('worker.list.department')">
<template #value>
@ -128,13 +89,9 @@ const filter = {
<VnLinkPhone :phone-number="worker.client?.phone" />
</template>
</VnLv>
<VnLv :label="t('worker.summary.locker')" :value="worker.locker" />
</QCard>
<QCard class="vn-one">
<VnTitle
:url="`#/worker/${entityId}/basic-data`"
:text="t('worker.summary.basicData')"
/>
<QCard class="vn-one" v-if="advancedSummary">
<VnTitle :url="basicDataUrl" :text="t('worker.summary.basicData')" />
<VnLv
:label="t('worker.summary.fiDueDate')"
:value="toDate(worker.fiDueDate)"
@ -162,7 +119,6 @@ const filter = {
</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')"

View File

@ -561,15 +561,16 @@ onMounted(async () => {
<span class="q-mb-md text-sm text-body1">
{{ secondsToHoursMinutes(day.dayData?.workedHours) }}
</span>
<QIcon
name="add_circle"
<QBtn
icon="add_circle"
shortcut="+"
flat
color="primary"
class="fill-icon cursor-pointer"
size="sm"
@click="showWorkerTimeForm(day.dayData?.dated, 'create')"
>
<QTooltip>{{ t('Add time') }}</QTooltip>
</QIcon>
</QBtn>
</div>
</QTd>
</QTr>

View File

@ -180,17 +180,18 @@ function handleEvent(type, event, node) {
{{ t('Remove') }}
</QTooltip>
</QIcon>
<QIcon
name="add"
<QBtn
color="primary"
size="sm"
flat
icon="add"
shortcut="+"
class="cursor-pointer"
@click.stop="showCreateNodeForm(node.id)"
>
<QTooltip>
{{ t('Create') }}
</QTooltip>
</QIcon>
</QBtn>
</div>
</div>
</template>

View File

@ -74,7 +74,7 @@ async function remove(row) {
</VnPaginate>
</div>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn @click="create" fab icon="add" color="primary" />
<QBtn @click="create" fab icon="add" shortcut="+" color="primary" />
</QPageSticky>
</QPage>
</template>

View File

@ -74,7 +74,7 @@ async function remove(row) {
</VnPaginate>
</div>
<QPageSticky position="bottom-right" :offset="[18, 18]">
<QBtn @click="create" fab icon="add" color="primary" />
<QBtn @click="create" fab icon="add" shortcut="+" color="primary" />
</QPageSticky>
</QPage>
</template>