) => {
+ setEditingData((prev) => {
+ const currentData = prev[id] || {};
+
+ return {
+ ...prev,
+ [id]: {
+ ...currentData,
+ ...changes,
+ passport: changes.passport
+ ? { ...currentData.passport, ...changes.passport }
+ : currentData.passport,
+ },
+ };
+ });
+ }, []);
+
+ const handleTableChange = (pagination: TablePaginationConfig) => {
+ if (pagination.current !== undefined) {
+ setPage(pagination.current - 1);
+ }
+
+ setEditingKey(null);
+ setEditingData({});
+ };
+
+ const columns = [
+ {
+ title: 'iD',
+ dataIndex: 'id',
+ },
+ {
+ title: 'Фамилия, Имя, Отчество',
+ render: (record: IContentPassengerTable) => {
+ const editable = isEditing(record);
+ const currentEditingData = editingData[record.id] || {};
+ return editable ? (
+
+ {
+ const trimmedValue = e.target.value.slice(0, 15);
+ setValue(`lastName-${record.id}`, trimmedValue);
+ handleInputChange(record.id, { lastName: trimmedValue });
+ await trigger(`lastName-${record.id}`);
+ }}
+ placeholder="Фамилия"
+ status={errors[`lastName-${record.id}`] ? 'error' : ''}
+ />
+ {errors[`lastName-${record.id}`] && (
+ {errors[`lastName-${record.id}`]?.message}
+ )}
+ {
+ const trimmedValue = e.target.value.slice(0, 15);
+ setValue(`firstName-${record.id}`, trimmedValue);
+ handleInputChange(record.id, { firstName: trimmedValue });
+ await trigger(`firstName-${record.id}`);
+ }}
+ placeholder="Имя"
+ status={errors[`firstName-${record.id}`] ? 'error' : ''}
+ />
+ {errors[`firstName-${record.id}`] && (
+ {errors[`firstName-${record.id}`]?.message}
+ )}
+ {
+ const lettersOnly = e.target.value.replace(/[^a-zA-Zа-яА-ЯёЁ]/g, '');
+ handleInputChange(record.id, {
+ passport: {
+ middleName: lettersOnly,
+ },
+ });
+ }}
+ placeholder="Отчество (при наличии)"
+ />
+
+ ) : (
+ `${record.lastName} ${record.firstName} ${record.passport.middleName === 'isAbsent' ? '' : record.passport.middleName}`
+ );
+ },
+ },
+ {
+ title: 'Пол',
+ render: (record: IContentPassengerTable) => {
+ const editable = isEditing(record);
+ const currentEditingData = editingData[record.id] || {};
+ const currentGender = currentEditingData.passport?.gender ?? record.passport.gender;
+ return editable ? (
+