diff --git a/src/Meezi.API/Controllers/BranchPrintSettingsController.cs b/src/Meezi.API/Controllers/BranchPrintSettingsController.cs
index 484c945..9bfd53a 100644
--- a/src/Meezi.API/Controllers/BranchPrintSettingsController.cs
+++ b/src/Meezi.API/Controllers/BranchPrintSettingsController.cs
@@ -91,6 +91,14 @@ public class BranchPrintSettingsController : CafeApiControllerBase
: request.PosDeviceIp.Trim();
if (request.PosDevicePort.HasValue)
branch.PosDevicePort = request.PosDevicePort.Value;
+ if (request.ReceiptPrintDeviceId is not null)
+ branch.ReceiptPrintDeviceId = string.IsNullOrWhiteSpace(request.ReceiptPrintDeviceId)
+ ? null
+ : request.ReceiptPrintDeviceId;
+ if (request.KitchenPrintDeviceId is not null)
+ branch.KitchenPrintDeviceId = string.IsNullOrWhiteSpace(request.KitchenPrintDeviceId)
+ ? null
+ : request.KitchenPrintDeviceId;
branch.UpdatedAt = DateTime.UtcNow;
await _db.SaveChangesAsync(ct);
@@ -110,5 +118,7 @@ public class BranchPrintSettingsController : CafeApiControllerBase
b.ReceiptFooter,
b.WifiPassword,
b.PosDeviceIp,
- b.PosDevicePort);
+ b.PosDevicePort,
+ b.ReceiptPrintDeviceId,
+ b.KitchenPrintDeviceId);
}
diff --git a/src/Meezi.API/Controllers/PrintAgentsController.cs b/src/Meezi.API/Controllers/PrintAgentsController.cs
index 76643e6..941fdb2 100644
--- a/src/Meezi.API/Controllers/PrintAgentsController.cs
+++ b/src/Meezi.API/Controllers/PrintAgentsController.cs
@@ -18,11 +18,13 @@ public class PrintAgentsController : CafeApiControllerBase
{
private readonly AppDbContext _db;
private readonly IPrintAgentRegistry _registry;
+ private readonly IPrinterService _printer;
- public PrintAgentsController(AppDbContext db, IPrintAgentRegistry registry)
+ public PrintAgentsController(AppDbContext db, IPrintAgentRegistry registry, IPrinterService printer)
{
_db = db;
_registry = registry;
+ _printer = printer;
}
[HttpGet]
@@ -101,6 +103,20 @@ public class PrintAgentsController : CafeApiControllerBase
return Ok(new ApiResponse
) : null}
+ {/* Print servers — auto-discovered printers via the local agent */}
+
+
+
+
+
+ {t("agents.title")}
+
+
{t("agents.hint")}
+
+
+
+
+ {pairing ? (
+
+
{t("agents.pairingTitle")}
+
+ {pairing.code}
+
+
{t("agents.pairingSteps")}
+
+ ) : null}
+
+ {agents.length === 0 ? (
+ {t("agents.empty")}
+ ) : (
+
+ )}
+
+ {devices.length > 0 ? (
+
+
+
+
+
+
+
+
+ ) : null}
+
+
diff --git a/web/dashboard/src/components/settings/settings-stations-panel.tsx b/web/dashboard/src/components/settings/settings-stations-panel.tsx
index 74696c0..750dc15 100644
--- a/web/dashboard/src/components/settings/settings-stations-panel.tsx
+++ b/web/dashboard/src/components/settings/settings-stations-panel.tsx
@@ -12,6 +12,7 @@ import {
type KitchenStation,
} from "@/lib/api/kitchen-stations";
import { testPrinter, printErrorMessage } from "@/lib/api/print";
+import { listPrintAgents, deviceOptions } from "@/lib/api/print-agents";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
@@ -37,6 +38,14 @@ function StationForm({
const [name, setName] = useState(station?.name ?? "");
const [ip, setIp] = useState(station?.printerIp ?? "");
const [port, setPort] = useState(String(station?.printerPort ?? 9100));
+ const [deviceId, setDeviceId] = useState(station?.printDeviceId ?? "");
+
+ const { data: agents = [] } = useQuery({
+ queryKey: ["print-agents", cafeId],
+ queryFn: () => listPrintAgents(cafeId),
+ enabled: !!cafeId,
+ });
+ const devices = deviceOptions(agents);
const save = useMutation({
mutationFn: () => {
@@ -44,6 +53,7 @@ function StationForm({
name: name.trim(),
printerIp: ip.trim() || null,
printerPort: parseInt(port, 10) || 9100,
+ printDeviceId: deviceId || null,
};
return station
? updateKitchenStation(cafeId, station.id, body)
@@ -88,6 +98,23 @@ function StationForm({
/>
+ {devices.length > 0 ? (
+
+
+
+ ) : null}