klg-asutk-app/components/AuditCreateModal.tsx
Yuriy aa052763f6 Безопасность и качество: 8 исправлений + обновления
- .env.example: полный шаблон, защита секретов
- .gitignore: явное исключение .env.* и секретов
- layout.tsx: XSS — заменён dangerouslySetInnerHTML на next/script для SW
- ESLint: no-console error (allow warn/error), ignore scripts/
- scripts/remove-console-logs.js: очистка console.log без glob
- backend/routes/modules: README с планом рефакторинга крупных файлов
- SECURITY.md: гид по секретам, XSS, CORS, auth, линту
- .husky/pre-commit: запуск npm run lint

+ прочие правки приложения и бэкенда

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-14 21:29:16 +03:00

31 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import { useState } from 'react';
import { Modal } from '@/components/ui';
import FormField from '@/components/ui/FormField';
interface Props { isOpen: boolean; onClose: () => void; onCreate: (data: any) => void; templates?: any[]; aircraft?: any[]; }
export default function AuditCreateModal({ isOpen, onClose, onCreate, templates = [], aircraft = [] }: Props) {
const [form, setForm] = useState({ aircraft_id: '', template_id: '', planned_at: '' });
const set = (k: string, v: string) => setForm(f => ({ ...f, [k]: v }));
return (
<Modal isOpen={isOpen} onClose={onClose} title="Создать аудит" size="md"
footer={<><button onClick={onClose} className="btn-secondary">Отмена</button><button onClick={() => { if (!form.aircraft_id) return alert('Укажите ВС'); onCreate(form); }} className="btn-primary">Создать</button></>}>
<FormField label="Воздушное судно" required>
<select value={form.aircraft_id} onChange={e => set('aircraft_id', e.target.value)} className="input-field">
<option value=""> Выберите ВС </option>
{aircraft.map((a: any) => <option key={a.id} value={a.id}>{a.registrationNumber || a.id.slice(0, 8)}</option>)}
</select>
</FormField>
<FormField label="Шаблон">
<select value={form.template_id} onChange={e => set('template_id', e.target.value)} className="input-field">
<option value=""> Без шаблона </option>
{templates.map((t: any) => <option key={t.id} value={t.id}>{t.name}</option>)}
</select>
</FormField>
<FormField label="Плановая дата"><input type="date" value={form.planned_at} onChange={e => set('planned_at', e.target.value)} className="input-field" /></FormField>
</Modal>
);
}