From 8eb83a5189cc650e753a18337c5896fff3dfb3e7 Mon Sep 17 00:00:00 2001 From: HotelSync Date: Fri, 27 Mar 2026 15:03:09 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20NetUp=20device=20form=20=E2=80=94=20hide?= =?UTF-8?q?=20purpose/USB/COM,=20auto-select=20network?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- src/pages/EquipmentPage.tsx | 86 ++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/src/pages/EquipmentPage.tsx b/src/pages/EquipmentPage.tsx index 4eb58d4..8c58358 100644 --- a/src/pages/EquipmentPage.tsx +++ b/src/pages/EquipmentPage.tsx @@ -189,6 +189,10 @@ function DeviceForm({ wsOnline: boolean }) { const [type, setType] = useState<'kkt' | 'printer' | 'netup'>(initial?.type ?? 'printer') + const handleTypeChange = (t: 'kkt' | 'printer' | 'netup') => { + setType(t) + if (t === 'netup') setConnection('network') + } const [name, setName] = useState(initial?.name ?? '') const [connection, setConnection] = useState<'usb' | 'network' | 'com'>(initial?.connection ?? 'network') const [networkHost, setNetworkHost] = useState(initial?.networkHost ?? '') @@ -230,12 +234,12 @@ function DeviceForm({ return (
-
+
-
- - -
+ {type !== 'netup' && ( +
+ + +
+ )}
{/* KKT-specific: fiscal mode + DTO port */} @@ -305,33 +311,35 @@ function DeviceForm({ value={name} onChange={e => setName(e.target.value)} className="w-full input text-sm" - placeholder="Касса №1 / Принтер кухни" + placeholder={type === 'netup' ? 'NetUp сервер' : type === 'kkt' ? 'Касса №1' : 'Принтер кухни'} />
-
- -
- {([ - { id: 'usb', icon: , label: 'USB' }, - { id: 'network', icon: , label: 'Сеть (TCP)' }, - { id: 'com', icon: , label: 'COM-порт' }, - ] as const).map(c => ( - - ))} + {type !== 'netup' && ( +
+ +
+ {([ + { id: 'usb', icon: , label: 'USB' }, + { id: 'network', icon: , label: 'Сеть (TCP)' }, + { id: 'com', icon: , label: 'COM-порт' }, + ] as const).map(c => ( + + ))} +
-
+ )} {connection === 'network' && (
@@ -341,7 +349,7 @@ function DeviceForm({ value={networkHost} onChange={e => setNetworkHost(e.target.value)} className="w-full input text-sm font-mono" - placeholder="192.168.1.50" + placeholder={type === 'netup' ? '172.16.0.12' : '192.168.1.50'} />
@@ -350,7 +358,7 @@ function DeviceForm({ value={networkPort} onChange={e => setNetworkPort(e.target.value)} className="w-full input text-sm font-mono" - placeholder="9100" + placeholder={type === 'netup' ? '8880' : '9100'} />