Entrega dashboard e correccoes transversais preservando Ofertas instalado
tests / ci (push) Canceled after 0s
tests / ci (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import CurrencySelect from './currency-select';
|
||||
|
||||
/** A planning interval is not the amount used in a financial calculation. */
|
||||
export default function InvestmentBudgetRange({
|
||||
values,
|
||||
onChange,
|
||||
}: {
|
||||
values: Record<string, string>;
|
||||
onChange?: (field: string, value: string) => void;
|
||||
}) {
|
||||
if (
|
||||
!onChange &&
|
||||
!values.investment_budget_min &&
|
||||
!values.investment_budget_max
|
||||
)
|
||||
return null;
|
||||
return (
|
||||
<section className="grid gap-3 rounded border p-4">
|
||||
<h3 className="font-semibold">Orçamento previsto</h3>
|
||||
{onChange ? (
|
||||
<>
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
{(
|
||||
[
|
||||
'investment_budget_min',
|
||||
'investment_budget_max',
|
||||
] as const
|
||||
).map((field, index) => (
|
||||
<label key={field} className="grid gap-1">
|
||||
{index === 0 ? 'Desde' : 'Até'}
|
||||
<input
|
||||
className="min-w-0 rounded border p-2"
|
||||
type="number"
|
||||
min="0"
|
||||
step="any"
|
||||
value={values[field] ?? ''}
|
||||
onChange={(event) =>
|
||||
onChange(field, event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
<CurrencySelect
|
||||
label="Moeda do orçamento"
|
||||
value={values.currency ?? ''}
|
||||
onChange={(value) => onChange('currency', value)}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<p>
|
||||
{values.investment_budget_min || 'Mínimo por indicar'} –{' '}
|
||||
{values.investment_budget_max || 'Máximo por indicar'}{' '}
|
||||
{values.currency}
|
||||
</p>
|
||||
)}
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Este intervalo orienta a preparação. O valor de cada cenário de
|
||||
investimento será indicado por si no simulador.
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user