75 lines
2.8 KiB
TypeScript
75 lines
2.8 KiB
TypeScript
import { useForm, Link } from '@inertiajs/react';
|
|
import { Management } from '../management/shared';
|
|
import { Errors, button, labels } from './shared';
|
|
type Props = {
|
|
hash: string;
|
|
installed: boolean;
|
|
target: { database: string; port: number };
|
|
records: { id: number; title: string; user_id: number; status: string }[];
|
|
backupVerified: boolean;
|
|
qaVerified: boolean;
|
|
backupDate: string | null;
|
|
changes: string[];
|
|
};
|
|
export default function Installation(p: Props) {
|
|
const form = useForm({ hash: p.hash });
|
|
return (
|
|
<Management title="Aplicação da Bolsa de Parcerias">
|
|
<div className="space-y-5">
|
|
<p>
|
|
Destino: {p.target.database}:{p.target.port}. Estado:{' '}
|
|
{p.installed
|
|
? 'Instalada'
|
|
: 'Preparada para aplicação autenticada'}
|
|
.
|
|
</p>
|
|
<p>
|
|
Backup e restauro:{' '}
|
|
{p.backupVerified ? 'Comprovados' : 'Pendentes'} ·{' '}
|
|
{p.backupDate}. QA desta versão:{' '}
|
|
{p.qaVerified ? 'Comprovada' : 'Pendente'}.
|
|
</p>
|
|
<ul className="list-disc pl-5">
|
|
{p.changes.map((change) => (
|
|
<li key={change}>{change}</li>
|
|
))}
|
|
</ul>
|
|
<h2 className="text-xl font-bold">
|
|
Propostas antigas a preservar: {p.records.length}
|
|
</h2>
|
|
{p.records.map((record) => (
|
|
<p key={record.id}>
|
|
{record.id} · {record.title} · Autor {record.user_id} ·{' '}
|
|
{labels[record.status] ?? record.status}
|
|
</p>
|
|
))}
|
|
{!p.installed && (
|
|
<form
|
|
onSubmit={(e) => {
|
|
e.preventDefault();
|
|
form.post('/management/partnerships-install');
|
|
}}
|
|
>
|
|
<Errors errors={form.errors} />
|
|
<button
|
|
className={button}
|
|
disabled={
|
|
form.processing ||
|
|
!p.backupVerified ||
|
|
!p.qaVerified
|
|
}
|
|
>
|
|
Aplicar módulo preservando propostas
|
|
</button>
|
|
</form>
|
|
)}
|
|
{p.installed && (
|
|
<Link href="/parcerias/painel" className="underline">
|
|
Abrir painel da Bolsa
|
|
</Link>
|
|
)}
|
|
</div>
|
|
</Management>
|
|
);
|
|
}
|