From a6ecc65b973bf8c24f33fcebc4136e0ec1193833 Mon Sep 17 00:00:00 2001 From: nns <278048682+nurdotnet@users.noreply.github.com> Date: Wed, 6 May 2026 11:20:39 +0500 Subject: [PATCH] =?UTF-8?q?feat(forms):=20MoneyInput=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D1=8F=20=C2=AB=D0=9E=D0=BA=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=C2=BB=20=D0=B2=20=D0=BA=D0=B0=D1=80=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=BA=D0=B5=20=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Раньше Salary был с примитивной валидацией. Заменено на MoneyInput (как в ценах товаров и др. денежных полях), который: - читает org-setting allowFractionalPrices (копейки или нет); - показывает символ валюты (₸/$/€) справа; - хранит draft-string для бесшовного ввода 100.50 без потери точки; - onBlur нормализует значение. Тип формы изменён: `salary: string` → `salary: number | null`, сохранение payload берёт значение напрямую без Number() парсинга. Других денежных полей в формах сотрудников/контрагентов (зарплаты, авансы, штрафы, доплаты) сейчас НЕТ — есть только Salary в Employee и MoneyInput уже используется в ProductEditPage (цены) и SupplyEditPage (себестоимость и сумма по позициям). Поэтому пункт закрыт одной правкой EmployeesPage. --- src/food-market.web/src/pages/EmployeesPage.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/food-market.web/src/pages/EmployeesPage.tsx b/src/food-market.web/src/pages/EmployeesPage.tsx index 1cf2302..9381014 100644 --- a/src/food-market.web/src/pages/EmployeesPage.tsx +++ b/src/food-market.web/src/pages/EmployeesPage.tsx @@ -8,7 +8,7 @@ import { Pagination } from '@/components/Pagination' import { SearchBar } from '@/components/SearchBar' import { Button } from '@/components/Button' import { Modal } from '@/components/Modal' -import { Field, TextInput, TextArea, Checkbox } from '@/components/Field' +import { Field, TextInput, TextArea, Checkbox, MoneyInput } from '@/components/Field' import { PhoneInput } from '@/components/PhoneInput' import { useCatalogList, useCatalogMutations } from '@/lib/useCatalog' import type { PagedResult, RetailPoint } from '@/lib/types' @@ -51,7 +51,10 @@ interface Form { position: string email: string phone: string - salary: string + /** Денежное значение в валюте организации (берётся из useOrgSettings). + * Используется MoneyInput, который сам формирует с копейками или без + * в зависимости от org-setting allowFractionalPrices. */ + salary: number | null taxNumber: string description: string imageUrl: string @@ -64,7 +67,7 @@ interface Form { const blankForm = (): Form => ({ lastName: '', firstName: '', middleName: '', position: '', email: '', phone: '', - salary: '', taxNumber: '', description: '', imageUrl: '', + salary: null, taxNumber: '', description: '', imageUrl: '', roleId: '', isActive: true, retailPointIds: [], createAccount: true, @@ -113,7 +116,7 @@ export function EmployeesPage() { const payload = { lastName: form.lastName, firstName: form.firstName, middleName: form.middleName || null, position: form.position || null, email: form.email || null, phone: form.phone || null, - salary: form.salary ? Number(form.salary) : null, + salary: form.salary, taxNumber: form.taxNumber || null, description: form.description || null, imageUrl: form.imageUrl || null, @@ -178,7 +181,7 @@ export function EmployeesPage() { setForm({ id: r.id, lastName: r.lastName, firstName: r.firstName, middleName: r.middleName ?? '', position: r.position ?? '', email: r.email ?? '', phone: r.phone ?? '', - salary: r.salary != null ? String(r.salary) : '', + salary: r.salary, taxNumber: r.taxNumber ?? '', description: r.description ?? '', imageUrl: r.imageUrl ?? '', roleId: r.roleId, isActive: r.isActive, retailPointIds: r.retailPointIds, createAccount: false, @@ -296,7 +299,7 @@ export function EmployeesPage() {
- setForm({ ...form, salary: e.target.value })} placeholder="—" /> + setForm({ ...form, salary: v })} /> setForm({ ...form, taxNumber: e.target.value })} placeholder="12 цифр" maxLength={12} inputMode="numeric" />