mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-02 09:13:42 +00:00
contrat nad booking modification
This commit is contained in:
@@ -9,7 +9,10 @@ import {
|
||||
type SubmitPriorityRuleChangePayload,
|
||||
type SubmitRateChangePayload,
|
||||
} from "@/services/ruleEngine/ruleEngine.service";
|
||||
import { RULE_ENGINE_SELECT_NONE } from "@/pages/ruleEngine/config/resources";
|
||||
import {
|
||||
LEGACY_APPROVAL_ROLES,
|
||||
RULE_ENGINE_SELECT_NONE,
|
||||
} from "@/pages/ruleEngine/config/resources";
|
||||
import type {
|
||||
RuleEngineRecord,
|
||||
RuleEngineResourceSlug,
|
||||
@@ -155,6 +158,33 @@ export const useContainerTypeOptions = (
|
||||
select: (rows) => buildContainerTypeSelectOptions(rows, includeNone),
|
||||
});
|
||||
|
||||
/**
|
||||
* Approval-step role options, sourced from the live IAM position types. The
|
||||
* three pre-IAM role strings are appended (marked "(legacy)") so an approval
|
||||
* rule still stored against one of them renders its label instead of an empty
|
||||
* select; a position type that reuses one of those values wins the dedupe.
|
||||
*/
|
||||
export const useApprovalRoleOptions = (enabled = true) =>
|
||||
useQuery({
|
||||
queryKey: QUERY_KEYS.RULE_ENGINE.selectOptions("approval-rules", {
|
||||
positionTypes: true,
|
||||
}),
|
||||
queryFn: () => ruleEngineService.getApprovalPositionTypes(),
|
||||
enabled,
|
||||
select: (rows): { label: string; value: string }[] => {
|
||||
const byValue = new Map<string, { label: string; value: string }>();
|
||||
for (const row of rows) {
|
||||
const value = String(row?.value ?? "").trim();
|
||||
if (!value) continue;
|
||||
byValue.set(value, { label: String(row.label ?? "").trim() || value, value });
|
||||
}
|
||||
for (const legacy of LEGACY_APPROVAL_ROLES) {
|
||||
if (!byValue.has(legacy.value)) byValue.set(legacy.value, legacy);
|
||||
}
|
||||
return [...byValue.values()];
|
||||
},
|
||||
});
|
||||
|
||||
/** A yard option that remembers its country, so callers can filter by leg. */
|
||||
export interface YardOption {
|
||||
label: string;
|
||||
|
||||
Reference in New Issue
Block a user