feat(data): extend permission modules to cover all routed features + add assignedAgentId to leads
This commit is contained in:
+27
-2
@@ -8279,6 +8279,17 @@ function seedLeadsFromAttribution() {
|
||||
'HOA required repair; homeowner wants professional documentation for board approval.',
|
||||
];
|
||||
|
||||
// Canvasser name → canonical field-agent userId mapping for ABAC assignedAgentId
|
||||
const canvasserAgentMap = {
|
||||
'Cody Tatum': 'e1',
|
||||
'Hannah Reyes': 'e2',
|
||||
'Travis Boone': 'e3',
|
||||
'Shelby Greer': 'e4',
|
||||
'Dalton Pruitt': 'e5',
|
||||
};
|
||||
// Round-robin fallback agents (e1–e5)
|
||||
const agentFallback = ['e1','e2','e3','e4','e5'];
|
||||
|
||||
// Deterministic assignment based on SAL index so output is stable.
|
||||
return MOCK_STORM_ATTRIBUTION_LEADS.map((sal, idx) => {
|
||||
const canvasserName = canvassers[idx % canvassers.length];
|
||||
@@ -8318,8 +8329,9 @@ function seedLeadsFromAttribution() {
|
||||
const notes = canvassingNotes[idx % canvassingNotes.length];
|
||||
|
||||
// Assignment
|
||||
const assignedTo = repNames[idx % repNames.length];
|
||||
const followUpDate = followUpDates[idx % followUpDates.length];
|
||||
const assignedTo = repNames[idx % repNames.length];
|
||||
const followUpDate = followUpDates[idx % followUpDates.length];
|
||||
const assignedAgentId = canvasserAgentMap[canvasserName] ?? agentFallback[idx % agentFallback.length];
|
||||
|
||||
// Insurance block (only for Insurance leads)
|
||||
let insuranceBlock = {};
|
||||
@@ -8365,6 +8377,7 @@ function seedLeadsFromAttribution() {
|
||||
stormSource: sal.stormSource,
|
||||
createdAt: sal.createdAt,
|
||||
canvasserName,
|
||||
assignedAgentId,
|
||||
createdByName,
|
||||
isQuickCapture: false,
|
||||
// ── Enriched phone list ──
|
||||
@@ -9076,6 +9089,12 @@ export const MockStoreProvider = ({ children }) => {
|
||||
leads: { OWNER: ['view','log','verify'], ADMIN: ['view','log','verify'], SALES_REP: ['view','verify'], CANVASSER: ['view','log'], SUBCONTRACTOR: [] },
|
||||
leaderboard: { OWNER: ['view'], ADMIN: ['view'], SALES_REP: ['view'], CANVASSER: ['view'], SUBCONTRACTOR: [] },
|
||||
subcontractor_tasks: { OWNER: ['view','assign'], ADMIN: ['view','assign'], SALES_REP: [], CANVASSER: [], SUBCONTRACTOR: ['view','receive'] },
|
||||
dispatch: { OWNER: ['view','assign'], ADMIN: ['view','assign'], SALES_REP: ['view'], CANVASSER: [], SUBCONTRACTOR: [] },
|
||||
storm_intel: { OWNER: ['view'], ADMIN: ['view'], SALES_REP: ['view'], CANVASSER: ['view'], SUBCONTRACTOR: [] },
|
||||
territory_map: { OWNER: ['view'], ADMIN: ['view'], SALES_REP: ['view'], CANVASSER: ['view'], SUBCONTRACTOR: [] },
|
||||
estimates: { OWNER: ['view','edit'], ADMIN: ['view','edit'], SALES_REP: ['view','edit'], CANVASSER: [], SUBCONTRACTOR: [] },
|
||||
pro_canvas: { OWNER: ['view'], ADMIN: ['view'], SALES_REP: ['view'], CANVASSER: ['view'], SUBCONTRACTOR: [] },
|
||||
settings: { OWNER: ['view','edit'], ADMIN: ['view'], SALES_REP: [], CANVASSER: [], SUBCONTRACTOR: [] },
|
||||
});
|
||||
|
||||
const PERMISSION_MODULES = {
|
||||
@@ -9086,6 +9105,12 @@ export const MockStoreProvider = ({ children }) => {
|
||||
leads: { label: 'Leads & Door Knocks', actions: ['view','log','verify'] },
|
||||
leaderboard: { label: 'Leaderboard', actions: ['view'] },
|
||||
subcontractor_tasks: { label: 'Subcontractor Tasks', actions: ['view','assign','receive'] },
|
||||
dispatch: { label: 'LynkDispatch', actions: ['view','assign'] },
|
||||
storm_intel: { label: 'Storm Intel', actions: ['view'] },
|
||||
territory_map: { label: 'Territory Map', actions: ['view'] },
|
||||
estimates: { label: 'Estimates', actions: ['view','edit'] },
|
||||
pro_canvas: { label: 'ProCanvas', actions: ['view'] },
|
||||
settings: { label: 'Org Settings', actions: ['view','edit'] },
|
||||
};
|
||||
|
||||
// Per-user permission overrides: grant or deny specific module+action regardless of role
|
||||
|
||||
Reference in New Issue
Block a user