@@ -1,5 +1,5 @@
|
||||
import { Link, useForm, usePage } from '@inertiajs/react';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { Frame, input, button, card } from '@/pages/investment/shared';
|
||||
type Option = {
|
||||
id: string;
|
||||
@@ -66,6 +66,14 @@ export default function Panel({
|
||||
organization_id: ['Organização representada', organizations],
|
||||
journey_id: ['Percurso territorial existente', journeys],
|
||||
} as const;
|
||||
const derivedTitle = useRef('');
|
||||
const contextTitle = journeys.find((item) => item.id === form.data.journey_id)?.name ?? submissions.find((item) => item.id === form.data.submission_id)?.name ?? companies.find((item) => item.id === form.data.company_id)?.name ?? '';
|
||||
useEffect(() => {
|
||||
if ((!form.data.title || form.data.title === derivedTitle.current) && contextTitle) {
|
||||
form.setData('title', contextTitle.slice(0, 200));
|
||||
derivedTitle.current = contextTitle.slice(0, 200);
|
||||
}
|
||||
}, [contextTitle, form.data.title]);
|
||||
return (
|
||||
<Frame title="Balcão Virtual — acompanhamento">
|
||||
<nav className="flex flex-wrap gap-4">
|
||||
@@ -102,6 +110,7 @@ export default function Panel({
|
||||
</section>
|
||||
<details className={card}>
|
||||
<summary>Preparar acompanhamento de um projecto</summary>
|
||||
<p>Selecione um percurso ou investimento da sua conta. O título é recuperado do registo existente quando disponível; pode corrigi-lo antes de guardar. A associação requer a sua autorização abaixo.</p>
|
||||
<form
|
||||
className="mt-4 space-y-3"
|
||||
onSubmit={(e) => {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Frame, card, input, button } from '@/pages/investment/shared';
|
||||
import CountrySelect, { type Country } from '@/components/country-select';
|
||||
import {
|
||||
DocumentReview,
|
||||
RequestOperations,
|
||||
@@ -32,6 +33,7 @@ export default function RequestPage({
|
||||
documents,
|
||||
payments,
|
||||
caseVersion,
|
||||
countries,
|
||||
}: {
|
||||
request: {
|
||||
id: string;
|
||||
@@ -73,6 +75,7 @@ export default function RequestPage({
|
||||
documents: DeskDocument[];
|
||||
payments: DeskPayment[];
|
||||
caseVersion: number;
|
||||
countries: Country[];
|
||||
events: {
|
||||
id: string;
|
||||
action: string;
|
||||
@@ -165,6 +168,10 @@ export default function RequestPage({
|
||||
form.put(`/balcao-virtual/pedidos/${request.id}`);
|
||||
}}
|
||||
>
|
||||
<label className="block" htmlFor="declared-origin-country">País de origem declarado desta solicitação</label>
|
||||
<CountrySelect id="declared-origin-country" countries={countries} value={form.data.payload.declared_origin_country_code ?? ''} disabled={!canEdit || form.processing || (request.status === 'returned' && !request.editable_fields.includes('declared_origin_country_code'))} onChange={(value) => form.setData('payload', { ...form.data.payload, declared_origin_country_code: value })} />
|
||||
<p>A origem não é deduzida do IP nem do país de residência. Pedidos antigos sem declaração mantêm “não informado”.</p>
|
||||
{form.errors['payload.declared_origin_country_code'] && <p role="alert">{form.errors['payload.declared_origin_country_code']}</p>}
|
||||
{Object.entries(definition.fields)
|
||||
.filter(
|
||||
([, f]) =>
|
||||
|
||||
Reference in New Issue
Block a user