Files

33 lines
968 B
Lua

-- AD Field View
-- Rene regler for fanen Marker: hvilke marker vises (slåafgrøder som standard), rækkefølge og
-- statusord. GUI'et oversætter nøglerne.
ADFieldView = {}
function ADFieldView.rows(infos, fieldsById, showAll)
local rows = {}
for _, info in ipairs(infos or {}) do
if showAll or info.mowable then
table.insert(rows, {info = info, field = fieldsById[info.id] or ADFieldModel.newField(info.id)})
end
end
table.sort(rows, function(a, b) return a.info.id < b.info.id end)
return rows
end
function ADFieldView.hiddenCount(infos, showAll)
if showAll then return 0 end
local hidden = 0
for _, info in ipairs(infos or {}) do
if not info.mowable then hidden = hidden + 1 end
end
return hidden
end
function ADFieldView.statusKey(field, info)
if info.markerId == nil then
return "spu_field_noMarker"
end
return "spu_field_stage_" .. tostring(field.stage)
end