Files
doormile_crm_build/dist/assets/Pricing-UUO57Utn.js
2026-06-16 15:26:57 +05:30

2 lines
11 KiB
JavaScript

import{r as E,j as e,i as $,a as m,S as c,N as q,B as n,T as x,K as f,I as v}from"./index-BM8mPUSr.js";import{d as B,D as W,a as T,b as R,c as w,e as I,f as G}from"./DeleteOutline-BA25_mRN.js";import{d as S}from"./LocalShippingOutlined-nmDa0zcy.js";import{P as Z,G as o,C as p}from"./PageHeader-BJLqB58q.js";import{B as g}from"./Button-Blhp1LXA.js";import{T as K,a as z}from"./Tabs-CB6PDxRe.js";import{C as N}from"./Link-Bp7Yd4eg.js";import{T as d}from"./TextField-B3PMybuP.js";import{T as U,a as J,b as Q,c as A,d as s,e as X}from"./TableRow-CxHAjBtA.js";var y={},Y=$;Object.defineProperty(y,"__esModule",{value:!0});var C=y.default=void 0,ee=Y(E()),le=e;C=y.default=(0,ee.default)((0,le.jsx)("path",{d:"M2.5 19h19v2h-19zm19.57-9.36c-.21-.8-1.04-1.28-1.84-1.06L14.92 10l-6.9-6.43-1.93.51 4.14 7.17-4.97 1.33-1.97-1.54-1.45.39 2.59 4.49L21 11.49c.81-.23 1.28-1.05 1.07-1.85"}),"FlightTakeoffOutlined");var D={},ae=$;Object.defineProperty(D,"__esModule",{value:!0});var L=D.default=void 0,ie=ae(E()),_=e;L=D.default=(0,ie.default)([(0,_.jsx)("path",{d:"M17 7h2v2h-2zm0 4h2v2h-2zm0 4h2v2h-2zM1 11v10h6v-5h2v5h6V11L8 6zm12 8h-2v-5H5v5H3v-7l5-3.5 5 3.5z"},"0"),(0,_.jsx)("path",{d:"M10 3v1.97l2 1.43V5h9v14h-4v2h6V3z"},"1")],"MapsHomeWorkOutlined");const re=[{id:"dtdc",name:"DTDC",description:"Standard & Premium Services",services:["DTDC Lite","DTDC Plus/Prime"],rates:[{id:1,slab:"< 500g",local:"₹40 - ₹100",zonal:"₹60 - ₹250",national:"₹150 - ₹300"},{id:2,slab:"500g - 1kg",local:"₹100 - ₹200",zonal:"₹150 - ₹350",national:"₹200 - ₹400"},{id:3,slab:"1kg - 2kg",local:"₹200 - ₹300",zonal:"₹250 - ₹450",national:"₹300 - ₹550"},{id:4,slab:"2kg - 5kg",local:"₹300 - ₹400",zonal:"₹350 - ₹550",national:"₹450 - ₹700"},{id:5,slab:"> 5kg (+ per kg)",local:"₹40 - ₹50",zonal:"₹50 - ₹80",national:"₹80 - ₹120"}]},{id:"st-courier",name:"ST Courier",description:"Regional & National Network",services:["Standard Surface"],rates:[{id:1,slab:"< 500g",local:"₹25 - ₹50",zonal:"₹40 - ₹80",national:"₹60 - ₹120"},{id:2,slab:"500g - 1kg",local:"₹40 - ₹80",zonal:"₹60 - ₹120",national:"₹80 - ₹180"},{id:3,slab:"1kg - 2kg",local:"₹70 - ₹130",zonal:"₹100 - ₹200",national:"₹150 - ₹280"},{id:4,slab:"2kg - 5kg",local:"₹110 - ₹220",zonal:"₹160 - ₹320",national:"₹240 - ₹450"},{id:5,slab:"> 5kg (+ per kg)",local:"₹20 - ₹35",zonal:"₹30 - ₹50",national:"₹45 - ₹80"}]},{id:"pro-courier",name:"Professional Courier",description:"Document & Parcel Delivery",services:["Standard","Express"],rates:[{id:1,slab:"< 500g",local:"₹30 - ₹60",zonal:"₹50 - ₹90",national:"₹70 - ₹130"},{id:2,slab:"500g - 1kg",local:"₹50 - ₹90",zonal:"₹80 - ₹140",national:"₹110 - ₹200"},{id:3,slab:"1kg - 2kg",local:"₹80 - ₹150",zonal:"₹130 - ₹230",national:"₹180 - ₹320"},{id:4,slab:"2kg - 5kg",local:"₹150 - ₹280",zonal:"₹220 - ₹420",national:"₹300 - ₹600"},{id:5,slab:"> 5kg (+ per kg)",local:"₹25 - ₹40",zonal:"₹40 - ₹70",national:"₹55 - ₹90"}]},{id:"blue-dart",name:"Blue Dart",description:"Premium Air & Surface Express",services:["Domestic Priority","Dart Apex","Dart Surfaceline"],rates:[{id:1,slab:"< 500g",local:"₹150",zonal:"₹130",national:"₹80 (Surface)"},{id:2,slab:"500g - 1kg",local:"₹200 - ₹280",zonal:"₹250 - ₹350",national:"₹300 - ₹420"},{id:3,slab:"1kg - 2kg",local:"₹350 - ₹450",zonal:"₹420 - ₹550",national:"₹500 - ₹700"},{id:4,slab:"2kg - 5kg",local:"₹450 - ₹650",zonal:"₹550 - ₹850",national:"₹700 - ₹1100"},{id:5,slab:"> 5kg (+ per kg)",local:"₹60 - ₹90",zonal:"₹80 - ₹110",national:"₹90 - ₹130"}]}];function k({label:i,value:h,icon:u,color:r="primary"}){return e.jsx(n,{sx:{flex:1,p:2.5,borderRadius:2,border:1,borderColor:"divider",bgcolor:"background.paper",boxShadow:"0 4px 20px rgba(0,0,0,0.03)"},children:e.jsxs(c,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(n,{sx:{width:48,height:48,borderRadius:2,bgcolor:`${r}.lighter`,color:`${r}.main`,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(u,{sx:{fontSize:24}})}),e.jsxs(n,{children:[e.jsx(x,{variant:"h4",sx:{fontWeight:800,color:"grey.800",lineHeight:1.1},children:h}),e.jsx(x,{variant:"body2",sx:{fontWeight:600,mt:.5},color:"text.secondary",children:i})]})]})})}function se({provider:i,onEditProvider:h,onEditRow:u,onAddRow:r}){return e.jsxs(N,{sx:{mb:4,borderRadius:2.5,boxShadow:"0 8px 24px rgba(0,0,0,0.04)",border:1,borderColor:"grey.200",overflow:"hidden"},children:[e.jsxs(n,{sx:{px:2.5,py:2,borderBottom:1,borderColor:"divider",display:"flex",alignItems:"center",justifyContent:"space-between",background:a=>`linear-gradient(90deg, ${a.palette.primary.lighter}44 0%, ${a.palette.background.paper} 70%)`},children:[e.jsxs(c,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(n,{sx:{width:48,height:48,borderRadius:"50%",bgcolor:"primary.main",color:"primary.contrastText",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,fontSize:"1.4rem"},children:i.name[0].toUpperCase()}),e.jsxs(n,{children:[e.jsx(x,{variant:"h6",sx:{fontWeight:800,color:"grey.800",lineHeight:1.2},children:i.name}),e.jsx(x,{variant:"caption",color:"text.secondary",children:i.description})]})]}),e.jsxs(c,{direction:"row",spacing:1,alignItems:"center",children:[i.services.map(a=>e.jsx(p,{label:a,size:"small",sx:{fontWeight:600,bgcolor:"primary.lighter",color:"primary.dark"}},a)),e.jsx(f,{title:"Edit Provider",children:e.jsx(v,{size:"small",sx:{ml:1},onClick:()=>h(i),children:e.jsx(I,{fontSize:"small"})})})]})]}),e.jsx(U,{children:e.jsxs(J,{sx:{minWidth:600},children:[e.jsx(Q,{children:e.jsxs(A,{sx:{"& th":{bgcolor:"grey.50",fontWeight:700,color:"grey.700",textTransform:"uppercase",fontSize:"0.72rem",letterSpacing:.4}},children:[e.jsx(s,{children:"Weight Slab"}),e.jsx(s,{children:e.jsxs(c,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(L,{fontSize:"small",sx:{color:"grey.400"}}),e.jsx("span",{children:"Local / Same City"})]})}),e.jsx(s,{children:e.jsxs(c,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(S,{fontSize:"small",sx:{color:"grey.400"}}),e.jsx("span",{children:"Zonal / State"})]})}),e.jsx(s,{children:e.jsxs(c,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(C,{fontSize:"small",sx:{color:"grey.400"}}),e.jsx("span",{children:"National / Inter-State"})]})}),e.jsx(s,{align:"right",children:"Actions"})]})}),e.jsx(X,{children:i.rates.map(a=>e.jsxs(A,{hover:!0,sx:{"& > *":{borderBottom:"1px solid",borderColor:"divider"}},children:[e.jsx(s,{children:e.jsx(x,{variant:"body2",sx:{fontWeight:700,color:"grey.800"},children:a.slab})}),e.jsx(s,{children:e.jsx(p,{size:"small",label:a.local,sx:{fontWeight:600,bgcolor:"success.lighter",color:"success.dark",borderRadius:1}})}),e.jsx(s,{children:e.jsx(p,{size:"small",label:a.zonal,sx:{fontWeight:600,bgcolor:"info.lighter",color:"info.dark",borderRadius:1}})}),e.jsx(s,{children:e.jsx(p,{size:"small",label:a.national,sx:{fontWeight:600,bgcolor:"warning.lighter",color:"warning.dark",borderRadius:1}})}),e.jsxs(s,{align:"right",children:[e.jsx(f,{title:"Edit Row",children:e.jsx(v,{size:"small",onClick:()=>u(a),children:e.jsx(I,{fontSize:"small"})})}),e.jsx(f,{title:"Delete Row",children:e.jsx(v,{size:"small",children:e.jsx(G,{fontSize:"small"})})})]})]},a.id))})]})}),e.jsx(n,{sx:{p:1,borderTop:1,borderColor:"divider",bgcolor:"grey.50"},children:e.jsx(g,{fullWidth:!0,size:"small",startIcon:e.jsx(B,{}),sx:{color:"text.secondary",fontWeight:600,"&:hover":{bgcolor:"grey.200",color:"primary.main"}},onClick:()=>r(i),children:"Add New Weight Slab"})})]})}function je(){var P;const[i,h]=m.useState(0),[u,r]=m.useState(!1),[a,j]=m.useState(!1),[l,b]=m.useState(null),V=t=>{b(t),r(!0)},H=t=>{b(t),j(!0)},M=t=>{b({providerId:t.id,slab:"",local:"",zonal:"",national:""}),j(!0)},O=()=>{b(null),r(!0)};return e.jsxs(e.Fragment,{children:[e.jsx(Z,{title:"Logistics Pricing Matrix",breadcrumbs:[{label:"Pricing Rate Cards"}],action:e.jsx(g,{variant:"contained",startIcon:e.jsx(B,{}),onClick:O,sx:{borderRadius:2,px:3,boxShadow:"0 4px 12px rgba(0,0,0,0.1)"},children:"Add Provider"})}),e.jsxs(c,{direction:{xs:"column",md:"row"},spacing:2,sx:{mt:3,mb:4},children:[e.jsx(k,{label:"Total Logistics Partners",value:22,icon:S,color:"primary"}),e.jsx(k,{label:"Avg Local Rate (1kg)",value:"₹45",icon:q,color:"success"}),e.jsx(k,{label:"Avg National Rate (1kg)",value:"₹160",icon:C,color:"warning"})]}),e.jsx(n,{sx:{borderBottom:1,borderColor:"divider",mb:3},children:e.jsxs(K,{value:i,onChange:(t,F)=>h(F),children:[e.jsx(z,{label:"Express Carriers (Air & Surface)",sx:{fontWeight:600}}),e.jsx(z,{label:"Heavy Cargo & B2B",sx:{fontWeight:600}}),e.jsx(z,{label:"Regional Networks",sx:{fontWeight:600}})]})}),i===0&&e.jsx(n,{children:re.map(t=>e.jsx(se,{provider:t,onEditProvider:V,onEditRow:H,onAddRow:M},t.id))}),i!==0&&e.jsxs(N,{sx:{p:6,textAlign:"center",borderRadius:2.5,boxShadow:"0 8px 24px rgba(0,0,0,0.04)",border:1,borderColor:"grey.200"},children:[e.jsx(S,{sx:{fontSize:48,color:"grey.300",mb:2}}),e.jsx(x,{variant:"h6",sx:{color:"grey.700",fontWeight:600},children:"Rate cards for this segment are pending"}),e.jsx(x,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"Connect your API to sync the remaining pricing data from your Excel sheet."})]}),e.jsxs(W,{open:u,onClose:()=>r(!1),maxWidth:"sm",fullWidth:!0,children:[e.jsx(T,{children:l!=null&&l.id?"Edit Provider Details":"Add New Logistics Provider"}),e.jsx(R,{dividers:!0,children:e.jsxs(o,{container:!0,spacing:2,children:[e.jsx(o,{item:!0,xs:12,children:e.jsx(d,{fullWidth:!0,size:"small",label:"Provider Name",defaultValue:(l==null?void 0:l.name)||"",placeholder:"e.g. DTDC"})}),e.jsx(o,{item:!0,xs:12,children:e.jsx(d,{fullWidth:!0,size:"small",label:"Short Description",defaultValue:(l==null?void 0:l.description)||"",placeholder:"e.g. Standard & Premium Services"})}),e.jsx(o,{item:!0,xs:12,children:e.jsx(d,{fullWidth:!0,size:"small",label:"Services (comma separated)",defaultValue:((P=l==null?void 0:l.services)==null?void 0:P.join(", "))||"",placeholder:"e.g. DTDC Lite, DTDC Plus"})})]})}),e.jsxs(w,{sx:{p:2},children:[e.jsx(g,{onClick:()=>r(!1),children:"Cancel"}),e.jsx(g,{variant:"contained",onClick:()=>r(!1),children:"Save Provider"})]})]}),e.jsxs(W,{open:a,onClose:()=>j(!1),maxWidth:"sm",fullWidth:!0,children:[e.jsx(T,{children:l!=null&&l.id?"Edit Pricing Row":"Add New Pricing Slab"}),e.jsx(R,{dividers:!0,children:e.jsxs(o,{container:!0,spacing:2,children:[e.jsx(o,{item:!0,xs:12,children:e.jsx(d,{fullWidth:!0,size:"small",label:"Weight Slab",defaultValue:(l==null?void 0:l.slab)||"",placeholder:"e.g. 1kg - 2kg"})}),e.jsx(o,{item:!0,xs:12,children:e.jsx(d,{fullWidth:!0,size:"small",label:"Local / Same City",defaultValue:(l==null?void 0:l.local)||"",placeholder:"e.g. ₹200 - ₹300"})}),e.jsx(o,{item:!0,xs:12,children:e.jsx(d,{fullWidth:!0,size:"small",label:"Zonal / State",defaultValue:(l==null?void 0:l.zonal)||"",placeholder:"e.g. ₹250 - ₹450"})}),e.jsx(o,{item:!0,xs:12,children:e.jsx(d,{fullWidth:!0,size:"small",label:"National / Inter-State",defaultValue:(l==null?void 0:l.national)||"",placeholder:"e.g. ₹300 - ₹550"})})]})}),e.jsxs(w,{sx:{p:2},children:[e.jsx(g,{onClick:()=>j(!1),children:"Cancel"}),e.jsx(g,{variant:"contained",onClick:()=>j(!1),children:"Save Pricing"})]})]})]})}export{je as default};