export type OfferParticulars = { business?: Record | null; property?: Record | null; }; const control = 'w-full min-w-0 rounded-md border p-2'; const propertyLabels: Record = { house: 'Casa', apartment: 'Apartamento', office: 'Escritório', retail: 'Espaço comercial', warehouse: 'Armazém', hospitality: 'Hotelaria', industrial: 'Industrial', mixed_use: 'Uso misto', development: 'Empreendimento', other: 'Outro', }; export default function OfferParticularsFields({ value, category, sectors, propertyTypes, disabled, onChange, }: { value: OfferParticulars; category: string; sectors: { id: number; name: string }[]; propertyTypes: string[]; disabled: boolean; onChange: (next: OfferParticulars) => void; }) { if (!['business_sale', 'real_estate'].includes(category)) return null; const business = category === 'business_sale'; const group = business ? 'business' : 'property'; const data = value[group] ?? {}; const update = (key: string, next: string | string[] | null) => onChange({ ...value, [group]: { ...data, [key]: next } }); const text = (key: string, label: string, numeric = false) => ( ); const select = ( key: string, label: string, options: { value: string; label: string }[], ) => ( ); return (
{business ? 'Dados da empresa — acesso reservado' : 'Características do imóvel'}

Campos opcionais durante a preparação. A gravação não publica estes dados.

{business ? ( <> {['sector_id', 'secondary_sector_id'].map( (key, index) => select( key, index ? 'Sector secundário' : 'Sector principal', sectors.map((sector) => ({ value: String(sector.id), label: sector.name, })), ), )} {text('revenue', 'Receita resumida', true)} {text( 'cash_flow', 'Lucro ou fluxo de caixa resumido', true, )} {select('currency', 'Moeda dos valores da empresa', [ { value: 'MZN', label: 'MZN' }, { value: 'USD', label: 'USD' }, ])} {text('reason', 'Motivo da venda')} ) : ( <> {select('transaction_type', 'Tipo de negócio', [ { value: 'sale', label: 'Venda' }, { value: 'lease', label: 'Arrendamento' }, ])} {select( 'property_type', 'Tipo de imóvel', propertyTypes.map((type) => ({ value: type, label: propertyLabels[type] ?? type, })), )} {text('land_area', 'Área do terreno', true)} {text('built_area', 'Área construída', true)} {select('area_unit', 'Unidade da área', [ { value: 'sqm', label: 'm²' }, { value: 'ha', label: 'ha' }, { value: 'sqkm', label: 'km²' }, ])} {[ 'house', 'apartment', 'hospitality', 'mixed_use', ].includes(String(data.property_type)) && ( <> {text('bedrooms', 'Quartos', true)} {text('bathrooms', 'Casas de banho', true)} )}