feat(manager): customer display looks: several, a default, one per display; pictures from the library (platform-v2 step 5.3)
Settings → Customer display lists the looks (default starred, how many displays each), edits one (logo / picture with MediaField, the slideshow's pictures picked several at a time, reordered, removed), new look (empty or a copy), make default, delete, and "Which display shows which look". The Devices page offers the looks for a display's Idle screen. MediaPicker: `multiple`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import client from '../../api/client'
|
||||
import { configGroups, configValue, refOptions } from './devicesLogic'
|
||||
|
||||
// Where a `ref` field's choices come from (the device list is passed in)
|
||||
const REF_URLS = { prep_zones: '/api/prep-zones', categories: '/api/products/categories', printers: '/api/system/printers' }
|
||||
const REF_URLS = { prep_zones: '/api/prep-zones', categories: '/api/products/categories', printers: '/api/system/printers', display_looks: '/api/display/looks' }
|
||||
|
||||
export default function DeviceConfigFields({ appKey, fields = [], value, onChange, devices = [], selfId = null }) {
|
||||
const { t } = useTranslation('manager')
|
||||
@@ -28,6 +28,7 @@ export default function DeviceConfigFields({ appKey, fields = [], value, onChang
|
||||
const zones = lists.prep_zones ?? []
|
||||
const categories = lists.categories ?? []
|
||||
const printers = lists.printers ?? []
|
||||
const looks = lists.display_looks ?? []
|
||||
|
||||
if (!fields.length) return null
|
||||
const base = key => `modules:${appKey}.config.${key}`
|
||||
@@ -53,7 +54,7 @@ export default function DeviceConfigFields({ appKey, fields = [], value, onChang
|
||||
<Field key={f.key} label={label} hint={hint}>
|
||||
<Select value={v == null ? '' : String(v)} onChange={e => set(f, e.target.value)} data-config={f.key}
|
||||
options={[{ value: '', label: t(`${base(f.key)}.none`, { defaultValue: t('devices.form.none') }) },
|
||||
...refOptions(f, { zones, categories, printers, devices, selfId })]} />
|
||||
...refOptions(f, { zones, categories, printers, looks, devices, selfId })]} />
|
||||
</Field>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -85,8 +85,9 @@ export function configGroups(fields = []) {
|
||||
return out
|
||||
}
|
||||
|
||||
/** Options of a `ref` field: prep zones, categories, printers, or live devices of one app ("devices:<app>"). */
|
||||
export function refOptions(field, { zones = [], categories = [], printers = [], devices = [], selfId = null } = {}) {
|
||||
/** Options of a `ref` field: prep zones, categories, printers, customer display looks, or live devices of one app ("devices:<app>"). */
|
||||
export function refOptions(field, { zones = [], categories = [], printers = [], looks = [], devices = [], selfId = null } = {}) {
|
||||
if (field.choices_from === 'display_looks') return looks.map(l => ({ value: String(l.id), label: l.name }))
|
||||
if (field.choices_from === 'prep_zones') return zones.map(z => ({ value: String(z.id), label: z.name }))
|
||||
if (field.choices_from === 'categories') return categories.map(c => ({ value: String(c.id), label: c.name }))
|
||||
if (field.choices_from === 'printers') return printers.filter(p => p.is_active !== false).map(p => ({ value: String(p.id), label: p.name }))
|
||||
|
||||
Reference in New Issue
Block a user