Merge branch 'test' into warmfix_ticketList
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2025-03-02 23:22:18 +01:00
commit 8df6c95640
31 changed files with 349 additions and 149 deletions

View File

@ -95,6 +95,10 @@ const $props = defineProps({
type: [String, Boolean],
default: '800px',
},
onDataSaved: {
type: Function,
default: () => {},
},
});
const emit = defineEmits(['onFetch', 'onDataSaved']);
const modelValue = computed(

View File

@ -32,7 +32,6 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
import VnTableFilter from './VnTableFilter.vue';
import { getColAlign } from 'src/composables/getColAlign';
import RightMenu from '../common/RightMenu.vue';
import { QItemSection } from 'quasar';
const arrayData = useArrayData(useAttrs()['data-key']);
const $props = defineProps({
@ -139,6 +138,10 @@ const $props = defineProps({
createComplement: {
type: Object,
},
dataCy: {
type: String,
default: 'vn-table',
},
});
const { t } = useI18n();
@ -167,7 +170,6 @@ const app = inject('app');
const editingRow = ref(null);
const editingField = ref(null);
const isTableMode = computed(() => mode.value == TABLE_MODE);
const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon);
const selectRegex = /select/;
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
const tableModes = [
@ -255,7 +257,9 @@ function splitColumns(columns) {
col.columnFilter = { inWhere: true, ...col.columnFilter };
splittedColumns.value.columns.push(col);
}
// Status column
splittedColumns.value.create = createOrderSort(splittedColumns.value.create);
if (splittedColumns.value.chips.length) {
splittedColumns.value.columnChips = splittedColumns.value.chips.filter(
(c) => !c.isId,
@ -271,6 +275,24 @@ function splitColumns(columns) {
}
}
function createOrderSort(columns) {
const orderedColumn = columns
.map((column, index) =>
column.createOrder !== undefined ? { ...column, originalIndex: index } : null,
)
.filter((item) => item !== null);
orderedColumn.sort((a, b) => a.createOrder - b.createOrder);
const filteredColumns = columns.filter((col) => col.createOrder === undefined);
orderedColumn.forEach((col) => {
filteredColumns.splice(col.createOrder, 0, col);
});
return filteredColumns;
}
const rowClickFunction = computed(() => {
if ($props.rowClick != undefined) return $props.rowClick;
if ($props.redirect) return ({ id }) => redirectFn(id);
@ -316,8 +338,14 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
if (evt?.shiftKey && added) {
const rowIndex = selectedRows[0].$index;
const selectedIndexes = new Set(selected.value.map((row) => row.$index));
for (const row of rows) {
if (row.$index == rowIndex) break;
const minIndex = selectedIndexes.size
? Math.min(...selectedIndexes, rowIndex)
: 0;
const maxIndex = Math.max(...selectedIndexes, rowIndex);
for (let i = minIndex; i <= maxIndex; i++) {
const row = rows[i];
if (row.$index == rowIndex) continue;
if (!selectedIndexes.has(row.$index)) {
selected.value.push(row);
selectedIndexes.add(row.$index);
@ -340,12 +368,11 @@ function hasEditableFormat(column) {
const clickHandler = async (event) => {
const clickedElement = event.target.closest('td');
const isDateElement = event.target.closest('.q-date');
const isTimeElement = event.target.closest('.q-time');
const isQselectDropDown = event.target.closest('.q-select__dropdown-icon');
const isQSelectDropDown = event.target.closest('.q-select__dropdown-icon');
if (isDateElement || isTimeElement || isQselectDropDown) return;
if (isDateElement || isTimeElement || isQSelectDropDown) return;
if (clickedElement === null) {
await destroyInput(editingRow.value, editingField.value);
@ -584,9 +611,24 @@ function removeTextValue(data, getChanges) {
return data;
}
function handleRowClick(event, row) {
if (event.ctrlKey) return rowCtrlClickFunction.value(event, row);
if (rowClickFunction.value) rowClickFunction.value(row);
}
const rowCtrlClickFunction = computed(() => {
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
if ($props.redirect)
return (evt, { id }) => {
stopEventPropagation(evt);
window.open(`/#/${$props.redirect}/${id}`, '_blank');
};
return () => {};
});
</script>
<template>
<RightMenu v-if="$props.rightSearch">
<RightMenu v-if="$props.rightSearch" :overlay="overlay">
<template #right-panel>
<VnTableFilter
:data-key="$attrs['data-key']"
@ -639,7 +681,7 @@ function removeTextValue(data, getChanges) {
:style="isTableMode && `max-height: ${tableHeight}`"
:virtual-scroll="isTableMode"
@virtual-scroll="handleScroll"
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
@row-click="(event, row) => handleRowClick(event, row)"
@update:selected="emit('update:selected', $event)"
@selection="(details) => handleSelection(details, rows)"
:hide-selected-banner="true"
@ -985,7 +1027,10 @@ function removeTextValue(data, getChanges) {
>
<template #form-inputs="{ data }">
<div :style="createComplement?.containerStyle">
<div>
<div
:style="createComplement?.previousStyle"
v-if="!quasar.screen.xs"
>
<slot name="previous-create-dialog" :data="data" />
</div>
<div class="grid-create" :style="createComplement?.columnGridStyle">
@ -998,7 +1043,10 @@ function removeTextValue(data, getChanges) {
:label="column.label"
>
<VnColumn
:column="column"
:column="{
...column,
...{ disable: column?.createDisable ?? false },
}"
:row="{}"
default="input"
v-model="data[column.name]"

View File

@ -27,30 +27,58 @@ describe('VnTable', () => {
beforeEach(() => (vm.selected = []));
describe('handleSelection()', () => {
const rows = [{ $index: 0 }, { $index: 1 }, { $index: 2 }];
const selectedRows = [{ $index: 1 }];
it('should add rows to selected when shift key is pressed and rows are added except last one', () => {
const rows = [
{ $index: 0 },
{ $index: 1 },
{ $index: 2 },
{ $index: 3 },
{ $index: 4 },
];
it('should add rows to selected when shift key is pressed and rows are added in ascending order', () => {
const selectedRows = [{ $index: 1 }];
vm.handleSelection(
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
rows
rows,
);
expect(vm.selected).toEqual([{ $index: 0 }]);
});
it('should add rows to selected when shift key is pressed and rows are added in descending order', () => {
const selectedRows = [{ $index: 3 }];
vm.handleSelection(
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
rows,
);
expect(vm.selected).toEqual([{ $index: 0 }, { $index: 1 }, { $index: 2 }]);
});
it('should not add rows to selected when shift key is not pressed', () => {
const selectedRows = [{ $index: 1 }];
vm.handleSelection(
{ evt: { shiftKey: false }, added: true, rows: selectedRows },
rows
rows,
);
expect(vm.selected).toEqual([]);
});
it('should not add rows to selected when rows are not added', () => {
const selectedRows = [{ $index: 1 }];
vm.handleSelection(
{ evt: { shiftKey: true }, added: false, rows: selectedRows },
rows
rows,
);
expect(vm.selected).toEqual([]);
});
it('should add all rows between the smallest and largest selected indexes', () => {
vm.selected = [{ $index: 1 }, { $index: 3 }];
const selectedRows = [{ $index: 4 }];
vm.handleSelection(
{ evt: { shiftKey: true }, added: true, rows: selectedRows },
rows,
);
expect(vm.selected).toEqual([{ $index: 1 }, { $index: 3 }, { $index: 2 }]);
});
});
});

View File

@ -11,6 +11,13 @@ const stateStore = useStateStore();
const slots = useSlots();
const hasContent = useHasContent('#right-panel');
defineProps({
overlay: {
type: Boolean,
default: false,
},
});
onMounted(() => {
if ((!slots['right-panel'] && !hasContent.value) || quasar.platform.is.mobile)
stateStore.rightDrawer = false;
@ -34,7 +41,12 @@ onMounted(() => {
</QBtn>
</div>
</Teleport>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256">
<QDrawer
v-model="stateStore.rightDrawer"
side="right"
:width="256"
:overlay="overlay"
>
<QScrollArea class="fit">
<div id="right-panel"></div>
<slot v-if="!hasContent" name="right-panel" />

View File

@ -27,7 +27,7 @@ const checkboxModel = computed({
</script>
<template>
<div>
<QCheckbox v-bind="$attrs" v-on="$attrs" v-model="checkboxModel" />
<QCheckbox v-bind="$attrs" v-model="checkboxModel" />
<QIcon
v-if="info"
v-bind="$attrs"

View File

@ -302,8 +302,6 @@ defineExpose({ opts: myOptions, vnSelectRef });
function handleKeyDown(event) {
if (event.key === 'Tab' && !event.shiftKey) {
event.preventDefault();
const inputValue = vnSelectRef.value?.inputValue;
if (inputValue) {

View File

@ -76,6 +76,15 @@ onBeforeMount(async () => {
);
});
const routeName = computed(() => {
const DESCRIPTOR_PROXY = 'DescriptorProxy';
let name = $props.dataKey;
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
name = name.split(DESCRIPTOR_PROXY)[0];
}
return `${name}Summary`;
});
async function getData() {
store.url = $props.url;
store.filter = $props.filter ?? {};
@ -154,9 +163,7 @@ const toModule = computed(() =>
{{ t('components.smartCard.openSummary') }}
</QTooltip>
</QBtn>
<RouterLink
:to="{ name: `${dataKey}Summary`, params: { id: entity.id } }"
>
<RouterLink :to="{ name: routeName, params: { id: entity.id } }">
<QBtn
class="link"
color="white"

View File

@ -29,7 +29,6 @@ export async function checkEntryLock(entryFk, userFk) {
.dialog({
component: VnConfirm,
componentProps: {
'data-cy': 'entry-lock-confirm',
title: t('entry.lock.title'),
message: t('entry.lock.message', {
userName: data?.user?.nickname,

View File

@ -153,6 +153,7 @@ globals:
maxTemperature: Max
minTemperature: Min
changePass: Change password
setPass: Set password
deleteConfirmTitle: Delete selected elements
changeState: Change state
raid: 'Raid {daysInForward} days'
@ -693,8 +694,10 @@ worker:
machine: Machine
business:
tableVisibleColumns:
id: ID
started: Start Date
ended: End Date
hourlyLabor: Time sheet
company: Company
reasonEnd: Reason for Termination
department: Department
@ -702,6 +705,7 @@ worker:
calendarType: Work Calendar
workCenter: Work Center
payrollCategories: Contract Category
workerBusinessAgreementName: Agreement
occupationCode: Contribution Code
rate: Rate
businessType: Contract Type

View File

@ -157,6 +157,7 @@ globals:
maxTemperature: Máx
minTemperature: Mín
changePass: Cambiar contraseña
setPass: Establecer contraseña
deleteConfirmTitle: Eliminar los elementos seleccionados
changeState: Cambiar estado
raid: 'Redada {daysInForward} días'
@ -769,8 +770,10 @@ worker:
concept: Concepto
business:
tableVisibleColumns:
id: Id
started: Fecha inicio
ended: Fecha fin
hourlyLabor: Ficha
company: Empresa
reasonEnd: Motivo finalización
department: Departamento
@ -781,6 +784,7 @@ worker:
occupationCode: Cotización
rate: Tarifa
businessType: Contrato
workerBusinessAgreementName: Convenio
amount: Salario
basicSalary: Salario transportistas
notes: Notas

View File

@ -25,12 +25,13 @@ const $props = defineProps({
const { t } = useI18n();
const { hasAccount } = toRefs($props);
const { openConfirmationModal } = useVnConfirm();
const arrayData = useArrayData('Account');
const route = useRoute();
const router = useRouter();
const state = useState();
const user = state.getUser();
const { notify } = useQuasar();
const account = computed(() => useArrayData('Account').store.data[0]);
const account = computed(() => arrayData.store.data);
account.value.hasAccount = hasAccount.value;
const entityId = computed(() => +route.params.id);
const hasitManagementAccess = ref();
@ -39,7 +40,7 @@ const isHimself = computed(() => user.value.id === account.value.id);
const url = computed(() =>
isHimself.value
? 'Accounts/change-password'
: `Accounts/${entityId.value}/setPassword`
: `Accounts/${entityId.value}/setPassword`,
);
async function updateStatusAccount(active) {
@ -153,6 +154,7 @@ onMounted(() => {
t('account.card.actions.disableAccount.title'),
t('account.card.actions.disableAccount.subtitle'),
() => deleteAccount(),
() => deleteAccount(),
)
"
>
@ -172,6 +174,7 @@ onMounted(() => {
t('account.card.actions.enableAccount.title'),
t('account.card.actions.enableAccount.subtitle'),
() => updateStatusAccount(true),
() => updateStatusAccount(true),
)
"
>
@ -186,6 +189,7 @@ onMounted(() => {
t('account.card.actions.disableAccount.title'),
t('account.card.actions.disableAccount.subtitle'),
() => updateStatusAccount(false),
() => updateStatusAccount(false),
)
"
>
@ -201,6 +205,7 @@ onMounted(() => {
t('account.card.actions.activateUser.title'),
t('account.card.actions.activateUser.title'),
() => updateStatusUser(true),
() => updateStatusUser(true),
)
"
>
@ -215,6 +220,7 @@ onMounted(() => {
t('account.card.actions.deactivateUser.title'),
t('account.card.actions.deactivateUser.title'),
() => updateStatusUser(false),
() => updateStatusUser(false),
)
"
>

View File

@ -54,6 +54,7 @@ const columns = [
toggleIndeterminate: false,
},
create: true,
createOrder: 12,
width: '25px',
},
{
@ -61,9 +62,10 @@ const columns = [
name: 'workerFk',
component: 'select',
attrs: {
url: 'Workers/search',
url: 'TicketRequests/getItemTypeWorker',
fields: ['id', 'nickname'],
optionLabel: 'nickname',
sortBy: 'nickname ASC',
optionValue: 'id',
},
visible: false,
@ -87,15 +89,6 @@ const columns = [
isEditable: false,
columnFilter: false,
},
{
name: 'entryFk',
isId: true,
visible: false,
isEditable: false,
disable: true,
create: true,
columnFilter: false,
},
{
align: 'center',
label: 'Id',
@ -137,6 +130,7 @@ const columns = [
name: 'itemFk',
visible: false,
create: true,
createOrder: 0,
columnFilter: false,
},
{
@ -160,6 +154,8 @@ const columns = [
name: 'stickers',
component: 'input',
create: true,
createOrder: 1,
attrs: {
positive: false,
},
@ -271,6 +267,7 @@ const columns = [
},
width: '45px',
create: true,
createOrder: 3,
style: getQuantityStyle,
},
{
@ -280,6 +277,7 @@ const columns = [
toolTip: t('Buying value'),
name: 'buyingValue',
create: true,
createOrder: 2,
component: 'number',
attrs: {
positive: false,
@ -312,6 +310,7 @@ const columns = [
toolTip: t('Package'),
name: 'price2',
component: 'number',
createDisable: true,
width: '35px',
create: true,
format: (row) => parseFloat(row['price2']).toFixed(2),
@ -321,6 +320,7 @@ const columns = [
label: t('Box'),
name: 'price3',
component: 'number',
createDisable: true,
cellEvent: {
'update:modelValue': async (value, oldValue, row) => {
row['price2'] = row['price2'] * (value / oldValue);
@ -508,13 +508,14 @@ async function setBuyUltimate(itemFk, data) {
},
});
const buyUltimateData = buyUltimate.data[0];
if (!buyUltimateData) return;
const allowedKeys = columns
.filter((col) => col.create === true)
.map((col) => col.name);
allowedKeys.forEach((key) => {
if (buyUltimateData.hasOwnProperty(key) && key !== 'entryFk') {
if (buyUltimateData?.hasOwnProperty(key) && key !== 'entryFk') {
if (!['stickers', 'quantity'].includes(key)) data[key] = buyUltimateData[key];
}
});
@ -607,6 +608,7 @@ onMounted(() => {
ref="entryBuysRef"
data-key="EntryBuys"
:url="`Entries/${entityId}/getBuyList`"
search-url="EntryBuys"
save-url="Buys/crud"
:disable-option="{ card: true }"
v-model:selected="selectedRows"
@ -636,16 +638,19 @@ onMounted(() => {
isFullWidth: true,
containerStyle: {
display: 'flex',
'flex-wrap': 'wrap',
gap: '16px',
position: 'relative',
height: '500px',
},
columnGridStyle: {
'max-width': '50%',
flex: 1,
'margin-right': '30px',
flex: 1,
},
previousStyle: {
'max-width': '30%',
height: '500px',
},
displayPrevious: true,
}"
:is-editable="editableMode"
:without-header="!editableMode"
@ -660,6 +665,7 @@ onMounted(() => {
auto-load
footer
data-cy="entry-buys"
overlay
>
<template #column-hex="{ row }">
<VnColor :colors="row?.hexJson" style="height: 100%; min-width: 2000px" />

View File

@ -248,7 +248,7 @@ const entryFilterPanel = ref();
<i18n>
en:
params:
isExcludedFromAvailable: Inventory
isExcludedFromAvailable: Is excluded
isOrdered: Ordered
isReceived: Received
isConfirmed: Confirmed

View File

@ -11,6 +11,8 @@ import VnTable from 'components/VnTable/VnTable.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import VnSelectTravelExtended from 'src/components/common/VnSelectTravelExtended.vue';
import { toDate } from 'src/filters';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import EntrySummary from './Card/EntrySummary.vue';
const { t } = useI18n();
const tableRef = ref();
@ -18,6 +20,7 @@ const defaultEntry = ref({});
const state = useState();
const user = state.getUser();
const dataKey = 'EntryList';
const { viewSummary } = useSummaryDialog();
const entryQueryFilter = {
include: [
@ -222,6 +225,19 @@ const columns = computed(() => [
visible: false,
create: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('components.smartCard.viewSummary'),
icon: 'preview',
isPrimary: true,
action: (row) => viewSummary(row.id, EntrySummary, 'xlg-width'),
},
],
},
]);
function getBadgeAttrs(row) {
const date = row.landed;
@ -267,16 +283,7 @@ onBeforeMount(async () => {
</script>
<template>
<VnSection
:data-key="dataKey"
prefix="entry"
url="Entries/filter"
:array-data-props="{
url: 'Entries/filter',
order: 'landed DESC',
userFilter: entryQueryFilter,
}"
>
<VnSection :data-key="dataKey" prefix="entry">
<template #advanced-menu>
<EntryFilter :data-key="dataKey" />
</template>
@ -285,6 +292,7 @@ onBeforeMount(async () => {
v-if="defaultEntry.defaultSupplierFk"
ref="tableRef"
:data-key="dataKey"
search-url="EntryList"
url="Entries/filter"
:filter="entryQueryFilter"
order="landed DESC"

View File

@ -19,6 +19,7 @@ const { t } = useI18n();
const quasar = useQuasar();
const state = useState();
const user = state.getUser();
const footer = ref({ bought: 0, reserve: 0 });
const columns = computed(() => [
{
align: 'left',
@ -38,16 +39,14 @@ const columns = computed(() => [
cardVisible: true,
create: true,
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name', 'nickname'],
where: { role: 'buyer' },
optionFilter: 'firstName',
url: 'TicketRequests/getItemTypeWorker',
fields: ['id', 'nickname'],
optionLabel: 'nickname',
sortBy: 'nickname ASC',
optionValue: 'id',
useLike: false,
},
columnFilter: false,
width: '70px',
width: '50px',
},
{
align: 'center',
@ -58,6 +57,7 @@ const columns = computed(() => [
component: 'number',
summation: true,
width: '50px',
format: ({ reserve }, dashIfEmpty) => dashIfEmpty(round(reserve)),
},
{
align: 'center',
@ -65,6 +65,7 @@ const columns = computed(() => [
name: 'bought',
summation: true,
cardVisible: true,
style: ({ reserve, bought }) => boughtStyle(bought, reserve),
columnFilter: false,
},
{
@ -95,7 +96,6 @@ const columns = computed(() => [
},
},
],
'data-cy': 'table-actions',
},
]);
@ -137,20 +137,20 @@ function openDialog() {
}
function setFooter(data) {
const footer = {
bought: 0,
reserve: 0,
};
footer.value = { bought: 0, reserve: 0 };
data.forEach((row) => {
footer.bought += row?.bought;
footer.reserve += row?.reserve;
footer.value.bought += row?.bought;
footer.value.reserve += row?.reserve;
});
tableRef.value.footer = footer;
}
function round(value) {
return Math.round(value * 100) / 100;
}
function boughtStyle(bought, reserve) {
return reserve < bought ? { color: 'var(--q-negative)' } : '';
}
</script>
<template>
<VnSubToolbar>
@ -253,24 +253,14 @@ function round(value) {
<WorkerDescriptorProxy :id="row?.workerFk" />
</span>
</template>
<template #column-bought="{ row }">
<span :class="{ 'text-negative': row.reserve < row.bought }">
{{ row?.bought }}
</span>
</template>
<template #column-footer-reserve>
<span>
{{ round(tableRef.footer.reserve) }}
{{ round(footer.reserve) }}
</span>
</template>
<template #column-footer-bought>
<span
:class="{
'text-negative':
tableRef.footer.reserve < tableRef.footer.bought,
}"
>
{{ round(tableRef.footer.bought) }}
<span :style="boughtStyle(footer?.bought, footer?.reserve)">
{{ round(footer.bought) }}
</span>
</template>
</VnTable>
@ -286,7 +276,7 @@ function round(value) {
justify-content: center;
}
.column {
min-width: 40%;
min-width: 35%;
margin-top: 5%;
display: flex;
flex-direction: column;

View File

@ -14,7 +14,7 @@ const $props = defineProps({
required: true,
},
dated: {
type: Date,
type: [Date, String],
required: true,
},
});

View File

@ -202,7 +202,7 @@ function setCursor(ref) {
:option-label="col.optionLabel"
:filter-options="['id', 'name']"
:tooltip="t('Create a new expense')"
@keydown.tab="
@keydown.tab.prevent="
autocompleteExpense(
$event,
row,

View File

@ -97,16 +97,19 @@ const columns = computed(() => [
align: 'left',
name: 'isActive',
label: t('invoiceOut.negativeBases.active'),
component: 'checkbox',
},
{
align: 'left',
name: 'hasToInvoice',
label: t('invoiceOut.negativeBases.hasToInvoice'),
component: 'checkbox',
},
{
align: 'left',
name: 'hasVerifiedData',
name: 'isTaxDataChecked',
label: t('invoiceOut.negativeBases.verifiedData'),
component: 'checkbox',
},
{
align: 'left',
@ -142,7 +145,7 @@ const downloadCSV = async () => {
await invoiceOutGlobalStore.getNegativeBasesCsv(
userParams.from,
userParams.to,
filterParams
filterParams,
);
};
</script>

View File

@ -120,22 +120,9 @@ const updateStock = async () => {
</template>
</VnLv>
<VnLv :label="t('globals.producer')" :value="dashIfEmpty(entity.subName)" />
<VnLv
v-if="entity.value5"
:label="t('item.descriptor.color')"
:value="entity.value5"
>
</VnLv>
<VnLv
v-if="entity.value6"
:label="t('item.descriptor.category')"
:value="entity.value6"
/>
<VnLv
v-if="entity.value7"
:label="t('item.list.stems')"
:value="entity.value7"
/>
<VnLv v-if="entity?.value5" :label="entity?.tag5" :value="entity.value5" />
<VnLv v-if="entity?.value6" :label="entity?.tag6" :value="entity.value6" />
<VnLv v-if="entity?.value7" :label="entity?.tag7" :value="entity.value7" />
</template>
<template #icons="{ entity }">
<QCardActions v-if="entity" class="q-gutter-x-md">

View File

@ -12,7 +12,7 @@ import FetchData from 'components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import { toDateFormat } from 'src/filters/date.js';
import { toDateTimeFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters';
import { date } from 'quasar';
import { useState } from 'src/composables/useState';
@ -143,7 +143,12 @@ onMounted(async () => {
const fetchItemBalances = async () => await arrayDataItemBalances.fetch({});
const getBadgeAttrs = (_date) => {
const isSameDate = date.isSameDate(today, _date);
let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let timeTicket = new Date(_date);
timeTicket.setHours(0, 0, 0, 0);
const isSameDate = date.isSameDate(today, timeTicket);
const attrs = {
'text-color': isSameDate ? 'black' : 'white',
color: isSameDate ? 'warning' : 'transparent',
@ -244,7 +249,7 @@ async function updateWarehouse(warehouseFk) {
dense
style="font-size: 14px"
>
{{ toDateFormat(row.shipped) }}
{{ toDateTimeFormat(row.shipped) }}
</QBadge>
</QTd>
</template>

View File

@ -11,7 +11,6 @@ import { toCurrency } from 'filters/index';
import { useArrayData } from 'composables/useArrayData';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
const { t } = useI18n();
const route = useRoute();
const from = ref();
@ -41,7 +40,7 @@ const itemLastEntries = ref([]);
const columns = computed(() => [
{
label: 'Nv',
label: 'NV',
name: 'ig',
align: 'center',
},
@ -70,6 +69,7 @@ const columns = computed(() => [
field: 'reference',
align: 'center',
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
style: (row) => highlightedRow(row),
},
{
label: t('lastEntries.printedStickers'),
@ -84,6 +84,7 @@ const columns = computed(() => [
field: 'stickers',
align: 'center',
format: (val) => dashIfEmpty(val),
style: (row) => highlightedRow(row),
},
{
label: 'Packing',
@ -102,12 +103,14 @@ const columns = computed(() => [
name: 'stems',
field: 'stems',
align: 'center',
style: (row) => highlightedRow(row),
},
{
label: t('lastEntries.quantity'),
name: 'quantity',
field: 'quantity',
align: 'center',
style: (row) => highlightedRow(row),
},
{
label: t('lastEntries.cost'),
@ -120,12 +123,14 @@ const columns = computed(() => [
name: 'weight',
field: 'weight',
align: 'center',
style: (row) => highlightedRow(row),
},
{
label: t('lastEntries.cube'),
name: 'cube',
field: 'packagingFk',
align: 'center',
style: (row) => highlightedRow(row),
},
{
label: t('lastEntries.supplier'),
@ -208,6 +213,14 @@ onMounted(async () => {
function getBadgeClass(groupingMode, expectedGrouping) {
return groupingMode === expectedGrouping ? 'accent-badge' : 'simple-badge';
}
function highlightedRow(row) {
return row?.isInventorySupplier
? {
'background-color': 'var(--vn-section-hover-color)',
}
: '';
}
</script>
<template>
<VnSubToolbar>
@ -236,7 +249,7 @@ function getBadgeClass(groupingMode, expectedGrouping) {
:no-data-label="t('globals.noResults')"
>
<template #body-cell-ig="{ row }">
<QTd class="text-center">
<QTd class="text-center" :style="highlightedRow(row)">
<QIcon
:name="row.isIgnored ? 'check_box' : 'check_box_outline_blank'"
style="color: var(--vn-label-color)"
@ -245,38 +258,38 @@ function getBadgeClass(groupingMode, expectedGrouping) {
</QTd>
</template>
<template #body-cell-warehouse="{ row }">
<QTd>
<QTd :style="highlightedRow(row)">
<span>{{ row.warehouse }}</span>
</QTd>
</template>
<template #body-cell-date="{ row }">
<QTd class="text-center">
<QTd class="text-center" :style="highlightedRow(row)">
<VnDateBadge :date="row.landed" />
</QTd>
</template>
<template #body-cell-entry="{ row }">
<QTd @click.stop>
<QTd @click.stop :style="highlightedRow(row)">
<div class="full-width flex justify-center">
<EntryDescriptorProxy :id="row.entryFk" class="q-ma-none" dense />
<span class="link">{{ row.entryFk }}</span>
</div>
</QTd>
</template>
<template #body-cell-pvp="{ value }">
<QTd @click.stop class="text-center">
<template #body-cell-pvp="{ row, value }">
<QTd @click.stop class="text-center" :style="highlightedRow(row)">
<span> {{ value }}</span>
<QTooltip> {{ t('lastEntries.grouping') }}/Packing </QTooltip></QTd
>
<QTooltip> {{ t('lastEntries.grouping') }}/Packing </QTooltip>
</QTd>
</template>
<template #body-cell-printedStickers="{ row }">
<QTd @click.stop class="text-center">
<QTd @click.stop class="text-center" :style="highlightedRow(row)">
<span style="color: var(--vn-label-color)">
{{ row.printedStickers }}</span
>
</QTd>
</template>
<template #body-cell-packing="{ row }">
<QTd @click.stop>
<QTd @click.stop :style="highlightedRow(row)">
<QBadge
class="center-content"
:class="getBadgeClass(row.groupingMode, 'packing')"
@ -288,7 +301,7 @@ function getBadgeClass(groupingMode, expectedGrouping) {
</QTd>
</template>
<template #body-cell-grouping="{ row }">
<QTd @click.stop>
<QTd @click.stop :style="highlightedRow(row)">
<QBadge
class="center-content"
:class="getBadgeClass(row.groupingMode, 'grouping')"
@ -300,7 +313,7 @@ function getBadgeClass(groupingMode, expectedGrouping) {
</QTd>
</template>
<template #body-cell-cost="{ row }">
<QTd @click.stop class="text-center">
<QTd @click.stop class="text-center" :style="highlightedRow(row)">
<span>
{{ toCurrency(row.cost, 'EUR', 3) }}
<QTooltip>
@ -319,7 +332,7 @@ function getBadgeClass(groupingMode, expectedGrouping) {
</QTd>
</template>
<template #body-cell-supplier="{ row }">
<QTd @click.stop>
<QTd @click.stop :style="highlightedRow(row)">
<div class="full-width flex justify-left">
<QBadge
:class="
@ -354,7 +367,6 @@ function getBadgeClass(groupingMode, expectedGrouping) {
.th :first-child {
.td {
text-align: center;
background-color: red;
}
}
.accent-badge {

View File

@ -1,5 +1,5 @@
<script setup>
import { computed, ref } from 'vue';
import { computed, ref, markRaw } from 'vue';
import { useI18n } from 'vue-i18n';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toHour } from 'src/filters';
@ -8,6 +8,7 @@ import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnSection from 'src/components/common/VnSection.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
@ -38,17 +39,7 @@ const columns = computed(() => [
align: 'left',
name: 'workerFk',
label: t('route.Worker'),
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
useLike: false,
optionFilter: 'firstName',
find: {
value: 'workerFk',
label: 'workerUserName',
},
},
component: markRaw(VnSelectWorker),
create: true,
cardVisible: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
@ -59,6 +50,10 @@ const columns = computed(() => [
name: 'agencyName',
label: t('route.Agency'),
cardVisible: true,
},
{
label: t('route.Agency'),
name: 'agencyModeFk',
component: 'select',
attrs: {
url: 'agencyModes',
@ -69,14 +64,19 @@ const columns = computed(() => [
},
},
create: true,
columnClass: 'expand',
columnFilter: false,
visible: false,
},
{
align: 'left',
name: 'vehiclePlateNumber',
label: t('route.Vehicle'),
cardVisible: true,
},
{
name: 'vehicleFk',
label: t('route.Vehicle'),
cardVisible: true,
component: 'select',
attrs: {
url: 'vehicles',
@ -90,6 +90,7 @@ const columns = computed(() => [
},
create: true,
columnFilter: false,
visible: false,
},
{
align: 'left',
@ -156,6 +157,7 @@ const columns = computed(() => [
<VnTable
:data-key
:columns="columns"
ref="tableRef"
:right-search="false"
redirect="route"
:create="{

View File

@ -6,7 +6,10 @@ import VnSection from 'src/components/common/VnSection.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'src/components/FetchData.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import SupplierSummary from './Card/SupplierSummary.vue';
const { viewSummary } = useSummaryDialog();
const { t } = useI18n();
const tableRef = ref();
const dataKey = 'SupplierList';
@ -103,6 +106,19 @@ const columns = computed(() => [
},
},
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('components.smartCard.viewSummary'),
icon: 'preview',
isPrimary: true,
action: (row) => viewSummary(row.id, SupplierSummary, 'md-width'),
},
],
},
]);
</script>
<template>

View File

@ -203,7 +203,7 @@ const updateQuantity = async (sale) => {
sale.isNew = false;
await axios.post(`Sales/${id}/updateQuantity`, { quantity });
notify('globals.dataSaved', 'positive');
tableRef.value.reload();
resetChanges();
} catch (e) {
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
(s) => s.id === sale.id,
@ -247,7 +247,7 @@ const updateConcept = async (sale) => {
const data = { newConcept: sale.concept };
await axios.post(`Sales/${sale.id}/updateConcept`, data);
notify('globals.dataSaved', 'positive');
tableRef.value.reload();
resetChanges();
};
const DEFAULT_EDIT = {
@ -298,7 +298,7 @@ const updatePrice = async (sale, newPrice) => {
sale.price = newPrice;
edit.value = { ...DEFAULT_EDIT };
notify('globals.dataSaved', 'positive');
tableRef.value.reload();
resetChanges();
};
const changeDiscount = async (sale) => {
@ -330,7 +330,7 @@ const updateDiscount = async (sales, newDiscount = null) => {
};
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
notify('globals.dataSaved', 'positive');
tableRef.value.reload();
resetChanges();
};
const getNewPrice = computed(() => {
@ -398,7 +398,7 @@ const removeSales = async () => {
await axios.post('Sales/deleteSales', params);
removeSelectedSales();
notify('globals.dataSaved', 'positive');
window.location.reload();
resetChanges();
};
const setTransferParams = async () => {

View File

@ -456,6 +456,7 @@ watch(
:pagination="{ rowsPerPage: 0 }"
:no-data-label="t('globals.noResults')"
:right-search="false"
:order="['futureTotalWithVat ASC']"
auto-load
:disable-option="{ card: true }"
>

View File

@ -275,7 +275,7 @@ const fetchAvailableAgencies = async (formData) => {
const { options, agency } = response;
if (options) agenciesOptions.value = options;
if (agency) formData.agencyModeId = agency;
if (agency) formData.agencyModeId = agency.agencyModeFk;
};
const fetchClient = async (formData) => {

View File

@ -17,6 +17,12 @@ const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
async function setAdvancedSummary(data) {
const advanced = (await useAdvancedSummary('Workers', data.id)) ?? {};
Object.assign(form.value.formData, advanced);
await nextTick();
if (form.value) form.value.hasChanges = false;
}
</script>
<template>
<FetchData
@ -36,13 +42,7 @@ const maritalStatus = [
:url-update="`Workers/${$route.params.id}`"
auto-load
model="Worker"
@on-fetch="
async (data) => {
Object.assign(data, (await useAdvancedSummary('Workers', data.id)) ?? {});
await $nextTick();
if (form) form.hasChanges = false;
}
"
@on-fetch="setAdvancedSummary"
>
<template #form="{ data }">
<VnRow>

View File

@ -35,6 +35,22 @@ async function reactivateWorker() {
}
}
const columns = computed(() => [
{
name: 'id',
label: t('Id'),
align: 'left',
isId: true,
cardVisible: true,
width: '40px',
},
{
name: 'isHourlyLabor',
label: t('worker.business.tableVisibleColumns.hourlyLabor'),
align: 'left',
component: 'checkbox',
cardVisible: true,
width: '60px',
},
{
name: 'started',
label: t('worker.business.tableVisibleColumns.started'),
@ -194,6 +210,20 @@ const columns = computed(() => [
format: ({ workerBusinessTypeName }, dashIfEmpty) =>
dashIfEmpty(workerBusinessTypeName),
},
{
align: 'left',
name: 'workerBusinessAgreementFk',
label: t('worker.business.tableVisibleColumns.workerBusinessAgreementName'),
component: 'select',
attrs: {
url: 'WorkerBusinessAgreements',
fields: ['id', 'name'],
},
cardVisible: true,
create: true,
format: ({ workerBusinessAgreementName }, dashIfEmpty) =>
dashIfEmpty(workerBusinessAgreementName),
},
{
align: 'left',
label: t('worker.business.tableVisibleColumns.amount'),
@ -230,7 +260,7 @@ const columns = computed(() => [
save-url="/Businesses/crud"
:create="{
urlCreate: `Workers/${entityId}/Business`,
title: 'Create business',
title: t('Create business'),
onDataSaved: () => tableRef.reload(),
formInitialData: {},
}"
@ -248,4 +278,5 @@ const columns = computed(() => [
<i18n>
es:
Do you want to reactivate the user?: desea reactivar el usuario?
Create business: Crear contrato
</i18n>

View File

@ -12,6 +12,11 @@ const $props = defineProps({
<template>
<QPopupProxy>
<WorkerDescriptor v-if="$props.id" :id="$props.id" :summary="WorkerSummary" />
<WorkerDescriptor
v-if="$props.id"
:id="$props.id"
:summary="WorkerSummary"
data-key="WorkerDescriptorProxy"
/>
</QPopupProxy>
</template>

View File

@ -0,0 +1,24 @@
describe('ClaimNotes', () => {
const descriptorOptions = '[data-cy="descriptor-more-opts-menu"] > .q-list';
const url = '/#/account/1/summary';
it('should see all the account options', () => {
cy.login('itManagement');
cy.visit(url);
cy.dataCy('descriptor-more-opts').click();
cy.get(descriptorOptions)
.find('.q-item')
.its('length')
.then((count) => {
cy.log('Número de opciones:', count);
expect(count).to.equal(5);
});
});
it('should not see any option', () => {
cy.login('salesPerson');
cy.visit(url);
cy.dataCy('descriptor-more-opts').click();
cy.get(descriptorOptions).should('not.be.visible');
});
});

View File

@ -67,7 +67,7 @@ describe('Entry', () => {
it('Should notify when entry is lock by another user', () => {
const checkLockMessage = () => {
cy.get('[data-cy="entry-lock-confirm"]').should('be.visible');
cy.get('[role="dialog"]').should('be.visible');
cy.get('[data-cy="VnConfirm_message"] > span').should(
'contain.text',
'This entry has been locked by buyerNick',