feat(offers): implement phase four private details and confidentiality in QA

This commit is contained in:
2026-11-14 17:28:12 +02:00
parent 7691cab3bc
commit e431de8b42
29 changed files with 2356 additions and 12 deletions
@@ -0,0 +1,11 @@
import { Head } from '@inertiajs/react';
import OfferConfidentialAccess from '@/components/offer-confidential-access';
export default function OfferConfidentiality({ offerId }: { offerId: number }) {
return (
<main className="mx-auto w-full max-w-3xl space-y-4 p-4">
<Head title="Acesso confidencial" />
<h1 className="text-2xl font-semibold">Acesso confidencial</h1>
<OfferConfidentialAccess id={offerId} />
</main>
);
}
+45 -1
View File
@@ -10,8 +10,13 @@ import { createOperationKey } from '@/lib/operation-key';
import { profileJson, ProfileValidationError } from '@/lib/profile-json';
import OfferEditorialReview from '@/components/offer-editorial-review';
import { type OfferEditorialRecord } from '@/lib/offer-editorial';
import OfferParticularsFields, {
type OfferParticulars,
} from '@/components/offer-particulars';
import OfferPrivateResources from '@/components/offer-private-resources';
import OfferConfidentialAccess from '@/components/offer-confidential-access';
type Offer = {
type Offer = OfferParticulars & {
price_mode?: string | null;
amount?: string | null;
currency?: string | null;
@@ -49,11 +54,15 @@ export default function OfferPreparation({
contexts,
contacts,
contactInvestors,
sectors,
propertyTypes,
}: {
record: RecordData | null;
contexts: Context[];
contacts: Contact[];
contactInvestors: { id: string; legal_name: string }[];
sectors: { id: number; name: string }[];
propertyTypes: string[];
}) {
const [saved, setSaved] = useState(record);
const [creationKey] = useState(createOperationKey);
@@ -417,6 +426,41 @@ export default function OfferPreparation({
</button>
)}
</form>
<OfferParticularsFields
value={offer}
category={context.type}
sectors={sectors}
propertyTypes={propertyTypes}
disabled={busy || readOnly}
onChange={(next) => updateOffer({ ...offer, ...next })}
/>
{saved && (
<OfferPrivateResources
id={saved.id}
etag={saved.etag}
editable={saved.canEdit}
property={context.type === 'real_estate'}
disabled={dirty || busy}
onChanged={(etag) => {
setSaved((previous) =>
previous ? { ...previous, etag } : previous,
);
setConfirmed(false);
}}
/>
)}
{saved && context.type === 'business_sale' && (
<OfferConfidentialAccess
key={`${saved.id}-${saved.state}`}
id={saved.id}
onChanged={(etag) => {
setSaved((previous) =>
previous ? { ...previous, etag } : previous,
);
setConfirmed(false);
}}
/>
)}
{saved?.canEdit && (
<details className="rounded-lg border p-4">
<summary className="cursor-pointer font-medium">