PageSourceSearch

https://ommo.ai/assets/roles-0c5f6cff.js

js ommo.ai collected 2026-10-05 13:35:05 UTC 7,978 bytes, 1 lines download raw bytes

1import{a as e,r as t}from"./react-vendor-690ef4bc.js";import{B as a}from"./boldarrowsaltarrowright-60037b2b.js";import{P as l,m as s}from"./icons-142e3e49.js";import{T as n}from"./toggleproperty1on-5608b565.js";import{E as r}from"./editicon-8a697f27.js";import{D as i}from"./index-d3072779.js";import{D as o}from"./deactivate-popup-a61aefa4.js";import{m as c,A as m}from"./utils-b81ec68d.js";import"./mui-core-0fc19580.js";const d=({permissions:t,onToggle:a,className:l=""})=>e.createElement("div",{className:`pt-2 pb-2 flex flex-col gap-3 items-start justify-start self-stretch shrink-0 relative ${l}`},t.map(t=>e.createElement("div",{key:t.id,className:"flex flex-row gap-3 items-center justify-start self-stretch shrink-0 relative"},e.createElement(n,{property1:t.isEnabled?"on":"off",text:t.text,className:"w-full",onChange:()=>a(t.id,!t.isEnabled),showStatusText:!1}))),e.createElement("div",{className:"roles-table-divider"})),u=[{id:"all",text:"All",isEnabled:!1},{id:"company-profile",text:"Can manage company profile and settings",isEnabled:!1},{id:"org-settings",text:"Configure organization settings, integrations, and security",isEnabled:!1},{id:"notifications",text:"Can configure system notifications and alerts for the team",isEnabled:!1},{id:"analytics",text:"View analytics, activity logs, and system events",isEnabled:!1},{id:"edit-delete",text:"Edit and delete any data across the platform",isEnabled:!1}],g=[{id:"administrator",name:"Administrator",description:"Full access to the entire system, including user management, role assignments, company settings, and integrations.",users:[{label:"J",color:"green"},{label:"F",color:"blue"},{label:"B",color:"orange"}],permissions:[{id:"all",text:"All",isEnabled:!0},{id:"company-profile",text:"Can manage company profile and settings",isEnabled:!0},{id:"org-settings",text:"Configure organization settings, integrations, and security",isEnabled:!0},{id:"notifications",text:"Can configure system notifications and alerts for the team",isEnabled:!0},{id:"analytics",text:"View analytics, activity logs, and system events",isEnabled:!0},{id:"edit-delete",text:"Edit and delete any data across the platform",isEnabled:!0}],isHighlighted:!0},{id:"safety-manager",name:"Safety manager",description:"Access to all safety-related tools, including incident reporting, compliance monitoring, and safety documentation management.",users:[{label:"A",color:"blue"},{label:"J",color:"orange"},{label:"O",color:"green"},{label:"+3",color:"gray"}],permissions:[]},{id:"dispatcher",name:"Dispatcher",description:"Manage driver assignments, create and edit routes, track real-time status, and handle delivery scheduling.",users:[{label:"",color:"gray"}],permissions:[]},{id:"accountant",name:"Accountant",description:"Access to financial data, including invoices, fuel and maintenance expenses, and reporting tools.",users:[{label:"B",color:"green"},{label:"K",color:"blue"},{label:"J",color:"orange"}],permissions:[]},{id:"driver",name:"Driver",description:"View assigned routes, update trip statuses, submit reports, and receive real-time instructions on the road.",users:[{label:"O",color:"orange"},{label:"K",color:"green"},{label:"L",color:"blue"},{label:"A",color:"orange"}],permissions:[]},{id:"fleet-manager",name:"Fleet manager",description:"Manage vehicles, track maintenance schedules, receive alerts for issues, and monitor fleet performance.",users:[{label:"D",color:"blue"},{label:"P",color:"orange"},{label:"K",color:"green"},{label:"+5",color:"gray"}],permissions:[]}],b=({role:n,onTogglePermission:o,onDeleteRole:g})=>{const[b,p]=t.useState(!1),[E,v]=t.useState(!1),f=t.useRef(null);t.useEffect(()=>{const e=e=>{f.current&&!f.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);const h=e=>{p(!1),"Delete"===e&&g(n)},N=n.permissions.length>0?n.permissions:u;return e.createElement(e.Fragment,null,n.isHighlighted&&e.createElement("div",{className:"roles-table-row-highlighted"}),e.createElement("div",{className:"roles-table-row-wrapper"},e.createElement("div",{className:"roles-table-row",onClick:()=>v(!E)},e.createElement("div",{className:"roles-table-cell roles-table-cell-role"},e.createElement(c.div,{initial:{rotate:-90},animate:{rotate:E?0:-90},transition:{duration:.2},className:"roles-table-arrow"},e.createElement(a,null)),e.createElement("div",{className:"roles-table-role-info"},e.createElement("div",{className:"role-name"},n.name))),e.createElement("div",{className:"roles-table-cell roles-table-cell-description"},e.createElement("div",{className:"role-description"},n.description)),e.createElement("div",{className:"roles-table-cell roles-table-cell-users"},e.createElement("div",{className:"users-avatars"},n.users.map((t,a)=>e.createElement("div",{key:a,className:`user-avatar user-avatar-${t.color}`},t.label||e.createElement(l,null))))),e.createElement("div",{className:"roles-table-cell roles-table-cell-action",ref:f},e.createElement("button",{onClick:e=>{e.stopPropagation(),p(!b)},className:"action-menu-button","aria-label":"Action menu"},e.createElement(s,null)),b&&e.createElement("div",{className:"action-menu"},e.createElement("button",{onClick:e=>{e.stopPropagation(),h("Edit")},className:"action-menu-item action-menu-edit"}
1,e.createElement(r,null),e.createElement("div",null,"Edit")),e.createElement("button",{onClick:e=>{e.stopPropagation(),h("Delete")},className:"action-menu-item action-menu-delete"},e.createElement(i,null),e.createElement("div",null,"Delete")))))),n.isHighlighted?e.createElement("div",{className:"roles-table-divider-green"}):e.createElement("div",{className:"roles-table-divider"}),e.createElement(m,null,E&&e.createElement(c.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:"easeInOut"},style:{overflow:"hidden"}},e.createElement(d,{permissions:N,onToggle:(e,t)=>{o(n.id,e,t)}}))))},p=({className:a,...l})=>{const[s,n]=t.useState(g),[r,i]=t.useState(null),[c,m]=t.useState(!1),d=(e,t,a)=>{n(l=>l.map(l=>{if(l.id!==e)return l;const s=(l.permissions.length>0?l.permissions:u).map(e=>e.id===t?{...e,isEnabled:a}:e);return{...l,permissions:s}}))},p=e=>{i(e),m(!0)},E=()=>{i(null),m(!1)};return e.createElement("div",{className:`roles-table-container ${a}`,...l},e.createElement("div",{className:"roles-table-header"},e.createElement("div",{className:"roles-table-header-row"},e.createElement("div",{className:"roles-table-cell roles-table-cell-role"},e.createElement("div",{className:"roles-table-header-cell"},"Role")),e.createElement("div",{className:"roles-table-cell roles-table-cell-description"},e.createElement("div",{className:"roles-table-header-cell"},"Description")),e.createElement("div",{className:"roles-table-cell roles-table-cell-users"},e.createElement("div",{className:"roles-table-header-cell"},"Users")),e.createElement("div",{className:"roles-table-cell roles-table-cell-action"},e.createElement("div",{className:"roles-table-header-cell"},"Action")))),e.createElement("div",{className:"roles-table-body"},s.map(t=>e.createElement(b,{key:t.id,role:t,onTogglePermission:d,onDeleteRole:p}))),c&&r&&e.createElement(o,{title:"Delete Role",description:`Are you sure you want to delete the "${r.name}" role? This action cannot be undone.`,confirmText:"Delete",onConfirm:()=>{r&&(n(e=>e.filter(e=>e.id!==r.id)),i(null),m(!1))},onCancel:E,onClose:E}))},E=()=>e.createElement("div",{className:"userSettings"},e.createElement("div",{className:"user-settings__details-card"},e.createElement("div",{className:"user-settings__details-card_with_edit"},e.createElement("h2",{className:"user-settings__card-title"},"Roles"),e.createElement("button",null," ",e.createElement("div",{className:"text-green-400 flex"}," ",e.createElement(l,{className:"mt-0.5"})," Add User Role"," ")," ")),e.createElement("div",{className:"user-settings__divider"}),e.createElement(p,null)));export{E as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.