@@ -477,8 +477,8 @@ export default function Show({
|
||||
</ActionBar>
|
||||
</div>
|
||||
))}
|
||||
<div className="grid gap-6 lg:grid-cols-3">
|
||||
<div className="space-y-6 lg:col-span-2">
|
||||
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
|
||||
<div className="min-w-0 space-y-6 lg:col-span-2">
|
||||
<Panel title="Detalhes do pedido">
|
||||
<dl className="grid gap-5 text-sm sm:grid-cols-3">
|
||||
<div>
|
||||
@@ -715,7 +715,7 @@ export default function Show({
|
||||
</Panel>
|
||||
)}
|
||||
</div>
|
||||
<div className="space-y-6">
|
||||
<div className="min-w-0 space-y-6">
|
||||
{approvalRouting &&
|
||||
approvalRouting.status !== 'inactive' && (
|
||||
<Panel
|
||||
|
||||
@@ -14,6 +14,10 @@ import LegalChargeFields, {
|
||||
type LegalChargeDraft,
|
||||
} from '@/components/import-legal-charges';
|
||||
import { estimateMinor, estimateMoney } from '@/lib/import-estimate-money';
|
||||
import {
|
||||
specificRateLabel,
|
||||
specificRateMinor,
|
||||
} from '@/lib/import-legal-specific-rate';
|
||||
import { date, money } from '@/types/procurement';
|
||||
|
||||
type LegalData = {
|
||||
@@ -427,7 +431,8 @@ function ChargeEstimate({
|
||||
{['specific', 'maximum'].includes(charge.method) && (
|
||||
<label className="grid gap-1">
|
||||
Quantidade em {charge.quantity_unit} · taxa{' '}
|
||||
{money(charge.specific_minor)} por unidade
|
||||
{specificRateLabel(charge.specific_minor)} por
|
||||
unidade
|
||||
<input
|
||||
inputMode="decimal"
|
||||
className={controlClass}
|
||||
@@ -750,11 +755,15 @@ export default function ImportLegal(props: Props) {
|
||||
))}
|
||||
</Panel>
|
||||
<Panel
|
||||
title="Regras e fontes preservadas"
|
||||
title="Regras preparadas e publicadas"
|
||||
description="Uma nova preparação conserva a última publicação até ser validada. Retirar uma regra impede novas sugestões e conserva as decisões anteriores."
|
||||
>
|
||||
{props.rules.data.length === 0 && (
|
||||
<p>Ainda não existem fontes neste âmbito.</p>
|
||||
<p>
|
||||
Ainda não existem regras neste âmbito. Os diplomas
|
||||
disponíveis para consulta são apresentados
|
||||
separadamente.
|
||||
</p>
|
||||
)}
|
||||
{props.rules.data.map((rule) => (
|
||||
<article key={rule.id} className="space-y-2 border-b py-4">
|
||||
@@ -893,12 +902,13 @@ export default function ImportLegal(props: Props) {
|
||||
Preparar a partir do exemplar oficial
|
||||
</h3>
|
||||
<p className="text-sm">
|
||||
Transcrição da página 2180-(4) da Lei 8/2025,
|
||||
com início em 01/01/2026. Inclui apenas a taxa
|
||||
geral dessa edição; não é uma pauta consolidada
|
||||
nem determina isenções, preferências ou outras
|
||||
imposições. A preparação continua editável e
|
||||
exige gravação e decisão expressas.
|
||||
Transcrição do anexo da Lei 8/2025, páginas
|
||||
2180-(4) a (7), com início em 01/01/2026. Inclui
|
||||
apenas a taxa geral dessa edição; não é uma
|
||||
pauta consolidada nem determina isenções,
|
||||
preferências ou outras imposições. A preparação
|
||||
continua editável e exige gravação e decisão
|
||||
expressas.
|
||||
</p>
|
||||
{form.isDirty && (
|
||||
<p className="text-sm">
|
||||
@@ -907,56 +917,75 @@ export default function ImportLegal(props: Props) {
|
||||
existente será conservado.
|
||||
</p>
|
||||
)}
|
||||
<div className="grid gap-2">
|
||||
{props.referenceDrafts?.map((draft) => (
|
||||
<Button
|
||||
key={`${draft.source_id}:${draft.code}`}
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="h-auto justify-start text-left whitespace-normal"
|
||||
disabled={
|
||||
<label className="grid gap-1">
|
||||
Código do anexo e fonte
|
||||
<select
|
||||
className={controlClass}
|
||||
value=""
|
||||
disabled={
|
||||
form.isDirty ||
|
||||
form.processing ||
|
||||
form.data.record_key !== null
|
||||
}
|
||||
onChange={(event) => {
|
||||
if (
|
||||
form.isDirty ||
|
||||
form.processing ||
|
||||
form.data.record_key !== null
|
||||
}
|
||||
onClick={() => {
|
||||
form.setData({
|
||||
...form.data,
|
||||
operation_key: '',
|
||||
record_key: null,
|
||||
version: 0,
|
||||
action: 'save',
|
||||
title: draft.title,
|
||||
official_reference:
|
||||
draft.official_reference,
|
||||
official_url:
|
||||
draft.official_url ?? '',
|
||||
citation: draft.citation,
|
||||
valid_from: draft.valid_from,
|
||||
valid_until: '',
|
||||
match_code: draft.code,
|
||||
suggested_code: draft.code,
|
||||
origin_country: '',
|
||||
sector: '',
|
||||
obligations: draft.obligations,
|
||||
document_types: [],
|
||||
reason: '',
|
||||
file: null,
|
||||
source_id: String(
|
||||
draft.source_id,
|
||||
),
|
||||
charges: chargeDrafts(
|
||||
draft.charges,
|
||||
),
|
||||
});
|
||||
form.clearErrors();
|
||||
}}
|
||||
>
|
||||
{draft.code} — {draft.description} —
|
||||
taxa geral {draft.rate_percent}%
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
return;
|
||||
const draft =
|
||||
props.referenceDrafts?.find(
|
||||
(item) =>
|
||||
`${item.source_id}:${item.code}` ===
|
||||
event.target.value,
|
||||
);
|
||||
if (!draft) return;
|
||||
form.setData({
|
||||
...form.data,
|
||||
operation_key: '',
|
||||
record_key: null,
|
||||
version: 0,
|
||||
action: 'save',
|
||||
title: draft.title,
|
||||
official_reference:
|
||||
draft.official_reference,
|
||||
official_url:
|
||||
draft.official_url ?? '',
|
||||
citation: draft.citation,
|
||||
valid_from: draft.valid_from,
|
||||
valid_until: '',
|
||||
match_code: draft.code,
|
||||
suggested_code: draft.code,
|
||||
origin_country: '',
|
||||
sector: '',
|
||||
obligations: draft.obligations,
|
||||
document_types: [],
|
||||
reason: '',
|
||||
file: null,
|
||||
source_id: String(draft.source_id),
|
||||
charges: chargeDrafts(
|
||||
draft.charges,
|
||||
),
|
||||
});
|
||||
form.clearErrors();
|
||||
}}
|
||||
>
|
||||
<option value="">
|
||||
Seleccione para preencher uma preparação
|
||||
</option>
|
||||
{props.referenceDrafts?.map((draft) => (
|
||||
<option
|
||||
key={`${draft.source_id}:${draft.code}`}
|
||||
value={`${draft.source_id}:${draft.code}`}
|
||||
>
|
||||
{draft.code} — {draft.description} —
|
||||
taxa geral {draft.rate_percent}% —
|
||||
fonte #{draft.source_id}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
<form
|
||||
@@ -983,7 +1012,7 @@ export default function ImportLegal(props: Props) {
|
||||
specific_minor:
|
||||
charge.specific_amount === ''
|
||||
? null
|
||||
: estimateMinor(
|
||||
: specificRateMinor(
|
||||
charge.specific_amount,
|
||||
),
|
||||
quantity_unit: charge.quantity_unit || null,
|
||||
@@ -1151,13 +1180,15 @@ export default function ImportLegal(props: Props) {
|
||||
<Button disabled={form.processing}>
|
||||
Guardar preparação para validação aduaneira
|
||||
</Button>
|
||||
{form.data.record_key && (
|
||||
{(form.isDirty || form.data.record_key) && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() => form.reset()}
|
||||
>
|
||||
Preparar outra regra
|
||||
{form.data.record_key
|
||||
? 'Preparar outra regra'
|
||||
: 'Limpar preparação'}
|
||||
</Button>
|
||||
)}
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user