feat: configurable DTO login/password per KKT device
- Equipment page: add login/password fields in KKT fiscal mode form - Stored in device config JSON (dto_user, dto_pass) - Backend passes credentials to agent in test_device command - Agent uses per-device credentials for all ATOL DTO API calls Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -300,6 +300,8 @@ const workstationRoutes: FastifyPluginAsync = async (fastify) => {
|
|||||||
com_port: device.com_port,
|
com_port: device.com_port,
|
||||||
fiscal_mode: device.fiscal_mode,
|
fiscal_mode: device.fiscal_mode,
|
||||||
dto_port: device.dto_port,
|
dto_port: device.dto_port,
|
||||||
|
dto_user: device.config?.dto_user,
|
||||||
|
dto_pass: device.config?.dto_pass,
|
||||||
},
|
},
|
||||||
}) as { ok: boolean; error?: string; message?: string }
|
}) as { ok: boolean; error?: string; message?: string }
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -201,6 +201,8 @@ function DeviceForm({
|
|||||||
const [purpose, setPurpose] = useState(initial?.purpose ?? 'receipt')
|
const [purpose, setPurpose] = useState(initial?.purpose ?? 'receipt')
|
||||||
const [fiscalMode, setFiscalMode] = useState(initial?.fiscalMode !== false)
|
const [fiscalMode, setFiscalMode] = useState(initial?.fiscalMode !== false)
|
||||||
const [dtoPort, setDtoPort] = useState(String(initial?.dtoPort ?? 16732))
|
const [dtoPort, setDtoPort] = useState(String(initial?.dtoPort ?? 16732))
|
||||||
|
const [dtoUser, setDtoUser] = useState(String(initial?.config?.dto_user ?? '30'))
|
||||||
|
const [dtoPass, setDtoPass] = useState(String(initial?.config?.dto_pass ?? '30'))
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
const [availablePorts, setAvailablePorts] = useState<{ port: string; description?: string }[] | null>(null)
|
const [availablePorts, setAvailablePorts] = useState<{ port: string; description?: string }[] | null>(null)
|
||||||
const [portsLoading, setPortsLoading] = useState(false)
|
const [portsLoading, setPortsLoading] = useState(false)
|
||||||
@@ -228,6 +230,7 @@ function DeviceForm({
|
|||||||
purpose: purpose as WorkstationDevice['purpose'],
|
purpose: purpose as WorkstationDevice['purpose'],
|
||||||
fiscalMode: type === 'kkt' ? fiscalMode : undefined,
|
fiscalMode: type === 'kkt' ? fiscalMode : undefined,
|
||||||
dtoPort: type === 'kkt' && fiscalMode ? Number(dtoPort) : undefined,
|
dtoPort: type === 'kkt' && fiscalMode ? Number(dtoPort) : undefined,
|
||||||
|
config: type === 'kkt' && fiscalMode ? { dto_user: dtoUser, dto_pass: dtoPass } : undefined,
|
||||||
})
|
})
|
||||||
setSaving(false)
|
setSaving(false)
|
||||||
}
|
}
|
||||||
@@ -291,15 +294,38 @@ function DeviceForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{fiscalMode && (
|
{fiscalMode && (
|
||||||
<div>
|
<div className="space-y-3">
|
||||||
<label className="block text-xs font-medium text-slate-500 mb-1">Порт АТОЛ ДТО</label>
|
<div>
|
||||||
<input
|
<label className="block text-xs font-medium text-slate-500 mb-1">Порт АТОЛ ДТО</label>
|
||||||
value={dtoPort}
|
<input
|
||||||
onChange={e => setDtoPort(e.target.value)}
|
value={dtoPort}
|
||||||
className="w-32 input text-sm font-mono"
|
onChange={e => setDtoPort(e.target.value)}
|
||||||
placeholder="16732"
|
className="w-32 input text-sm font-mono"
|
||||||
/>
|
placeholder="16732"
|
||||||
<p className="text-xs text-slate-400 mt-1">Порт АТОЛ ДТО 10 (по умолчанию 16732). Для нескольких касс — разные порты.</p>
|
/>
|
||||||
|
<p className="text-xs text-slate-400 mt-1">По умолчанию 16732. Для нескольких касс — разные порты.</p>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-2 gap-3">
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-slate-500 mb-1">Логин ДТО</label>
|
||||||
|
<input
|
||||||
|
value={dtoUser}
|
||||||
|
onChange={e => setDtoUser(e.target.value)}
|
||||||
|
className="w-full input text-sm"
|
||||||
|
placeholder="30"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-slate-500 mb-1">Пароль ДТО</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
value={dtoPass}
|
||||||
|
onChange={e => setDtoPass(e.target.value)}
|
||||||
|
className="w-full input text-sm"
|
||||||
|
placeholder="30"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user