mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 09:23:58 +08:00
Add stock to storage locations [SCI-10921]
This commit is contained in:
parent
6ad8120e0d
commit
b774c04f5b
2 changed files with 13 additions and 3 deletions
|
@ -117,7 +117,7 @@ export default {
|
|||
|
||||
columnDefs() {
|
||||
const columns = [{
|
||||
field: 'position',
|
||||
field: 'position_formatted',
|
||||
headerName: this.i18n.t('storage_locations.show.table.position'),
|
||||
sortable: true,
|
||||
notSelectable: true,
|
||||
|
|
|
@ -4,7 +4,7 @@ module Lists
|
|||
class StorageLocationRepositoryRowSerializer < ActiveModel::Serializer
|
||||
include Canaid::Helpers::PermissionsHelper
|
||||
|
||||
attributes :created_by, :created_on, :position, :row_id, :row_name, :hidden
|
||||
attributes :created_by, :created_on, :position, :row_id, :row_name, :hidden, :position_formatted, :stock
|
||||
|
||||
def row_id
|
||||
object.repository_row.id unless hidden
|
||||
|
@ -19,13 +19,23 @@ module Lists
|
|||
end
|
||||
|
||||
def created_on
|
||||
I18n.l(object.created_at, format: :full)
|
||||
I18n.l(object.created_at, format: :full) unless hidden
|
||||
end
|
||||
|
||||
def position
|
||||
object.metadata['position']
|
||||
end
|
||||
|
||||
def position_formatted
|
||||
"#{('A'..'Z').to_a[position[0] - 1]}#{position[1]}" if position
|
||||
end
|
||||
|
||||
def stock
|
||||
if object.repository_row.repository.has_stock_management? && !hidden
|
||||
object.repository_row.repository_cells.find_by(value_type: 'RepositoryStockValue')&.value&.formatted
|
||||
end
|
||||
end
|
||||
|
||||
def hidden
|
||||
!can_read_repository?(object.repository_row.repository)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue