diff --git a/apps/edr-freight-web/backoffice/src/App.tsx b/apps/edr-freight-web/backoffice/src/App.tsx
index 744fa17d8..dcbb6f50a 100644
--- a/apps/edr-freight-web/backoffice/src/App.tsx
+++ b/apps/edr-freight-web/backoffice/src/App.tsx
@@ -317,7 +317,7 @@ const App = () => {
}
+ element={}
/>
} />
diff --git a/apps/edr-freight-web/backoffice/src/constants/URLS.ts b/apps/edr-freight-web/backoffice/src/constants/URLS.ts
index 7449ae7f3..99f817b74 100644
--- a/apps/edr-freight-web/backoffice/src/constants/URLS.ts
+++ b/apps/edr-freight-web/backoffice/src/constants/URLS.ts
@@ -212,8 +212,8 @@ export const URL_CONSTANTS = {
WAGON_TYPES: "/wagon-types",
WAGON_TYPE_BY_ID: (id: string) => `/wagon-types/${id}`,
- PRIORITY_RULES: "/priority-rules",
- PRIORITY_RULE_BY_ID: (id: string) => `/priority-rules/${id}`,
+ PRIORITY_CONFIGS: "/priority-configs",
+ PRIORITY_CONFIG_BY_ID: (id: string) => `/priority-configs/${id}`,
SERVICE_TYPES: "/service-types",
SERVICE_TYPE_BY_ID: (id: string) => `/service-types/${id}`,
diff --git a/apps/edr-freight-web/backoffice/src/pages/ruleEngine/config/resources.ts b/apps/edr-freight-web/backoffice/src/pages/ruleEngine/config/resources.ts
index 689f994c0..6ac2b29c7 100644
--- a/apps/edr-freight-web/backoffice/src/pages/ruleEngine/config/resources.ts
+++ b/apps/edr-freight-web/backoffice/src/pages/ruleEngine/config/resources.ts
@@ -110,7 +110,15 @@ const RATE_UNITS = ["PER_WAGON", "PER_TON", "PER_CONTAINER", "PER_KM", "FLAT"].m
value: v,
}));
-const CURRENCIES = [{ label: "USD", value: "USD" }];
+const CURRENCIES = [
+ { label: "USD", value: "USD" },
+ { label: "ETB", value: "ETB" },
+];
+
+const PRIORITY_CONFIG_TYPES = [
+ { label: "Wagon count", value: "WAGON" },
+ { label: "Payment currency", value: "CURRENCY" },
+];
const codeColumn = (key: string, header = "Code"): ResourceColumn => ({
id: key,
@@ -226,29 +234,42 @@ export const RULE_ENGINE_RESOURCES: RuleEngineResourceConfig[] = [
],
},
{
- slug: "priority-rules",
+ slug: "priority-configs",
label: "Priority Rules",
category: "rules",
- subtitle: "Booking priority scoring rules",
+ subtitle: "Wagon-count and payment-currency scoring rules",
searchPlaceholder: "Search priority rules...",
+ orderConfig: { field: "displayOrder", label: "Display order" },
columns: [
- codeColumn("code"),
{ id: "label", header: "Label", accessorKey: "label" },
- { id: "score", header: "Score", accessorKey: "score", format: "number" },
- { id: "conditionCurrency", header: "Currency", accessorKey: "conditionCurrency" },
+ { id: "type", header: "Type", accessorKey: "type" },
+ { id: "currency", header: "Currency", accessorKey: "currency" },
+ { id: "minWagonCount", header: "Min wagons", accessorKey: "minWagonCount", format: "number" },
+ { id: "maxWagonCount", header: "Max wagons", accessorKey: "maxWagonCount", format: "number" },
+ { id: "scorePoints", header: "Points", accessorKey: "scorePoints", format: "number" },
activeColumn,
],
formFields: [
{ name: "label", label: "Label", type: "text", required: true },
- { name: "score", label: "Score", type: "number", required: true },
{
- name: "conditionCurrency",
- label: "Condition currency",
+ name: "type",
+ label: "Type",
+ type: "select",
+ required: true,
+ options: PRIORITY_CONFIG_TYPES,
+ placeholder: "Wagon count or payment currency",
+ },
+ {
+ name: "currency",
+ label: "Currency (required for Payment currency type)",
type: "select",
optional: true,
- options: [{ label: "Any", value: RULE_ENGINE_SELECT_NONE }, ...CURRENCIES],
- placeholder: "Any currency (optional)",
+ options: [{ label: "None", value: RULE_ENGINE_SELECT_NONE }, ...CURRENCIES],
+ placeholder: "Leave as None for Wagon count rules",
},
+ { name: "minWagonCount", label: "Min wagon count", type: "number", required: true },
+ { name: "maxWagonCount", label: "Max wagon count", type: "number", required: true },
+ { name: "scorePoints", label: "Score points", type: "number", required: true },
{ name: "isActive", label: "Active", type: "boolean" },
],
},
@@ -500,7 +521,7 @@ export const getCategorySidebarChildren = (
}));
export const DEFAULT_CONFIGURATION_SLUG: RuleEngineResourceSlug = "cargo-types";
-export const DEFAULT_RULES_SLUG: RuleEngineResourceSlug = "priority-rules";
+export const DEFAULT_RULES_SLUG: RuleEngineResourceSlug = "priority-configs";
/** @deprecated Use DEFAULT_CONFIGURATION_SLUG */
export const DEFAULT_RULE_ENGINE_SLUG = DEFAULT_CONFIGURATION_SLUG;
diff --git a/apps/edr-freight-web/backoffice/src/services/ruleEngine/ruleEngine.service.ts b/apps/edr-freight-web/backoffice/src/services/ruleEngine/ruleEngine.service.ts
index 38328c782..9f092f46d 100644
--- a/apps/edr-freight-web/backoffice/src/services/ruleEngine/ruleEngine.service.ts
+++ b/apps/edr-freight-web/backoffice/src/services/ruleEngine/ruleEngine.service.ts
@@ -28,7 +28,7 @@ const RESOURCE_BASE: Record = {
"cargo-types": URL_CONSTANTS.RULE_ENGINE.CARGO_TYPES,
"container-types": URL_CONSTANTS.RULE_ENGINE.CONTAINER_TYPES,
"wagon-types": URL_CONSTANTS.RULE_ENGINE.WAGON_TYPES,
- "priority-rules": URL_CONSTANTS.RULE_ENGINE.PRIORITY_RULES,
+ "priority-configs": URL_CONSTANTS.RULE_ENGINE.PRIORITY_CONFIGS,
"service-types": URL_CONSTANTS.RULE_ENGINE.SERVICE_TYPES,
"surcharge-types": URL_CONSTANTS.RULE_ENGINE.SURCHARGE_TYPES,
"weight-limit-rules": URL_CONSTANTS.RULE_ENGINE.WEIGHT_LIMIT_RULES,
@@ -46,8 +46,8 @@ const byIdPath = (resource: RuleEngineResourceSlug, id: string): string => {
return URL_CONSTANTS.RULE_ENGINE.CONTAINER_TYPE_BY_ID(id);
case "wagon-types":
return URL_CONSTANTS.RULE_ENGINE.WAGON_TYPE_BY_ID(id);
- case "priority-rules":
- return URL_CONSTANTS.RULE_ENGINE.PRIORITY_RULE_BY_ID(id);
+ case "priority-configs":
+ return URL_CONSTANTS.RULE_ENGINE.PRIORITY_CONFIG_BY_ID(id);
case "service-types":
return URL_CONSTANTS.RULE_ENGINE.SERVICE_TYPE_BY_ID(id);
case "surcharge-types":
diff --git a/apps/edr-freight-web/backoffice/src/types/rule-engine/index.ts b/apps/edr-freight-web/backoffice/src/types/rule-engine/index.ts
index 041907f59..69cb05058 100644
--- a/apps/edr-freight-web/backoffice/src/types/rule-engine/index.ts
+++ b/apps/edr-freight-web/backoffice/src/types/rule-engine/index.ts
@@ -2,7 +2,7 @@ export type RuleEngineResourceSlug =
| "cargo-types"
| "container-types"
| "wagon-types"
- | "priority-rules"
+ | "priority-configs"
| "service-types"
| "surcharge-types"
| "weight-limit-rules"