Storage locations box fixes [SCI-11077][SCI-11078][SCI-11080]

This commit is contained in:
Anton 2024-09-23 12:47:46 +02:00
parent 17fd864f5d
commit 52d2cd6d0c
4 changed files with 45 additions and 30 deletions

View file

@ -46,6 +46,8 @@ class RepositoriesController < ApplicationController
def list def list
results = @repositories results = @repositories
results = results.name_like(params[:query]) if params[:query].present? results = results.name_like(params[:query]) if params[:query].present?
results = results.joins(:repository_rows).distinct if params[:non_empty].present?
render json: { data: results.map { |r| [r.id, r.name] } } render json: { data: results.map { |r| [r.id, r.name] } }
end end

View file

@ -125,34 +125,43 @@ export default {
}, },
columnDefs() { columnDefs() {
const columns = [{ let columns = [];
field: 'position_formatted',
headerName: this.i18n.t('storage_locations.show.table.position'), if (this.withGrid) {
sortable: true, columns.push({
cellClass: 'text-sn-blue cursor-pointer' field: 'position_formatted',
}, headerName: this.i18n.t('storage_locations.show.table.position'),
{ sortable: true,
field: 'reminders', cellClass: 'text-sn-blue cursor-pointer'
headerName: this.i18n.t('storage_locations.show.table.reminders'), });
sortable: false, }
cellRenderer: RemindersRender
}, columns = columns.concat(
{ [
field: 'row_id', {
headerName: this.i18n.t('storage_locations.show.table.row_id'), field: 'reminders',
sortable: true headerName: this.i18n.t('storage_locations.show.table.reminders'),
}, sortable: false,
{ cellRenderer: RemindersRender
field: 'row_name', },
headerName: this.i18n.t('storage_locations.show.table.row_name'), {
sortable: true, field: 'row_code',
cellRenderer: ItemNameRenderer headerName: this.i18n.t('storage_locations.show.table.row_id'),
}, sortable: true
{ },
field: 'stock', {
headerName: this.i18n.t('storage_locations.show.table.stock'), field: 'row_name',
sortable: false headerName: this.i18n.t('storage_locations.show.table.row_name'),
}]; sortable: true,
cellRenderer: ItemNameRenderer
},
{
field: 'stock',
headerName: this.i18n.t('storage_locations.show.table.stock'),
sortable: false
}
]
);
return columns; return columns;
}, },

View file

@ -48,7 +48,7 @@ export default {
}, },
computed: { computed: {
repositoriesUrl() { repositoriesUrl() {
return list_team_repositories_path(this.teamId); return list_team_repositories_path(this.teamId, { non_empty: true });
}, },
rowsUrl() { rowsUrl() {
if (!this.selectedRepository) { if (!this.selectedRepository) {

View file

@ -6,9 +6,13 @@ module Lists
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
attributes :created_by, :created_on, :position, :row_id, :row_name, :hidden, :position_formatted, :stock, attributes :created_by, :created_on, :position, :row_id, :row_name, :hidden, :position_formatted, :stock,
:have_reminders, :reminders_url, :row_url :have_reminders, :reminders_url, :row_url, :row_code
def row_id def row_id
object.repository_row.id
end
def row_code
object.repository_row.code object.repository_row.code
end end