Small fixes for storage locations [SCI-11700][SCI-11699][SCI-11702]

This commit is contained in:
Anton 2025-03-14 12:35:08 +01:00
parent 94f38d5a4d
commit f5412a45a8
4 changed files with 13 additions and 13 deletions

View file

@ -24,14 +24,13 @@
:class="{ '!border-t-sn-grey': cell.row === 0, '!border-l-sn-grey': cell.column === 0 }"
>
<div
class="h-full w-full rounded-full items-center flex justify-center"
class="h-full w-full rounded-full items-center flex justify-center cursor-pointer"
@click="selectPosition(cell)"
:class="{
'bg-sn-background-green': cellIsOccupied(cell),
'bg-sn-grey-100': cellIsHidden(cell),
'bg-white': cellIsAvailable(cell),
'bg-white border-sn-science-blue border-solid border-[1px]': cellIsSelected(cell),
'cursor-pointer': !cellIsHidden(cell)
}"
>
<template v-if="cellIsHidden(cell)">
@ -119,21 +118,17 @@ export default {
return !this.cellIsOccupied(cell) && !this.cellIsHidden(cell);
},
selectPosition(cell) {
if (this.cellIsOccupied(cell)) {
if (this.cellIsOccupied(cell) || this.cellIsHidden(cell)) {
this.$emit('select', this.cellObject(cell));
return;
}
if (this.cellIsHidden(cell)) {
return;
}
this.$emit('selectEmptyCell', cell);
},
selectRow(row) {
this.columnsList.forEach((column) => {
const cell = { row: this.rowsList.indexOf(row), column: column - 1 };
if (!this.cellIsSelected(cell) && !this.cellIsOccupied(cell)) {
if (!this.cellIsSelected(cell) && !this.cellIsOccupied(cell) && !this.cellIsHidden(cell)) {
this.$emit('selectEmptyCell', cell);
}
});
@ -141,7 +136,7 @@ export default {
selectColumn(column) {
this.rowsList.forEach((row) => {
const cell = { row: this.rowsList.indexOf(row), column: column - 1 };
if (!this.cellIsSelected(cell) && !this.cellIsOccupied(cell)) {
if (!this.cellIsSelected(cell) && !this.cellIsOccupied(cell) && !this.cellIsHidden(cell)) {
this.$emit('selectEmptyCell', cell);
}
});

View file

@ -52,7 +52,7 @@
{{ i18n.t(`storage_locations.show.assign_modal.move_description`, { name: selectedRowName }) }}
</h4>
<p v-else class="mb-4">
{{ i18n.t(`storage_locations.show.assign_modal.assign_description`) }}
{{ i18n.t(`storage_locations.show.assign_modal.assign_description`, { number: selectedPositions.length } )}}
</p>
<RowSelector v-if="!selectedRow" @change="this.rowId = $event" class="mb-4"></RowSelector>
<ContainerSelector v-if="!selectedContainer" @change="this.containerId = $event"></ContainerSelector>
@ -117,7 +117,12 @@ export default {
formattedPosition() {
if (this.selectedPositions.length > 0) {
const pos = [];
this.selectedPositions.forEach((p) => {
this.selectedPositions.sort((a, b) => {
if (a[0] === b[0]) {
return a[1] - b[1];
}
return a[0] - b[0];
}).forEach((p) => {
pos.push(String.fromCharCode(96 + parseInt(p[0], 10)).toUpperCase() + p[1]);
});
return pos.join(', ');

View file

@ -81,7 +81,7 @@ class StorageLocation < ApplicationRecord
url = if container
storage_location_path(id)
else
storage_locations_path(parent_id: root? ? nil : parent_id)
storage_locations_path(parent_id: id)
end
return [{ name: (readable ? name : code), url: url }] if root?

View file

@ -2840,7 +2840,7 @@ en:
selected_row_title: 'Assign new location'
assign_title: 'Assign position'
move_title: 'Move %{name}'
assign_description: 'Select an item to assign it to a location.'
assign_description: 'Select an item to assign it to a %{number} location(s).'
move_description: 'Select where you want to move %{name}.'
selected_row_description: "Select a location for the item %{name}."
assign_action: 'Assign'