feat: страница Оборудование — рабочие места, агенты, ККТ и принтеры
- EquipmentPage: CRUD рабочих мест, генерация кода сопряжения с таймером, добавление устройств (ККТ/принтер, USB/сеть), онлайн-статус агентов - api.ts: интерфейсы Workstation, WorkstationDevice + api.workstations.* - Sidebar: пункт «Оборудование» в группе Настройки Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -315,6 +315,28 @@ export const api = {
|
||||
req<{ room_id: string }>('POST', `/api/hotels/${slug}/chat/direct/${otherUserId}`),
|
||||
},
|
||||
|
||||
// ── Workstations ──────────────────────────────────────────────────────────
|
||||
workstations: {
|
||||
list: (slug: string) =>
|
||||
req<Workstation[]>('GET', `/api/hotels/${slug}/workstations`),
|
||||
create: (slug: string, name: string) =>
|
||||
req<Workstation>('POST', `/api/hotels/${slug}/workstations`, { name }),
|
||||
update: (slug: string, id: string, name: string) =>
|
||||
req<Workstation>('PATCH', `/api/hotels/${slug}/workstations/${id}`, { name }),
|
||||
remove: (slug: string, id: string) =>
|
||||
req<void>('DELETE', `/api/hotels/${slug}/workstations/${id}`),
|
||||
pairCode: (slug: string, id: string) =>
|
||||
req<{ code: string; expires_at: string }>('POST', `/api/hotels/${slug}/workstations/${id}/pair-code`),
|
||||
listDevices: (slug: string, id: string) =>
|
||||
req<WorkstationDevice[]>('GET', `/api/hotels/${slug}/workstations/${id}/devices`),
|
||||
addDevice: (slug: string, id: string, data: Partial<WorkstationDevice>) =>
|
||||
req<WorkstationDevice>('POST', `/api/hotels/${slug}/workstations/${id}/devices`, data),
|
||||
updateDevice: (slug: string, id: string, deviceId: string, data: Partial<WorkstationDevice>) =>
|
||||
req<WorkstationDevice>('PATCH', `/api/hotels/${slug}/workstations/${id}/devices/${deviceId}`, data),
|
||||
removeDevice: (slug: string, id: string, deviceId: string) =>
|
||||
req<void>('DELETE', `/api/hotels/${slug}/workstations/${id}/devices/${deviceId}`),
|
||||
},
|
||||
|
||||
// ── Hotels ────────────────────────────────────────────────────────────────
|
||||
hotels: {
|
||||
get: (slug: string) =>
|
||||
@@ -945,6 +967,31 @@ export interface ChatMessage {
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface WorkstationDevice {
|
||||
id: string
|
||||
workstationId: string
|
||||
type: 'kkt' | 'printer'
|
||||
name: string
|
||||
connection: 'usb' | 'network'
|
||||
networkHost?: string
|
||||
networkPort?: number
|
||||
purpose: 'fiscal' | 'kitchen' | 'bar' | 'receipt' | 'other'
|
||||
config: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface Workstation {
|
||||
id: string
|
||||
hotelId: string
|
||||
agentId: string | null
|
||||
name: string
|
||||
hostname: string | null
|
||||
ipAddress: string | null
|
||||
isOnline: boolean
|
||||
lastSeen: string | null
|
||||
createdAt: string
|
||||
devices: WorkstationDevice[] | null
|
||||
}
|
||||
|
||||
function toHotelPayload(h: HotelPayload): Record<string, unknown> {
|
||||
const out: Record<string, unknown> = {}
|
||||
if (h.name !== undefined) out.name = h.name
|
||||
|
||||
Reference in New Issue
Block a user