From 313d041db3dea816381e97e39d63e4671760d746 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Wed, 27 May 2026 11:22:49 +0200 Subject: [PATCH] feat(clients): restore Auto Renew field in client form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vue→react rewrite dropped the per-client `reset` (Auto Renew) input. The backend's autoRenewClients job has always honoured it, but the form had no way to set or change the value, so existing auto-renew settings were also invisible during edits. Reinstate the field as an InputNumber with a tooltip explaining "0 = disable (unit: day)", placed on the same row as the Reverse tag field so the form doesn't grow taller for the common cases. Wired through FormState defaults, edit-mode hydration, the submit payload, and ClientFormSchema validation. --- .../src/pages/clients/ClientFormModal.tsx | 64 +++++++++++-------- frontend/src/schemas/client.ts | 1 + 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/frontend/src/pages/clients/ClientFormModal.tsx b/frontend/src/pages/clients/ClientFormModal.tsx index 7761466f..f605c137 100644 --- a/frontend/src/pages/clients/ClientFormModal.tsx +++ b/frontend/src/pages/clients/ClientFormModal.tsx @@ -79,6 +79,7 @@ interface FormState { expiryDate: Dayjs | null; delayedStart: boolean; delayedDays: number; + reset: number; limitIp: number; tgId: number; comment: string; @@ -99,6 +100,7 @@ function emptyForm(): FormState { expiryDate: null, delayedStart: false, delayedDays: 0, + reset: 0, limitIp: 0, tgId: 0, comment: '', @@ -157,6 +159,7 @@ export default function ClientFormModal({ flow: client.flow || '', reverseTag: client.reverse?.tag || '', totalGB: bytesToGB(client.totalGB || 0), + reset: Number(client.reset) || 0, limitIp: client.limitIp || 0, tgId: Number(client.tgId) || 0, comment: client.comment || '', @@ -280,6 +283,7 @@ export default function ClientFormModal({ totalGB: form.totalGB, delayedStart: form.delayedStart, delayedDays: form.delayedDays, + reset: form.reset, limitIp: form.limitIp, tgId: form.tgId, comment: form.comment, @@ -303,6 +307,7 @@ export default function ClientFormModal({ flow: showFlow ? (form.flow || '') : '', totalGB: gbToBytes(form.totalGB), expiryTime, + reset: Number(form.reset) || 0, limitIp: Number(form.limitIp) || 0, tgId: Number(form.tgId) || 0, comment: form.comment, @@ -452,32 +457,39 @@ export default function ClientFormModal({ - {(showFlow || showReverseTag) && ( - - {showFlow && ( - - - update('reverseTag', e.target.value)} /> - - - )} - - )} + + + + update('reset', Number(v) || 0)} /> + + + {showReverseTag && ( + + + update('reverseTag', e.target.value)} /> + + + )} + {showFlow && ( + + +