fix(ui): синхронизация contract-number и горизонтальная дата
- ContractNumberField: mode и customerValue теперь синхронизируются с value prop через useEffect - TaskDetail: date/datetime input используют w-auto, чтобы чекбокс автопролонгации шёл в одну строку
This commit is contained in:
@@ -65,6 +65,18 @@ export default function ContractNumberField({
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string>('');
|
||||
|
||||
// Синхронизируем локальное состояние с value prop, чтобы при повторном открытии
|
||||
// глобального редактирования mode и customerValue соответствовали сохранённому значению.
|
||||
useEffect(() => {
|
||||
setMode(parsed.mode);
|
||||
}, [parsed.mode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (parsed.mode === 'customer') {
|
||||
setCustomerValue(parsed.value);
|
||||
}
|
||||
}, [parsed.mode, parsed.value]);
|
||||
|
||||
const legalEntityFormId = config?.legalEntityFormId;
|
||||
const legalEntityTaskId = parsed.legalEntityTaskId;
|
||||
|
||||
|
||||
@@ -998,7 +998,7 @@ function FieldValueRow({
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<input
|
||||
type="date"
|
||||
className={inputClass}
|
||||
className={cn(inputClass, 'w-auto')}
|
||||
value={isProlongation ? '' : (editorValue ? String(editorValue).split('T')[0] : '')}
|
||||
onChange={e => onDraftChange?.(e.target.value)}
|
||||
onClick={e => e.stopPropagation()}
|
||||
@@ -1026,7 +1026,7 @@ function FieldValueRow({
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<input
|
||||
type="datetime-local"
|
||||
className={inputClass}
|
||||
className={cn(inputClass, 'w-auto')}
|
||||
value={isProlongation ? '' : (editorValue ? String(editorValue).slice(0, 16) : '')}
|
||||
onChange={e => onDraftChange?.(e.target.value)}
|
||||
onClick={e => e.stopPropagation()}
|
||||
|
||||
Reference in New Issue
Block a user