diff --git a/apps/edr-freight-api/src/seed/freight-permissions.registry.ts b/apps/edr-freight-api/src/seed/freight-permissions.registry.ts index 1f82f6e93..d8fedcd6e 100644 --- a/apps/edr-freight-api/src/seed/freight-permissions.registry.ts +++ b/apps/edr-freight-api/src/seed/freight-permissions.registry.ts @@ -302,8 +302,6 @@ export const SCHEDULING_EXTRA_PERMISSIONS: FreightPermissionSeed[] = [ // L. Administration & settings (split from the coarse admin umbrella) export const CONFIG_SETTINGS_PERMISSIONS: FreightPermissionSeed[] = [ - perm('b3a00001-0001-4000-8000-000000000001', 'edr_freight_app:config:contract_validity:view', 'View contract validity periods'), - perm('b3a00001-0001-4000-8000-000000000002', 'edr_freight_app:config:contract_validity:manage', 'Manage contract validity periods'), perm('b4a00001-0001-4000-8000-000000000001', 'edr_freight_app:settings:file_upload:view', 'View file-upload settings'), perm('b4a00001-0001-4000-8000-000000000002', 'edr_freight_app:settings:file_upload:manage', 'Manage file-upload settings'), perm('b4b00001-0001-4000-8000-000000000001', 'edr_freight_app:settings:dropdown:view', 'View dropdown settings'), @@ -594,12 +592,6 @@ export const FREIGHT_PERMS = { cancel: 'edr_freight_app:warehouse_fee_invoices:cancel', pay: 'edr_freight_app:warehouse_fee_invoices:pay', }, - config: { - contractValidity: { - view: 'edr_freight_app:config:contract_validity:view', - manage: 'edr_freight_app:config:contract_validity:manage', - }, - }, settings: { fileUpload: { view: 'edr_freight_app:settings:file_upload:view', diff --git a/apps/edr-freight-web/backoffice/src/App.tsx b/apps/edr-freight-web/backoffice/src/App.tsx index d216447f3..77ff95c2d 100644 --- a/apps/edr-freight-web/backoffice/src/App.tsx +++ b/apps/edr-freight-web/backoffice/src/App.tsx @@ -548,11 +548,6 @@ const buildSidebarSections = (demoItems: SidebarItem[]): SidebarSection[] => [ icon: , children: [ ...getCategorySidebarChildren("configuration"), - { - label: "Contract validity", - href: "/dashboard/configuration/contract-validity-periods", - permission: FREIGHT_PERMS.config.contractValidity.view, - }, { label: "Train scheduling rules", href: "/dashboard/configuration/train-scheduling-rules", @@ -1463,14 +1458,14 @@ const App = () => { } /> - } - /> + /> */} } /> ; @@ -29,6 +31,7 @@ export function ContractApprovalStepsCard({ contract, mutations, }: ContractApprovalStepsCardProps) { + const { user } = useAuth(); const [confirmOpen, setConfirmOpen] = useState(false); const [pendingStep, setPendingStep] = useState(null); @@ -166,6 +169,10 @@ export function ContractApprovalStepsCard({ key={step.id} step={step} isNext={actionable && nextPending?.id === step.id} + // Buttons show only to the step's actual approver (matching + // position type): a chief step never offers Approve/Reject to a + // marketing officer. Everyone still sees the "next" highlight. + canAct={canApproveContractStep(user, step.requiredRole)} isPending={ mutations.approveStep.isPending || mutations.rejectStep.isPending @@ -306,12 +313,14 @@ export function ContractApprovalStepsCard({ function StepRow({ step, isNext, + canAct, isPending, onApprove, onReject, }: { step: Freight.IContractApprovalStep; isNext: boolean; + canAct: boolean; isPending: boolean; onApprove: () => void; onReject: () => void; @@ -372,8 +381,11 @@ function StepRow({ )} - - {isNext && step.status === "PENDING" && ( + {/* One element type per row: action buttons on the active step (they + already imply "pending & actionable"), a status badge otherwise. + Mixing compact buttons + a badge here made them read as misaligned. */} + + {isNext && canAct && step.status === "PENDING" ? ( <>