ubk.erp.webpack 1.0.9 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),l=require("antd"),se=require("swr"),h=require("react"),et=require("swr/mutation"),he=require("@ant-design/icons"),ge=require("dayjs"),Qr=require("react-dom/server"),xr=require("react-to-print"),N=require("react-hot-toast"),Sr=require("react-select"),Zr=require("react-barcode"),ea=()=>t.jsxs(l.Card,{style:{borderRadius:16},children:[t.jsx(l.Typography.Title,{level:3,style:{marginTop:0},children:"UBK ERP"}),t.jsx(l.Typography.Paragraph,{style:{marginBottom:0},children:"Welcome to your webpack-powered ERP system."})]}),oe=({width:e,height:n,display:r,justifyContent:a,alignItems:s,flexDirection:o,gap:i,style:c,children:x,...p})=>{const d={width:e,height:n,display:r,justifyContent:a,alignItems:s,flexDirection:o,gap:i,...c};return t.jsx("div",{style:d,...p,children:x})},De=({variant:e,fontWeight:n,style:r,children:a,...s})=>{const o=n==="bold"?700:n==="light"?300:n;return e==="h1"?t.jsx(l.Typography.Title,{level:1,style:{fontWeight:o,...r},...s,children:a}):e==="h2"?t.jsx(l.Typography.Title,{level:2,style:{fontWeight:o,...r},...s,children:a}):e==="h3"?t.jsx(l.Typography.Title,{level:3,style:{fontWeight:o,...r},...s,children:a}):e==="h4"?t.jsx(l.Typography.Title,{level:4,style:{fontWeight:o,...r},...s,children:a}):e==="h5"?t.jsx(l.Typography.Title,{level:5,style:{fontWeight:o,...r},...s,children:a}):t.jsx(l.Typography.Text,{style:{fontWeight:o,...r},...s,children:a})};function wr({title:e="",icon:n="",path:r="",onClick:a}){const s=()=>{if(a){a(r);return}typeof window<"u"&&typeof r=="string"&&r.length>0&&window.location.assign(r)};return t.jsxs(l.Card,{hoverable:!0,onClick:s,style:{borderRadius:12,overflow:"hidden",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.10)"},bodyStyle:{padding:0,cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[t.jsx(oe,{width:"100%",display:"flex",justifyContent:"center",alignItems:"center",style:{padding:"10px 12px",minHeight:80},children:t.jsx("img",{src:n,alt:"",style:{width:45,height:50,objectFit:"contain"}})}),t.jsx(oe,{style:{padding:"0 12px"},children:t.jsx(l.Divider,{style:{margin:0,minWidth:0}})}),t.jsx(oe,{style:{padding:"10px 10px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:35},children:t.jsx(De,{variant:"button",fontWeight:"bold",style:{fontSize:12},children:e})})]})}function jr(e,n){return function(){return e.apply(n,arguments)}}const{toString:ta}=Object.prototype,{getPrototypeOf:$t}=Object,{iterator:Lt,toStringTag:vr}=Symbol,qt=(e=>n=>{const r=ta.call(n);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),qe=e=>(e=e.toLowerCase(),n=>qt(n)===e),zt=e=>n=>typeof n===e,{isArray:ht}=Array,ft=zt("undefined");function _t(e){return e!==null&&!ft(e)&&e.constructor!==null&&!ft(e.constructor)&&ke(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const _r=qe("ArrayBuffer");function na(e){let n;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?n=ArrayBuffer.isView(e):n=e&&e.buffer&&_r(e.buffer),n}const ra=zt("string"),ke=zt("function"),Cr=zt("number"),Ct=e=>e!==null&&typeof e=="object",aa=e=>e===!0||e===!1,Ut=e=>{if(qt(e)!=="object")return!1;const n=$t(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(vr in e)&&!(Lt in e)},sa=e=>{if(!Ct(e)||_t(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},oa=qe("Date"),ia=qe("File"),la=e=>!!(e&&typeof e.uri<"u"),ca=e=>e&&typeof e.getParts<"u",da=qe("Blob"),ua=qe("FileList"),pa=e=>Ct(e)&&ke(e.pipe);function fa(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Tn=fa(),Rn=typeof Tn.FormData<"u"?Tn.FormData:void 0,ha=e=>{if(!e)return!1;if(Rn&&e instanceof Rn)return!0;const n=$t(e);if(!n||n===Object.prototype||!ke(e.append))return!1;const r=qt(e);return r==="formdata"||r==="object"&&ke(e.toString)&&e.toString()==="[object FormData]"},ma=qe("URLSearchParams"),[ya,ga,ba,xa]=["ReadableStream","Request","Response","Headers"].map(qe),Sa=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Tt(e,n,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let a,s;if(typeof e!="object"&&(e=[e]),ht(e))for(a=0,s=e.length;a<s;a++)n.call(null,e[a],a,e);else{if(_t(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(a=0;a<i;a++)c=o[a],n.call(null,e[c],c,e)}}function Tr(e,n){if(_t(e))return null;n=n.toLowerCase();const r=Object.keys(e);let a=r.length,s;for(;a-- >0;)if(s=r[a],n===s.toLowerCase())return s;return null}const st=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Rr=e=>!ft(e)&&e!==st;function hn(){const{caseless:e,skipUndefined:n}=Rr(this)&&this||{},r={},a=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=e&&Tr(r,o)||o;Ut(r[i])&&Ut(s)?r[i]=hn(r[i],s):Ut(s)?r[i]=hn({},s):ht(s)?r[i]=s.slice():(!n||!ft(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&Tt(arguments[s],a);return r}const wa=(e,n,r,{allOwnKeys:a}={})=>(Tt(n,(s,o)=>{r&&ke(s)?Object.defineProperty(e,o,{value:jr(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:a}),e),ja=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),va=(e,n,r,a)=>{e.prototype=Object.create(n.prototype,a),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:n.prototype}),r&&Object.assign(e.prototype,r)},_a=(e,n,r,a)=>{let s,o,i;const c={};if(n=n||{},e==null)return n;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!a||a(i,e,n))&&!c[i]&&(n[i]=e[i],c[i]=!0);e=r!==!1&&$t(e)}while(e&&(!r||r(e,n))&&e!==Object.prototype);return n},Ca=(e,n,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=n.length;const a=e.indexOf(n,r);return a!==-1&&a===r},Ta=e=>{if(!e)return null;if(ht(e))return e;let n=e.length;if(!Cr(n))return null;const r=new Array(n);for(;n-- >0;)r[n]=e[n];return r},Ra=(e=>n=>e&&n instanceof e)(typeof Uint8Array<"u"&&$t(Uint8Array)),Oa=(e,n)=>{const a=(e&&e[Lt]).call(e);let s;for(;(s=a.next())&&!s.done;){const o=s.value;n.call(e,o[0],o[1])}},Ea=(e,n)=>{let r;const a=[];for(;(r=e.exec(n))!==null;)a.push(r);return a},Da=qe("HTMLFormElement"),Aa=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,a,s){return a.toUpperCase()+s}),On=(({hasOwnProperty:e})=>(n,r)=>e.call(n,r))(Object.prototype),Pa=qe("RegExp"),Or=(e,n)=>{const r=Object.getOwnPropertyDescriptors(e),a={};Tt(r,(s,o)=>{let i;(i=n(s,o,e))!==!1&&(a[o]=i||s)}),Object.defineProperties(e,a)},ka=e=>{Or(e,(n,r)=>{if(ke(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const a=e[r];if(ke(a)){if(n.enumerable=!1,"writable"in n){n.writable=!1;return}n.set||(n.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ia=(e,n)=>{const r={},a=s=>{s.forEach(o=>{r[o]=!0})};return ht(e)?a(e):a(String(e).split(n)),r},Ma=()=>{},Ua=(e,n)=>e!=null&&Number.isFinite(e=+e)?e:n;function Ba(e){return!!(e&&ke(e.append)&&e[vr]==="FormData"&&e[Lt])}const Na=e=>{const n=new Array(10),r=(a,s)=>{if(Ct(a)){if(n.indexOf(a)>=0)return;if(_t(a))return a;if(!("toJSON"in a)){n[s]=a;const o=ht(a)?[]:{};return Tt(a,(i,c)=>{const x=r(i,s+1);!ft(x)&&(o[c]=x)}),n[s]=void 0,o}}return a};return r(e,0)},Fa=qe("AsyncFunction"),$a=e=>e&&(Ct(e)||ke(e))&&ke(e.then)&&ke(e.catch),Er=((e,n)=>e?setImmediate:n?((r,a)=>(st.addEventListener("message",({source:s,data:o})=>{s===st&&o===r&&a.length&&a.shift()()},!1),s=>{a.push(s),st.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",ke(st.postMessage)),La=typeof queueMicrotask<"u"?queueMicrotask.bind(st):typeof process<"u"&&process.nextTick||Er,qa=e=>e!=null&&ke(e[Lt]),w={isArray:ht,isArrayBuffer:_r,isBuffer:_t,isFormData:ha,isArrayBufferView:na,isString:ra,isNumber:Cr,isBoolean:aa,isObject:Ct,isPlainObject:Ut,isEmptyObject:sa,isReadableStream:ya,isRequest:ga,isResponse:ba,isHeaders:xa,isUndefined:ft,isDate:oa,isFile:ia,isReactNativeBlob:la,isReactNative:ca,isBlob:da,isRegExp:Pa,isFunction:ke,isStream:pa,isURLSearchParams:ma,isTypedArray:Ra,isFileList:ua,forEach:Tt,merge:hn,extend:wa,trim:Sa,stripBOM:ja,inherits:va,toFlatObject:_a,kindOf:qt,kindOfTest:qe,endsWith:Ca,toArray:Ta,forEachEntry:Oa,matchAll:Ea,isHTMLForm:Da,hasOwnProperty:On,hasOwnProp:On,reduceDescriptors:Or,freezeMethods:ka,toObjectSet:Ia,toCamelCase:Aa,noop:Ma,toFiniteNumber:Ua,findKey:Tr,global:st,isContextDefined:Rr,isSpecCompliantForm:Ba,toJSONObject:Na,isAsyncFn:Fa,isThenable:$a,setImmediate:Er,asap:La,isIterable:qa};let re=class Dr extends Error{static from(n,r,a,s,o,i){const c=new Dr(n.message,r||n.code,a,s,o);return c.cause=n,c.name=n.name,n.status!=null&&c.status==null&&(c.status=n.status),i&&Object.assign(c,i),c}constructor(n,r,a,s,o){super(n),Object.defineProperty(this,"message",{value:n,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),a&&(this.config=a),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:w.toJSONObject(this.config),code:this.code,status:this.status}}};re.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";re.ERR_BAD_OPTION="ERR_BAD_OPTION";re.ECONNABORTED="ECONNABORTED";re.ETIMEDOUT="ETIMEDOUT";re.ERR_NETWORK="ERR_NETWORK";re.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";re.ERR_DEPRECATED="ERR_DEPRECATED";re.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";re.ERR_BAD_REQUEST="ERR_BAD_REQUEST";re.ERR_CANCELED="ERR_CANCELED";re.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";re.ERR_INVALID_URL="ERR_INVALID_URL";re.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const za=null;function mn(e){return w.isPlainObject(e)||w.isArray(e)}function Ar(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function Kt(e,n,r){return e?e.concat(n).map(function(s,o){return s=Ar(s),!r&&o?"["+s+"]":s}).join(r?".":""):n}function Va(e){return w.isArray(e)&&!e.some(mn)}const Wa=w.toFlatObject(w,{},null,function(n){return/^is[A-Z]/.test(n)});function Vt(e,n,r){if(!w.isObject(e))throw new TypeError("target must be an object");n=n||new FormData,r=w.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,_){return!w.isUndefined(_[m])});const a=r.metaTokens,s=r.visitor||b,o=r.dots,i=r.indexes,c=r.Blob||typeof Blob<"u"&&Blob,x=r.maxDepth===void 0?100:r.maxDepth,p=c&&w.isSpecCompliantForm(n);if(!w.isFunction(s))throw new TypeError("visitor must be a function");function d(u){if(u===null)return"";if(w.isDate(u))return u.toISOString();if(w.isBoolean(u))return u.toString();if(!p&&w.isBlob(u))throw new re("Blob is not supported. Use a Buffer instead.");return w.isArrayBuffer(u)||w.isTypedArray(u)?p&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function b(u,m,_){let P=u;if(w.isReactNative(n)&&w.isReactNativeBlob(u))return n.append(Kt(_,m,o),d(u)),!1;if(u&&!_&&typeof u=="object"){if(w.endsWith(m,"{}"))m=a?m:m.slice(0,-2),u=JSON.stringify(u);else if(w.isArray(u)&&Va(u)||(w.isFileList(u)||w.endsWith(m,"[]"))&&(P=w.toArray(u)))return m=Ar(m),P.forEach(function(k,j){!(w.isUndefined(k)||k===null)&&n.append(i===!0?Kt([m],j,o):i===null?m:m+"[]",d(k))}),!1}return mn(u)?!0:(n.append(Kt(_,m,o),d(u)),!1)}const v=[],S=Object.assign(Wa,{defaultVisitor:b,convertValue:d,isVisitable:mn});function g(u,m,_=0){if(!w.isUndefined(u)){if(_>x)throw new re("Object is too deeply nested ("+_+" levels). Max depth: "+x,re.ERR_FORM_DATA_DEPTH_EXCEEDED);if(v.indexOf(u)!==-1)throw Error("Circular reference detected in "+m.join("."));v.push(u),w.forEach(u,function(C,k){(!(w.isUndefined(C)||C===null)&&s.call(n,C,w.isString(k)?k.trim():k,m,S))===!0&&g(C,m?m.concat(k):[k],_+1)}),v.pop()}}if(!w.isObject(e))throw new TypeError("data must be an object");return g(e),n}function En(e){const n={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(a){return n[a]})}function xn(e,n){this._pairs=[],e&&Vt(e,this,n)}const Pr=xn.prototype;Pr.append=function(n,r){this._pairs.push([n,r])};Pr.toString=function(n){const r=n?function(a){return n.call(this,a,En)}:En;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Ha(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function kr(e,n,r){if(!n)return e;const a=r&&r.encode||Ha,s=w.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(n,s):i=w.isURLSearchParams(n)?n.toString():new xn(n,s).toString(a),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Dn{constructor(){this.handlers=[]}use(n,r,a){return this.handlers.push({fulfilled:n,rejected:r,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(n){this.handlers[n]&&(this.handlers[n]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(n){w.forEach(this.handlers,function(a){a!==null&&n(a)})}}const Sn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ya=typeof URLSearchParams<"u"?URLSearchParams:xn,Ka=typeof FormData<"u"?FormData:null,Ja=typeof Blob<"u"?Blob:null,Xa={isBrowser:!0,classes:{URLSearchParams:Ya,FormData:Ka,Blob:Ja},protocols:["http","https","file","blob","url","data"]},wn=typeof window<"u"&&typeof document<"u",yn=typeof navigator=="object"&&navigator||void 0,Ga=wn&&(!yn||["ReactNative","NativeScript","NS"].indexOf(yn.product)<0),Qa=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Za=wn&&window.location.href||"http://localhost",es=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:wn,hasStandardBrowserEnv:Ga,hasStandardBrowserWebWorkerEnv:Qa,navigator:yn,origin:Za},Symbol.toStringTag,{value:"Module"})),Oe={...es,...Xa};function ts(e,n){return Vt(e,new Oe.classes.URLSearchParams,{visitor:function(r,a,s,o){return Oe.isNode&&w.isBuffer(r)?(this.append(a,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...n})}function ns(e){return w.matchAll(/\w+|\[(\w*)]/g,e).map(n=>n[0]==="[]"?"":n[1]||n[0])}function rs(e){const n={},r=Object.keys(e);let a;const s=r.length;let o;for(a=0;a<s;a++)o=r[a],n[o]=e[o];return n}function Ir(e){function n(r,a,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),x=o>=r.length;return i=!i&&w.isArray(s)?s.length:i,x?(w.hasOwnProp(s,i)?s[i]=w.isArray(s[i])?s[i].concat(a):[s[i],a]:s[i]=a,!c):((!s[i]||!w.isObject(s[i]))&&(s[i]=[]),n(r,a,s[i],o)&&w.isArray(s[i])&&(s[i]=rs(s[i])),!c)}if(w.isFormData(e)&&w.isFunction(e.entries)){const r={};return w.forEachEntry(e,(a,s)=>{n(ns(a),s,r,0)}),r}return null}const dt=(e,n)=>e!=null&&w.hasOwnProp(e,n)?e[n]:void 0;function as(e,n,r){if(w.isString(e))try{return(n||JSON.parse)(e),w.trim(e)}catch(a){if(a.name!=="SyntaxError")throw a}return(r||JSON.stringify)(e)}const Rt={transitional:Sn,adapter:["xhr","http","fetch"],transformRequest:[function(n,r){const a=r.getContentType()||"",s=a.indexOf("application/json")>-1,o=w.isObject(n);if(o&&w.isHTMLForm(n)&&(n=new FormData(n)),w.isFormData(n))return s?JSON.stringify(Ir(n)):n;if(w.isArrayBuffer(n)||w.isBuffer(n)||w.isStream(n)||w.isFile(n)||w.isBlob(n)||w.isReadableStream(n))return n;if(w.isArrayBufferView(n))return n.buffer;if(w.isURLSearchParams(n))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),n.toString();let c;if(o){const x=dt(this,"formSerializer");if(a.indexOf("application/x-www-form-urlencoded")>-1)return ts(n,x).toString();if((c=w.isFileList(n))||a.indexOf("multipart/form-data")>-1){const p=dt(this,"env"),d=p&&p.FormData;return Vt(c?{"files[]":n}:n,d&&new d,x)}}return o||s?(r.setContentType("application/json",!1),as(n)):n}],transformResponse:[function(n){const r=dt(this,"transitional")||Rt.transitional,a=r&&r.forcedJSONParsing,s=dt(this,"responseType"),o=s==="json";if(w.isResponse(n)||w.isReadableStream(n))return n;if(n&&w.isString(n)&&(a&&!s||o)){const c=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(n,dt(this,"parseReviver"))}catch(x){if(c)throw x.name==="SyntaxError"?re.from(x,re.ERR_BAD_RESPONSE,this,null,dt(this,"response")):x}}return n}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Oe.classes.FormData,Blob:Oe.classes.Blob},validateStatus:function(n){return n>=200&&n<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch"],e=>{Rt.headers[e]={}});const ss=w.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),os=e=>{const n={};let r,a,s;return e&&e.split(`
2
- `).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),a=i.substring(s+1).trim(),!(!r||n[r]&&ss[r])&&(r==="set-cookie"?n[r]?n[r].push(a):n[r]=[a]:n[r]=n[r]?n[r]+", "+a:a)}),n},An=Symbol("internals"),is=/[^\x09\x20-\x7E\x80-\xFF]/g;function ls(e){let n=0,r=e.length;for(;n<r;){const a=e.charCodeAt(n);if(a!==9&&a!==32)break;n+=1}for(;r>n;){const a=e.charCodeAt(r-1);if(a!==9&&a!==32)break;r-=1}return n===0&&r===e.length?e:e.slice(n,r)}function bt(e){return e&&String(e).trim().toLowerCase()}function cs(e){return ls(e.replace(is,""))}function Bt(e){return e===!1||e==null?e:w.isArray(e)?e.map(Bt):cs(String(e))}function ds(e){const n=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=r.exec(e);)n[a[1]]=a[2];return n}const us=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Jt(e,n,r,a,s){if(w.isFunction(a))return a.call(this,n,r);if(s&&(n=r),!!w.isString(n)){if(w.isString(a))return n.indexOf(a)!==-1;if(w.isRegExp(a))return a.test(n)}}function ps(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(n,r,a)=>r.toUpperCase()+a)}function fs(e,n){const r=w.toCamelCase(" "+n);["get","set","has"].forEach(a=>{Object.defineProperty(e,a+r,{value:function(s,o,i){return this[a].call(this,n,s,o,i)},configurable:!0})})}let Ie=class{constructor(n){n&&this.set(n)}set(n,r,a){const s=this;function o(c,x,p){const d=bt(x);if(!d)throw new Error("header name must be a non-empty string");const b=w.findKey(s,d);(!b||s[b]===void 0||p===!0||p===void 0&&s[b]!==!1)&&(s[b||x]=Bt(c))}const i=(c,x)=>w.forEach(c,(p,d)=>o(p,d,x));if(w.isPlainObject(n)||n instanceof this.constructor)i(n,r);else if(w.isString(n)&&(n=n.trim())&&!us(n))i(os(n),r);else if(w.isObject(n)&&w.isIterable(n)){let c={},x,p;for(const d of n){if(!w.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[p=d[0]]=(x=c[p])?w.isArray(x)?[...x,d[1]]:[x,d[1]]:d[1]}i(c,r)}else n!=null&&o(r,n,a);return this}get(n,r){if(n=bt(n),n){const a=w.findKey(this,n);if(a){const s=this[a];if(!r)return s;if(r===!0)return ds(s);if(w.isFunction(r))return r.call(this,s,a);if(w.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(n,r){if(n=bt(n),n){const a=w.findKey(this,n);return!!(a&&this[a]!==void 0&&(!r||Jt(this,this[a],a,r)))}return!1}delete(n,r){const a=this;let s=!1;function o(i){if(i=bt(i),i){const c=w.findKey(a,i);c&&(!r||Jt(a,a[c],c,r))&&(delete a[c],s=!0)}}return w.isArray(n)?n.forEach(o):o(n),s}clear(n){const r=Object.keys(this);let a=r.length,s=!1;for(;a--;){const o=r[a];(!n||Jt(this,this[o],o,n,!0))&&(delete this[o],s=!0)}return s}normalize(n){const r=this,a={};return w.forEach(this,(s,o)=>{const i=w.findKey(a,o);if(i){r[i]=Bt(s),delete r[o];return}const c=n?ps(o):String(o).trim();c!==o&&delete r[o],r[c]=Bt(s),a[c]=!0}),this}concat(...n){return this.constructor.concat(this,...n)}toJSON(n){const r=Object.create(null);return w.forEach(this,(a,s)=>{a!=null&&a!==!1&&(r[s]=n&&w.isArray(a)?a.join(", "):a)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([n,r])=>n+": "+r).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(n){return n instanceof this?n:new this(n)}static concat(n,...r){const a=new this(n);return r.forEach(s=>a.set(s)),a}static accessor(n){const a=(this[An]=this[An]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=bt(i);a[c]||(fs(s,i),a[c]=!0)}return w.isArray(n)?n.forEach(o):o(n),this}};Ie.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);w.reduceDescriptors(Ie.prototype,({value:e},n)=>{let r=n[0].toUpperCase()+n.slice(1);return{get:()=>e,set(a){this[r]=a}}});w.freezeMethods(Ie);function Xt(e,n){const r=this||Rt,a=n||r,s=Ie.from(a.headers);let o=a.data;return w.forEach(e,function(c){o=c.call(r,o,s.normalize(),n?n.status:void 0)}),s.normalize(),o}function Mr(e){return!!(e&&e.__CANCEL__)}let Ot=class extends re{constructor(n,r,a){super(n??"canceled",re.ERR_CANCELED,r,a),this.name="CanceledError",this.__CANCEL__=!0}};function Ur(e,n,r){const a=r.config.validateStatus;!r.status||!a||a(r.status)?e(r):n(new re("Request failed with status code "+r.status,[re.ERR_BAD_REQUEST,re.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function hs(e){const n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return n&&n[1]||""}function ms(e,n){e=e||10;const r=new Array(e),a=new Array(e);let s=0,o=0,i;return n=n!==void 0?n:1e3,function(x){const p=Date.now(),d=a[o];i||(i=p),r[s]=x,a[s]=p;let b=o,v=0;for(;b!==s;)v+=r[b++],b=b%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),p-i<n)return;const S=d&&p-d;return S?Math.round(v*1e3/S):void 0}}function ys(e,n){let r=0,a=1e3/n,s,o;const i=(p,d=Date.now())=>{r=d,s=null,o&&(clearTimeout(o),o=null),e(...p)};return[(...p)=>{const d=Date.now(),b=d-r;b>=a?i(p,d):(s=p,o||(o=setTimeout(()=>{o=null,i(s)},a-b)))},()=>s&&i(s)]}const Ft=(e,n,r=3)=>{let a=0;const s=ms(50,250);return ys(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,x=c!=null?Math.min(i,c):i,p=Math.max(0,x-a),d=s(p);a=Math.max(a,x);const b={loaded:x,total:c,progress:c?x/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c?(c-x)/d:void 0,event:o,lengthComputable:c!=null,[n?"download":"upload"]:!0};e(b)},r)},Pn=(e,n)=>{const r=e!=null;return[a=>n[0]({lengthComputable:r,total:e,loaded:a}),n[1]]},kn=e=>(...n)=>w.asap(()=>e(...n)),gs=Oe.hasStandardBrowserEnv?((e,n)=>r=>(r=new URL(r,Oe.origin),e.protocol===r.protocol&&e.host===r.host&&(n||e.port===r.port)))(new URL(Oe.origin),Oe.navigator&&/(msie|trident)/i.test(Oe.navigator.userAgent)):()=>!0,bs=Oe.hasStandardBrowserEnv?{write(e,n,r,a,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(n)}`];w.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),w.isString(a)&&c.push(`path=${a}`),w.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),w.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const n=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return n?decodeURIComponent(n[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function xs(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ss(e,n){return n?e.replace(/\/?\/$/,"")+"/"+n.replace(/^\/+/,""):e}function Br(e,n,r){let a=!xs(n);return e&&(a||r===!1)?Ss(e,n):n}const In=e=>e instanceof Ie?{...e}:e;function it(e,n){n=n||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function a(p,d,b,v){return w.isPlainObject(p)&&w.isPlainObject(d)?w.merge.call({caseless:v},p,d):w.isPlainObject(d)?w.merge({},d):w.isArray(d)?d.slice():d}function s(p,d,b,v){if(w.isUndefined(d)){if(!w.isUndefined(p))return a(void 0,p,b,v)}else return a(p,d,b,v)}function o(p,d){if(!w.isUndefined(d))return a(void 0,d)}function i(p,d){if(w.isUndefined(d)){if(!w.isUndefined(p))return a(void 0,p)}else return a(void 0,d)}function c(p,d,b){if(w.hasOwnProp(n,b))return a(p,d);if(w.hasOwnProp(e,b))return a(void 0,p)}const x={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:c,headers:(p,d,b)=>s(In(p),In(d),b,!0)};return w.forEach(Object.keys({...e,...n}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const b=w.hasOwnProp(x,d)?x[d]:s,v=w.hasOwnProp(e,d)?e[d]:void 0,S=w.hasOwnProp(n,d)?n[d]:void 0,g=b(v,S,d);w.isUndefined(g)&&b!==c||(r[d]=g)}),r}const Nr=e=>{const n=it({},e),r=v=>w.hasOwnProp(n,v)?n[v]:void 0,a=r("data");let s=r("withXSRFToken");const o=r("xsrfHeaderName"),i=r("xsrfCookieName");let c=r("headers");const x=r("auth"),p=r("baseURL"),d=r("allowAbsoluteUrls"),b=r("url");if(n.headers=c=Ie.from(c),n.url=kr(Br(p,b,d),e.params,e.paramsSerializer),x&&c.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):""))),w.isFormData(a)){if(Oe.hasStandardBrowserEnv||Oe.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(w.isFunction(a.getHeaders)){const v=a.getHeaders(),S=["content-type","content-length"];Object.entries(v).forEach(([g,u])=>{S.includes(g.toLowerCase())&&c.set(g,u)})}}if(Oe.hasStandardBrowserEnv&&(w.isFunction(s)&&(s=s(n)),s===!0||s==null&&gs(n.url))){const S=o&&i&&bs.read(i);S&&c.set(o,S)}return n},ws=typeof XMLHttpRequest<"u",js=ws&&function(e){return new Promise(function(r,a){const s=Nr(e);let o=s.data;const i=Ie.from(s.headers).normalize();let{responseType:c,onUploadProgress:x,onDownloadProgress:p}=s,d,b,v,S,g;function u(){S&&S(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function _(){if(!m)return;const C=Ie.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),j={data:!c||c==="text"||c==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:C,config:e,request:m};Ur(function(Z){r(Z),u()},function(Z){a(Z),u()},j),m=null}"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(_)},m.onabort=function(){m&&(a(new re("Request aborted",re.ECONNABORTED,e,m)),m=null)},m.onerror=function(k){const j=k&&k.message?k.message:"Network Error",Q=new re(j,re.ERR_NETWORK,e,m);Q.event=k||null,a(Q),m=null},m.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const j=s.transitional||Sn;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),a(new re(k,j.clarifyTimeoutError?re.ETIMEDOUT:re.ECONNABORTED,e,m)),m=null},o===void 0&&i.setContentType(null),"setRequestHeader"in m&&w.forEach(i.toJSON(),function(k,j){m.setRequestHeader(j,k)}),w.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),c&&c!=="json"&&(m.responseType=s.responseType),p&&([v,g]=Ft(p,!0),m.addEventListener("progress",v)),x&&m.upload&&([b,S]=Ft(x),m.upload.addEventListener("progress",b),m.upload.addEventListener("loadend",S)),(s.cancelToken||s.signal)&&(d=C=>{m&&(a(!C||C.type?new Ot(null,e,m):C),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const P=hs(s.url);if(P&&Oe.protocols.indexOf(P)===-1){a(new re("Unsupported protocol "+P+":",re.ERR_BAD_REQUEST,e));return}m.send(o||null)})},vs=(e,n)=>{const{length:r}=e=e?e.filter(Boolean):[];if(n||r){let a=new AbortController,s;const o=function(p){if(!s){s=!0,c();const d=p instanceof Error?p:this.reason;a.abort(d instanceof re?d:new Ot(d instanceof Error?d.message:d))}};let i=n&&setTimeout(()=>{i=null,o(new re(`timeout of ${n}ms exceeded`,re.ETIMEDOUT))},n);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(o):p.removeEventListener("abort",o)}),e=null)};e.forEach(p=>p.addEventListener("abort",o));const{signal:x}=a;return x.unsubscribe=()=>w.asap(c),x}},_s=function*(e,n){let r=e.byteLength;if(r<n){yield e;return}let a=0,s;for(;a<r;)s=a+n,yield e.slice(a,s),a=s},Cs=async function*(e,n){for await(const r of Ts(e))yield*_s(r,n)},Ts=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const n=e.getReader();try{for(;;){const{done:r,value:a}=await n.read();if(r)break;yield a}}finally{await n.cancel()}},Mn=(e,n,r,a)=>{const s=Cs(e,n);let o=0,i,c=x=>{i||(i=!0,a&&a(x))};return new ReadableStream({async pull(x){try{const{done:p,value:d}=await s.next();if(p){c(),x.close();return}let b=d.byteLength;if(r){let v=o+=b;r(v)}x.enqueue(new Uint8Array(d))}catch(p){throw c(p),p}},cancel(x){return c(x),s.return()}},{highWaterMark:2})},Un=64*1024,{isFunction:Dt}=w,Rs=(({Request:e,Response:n})=>({Request:e,Response:n}))(w.global),{ReadableStream:Bn,TextEncoder:Nn}=w.global,Fn=(e,...n)=>{try{return!!e(...n)}catch{return!1}},Os=e=>{e=w.merge.call({skipUndefined:!0},Rs,e);const{fetch:n,Request:r,Response:a}=e,s=n?Dt(n):typeof fetch=="function",o=Dt(r),i=Dt(a);if(!s)return!1;const c=s&&Dt(Bn),x=s&&(typeof Nn=="function"?(g=>u=>g.encode(u))(new Nn):async g=>new Uint8Array(await new r(g).arrayBuffer())),p=o&&c&&Fn(()=>{let g=!1;const u=new r(Oe.origin,{body:new Bn,method:"POST",get duplex(){return g=!0,"half"}}),m=u.headers.has("Content-Type");return u.body!=null&&u.body.cancel(),g&&!m}),d=i&&c&&Fn(()=>w.isReadableStream(new a("").body)),b={stream:d&&(g=>g.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!b[g]&&(b[g]=(u,m)=>{let _=u&&u[g];if(_)return _.call(u);throw new re(`Response type '${g}' is not supported`,re.ERR_NOT_SUPPORT,m)})});const v=async g=>{if(g==null)return 0;if(w.isBlob(g))return g.size;if(w.isSpecCompliantForm(g))return(await new r(Oe.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(w.isArrayBufferView(g)||w.isArrayBuffer(g))return g.byteLength;if(w.isURLSearchParams(g)&&(g=g+""),w.isString(g))return(await x(g)).byteLength},S=async(g,u)=>{const m=w.toFiniteNumber(g.getContentLength());return m??v(u)};return async g=>{let{url:u,method:m,data:_,signal:P,cancelToken:C,timeout:k,onDownloadProgress:j,onUploadProgress:Q,responseType:Z,headers:T,withCredentials:D="same-origin",fetchOptions:R}=Nr(g),U=n||fetch;Z=Z?(Z+"").toLowerCase():"text";let I=vs([P,C&&C.toAbortSignal()],k),H=null;const J=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let pe;try{if(Q&&p&&m!=="get"&&m!=="head"&&(pe=await S(T,_))!==0){let y=new r(u,{method:"POST",body:_,duplex:"half"}),E;if(w.isFormData(_)&&(E=y.headers.get("content-type"))&&T.setContentType(E),y.body){const[A,q]=Pn(pe,Ft(kn(Q)));_=Mn(y.body,Un,A,q)}}w.isString(D)||(D=D?"include":"omit");const M=o&&"credentials"in r.prototype;if(w.isFormData(_)){const y=T.getContentType();y&&/^multipart\/form-data/i.test(y)&&!/boundary=/i.test(y)&&T.delete("content-type")}const z={...R,signal:I,method:m.toUpperCase(),headers:T.normalize().toJSON(),body:_,duplex:"half",credentials:M?D:void 0};H=o&&new r(u,z);let ce=await(o?U(H,R):U(u,z));const W=d&&(Z==="stream"||Z==="response");if(d&&(j||W&&J)){const y={};["status","statusText","headers"].forEach(ee=>{y[ee]=ce[ee]});const E=w.toFiniteNumber(ce.headers.get("content-length")),[A,q]=j&&Pn(E,Ft(kn(j),!0))||[];ce=new a(Mn(ce.body,Un,A,()=>{q&&q(),J&&J()}),y)}Z=Z||"text";let f=await b[w.findKey(b,Z)||"text"](ce,g);return!W&&J&&J(),await new Promise((y,E)=>{Ur(y,E,{data:f,headers:Ie.from(ce.headers),status:ce.status,statusText:ce.statusText,config:g,request:H})})}catch(M){throw J&&J(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new re("Network Error",re.ERR_NETWORK,g,H,M&&M.response),{cause:M.cause||M}):re.from(M,M&&M.code,g,H,M&&M.response)}}},Es=new Map,Fr=e=>{let n=e&&e.env||{};const{fetch:r,Request:a,Response:s}=n,o=[a,s,r];let i=o.length,c=i,x,p,d=Es;for(;c--;)x=o[c],p=d.get(x),p===void 0&&d.set(x,p=c?new Map:Os(n)),d=p;return p};Fr();const jn={http:za,xhr:js,fetch:{get:Fr}};w.forEach(jn,(e,n)=>{if(e){try{Object.defineProperty(e,"name",{value:n})}catch{}Object.defineProperty(e,"adapterName",{value:n})}});const $n=e=>`- ${e}`,Ds=e=>w.isFunction(e)||e===null||e===!1;function As(e,n){e=w.isArray(e)?e:[e];const{length:r}=e;let a,s;const o={};for(let i=0;i<r;i++){a=e[i];let c;if(s=a,!Ds(a)&&(s=jn[(c=String(a)).toLowerCase()],s===void 0))throw new re(`Unknown adapter '${c}'`);if(s&&(w.isFunction(s)||(s=s.get(n))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([x,p])=>`adapter ${x} `+(p===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
4
- `+i.map($n).join(`
5
- `):" "+$n(i[0]):"as no adapter specified";throw new re("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const $r={getAdapter:As,adapters:jn};function Gt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ot(null,e)}function Ln(e){return Gt(e),e.headers=Ie.from(e.headers),e.data=Xt.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),$r.getAdapter(e.adapter||Rt.adapter,e)(e).then(function(a){return Gt(e),a.data=Xt.call(e,e.transformResponse,a),a.headers=Ie.from(a.headers),a},function(a){return Mr(a)||(Gt(e),a&&a.response&&(a.response.data=Xt.call(e,e.transformResponse,a.response),a.response.headers=Ie.from(a.response.headers))),Promise.reject(a)})}const Lr="1.15.2",Wt={};["object","boolean","number","function","string","symbol"].forEach((e,n)=>{Wt[e]=function(a){return typeof a===e||"a"+(n<1?"n ":" ")+e}});const qn={};Wt.transitional=function(n,r,a){function s(o,i){return"[Axios v"+Lr+"] Transitional option '"+o+"'"+i+(a?". "+a:"")}return(o,i,c)=>{if(n===!1)throw new re(s(i," has been removed"+(r?" in "+r:"")),re.ERR_DEPRECATED);return r&&!qn[i]&&(qn[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),n?n(o,i,c):!0}};Wt.spelling=function(n){return(r,a)=>(console.warn(`${a} is likely a misspelling of ${n}`),!0)};function Ps(e,n,r){if(typeof e!="object")throw new re("options must be an object",re.ERR_BAD_OPTION_VALUE);const a=Object.keys(e);let s=a.length;for(;s-- >0;){const o=a[s],i=Object.prototype.hasOwnProperty.call(n,o)?n[o]:void 0;if(i){const c=e[o],x=c===void 0||i(c,o,e);if(x!==!0)throw new re("option "+o+" must be "+x,re.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new re("Unknown option "+o,re.ERR_BAD_OPTION)}}const Nt={assertOptions:Ps,validators:Wt},Fe=Nt.validators;let ot=class{constructor(n){this.defaults=n||{},this.interceptors={request:new Dn,response:new Dn}}async request(n,r){try{return await this._request(n,r)}catch(a){if(a instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=(()=>{if(!s.stack)return"";const i=s.stack.indexOf(`
6
- `);return i===-1?"":s.stack.slice(i+1)})();try{if(!a.stack)a.stack=o;else if(o){const i=o.indexOf(`
7
- `),c=i===-1?-1:o.indexOf(`
8
- `,i+1),x=c===-1?"":o.slice(c+1);String(a.stack).endsWith(x)||(a.stack+=`
9
- `+o)}}catch{}}throw a}}_request(n,r){typeof n=="string"?(r=r||{},r.url=n):r=n||{},r=it(this.defaults,r);const{transitional:a,paramsSerializer:s,headers:o}=r;a!==void 0&&Nt.assertOptions(a,{silentJSONParsing:Fe.transitional(Fe.boolean),forcedJSONParsing:Fe.transitional(Fe.boolean),clarifyTimeoutError:Fe.transitional(Fe.boolean),legacyInterceptorReqResOrdering:Fe.transitional(Fe.boolean)},!1),s!=null&&(w.isFunction(s)?r.paramsSerializer={serialize:s}:Nt.assertOptions(s,{encode:Fe.function,serialize:Fe.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Nt.assertOptions(r,{baseUrl:Fe.spelling("baseURL"),withXsrfToken:Fe.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&w.merge(o.common,o[r.method]);o&&w.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),r.headers=Ie.concat(i,o);const c=[];let x=!0;this.interceptors.request.forEach(function(u){if(typeof u.runWhen=="function"&&u.runWhen(r)===!1)return;x=x&&u.synchronous;const m=r.transitional||Sn;m&&m.legacyInterceptorReqResOrdering?c.unshift(u.fulfilled,u.rejected):c.push(u.fulfilled,u.rejected)});const p=[];this.interceptors.response.forEach(function(u){p.push(u.fulfilled,u.rejected)});let d,b=0,v;if(!x){const g=[Ln.bind(this),void 0];for(g.unshift(...c),g.push(...p),v=g.length,d=Promise.resolve(r);b<v;)d=d.then(g[b++],g[b++]);return d}v=c.length;let S=r;for(;b<v;){const g=c[b++],u=c[b++];try{S=g(S)}catch(m){u.call(this,m);break}}try{d=Ln.call(this,S)}catch(g){return Promise.reject(g)}for(b=0,v=p.length;b<v;)d=d.then(p[b++],p[b++]);return d}getUri(n){n=it(this.defaults,n);const r=Br(n.baseURL,n.url,n.allowAbsoluteUrls);return kr(r,n.params,n.paramsSerializer)}};w.forEach(["delete","get","head","options"],function(n){ot.prototype[n]=function(r,a){return this.request(it(a||{},{method:n,url:r,data:(a||{}).data}))}});w.forEach(["post","put","patch"],function(n){function r(a){return function(o,i,c){return this.request(it(c||{},{method:n,headers:a?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ot.prototype[n]=r(),ot.prototype[n+"Form"]=r(!0)});let ks=class qr{constructor(n){if(typeof n!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const a=this;this.promise.then(s=>{if(!a._listeners)return;let o=a._listeners.length;for(;o-- >0;)a._listeners[o](s);a._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{a.subscribe(c),o=c}).then(s);return i.cancel=function(){a.unsubscribe(o)},i},n(function(o,i,c){a.reason||(a.reason=new Ot(o,i,c),r(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]}unsubscribe(n){if(!this._listeners)return;const r=this._listeners.indexOf(n);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const n=new AbortController,r=a=>{n.abort(a)};return this.subscribe(r),n.signal.unsubscribe=()=>this.unsubscribe(r),n.signal}static source(){let n;return{token:new qr(function(s){n=s}),cancel:n}}};function Is(e){return function(r){return e.apply(null,r)}}function Ms(e){return w.isObject(e)&&e.isAxiosError===!0}const gn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gn).forEach(([e,n])=>{gn[n]=e});function zr(e){const n=new ot(e),r=jr(ot.prototype.request,n);return w.extend(r,ot.prototype,n,{allOwnKeys:!0}),w.extend(r,n,null,{allOwnKeys:!0}),r.create=function(s){return zr(it(e,s))},r}const Se=zr(Rt);Se.Axios=ot;Se.CanceledError=Ot;Se.CancelToken=ks;Se.isCancel=Mr;Se.VERSION=Lr;Se.toFormData=Vt;Se.AxiosError=re;Se.Cancel=Se.CanceledError;Se.all=function(n){return Promise.all(n)};Se.spread=Is;Se.isAxiosError=Ms;Se.mergeConfig=it;Se.AxiosHeaders=Ie;Se.formToJSON=e=>Ir(w.isHTMLForm(e)?new FormData(e):e);Se.getAdapter=$r.getAdapter;Se.HttpStatusCode=gn;Se.default=Se;const{Axios:Jo,AxiosError:Xo,CanceledError:Go,isCancel:Qo,CancelToken:Zo,VERSION:ei,all:ti,Cancel:ni,isAxiosError:ri,spread:ai,toFormData:si,AxiosHeaders:oi,HttpStatusCode:ii,formToJSON:li,getAdapter:ci,mergeConfig:di}=Se,Us=()=>new Promise(e=>setTimeout(()=>e(),800));let bn=null;const Bs=e=>{bn=e,Ve.defaults.baseURL=vn()},vn=()=>bn||"https://npmapi.ubkerp.com/",Ve=Se.create({baseURL:vn()}),vt=()=>vn(),We=async(e,n,r)=>{const a=await Ve.post(e,n,{headers:{Authorization:r}});if(console.log("ddddfdfdfd",a.data?.Status),a.data?.Status=="Success")return a?.data?.data||a?.data;throw new Error(a.data?.msg)},le=async(e,n)=>{try{let a=e;if(!e.includes("session_id")){const o=e.includes("?")?"&":"?";a=`${e}${o}session_id=1`}return(await Ve.get(a,{headers:{Authorization:n}})).data}catch(r){throw r.response?.status===401&&console.error("401 Unauthorized"),r}},Ns=async(e,n)=>{const r=await Ve.post(e,"",{headers:{Authorization:n}});if(r.data?.Status=="Success")return r?.data?.data||r?.data;throw new Error(r.data?.msg)},Fs=async(e,n,r)=>(await Ve.post(e,n,{headers:{Authorization:r}}))?.data,Qt=async(e,n,r)=>{const a=n?.arg;return(await Ve.post(e,a,{headers:{Authorization:r}}))?.data},Zt=async(e,n,r)=>{const a=n?.arg,s=e.includes("?")?"&":"?";return(await Ve.get(e+s,{params:a,headers:{Authorization:r}}))?.data},$s=async(e,n,r)=>{const a=n?.arg,s=e.includes("?")?"&":"?";return(await Ve.get(e+s,{params:a,headers:{Authorization:r}}))?.data},lt=async(e,n,r)=>(await Us(),(await Ve.post(e,n,{headers:{Authorization:r}}))?.data),He=async(e,n,r)=>(await Ve.delete(`${e}/${n}`,{headers:{Authorization:r}})).data,Ls=({token:e,menu:n})=>{const{isLoading:r,data:a}=se(e?["api/sdk/Menus",e]:null,([o,i])=>Ns(o,i)),s=a?.find(o=>o.path===n)?.sub_menu??[];return console.log("menuData",a),t.jsx(l.Row,{gutter:[16,16],children:s?.map((o,i)=>o.dashboard_show==="YES"?t.jsx(l.Col,{xs:24,md:8,lg:8,children:t.jsx(oe,{children:t.jsx(wr,{icon:`${vt()}icons/frontoffice/${o.icons}`,title:o.submenu_name,path:o.menu_key})})},`${i}office001`):null)})};function Vr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ce={},en,zn;function qs(){return zn||(zn=1,en=function e(n,r){if(n===r)return!0;if(n&&r&&typeof n=="object"&&typeof r=="object"){if(n.constructor!==r.constructor)return!1;var a,s,o;if(Array.isArray(n)){if(a=n.length,a!=r.length)return!1;for(s=a;s--!==0;)if(!e(n[s],r[s]))return!1;return!0}if(n.constructor===RegExp)return n.source===r.source&&n.flags===r.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===r.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===r.toString();if(o=Object.keys(n),a=o.length,a!==Object.keys(r).length)return!1;for(s=a;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=a;s--!==0;){var i=o[s];if(!e(n[i],r[i]))return!1}return!0}return n!==n&&r!==r}),en}var At={exports:{}},Pt={exports:{}},me={};var Vn;function zs(){if(Vn)return me;Vn=1;var e=typeof Symbol=="function"&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,s=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,x=e?Symbol.for("react.async_mode"):60111,p=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,b=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,u=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,P=e?Symbol.for("react.scope"):60119;function C(j){if(typeof j=="object"&&j!==null){var Q=j.$$typeof;switch(Q){case n:switch(j=j.type,j){case x:case p:case a:case o:case s:case b:return j;default:switch(j=j&&j.$$typeof,j){case c:case d:case g:case S:case i:return j;default:return Q}}case r:return Q}}}function k(j){return C(j)===p}return me.AsyncMode=x,me.ConcurrentMode=p,me.ContextConsumer=c,me.ContextProvider=i,me.Element=n,me.ForwardRef=d,me.Fragment=a,me.Lazy=g,me.Memo=S,me.Portal=r,me.Profiler=o,me.StrictMode=s,me.Suspense=b,me.isAsyncMode=function(j){return k(j)||C(j)===x},me.isConcurrentMode=k,me.isContextConsumer=function(j){return C(j)===c},me.isContextProvider=function(j){return C(j)===i},me.isElement=function(j){return typeof j=="object"&&j!==null&&j.$$typeof===n},me.isForwardRef=function(j){return C(j)===d},me.isFragment=function(j){return C(j)===a},me.isLazy=function(j){return C(j)===g},me.isMemo=function(j){return C(j)===S},me.isPortal=function(j){return C(j)===r},me.isProfiler=function(j){return C(j)===o},me.isStrictMode=function(j){return C(j)===s},me.isSuspense=function(j){return C(j)===b},me.isValidElementType=function(j){return typeof j=="string"||typeof j=="function"||j===a||j===p||j===o||j===s||j===b||j===v||typeof j=="object"&&j!==null&&(j.$$typeof===g||j.$$typeof===S||j.$$typeof===i||j.$$typeof===c||j.$$typeof===d||j.$$typeof===m||j.$$typeof===_||j.$$typeof===P||j.$$typeof===u)},me.typeOf=C,me}var ye={};var Wn;function Vs(){return Wn||(Wn=1,process.env.NODE_ENV!=="production"&&(function(){var e=typeof Symbol=="function"&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,a=e?Symbol.for("react.fragment"):60107,s=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,x=e?Symbol.for("react.async_mode"):60111,p=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,b=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,S=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,u=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,P=e?Symbol.for("react.scope"):60119;function C(F){return typeof F=="string"||typeof F=="function"||F===a||F===p||F===o||F===s||F===b||F===v||typeof F=="object"&&F!==null&&(F.$$typeof===g||F.$$typeof===S||F.$$typeof===i||F.$$typeof===c||F.$$typeof===d||F.$$typeof===m||F.$$typeof===_||F.$$typeof===P||F.$$typeof===u)}function k(F){if(typeof F=="object"&&F!==null){var je=F.$$typeof;switch(je){case n:var Re=F.type;switch(Re){case x:case p:case a:case o:case s:case b:return Re;default:var ze=Re&&Re.$$typeof;switch(ze){case c:case d:case g:case S:case i:return ze;default:return je}}case r:return je}}}var j=x,Q=p,Z=c,T=i,D=n,R=d,U=a,I=g,H=S,J=r,pe=o,M=s,z=b,ce=!1;function W(F){return ce||(ce=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),f(F)||k(F)===x}function f(F){return k(F)===p}function y(F){return k(F)===c}function E(F){return k(F)===i}function A(F){return typeof F=="object"&&F!==null&&F.$$typeof===n}function q(F){return k(F)===d}function ee(F){return k(F)===a}function X(F){return k(F)===g}function ne(F){return k(F)===S}function O(F){return k(F)===r}function $(F){return k(F)===o}function K(F){return k(F)===s}function be(F){return k(F)===b}ye.AsyncMode=j,ye.ConcurrentMode=Q,ye.ContextConsumer=Z,ye.ContextProvider=T,ye.Element=D,ye.ForwardRef=R,ye.Fragment=U,ye.Lazy=I,ye.Memo=H,ye.Portal=J,ye.Profiler=pe,ye.StrictMode=M,ye.Suspense=z,ye.isAsyncMode=W,ye.isConcurrentMode=f,ye.isContextConsumer=y,ye.isContextProvider=E,ye.isElement=A,ye.isForwardRef=q,ye.isFragment=ee,ye.isLazy=X,ye.isMemo=ne,ye.isPortal=O,ye.isProfiler=$,ye.isStrictMode=K,ye.isSuspense=be,ye.isValidElementType=C,ye.typeOf=k})()),ye}var Hn;function Wr(){return Hn||(Hn=1,process.env.NODE_ENV==="production"?Pt.exports=zs():Pt.exports=Vs()),Pt.exports}var tn,Yn;function Ws(){if(Yn)return tn;Yn=1;var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function s(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var i={},c=0;c<10;c++)i["_"+String.fromCharCode(c)]=c;var x=Object.getOwnPropertyNames(i).map(function(d){return i[d]});if(x.join("")!=="0123456789")return!1;var p={};return"abcdefghijklmnopqrst".split("").forEach(function(d){p[d]=d}),Object.keys(Object.assign({},p)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return tn=s()?Object.assign:function(o,i){for(var c,x=a(o),p,d=1;d<arguments.length;d++){c=Object(arguments[d]);for(var b in c)n.call(c,b)&&(x[b]=c[b]);if(e){p=e(c);for(var v=0;v<p.length;v++)r.call(c,p[v])&&(x[p[v]]=c[p[v]])}}return x},tn}var nn,Kn;function _n(){if(Kn)return nn;Kn=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nn=e,nn}var rn,Jn;function Hr(){return Jn||(Jn=1,rn=Function.call.bind(Object.prototype.hasOwnProperty)),rn}var an,Xn;function Hs(){if(Xn)return an;Xn=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var n=_n(),r={},a=Hr();e=function(o){var i="Warning: "+o;typeof console<"u"&&console.error(i);try{throw new Error(i)}catch{}}}function s(o,i,c,x,p){if(process.env.NODE_ENV!=="production"){for(var d in o)if(a(o,d)){var b;try{if(typeof o[d]!="function"){var v=Error((x||"React class")+": "+c+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}b=o[d](i,d,x,c,null,n)}catch(g){b=g}if(b&&!(b instanceof Error)&&e((x||"React class")+": type specification of "+c+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof b+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),b instanceof Error&&!(b.message in r)){r[b.message]=!0;var S=p?p():"";e("Failed "+c+" type: "+b.message+(S??""))}}}}return s.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(r={})},an=s,an}var sn,Gn;function Ys(){if(Gn)return sn;Gn=1;var e=Wr(),n=Ws(),r=_n(),a=Hr(),s=Hs(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(c){var x="Warning: "+c;typeof console<"u"&&console.error(x);try{throw new Error(x)}catch{}});function i(){return null}return sn=function(c,x){var p=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function b(f){var y=f&&(p&&f[p]||f[d]);if(typeof y=="function")return y}var v="<<anonymous>>",S={array:_("array"),bigint:_("bigint"),bool:_("boolean"),func:_("function"),number:_("number"),object:_("object"),string:_("string"),symbol:_("symbol"),any:P(),arrayOf:C,element:k(),elementType:j(),instanceOf:Q,node:R(),objectOf:T,oneOf:Z,oneOfType:D,shape:I,exact:H};function g(f,y){return f===y?f!==0||1/f===1/y:f!==f&&y!==y}function u(f,y){this.message=f,this.data=y&&typeof y=="object"?y:{},this.stack=""}u.prototype=Error.prototype;function m(f){if(process.env.NODE_ENV!=="production")var y={},E=0;function A(ee,X,ne,O,$,K,be){if(O=O||v,K=K||ne,be!==r){if(x){var F=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw F.name="Invariant Violation",F}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var je=O+":"+ne;!y[je]&&E<3&&(o("You are manually calling a React.PropTypes validation function for the `"+K+"` prop on `"+O+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),y[je]=!0,E++)}}return X[ne]==null?ee?X[ne]===null?new u("The "+$+" `"+K+"` is marked as required "+("in `"+O+"`, but its value is `null`.")):new u("The "+$+" `"+K+"` is marked as required in "+("`"+O+"`, but its value is `undefined`.")):null:f(X,ne,O,$,K)}var q=A.bind(null,!1);return q.isRequired=A.bind(null,!0),q}function _(f){function y(E,A,q,ee,X,ne){var O=E[A],$=M(O);if($!==f){var K=z(O);return new u("Invalid "+ee+" `"+X+"` of type "+("`"+K+"` supplied to `"+q+"`, expected ")+("`"+f+"`."),{expectedType:f})}return null}return m(y)}function P(){return m(i)}function C(f){function y(E,A,q,ee,X){if(typeof f!="function")return new u("Property `"+X+"` of component `"+q+"` has invalid PropType notation inside arrayOf.");var ne=E[A];if(!Array.isArray(ne)){var O=M(ne);return new u("Invalid "+ee+" `"+X+"` of type "+("`"+O+"` supplied to `"+q+"`, expected an array."))}for(var $=0;$<ne.length;$++){var K=f(ne,$,q,ee,X+"["+$+"]",r);if(K instanceof Error)return K}return null}return m(y)}function k(){function f(y,E,A,q,ee){var X=y[E];if(!c(X)){var ne=M(X);return new u("Invalid "+q+" `"+ee+"` of type "+("`"+ne+"` supplied to `"+A+"`, expected a single ReactElement."))}return null}return m(f)}function j(){function f(y,E,A,q,ee){var X=y[E];if(!e.isValidElementType(X)){var ne=M(X);return new u("Invalid "+q+" `"+ee+"` of type "+("`"+ne+"` supplied to `"+A+"`, expected a single ReactElement type."))}return null}return m(f)}function Q(f){function y(E,A,q,ee,X){if(!(E[A]instanceof f)){var ne=f.name||v,O=W(E[A]);return new u("Invalid "+ee+" `"+X+"` of type "+("`"+O+"` supplied to `"+q+"`, expected ")+("instance of `"+ne+"`."))}return null}return m(y)}function Z(f){if(!Array.isArray(f))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):o("Invalid argument supplied to oneOf, expected an array.")),i;function y(E,A,q,ee,X){for(var ne=E[A],O=0;O<f.length;O++)if(g(ne,f[O]))return null;var $=JSON.stringify(f,function(be,F){var je=z(F);return je==="symbol"?String(F):F});return new u("Invalid "+ee+" `"+X+"` of value `"+String(ne)+"` "+("supplied to `"+q+"`, expected one of "+$+"."))}return m(y)}function T(f){function y(E,A,q,ee,X){if(typeof f!="function")return new u("Property `"+X+"` of component `"+q+"` has invalid PropType notation inside objectOf.");var ne=E[A],O=M(ne);if(O!=="object")return new u("Invalid "+ee+" `"+X+"` of type "+("`"+O+"` supplied to `"+q+"`, expected an object."));for(var $ in ne)if(a(ne,$)){var K=f(ne,$,q,ee,X+"."+$,r);if(K instanceof Error)return K}return null}return m(y)}function D(f){if(!Array.isArray(f))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),i;for(var y=0;y<f.length;y++){var E=f[y];if(typeof E!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ce(E)+" at index "+y+"."),i}function A(q,ee,X,ne,O){for(var $=[],K=0;K<f.length;K++){var be=f[K],F=be(q,ee,X,ne,O,r);if(F==null)return null;F.data&&a(F.data,"expectedType")&&$.push(F.data.expectedType)}var je=$.length>0?", expected one of type ["+$.join(", ")+"]":"";return new u("Invalid "+ne+" `"+O+"` supplied to "+("`"+X+"`"+je+"."))}return m(A)}function R(){function f(y,E,A,q,ee){return J(y[E])?null:new u("Invalid "+q+" `"+ee+"` supplied to "+("`"+A+"`, expected a ReactNode."))}return m(f)}function U(f,y,E,A,q){return new u((f||"React class")+": "+y+" type `"+E+"."+A+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+q+"`.")}function I(f){function y(E,A,q,ee,X){var ne=E[A],O=M(ne);if(O!=="object")return new u("Invalid "+ee+" `"+X+"` of type `"+O+"` "+("supplied to `"+q+"`, expected `object`."));for(var $ in f){var K=f[$];if(typeof K!="function")return U(q,ee,X,$,z(K));var be=K(ne,$,q,ee,X+"."+$,r);if(be)return be}return null}return m(y)}function H(f){function y(E,A,q,ee,X){var ne=E[A],O=M(ne);if(O!=="object")return new u("Invalid "+ee+" `"+X+"` of type `"+O+"` "+("supplied to `"+q+"`, expected `object`."));var $=n({},E[A],f);for(var K in $){var be=f[K];if(a(f,K)&&typeof be!="function")return U(q,ee,X,K,z(be));if(!be)return new u("Invalid "+ee+" `"+X+"` key `"+K+"` supplied to `"+q+"`.\nBad object: "+JSON.stringify(E[A],null," ")+`
10
- Valid keys: `+JSON.stringify(Object.keys(f),null," "));var F=be(ne,K,q,ee,X+"."+K,r);if(F)return F}return null}return m(y)}function J(f){switch(typeof f){case"number":case"string":case"undefined":return!0;case"boolean":return!f;case"object":if(Array.isArray(f))return f.every(J);if(f===null||c(f))return!0;var y=b(f);if(y){var E=y.call(f),A;if(y!==f.entries){for(;!(A=E.next()).done;)if(!J(A.value))return!1}else for(;!(A=E.next()).done;){var q=A.value;if(q&&!J(q[1]))return!1}}else return!1;return!0;default:return!1}}function pe(f,y){return f==="symbol"?!0:y?y["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&y instanceof Symbol:!1}function M(f){var y=typeof f;return Array.isArray(f)?"array":f instanceof RegExp?"object":pe(y,f)?"symbol":y}function z(f){if(typeof f>"u"||f===null)return""+f;var y=M(f);if(y==="object"){if(f instanceof Date)return"date";if(f instanceof RegExp)return"regexp"}return y}function ce(f){var y=z(f);switch(y){case"array":case"object":return"an "+y;case"boolean":case"date":case"regexp":return"a "+y;default:return y}}function W(f){return!f.constructor||!f.constructor.name?v:f.constructor.name}return S.checkPropTypes=s,S.resetWarningCache=s.resetWarningCache,S.PropTypes=S,S},sn}var on,Qn;function Ks(){if(Qn)return on;Qn=1;var e=_n();function n(){}function r(){}return r.resetWarningCache=n,on=function(){function a(i,c,x,p,d,b){if(b!==e){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}}a.isRequired=a;function s(){return a}var o={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:s,element:a,elementType:a,instanceOf:s,node:a,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:r,resetWarningCache:n};return o.PropTypes=o,o},on}var Zn;function Yr(){if(Zn)return At.exports;if(Zn=1,process.env.NODE_ENV!=="production"){var e=Wr(),n=!0;At.exports=Ys()(e.isElement,n)}else At.exports=Ks()();return At.exports}var er;function Js(){if(er)return Ce;er=1;var e=Ce&&Ce.__extends||(function(){var S=function(g,u){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,_){m.__proto__=_}||function(m,_){for(var P in _)Object.prototype.hasOwnProperty.call(_,P)&&(m[P]=_[P])},S(g,u)};return function(g,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");S(g,u);function m(){this.constructor=g}g.prototype=u===null?Object.create(u):(m.prototype=u.prototype,new m)}})(),n=Ce&&Ce.__assign||function(){return n=Object.assign||function(S){for(var g,u=1,m=arguments.length;u<m;u++){g=arguments[u];for(var _ in g)Object.prototype.hasOwnProperty.call(g,_)&&(S[_]=g[_])}return S},n.apply(this,arguments)},r=Ce&&Ce.__createBinding||(Object.create?(function(S,g,u,m){m===void 0&&(m=u);var _=Object.getOwnPropertyDescriptor(g,u);(!_||("get"in _?!g.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return g[u]}}),Object.defineProperty(S,m,_)}):(function(S,g,u,m){m===void 0&&(m=u),S[m]=g[u]})),a=Ce&&Ce.__setModuleDefault||(Object.create?(function(S,g){Object.defineProperty(S,"default",{enumerable:!0,value:g})}):function(S,g){S.default=g}),s=Ce&&Ce.__importStar||function(S){if(S&&S.__esModule)return S;var g={};if(S!=null)for(var u in S)u!=="default"&&Object.prototype.hasOwnProperty.call(S,u)&&r(g,S,u);return a(g,S),g},o=Ce&&Ce.__rest||function(S,g){var u={};for(var m in S)Object.prototype.hasOwnProperty.call(S,m)&&g.indexOf(m)<0&&(u[m]=S[m]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var _=0,m=Object.getOwnPropertySymbols(S);_<m.length;_++)g.indexOf(m[_])<0&&Object.prototype.propertyIsEnumerable.call(S,m[_])&&(u[m[_]]=S[m[_]]);return u},i=Ce&&Ce.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(Ce,"__esModule",{value:!0});var c=s(h),x=i(qs()),p=s(Yr());function d(S){return S&&S.replace(/&nbsp;|\u202F|\u00A0/g," ").replace(/<br \/>/g,"<br>")}function b(S){var g=document.createTextNode("");S.appendChild(g);var u=document.activeElement===S;if(g!==null&&g.nodeValue!==null&&u){var m=window.getSelection();if(m!==null){var _=document.createRange();_.setStart(g,g.nodeValue.length),_.collapse(!0),m.removeAllRanges(),m.addRange(_)}S instanceof HTMLElement&&S.focus()}}var v=(function(S){e(g,S);function g(){var u=S!==null&&S.apply(this,arguments)||this;return u.lastHtml=u.props.html,u.el=typeof u.props.innerRef=="function"?{current:null}:c.createRef(),u.getEl=function(){return(u.props.innerRef&&typeof u.props.innerRef!="function"?u.props.innerRef:u.el).current},u.emitChange=function(m){var _=u.getEl();if(_){var P=_.innerHTML;if(u.props.onChange&&P!==u.lastHtml){var C=Object.assign({},m,{target:{value:P}});u.props.onChange(C)}u.lastHtml=P}},u}return g.prototype.render=function(){var u=this,m=this.props,_=m.tagName,P=m.html,C=m.innerRef,k=o(m,["tagName","html","innerRef"]);return c.createElement(_||"div",n(n({},k),{ref:typeof C=="function"?function(j){C(j),u.el.current=j}:C||this.el,onInput:this.emitChange,onBlur:this.props.onBlur||this.emitChange,onKeyUp:this.props.onKeyUp||this.emitChange,onKeyDown:this.props.onKeyDown||this.emitChange,contentEditable:!this.props.disabled,dangerouslySetInnerHTML:{__html:P}}),this.props.children)},g.prototype.shouldComponentUpdate=function(u){var m=this.props,_=this.getEl();return!_||d(u.html)!==d(_.innerHTML)?!0:m.disabled!==u.disabled||m.tagName!==u.tagName||m.className!==u.className||m.innerRef!==u.innerRef||m.placeholder!==u.placeholder||!(0,x.default)(m.style,u.style)},g.prototype.componentDidUpdate=function(){var u=this.getEl();u&&(this.props.html!==u.innerHTML&&(u.innerHTML=this.props.html),this.lastHtml=this.props.html,b(u))},g.propTypes={html:p.string.isRequired,onChange:p.func,disabled:p.bool,tagName:p.string,className:p.string,style:p.object,innerRef:p.oneOfType([p.object,p.func])},g})(c.Component);return Ce.default=v,Ce}var Xs=Js();const Gs=Vr(Xs),Qs={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},Zs={width:"100%",minHeight:40,padding:"8px 0",fontSize:"14px",color:"#222",background:"transparent",border:0,borderTop:0,borderLeft:0,borderRight:0,borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none",outline:"none",transition:"border-color 0.2s ease"},ae=h.forwardRef(({style:e,onFocus:n,onBlur:r,...a},s)=>{const[o,i]=h.useState(!1);return t.jsxs("div",{className:"",style:{width:"100%"},children:[a.label&&t.jsx("label",{className:"labelfont",style:Qs,children:a.label}),t.jsx("input",{placeholder:a.placeholder||a.label,...a,ref:s,onFocus:c=>{i(!0),n?.(c)},onBlur:c=>{i(!1),r?.(c)},style:{...Zs,borderBottom:`1px solid ${o?"#222":"#d9d9d9"}`,...e||{}}})]})});function eo(){return[{label:"One Time (During Admission)",value:"one_time"},{label:"One Time",value:"one_time_without_admission"},{label:"Monthly",value:"monthly"},{label:"Quarterly",value:"quarterly"},{label:"Half Yearly",value:"half_yearly"},{label:"Yearly",value:"yearly"}]}const to=e=>{const n=JSON.parse(localStorage.getItem("genrall_settings"));return console.log("amount______",e),t.jsxs(t.Fragment,{children:[n?.currency_icon," ",Number(e||0).toLocaleString("en-IN")]})};var xt={},St={},Ue={},wt={},ut={},tr;function no(){if(tr)return ut;tr=1;var e=ut&&ut.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(ut,"__esModule",{value:!0});const n=e(h),r=Qr,a=["string","number","boolean"];function s({header:o,body:i}){const c=n.default.createElement("tr",null,o.map(p=>n.default.createElement("th",{key:p},p))),x=i.map((p,d)=>Array.isArray(p)?n.default.createElement("tr",{key:d},p.map((b,v)=>n.default.createElement("th",{key:v}," ",b," "))):p!==null&&typeof p=="object"?n.default.createElement("tr",{key:d},Object.entries(p).map(([b,v],S)=>typeof v=="object"?(console.error(`typeof ${b} is incorrect, only accept ${a.join(", ")} `),n.default.createElement("th",{key:S})):n.default.createElement("th",{key:S},n.default.createElement(n.default.Fragment,null,v)))):(console.error(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("antd"),X=require("swr"),l=require("react"),ze=require("swr/mutation"),ce=require("@ant-design/icons"),ye=require("dayjs"),gs=require("react-dom/server"),Vt=require("react-to-print"),A=require("react-hot-toast"),Ar=require("react-select"),Or=require("react-barcode"),xs=()=>e.jsxs(o.Card,{style:{borderRadius:16},children:[e.jsx(o.Typography.Title,{level:3,style:{marginTop:0},children:"UBK ERP"}),e.jsx(o.Typography.Paragraph,{style:{marginBottom:0},children:"Welcome to your webpack-powered ERP system."})]}),ne=({width:t,height:n,display:a,justifyContent:r,alignItems:s,flexDirection:i,gap:d,style:u,children:b,...h})=>{const p={width:t,height:n,display:a,justifyContent:r,alignItems:s,flexDirection:i,gap:d,...u};return e.jsx("div",{style:p,...h,children:b})},Re=({variant:t,fontWeight:n,style:a,children:r,...s})=>{const i=n==="bold"?700:n==="light"?300:n;return t==="h1"?e.jsx(o.Typography.Title,{level:1,style:{fontWeight:i,...a},...s,children:r}):t==="h2"?e.jsx(o.Typography.Title,{level:2,style:{fontWeight:i,...a},...s,children:r}):t==="h3"?e.jsx(o.Typography.Title,{level:3,style:{fontWeight:i,...a},...s,children:r}):t==="h4"?e.jsx(o.Typography.Title,{level:4,style:{fontWeight:i,...a},...s,children:r}):t==="h5"?e.jsx(o.Typography.Title,{level:5,style:{fontWeight:i,...a},...s,children:r}):e.jsx(o.Typography.Text,{style:{fontWeight:i,...a},...s,children:r})};function Pr({title:t="",icon:n="",path:a="",onClick:r}){const s=()=>{if(r){r(a);return}typeof window<"u"&&typeof a=="string"&&a.length>0&&window.location.assign(a)};return e.jsxs(o.Card,{hoverable:!0,onClick:s,style:{borderRadius:12,overflow:"hidden",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.10)"},bodyStyle:{padding:0,cursor:"pointer",display:"flex",flexDirection:"column",alignItems:"stretch"},children:[e.jsx(ne,{width:"100%",display:"flex",justifyContent:"center",alignItems:"center",style:{padding:"10px 12px",minHeight:80},children:e.jsx("img",{src:n,alt:"",style:{width:45,height:50,objectFit:"contain"}})}),e.jsx(ne,{style:{padding:"0 12px"},children:e.jsx(o.Divider,{style:{margin:0,minWidth:0}})}),e.jsx(ne,{style:{padding:"10px 10px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:35},children:e.jsx(Re,{variant:"button",fontWeight:"bold",style:{fontSize:12},children:t})})]})}function Ir(t,n){return function(){return t.apply(n,arguments)}}const{toString:bs}=Object.prototype,{getPrototypeOf:Rn}=Object,{iterator:Dn,toStringTag:Er}=Symbol,An=(t=>n=>{const a=bs.call(n);return t[a]||(t[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),it=t=>(t=t.toLowerCase(),n=>An(n)===t),On=t=>n=>typeof n===t,{isArray:It}=Array,Ot=On("undefined");function Yt(t){return t!==null&&!Ot(t)&&t.constructor!==null&&!Ot(t.constructor)&&Ve(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const kr=it("ArrayBuffer");function Ss(t){let n;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?n=ArrayBuffer.isView(t):n=t&&t.buffer&&kr(t.buffer),n}const js=On("string"),Ve=On("function"),Mr=On("number"),Wt=t=>t!==null&&typeof t=="object",ws=t=>t===!0||t===!1,mn=t=>{if(An(t)!=="object")return!1;const n=Rn(t);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Er in t)&&!(Dn in t)},vs=t=>{if(!Wt(t)||Yt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},_s=it("Date"),Cs=it("File"),Ts=t=>!!(t&&typeof t.uri<"u"),Rs=t=>t&&typeof t.getParts<"u",Ds=it("Blob"),As=it("FileList"),Os=t=>Wt(t)&&Ve(t.pipe);function Ps(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const ba=Ps(),Sa=typeof ba.FormData<"u"?ba.FormData:void 0,Is=t=>{if(!t)return!1;if(Sa&&t instanceof Sa)return!0;const n=Rn(t);if(!n||n===Object.prototype||!Ve(t.append))return!1;const a=An(t);return a==="formdata"||a==="object"&&Ve(t.toString)&&t.toString()==="[object FormData]"},Es=it("URLSearchParams"),[ks,Ms,Fs,Bs]=["ReadableStream","Request","Response","Headers"].map(it),Ns=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ht(t,n,{allOwnKeys:a=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),It(t))for(r=0,s=t.length;r<s;r++)n.call(null,t[r],r,t);else{if(Yt(t))return;const i=a?Object.getOwnPropertyNames(t):Object.keys(t),d=i.length;let u;for(r=0;r<d;r++)u=i[r],n.call(null,t[u],u,t)}}function Fr(t,n){if(Yt(t))return null;n=n.toLowerCase();const a=Object.keys(t);let r=a.length,s;for(;r-- >0;)if(s=a[r],n===s.toLowerCase())return s;return null}const bt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Br=t=>!Ot(t)&&t!==bt;function ra(){const{caseless:t,skipUndefined:n}=Br(this)&&this||{},a={},r=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const d=t&&Fr(a,i)||i;mn(a[d])&&mn(s)?a[d]=ra(a[d],s):mn(s)?a[d]=ra({},s):It(s)?a[d]=s.slice():(!n||!Ot(s))&&(a[d]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Ht(arguments[s],r);return a}const $s=(t,n,a,{allOwnKeys:r}={})=>(Ht(n,(s,i)=>{a&&Ve(s)?Object.defineProperty(t,i,{value:Ir(s,a),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),Us=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Ls=(t,n,a,r)=>{t.prototype=Object.create(n.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:n.prototype}),a&&Object.assign(t.prototype,a)},qs=(t,n,a,r)=>{let s,i,d;const u={};if(n=n||{},t==null)return n;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)d=s[i],(!r||r(d,t,n))&&!u[d]&&(n[d]=t[d],u[d]=!0);t=a!==!1&&Rn(t)}while(t&&(!a||a(t,n))&&t!==Object.prototype);return n},zs=(t,n,a)=>{t=String(t),(a===void 0||a>t.length)&&(a=t.length),a-=n.length;const r=t.indexOf(n,a);return r!==-1&&r===a},Vs=t=>{if(!t)return null;if(It(t))return t;let n=t.length;if(!Mr(n))return null;const a=new Array(n);for(;n-- >0;)a[n]=t[n];return a},Ys=(t=>n=>t&&n instanceof t)(typeof Uint8Array<"u"&&Rn(Uint8Array)),Ws=(t,n)=>{const r=(t&&t[Dn]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;n.call(t,i[0],i[1])}},Hs=(t,n)=>{let a;const r=[];for(;(a=t.exec(n))!==null;)r.push(a);return r},Ks=it("HTMLFormElement"),Js=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,r,s){return r.toUpperCase()+s}),ja=(({hasOwnProperty:t})=>(n,a)=>t.call(n,a))(Object.prototype),Gs=it("RegExp"),Nr=(t,n)=>{const a=Object.getOwnPropertyDescriptors(t),r={};Ht(a,(s,i)=>{let d;(d=n(s,i,t))!==!1&&(r[i]=d||s)}),Object.defineProperties(t,r)},Qs=t=>{Nr(t,(n,a)=>{if(Ve(t)&&["arguments","caller","callee"].indexOf(a)!==-1)return!1;const r=t[a];if(Ve(r)){if(n.enumerable=!1,"writable"in n){n.writable=!1;return}n.set||(n.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},Xs=(t,n)=>{const a={},r=s=>{s.forEach(i=>{a[i]=!0})};return It(t)?r(t):r(String(t).split(n)),a},Zs=()=>{},eo=(t,n)=>t!=null&&Number.isFinite(t=+t)?t:n;function to(t){return!!(t&&Ve(t.append)&&t[Er]==="FormData"&&t[Dn])}const no=t=>{const n=new Array(10),a=(r,s)=>{if(Wt(r)){if(n.indexOf(r)>=0)return;if(Yt(r))return r;if(!("toJSON"in r)){n[s]=r;const i=It(r)?[]:{};return Ht(r,(d,u)=>{const b=a(d,s+1);!Ot(b)&&(i[u]=b)}),n[s]=void 0,i}}return r};return a(t,0)},ao=it("AsyncFunction"),ro=t=>t&&(Wt(t)||Ve(t))&&Ve(t.then)&&Ve(t.catch),$r=((t,n)=>t?setImmediate:n?((a,r)=>(bt.addEventListener("message",({source:s,data:i})=>{s===bt&&i===a&&r.length&&r.shift()()},!1),s=>{r.push(s),bt.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",Ve(bt.postMessage)),so=typeof queueMicrotask<"u"?queueMicrotask.bind(bt):typeof process<"u"&&process.nextTick||$r,oo=t=>t!=null&&Ve(t[Dn]),M={isArray:It,isArrayBuffer:kr,isBuffer:Yt,isFormData:Is,isArrayBufferView:Ss,isString:js,isNumber:Mr,isBoolean:ws,isObject:Wt,isPlainObject:mn,isEmptyObject:vs,isReadableStream:ks,isRequest:Ms,isResponse:Fs,isHeaders:Bs,isUndefined:Ot,isDate:_s,isFile:Cs,isReactNativeBlob:Ts,isReactNative:Rs,isBlob:Ds,isRegExp:Gs,isFunction:Ve,isStream:Os,isURLSearchParams:Es,isTypedArray:Ys,isFileList:As,forEach:Ht,merge:ra,extend:$s,trim:Ns,stripBOM:Us,inherits:Ls,toFlatObject:qs,kindOf:An,kindOfTest:it,endsWith:zs,toArray:Vs,forEachEntry:Ws,matchAll:Hs,isHTMLForm:Ks,hasOwnProperty:ja,hasOwnProp:ja,reduceDescriptors:Nr,freezeMethods:Qs,toObjectSet:Xs,toCamelCase:Js,noop:Zs,toFiniteNumber:eo,findKey:Fr,global:bt,isContextDefined:Br,isSpecCompliantForm:to,toJSONObject:no,isAsyncFn:ao,isThenable:ro,setImmediate:$r,asap:so,isIterable:oo};let ge=class Ur extends Error{static from(n,a,r,s,i,d){const u=new Ur(n.message,a||n.code,r,s,i);return u.cause=n,u.name=n.name,n.status!=null&&u.status==null&&(u.status=n.status),d&&Object.assign(u,d),u}constructor(n,a,r,s,i){super(n),Object.defineProperty(this,"message",{value:n,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,a&&(this.code=a),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.status}}};ge.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";ge.ERR_BAD_OPTION="ERR_BAD_OPTION";ge.ECONNABORTED="ECONNABORTED";ge.ETIMEDOUT="ETIMEDOUT";ge.ERR_NETWORK="ERR_NETWORK";ge.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";ge.ERR_DEPRECATED="ERR_DEPRECATED";ge.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";ge.ERR_BAD_REQUEST="ERR_BAD_REQUEST";ge.ERR_CANCELED="ERR_CANCELED";ge.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";ge.ERR_INVALID_URL="ERR_INVALID_URL";ge.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const io=null;function sa(t){return M.isPlainObject(t)||M.isArray(t)}function Lr(t){return M.endsWith(t,"[]")?t.slice(0,-2):t}function Nn(t,n,a){return t?t.concat(n).map(function(s,i){return s=Lr(s),!a&&i?"["+s+"]":s}).join(a?".":""):n}function lo(t){return M.isArray(t)&&!t.some(sa)}const co=M.toFlatObject(M,{},null,function(n){return/^is[A-Z]/.test(n)});function Pn(t,n,a){if(!M.isObject(t))throw new TypeError("target must be an object");n=n||new FormData,a=M.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,T){return!M.isUndefined(T[f])});const r=a.metaTokens,s=a.visitor||y,i=a.dots,d=a.indexes,u=a.Blob||typeof Blob<"u"&&Blob,b=a.maxDepth===void 0?100:a.maxDepth,h=u&&M.isSpecCompliantForm(n);if(!M.isFunction(s))throw new TypeError("visitor must be a function");function p(c){if(c===null)return"";if(M.isDate(c))return c.toISOString();if(M.isBoolean(c))return c.toString();if(!h&&M.isBlob(c))throw new ge("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(c)||M.isTypedArray(c)?h&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function y(c,f,T){let C=c;if(M.isReactNative(n)&&M.isReactNativeBlob(c))return n.append(Nn(T,f,i),p(c)),!1;if(c&&!T&&typeof c=="object"){if(M.endsWith(f,"{}"))f=r?f:f.slice(0,-2),c=JSON.stringify(c);else if(M.isArray(c)&&lo(c)||(M.isFileList(c)||M.endsWith(f,"[]"))&&(C=M.toArray(c)))return f=Lr(f),C.forEach(function(j,g){!(M.isUndefined(j)||j===null)&&n.append(d===!0?Nn([f],g,i):d===null?f:f+"[]",p(j))}),!1}return sa(c)?!0:(n.append(Nn(T,f,i),p(c)),!1)}const v=[],w=Object.assign(co,{defaultVisitor:y,convertValue:p,isVisitable:sa});function m(c,f,T=0){if(!M.isUndefined(c)){if(T>b)throw new ge("Object is too deeply nested ("+T+" levels). Max depth: "+b,ge.ERR_FORM_DATA_DEPTH_EXCEEDED);if(v.indexOf(c)!==-1)throw Error("Circular reference detected in "+f.join("."));v.push(c),M.forEach(c,function(S,j){(!(M.isUndefined(S)||S===null)&&s.call(n,S,M.isString(j)?j.trim():j,f,w))===!0&&m(S,f?f.concat(j):[j],T+1)}),v.pop()}}if(!M.isObject(t))throw new TypeError("data must be an object");return m(t),n}function wa(t){const n={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(r){return n[r]})}function ca(t,n){this._pairs=[],t&&Pn(t,this,n)}const qr=ca.prototype;qr.append=function(n,a){this._pairs.push([n,a])};qr.toString=function(n){const a=n?function(r){return n.call(this,r,wa)}:wa;return this._pairs.map(function(s){return a(s[0])+"="+a(s[1])},"").join("&")};function uo(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function zr(t,n,a){if(!n)return t;const r=a&&a.encode||uo,s=M.isFunction(a)?{serialize:a}:a,i=s&&s.serialize;let d;if(i?d=i(n,s):d=M.isURLSearchParams(n)?n.toString():new ca(n,s).toString(r),d){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+d}return t}class va{constructor(){this.handlers=[]}use(n,a,r){return this.handlers.push({fulfilled:n,rejected:a,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(n){this.handlers[n]&&(this.handlers[n]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(n){M.forEach(this.handlers,function(r){r!==null&&n(r)})}}const ua={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},po=typeof URLSearchParams<"u"?URLSearchParams:ca,fo=typeof FormData<"u"?FormData:null,mo=typeof Blob<"u"?Blob:null,ho={isBrowser:!0,classes:{URLSearchParams:po,FormData:fo,Blob:mo},protocols:["http","https","file","blob","url","data"]},pa=typeof window<"u"&&typeof document<"u",oa=typeof navigator=="object"&&navigator||void 0,yo=pa&&(!oa||["ReactNative","NativeScript","NS"].indexOf(oa.product)<0),go=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xo=pa&&window.location.href||"http://localhost",bo=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:pa,hasStandardBrowserEnv:yo,hasStandardBrowserWebWorkerEnv:go,navigator:oa,origin:xo},Symbol.toStringTag,{value:"Module"})),Ne={...bo,...ho};function So(t,n){return Pn(t,new Ne.classes.URLSearchParams,{visitor:function(a,r,s,i){return Ne.isNode&&M.isBuffer(a)?(this.append(r,a.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...n})}function jo(t){return M.matchAll(/\w+|\[(\w*)]/g,t).map(n=>n[0]==="[]"?"":n[1]||n[0])}function wo(t){const n={},a=Object.keys(t);let r;const s=a.length;let i;for(r=0;r<s;r++)i=a[r],n[i]=t[i];return n}function Vr(t){function n(a,r,s,i){let d=a[i++];if(d==="__proto__")return!0;const u=Number.isFinite(+d),b=i>=a.length;return d=!d&&M.isArray(s)?s.length:d,b?(M.hasOwnProp(s,d)?s[d]=M.isArray(s[d])?s[d].concat(r):[s[d],r]:s[d]=r,!u):((!s[d]||!M.isObject(s[d]))&&(s[d]=[]),n(a,r,s[d],i)&&M.isArray(s[d])&&(s[d]=wo(s[d])),!u)}if(M.isFormData(t)&&M.isFunction(t.entries)){const a={};return M.forEachEntry(t,(r,s)=>{n(jo(r),s,a,0)}),a}return null}const vt=(t,n)=>t!=null&&M.hasOwnProp(t,n)?t[n]:void 0;function vo(t,n,a){if(M.isString(t))try{return(n||JSON.parse)(t),M.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(a||JSON.stringify)(t)}const Kt={transitional:ua,adapter:["xhr","http","fetch"],transformRequest:[function(n,a){const r=a.getContentType()||"",s=r.indexOf("application/json")>-1,i=M.isObject(n);if(i&&M.isHTMLForm(n)&&(n=new FormData(n)),M.isFormData(n))return s?JSON.stringify(Vr(n)):n;if(M.isArrayBuffer(n)||M.isBuffer(n)||M.isStream(n)||M.isFile(n)||M.isBlob(n)||M.isReadableStream(n))return n;if(M.isArrayBufferView(n))return n.buffer;if(M.isURLSearchParams(n))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),n.toString();let u;if(i){const b=vt(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return So(n,b).toString();if((u=M.isFileList(n))||r.indexOf("multipart/form-data")>-1){const h=vt(this,"env"),p=h&&h.FormData;return Pn(u?{"files[]":n}:n,p&&new p,b)}}return i||s?(a.setContentType("application/json",!1),vo(n)):n}],transformResponse:[function(n){const a=vt(this,"transitional")||Kt.transitional,r=a&&a.forcedJSONParsing,s=vt(this,"responseType"),i=s==="json";if(M.isResponse(n)||M.isReadableStream(n))return n;if(n&&M.isString(n)&&(r&&!s||i)){const u=!(a&&a.silentJSONParsing)&&i;try{return JSON.parse(n,vt(this,"parseReviver"))}catch(b){if(u)throw b.name==="SyntaxError"?ge.from(b,ge.ERR_BAD_RESPONSE,this,null,vt(this,"response")):b}}return n}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ne.classes.FormData,Blob:Ne.classes.Blob},validateStatus:function(n){return n>=200&&n<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};M.forEach(["delete","get","head","post","put","patch"],t=>{Kt.headers[t]={}});const _o=M.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Co=t=>{const n={};let a,r,s;return t&&t.split(`
2
+ `).forEach(function(d){s=d.indexOf(":"),a=d.substring(0,s).trim().toLowerCase(),r=d.substring(s+1).trim(),!(!a||n[a]&&_o[a])&&(a==="set-cookie"?n[a]?n[a].push(r):n[a]=[r]:n[a]=n[a]?n[a]+", "+r:r)}),n},_a=Symbol("internals"),To=/[^\x09\x20-\x7E\x80-\xFF]/g;function Ro(t){let n=0,a=t.length;for(;n<a;){const r=t.charCodeAt(n);if(r!==9&&r!==32)break;n+=1}for(;a>n;){const r=t.charCodeAt(a-1);if(r!==9&&r!==32)break;a-=1}return n===0&&a===t.length?t:t.slice(n,a)}function Ft(t){return t&&String(t).trim().toLowerCase()}function Do(t){return Ro(t.replace(To,""))}function hn(t){return t===!1||t==null?t:M.isArray(t)?t.map(hn):Do(String(t))}function Ao(t){const n=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=a.exec(t);)n[r[1]]=r[2];return n}const Oo=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function $n(t,n,a,r,s){if(M.isFunction(r))return r.call(this,n,a);if(s&&(n=a),!!M.isString(n)){if(M.isString(r))return n.indexOf(r)!==-1;if(M.isRegExp(r))return r.test(n)}}function Po(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(n,a,r)=>a.toUpperCase()+r)}function Io(t,n){const a=M.toCamelCase(" "+n);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+a,{value:function(s,i,d){return this[r].call(this,n,s,i,d)},configurable:!0})})}let Ye=class{constructor(n){n&&this.set(n)}set(n,a,r){const s=this;function i(u,b,h){const p=Ft(b);if(!p)throw new Error("header name must be a non-empty string");const y=M.findKey(s,p);(!y||s[y]===void 0||h===!0||h===void 0&&s[y]!==!1)&&(s[y||b]=hn(u))}const d=(u,b)=>M.forEach(u,(h,p)=>i(h,p,b));if(M.isPlainObject(n)||n instanceof this.constructor)d(n,a);else if(M.isString(n)&&(n=n.trim())&&!Oo(n))d(Co(n),a);else if(M.isObject(n)&&M.isIterable(n)){let u={},b,h;for(const p of n){if(!M.isArray(p))throw TypeError("Object iterator must return a key-value pair");u[h=p[0]]=(b=u[h])?M.isArray(b)?[...b,p[1]]:[b,p[1]]:p[1]}d(u,a)}else n!=null&&i(a,n,r);return this}get(n,a){if(n=Ft(n),n){const r=M.findKey(this,n);if(r){const s=this[r];if(!a)return s;if(a===!0)return Ao(s);if(M.isFunction(a))return a.call(this,s,r);if(M.isRegExp(a))return a.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(n,a){if(n=Ft(n),n){const r=M.findKey(this,n);return!!(r&&this[r]!==void 0&&(!a||$n(this,this[r],r,a)))}return!1}delete(n,a){const r=this;let s=!1;function i(d){if(d=Ft(d),d){const u=M.findKey(r,d);u&&(!a||$n(r,r[u],u,a))&&(delete r[u],s=!0)}}return M.isArray(n)?n.forEach(i):i(n),s}clear(n){const a=Object.keys(this);let r=a.length,s=!1;for(;r--;){const i=a[r];(!n||$n(this,this[i],i,n,!0))&&(delete this[i],s=!0)}return s}normalize(n){const a=this,r={};return M.forEach(this,(s,i)=>{const d=M.findKey(r,i);if(d){a[d]=hn(s),delete a[i];return}const u=n?Po(i):String(i).trim();u!==i&&delete a[i],a[u]=hn(s),r[u]=!0}),this}concat(...n){return this.constructor.concat(this,...n)}toJSON(n){const a=Object.create(null);return M.forEach(this,(r,s)=>{r!=null&&r!==!1&&(a[s]=n&&M.isArray(r)?r.join(", "):r)}),a}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([n,a])=>n+": "+a).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(n){return n instanceof this?n:new this(n)}static concat(n,...a){const r=new this(n);return a.forEach(s=>r.set(s)),r}static accessor(n){const r=(this[_a]=this[_a]={accessors:{}}).accessors,s=this.prototype;function i(d){const u=Ft(d);r[u]||(Io(s,d),r[u]=!0)}return M.isArray(n)?n.forEach(i):i(n),this}};Ye.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);M.reduceDescriptors(Ye.prototype,({value:t},n)=>{let a=n[0].toUpperCase()+n.slice(1);return{get:()=>t,set(r){this[a]=r}}});M.freezeMethods(Ye);function Un(t,n){const a=this||Kt,r=n||a,s=Ye.from(r.headers);let i=r.data;return M.forEach(t,function(u){i=u.call(a,i,s.normalize(),n?n.status:void 0)}),s.normalize(),i}function Yr(t){return!!(t&&t.__CANCEL__)}let Jt=class extends ge{constructor(n,a,r){super(n??"canceled",ge.ERR_CANCELED,a,r),this.name="CanceledError",this.__CANCEL__=!0}};function Wr(t,n,a){const r=a.config.validateStatus;!a.status||!r||r(a.status)?t(a):n(new ge("Request failed with status code "+a.status,[ge.ERR_BAD_REQUEST,ge.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function Eo(t){const n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return n&&n[1]||""}function ko(t,n){t=t||10;const a=new Array(t),r=new Array(t);let s=0,i=0,d;return n=n!==void 0?n:1e3,function(b){const h=Date.now(),p=r[i];d||(d=h),a[s]=b,r[s]=h;let y=i,v=0;for(;y!==s;)v+=a[y++],y=y%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-d<n)return;const w=p&&h-p;return w?Math.round(v*1e3/w):void 0}}function Mo(t,n){let a=0,r=1e3/n,s,i;const d=(h,p=Date.now())=>{a=p,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const p=Date.now(),y=p-a;y>=r?d(h,p):(s=h,i||(i=setTimeout(()=>{i=null,d(s)},r-y)))},()=>s&&d(s)]}const Tn=(t,n,a=3)=>{let r=0;const s=ko(50,250);return Mo(i=>{const d=i.loaded,u=i.lengthComputable?i.total:void 0,b=u!=null?Math.min(d,u):d,h=Math.max(0,b-r),p=s(h);r=Math.max(r,b);const y={loaded:b,total:u,progress:u?b/u:void 0,bytes:h,rate:p||void 0,estimated:p&&u?(u-b)/p:void 0,event:i,lengthComputable:u!=null,[n?"download":"upload"]:!0};t(y)},a)},Ca=(t,n)=>{const a=t!=null;return[r=>n[0]({lengthComputable:a,total:t,loaded:r}),n[1]]},Ta=t=>(...n)=>M.asap(()=>t(...n)),Fo=Ne.hasStandardBrowserEnv?((t,n)=>a=>(a=new URL(a,Ne.origin),t.protocol===a.protocol&&t.host===a.host&&(n||t.port===a.port)))(new URL(Ne.origin),Ne.navigator&&/(msie|trident)/i.test(Ne.navigator.userAgent)):()=>!0,Bo=Ne.hasStandardBrowserEnv?{write(t,n,a,r,s,i,d){if(typeof document>"u")return;const u=[`${t}=${encodeURIComponent(n)}`];M.isNumber(a)&&u.push(`expires=${new Date(a).toUTCString()}`),M.isString(r)&&u.push(`path=${r}`),M.isString(s)&&u.push(`domain=${s}`),i===!0&&u.push("secure"),M.isString(d)&&u.push(`SameSite=${d}`),document.cookie=u.join("; ")},read(t){if(typeof document>"u")return null;const n=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return n?decodeURIComponent(n[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function No(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $o(t,n){return n?t.replace(/\/?\/$/,"")+"/"+n.replace(/^\/+/,""):t}function Hr(t,n,a){let r=!No(n);return t&&(r||a===!1)?$o(t,n):n}const Ra=t=>t instanceof Ye?{...t}:t;function wt(t,n){n=n||{};const a=Object.create(null);Object.defineProperty(a,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(h,p,y,v){return M.isPlainObject(h)&&M.isPlainObject(p)?M.merge.call({caseless:v},h,p):M.isPlainObject(p)?M.merge({},p):M.isArray(p)?p.slice():p}function s(h,p,y,v){if(M.isUndefined(p)){if(!M.isUndefined(h))return r(void 0,h,y,v)}else return r(h,p,y,v)}function i(h,p){if(!M.isUndefined(p))return r(void 0,p)}function d(h,p){if(M.isUndefined(p)){if(!M.isUndefined(h))return r(void 0,h)}else return r(void 0,p)}function u(h,p,y){if(M.hasOwnProp(n,y))return r(h,p);if(M.hasOwnProp(t,y))return r(void 0,h)}const b={url:i,method:i,data:i,baseURL:d,transformRequest:d,transformResponse:d,paramsSerializer:d,timeout:d,timeoutMessage:d,withCredentials:d,withXSRFToken:d,adapter:d,responseType:d,xsrfCookieName:d,xsrfHeaderName:d,onUploadProgress:d,onDownloadProgress:d,decompress:d,maxContentLength:d,maxBodyLength:d,beforeRedirect:d,transport:d,httpAgent:d,httpsAgent:d,cancelToken:d,socketPath:d,allowedSocketPaths:d,responseEncoding:d,validateStatus:u,headers:(h,p,y)=>s(Ra(h),Ra(p),y,!0)};return M.forEach(Object.keys({...t,...n}),function(p){if(p==="__proto__"||p==="constructor"||p==="prototype")return;const y=M.hasOwnProp(b,p)?b[p]:s,v=M.hasOwnProp(t,p)?t[p]:void 0,w=M.hasOwnProp(n,p)?n[p]:void 0,m=y(v,w,p);M.isUndefined(m)&&y!==u||(a[p]=m)}),a}const Kr=t=>{const n=wt({},t),a=v=>M.hasOwnProp(n,v)?n[v]:void 0,r=a("data");let s=a("withXSRFToken");const i=a("xsrfHeaderName"),d=a("xsrfCookieName");let u=a("headers");const b=a("auth"),h=a("baseURL"),p=a("allowAbsoluteUrls"),y=a("url");if(n.headers=u=Ye.from(u),n.url=zr(Hr(h,y,p),t.params,t.paramsSerializer),b&&u.set("Authorization","Basic "+btoa((b.username||"")+":"+(b.password?unescape(encodeURIComponent(b.password)):""))),M.isFormData(r)){if(Ne.hasStandardBrowserEnv||Ne.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(M.isFunction(r.getHeaders)){const v=r.getHeaders(),w=["content-type","content-length"];Object.entries(v).forEach(([m,c])=>{w.includes(m.toLowerCase())&&u.set(m,c)})}}if(Ne.hasStandardBrowserEnv&&(M.isFunction(s)&&(s=s(n)),s===!0||s==null&&Fo(n.url))){const w=i&&d&&Bo.read(d);w&&u.set(i,w)}return n},Uo=typeof XMLHttpRequest<"u",Lo=Uo&&function(t){return new Promise(function(a,r){const s=Kr(t);let i=s.data;const d=Ye.from(s.headers).normalize();let{responseType:u,onUploadProgress:b,onDownloadProgress:h}=s,p,y,v,w,m;function c(){w&&w(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(p),s.signal&&s.signal.removeEventListener("abort",p)}let f=new XMLHttpRequest;f.open(s.method.toUpperCase(),s.url,!0),f.timeout=s.timeout;function T(){if(!f)return;const S=Ye.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),g={data:!u||u==="text"||u==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:S,config:t,request:f};Wr(function(P){a(P),c()},function(P){r(P),c()},g),f=null}"onloadend"in f?f.onloadend=T:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(T)},f.onabort=function(){f&&(r(new ge("Request aborted",ge.ECONNABORTED,t,f)),f=null)},f.onerror=function(j){const g=j&&j.message?j.message:"Network Error",_=new ge(g,ge.ERR_NETWORK,t,f);_.event=j||null,r(_),f=null},f.ontimeout=function(){let j=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const g=s.transitional||ua;s.timeoutErrorMessage&&(j=s.timeoutErrorMessage),r(new ge(j,g.clarifyTimeoutError?ge.ETIMEDOUT:ge.ECONNABORTED,t,f)),f=null},i===void 0&&d.setContentType(null),"setRequestHeader"in f&&M.forEach(d.toJSON(),function(j,g){f.setRequestHeader(g,j)}),M.isUndefined(s.withCredentials)||(f.withCredentials=!!s.withCredentials),u&&u!=="json"&&(f.responseType=s.responseType),h&&([v,m]=Tn(h,!0),f.addEventListener("progress",v)),b&&f.upload&&([y,w]=Tn(b),f.upload.addEventListener("progress",y),f.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(p=S=>{f&&(r(!S||S.type?new Jt(null,t,f):S),f.abort(),f=null)},s.cancelToken&&s.cancelToken.subscribe(p),s.signal&&(s.signal.aborted?p():s.signal.addEventListener("abort",p)));const C=Eo(s.url);if(C&&Ne.protocols.indexOf(C)===-1){r(new ge("Unsupported protocol "+C+":",ge.ERR_BAD_REQUEST,t));return}f.send(i||null)})},qo=(t,n)=>{const{length:a}=t=t?t.filter(Boolean):[];if(n||a){let r=new AbortController,s;const i=function(h){if(!s){s=!0,u();const p=h instanceof Error?h:this.reason;r.abort(p instanceof ge?p:new Jt(p instanceof Error?p.message:p))}};let d=n&&setTimeout(()=>{d=null,i(new ge(`timeout of ${n}ms exceeded`,ge.ETIMEDOUT))},n);const u=()=>{t&&(d&&clearTimeout(d),d=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:b}=r;return b.unsubscribe=()=>M.asap(u),b}},zo=function*(t,n){let a=t.byteLength;if(a<n){yield t;return}let r=0,s;for(;r<a;)s=r+n,yield t.slice(r,s),r=s},Vo=async function*(t,n){for await(const a of Yo(t))yield*zo(a,n)},Yo=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const n=t.getReader();try{for(;;){const{done:a,value:r}=await n.read();if(a)break;yield r}}finally{await n.cancel()}},Da=(t,n,a,r)=>{const s=Vo(t,n);let i=0,d,u=b=>{d||(d=!0,r&&r(b))};return new ReadableStream({async pull(b){try{const{done:h,value:p}=await s.next();if(h){u(),b.close();return}let y=p.byteLength;if(a){let v=i+=y;a(v)}b.enqueue(new Uint8Array(p))}catch(h){throw u(h),h}},cancel(b){return u(b),s.return()}},{highWaterMark:2})},Aa=64*1024,{isFunction:tn}=M,Wo=(({Request:t,Response:n})=>({Request:t,Response:n}))(M.global),{ReadableStream:Oa,TextEncoder:Pa}=M.global,Ia=(t,...n)=>{try{return!!t(...n)}catch{return!1}},Ho=t=>{t=M.merge.call({skipUndefined:!0},Wo,t);const{fetch:n,Request:a,Response:r}=t,s=n?tn(n):typeof fetch=="function",i=tn(a),d=tn(r);if(!s)return!1;const u=s&&tn(Oa),b=s&&(typeof Pa=="function"?(m=>c=>m.encode(c))(new Pa):async m=>new Uint8Array(await new a(m).arrayBuffer())),h=i&&u&&Ia(()=>{let m=!1;const c=new a(Ne.origin,{body:new Oa,method:"POST",get duplex(){return m=!0,"half"}}),f=c.headers.has("Content-Type");return c.body!=null&&c.body.cancel(),m&&!f}),p=d&&u&&Ia(()=>M.isReadableStream(new r("").body)),y={stream:p&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!y[m]&&(y[m]=(c,f)=>{let T=c&&c[m];if(T)return T.call(c);throw new ge(`Response type '${m}' is not supported`,ge.ERR_NOT_SUPPORT,f)})});const v=async m=>{if(m==null)return 0;if(M.isBlob(m))return m.size;if(M.isSpecCompliantForm(m))return(await new a(Ne.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(M.isArrayBufferView(m)||M.isArrayBuffer(m))return m.byteLength;if(M.isURLSearchParams(m)&&(m=m+""),M.isString(m))return(await b(m)).byteLength},w=async(m,c)=>{const f=M.toFiniteNumber(m.getContentLength());return f??v(c)};return async m=>{let{url:c,method:f,data:T,signal:C,cancelToken:S,timeout:j,onDownloadProgress:g,onUploadProgress:_,responseType:P,headers:I,withCredentials:O="same-origin",fetchOptions:k}=Kr(m),E=n||fetch;P=P?(P+"").toLowerCase():"text";let D=qo([C,S&&S.toAbortSignal()],j),F=null;const V=D&&D.unsubscribe&&(()=>{D.unsubscribe()});let Z;try{if(_&&h&&f!=="get"&&f!=="head"&&(Z=await w(I,T))!==0){let R=new a(c,{method:"POST",body:T,duplex:"half"}),$;if(M.isFormData(T)&&($=R.headers.get("content-type"))&&I.setContentType($),R.body){const[q,Q]=Ca(Z,Tn(Ta(_)));T=Da(R.body,Aa,q,Q)}}M.isString(O)||(O=O?"include":"omit");const U=i&&"credentials"in a.prototype;if(M.isFormData(T)){const R=I.getContentType();R&&/^multipart\/form-data/i.test(R)&&!/boundary=/i.test(R)&&I.delete("content-type")}const Y={...k,signal:D,method:f.toUpperCase(),headers:I.normalize().toJSON(),body:T,duplex:"half",credentials:U?O:void 0};F=i&&new a(c,Y);let W=await(i?E(F,k):E(c,Y));const L=p&&(P==="stream"||P==="response");if(p&&(g||L&&V)){const R={};["status","statusText","headers"].forEach(ue=>{R[ue]=W[ue]});const $=M.toFiniteNumber(W.headers.get("content-length")),[q,Q]=g&&Ca($,Tn(Ta(g),!0))||[];W=new r(Da(W.body,Aa,q,()=>{Q&&Q(),V&&V()}),R)}P=P||"text";let x=await y[M.findKey(y,P)||"text"](W,m);return!L&&V&&V(),await new Promise((R,$)=>{Wr(R,$,{data:x,headers:Ye.from(W.headers),status:W.status,statusText:W.statusText,config:m,request:F})})}catch(U){throw V&&V(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new ge("Network Error",ge.ERR_NETWORK,m,F,U&&U.response),{cause:U.cause||U}):ge.from(U,U&&U.code,m,F,U&&U.response)}}},Ko=new Map,Jr=t=>{let n=t&&t.env||{};const{fetch:a,Request:r,Response:s}=n,i=[r,s,a];let d=i.length,u=d,b,h,p=Ko;for(;u--;)b=i[u],h=p.get(b),h===void 0&&p.set(b,h=u?new Map:Ho(n)),p=h;return h};Jr();const fa={http:io,xhr:Lo,fetch:{get:Jr}};M.forEach(fa,(t,n)=>{if(t){try{Object.defineProperty(t,"name",{value:n})}catch{}Object.defineProperty(t,"adapterName",{value:n})}});const Ea=t=>`- ${t}`,Jo=t=>M.isFunction(t)||t===null||t===!1;function Go(t,n){t=M.isArray(t)?t:[t];const{length:a}=t;let r,s;const i={};for(let d=0;d<a;d++){r=t[d];let u;if(s=r,!Jo(r)&&(s=fa[(u=String(r)).toLowerCase()],s===void 0))throw new ge(`Unknown adapter '${u}'`);if(s&&(M.isFunction(s)||(s=s.get(n))))break;i[u||"#"+d]=s}if(!s){const d=Object.entries(i).map(([b,h])=>`adapter ${b} `+(h===!1?"is not supported by the environment":"is not available in the build"));let u=a?d.length>1?`since :
4
+ `+d.map(Ea).join(`
5
+ `):" "+Ea(d[0]):"as no adapter specified";throw new ge("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return s}const Gr={getAdapter:Go,adapters:fa};function Ln(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Jt(null,t)}function ka(t){return Ln(t),t.headers=Ye.from(t.headers),t.data=Un.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Gr.getAdapter(t.adapter||Kt.adapter,t)(t).then(function(r){return Ln(t),r.data=Un.call(t,t.transformResponse,r),r.headers=Ye.from(r.headers),r},function(r){return Yr(r)||(Ln(t),r&&r.response&&(r.response.data=Un.call(t,t.transformResponse,r.response),r.response.headers=Ye.from(r.response.headers))),Promise.reject(r)})}const Qr="1.15.2",In={};["object","boolean","number","function","string","symbol"].forEach((t,n)=>{In[t]=function(r){return typeof r===t||"a"+(n<1?"n ":" ")+t}});const Ma={};In.transitional=function(n,a,r){function s(i,d){return"[Axios v"+Qr+"] Transitional option '"+i+"'"+d+(r?". "+r:"")}return(i,d,u)=>{if(n===!1)throw new ge(s(d," has been removed"+(a?" in "+a:"")),ge.ERR_DEPRECATED);return a&&!Ma[d]&&(Ma[d]=!0,console.warn(s(d," has been deprecated since v"+a+" and will be removed in the near future"))),n?n(i,d,u):!0}};In.spelling=function(n){return(a,r)=>(console.warn(`${r} is likely a misspelling of ${n}`),!0)};function Qo(t,n,a){if(typeof t!="object")throw new ge("options must be an object",ge.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],d=Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0;if(d){const u=t[i],b=u===void 0||d(u,i,t);if(b!==!0)throw new ge("option "+i+" must be "+b,ge.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new ge("Unknown option "+i,ge.ERR_BAD_OPTION)}}const yn={assertOptions:Qo,validators:In},et=yn.validators;let St=class{constructor(n){this.defaults=n||{},this.interceptors={request:new va,response:new va}}async request(n,a){try{return await this._request(n,a)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const d=s.stack.indexOf(`
6
+ `);return d===-1?"":s.stack.slice(d+1)})();try{if(!r.stack)r.stack=i;else if(i){const d=i.indexOf(`
7
+ `),u=d===-1?-1:i.indexOf(`
8
+ `,d+1),b=u===-1?"":i.slice(u+1);String(r.stack).endsWith(b)||(r.stack+=`
9
+ `+i)}}catch{}}throw r}}_request(n,a){typeof n=="string"?(a=a||{},a.url=n):a=n||{},a=wt(this.defaults,a);const{transitional:r,paramsSerializer:s,headers:i}=a;r!==void 0&&yn.assertOptions(r,{silentJSONParsing:et.transitional(et.boolean),forcedJSONParsing:et.transitional(et.boolean),clarifyTimeoutError:et.transitional(et.boolean),legacyInterceptorReqResOrdering:et.transitional(et.boolean)},!1),s!=null&&(M.isFunction(s)?a.paramsSerializer={serialize:s}:yn.assertOptions(s,{encode:et.function,serialize:et.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),yn.assertOptions(a,{baseUrl:et.spelling("baseURL"),withXsrfToken:et.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let d=i&&M.merge(i.common,i[a.method]);i&&M.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),a.headers=Ye.concat(d,i);const u=[];let b=!0;this.interceptors.request.forEach(function(c){if(typeof c.runWhen=="function"&&c.runWhen(a)===!1)return;b=b&&c.synchronous;const f=a.transitional||ua;f&&f.legacyInterceptorReqResOrdering?u.unshift(c.fulfilled,c.rejected):u.push(c.fulfilled,c.rejected)});const h=[];this.interceptors.response.forEach(function(c){h.push(c.fulfilled,c.rejected)});let p,y=0,v;if(!b){const m=[ka.bind(this),void 0];for(m.unshift(...u),m.push(...h),v=m.length,p=Promise.resolve(a);y<v;)p=p.then(m[y++],m[y++]);return p}v=u.length;let w=a;for(;y<v;){const m=u[y++],c=u[y++];try{w=m(w)}catch(f){c.call(this,f);break}}try{p=ka.call(this,w)}catch(m){return Promise.reject(m)}for(y=0,v=h.length;y<v;)p=p.then(h[y++],h[y++]);return p}getUri(n){n=wt(this.defaults,n);const a=Hr(n.baseURL,n.url,n.allowAbsoluteUrls);return zr(a,n.params,n.paramsSerializer)}};M.forEach(["delete","get","head","options"],function(n){St.prototype[n]=function(a,r){return this.request(wt(r||{},{method:n,url:a,data:(r||{}).data}))}});M.forEach(["post","put","patch"],function(n){function a(r){return function(i,d,u){return this.request(wt(u||{},{method:n,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:d}))}}St.prototype[n]=a(),St.prototype[n+"Form"]=a(!0)});let Xo=class Xr{constructor(n){if(typeof n!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(i){a=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const d=new Promise(u=>{r.subscribe(u),i=u}).then(s);return d.cancel=function(){r.unsubscribe(i)},d},n(function(i,d,u){r.reason||(r.reason=new Jt(i,d,u),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]}unsubscribe(n){if(!this._listeners)return;const a=this._listeners.indexOf(n);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const n=new AbortController,a=r=>{n.abort(r)};return this.subscribe(a),n.signal.unsubscribe=()=>this.unsubscribe(a),n.signal}static source(){let n;return{token:new Xr(function(s){n=s}),cancel:n}}};function Zo(t){return function(a){return t.apply(null,a)}}function ei(t){return M.isObject(t)&&t.isAxiosError===!0}const ia={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ia).forEach(([t,n])=>{ia[n]=t});function Zr(t){const n=new St(t),a=Ir(St.prototype.request,n);return M.extend(a,St.prototype,n,{allOwnKeys:!0}),M.extend(a,n,null,{allOwnKeys:!0}),a.create=function(s){return Zr(wt(t,s))},a}const De=Zr(Kt);De.Axios=St;De.CanceledError=Jt;De.CancelToken=Xo;De.isCancel=Yr;De.VERSION=Qr;De.toFormData=Pn;De.AxiosError=ge;De.Cancel=De.CanceledError;De.all=function(n){return Promise.all(n)};De.spread=Zo;De.isAxiosError=ei;De.mergeConfig=wt;De.AxiosHeaders=Ye;De.formToJSON=t=>Vr(M.isHTMLForm(t)?new FormData(t):t);De.getAdapter=Gr.getAdapter;De.HttpStatusCode=ia;De.default=De;const{Axios:Cc,AxiosError:Tc,CanceledError:Rc,isCancel:Dc,CancelToken:Ac,VERSION:Oc,all:Pc,Cancel:Ic,isAxiosError:Ec,spread:kc,toFormData:Mc,AxiosHeaders:Fc,HttpStatusCode:Bc,formToJSON:Nc,getAdapter:$c,mergeConfig:Uc}=De,ti=()=>new Promise(t=>setTimeout(()=>t(),800));let la=null;const ni=t=>{la=t,ct.defaults.baseURL=ma()},ma=()=>la||"https://npmapi.ubkerp.com/",ct=De.create({baseURL:ma()}),pt=()=>ma(),Ge=async(t,n,a)=>{const r=await ct.post(t,n,{headers:{Authorization:a}});if(console.log("ddddfdfdfd",r.data?.Status),r.data?.Status=="Success")return r?.data?.data||r?.data;throw new Error(r.data?.msg)},te=async(t,n)=>{try{let r=t;if(!t.includes("session_id")){const i=t.includes("?")?"&":"?";r=`${t}${i}session_id=1`}return(await ct.get(r,{headers:{Authorization:n}})).data}catch(a){throw a.response?.status===401&&console.error("401 Unauthorized"),a}},ai=async(t,n)=>{const a=await ct.post(t,"",{headers:{Authorization:n}});if(a.data?.Status=="Success")return a?.data?.data||a?.data;throw new Error(a.data?.msg)},es=async(t,n,a)=>(await ct.post(t,n,{headers:{Authorization:a}}))?.data,qn=async(t,n,a)=>{const r=n?.arg;return(await ct.post(t,r,{headers:{Authorization:a}}))?.data},At=async(t,n,a)=>{const r=n?.arg,s=t.includes("?")?"&":"?";return(await ct.get(t+s,{params:r,headers:{Authorization:a}}))?.data},ri="/branchapi/GeneralSettings/getsetting_allowances_dedectionBranch",ha=async(t,n,a)=>{const r=n?.arg,s=t.includes("?")?"&":"?";return(await ct.get(t+s,{params:r,headers:{Authorization:a}}))?.data},ft=async(t,n,a)=>(await ti(),(await ct.post(t,n,{headers:{Authorization:a}}))?.data),nt=async(t,n,a)=>(await ct.delete(`${t}/${n}`,{headers:{Authorization:a}})).data,si=({token:t,menu:n})=>{const{isLoading:a,data:r}=X(t?["api/sdk/Menus",t]:null,([i,d])=>ai(i,d)),s=r?.find(i=>i.path===n)?.sub_menu??[];return console.log("menuData",r),e.jsx(o.Row,{gutter:[16,16],children:s?.map((i,d)=>i.dashboard_show==="YES"?e.jsx(o.Col,{xs:24,md:8,lg:8,children:e.jsx(ne,{children:e.jsx(Pr,{icon:`${pt()}icons/frontoffice/${i.icons}`,title:i.submenu_name,path:i.menu_key})})},`${d}office001`):null)})};function ts(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Me={},zn,Fa;function oi(){return Fa||(Fa=1,zn=function t(n,a){if(n===a)return!0;if(n&&a&&typeof n=="object"&&typeof a=="object"){if(n.constructor!==a.constructor)return!1;var r,s,i;if(Array.isArray(n)){if(r=n.length,r!=a.length)return!1;for(s=r;s--!==0;)if(!t(n[s],a[s]))return!1;return!0}if(n.constructor===RegExp)return n.source===a.source&&n.flags===a.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===a.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===a.toString();if(i=Object.keys(n),r=i.length,r!==Object.keys(a).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(a,i[s]))return!1;for(s=r;s--!==0;){var d=i[s];if(!t(n[d],a[d]))return!1}return!0}return n!==n&&a!==a}),zn}var nn={exports:{}},an={exports:{}},Ce={};var Ba;function ii(){if(Ba)return Ce;Ba=1;var t=typeof Symbol=="function"&&Symbol.for,n=t?Symbol.for("react.element"):60103,a=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,d=t?Symbol.for("react.provider"):60109,u=t?Symbol.for("react.context"):60110,b=t?Symbol.for("react.async_mode"):60111,h=t?Symbol.for("react.concurrent_mode"):60111,p=t?Symbol.for("react.forward_ref"):60112,y=t?Symbol.for("react.suspense"):60113,v=t?Symbol.for("react.suspense_list"):60120,w=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,c=t?Symbol.for("react.block"):60121,f=t?Symbol.for("react.fundamental"):60117,T=t?Symbol.for("react.responder"):60118,C=t?Symbol.for("react.scope"):60119;function S(g){if(typeof g=="object"&&g!==null){var _=g.$$typeof;switch(_){case n:switch(g=g.type,g){case b:case h:case r:case i:case s:case y:return g;default:switch(g=g&&g.$$typeof,g){case u:case p:case m:case w:case d:return g;default:return _}}case a:return _}}}function j(g){return S(g)===h}return Ce.AsyncMode=b,Ce.ConcurrentMode=h,Ce.ContextConsumer=u,Ce.ContextProvider=d,Ce.Element=n,Ce.ForwardRef=p,Ce.Fragment=r,Ce.Lazy=m,Ce.Memo=w,Ce.Portal=a,Ce.Profiler=i,Ce.StrictMode=s,Ce.Suspense=y,Ce.isAsyncMode=function(g){return j(g)||S(g)===b},Ce.isConcurrentMode=j,Ce.isContextConsumer=function(g){return S(g)===u},Ce.isContextProvider=function(g){return S(g)===d},Ce.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===n},Ce.isForwardRef=function(g){return S(g)===p},Ce.isFragment=function(g){return S(g)===r},Ce.isLazy=function(g){return S(g)===m},Ce.isMemo=function(g){return S(g)===w},Ce.isPortal=function(g){return S(g)===a},Ce.isProfiler=function(g){return S(g)===i},Ce.isStrictMode=function(g){return S(g)===s},Ce.isSuspense=function(g){return S(g)===y},Ce.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===r||g===h||g===i||g===s||g===y||g===v||typeof g=="object"&&g!==null&&(g.$$typeof===m||g.$$typeof===w||g.$$typeof===d||g.$$typeof===u||g.$$typeof===p||g.$$typeof===f||g.$$typeof===T||g.$$typeof===C||g.$$typeof===c)},Ce.typeOf=S,Ce}var Te={};var Na;function li(){return Na||(Na=1,process.env.NODE_ENV!=="production"&&(function(){var t=typeof Symbol=="function"&&Symbol.for,n=t?Symbol.for("react.element"):60103,a=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,s=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,d=t?Symbol.for("react.provider"):60109,u=t?Symbol.for("react.context"):60110,b=t?Symbol.for("react.async_mode"):60111,h=t?Symbol.for("react.concurrent_mode"):60111,p=t?Symbol.for("react.forward_ref"):60112,y=t?Symbol.for("react.suspense"):60113,v=t?Symbol.for("react.suspense_list"):60120,w=t?Symbol.for("react.memo"):60115,m=t?Symbol.for("react.lazy"):60116,c=t?Symbol.for("react.block"):60121,f=t?Symbol.for("react.fundamental"):60117,T=t?Symbol.for("react.responder"):60118,C=t?Symbol.for("react.scope"):60119;function S(K){return typeof K=="string"||typeof K=="function"||K===r||K===h||K===i||K===s||K===y||K===v||typeof K=="object"&&K!==null&&(K.$$typeof===m||K.$$typeof===w||K.$$typeof===d||K.$$typeof===u||K.$$typeof===p||K.$$typeof===f||K.$$typeof===T||K.$$typeof===C||K.$$typeof===c)}function j(K){if(typeof K=="object"&&K!==null){var ve=K.$$typeof;switch(ve){case n:var Pe=K.type;switch(Pe){case b:case h:case r:case i:case s:case y:return Pe;default:var ke=Pe&&Pe.$$typeof;switch(ke){case u:case p:case m:case w:case d:return ke;default:return ve}}case a:return ve}}}var g=b,_=h,P=u,I=d,O=n,k=p,E=r,D=m,F=w,V=a,Z=i,U=s,Y=y,W=!1;function L(K){return W||(W=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),x(K)||j(K)===b}function x(K){return j(K)===h}function R(K){return j(K)===u}function $(K){return j(K)===d}function q(K){return typeof K=="object"&&K!==null&&K.$$typeof===n}function Q(K){return j(K)===p}function ue(K){return j(K)===r}function se(K){return j(K)===m}function pe(K){return j(K)===w}function B(K){return j(K)===a}function H(K){return j(K)===i}function ie(K){return j(K)===s}function je(K){return j(K)===y}Te.AsyncMode=g,Te.ConcurrentMode=_,Te.ContextConsumer=P,Te.ContextProvider=I,Te.Element=O,Te.ForwardRef=k,Te.Fragment=E,Te.Lazy=D,Te.Memo=F,Te.Portal=V,Te.Profiler=Z,Te.StrictMode=U,Te.Suspense=Y,Te.isAsyncMode=L,Te.isConcurrentMode=x,Te.isContextConsumer=R,Te.isContextProvider=$,Te.isElement=q,Te.isForwardRef=Q,Te.isFragment=ue,Te.isLazy=se,Te.isMemo=pe,Te.isPortal=B,Te.isProfiler=H,Te.isStrictMode=ie,Te.isSuspense=je,Te.isValidElementType=S,Te.typeOf=j})()),Te}var $a;function ns(){return $a||($a=1,process.env.NODE_ENV==="production"?an.exports=ii():an.exports=li()),an.exports}var Vn,Ua;function di(){if(Ua)return Vn;Ua=1;var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function s(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var d={},u=0;u<10;u++)d["_"+String.fromCharCode(u)]=u;var b=Object.getOwnPropertyNames(d).map(function(p){return d[p]});if(b.join("")!=="0123456789")return!1;var h={};return"abcdefghijklmnopqrst".split("").forEach(function(p){h[p]=p}),Object.keys(Object.assign({},h)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Vn=s()?Object.assign:function(i,d){for(var u,b=r(i),h,p=1;p<arguments.length;p++){u=Object(arguments[p]);for(var y in u)n.call(u,y)&&(b[y]=u[y]);if(t){h=t(u);for(var v=0;v<h.length;v++)a.call(u,h[v])&&(b[h[v]]=u[h[v]])}}return b},Vn}var Yn,La;function ya(){if(La)return Yn;La=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Yn=t,Yn}var Wn,qa;function as(){return qa||(qa=1,Wn=Function.call.bind(Object.prototype.hasOwnProperty)),Wn}var Hn,za;function ci(){if(za)return Hn;za=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var n=ya(),a={},r=as();t=function(i){var d="Warning: "+i;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}}}function s(i,d,u,b,h){if(process.env.NODE_ENV!=="production"){for(var p in i)if(r(i,p)){var y;try{if(typeof i[p]!="function"){var v=Error((b||"React class")+": "+u+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}y=i[p](d,p,b,u,null,n)}catch(m){y=m}if(y&&!(y instanceof Error)&&t((b||"React class")+": type specification of "+u+" `"+p+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof y+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),y instanceof Error&&!(y.message in a)){a[y.message]=!0;var w=h?h():"";t("Failed "+u+" type: "+y.message+(w??""))}}}}return s.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(a={})},Hn=s,Hn}var Kn,Va;function ui(){if(Va)return Kn;Va=1;var t=ns(),n=di(),a=ya(),r=as(),s=ci(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(u){var b="Warning: "+u;typeof console<"u"&&console.error(b);try{throw new Error(b)}catch{}});function d(){return null}return Kn=function(u,b){var h=typeof Symbol=="function"&&Symbol.iterator,p="@@iterator";function y(x){var R=x&&(h&&x[h]||x[p]);if(typeof R=="function")return R}var v="<<anonymous>>",w={array:T("array"),bigint:T("bigint"),bool:T("boolean"),func:T("function"),number:T("number"),object:T("object"),string:T("string"),symbol:T("symbol"),any:C(),arrayOf:S,element:j(),elementType:g(),instanceOf:_,node:k(),objectOf:I,oneOf:P,oneOfType:O,shape:D,exact:F};function m(x,R){return x===R?x!==0||1/x===1/R:x!==x&&R!==R}function c(x,R){this.message=x,this.data=R&&typeof R=="object"?R:{},this.stack=""}c.prototype=Error.prototype;function f(x){if(process.env.NODE_ENV!=="production")var R={},$=0;function q(ue,se,pe,B,H,ie,je){if(B=B||v,ie=ie||pe,je!==a){if(b){var K=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw K.name="Invariant Violation",K}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=B+":"+pe;!R[ve]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ie+"` prop on `"+B+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),R[ve]=!0,$++)}}return se[pe]==null?ue?se[pe]===null?new c("The "+H+" `"+ie+"` is marked as required "+("in `"+B+"`, but its value is `null`.")):new c("The "+H+" `"+ie+"` is marked as required in "+("`"+B+"`, but its value is `undefined`.")):null:x(se,pe,B,H,ie)}var Q=q.bind(null,!1);return Q.isRequired=q.bind(null,!0),Q}function T(x){function R($,q,Q,ue,se,pe){var B=$[q],H=U(B);if(H!==x){var ie=Y(B);return new c("Invalid "+ue+" `"+se+"` of type "+("`"+ie+"` supplied to `"+Q+"`, expected ")+("`"+x+"`."),{expectedType:x})}return null}return f(R)}function C(){return f(d)}function S(x){function R($,q,Q,ue,se){if(typeof x!="function")return new c("Property `"+se+"` of component `"+Q+"` has invalid PropType notation inside arrayOf.");var pe=$[q];if(!Array.isArray(pe)){var B=U(pe);return new c("Invalid "+ue+" `"+se+"` of type "+("`"+B+"` supplied to `"+Q+"`, expected an array."))}for(var H=0;H<pe.length;H++){var ie=x(pe,H,Q,ue,se+"["+H+"]",a);if(ie instanceof Error)return ie}return null}return f(R)}function j(){function x(R,$,q,Q,ue){var se=R[$];if(!u(se)){var pe=U(se);return new c("Invalid "+Q+" `"+ue+"` of type "+("`"+pe+"` supplied to `"+q+"`, expected a single ReactElement."))}return null}return f(x)}function g(){function x(R,$,q,Q,ue){var se=R[$];if(!t.isValidElementType(se)){var pe=U(se);return new c("Invalid "+Q+" `"+ue+"` of type "+("`"+pe+"` supplied to `"+q+"`, expected a single ReactElement type."))}return null}return f(x)}function _(x){function R($,q,Q,ue,se){if(!($[q]instanceof x)){var pe=x.name||v,B=L($[q]);return new c("Invalid "+ue+" `"+se+"` of type "+("`"+B+"` supplied to `"+Q+"`, expected ")+("instance of `"+pe+"`."))}return null}return f(R)}function P(x){if(!Array.isArray(x))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),d;function R($,q,Q,ue,se){for(var pe=$[q],B=0;B<x.length;B++)if(m(pe,x[B]))return null;var H=JSON.stringify(x,function(je,K){var ve=Y(K);return ve==="symbol"?String(K):K});return new c("Invalid "+ue+" `"+se+"` of value `"+String(pe)+"` "+("supplied to `"+Q+"`, expected one of "+H+"."))}return f(R)}function I(x){function R($,q,Q,ue,se){if(typeof x!="function")return new c("Property `"+se+"` of component `"+Q+"` has invalid PropType notation inside objectOf.");var pe=$[q],B=U(pe);if(B!=="object")return new c("Invalid "+ue+" `"+se+"` of type "+("`"+B+"` supplied to `"+Q+"`, expected an object."));for(var H in pe)if(r(pe,H)){var ie=x(pe,H,Q,ue,se+"."+H,a);if(ie instanceof Error)return ie}return null}return f(R)}function O(x){if(!Array.isArray(x))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),d;for(var R=0;R<x.length;R++){var $=x[R];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+W($)+" at index "+R+"."),d}function q(Q,ue,se,pe,B){for(var H=[],ie=0;ie<x.length;ie++){var je=x[ie],K=je(Q,ue,se,pe,B,a);if(K==null)return null;K.data&&r(K.data,"expectedType")&&H.push(K.data.expectedType)}var ve=H.length>0?", expected one of type ["+H.join(", ")+"]":"";return new c("Invalid "+pe+" `"+B+"` supplied to "+("`"+se+"`"+ve+"."))}return f(q)}function k(){function x(R,$,q,Q,ue){return V(R[$])?null:new c("Invalid "+Q+" `"+ue+"` supplied to "+("`"+q+"`, expected a ReactNode."))}return f(x)}function E(x,R,$,q,Q){return new c((x||"React class")+": "+R+" type `"+$+"."+q+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+Q+"`.")}function D(x){function R($,q,Q,ue,se){var pe=$[q],B=U(pe);if(B!=="object")return new c("Invalid "+ue+" `"+se+"` of type `"+B+"` "+("supplied to `"+Q+"`, expected `object`."));for(var H in x){var ie=x[H];if(typeof ie!="function")return E(Q,ue,se,H,Y(ie));var je=ie(pe,H,Q,ue,se+"."+H,a);if(je)return je}return null}return f(R)}function F(x){function R($,q,Q,ue,se){var pe=$[q],B=U(pe);if(B!=="object")return new c("Invalid "+ue+" `"+se+"` of type `"+B+"` "+("supplied to `"+Q+"`, expected `object`."));var H=n({},$[q],x);for(var ie in H){var je=x[ie];if(r(x,ie)&&typeof je!="function")return E(Q,ue,se,ie,Y(je));if(!je)return new c("Invalid "+ue+" `"+se+"` key `"+ie+"` supplied to `"+Q+"`.\nBad object: "+JSON.stringify($[q],null," ")+`
10
+ Valid keys: `+JSON.stringify(Object.keys(x),null," "));var K=je(pe,ie,Q,ue,se+"."+ie,a);if(K)return K}return null}return f(R)}function V(x){switch(typeof x){case"number":case"string":case"undefined":return!0;case"boolean":return!x;case"object":if(Array.isArray(x))return x.every(V);if(x===null||u(x))return!0;var R=y(x);if(R){var $=R.call(x),q;if(R!==x.entries){for(;!(q=$.next()).done;)if(!V(q.value))return!1}else for(;!(q=$.next()).done;){var Q=q.value;if(Q&&!V(Q[1]))return!1}}else return!1;return!0;default:return!1}}function Z(x,R){return x==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function U(x){var R=typeof x;return Array.isArray(x)?"array":x instanceof RegExp?"object":Z(R,x)?"symbol":R}function Y(x){if(typeof x>"u"||x===null)return""+x;var R=U(x);if(R==="object"){if(x instanceof Date)return"date";if(x instanceof RegExp)return"regexp"}return R}function W(x){var R=Y(x);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function L(x){return!x.constructor||!x.constructor.name?v:x.constructor.name}return w.checkPropTypes=s,w.resetWarningCache=s.resetWarningCache,w.PropTypes=w,w},Kn}var Jn,Ya;function pi(){if(Ya)return Jn;Ya=1;var t=ya();function n(){}function a(){}return a.resetWarningCache=n,Jn=function(){function r(d,u,b,h,p,y){if(y!==t){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}}r.isRequired=r;function s(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:a,resetWarningCache:n};return i.PropTypes=i,i},Jn}var Wa;function rs(){if(Wa)return nn.exports;if(Wa=1,process.env.NODE_ENV!=="production"){var t=ns(),n=!0;nn.exports=ui()(t.isElement,n)}else nn.exports=pi()();return nn.exports}var Ha;function fi(){if(Ha)return Me;Ha=1;var t=Me&&Me.__extends||(function(){var w=function(m,c){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,T){f.__proto__=T}||function(f,T){for(var C in T)Object.prototype.hasOwnProperty.call(T,C)&&(f[C]=T[C])},w(m,c)};return function(m,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");w(m,c);function f(){this.constructor=m}m.prototype=c===null?Object.create(c):(f.prototype=c.prototype,new f)}})(),n=Me&&Me.__assign||function(){return n=Object.assign||function(w){for(var m,c=1,f=arguments.length;c<f;c++){m=arguments[c];for(var T in m)Object.prototype.hasOwnProperty.call(m,T)&&(w[T]=m[T])}return w},n.apply(this,arguments)},a=Me&&Me.__createBinding||(Object.create?(function(w,m,c,f){f===void 0&&(f=c);var T=Object.getOwnPropertyDescriptor(m,c);(!T||("get"in T?!m.__esModule:T.writable||T.configurable))&&(T={enumerable:!0,get:function(){return m[c]}}),Object.defineProperty(w,f,T)}):(function(w,m,c,f){f===void 0&&(f=c),w[f]=m[c]})),r=Me&&Me.__setModuleDefault||(Object.create?(function(w,m){Object.defineProperty(w,"default",{enumerable:!0,value:m})}):function(w,m){w.default=m}),s=Me&&Me.__importStar||function(w){if(w&&w.__esModule)return w;var m={};if(w!=null)for(var c in w)c!=="default"&&Object.prototype.hasOwnProperty.call(w,c)&&a(m,w,c);return r(m,w),m},i=Me&&Me.__rest||function(w,m){var c={};for(var f in w)Object.prototype.hasOwnProperty.call(w,f)&&m.indexOf(f)<0&&(c[f]=w[f]);if(w!=null&&typeof Object.getOwnPropertySymbols=="function")for(var T=0,f=Object.getOwnPropertySymbols(w);T<f.length;T++)m.indexOf(f[T])<0&&Object.prototype.propertyIsEnumerable.call(w,f[T])&&(c[f[T]]=w[f[T]]);return c},d=Me&&Me.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(Me,"__esModule",{value:!0});var u=s(l),b=d(oi()),h=s(rs());function p(w){return w&&w.replace(/&nbsp;|\u202F|\u00A0/g," ").replace(/<br \/>/g,"<br>")}function y(w){var m=document.createTextNode("");w.appendChild(m);var c=document.activeElement===w;if(m!==null&&m.nodeValue!==null&&c){var f=window.getSelection();if(f!==null){var T=document.createRange();T.setStart(m,m.nodeValue.length),T.collapse(!0),f.removeAllRanges(),f.addRange(T)}w instanceof HTMLElement&&w.focus()}}var v=(function(w){t(m,w);function m(){var c=w!==null&&w.apply(this,arguments)||this;return c.lastHtml=c.props.html,c.el=typeof c.props.innerRef=="function"?{current:null}:u.createRef(),c.getEl=function(){return(c.props.innerRef&&typeof c.props.innerRef!="function"?c.props.innerRef:c.el).current},c.emitChange=function(f){var T=c.getEl();if(T){var C=T.innerHTML;if(c.props.onChange&&C!==c.lastHtml){var S=Object.assign({},f,{target:{value:C}});c.props.onChange(S)}c.lastHtml=C}},c}return m.prototype.render=function(){var c=this,f=this.props,T=f.tagName,C=f.html,S=f.innerRef,j=i(f,["tagName","html","innerRef"]);return u.createElement(T||"div",n(n({},j),{ref:typeof S=="function"?function(g){S(g),c.el.current=g}:S||this.el,onInput:this.emitChange,onBlur:this.props.onBlur||this.emitChange,onKeyUp:this.props.onKeyUp||this.emitChange,onKeyDown:this.props.onKeyDown||this.emitChange,contentEditable:!this.props.disabled,dangerouslySetInnerHTML:{__html:C}}),this.props.children)},m.prototype.shouldComponentUpdate=function(c){var f=this.props,T=this.getEl();return!T||p(c.html)!==p(T.innerHTML)?!0:f.disabled!==c.disabled||f.tagName!==c.tagName||f.className!==c.className||f.innerRef!==c.innerRef||f.placeholder!==c.placeholder||!(0,b.default)(f.style,c.style)},m.prototype.componentDidUpdate=function(){var c=this.getEl();c&&(this.props.html!==c.innerHTML&&(c.innerHTML=this.props.html),this.lastHtml=this.props.html,y(c))},m.propTypes={html:h.string.isRequired,onChange:h.func,disabled:h.bool,tagName:h.string,className:h.string,style:h.object,innerRef:h.oneOfType([h.object,h.func])},m})(u.Component);return Me.default=v,Me}var mi=fi();const hi=ts(mi),yi={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},gi={width:"100%",minHeight:40,padding:"8px 0",fontSize:"14px",color:"#222",background:"transparent",border:0,borderTop:0,borderLeft:0,borderRight:0,borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none",outline:"none",transition:"border-color 0.2s ease"},z=l.forwardRef(({style:t,onFocus:n,onBlur:a,...r},s)=>{const[i,d]=l.useState(!1);return e.jsxs("div",{className:"",style:{width:"100%"},children:[r.label&&e.jsx("label",{className:"labelfont",style:yi,children:r.label}),e.jsx("input",{placeholder:r.placeholder||r.label,...r,ref:s,onFocus:u=>{d(!0),n?.(u)},onBlur:u=>{d(!1),a?.(u)},style:{...gi,borderBottom:`1px solid ${i?"#222":"#d9d9d9"}`,...t||{}}})]})}),Ka=[{value:"01",label:"January"},{value:"02",label:"February"},{value:"03",label:"March"},{value:"04",label:"April"},{value:"05",label:"May"},{value:"06",label:"June"},{value:"07",label:"July"},{value:"08",label:"August"},{value:"09",label:"September"},{value:"10",label:"October"},{value:"11",label:"November"},{value:"12",label:"December"}];function ss(t){const n=ye().year(),a=[];for(let r=n;r>=n-t;r--)a.push({label:String(r),value:r});return a}function _t(t){switch(t){case"late":return e.jsx("span",{className:"label label-late",children:"L"});case"present":return e.jsx("span",{className:"label label-success",children:"P"});case"absent":return e.jsx("span",{className:"label label-danger",children:"A"});case"P":return e.jsx("span",{className:"monthlyLabel label-success",children:"P"});case"A":return e.jsx("span",{className:"monthlyLabel label-danger",children:"A"});case"L":return e.jsx("span",{className:"monthlyLabel label-late",children:"L"});case"W":return e.jsx("span",{className:"monthlyLabel sunday",children:"W"});case"H":return e.jsx("span",{className:"monthlyLabel holiday",children:"H"});default:return e.jsx("span",{className:"label",children:t})}}function os(t){const n=ye().year(),a=ye().month();return t<n?Ka:Ka.slice(0,a+1)}function xi(){return[{label:"One Time (During Admission)",value:"one_time"},{label:"One Time",value:"one_time_without_admission"},{label:"Monthly",value:"monthly"},{label:"Quarterly",value:"quarterly"},{label:"Half Yearly",value:"half_yearly"},{label:"Yearly",value:"yearly"}]}const is=t=>{switch(t){case"paid":return e.jsx("div",{style:{background:"#3cb371",color:"white",textAlign:"center"},children:"PAID"});case"due":return e.jsx("div",{style:{background:"red",color:"white",textAlign:"center"},children:"DUE"});case"partially_paid":return e.jsx("div",{style:{background:"#ff8d00",color:"white",textAlign:"center"},children:"Partially Paid"});case"Present":return e.jsx(o.Tag,{color:"success",children:"Present"});case"Absent":return e.jsx(o.Tag,{color:"error",children:"Absent"});case"NO Attendance":return e.jsx(o.Tag,{color:"error",children:"No Attendance"});case"one_time":return"ONETIME";case"monthly":return"MONTHLY";case"half_yearly":return"HALF YEARLY";case"quarterly":return"QUARTERLY";default:return""}},dt=t=>{const n=JSON.parse(localStorage.getItem("genrall_settings"));return console.log("amount______",t),e.jsxs(e.Fragment,{children:[n?.currency_icon," ",Number(t||0).toLocaleString("en-IN")]})};var Bt={},Nt={},Je={},$t={},Ct={},Ja;function bi(){if(Ja)return Ct;Ja=1;var t=Ct&&Ct.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ct,"__esModule",{value:!0});const n=t(l),a=gs,r=["string","number","boolean"];function s({header:i,body:d}){const u=n.default.createElement("tr",null,i.map(h=>n.default.createElement("th",{key:h},h))),b=d.map((h,p)=>Array.isArray(h)?n.default.createElement("tr",{key:p},h.map((y,v)=>n.default.createElement("th",{key:v}," ",y," "))):h!==null&&typeof h=="object"?n.default.createElement("tr",{key:p},Object.entries(h).map(([y,v],w)=>typeof v=="object"?(console.error(`typeof ${y} is incorrect, only accept ${r.join(", ")} `),n.default.createElement("th",{key:w})):n.default.createElement("th",{key:w},n.default.createElement(n.default.Fragment,null,v)))):(console.error(`
11
11
  data structure is incorrect,
12
12
  data structure type ->
13
13
  " type data = Array<{ [key: string]: string | number | boolean }>
14
14
  or
15
15
  type data = Array<(string | number | boolean)[]>"
16
- `),null));return(0,r.renderToString)(n.default.createElement("table",null,n.default.createElement("tbody",null,c,x)))}return ut.default=s,ut}var nr;function ro(){return nr||(nr=1,(function(e){var n=wt&&wt.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(e,"__esModule",{value:!0}),e.createTable=e.template=e.uri=e.format=e.base64=void 0;function r(o){return window.btoa(unescape(encodeURIComponent(o)))}e.base64=r;function a(o,i){return o.replace(/{(\w+)}/g,(c,x)=>i[x])}e.format=a,e.uri="data:application/vnd.ms-excel;base64,",e.template='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>{table}</body></html>';var s=no();Object.defineProperty(e,"createTable",{enumerable:!0,get:function(){return n(s).default}})})(wt)),wt}var rr;function Kr(){if(rr)return Ue;rr=1;var e=Ue&&Ue.__createBinding||(Object.create?(function(p,d,b,v){v===void 0&&(v=b);var S=Object.getOwnPropertyDescriptor(d,b);(!S||("get"in S?!d.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return d[b]}}),Object.defineProperty(p,v,S)}):(function(p,d,b,v){v===void 0&&(v=b),p[v]=d[b]})),n=Ue&&Ue.__setModuleDefault||(Object.create?(function(p,d){Object.defineProperty(p,"default",{enumerable:!0,value:d})}):function(p,d){p.default=d}),r=Ue&&Ue.__importStar||function(p){if(p&&p.__esModule)return p;var d={};if(p!=null)for(var b in p)b!=="default"&&Object.prototype.hasOwnProperty.call(p,b)&&e(d,p,b);return n(d,p),d};Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.downloadExcel=Ue.excel=void 0;const a=r(ro());function s(){return document?!0:((process==null?void 0:process.env.NODE_ENV)!=="production"&&console.error("Failed to access document object"),!1)}function o(p,d){const b=window.document.createElement("a");return b.href=a.uri+a.base64(a.format(a.template,d)),b.download=p,document.body.appendChild(b),b.click(),document.body.removeChild(b),!0}function i(p,d){if(p)return p.cloneNode(!0).outerHTML;if(d)return a.createTable(d);console.error("currentTableRef or tablePayload does not exist")}function c({fileName:p,sheet:d,tablePayload:b},v){if(!s())return!1;const S=i(v,b);return o(p,{worksheet:d||"Worksheet",table:S})}Ue.downloadExcel=c;function x({currentTableRef:p,filename:d,sheet:b}){function v(){if(!s())return!1;const S=i(p),g=`${d}.xls`;return o(g,{worksheet:b||"Worksheet",table:S})}return{onDownload:v}}return Ue.excel=x,Ue}var ar;function ao(){if(ar)return St;ar=1,Object.defineProperty(St,"__esModule",{value:!0}),St.useDownloadExcel=void 0;const e=h,n=Kr();function r({currentTableRef:a,filename:s,sheet:o}){const[i,c]=(0,e.useState)({});return(0,e.useEffect)(()=>{c({currentTableRef:a,filename:s,sheet:o})},[a,s,o]),(0,e.useMemo)(()=>(0,n.excel)(i),[i])}return St.useDownloadExcel=r,St}var sr;function so(){return sr||(sr=1,(function(e){var n=xt&&xt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(e,"__esModule",{value:!0}),e.downloadExcel=e.useDownloadExcel=e.DownloadTableExcel=void 0;const r=n(h),a=ao();Object.defineProperty(e,"useDownloadExcel",{enumerable:!0,get:function(){return a.useDownloadExcel}});const s=Kr();Object.defineProperty(e,"downloadExcel",{enumerable:!0,get:function(){return s.downloadExcel}});const o=({currentTableRef:i,filename:c,sheet:x,children:p})=>{const{onDownload:d}=(0,a.useDownloadExcel)({currentTableRef:i,filename:c,sheet:x});return r.default.createElement("span",{onClick:d},p)};e.DownloadTableExcel=o})(xt)),xt}var oo=so();const io=e=>{console.log("ExportDataWithHeader______",e);const{tableRef:n}=e.data;e?.tableRef;const r=new Date().getTime(),a=xr.useReactToPrint({content:()=>n.current});return t.jsx(t.Fragment,{children:t.jsx(l.Row,{justify:"end",children:t.jsx(l.Col,{children:t.jsxs(l.Row,{gutter:8,children:[t.jsx(l.Col,{children:t.jsx(l.Button,{type:"text",icon:t.jsx(he.PrinterOutlined,{style:{color:"#5080f8"}}),onClick:a})}),t.jsx(l.Col,{children:t.jsx(oo.DownloadTableExcel,{filename:r,sheet:"users",currentTableRef:n.current,children:t.jsx(l.Button,{type:"text",icon:t.jsx(he.FileTextOutlined,{style:{color:"#5080f8"}})})})})]})})})})},lo=e=>{const{tableRef:n}=e;return new Date().getTime(),t.jsx(t.Fragment,{children:t.jsx(l.Row,{justify:"center",children:t.jsx(l.Col,{span:24,style:{display:"flex",justifyContent:"center",alignSelf:"center",paddingBottom:"20px",position:"relative"}})})})},co=h.createContext(),uo=()=>({modal:{outline:"none",display:"flex",alignItems:"center",justifyContent:"center","&:hover":{backgroundcolor:"red"}},img:{outline:"none"},passwordmodal:{outline:"none",display:"flex",alignItems:"center",justifyContent:"center"}}),Xe=e=>{const{columns:n,action:r,DrawerUpdate:a,editDesign:s,newData:o,Loading:i,error:c,deleteTodoMutation:x,open:p,ActionView:d,viewDetails:b,myType:v,type:S,urlkey:g,columnstype:u,rowSelection:m}=e.data,_=uo(),[P,C]=h.useState(!1),[k,j]=h.useState(null),[Q,Z]=h.useState("false"),[T,D]=h.useState(!1),[R,U]=h.useState(!1),[I,H]=h.useState(),[J,pe]=h.useState(""),M=()=>C(!1),z=V=>{Z(V),C(!0)},[ce,W]=h.useState(),[f,y]=h.useState({page:e?.data?.pageController?e.data?.pageController?.page:1,rowsPerPage:e?.data?.pageController?e.data?.pageController?.rowsPerPage:10}),E=h.useRef(null),A=(V,Y)=>{e.parentCallback?.(V,Y),y({rowsPerPage:Y,page:V})},q=(V,Y)=>{j(Y),D(!0),H(V)},ee=(V,Y)=>{j(Y),U(!0),H(V)},X=e?.data?.onNavigate??e?.onNavigate,ne=(V,Y)=>{if(typeof X=="function"){X(V,Y);return}typeof window<"u"&&typeof V=="string"&&V.length>0&&window.location.assign(V)},O=V=>{if(S==="staff"){ne(`/HumanResourceDashboard/StaffFullInformation?id=${V.fk_staffID}`,V);return}ne(`/StudentInformation/StudentFullInformation?id=${V.id}`,V)},$=(V,Y)=>{W(V),a?.(Y)},K=async(V,Y,de,Te)=>{a?.(!0),de!==""&&((await Te({id:V,admission_no:Y,ec_no:de}))?.Status==="Success"?l.message.success("Ec No updated successfully"):l.message.error("Failed to Update Ec No."))},be=()=>t.jsx(co.Provider,{value:ce,children:s}),{trigger:F}=et("branchapi/staff/updateStaffPassword",Qt),{trigger:je}=et("branchapi/Student/updateEcNo",Qt),{trigger:Re}=et(g,(V,Y)=>Qt("student/studentDetails/editStudentLogInCredential",Y)),ze=async V=>{V.preventDefault(),D(!1);try{(await F({staff_id:I,new_passwod:V.target.password.value}))?.Status==="Success"?l.message.success("Password updated successfully"):l.message.error("Failed to update password")}catch{l.message.error("Failed to update password")}},Ge=async V=>{V.preventDefault(),U(!1);try{(await Re({edit_id:k?.edit_id,new_passwod:V.target.password.value,username:V.target.username.value,branch_id:JSON.parse(localStorage.getItem("genrall_settings"))?.fk_branchID}))?.Status==="Success"?l.message.success("Password updated successfully"):l.message.error("Failed to update password")}catch(Y){l.message.error(Y?.response?.data?.msg??"Failed to update password")}},Qe=(Array.isArray(n)?n:[]).some(V=>V?.fixed==="left"),Ye=[{title:"SR. NO.",dataIndex:"__serialNumber",key:"__serialNumber",width:90,fixed:u==="antd"&&Qe?"left":void 0,sorter:(V,Y)=>(V.__serialNumber??0)-(Y.__serialNumber??0),render:V=>V},...u==="antd"?n:(Array.isArray(n)?n:[]).map(V=>({title:V.name,dataIndex:V.selector,key:V.selector,sorter:V.sorter||(V.sortable?(Y,de)=>{const Te=Y[V.selector]??"",xe=de[V.selector]??"";return typeof Te=="number"&&typeof xe=="number"?Te-xe:String(Te).localeCompare(String(xe))}:!1),render:(Y,de)=>{switch(V.selector){case"my_staff":return de.staff_id!=="0"?de.staff_id:"Admin";case"gallery_cat_logo":return t.jsx(l.Image,{width:50,src:`undefined/branch/gallery/${de.gallery_cat_logo}`});case"file01":return de.documents?t.jsx("div",{onClick:()=>z(`undefined/branch/frontoffice/${de.documents}`),style:{textDecoration:"underline",color:"blue",cursor:"pointer"},children:"view file"}):"Not Uploaded";case"amount":case"fine_amount":case"basic_pay":case"net_amount":return to(Y);case"full_name":return t.jsx("span",{onClick:()=>O(de),style:{cursor:"pointer",color:"blue",textDecoration:"underline"},children:Y||`${de.firstname} ${de.lastname}`});case"extra_curricular_activity":return Y==="Yes"?"Extra Subject":"Fees Master";case"is_active":return Y==="yes"?t.jsx("span",{className:"label label-success",children:"Active"}):t.jsx("span",{className:"label label-danger",children:"Inactive"});case"steps":return de?.current_status==="Active"?t.jsx(l.Progress,{percent:de.steps==="1"?30:de.steps==="2"?70:100,steps:3}):t.jsx("span",{className:"label label-success",children:de?.current_status});case"Password":return t.jsx("span",{onClick:()=>q(de.id,de),style:{cursor:"pointer"},className:"label label-danger",children:"Update"});case"Passwordstd":return t.jsx("span",{onClick:()=>ee(de.id,de),style:{cursor:"pointer"},className:"label label-danger",children:"Update"});case"payment_status":return t.jsx(l.Tag,{onClick:()=>b?.(de.id),color:Y==="paid"?"#66aa18":Y==="partially_paid"?"#ff5722":"#DC143C",children:Y==="paid"?"Paid":Y==="partially_paid"?"Partially Paid":"Due"});case"fees_duration":return eo().find(Te=>Te.value===Y)?.label;case"status":return t.jsx("span",{onClick:()=>b?.(de?.fk_staffID,de?.total_leave),className:`label ${Y==="due"?"label-danger":"label-success"}`,style:{cursor:"pointer"},children:Y==="due"?"Due":"Paid"});case"subject_type_1":return t.jsxs(t.Fragment,{children:[de.is_theory==="yes"&&"Theory, ",de.is_practical==="yes"&&"Practical"]});case"ec_no":return t.jsx(Gs,{html:de.ec_no,onBlur:Te=>K(de.id,de.admission_no,Te.target.innerHTML,je)});case"Assign":case"AssignExtCarriAci":case"Medical":return t.jsx(l.Button,{type:"primary",icon:t.jsx(he.SendOutlined,{}),size:"small",onClick:()=>$(de.id,!0,V.name),children:V.name});case"Button":return t.jsx(l.Tag,{color:"cyan",onClick:()=>b?.(de),children:V.name});default:return Y}}})),...r?[{title:"Action",key:"action",render:(V,Y)=>{const de=Y?.current_status==="Promoted",Te=()=>{if(v=="sameAddUpdate"){$(Y,!0);return}if(v?.type==="examEdit"){v.editFunc(Y.id);return}$(Y.id||Y,!0)},xe=()=>{if(v==="student_result"){b?.(Y);return}if(v==="student"){b?.(Y.id,Y.class_id);return}b?.(Y.id)},nt=()=>{x?.(Y?.id)};return t.jsxs("div",{style:{display:"flex",gap:"5px"},children:[d?.[0]?.status&&t.jsx(l.Button,{icon:t.jsx(he.EditOutlined,{}),size:"small",disabled:de,onClick:Te}),d?.[1]?.status&&t.jsx(l.Button,{icon:t.jsx(he.DeleteOutlined,{}),size:"small",danger:!0,disabled:de,onClick:nt}),d?.[2]?.status&&t.jsx(l.Button,{icon:t.jsx(he.EyeOutlined,{}),size:"small",onClick:xe})]})}}]:[]],$e=h.useMemo(()=>o?Array.isArray(o?.data)?o.data:Array.isArray(o)?o:[]:[],[o]),Be=h.useMemo(()=>{const V=J.trim().toLowerCase();return V?$e.filter(Y=>Object.values(Y??{}).some(de=>String(de??"").toLowerCase().includes(V))):$e},[$e,J]),Le=!!e.parentCallback,Ae=J?Be.length:o?.pagination?.total_rows??Be.length,_e=(f.page-1)*f.rowsPerPage,Ee=Le?Be:Be.slice(_e,_e+f.rowsPerPage),Ke=h.useMemo(()=>(Ee??[]).map((V,Y)=>({...V??{},__serialNumber:_e+Y+1})),[_e,Ee]),tt=Ae===0?0:Math.min(_e+1,Ae),Je=Ae===0?0:Math.min(_e+Ee.length,Ae);let Me;return i?Me=t.jsx("p",{children:"Loading..."}):c?Me=t.jsx("p",{children:c.message}):Ee.length?Me=t.jsx(l.Table,{dataSource:Ke,columns:Ye,size:"small",bordered:!0,pagination:!1,rowSelection:m,rowKey:(V,Y)=>V?.id??V?._id??Y,scroll:{x:"max-content"}}):Me=t.jsx(l.Empty,{}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx(l.Drawer,{open:p,placement:"right",onClose:()=>a?.(!1),width:720,children:be()}),t.jsx(l.Modal,{title:"Update Password",open:T,onCancel:()=>D(!1),footer:null,children:t.jsx("form",{onSubmit:ze,children:t.jsxs(oe,{children:[t.jsx(oe,{style:{marginBottom:12},children:t.jsx(ae,{type:"password",label:"Password",name:"password",required:"required"})}),t.jsx(oe,{style:{marginTop:16},children:t.jsx(l.Button,{type:"primary",htmlType:"submit",children:"Update"})})]})})}),t.jsx(l.Modal,{title:" Update Credential",open:R,onCancel:()=>U(!1),footer:null,children:t.jsx("form",{onSubmit:Ge,children:t.jsxs(oe,{children:[t.jsx(oe,{style:{marginBottom:12},children:t.jsx(ae,{type:"text",label:"User Name",name:"username",required:"required",value:k?.username?k?.username:"",onChange:V=>j({...k,username:V.target.value})})}),t.jsx(oe,{style:{marginBottom:12},children:t.jsx(ae,{label:"Password",name:"password",required:"required",value:k?.password?k?.password:"",onChange:V=>j({...k,password:V.target.value})})}),t.jsx(oe,{style:{marginTop:16},children:t.jsx(l.Button,{type:"primary",htmlType:"submit",children:"Update"})})]})})}),t.jsx(l.Modal,{open:P,onCancel:M,footer:null,centered:!0,width:"80%",className:_.modal,children:t.jsxs("div",{style:{position:"relative"},className:_.img,children:[t.jsx(l.Image,{src:Q,alt:"",style:{width:"100%"},preview:!1}),t.jsx(l.Button,{type:"text",icon:t.jsx(he.CloseOutlined,{}),onClick:M,style:{position:"absolute",top:8,right:8,background:"rgba(0,0,0,0.45)",color:"#fff"}})]})}),t.jsxs(l.Card,{bodyStyle:{padding:16,background:"#f7f7fa"},children:[t.jsx("style",{children:`
16
+ `),null));return(0,a.renderToString)(n.default.createElement("table",null,n.default.createElement("tbody",null,u,b)))}return Ct.default=s,Ct}var Ga;function Si(){return Ga||(Ga=1,(function(t){var n=$t&&$t.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(t,"__esModule",{value:!0}),t.createTable=t.template=t.uri=t.format=t.base64=void 0;function a(i){return window.btoa(unescape(encodeURIComponent(i)))}t.base64=a;function r(i,d){return i.replace(/{(\w+)}/g,(u,b)=>d[b])}t.format=r,t.uri="data:application/vnd.ms-excel;base64,",t.template='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>{table}</body></html>';var s=bi();Object.defineProperty(t,"createTable",{enumerable:!0,get:function(){return n(s).default}})})($t)),$t}var Qa;function ls(){if(Qa)return Je;Qa=1;var t=Je&&Je.__createBinding||(Object.create?(function(h,p,y,v){v===void 0&&(v=y);var w=Object.getOwnPropertyDescriptor(p,y);(!w||("get"in w?!p.__esModule:w.writable||w.configurable))&&(w={enumerable:!0,get:function(){return p[y]}}),Object.defineProperty(h,v,w)}):(function(h,p,y,v){v===void 0&&(v=y),h[v]=p[y]})),n=Je&&Je.__setModuleDefault||(Object.create?(function(h,p){Object.defineProperty(h,"default",{enumerable:!0,value:p})}):function(h,p){h.default=p}),a=Je&&Je.__importStar||function(h){if(h&&h.__esModule)return h;var p={};if(h!=null)for(var y in h)y!=="default"&&Object.prototype.hasOwnProperty.call(h,y)&&t(p,h,y);return n(p,h),p};Object.defineProperty(Je,"__esModule",{value:!0}),Je.downloadExcel=Je.excel=void 0;const r=a(Si());function s(){return document?!0:((process==null?void 0:process.env.NODE_ENV)!=="production"&&console.error("Failed to access document object"),!1)}function i(h,p){const y=window.document.createElement("a");return y.href=r.uri+r.base64(r.format(r.template,p)),y.download=h,document.body.appendChild(y),y.click(),document.body.removeChild(y),!0}function d(h,p){if(h)return h.cloneNode(!0).outerHTML;if(p)return r.createTable(p);console.error("currentTableRef or tablePayload does not exist")}function u({fileName:h,sheet:p,tablePayload:y},v){if(!s())return!1;const w=d(v,y);return i(h,{worksheet:p||"Worksheet",table:w})}Je.downloadExcel=u;function b({currentTableRef:h,filename:p,sheet:y}){function v(){if(!s())return!1;const w=d(h),m=`${p}.xls`;return i(m,{worksheet:y||"Worksheet",table:w})}return{onDownload:v}}return Je.excel=b,Je}var Xa;function ji(){if(Xa)return Nt;Xa=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.useDownloadExcel=void 0;const t=l,n=ls();function a({currentTableRef:r,filename:s,sheet:i}){const[d,u]=(0,t.useState)({});return(0,t.useEffect)(()=>{u({currentTableRef:r,filename:s,sheet:i})},[r,s,i]),(0,t.useMemo)(()=>(0,n.excel)(d),[d])}return Nt.useDownloadExcel=a,Nt}var Za;function wi(){return Za||(Za=1,(function(t){var n=Bt&&Bt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(t,"__esModule",{value:!0}),t.downloadExcel=t.useDownloadExcel=t.DownloadTableExcel=void 0;const a=n(l),r=ji();Object.defineProperty(t,"useDownloadExcel",{enumerable:!0,get:function(){return r.useDownloadExcel}});const s=ls();Object.defineProperty(t,"downloadExcel",{enumerable:!0,get:function(){return s.downloadExcel}});const i=({currentTableRef:d,filename:u,sheet:b,children:h})=>{const{onDownload:p}=(0,r.useDownloadExcel)({currentTableRef:d,filename:u,sheet:b});return a.default.createElement("span",{onClick:p},h)};t.DownloadTableExcel=i})(Bt)),Bt}var ds=wi();const En=t=>{console.log("ExportDataWithHeader______",t);const{tableRef:n}=t.data;t?.tableRef;const a=new Date().getTime(),r=Vt.useReactToPrint({content:()=>n.current});return e.jsx(e.Fragment,{children:e.jsx(o.Row,{justify:"end",children:e.jsx(o.Col,{children:e.jsxs(o.Row,{gutter:8,children:[e.jsx(o.Col,{children:e.jsx(o.Button,{type:"text",icon:e.jsx(ce.PrinterOutlined,{style:{color:"#5080f8"}}),onClick:r})}),e.jsx(o.Col,{children:e.jsx(ds.DownloadTableExcel,{filename:a,sheet:"users",currentTableRef:n.current,children:e.jsx(o.Button,{type:"text",icon:e.jsx(ce.FileTextOutlined,{style:{color:"#5080f8"}})})})})]})})})})},Gt=t=>{const{tableRef:n}=t;return new Date().getTime(),e.jsx(e.Fragment,{children:e.jsx(o.Row,{justify:"center",children:e.jsx(o.Col,{span:24,style:{display:"flex",justifyContent:"center",alignSelf:"center",paddingBottom:"20px",position:"relative"}})})})},vi=l.createContext(),_i=()=>({modal:{outline:"none",display:"flex",alignItems:"center",justifyContent:"center","&:hover":{backgroundcolor:"red"}},img:{outline:"none"},passwordmodal:{outline:"none",display:"flex",alignItems:"center",justifyContent:"center"}}),Ee=t=>{const{columns:n,action:a,DrawerUpdate:r,editDesign:s,newData:i,Loading:d,error:u,deleteTodoMutation:b,open:h,ActionView:p,viewDetails:y,myType:v,type:w,urlkey:m,columnstype:c,rowSelection:f}=t.data,T=_i(),[C,S]=l.useState(!1),[j,g]=l.useState(null),[_,P]=l.useState("false"),[I,O]=l.useState(!1),[k,E]=l.useState(!1),[D,F]=l.useState(),[V,Z]=l.useState(""),U=()=>S(!1),Y=N=>{P(N),S(!0)},[W,L]=l.useState(),[x,R]=l.useState({page:t?.data?.pageController?t.data?.pageController?.page:1,rowsPerPage:t?.data?.pageController?t.data?.pageController?.rowsPerPage:10}),$=l.useRef(null),q=(N,G)=>{t.parentCallback?.(N,G),R({rowsPerPage:G,page:N})},Q=(N,G)=>{g(G),O(!0),F(N)},ue=(N,G)=>{g(G),E(!0),F(N)},se=t?.data?.onNavigate??t?.onNavigate,pe=(N,G)=>{if(typeof se=="function"){se(N,G);return}typeof window<"u"&&typeof N=="string"&&N.length>0&&window.location.assign(N)},B=N=>{if(w==="staff"){pe(`/HumanResourceDashboard/StaffFullInformation?id=${N.fk_staffID}`,N);return}pe(`/StudentInformation/StudentFullInformation?id=${N.id}`,N)},H=(N,G)=>{L(N),r?.(G)},ie=async(N,G,re,we)=>{r?.(!0),re!==""&&((await we({id:N,admission_no:G,ec_no:re}))?.Status==="Success"?o.message.success("Ec No updated successfully"):o.message.error("Failed to Update Ec No."))},je=()=>e.jsx(vi.Provider,{value:W,children:s}),{trigger:K}=ze("branchapi/staff/updateStaffPassword",qn),{trigger:ve}=ze("branchapi/Student/updateEcNo",qn),{trigger:Pe}=ze(m,(N,G)=>qn("student/studentDetails/editStudentLogInCredential",G)),ke=async N=>{N.preventDefault(),O(!1);try{(await K({staff_id:D,new_passwod:N.target.password.value}))?.Status==="Success"?o.message.success("Password updated successfully"):o.message.error("Failed to update password")}catch{o.message.error("Failed to update password")}},rt=async N=>{N.preventDefault(),E(!1);try{(await Pe({edit_id:j?.edit_id,new_passwod:N.target.password.value,username:N.target.username.value,branch_id:JSON.parse(localStorage.getItem("genrall_settings"))?.fk_branchID}))?.Status==="Success"?o.message.success("Password updated successfully"):o.message.error("Failed to update password")}catch(G){o.message.error(G?.response?.data?.msg??"Failed to update password")}},st=(Array.isArray(n)?n:[]).some(N=>N?.fixed==="left"),Qe=[{title:"SR. NO.",dataIndex:"__serialNumber",key:"__serialNumber",width:90,fixed:c==="antd"&&st?"left":void 0,sorter:(N,G)=>(N.__serialNumber??0)-(G.__serialNumber??0),render:N=>N},...c==="antd"?n:(Array.isArray(n)?n:[]).map(N=>({title:N.name,dataIndex:N.selector,key:N.selector,sorter:N.sorter||(N.sortable?(G,re)=>{const we=G[N.selector]??"",_e=re[N.selector]??"";return typeof we=="number"&&typeof _e=="number"?we-_e:String(we).localeCompare(String(_e))}:!1),render:(G,re)=>{switch(N.selector){case"my_staff":return re.staff_id!=="0"?re.staff_id:"Admin";case"gallery_cat_logo":return e.jsx(o.Image,{width:50,src:`undefined/branch/gallery/${re.gallery_cat_logo}`});case"file01":return re.documents?e.jsx("div",{onClick:()=>Y(`undefined/branch/frontoffice/${re.documents}`),style:{textDecoration:"underline",color:"blue",cursor:"pointer"},children:"view file"}):"Not Uploaded";case"amount":case"fine_amount":case"basic_pay":case"net_amount":return dt(G);case"full_name":return e.jsx("span",{onClick:()=>B(re),style:{cursor:"pointer",color:"blue",textDecoration:"underline"},children:G||`${re.firstname} ${re.lastname}`});case"extra_curricular_activity":return G==="Yes"?"Extra Subject":"Fees Master";case"is_active":return G==="yes"?e.jsx("span",{className:"label label-success",children:"Active"}):e.jsx("span",{className:"label label-danger",children:"Inactive"});case"steps":return re?.current_status==="Active"?e.jsx(o.Progress,{percent:re.steps==="1"?30:re.steps==="2"?70:100,steps:3}):e.jsx("span",{className:"label label-success",children:re?.current_status});case"Password":return e.jsx("span",{onClick:()=>Q(re.id,re),style:{cursor:"pointer"},className:"label label-danger",children:"Update"});case"Passwordstd":return e.jsx("span",{onClick:()=>ue(re.id,re),style:{cursor:"pointer"},className:"label label-danger",children:"Update"});case"payment_status":return e.jsx(o.Tag,{onClick:()=>y?.(re.id),color:G==="paid"?"#66aa18":G==="partially_paid"?"#ff5722":"#DC143C",children:G==="paid"?"Paid":G==="partially_paid"?"Partially Paid":"Due"});case"fees_duration":return xi().find(we=>we.value===G)?.label;case"status":return e.jsx("span",{onClick:()=>y?.(re?.fk_staffID,re?.total_leave),className:`label ${G==="due"?"label-danger":"label-success"}`,style:{cursor:"pointer"},children:G==="due"?"Due":"Paid"});case"subject_type_1":return e.jsxs(e.Fragment,{children:[re.is_theory==="yes"&&"Theory, ",re.is_practical==="yes"&&"Practical"]});case"ec_no":return e.jsx(hi,{html:re.ec_no,onBlur:we=>ie(re.id,re.admission_no,we.target.innerHTML,ve)});case"Assign":case"AssignExtCarriAci":case"Medical":return e.jsx(o.Button,{type:"primary",icon:e.jsx(ce.SendOutlined,{}),size:"small",onClick:()=>H(re.id,!0,N.name),children:N.name});case"Button":return e.jsx(o.Tag,{color:"cyan",onClick:()=>y?.(re),children:N.name});default:return G}}})),...a?[{title:"Action",key:"action",render:(N,G)=>{const re=G?.current_status==="Promoted",we=()=>{if(v=="sameAddUpdate"){H(G,!0);return}if(v?.type==="examEdit"){v.editFunc(G.id);return}H(G.id||G,!0)},_e=()=>{if(v==="student_result"){y?.(G);return}if(v==="student"){y?.(G.id,G.class_id);return}y?.(G.id)},lt=()=>{b?.(G?.id)};return e.jsxs("div",{style:{display:"flex",gap:"5px"},children:[p?.[0]?.status&&e.jsx(o.Button,{icon:e.jsx(ce.EditOutlined,{}),size:"small",disabled:re,onClick:we}),p?.[1]?.status&&e.jsx(o.Button,{icon:e.jsx(ce.DeleteOutlined,{}),size:"small",danger:!0,disabled:re,onClick:lt}),p?.[2]?.status&&e.jsx(o.Button,{icon:e.jsx(ce.EyeOutlined,{}),size:"small",onClick:_e})]})}}]:[]],He=l.useMemo(()=>i?Array.isArray(i?.data)?i.data:Array.isArray(i)?i:[]:[],[i]),Ue=l.useMemo(()=>{const N=V.trim().toLowerCase();return N?He.filter(G=>Object.values(G??{}).some(re=>String(re??"").toLowerCase().includes(N))):He},[He,V]),Ke=!!t.parentCallback,Be=V?Ue.length:i?.pagination?.total_rows??Ue.length,Oe=(x.page-1)*x.rowsPerPage,Fe=Ke?Ue:Ue.slice(Oe,Oe+x.rowsPerPage),ot=l.useMemo(()=>(Fe??[]).map((N,G)=>({...N??{},__serialNumber:Oe+G+1})),[Oe,Fe]),ae=Be===0?0:Math.min(Oe+1,Be),de=Be===0?0:Math.min(Oe+Fe.length,Be);let oe;return d?oe=e.jsx("p",{children:"Loading..."}):u?oe=e.jsx("p",{children:u.message}):Fe.length?oe=e.jsx(o.Table,{dataSource:ot,columns:Qe,size:"small",bordered:!0,pagination:!1,rowSelection:f,rowKey:(N,G)=>N?.id??N?._id??G,scroll:{x:"max-content"}}):oe=e.jsx(o.Empty,{}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx(o.Drawer,{open:h,placement:"right",onClose:()=>r?.(!1),width:720,children:je()}),e.jsx(o.Modal,{title:"Update Password",open:I,onCancel:()=>O(!1),footer:null,children:e.jsx("form",{onSubmit:ke,children:e.jsxs(ne,{children:[e.jsx(ne,{style:{marginBottom:12},children:e.jsx(z,{type:"password",label:"Password",name:"password",required:"required"})}),e.jsx(ne,{style:{marginTop:16},children:e.jsx(o.Button,{type:"primary",htmlType:"submit",children:"Update"})})]})})}),e.jsx(o.Modal,{title:" Update Credential",open:k,onCancel:()=>E(!1),footer:null,children:e.jsx("form",{onSubmit:rt,children:e.jsxs(ne,{children:[e.jsx(ne,{style:{marginBottom:12},children:e.jsx(z,{type:"text",label:"User Name",name:"username",required:"required",value:j?.username?j?.username:"",onChange:N=>g({...j,username:N.target.value})})}),e.jsx(ne,{style:{marginBottom:12},children:e.jsx(z,{label:"Password",name:"password",required:"required",value:j?.password?j?.password:"",onChange:N=>g({...j,password:N.target.value})})}),e.jsx(ne,{style:{marginTop:16},children:e.jsx(o.Button,{type:"primary",htmlType:"submit",children:"Update"})})]})})}),e.jsx(o.Modal,{open:C,onCancel:U,footer:null,centered:!0,width:"80%",className:T.modal,children:e.jsxs("div",{style:{position:"relative"},className:T.img,children:[e.jsx(o.Image,{src:_,alt:"",style:{width:"100%"},preview:!1}),e.jsx(o.Button,{type:"text",icon:e.jsx(ce.CloseOutlined,{}),onClick:U,style:{position:"absolute",top:8,right:8,background:"rgba(0,0,0,0.45)",color:"#fff"}})]})}),e.jsxs(o.Card,{bodyStyle:{padding:16,background:"#f7f7fa"},children:[e.jsx("style",{children:`
17
17
  .ubk-table-shell .ant-table-wrapper {
18
18
  background: #fff;
19
19
  border: 1px solid #e7e8f2;
@@ -56,4 +56,4 @@ Valid keys: `+JSON.stringify(Object.keys(f),null," "));var F=be(ne,K,q,ee,X+"."
56
56
  .ubk-table-shell .ant-pagination .ant-pagination-next button:hover {
57
57
  color: #8f99ff;
58
58
  }
59
- `}),t.jsx(oe,{children:t.jsx("div",{style:{display:"flex",justifyContent:"space-between"},children:t.jsx(io,{data:{tableRef:E}})})}),t.jsxs("div",{className:"ubk-table-shell",ref:E,style:{marginTop:12},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,flexWrap:"wrap",marginBottom:14},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"#222"},children:[t.jsx("span",{children:"Show"}),t.jsx(l.Select,{size:"small",value:f.rowsPerPage,onChange:V=>A(1,V),options:[10,25,50,100].map(V=>({label:V,value:V})),style:{width:72}}),t.jsx("span",{children:"entries"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("span",{style:{fontSize:12,color:"#222"},children:"Search:"}),t.jsx(l.Input,{size:"small",allowClear:!0,value:J,onChange:V=>{pe(V.target.value),y(Y=>({...Y,page:1}))},placeholder:"Enter search keyword",prefix:t.jsx(he.SearchOutlined,{style:{color:"#a3a8cf"}}),style:{width:220,borderWidth:"0 0 1px 0",borderRadius:0,background:"transparent"}})]})]}),t.jsx("div",{className:"print-only",children:t.jsx(lo,{})}),Me]}),o&&t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,marginTop:16,flexWrap:"wrap"},children:[t.jsx("div",{style:{fontSize:12,color:"#222"},children:`Showing ${tt} to ${Je} of ${Ae} entries`}),t.jsx(l.Pagination,{current:f.page,pageSize:f.rowsPerPage,total:Ae||0,showSizeChanger:!1,onChange:A})]})]})]})},po=({token:e,type:n})=>{const[r,a]=h.useState({page:1,rowsPerPage:10}),s="api/branchapi/frontoffice/enquirytablelist",o=s.includes("?")?s.endsWith("?")||s.endsWith("&")?"":"&":"?",i=`${s}${o}page=${r.page}&per_page=${r.rowsPerPage}`,{isLoading:c,data:x,error:p}=se(e?[i,e]:null,([P,C])=>le(P,C)),[d,b]=h.useState(!1),v=(P,C)=>{a({page:P,rowsPerPage:parseInt(C)})},S=async P=>{},g=P=>{console.log("dsdsdsdsd",P),b(P)},u=()=>{},m=[{key:"Edit",status:!0},{key:"Delete",status:!0},{key:"View",status:!1}],_=h.useMemo(()=>[{id:"1",name:"Name",selector:"name",sortable:!0,sorter:{compare:(P,C)=>P.name.localeCompare(C.name)}},{id:"2",name:"Phone",selector:"contact",sortable:!0,sorter:(P,C)=>(P.contact||"").localeCompare(C.contact||"")},{id:"6",name:"Description",selector:"description",sortable:!0,sorter:(P,C)=>(P.description||"").localeCompare(C.description||"")},{id:"3",name:"Source",selector:"source_name",sortable:!0,sorter:(P,C)=>(P.source_name||"").localeCompare(C.source_name||"")},{id:"4",name:"Enquiry Date",selector:"date",sortable:!0,sorter:(P,C)=>new Date(P.date)-new Date(C.date)},{id:"5",name:"Next Follow Up Date",selector:"follow_up_date",sortable:!0,sorter:(P,C)=>new Date(P.follow_up_date)-new Date(C.follow_up_date)}]);return t.jsx("div",{children:t.jsx(Xe,{parentCallback:v,data:{newData:x,columns:_,action:!0,Loading:c,error:p,open:d,viewDetails:u,deleteTodoMutation:S,DrawerUpdate:g,ActionView:m}})})},fo={minWidth:160,height:36,padding:"0 28px",border:"none",borderRadius:999,background:"linear-gradient(90deg, #f59b1c 0%, #ef3e7b 100%)",color:"#fff",fontSize:14,fontWeight:700,textTransform:"uppercase",cursor:"pointer",boxShadow:"none"},we=h.forwardRef(({error:e,success:n,disabled:r,style:a,...s},o)=>t.jsx("div",{className:"form-group",style:{marginBottom:0},children:t.jsx("input",{...s,ref:o,disabled:r,style:{...fo,opacity:r?.7:1,cursor:r?"not-allowed":"pointer",...a||{}}})})),ct=({id:e,funcName:n,disabled:r=!1})=>{const a="Data",[s,o]=h.useState(!1),i=()=>{o(!0),n(e),l.message.success(`${a} deleted successfully!`)},c=()=>{l.message.info(`Deletion of ${a} cancelled`)};return t.jsx(l.Popconfirm,{title:`Delete ${a}?`,description:`Are you sure you want to delete ${a}?`,onConfirm:i,onCancel:c,okText:"Yes",cancelText:"No",disabled:r||s,children:t.jsx(l.Button,{danger:!0,disabled:r,loading:s,icon:t.jsx(he.DeleteOutlined,{}),size:"small"})})},Et=e=>({optimisticData:n=>[...n.data,e],populateCache:(n,r)=>[...r.data,n]}),mt=e=>({optimisticData:n=>n.data.filter(r=>r.id!==e),populateCache:(n,r)=>r.data.filter(a=>a.id!==e)}),or={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function ho({token:e}){const[n,r]=h.useState({pagination:{current:1,pageSize:10}}),[a,s]=h.useState(!1),[o,i]=h.useState(null),c=`api/branchapi/Transport/routeTableList?page=${n.pagination.current}&per_page=${n.pagination.pageSize}`,x="api/branchapi/Transport/addroute",p="api/branchapi/Transport/editroute",d="api/branchapi/Transport/deleteroute",{isLoading:b,data:v,error:S,mutate:g}=se(e?[c,e]:null,([T,D])=>le(T,D)),u=async(T,D)=>{try{await g(We(T,D,e),Et(D)),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch{N.error("Failed to add the new item.",{duration:1e3})}},m=T=>{T.preventDefault();const D=new FormData(T.target);u(x,D),T.target.reset()},_=(T,D)=>{r(R=>({...R,pagination:{current:T,pageSize:parseInt(D,10)}}))},P=async T=>{try{await g(He(d,T,e),mt(T)),N.success("Success! Deleted item.",{duration:1e3})}catch{N.error("Failed to delete the item.",{duration:1e3})}},C=T=>{i(T),s(!0)},k=async T=>{try{await lt(p,T,e),await g(),N.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),i(null)}catch{N.error("Failed to update the item.",{duration:1e3})}},j=async T=>{T.preventDefault();const D=new FormData(T.target);D.append("id",o?.id),k(D)},Q=[{title:"Route Title",dataIndex:"route_title",key:"route_title",sorter:{compare:(T,D)=>T.name.localeCompare(D.route_title)}},{title:"Fare (Monthly)",dataIndex:"fare",key:"fare",sorter:{compare:(T,D)=>T.fare-D.fare}},{title:"Note",dataIndex:"note",key:"note",sorter:{compare:(T,D)=>T.note.localeCompare(D.note)}},{title:"Action",key:"action",render:(T,D)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.EditOutlined,{}),onClick:()=>C(D),style:{padding:2}}),t.jsx(ct,{id:D?.id,funcName:P})]})}],Z=o?.route_title?`Edit ${o.route_title}`:"Edit Route";return t.jsxs("div",{children:[t.jsx(l.Drawer,{open:a,title:Z,placement:"right",width:420,onClose:()=>{s(!1),i(null)},children:t.jsx("form",{onSubmit:j,children:t.jsxs("div",{style:{display:"grid",gap:20},children:[t.jsx(ae,{type:"text",name:"title",label:"Title",defaultValue:o?.route_title||"",required:"required"}),t.jsx(ae,{type:"number",name:"fare",label:"Fare (Monthly)",defaultValue:o?.fare||"",required:"required"}),t.jsx(ae,{type:"text",name:"note",label:"Note",defaultValue:o?.note||""}),t.jsx("div",{style:{display:"none"},children:t.jsx(ae,{type:"text",name:"no_of_vehicle",label:"Note"})}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Update",color:"primary"}),t.jsx(l.Button,{type:"text",onClick:()=>{s(!1),i(null)},style:or,children:"Cancel"})]})]})})}),t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(oe,{pt:5,pb:1,children:t.jsxs("div",{children:[t.jsx("div",{children:t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Add Route"})}),t.jsx(oe,{px:3,pb:2,children:t.jsx("form",{onSubmit:m,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx(ae,{type:"text",name:"title",label:"Title",placeholder:"Mumbai to Delhi",required:"required"}),t.jsx(ae,{type:"number",name:"fare",label:"Fare (Monthly)",required:"required"}),t.jsx(ae,{type:"text",name:"note",label:"Note"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Save",color:"primary"}),t.jsx(l.Button,{type:"text",htmlType:"reset",style:or,children:"Cancel"})]})]})})})]})}),t.jsx("div",{style:{marginTop:24},children:t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Route List"})}),t.jsx(oe,{children:t.jsx(Xe,{parentCallback:_,data:{newData:v,columns:Q,columnstype:"antd",action:!1,Loading:b,error:S,deleteTodoMutation:P}})})]})})]})})]})}const ir={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function mo({token:e}){const[n,r]=h.useState({page:1,rowsPerPage:10}),[a,s]=h.useState(!1),[o,i]=h.useState(null),c=`api/branchapi/Transport/vehiclesTableList?page=${n.page}&per_page=${n.rowsPerPage}`,x="api/branchapi/Transport/addvehicles",p="api/branchapi/Transport/editvehicle",d="api/branchapi/Transport/deletevehicle",{isLoading:b,data:v,error:S,mutate:g}=se(e?[c,e]:null,([T,D])=>le(T,D)),u=async(T,D)=>{try{await g(We(T,D,e),Et(D)),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch{N.error("Failed to add the new item.",{duration:1e3})}},m=T=>{T.preventDefault();const D=new FormData(T.target);u(x,D),T.target.reset()},_=async T=>{try{await g(He(d,T,e),mt(T)),N.success("Success! Deleted item.",{duration:1e3})}catch{N.error("Failed to delete the item.",{duration:1e3})}},P=T=>{i(T),s(!0)},C=async T=>{try{await lt(p,T,e),await g(),N.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),i(null)}catch{N.error("Failed to update the item.",{duration:1e3})}},k=async T=>{T.preventDefault();const D=new FormData(T.target);D.append("id",o?.id),C(D)},j=(T,D)=>{r({page:T,rowsPerPage:parseInt(D,10)})},Q=[{title:"Vehicle Number",dataIndex:"vehicle_no",key:"vehicle_no",sorter:{compare:(T,D)=>T.vehicle_no.localeCompare(D.vehicle_no)}},{title:"Vehicle Model",dataIndex:"vehicle_model",key:"vehicle_model",sorter:{compare:(T,D)=>T.vehicle_model.localeCompare(D.vehicle_model)}},{title:"Max Seating Capacity",dataIndex:"seating_capacity",key:"seating_capacity",sorter:{compare:(T,D)=>T.seating_capacity-D.seating_capacity}},{title:"Manufacture Year",dataIndex:"manufacture_year",key:"manufacture_year",sorter:{compare:(T,D)=>T.manufacture_year-D.manufacture_year}},{title:"Gps Url",key:"gps_url",sorter:{compare:(T,D)=>T.gps_url.localeCompare(D.gps_url)},render:(T,D)=>t.jsx("span",{title:D?.gps_url??"",style:{display:"inline-block",maxWidth:220,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:D?.gps_url})},{title:"Note",dataIndex:"note",key:"note",sorter:{compare:(T,D)=>T.note.localeCompare(D.note)}},{title:"Action",key:"action",render:(T,D)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.EditOutlined,{}),onClick:()=>P(D),style:{padding:2}}),t.jsx(ct,{id:D?.id,funcName:_})]})}],Z=o?.vehicle_no?`Edit ${o.vehicle_no}`:"Edit Vehicle";return t.jsxs("div",{children:[t.jsx(l.Drawer,{open:a,title:Z,placement:"right",width:420,onClose:()=>{s(!1),i(null)},children:t.jsx("form",{onSubmit:k,children:t.jsxs("div",{style:{display:"grid",gap:20},children:[t.jsx(ae,{type:"text",name:"number",label:"Vehicle Number",defaultValue:o?.vehicle_no||"",required:"required"}),t.jsx(ae,{type:"text",name:"model",label:"Vehicle Model",defaultValue:o?.vehicle_model||""}),t.jsx(ae,{type:"number",name:"manufacture_year",label:"Manufacture Year",defaultValue:o?.manufacture_year||""}),t.jsx(ae,{type:"number",name:"seating_capacity",label:"Max Seating Capacity",defaultValue:o?.seating_capacity||""}),t.jsx(ae,{type:"text",name:"gps_url",label:"Gps Url",defaultValue:o?.gps_url||""}),t.jsx(ae,{type:"text",name:"note",label:"Note",defaultValue:o?.note||""}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Update",color:"primary"}),t.jsx(l.Button,{type:"text",onClick:()=>{s(!1),i(null)},style:ir,children:"Cancel"})]})]})})}),t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(oe,{pt:5,pb:1,children:t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Add Vehicle"})}),t.jsx(oe,{px:3,pb:2,children:t.jsx("form",{onSubmit:m,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx(ae,{type:"text",name:"number",label:"Vehicle Number",required:"required"}),t.jsx(ae,{type:"text",name:"model",label:"Vehicle Model"}),t.jsx(ae,{type:"number",name:"manufacture_year",label:"Manufacture Year"}),t.jsx(ae,{type:"number",name:"seating_capacity",label:"Max Seating Capacity"}),t.jsx(ae,{type:"text",name:"gps_url",label:"Gps Url"}),t.jsx(ae,{type:"text",name:"note",label:"Note"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Save",color:"primary"}),t.jsx(l.Button,{type:"text",htmlType:"reset",style:ir,children:"Cancel"})]})]})})})]}),t.jsx("div",{style:{marginTop:24},children:t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Vehicle List"})}),t.jsx(oe,{children:t.jsx(Xe,{parentCallback:j,data:{newData:v,columns:Q,columnstype:"antd",action:!1,Loading:b,error:S,deleteTodoMutation:_}})})]})})]})})]})}var yo=Yr();const ln=Vr(yo),Jr=()=>{};class Cn extends h.Component{state={value:this.props.value||this.props.defaultValue||""};selectRef=null;setSelectRef=n=>{this.selectRef=n};componentDidUpdate(n){n.value!==this.props.value&&this.setState({value:this.props.value})}onChange=(n,r)=>{this.props.onChange(n,r),this.setState({value:n})};getValue=()=>{const{value:n}=this.state;return n?Array.isArray(n)?n.length?"valid":"":typeof n=="object"?n.value||"":n:""};render(){const{SelectComponent:n,required:r,...a}=this.props;console.log("sdsdsfsdddddddd",{...a});const{isDisabled:s}=this.props,o=!s;return t.jsxs("div",{children:[t.jsx(n,{...a,ref:this.setSelectRef,onChange:this.onChange}),o&&t.jsx("input",{tabIndex:-1,autoComplete:"off",style:{opacity:0,width:"100%",height:0,display:"block"},value:this.getValue(),onChange:Jr,onFocus:()=>this.selectRef.focus(),required:r})]})}}Cn.defaultProps={onChange:Jr};Cn.protoTypes={selectComponent:ln.func.isRequired,onChange:ln.func,required:ln.bool};const go={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},bo={menuPortal:e=>({...e,zIndex:9999}),control:(e,n)=>({...e,minHeight:40,height:40,fontSize:"14px",border:"none",borderBottom:`1px solid ${n.isFocused?"#222":"#d9d9d9"}`,borderRadius:0,boxShadow:"none",backgroundColor:"transparent",transition:"border-color 0.2s ease","&:hover":{border:"none",borderBottom:`1px solid ${n.isFocused?"#222":"#a8a8a8"}`}}),valueContainer:e=>({...e,height:40,padding:"0 0",display:"flex",alignItems:"center"}),input:e=>({...e,margin:0,padding:0}),indicatorSeparator:()=>({display:"none"}),indicatorsContainer:e=>({...e,height:40}),dropdownIndicator:(e,n)=>({...e,padding:"0 0 0 8px",color:n.isFocused?"#222":"#b5b5b5"}),singleValue:e=>({...e,color:"#222",marginLeft:0}),placeholder:e=>({...e,color:"#9f9f9f",marginLeft:0}),option:(e,n)=>({...e,fontSize:"14px",backgroundColor:n.isFocused?"#f8f8f8":"#fff",color:"#222",cursor:"pointer"})},Xr=e=>t.jsx(Sr.components.Input,{...e,className:"input-cont",required:!!e?.selectProps?.required}),xo=e=>t.jsx(Cn,{...e,SelectComponent:Sr,components:{Input:Xr},options:e.options}),fe=h.forwardRef(({...e},n)=>t.jsxs("div",{className:"form-group",style:{height:"auto"},children:[e.label&&t.jsx("label",{className:"labelfont",style:go,children:e?.label}),t.jsx(xo,{components:{Input:Xr},menuPortalTarget:document.body,styles:bo,className:"input-cont",...e,ref:n})]})),So={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},lr=({dataIndex:e,title:n,record:r,children:a,isEditable:s,...o})=>t.jsx("td",{...o,children:s?t.jsx("div",{style:{display:"flex",marginLeft:"5%"},children:a}):a});function wo({token:e}){const[n,r]=h.useState(!1),[a,s]=h.useState({pagination:{current:1,pageSize:50}}),[o,i]=h.useState(null),[c,x]=h.useState([]),p="api/branchapi/Transport/getrouteDropdown",d="api/branchapi/Transport/getvehicleDropdown",b="api/branchapi/Transport/getchechkedVehicleData",v="api/branchapi/Transport/assignedVehicleTable",S="api/branchapi/transport/assignvehicle",g="api/branchapi/Transport/deleteassignvehicle",u=o?`${b}?route_id=${o}`:null,{isLoading:m,data:_,mutate:P}=se(e?[`${v}?page=${a.pagination.current}&per_page=${a.pagination.pageSize}`,e]:null,([y,E])=>le(y,E)),{data:C}=se(e&&p?[p,e]:null,([y,E])=>le(y,E)),{data:k}=se(e&&d?[d,e]:null,([y,E])=>le(y,E)),j=e&&u?[u,e]:null,{isLoading:Q,data:Z}=se(j,([y,E])=>le(y,E)),{Status:T="Failed",pagination:{total_rows:D=0}={}}=_||{},{data:R=[]}=T==="Success"?_:{},U=h.useMemo(()=>{const y=C?.data??C??[];return Array.isArray(y)?y:[]},[C]),I=h.useMemo(()=>{const y=k?.data??k??[];return(Array.isArray(y)?y:[]).map(A=>{if(A==null)return null;if(typeof A=="string"||typeof A=="number")return{label:String(A),value:A};const q=A.value??A.vehicle_id??A.id??A.vehicleID,ee=A.label??A.vehicle_name??A.vehicle_no??A.vehicle_number??A.name??String(q??"");return q==null||ee===""?null:{label:String(ee),value:q}}).filter(Boolean)},[k]),H=h.useMemo(()=>{const y=Z?.data??Z??[];return(Array.isArray(y)?y:[]).map(A=>A?.value??A?.vehicle_id??A?.id??A).filter(A=>A!=null)},[Z]);h.useEffect(()=>{x(H)},[H,n]);const J=async(y,E,A)=>{try{await P(We(y,E,e),Et(E)),u&&se.mutate(j),r(q=>!q),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch(q){N.error(q?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},pe=y=>{y.preventDefault();const E=new FormData;E.append("route_id",o??""),c.length?c.forEach(A=>E.append("vehicle_ids[]",A)):E.append("vehicle_ids[]",""),J(S,E)},M=y=>{s(E=>({...E,pagination:{current:y,pageSize:E.pagination.pageSize}}))},z=async y=>{try{await P(He(g,y,e),mt(y)),u&&se.mutate(j),N.success("Success! Deleted item.",{duration:1e3})}catch{N.error("Failed to delete the item.",{duration:1e3})}},ce=[{title:"Route",dataIndex:"route_title"},{title:"Vehicle Numbers",render:(y,E,A)=>t.jsx(t.Fragment,{children:E.children.map((q,ee,X)=>t.jsx("span",{children:`${q.vehicle_name} ${ee+1===X.length?"":","}`},`${ee}vehicle001`))})},{title:"Action",render:(y,E,A)=>t.jsx(t.Fragment,{children:t.jsx(ct,{id:E?.route_id,funcName:z})})}],W=y=>{const E=["route_id","index"];for(let A=0;A<E.length;A++)if(y[E[A]])return y[E[A]]},f=y=>{const{children:E=[]}=y||{},A=[{title:"Vehicle Name",dataIndex:"vehicle_name",onCell:q=>({isEditable:!0})},{title:"Driver Name",dataIndex:"driver_name",onCell:q=>({isEditable:!0})},{title:"Driver Contact",dataIndex:"driver_contact_number",onCell:q=>({isEditable:!0})},{title:"Driver Licence",dataIndex:"Driver_licence",onCell:q=>({isEditable:!0})},{title:"Start Time",dataIndex:"start_time",onCell:q=>({isEditable:!0})},{title:"Drop Time",dataIndex:"drop_time",onCell:q=>({isEditable:!0})},{title:"Type",dataIndex:"type",onCell:q=>({isEditable:!0})}];return t.jsx("div",{style:{display:"flex",justifyContent:"center"},children:t.jsx("div",{style:{width:"95%",margin:8},children:t.jsx(l.Table,{components:{body:{cell:lr}},expandable:{childrenColumnName:"changed"},bordered:!0,size:"small",columns:A,rowKey:q=>W(q)+"cell01",dataSource:E,pagination:!1})})})};return t.jsxs("div",{children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(oe,{pt:5,pb:1,children:t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Assign Vehicle"})}),t.jsx(oe,{px:3,pb:2,children:t.jsx("form",{onSubmit:pe,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(220px, 320px) 1fr auto",gap:20,alignItems:"end"},children:[t.jsx("div",{children:t.jsx(fe,{options:U,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",required:!0,allowSelectAll:!1,onChange:y=>{i(y?.value??null),r(E=>!E)}})}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:{display:"block",marginBottom:6,fontSize:14,fontWeight:500,color:"#222"},children:"Vehicles"}),t.jsx("div",{style:{borderBottom:"1px solid #d9d9d9",paddingBottom:8,maxHeight:140,overflow:"auto"},children:t.jsx(l.Checkbox.Group,{style:{display:"flex",flexWrap:"wrap",gap:12},options:I,value:c,onChange:y=>x(y),disabled:!o||Q})},`check001${n}`)]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Save",color:"primary"}),t.jsx(l.Button,{type:"text",htmlType:"button",onClick:()=>{i(null),x([]),r(y=>!y)},style:So,children:"Cancel"})]})]})})})]}),t.jsx("div",{style:{marginTop:24},children:t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Vehicle List"})}),t.jsx(oe,{style:{padding:"10px 16px"},children:t.jsx(l.Table,{components:{body:{cell:lr}},columns:ce,bordered:!0,rowKey:y=>W(y),dataSource:Array.isArray(R)?R:[],loading:m,expandable:{expandedRowRender:f,childrenColumnName:"changed"},pagination:{current:a.pagination.current,pageSize:a.pagination.pageSize,total:D,showSizeChanger:!0,onChange:M,onShowSizeChange:(y,E)=>{s(A=>({...A,pagination:{current:1,pageSize:E}}))},showTotal:(y,E)=>`${E[0]}-${E[1]} of ${y} items`}})})]})})]})})]})}const jo={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},vo={width:"100%",height:"40px",background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"},_o=(e,n,r)=>n?e>ge(r).endOf("day")||e<ge(n).endOf("day"):!1,Gr=h.forwardRef(function(n,r){const{...a}=n;return t.jsxs("div",{className:"form-group",children:[a.Desplay&&t.jsx("label",{className:`labelfont ${a.classnme?a.classnme:""}`,style:jo,children:a.Desplay}),t.jsx(l.DatePicker,{...a,style:{...vo,...a.style||{}},className:"form-group",disabledDate:s=>_o(s,a.sessionStart||a.minDate?.subtract(1,"day").format("YYYY-MM-DD"),a.sessionEnd||a.maxDate?.format("YYYY-MM-DD")),required:!0,ref:r})]})}),cr={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},cn=e=>{const n=e?.data??e??[];return Array.isArray(n)?n:[]},dn=(e,n,r)=>{if(n==null||n==="")return null;const a=e.find(s=>String(s.value)===String(n));return a||(r?{label:String(r),value:n}:{label:String(n),value:n})},Co=()=>{try{return JSON.parse(localStorage.getItem("genrall_settings")||"{}")?.currency_symbol??""}catch{return""}},To=e=>{if(e==null||e===""||e==="null"||e==="undefined")return"";if(Array.isArray(e))return e.filter(r=>r!=null&&r!==""&&String(r).toLowerCase()!=="null"&&String(r).toLowerCase()!=="undefined").join(", ");const n=String(e).trim();return!n||n.toLowerCase()==="null"||n.toLowerCase()==="undefined"?"":n};function Ro({token:e,assignmentId:n,studentName:r,onClose:a,onSuccess:s}){const o="api/branchapi/Transport/showRouteAssignStudent",i="api/branchapi/Transport/updateTransportRoutesStudent",c="api/branchapi/Transport/getrouteDropdown",x="api/branchapi/Transport/getvehicleListByRouteIdwithCount",p="api/branchapi/Transport/getStoppageDropdown",d="api/branchapi/Transport/routeShowdata",[b,v]=h.useState(null),[S,g]=h.useState(0),[u,m]=h.useState(0),{data:_,isLoading:P}=se(e&&n?[`${o}?id=${n}`,e]:null,([O,$])=>le(O,$)),C=h.useMemo(()=>{if(!_||_?.Status&&_.Status!=="Success")return null;const O=_?.data??_;return Array.isArray(O)?O[0]??null:O},[_]);h.useEffect(()=>{const O=C?.fk_route_id??C?.route_id;O!=null&&v(O)},[C]);const k=e&&b?`${x}?route_id=${b}`:null,j=e&&b?`${d}?id=${b}`:null,Q=e&&b?`${p}?route_id=${b}`:null,{data:Z}=se(e&&c?[c,e]:null,([O,$])=>le(O,$)),{data:T,isLoading:D}=se(k?[k,e]:null,([O,$])=>le(O,$)),{data:R,isLoading:U}=se(Q?[Q,e]:null,([O,$])=>le(O,$)),{data:I}=se(j?[j,e]:null,([O,$])=>le(O,$)),H=h.useMemo(()=>cn(Z),[Z]),J=h.useMemo(()=>cn(T),[T]),pe=h.useMemo(()=>cn(R),[R]),M=I?.data?.[0]?.fare??C?.fare??C?.rootCost??C?.rootcost,z=Co(),ce=r||[C?.firstname,C?.lastname].filter(Boolean).join(" ")||"",W=(O,$)=>{switch($){case"route_id":v(O?.value??null),g(K=>K+1),m(K=>K+1);break;case"vehicle_id":m(K=>K+1);break}},f=async O=>{O.preventDefault();const $=new FormData(O.target);$.append("id",n);try{await lt(i,$,e),N.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s?.(),a?.()}catch(K){N.error(K?.message??"Failed to update the item.",{duration:1e3})}};if(P||!(C&&!P&&(!b||!D&&!U)))return t.jsx("div",{style:{display:"flex",justifyContent:"center",padding:48},children:t.jsx(l.Spin,{})});if(!C)return t.jsxs("div",{style:{padding:"8px 0"},children:[t.jsx("p",{style:{color:"#666",fontSize:14,marginBottom:16},children:"Unable to load assignment details. Please try again."}),t.jsx(l.Button,{type:"text",onClick:a,style:cr,children:"Close"})]});const E=C.fk_route_id??C.route_id,A=dn(H,E,C.route_title),q=dn(J,C.vehicle_id,C.vehicle_name??C.vehicle_no),ee=dn(pe,C.stop_id,C.stop_name??C.stoppage_name),X=C.start_date?ge(C.start_date):ge(),ne=To(C?.service_push);return t.jsx("form",{onSubmit:f,children:t.jsxs("div",{style:{display:"grid",gap:20},children:[t.jsx(ae,{type:"text",name:"title",label:"Student",defaultValue:ce,readOnly:!0}),t.jsx("input",{type:"hidden",name:"student_id",value:C.fk_student_id??C.student_id??""}),t.jsx(fe,{options:H,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"fk_route_id",required:!0,allowSelectAll:!1,defaultValue:A,onChange:O=>W(O,"route_id")}),t.jsx(fe,{options:J,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",required:!0,allowSelectAll:!1,defaultValue:q,onChange:O=>W(O,"vehicle_id")},`edit-vehicle-${S}`),t.jsx(fe,{options:pe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Stop",name:"stop_id",required:!0,allowSelectAll:!1,defaultValue:ee},`edit-stop-${u}`),t.jsx(ae,{type:"text",label:"Route Cost",value:M!=null?`${z}${M}`:"",readOnly:!0}),t.jsx("input",{type:"hidden",name:"rootCost",value:M??""}),t.jsx(Gr,{defaultValue:X,Desplay:"Start Date",name:"start_date",placement:"bottomRight",format:"YYYY-MM-DD",allowClear:!1}),t.jsx(ae,{type:"text",name:"puse_service",label:"Pause Service",defaultValue:ne,placeholder:"e.g. 01, 02, 03"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginTop:4},children:[t.jsx(we,{type:"submit",value:"Update",color:"primary"}),t.jsx(l.Button,{type:"text",onClick:a,style:cr,children:"Cancel"})]})]})},`edit-${n}-${S}`)}const dr={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},jt=e=>{const n=e?.data??e??[];return Array.isArray(n)?n:[]},Oo=e=>e||"",Eo=()=>{try{return JSON.parse(localStorage.getItem("genrall_settings")||"{}")?.currency_symbol??""}catch{return""}},Do=e=>{const n=String(e??"Drawer").trim().toLowerCase().replace(/\s+/g,"");return n==="page"||n==="sendpage"?"page":"drawer"},Ao=(e,n)=>{const r=n||"/TransportDashboard/EditAssignStudentTransport?id={id}",a=e?.id??"",s=encodeURIComponent(String(a));if(r.includes("{id}"))return r.replaceAll("{id}",s);if(r.includes(":id"))return r.replace(":id",s);try{const i=new URL(r,"http://localhost");if(i.searchParams.has("id"))return i.searchParams.set("id",String(a)),`${i.pathname}${i.search}${i.hash}`}catch{}const o=r.includes("?")?"&":"?";return`${r}${o}id=${s}`};function Po({token:e,editType:n,onNavigate:r,editPagePath:a}){const o=Do(n)==="drawer",i="api/branchapi/academy/classdropdownlist",c="api/branchapi/academy/sectionoftheClass",x="api/branchapi/Transport/routeStudentList",p="api/branchapi/Transport/getrouteDropdown",d="api/branchapi/Transport/getvehicleListByRouteIdwithCount",b="api/branchapi/Transport/getStoppageDropdown",v="api/branchapi/Transport/routeShowdata",S="api/branchapi/Transport/assignTransportRoutesStudent",g="api/branchapi/transport/removeStudentTransport",[u,m]=h.useState(null),[_,P]=h.useState(!1),[C,k]=h.useState(!1),[j,Q]=h.useState(null),[Z,T]=h.useState(null),[D,R]=h.useState(null),[U,I]=h.useState(null),[H,J]=h.useState(!1),[pe,M]=h.useState(!1),[z,ce]=h.useState({page:1,rowsPerPage:50}),[W,f]=h.useState(null),[y,E]=h.useState(!1),[A,q]=h.useState(null),[ee,X]=h.useState(null),ne=(G,ie)=>{switch(ie){case"class_id":f(`${c}?class_id=${G.value}`),P(Pe=>!Pe);break;case"route_id":T(`${d}?route_id=${G.value}`),R(`${v}?id=${G.value}`),X(G.value),J(Pe=>!Pe);break;case"vehicle_id":I(`${b}?route_id=${ee}`),M(Pe=>!Pe);break}},O=G=>{if(o){Q(G),k(!0);return}const ie=Ao(G,a);if(typeof r=="function"){r(ie,G);return}typeof window<"u"&&ie&&window.location.assign(ie)},$=()=>{k(!1),Q(null)},K=j?`Edit — ${j.firstname??""} ${j.lastname??""}`.trim():"Edit Student Transport",{data:be}=se(e&&i?[i,e]:null,([G,ie])=>le(G,ie)),{data:F}=se(e&&W?[W,e]:null,([G,ie])=>le(G,ie)),{data:je}=se(e&&Z?[Z,e]:null,([G,ie])=>le(G,ie)),{data:Re}=se(e&&U?[U,e]:null,([G,ie])=>le(G,ie)),{data:ze}=se(e&&D?[D,e]:null,([G,ie])=>le(G,ie)),{data:Ge}=se(e&&p?[p,e]:null,([G,ie])=>le(G,ie)),Qe=e&&u?`${u}&page=${z.page}&per_page=${z.rowsPerPage}`:null,{isLoading:Ye,error:$e,data:Be,mutate:Le}=se(Qe?[Qe,e]:null,([G,ie])=>le(G,ie)),Ae=h.useMemo(()=>jt(be),[be]),_e=h.useMemo(()=>jt(F),[F]),Ee=h.useMemo(()=>jt(je),[je]),Ke=h.useMemo(()=>jt(Re),[Re]),tt=h.useMemo(()=>jt(Ge),[Ge]),Je=ze?.data?.[0]?.fare,Me=async G=>{try{await Le(He(g,G,e),mt(G)),N.success("Success! Deleted item.",{duration:1e3})}catch{N.error("Failed to delete the item.",{duration:1e3})}},V=[{title:"Route Status",key:"route_status",render:(G,ie)=>ie.fk_route_id?t.jsx("span",{children:ie.route_title}):t.jsx("span",{children:"Not Assigned"})},{title:"Vehicle Assign Date",dataIndex:"start_date",key:"start_date",render:(G,ie)=>Oo(ie.start_date)},{title:"Admission No",dataIndex:"admission_no",key:"admission_no"},{title:"Roll No",dataIndex:"roll_no",key:"roll_no"},{title:"Name",key:"name",render:(G,ie)=>`${ie.firstname} ${ie.lastname}`},{title:"Class",dataIndex:"class",key:"class"},{title:"Section",dataIndex:"section",key:"section"},{title:"Mobileno",dataIndex:"mobileno",key:"mobileno"},{title:"Action",key:"action",render:(G,ie)=>t.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:ie.fk_route_id?t.jsxs(t.Fragment,{children:[t.jsx(ct,{id:ie?.id,funcName:Me}),t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.EditOutlined,{}),onClick:()=>O(ie),style:{padding:2}})]}):t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.PlusOutlined,{}),onClick:()=>xe(ie.student_id),style:{padding:2}})})}],Y=async(G,ie)=>{try{await Le(We(G,ie,e),Et(ie)),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),E(!1),rt()}catch{N.error("Failed to add the new item.",{duration:1e3})}},de=G=>{G.preventDefault();const ie=G?.target?.class_id?.value,Pe=G?.target?.section_id?.value;m(`${x}?cID=${ie}&sID=${Pe}`),ce(B=>({...B,page:1}))},Te=(G,ie)=>{ce({page:G,rowsPerPage:parseInt(ie,10)})},xe=G=>{q(G),E(!0)},nt=G=>{G.preventDefault();const ie=new FormData(G.target);Y(S,ie)},rt=()=>{E(!1),T(null),R(null),I(null),X(null)},yt=Eo();return t.jsxs("div",{children:[o&&t.jsx(l.Drawer,{open:C,title:K,placement:"right",width:420,destroyOnClose:!0,onClose:$,children:j?.id&&t.jsx(Ro,{token:e,assignmentId:j.id,studentName:`${j.firstname??""} ${j.lastname??""}`.trim(),onClose:$,onSuccess:()=>Le()})}),t.jsx(l.Modal,{open:y,title:"Assign Student to Transport",onCancel:rt,footer:null,width:640,destroyOnClose:!0,children:t.jsx("form",{onSubmit:nt,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20},children:[t.jsx(fe,{options:tt,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"fk_route_id",required:!0,allowSelectAll:!1,onChange:G=>ne(G,"route_id")}),t.jsx(fe,{options:Ee,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",required:!0,allowSelectAll:!1,onChange:G=>ne(G,"vehicle_id")},`vehicle001${H}`),t.jsx(fe,{options:Ke,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Stop",name:"stop_id",required:!0,allowSelectAll:!1},`stop001${pe}`),t.jsx(Gr,{defaultValue:ge(),Desplay:"Start Date",name:"start_date",placement:"bottomRight",format:"YYYY-MM-DD"}),t.jsx("input",{type:"hidden",value:A??"",name:"student_id"}),t.jsx(ae,{className:"noDisplay",type:"text",name:"rootCost",value:Je??""}),t.jsxs("div",{style:{gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:Je!=null?`${yt}${Je} — Assign`:"Assign",color:"primary"}),t.jsx(l.Button,{type:"text",onClick:rt,style:dr,children:"Cancel"})]})]})})}),t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(oe,{pt:5,pb:1,children:t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Search Students"})}),t.jsx(oe,{px:3,pb:2,children:t.jsx("form",{onSubmit:de,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx(fe,{options:Ae,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",onChange:G=>ne(G,"class_id"),name:"class_id",required:!0,allowSelectAll:!1}),t.jsx(fe,{options:_e,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",allowSelectAll:!1,name:"section_id",required:!0},`section1${_}`),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Search",color:"primary"}),t.jsx(l.Button,{type:"text",htmlType:"button",onClick:()=>{m(null),f(null),P(G=>!G)},style:dr,children:"Cancel"})]})]})})})]}),u&&t.jsx("div",{style:{marginTop:24},children:t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Student List"})}),t.jsx(oe,{children:t.jsx(Xe,{parentCallback:Te,data:{newData:Be,columns:V,columnstype:"antd",action:!1,Loading:Ye,error:$e,deleteTodoMutation:Me,pageController:z}})})]})})]})})]})}const ur={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},kt={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"};function ko({token:e}){const[n,r]=h.useState({page:1,rowsPerPage:50}),[a,s]=h.useState(!1),[o,i]=h.useState(null),[c,x]=h.useState(""),[p,d]=h.useState(""),[b,v]=h.useState(""),[S,g]=h.useState(!1),u=`api/branchapi/Transport/getdriverTable?page=${n.page}&per_page=${n.rowsPerPage}`,m="api/branchapi/Transport/add_driver",_="api/branchapi/Transport/edit_driver",P="api/branchapi/Transport/deletedriver",C="api/branchapi/staff/uploadDocuments",k=h.useMemo(()=>String(C).startsWith("http")?C:`${vt()??""}${String(C).replace(/^\/+/,"")}`,[C]),j=vt()??"",{isLoading:Q,data:Z,error:T,mutate:D}=se(e?[u,e]:null,([W,f])=>le(W,f)),R=async(W,f)=>{try{await We(W,f,e),await D(),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),x("")}catch(y){N.error(y?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},U=W=>{W.preventDefault();const f=new FormData(W.target);R(m,f),W.target.reset()},I=async W=>{try{await D(He(P,W,e),mt(W)),N.success("Success! Deleted item.",{duration:1e3})}catch{N.error("Failed to delete the item.",{duration:1e3})}},H=W=>{i(W),x(W?.image??""),s(!0)},J=async W=>{try{await lt(_,W,e),await D(),N.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),i(null),x("")}catch(f){N.error(f?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},pe=W=>{W.preventDefault();const f=new FormData(W.target);f.append("id",o?.id??""),J(f)},M=(W,f)=>{r({page:W,rowsPerPage:parseInt(f,10)})},z=[{title:"Driver Name",dataIndex:"name",key:"name",sorter:{compare:(W,f)=>String(W?.name??"").localeCompare(String(f?.name??""))}},{title:"Driver Licence",dataIndex:"Driver_licence",key:"Driver_licence",sorter:{compare:(W,f)=>String(W?.Driver_licence??"").localeCompare(String(f?.Driver_licence??""))}},{title:"Contact",dataIndex:"contact_number",key:"contact_number",sorter:{compare:(W,f)=>Number(W?.contact_number??0)-Number(f?.contact_number??0)}},{title:"Address",dataIndex:"address",key:"address",sorter:{compare:(W,f)=>String(W?.address??"").localeCompare(String(f?.address??""))}},{title:"Image",key:"image",width:100,render:(W,f)=>{const y=f?.image?`${j}staff/document/${f.image}`:"";return y?t.jsx("div",{style:{display:"flex",justifyContent:"center"},children:t.jsx(l.Image,{width:80,src:y,preview:{visible:!1,onVisibleChange:()=>{g(!0),d(y),v(f?.name??"Driver")}}})}):null}},{title:"Action",key:"action",render:(W,f)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.EditOutlined,{}),onClick:()=>H(f),style:{padding:2}}),t.jsx(ct,{id:f?.id,funcName:I})]})}],ce=o?.name?`Edit ${o.name}`:"Edit Driver";return t.jsxs("div",{children:[t.jsx(l.Drawer,{open:a,title:ce,placement:"right",width:420,destroyOnClose:!0,onClose:()=>{s(!1),i(null),x("")},children:t.jsx("form",{onSubmit:pe,children:t.jsxs("div",{style:{display:"grid",gap:20},children:[t.jsx(ae,{type:"text",name:"name",label:"Driver Name",defaultValue:o?.name??"",required:"required"}),t.jsx(ae,{type:"text",name:"Driver_licence",label:"Driver Licence",defaultValue:o?.Driver_licence??"",required:"required"}),t.jsx(ae,{type:"number",name:"contact_number",label:"Driver Contact",defaultValue:o?.contact_number??"",required:"required"}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:kt,children:"Address"}),t.jsx(l.Input.TextArea,{name:"address",defaultValue:o?.address??"",rows:2,style:{width:"100%",border:0,borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none",paddingLeft:0,paddingRight:0}})]}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:kt,children:"Image"}),t.jsx(l.Upload,{maxCount:1,action:k,headers:e?{Authorization:e}:void 0,onChange:W=>{if(W?.file?.status!=="done")return;const f=W?.file?.response,y=f?.data??f?.filename??f?.file??f?.path??"";y&&x(String(y))},children:t.jsx(l.Button,{icon:t.jsx(he.UploadOutlined,{}),disabled:!k,children:"Upload"})}),t.jsx("input",{type:"hidden",name:"file",value:c})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Update",color:"primary"}),t.jsx(l.Button,{type:"text",onClick:()=>{s(!1),i(null),x("")},style:ur,children:"Cancel"})]})]})})}),t.jsx(l.Modal,{zIndex:9999,open:S,title:b,footer:null,onCancel:()=>g(!1),children:t.jsx("img",{alt:"preview",style:{width:"100%"},src:p})}),t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(oe,{pt:5,pb:1,children:t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Add Driver"})}),t.jsx(oe,{px:3,pb:2,children:t.jsx("form",{onSubmit:U,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx(ae,{type:"text",name:"name",label:"Driver Name",required:"required"}),t.jsx(ae,{type:"text",name:"Driver_licence",label:"Driver Licence",required:"required"}),t.jsx(ae,{type:"number",name:"contact_number",label:"Driver Contact",required:"required"}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:kt,children:"Address"}),t.jsx(l.Input.TextArea,{name:"address",rows:2,style:{width:"100%",border:0,borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none",paddingLeft:0,paddingRight:0}})]}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:kt,children:"Image"}),t.jsx(l.Upload,{maxCount:1,action:k,headers:e?{Authorization:e}:void 0,onChange:W=>{if(W?.file?.status!=="done")return;const f=W?.file?.response,y=f?.data??f?.filename??f?.file??f?.path??"";y&&x(String(y))},children:t.jsx(l.Button,{icon:t.jsx(he.UploadOutlined,{}),disabled:!k,children:"Upload"})}),t.jsx("input",{type:"hidden",name:"file",value:c})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Save",color:"primary"}),t.jsx(l.Button,{type:"text",htmlType:"reset",onClick:()=>x(""),style:ur,children:"Cancel"})]})]})})})]}),t.jsx("div",{style:{marginTop:24},children:t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Driver List"})}),t.jsx(oe,{children:t.jsx(Xe,{parentCallback:M,data:{newData:Z,columns:z,columnstype:"antd",action:!1,Loading:Q,error:T,deleteTodoMutation:I}})})]})})]})})]})}const pr={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},pt={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},It={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"},fr=[{label:"Pick",value:"pick"},{label:"Drop",value:"drop"}],Mt=e=>{const n=e?.data??e??[];return Array.isArray(n)?n:[]};function Io({token:e}){const[n,r]=h.useState({page:1,rowsPerPage:50}),[a,s]=h.useState(!1),[o,i]=h.useState(!1),[c,x]=h.useState(null),[p,d]=h.useState(null),[b,v]=h.useState(null),[S,g]=h.useState(null),[u,m]=h.useState(ge()),[_,P]=h.useState(ge()),[C,k]=h.useState("pick"),[j,Q]=h.useState(!1),[Z,T]=h.useState(null),[D,R]=h.useState(null),[U,I]=h.useState(!1),[H,J]=h.useState(null),[pe,M]=h.useState(null),[z,ce]=h.useState(null),[W,f]=h.useState(null),[y,E]=h.useState(ge()),[A,q]=h.useState(ge()),[ee,X]=h.useState("pick"),ne=`api/branchapi/Transport/assignRouteTimeList?page=${n.page}&per_page=${n.rowsPerPage}`,O="api/branchapi/Transport/assignRouteTime",$="api/branchapi/Transport/editAssignRouteTime",K="api/branchapi/Transport/deleteAssignRouteTime",be="api/branchapi/Transport/driverDropdown",F="api/branchapi/transport/routeTimetableShowdata",je="api/branchapi/Transport/getrouteDropdown",Re="api/branchapi/Transport/getvehicleDropdown",{isLoading:ze,data:Ge,error:Qe,mutate:Ye}=se(e?[ne,e]:null,([B,te])=>le(B,te)),{data:$e}=se(e&&je?[je,e]:null,([B,te])=>le(B,te)),{data:Be}=se(e&&be?[be,e]:null,([B,te])=>le(B,te)),Le=h.useMemo(()=>c?`${Re}?route_id=${c}`:null,[c,Re]),{data:Ae}=se(e&&Le?[Le,e]:null,([B,te])=>le(B,te)),_e=h.useMemo(()=>Mt($e),[$e]),Ee=h.useMemo(()=>Mt(Be),[Be]),Ke=h.useMemo(()=>Mt(Ae),[Ae]),tt=(B,te)=>{r({page:B,rowsPerPage:parseInt(te,10)})},Je=async B=>{B.preventDefault();const te=new FormData(B.target);te.set("route_id",p?.value??c??""),te.set("driver_id",b?.value??""),te.set("vehicle_id",S?.value??""),te.set("start_time",u?u.format("h:mm a"):""),te.set("drop_time",_?_.format("h:mm a"):""),te.set("type",C);try{await We(O,te,e),await Ye(),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),B.target.reset(),x(null),d(null),v(null),g(null),i(Ne=>!Ne),m(ge()),P(ge()),k("pick"),s(Ne=>!Ne)}catch(Ne){N.error(Ne?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},Me=async B=>{try{await He(K,B,e),await Ye(),N.success("Success! Deleted item.",{duration:1e3})}catch(te){N.error(te?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},V=B=>{T(B),Q(!0);const te=B?.id??B?.route_time_id??B?.routeId??null;R(te);const Ne=B?.route_id??B?.routeId??B?.fk_route_id;J(Ne??null),M(_e.find(at=>at?.value===(Ne??B?.route_id))??null),ce(Ee.find(at=>at?.value===(B?.driver_id??B?.driverId))??null),f(null),I(at=>!at),E(B?.start_time?ge(B.start_time,["h:mm a","HH:mm"]):ge()),q(B?.drop_time?ge(B.drop_time,["h:mm a","HH:mm"]):ge()),X(B?.type??"pick")},Y=h.useMemo(()=>{if(!D)return null;const B=String(F).includes("?")?"&":"?";return`${F}${B}id=${encodeURIComponent(String(D))}`},[D,F]),{data:de,isLoading:Te}=se(e&&Y?[Y,e]:null,([B,te])=>le(B,te)),xe=h.useMemo(()=>{const B=de?.data??de;return Array.isArray(B)?B[0]??null:Array.isArray(B?.data)?B.data[0]??null:B??null},[de]);h.useEffect(()=>{if(!xe)return;const B=xe?.route_id??xe?.fk_route_id??xe?.routeId;J(B??null),M(_e.find(te=>te?.value===B)??null),ce(Ee.find(te=>te?.value===xe?.driver_id)??null),f(null),E(xe?.start_time?ge(xe.start_time,["h:mm a","HH:mm"]):ge()),q(xe?.drop_time?ge(xe.drop_time,["h:mm a","HH:mm"]):ge()),X(xe?.type??"pick"),I(te=>!te)},[Ee,xe,_e]),h.useEffect(()=>{if(!xe)return;const B=xe?.vehicle_id??xe?.vehicleId;B&&f(Pe.find(te=>te?.value===B)??null)},[xe,Pe]);const nt=async B=>{if(B.preventDefault(),!D)return;const te=new FormData(B.target);te.set("id",String(D)),te.set("route_id",pe?.value??H??""),te.set("driver_id",z?.value??""),te.set("vehicle_id",W?.value??""),te.set("start_time",y?y.format("h:mm a"):""),te.set("drop_time",A?A.format("h:mm a"):""),te.set("type",ee);try{await lt($,te,e),await Ye(),N.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),Q(!1),T(null)}catch(Ne){N.error(Ne?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},rt=[{title:"Route Name",dataIndex:"route_title",key:"route_title"},{title:"Driver Name",dataIndex:"driver_name",key:"driver_name"},{title:"Vehicle Name",dataIndex:"vehicle_name",key:"vehicle_name"},{title:"Start Time",dataIndex:"start_time",key:"start_time"},{title:"End Time",dataIndex:"drop_time",key:"drop_time"},{title:"Type",dataIndex:"type",key:"type"},{title:"Action",key:"action",render:(B,te)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.EditOutlined,{}),onClick:()=>V(te),style:{padding:2}}),t.jsx(ct,{id:te?.id??te?.routeId??te?.route_time_id,funcName:Me})]})}],yt=Z?.route_title?`Edit ${Z.route_title}`:"Edit Route Time",G=h.useMemo(()=>H?`${Re}?route_id=${H}`:null,[H,Re]),{data:ie}=se(e&&G?[G,e]:null,([B,te])=>le(B,te)),Pe=h.useMemo(()=>Mt(ie),[ie]);return t.jsxs("div",{children:[t.jsx(l.Drawer,{open:j,title:yt,placement:"right",width:420,destroyOnClose:!0,onClose:()=>{Q(!1),T(null),R(null),J(null),M(null),ce(null),f(null)},children:t.jsx("form",{onSubmit:nt,children:t.jsxs("div",{style:{display:"grid",gap:20,opacity:Te?.6:1},children:[t.jsx(fe,{options:_e,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",required:!0,allowSelectAll:!1,value:pe,onChange:B=>{J(B?.value??null),M(B??null),f(null),I(te=>!te)}}),t.jsx(fe,{options:Ee,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Driver",name:"driver_id",required:!0,allowSelectAll:!1,value:z,onChange:B=>ce(B??null)}),t.jsx(fe,{options:Pe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",required:!0,allowSelectAll:!1,value:W,onChange:B=>f(B??null)},`edit-vehicle-${U}`),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:pt,children:"Start Time"}),t.jsx(l.TimePicker,{value:y,onChange:B=>E(B),use12Hours:!0,format:"h:mm a",allowClear:!1,style:It})]}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:pt,children:"Drop Time"}),t.jsx(l.TimePicker,{value:A,onChange:B=>q(B),use12Hours:!0,format:"h:mm a",allowClear:!1,style:It})]}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:pt,children:"Type"}),t.jsx("div",{style:{borderBottom:"1px solid #d9d9d9",paddingBottom:6},children:t.jsx(l.Radio.Group,{options:fr,optionType:"button",buttonStyle:"solid",value:ee,onChange:B=>X(B.target.value)})})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Update",color:"primary"}),t.jsx(l.Button,{type:"text",onClick:()=>{Q(!1),T(null)},style:pr,children:"Cancel"})]})]})})}),t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(oe,{pt:5,pb:1,children:t.jsxs("div",{children:[t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Route Time Table"})}),t.jsx(oe,{px:3,pb:2,children:t.jsx("form",{onSubmit:Je,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx(fe,{options:_e,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",value:p,onChange:B=>{x(B?.value??null),d(B??null),g(null),i(te=>!te)},allowSelectAll:!1,required:!0}),t.jsx(fe,{options:Ee,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Driver",name:"driver_id",value:b,onChange:B=>v(B??null),allowSelectAll:!1,required:!0}),t.jsx(fe,{options:Ke,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",value:S,onChange:B=>g(B??null),allowSelectAll:!1,required:!0},`vehicle-${o}`),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:pt,children:"Start Time"}),t.jsx(l.TimePicker,{value:u,onChange:B=>m(B),use12Hours:!0,format:"h:mm a",allowClear:!1,style:It})]}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:pt,children:"Drop Time"}),t.jsx(l.TimePicker,{value:_,onChange:B=>P(B),use12Hours:!0,format:"h:mm a",allowClear:!1,style:It})]}),t.jsxs("div",{style:{width:"100%"},children:[t.jsx("label",{className:"labelfont",style:pt,children:"Type"}),t.jsx("div",{style:{borderBottom:"1px solid #d9d9d9",paddingBottom:6},children:t.jsx(l.Radio.Group,{options:fr,optionType:"button",buttonStyle:"solid",value:C,onChange:B=>k(B.target.value)})})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[t.jsx(we,{type:"submit",value:"Add",color:"primary"}),t.jsx(l.Button,{type:"text",htmlType:"reset",onClick:()=>{x(null),d(null),v(null),g(null),i(B=>!B),m(ge()),P(ge()),k("pick"),s(B=>!B)},style:pr,children:"Cancel"})]})]})},`form-${a}`)})]}),t.jsx("div",{style:{marginTop:24},children:t.jsxs("div",{children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Route Time List"})}),t.jsx(oe,{children:t.jsx(Xe,{parentCallback:tt,data:{newData:Ge,columns:rt,columnstype:"antd",action:!1,Loading:ze,error:Qe,deleteTodoMutation:Me}})})]})})]})})]})}const Mo={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},hr={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},mr={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"},yr=({dataIndex:e,title:n,record:r,children:a,isEditable:s,...o})=>t.jsx("td",{...o,children:s?t.jsx("div",{style:{display:"flex",marginLeft:"5%"},children:a}):a});let gr=2;function Uo({token:e}){const[n,r]=h.useState([]),[a,s]=h.useState(null),[o,i]=h.useState({pagination:{current:1,pageSize:50}}),{isLoading:c,data:x,mutate:p}=se(e?[`api/branchapi/transport/getrouteStoppageData?page=${o.pagination.current}&per_page=${o.pagination.pageSize}`,e]:null,([R,U])=>le(R,U)),{Status:d="Failed",pagination:{total_rows:b=0}={}}=x||{},{data:v=[]}=d==="Success"?x:{},{data:S}=se(e?["api/branchapi/Transport/getrouteDropdown",e]:null,([R,U])=>le(R,U)),g=h.useMemo(()=>{const R=S?.data??S??[];return Array.isArray(R)?R:[]},[S]),{data:u}=se(e&&a?["api/branchapi/transport/getrouteStoppageData?route_id="+a,e]:null,([R,U])=>le(R,U)),{Status:m="Failed"}=u||{},_=async(R,U)=>{try{await p(We(R,U,e),Et(U)),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch{N.error("Failed to add the new item.",{duration:1e3})}},P=R=>{R.preventDefault();const U=new FormData(R.target);_("/branchapi/transport/addstoppageToRoute",U)},C=()=>{r(R=>[...R,{idKey:gr++}])},k=R=>{if(n.length===1)return;const U=[...n];U.splice(R,1),r(U)},j=R=>{i(U=>({...U,pagination:{current:R,pageSize:U.pagination.pageSize}}))},Q=async R=>{const U="/branchapi/Transport/deletevehicle";try{await p(He(U,R,e),mt(R)),N.success("Success! Deleted item.",{duration:1e3})}catch{N.error("Failed to delete the item.",{duration:1e3})}};h.useEffect(()=>{if(m==="Success"){const R=Array.isArray(u?.data)?u.data:[];R.length>0?r(R):a&&r([{idKey:gr++}])}},[m,u,a]);const Z=R=>{const{children:U=[]}=R||{},I=[{title:"Stop Name",dataIndex:"stop_name",onCell:H=>({isEditable:!0})},{title:"Pick Time",dataIndex:"pickup_time",onCell:H=>({isEditable:!0})},{title:"Drop Name",dataIndex:"drop_time",onCell:H=>({isEditable:!0})}];return t.jsx("div",{style:{display:"flex",justifyContent:"center"},children:t.jsx("div",{style:{width:"95%",margin:8},children:t.jsx(l.Table,{components:{body:{cell:yr}},expandable:{childrenColumnName:"changed"},bordered:!0,columns:I,rowKey:H=>T(H)+"cell01",dataSource:U,pagination:!1})})})},T=R=>{const U=["id","index"];for(let I=0;I<U.length;I++)if(R[U[I]])return R[U[I]]},D=[{title:"Route",dataIndex:"route_title"},{title:"Stoppages",render:(R,U,I)=>t.jsx(t.Fragment,{children:U.children?.map((H,J,pe)=>t.jsx("span",{children:`${H.stop_name} ${J+1===pe.length?"":","}`},`${J}vehicle001`))})},{title:"Action",render:(R,U,I)=>t.jsx(t.Fragment,{children:t.jsx(ct,{id:U?.route_id,funcName:Q})})}];return t.jsxs("div",{children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsxs(oe,{pt:5,pb:1,children:[t.jsx(oe,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Route Time Table"})}),t.jsx(oe,{px:3,pb:2,children:t.jsxs("form",{onSubmit:P,children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx("div",{children:t.jsx(fe,{options:g,value:g.find(R=>R.value===a)??null,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",onChange:R=>{s(R?.value??null),r([])},allowSelectAll:!1,required:!0})}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-start",gap:12},children:a&&t.jsx("button",{type:"button",style:{padding:2,border:"none",background:"transparent",cursor:"pointer",marginBottom:8},title:"Add Row",onClick:C,children:t.jsx(he.PlusCircleOutlined,{style:{fontSize:24,color:"#28a745"}})})}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[t.jsx(we,{type:"submit",value:"Add",color:"primary"}),t.jsx(l.Button,{type:"text",htmlType:"button",onClick:()=>{s(null),r([])},style:Mo,children:"Cancel"})]})]}),t.jsx("div",{style:{marginTop:20},children:n.length>0&&n.map((R,U)=>{const I=R.pickup_time?ge(R.pickup_time,"h:mm a"):ge(),H=R.drop_time?ge(R.drop_time,"h:mm a"):ge();return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr)) auto",gap:16,alignItems:"end",marginBottom:12},children:[t.jsx("div",{children:t.jsx(ae,{defaultValue:R.stop_name??"",type:"text",name:`stoppage[${U}][name]`,label:"Place Name*",required:"required"})}),t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",style:hr,children:"Pick Time"}),t.jsx(l.TimePicker,{defaultValue:I,use12Hours:!0,format:"h:mm a",name:`stoppage[${U}][pickTime]`,allowClear:!1,style:mr})]}),t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",style:hr,children:"Drop Time"}),t.jsx(l.TimePicker,{defaultValue:H,use12Hours:!0,format:"h:mm a",name:`stoppage[${U}][drop_time]`,allowClear:!1,style:mr})]}),t.jsx("div",{style:{marginBottom:8},children:n.length>1&&t.jsx("button",{type:"button",style:{padding:2,border:"none",background:"transparent",cursor:"pointer"},onClick:()=>k(U),children:t.jsx(he.MinusCircleOutlined,{style:{fontSize:20,color:"#dc3545"}})})})]},R.idKey?R.idKey+"exp":R.id+"exp")})})]})}),t.jsx(oe,{mx:2,mt:1,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:t.jsx(De,{variant:"h6",color:"white",children:"Stoppage List"})}),t.jsx(oe,{style:{padding:"10px 16px"},children:t.jsx(l.Table,{components:{body:{cell:yr}},columns:D,bordered:!0,size:"small",rowKey:R=>T(R),dataSource:v,loading:c,expandable:{expandedRowRender:Z,childrenColumnName:"changed"},pagination:{current:o.pagination.current,pageSize:o.pagination.pageSize,total:b,showSizeChanger:!0,onChange:j,onShowSizeChange:(R,U)=>{i(I=>({...I,pagination:{current:1,pageSize:U}}))},showTotal:(R,U)=>`${U[0]}-${U[1]} of ${R} items`}})})]})]})}const Bo=(e,n)=>{const r=String(e??"").replace(/\/+$/,""),a=String(n).replace(/^\/+/,"");return`${r}/${a}`};function No({token:e}){const n=e??localStorage.getItem("authToken")??"",[r,a]=h.useState(null),[s,o]=h.useState(null),[i,c]=h.useState(null),[x,p]=h.useState(null),[d,b]=h.useState(null),[v,S]=h.useState(null),[g,u]=h.useState(null),m="api/branchapi/library/bookCategorydropdown",_="api/branchapi/academy/classdropdownlist",P="api/branchapi/Academy/getClassSubjectdropdown",C="api/branchapi/library/addBook",k="api/branchapi/library/uploadcsv",{data:j}=se(n?[m,n]:null,([I,H])=>le(I,H)),{data:Q}=se(n&&_?[_,n]:null,([I,H])=>le(I,H)),{data:Z}=se(n&&P?[P,n]:null,([I,H])=>le(I,H)),T=h.useMemo(()=>Bo(vt(),k),[k]),D=async I=>{I.preventDefault();const H=new FormData(I.target);H.set("cat_id",d?.value??""),H.set("class_id",v?.value??""),H.set("subject_id",g?.value??"");try{await We(C,H,n),N.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),I.target.reset(),b(null),S(null),u(null)}catch(J){N.error(J?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},R=async I=>{if(I.preventDefault(),!r){N.error("Please select a CSV file.",{duration:1e3});return}const H=new FormData;H.append("file",r),H.append("cat_id",s?.value??""),H.append("class_id",i?.value??""),H.append("subject_id",x?.value??"");try{const J=await Se.post(T,H,{headers:{Authorization:n,"Content-type":"multipart/form-data"}});J?.data?.Status==="Failed"?N.error(String(J?.data?.msg??"Upload failed."),{duration:1e3}):(N.success(String(J?.data?.msg??"Uploaded."),{duration:1e3,icon:"🚀"}),a(null),I.target.reset(),o(null),c(null),p(null))}catch(J){N.error(J?.response?.data?.msg??"Upload failed.",{duration:1e3})}},U=()=>{fetch("/books.csv").then(I=>{I.blob().then(H=>{const J=window.URL.createObjectURL(H);let pe=document.createElement("a");pe.href=J,pe.download="/books.csv",pe.click()})})};return t.jsxs("div",{style:{display:"grid",gap:20},children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsxs(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Add Book in Bulk"}),extra:t.jsx(l.Button,{type:"link",icon:t.jsx(he.DownloadOutlined,{}),onClick:U,children:"Download Sample"}),children:[t.jsx(l.Divider,{children:"Information"}),t.jsx(l.Typography.Paragraph,{style:{marginBottom:16},children:"1. Your CSV data should be in the format below. The first line of your CSV file should be the column headers as in the table example. Also make sure that your file is UTF-8 to avoid unnecessary encoding problems."}),t.jsx("form",{onSubmit:R,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx(fe,{options:j,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category",allowSelectAll:!1,name:"cat_id",required:!0,value:s,onChange:I=>o(I??null)}),t.jsx(fe,{options:Q,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",name:"class_id",allowSelectAll:!1,value:i,onChange:I=>c(I??null)}),t.jsx(fe,{options:Z,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Subjects",name:"subject_id",allowSelectAll:!1,value:x,onChange:I=>p(I??null)}),t.jsx(ae,{type:"file",label:"Upload CSV",name:"csv",accept:".csv",onChange:I=>a(I.target.files?.[0]??null),required:!0}),t.jsx(we,{type:"submit",value:"Save",color:"primary"})]})})]}),t.jsx(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Add Book"}),children:t.jsx("form",{onSubmit:D,children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[t.jsx(ae,{type:"text",label:"Book Name",name:"title",required:!0}),t.jsx(ae,{type:"text",label:"Author",name:"author",required:!0}),t.jsx(ae,{type:"text",label:"Publication",name:"publisher"}),t.jsx(ae,{type:"number",label:"Qty",name:"quantity",required:!0}),t.jsx(ae,{type:"number",label:"Book Price",name:"price",required:!0}),t.jsx(ae,{type:"number",label:"Fine Per Day",name:"fine",required:!0}),t.jsx(ae,{type:"text",label:"Barcode",name:"barcode"}),t.jsx(fe,{options:j,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category",allowSelectAll:!1,name:"cat_id",required:!0,value:d,onChange:I=>b(I??null)}),t.jsx(fe,{options:Q,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",name:"class_id",allowSelectAll:!1,value:v,onChange:I=>S(I??null)}),t.jsx(fe,{options:Z,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Subjects",name:"subject_id",allowSelectAll:!1,value:g,onChange:I=>u(I??null)}),t.jsx(we,{type:"submit",value:"Save",color:"primary"})]})})})]})}const un={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},pn=e=>{const n=e?.data??e??[];return Array.isArray(n)?n:[]};function Fo({token:e}){const n=e??localStorage.getItem("authToken")??"",[r,a]=h.useState([]),[s,o]=h.useState([]),i=h.useRef(),c={selectedRowKeys:r,onChange:(O,$)=>{a(O),o($)}},x=xr.useReactToPrint({contentRef:i,documentTitle:"Book Barcodes"}),p=()=>{if(!(typeof window>"u")){if(!s.length){N.error("Select at least one book to print.",{duration:1e3});return}if(!i.current){N.error("Nothing to print.",{duration:1e3});return}x?.()}},[d,b]=h.useState(!1),[v,S]=h.useState(null),[g,u]=h.useState(null),[m,_]=h.useState(null),[P,C]=h.useState(null),[k,j]=h.useState({page:1,rowsPerPage:10}),Q=(O,$)=>{j({page:O,rowsPerPage:parseInt($,10)})},Z="api/branchapi/library/booktable",T="api/branchapi/library/deletebooks",D="api/branchapi/library/editbook",R=`${Z}?page=${k.page}&per_page=${k.rowsPerPage}`,{isLoading:U,error:I,data:H,mutate:J}=se(n?[R,n]:null,([O,$])=>le(O,$)),pe="api/branchapi/library/bookCategorydropdown",M="api/branchapi/academy/classdropdownlist",z="api/branchapi/Academy/getClassSubjectdropdown",{data:ce}=se(n?[pe,n]:null,([O,$])=>le(O,$)),{data:W}=se(n&&M?[M,n]:null,([O,$])=>le(O,$)),{data:f}=se(n&&z?[z,n]:null,([O,$])=>le(O,$)),y=h.useMemo(()=>pn(ce),[ce]),E=h.useMemo(()=>pn(W),[W]),A=h.useMemo(()=>pn(f),[f]),q=async O=>{try{await He(T,O,n),await J(),N.success("Success! Deleted item.",{duration:1e3})}catch($){N.error($?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},ee=O=>{S(O??null);const $=O?.cat_id??O?.fk_cat_id??O?.category_id,K=O?.class_id??O?.fk_class_id,be=O?.subject_id??O?.fk_subject_id;u(y.find(F=>F?.value===$)??null),_(E.find(F=>F?.value===K)??null),C(A.find(F=>F?.value===be)??null),b(!0)},X=async O=>{O.preventDefault();const $=v?.id??v?.book_id??v?._id;if(!$)return;const K=new FormData(O.target);K.set("id",String($)),K.set("cat_id",g?.value??""),K.set("class_id",m?.value??""),K.set("subject_id",P?.value??"");try{await lt(D,K,n),await J(),N.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),b(!1),S(null)}catch(be){N.error(be?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},ne=h.useMemo(()=>[{title:"Name",dataIndex:"book_title",key:"book_title",width:220,ellipsis:!0,fixed:"left"},{title:"Barcode",dataIndex:"barcode",key:"barcode",width:140,responsive:["sm"]},{title:"Publisher",dataIndex:"publish",key:"publish",width:160,responsive:["lg"]},{title:"Author",dataIndex:"author",key:"author",width:160,responsive:["lg"]},{title:"Class",dataIndex:"class_name",key:"class_name",width:140,responsive:["xl"]},{title:"Subject",dataIndex:"subject_name",key:"subject_name",width:160,responsive:["xl"]},{title:"Avl Qty",dataIndex:"available_qty",key:"available_qty",width:90},{title:"Book Price",dataIndex:"perunitcost",key:"perunitcost",width:120,responsive:["xl"]},{title:"Fine Amount",dataIndex:"fine_amount",key:"fine_amount",width:120,responsive:["xl"]},{title:"Category",dataIndex:"cat_name",key:"cat_name",width:160,responsive:["xl"]},{title:"Action",key:"action",width:140,fixed:"right",render:(O,$)=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.EditOutlined,{}),onClick:()=>ee($),style:{padding:2}}),t.jsx(l.Button,{type:"text",size:"small",danger:!0,onClick:()=>q($?.id??$?.book_id??$?._id),style:{padding:"2px 6px"},children:"Delete"})]})}],[y,E,q,A]);return t.jsxs("div",{style:{},children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(l.Drawer,{open:d,title:"Edit Book",placement:"right",width:520,destroyOnClose:!0,onClose:()=>{b(!1),S(null)},children:t.jsx("form",{onSubmit:X,children:t.jsxs("div",{style:{display:"grid",gap:16},children:[t.jsx(ae,{label:"Book Name",name:"title",defaultValue:v?.book_title??"",required:!0}),t.jsx(ae,{label:"Author",name:"author",defaultValue:v?.author??"",required:!0}),t.jsx(ae,{label:"Publication",name:"publish",defaultValue:v?.publish??""}),t.jsx(ae,{label:"Qty",name:"quantity",type:"number",defaultValue:v?.quantity??""}),t.jsx(ae,{label:"Book Price",name:"perunitcost",type:"number",defaultValue:v?.perunitcost??""}),t.jsx(ae,{label:"Fine Amount",name:"fine_amount",type:"number",defaultValue:v?.fine_amount??""}),t.jsx(ae,{label:"Barcode",name:"barcode",defaultValue:v?.barcode??""}),t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",style:un,children:"Category"}),t.jsx(fe,{options:y,value:g,onChange:O=>u(O??null),name:"cat_id"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",style:un,children:"Class"}),t.jsx(fe,{options:E,value:m,onChange:O=>_(O??null),name:"class_id"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",style:un,children:"Subject"}),t.jsx(fe,{options:A,value:P,onChange:O=>C(O??null),name:"subject_id"})]}),t.jsxs("div",{style:{display:"flex",gap:12},children:[t.jsx(we,{type:"submit",value:"Update",color:"primary"}),t.jsx(l.Button,{type:"text",onClick:()=>{b(!1),S(null)},children:"Cancel"})]})]})})}),t.jsx(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Book List"}),extra:s.length>0?t.jsxs(l.Button,{type:"primary",onClick:p,children:["Print Barcode (",s.length,")"]}):null,children:t.jsx(Xe,{parentCallback:Q,data:{newData:H,columns:ne,columnstype:"antd",action:!1,Loading:U,error:I,rowSelection:c}})}),t.jsx("div",{style:{position:"fixed",left:-1e4,top:0,width:0,height:0,overflow:"hidden"},children:t.jsx("div",{ref:i,style:{padding:"20px"},children:t.jsx("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"},children:s.map((O,$)=>t.jsxs("div",{style:{margin:"10px",textAlign:"center",border:"1px dashed black",padding:"10px",borderRadius:"5px",width:"fit-content"},children:[t.jsx("div",{style:{fontSize:"12px",fontWeight:"bold",maxWidth:"200px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:O.book_title}),t.jsx(Zr,{value:O.barcode?String(O.barcode):String(O.id),format:"CODE128",width:1.5,height:50,fontSize:12,displayValue:!0})]},$))})})})]})}const $o=(e,n)=>{const r=String(e??"").replace(/\/+$/,""),a=String(n).replace(/^\/+/,"");return`${r}/${a}`},Ze=e=>{const n=e?.data??e??[];return Array.isArray(n)?n:[]};function Lo({token:e}){const n=e??localStorage.getItem("authToken")??"",r=JSON.parse(localStorage.getItem("genrall_settings")??"null")?.currency_symbol??"",[a,s]=h.useState("issue"),o=a==="return",[i,c]=h.useState(!1),[x,p]=h.useState(!1),[d,b]=h.useState(null),[v,S]=h.useState([]),[g,u]=h.useState([]),[m,_]=h.useState([]),[P,C]=h.useState(0),[k,j]=h.useState(!1),[Q,Z]=h.useState(null),[T,D]=h.useState(null),[R,U]=h.useState(null),[I,H]=h.useState(!1),[J,pe]=h.useState("Cash"),[M,z]=h.useState(""),[ce,W]=h.useState(""),[f,y]=h.useState(0),E=h.useRef(null),[A]=l.Form.useForm(),[q]=l.Form.useForm(),ee="api/branchapi/library/bookCategorydropdown",X="api/branchapi/academy/classdropdownlist",ne="api/branchapi/Academy/getClassSubjectdropdown",{data:O}=se(n?[ee,n]:null,([L,ue])=>le(L,ue)),{data:$}=se(n&&X?[X,n]:null,([L,ue])=>le(L,ue)),{data:K}=se(n&&ne?[ne,n]:null,([L,ue])=>le(L,ue)),be=h.useMemo(()=>Ze(O),[O]),F=h.useMemo(()=>Ze($),[$]),je=h.useMemo(()=>Ze(K),[K]),Re="api/branchapi/library/studentsearchByNameID",ze="api/branchapi/library/booksearchBybookname",Ge="api/branchapi/library/issuedBookList",Qe="api/branchapi/library/issueLibrarybook",Ye="api/branchapi/library/returnedLibrarybook",{trigger:$e,data:Be}=et(Re,(L,ue)=>Zt(L,ue,n)),{trigger:Le,data:Ae}=et(ze,(L,ue)=>Zt(L,ue,n)),{trigger:_e,data:Ee}=et(Ge,(L,ue)=>Zt(L,ue,n)),{trigger:Ke}=et(o?Ye:Qe,(L,ue)=>Fs(L,ue,n)),tt=h.useMemo(()=>Ze(Be),[Be]),Je=h.useMemo(()=>Ze(Ae),[Ae]),Me=h.useMemo(()=>Ze(Ee),[Ee]),V=L=>{const ue=ge().format("YYYY-MM-DD");S(ve=>ve.some(gt=>String(gt?.id)===String(L?.id))?ve:[...ve,{...L,return_date:L?.return_date?L.return_date:ue}])},Y=L=>{S(ue=>ue.filter(ve=>String(ve?.id)!==String(L)))},de=async L=>{if(n){if(!L){b(null);return}i||await $e({id:L})}},Te=async({search:L})=>{if(!n||!i)return;const ue=await $e({id:L}),ve=Ze(ue);ve.length===1&&(b(ve[0]),await _e({id:ve[0]?.student_id}),A.resetFields())},xe=async(L,ue)=>{b(ue??null),S([]),u([]),_([]),C(0),ue?.student_id&&await _e({id:ue.student_id}),A.resetFields()},nt=async L=>{n&&L&&(x||await Le({book:L}))},rt=async({search_book:L})=>{if(!n||!x)return;const ue=await Le({book:L,catID:Q?.value??"",sID:R?.value??"",cID:T?.value??""}),ve=Ze(ue);ve.length&&(V(ve[0]),q.resetFields())},yt=(L,ue)=>{V(ue),q.resetFields()},G=async()=>{if(!d?.member_id){N.error("Select a student first.",{duration:1e3});return}if(!v.length){N.error("Select at least one book.",{duration:1e3});return}const L=await Ke({member_id:d.member_id,fine:!1,books:v});L?.Status==="Success"?(N.success(String(L?.msg??"Success"),{duration:1e3}),S([]),b(null),u([]),_([]),C(0)):N.error(String(L?.msg??"Failed"),{duration:1e3})},ie=async()=>{if(!d?.member_id){N.error("Select a student first.",{duration:1e3});return}if(!m.length){N.error("Select at least one book to return.",{duration:1e3});return}if(Number(P)>0){H(!0);return}const L=await Ke({member_id:d.member_id,fine:!1,books:JSON.stringify(m)});L?.Status==="Success"?(N.success(String(L?.msg??"Success"),{duration:1e3}),u([]),_([]),C(0),await _e({id:d?.student_id})):N.error(String(L?.msg??"Failed"),{duration:1e3})},Pe=async()=>{if(!d?.member_id)return;const L=Math.max(0,Number(P)-Number(f||0)),ue={member_id:d.member_id,amount:L,fine:!0,books:JSON.stringify(m),payment_type:J,notes:M,attchement:ce,discount:f||0},ve=await Ke(ue);H(!1),ve?.Status==="Success"?(N.success(String(ve?.msg??"Success"),{duration:1e3}),u([]),_([]),C(0),y(0),z(""),W(""),await _e({id:d?.student_id})):N.error(String(ve?.msg??"Failed"),{duration:1e3})},B=h.useMemo(()=>$o(vt(),"api/branchapi/frontoffice/uploadfrontofficeDocument"),[]),te=[{title:"Book",dataIndex:"book_title",key:"book_title",width:220,ellipsis:!0,fixed:"left"},{title:"Author",dataIndex:"author",key:"author",width:180,responsive:["lg"]},{title:"Return Date",key:"return_date",width:160,render:(L,ue)=>t.jsx(l.Input,{value:ue?.return_date??"",onChange:ve=>{const gt=ve.target.value;S(Ht=>Ht.map(Yt=>String(Yt?.id)===String(ue?.id)?{...Yt,return_date:gt}:Yt))},placeholder:"YYYY-MM-DD"})},{title:"Action",key:"action",width:120,fixed:"right",render:(L,ue)=>t.jsx(l.Button,{type:"text",danger:!0,onClick:()=>Y(ue?.id),children:"Remove"})}],Ne={selectedRowKeys:g,onChange:(L,ue)=>{u(L),_(ue);const ve=(ue??[]).reduce((gt,Ht)=>gt+Number(Ht?.totalfine??0),0);C(ve)}},at=[{title:"Book",dataIndex:"book_title",key:"book_title",width:220,ellipsis:!0,fixed:"left"},{title:"Barcode",dataIndex:"barcode",key:"barcode",width:140,responsive:["sm"]},{title:"Issue Date",dataIndex:"issue_date",key:"issue_date",width:140,responsive:["lg"]},{title:"Due Date",dataIndex:"due_date",key:"due_date",width:140,responsive:["lg"]},{title:"Fine",dataIndex:"totalfine",key:"totalfine",width:120,fixed:"right",render:L=>t.jsxs("span",{children:[r," ",L]})}];return t.jsxs("div",{style:{display:"grid",gap:16},children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(l.Modal,{open:I,onCancel:()=>H(!1),footer:null,title:"Payment Options",destroyOnClose:!0,children:t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx(l.Radio.Group,{value:J,onChange:L=>pe(L.target.value),options:[{label:"Cash",value:"Cash"},{label:"UPI",value:"UPI"},{label:"DD",value:"DD"},{label:"Bank",value:"Bank"},{label:"Internet Banking",value:"Internet Banking"},{label:"Cheque",value:"Cheque"}]}),t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",children:"Note"}),t.jsx(l.Input.TextArea,{rows:3,value:M,onChange:L=>z(L.target.value)})]}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx("label",{className:"labelfont",children:"Image Attachment"}),t.jsx(l.Upload,{action:B,headers:{Authorization:n},maxCount:1,onChange:L=>{if(L.file.status==="done"){const ue=L.file.response?.data??L.file.response?.file??"";W(String(ue??""))}},children:t.jsx(l.Button,{icon:t.jsx(he.UploadOutlined,{}),children:"Upload"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",children:"Discount"}),t.jsx(l.Input,{type:"number",value:f,onChange:L=>y(L.target.value),placeholder:"0"})]}),t.jsxs(l.Button,{type:"primary",onClick:Pe,children:["Collect ",r,Math.max(0,Number(P)-Number(f||0))]})]})}),t.jsxs(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Issue / Return"}),children:[t.jsxs(l.Row,{gutter:[16,16],align:"middle",children:[t.jsx(l.Col,{xs:24,md:10,children:t.jsx(l.Radio.Group,{value:a,onChange:L=>{const ue=L.target.value;s(ue),S([]),u([]),_([]),C(0)},options:[{label:"Issue",value:"issue"},{label:"Return",value:"return"}],optionType:"button",buttonStyle:"solid"})}),t.jsx(l.Col,{xs:24,md:14,children:t.jsx(l.Form,{form:A,onFinish:Te,layout:"vertical",children:t.jsx(l.Form.Item,{name:"search",label:"Search Student",children:t.jsx(l.Space.Compact,{style:{width:"100%"},children:i?t.jsx(l.Input,{autoFocus:!0,addonBefore:t.jsxs(l.Space,{children:[t.jsx(he.BarcodeOutlined,{}),t.jsx(l.Checkbox,{checked:i,onChange:L=>c(L.target.checked)})]}),placeholder:"Scan barcode",allowClear:!0}):t.jsx(l.AutoComplete,{options:tt,onSelect:xe,onSearch:de,style:{width:"100%"},allowClear:!0,children:t.jsx(l.Input,{addonBefore:t.jsxs(l.Space,{children:[t.jsx(he.BarcodeOutlined,{}),t.jsx(l.Checkbox,{checked:i,onChange:L=>c(L.target.checked)})]}),placeholder:"Type student name / id",allowClear:!0})})})})})})]}),d?t.jsxs(t.Fragment,{children:[t.jsx(l.Divider,{}),t.jsxs(l.Row,{gutter:[12,12],children:[t.jsxs(l.Col,{xs:24,md:8,children:[t.jsx(l.Typography.Text,{strong:!0,children:"Name:"})," ",d?.value??""]}),t.jsxs(l.Col,{xs:24,md:8,children:[t.jsx(l.Typography.Text,{strong:!0,children:"Card No:"})," ",d?.library_card_no??""]}),t.jsxs(l.Col,{xs:24,md:8,children:[t.jsx(l.Typography.Text,{strong:!0,children:"Member ID:"})," ",d?.member_id??""]})]})]}):null,t.jsx(l.Divider,{}),o?t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",overflowX:"auto"},children:t.jsx("div",{style:{minWidth:760},children:t.jsx(l.Table,{dataSource:Me,columns:at,rowSelection:Ne,pagination:!1,rowKey:L=>L?.id??L?.issue_id??L?.barcode??Math.random(),scroll:{x:"max-content"},size:"small"})})}),t.jsx(l.Divider,{}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[t.jsxs(l.Typography.Text,{strong:!0,children:["Total Fine: ",r,P]}),t.jsx(l.Button,{type:"primary",onClick:ie,disabled:!m.length,children:P>0?`Pay Now ${r}${Math.max(0,Number(P)-Number(f||0))}`:"Return Selected"})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs(l.Row,{gutter:[16,16],align:"middle",children:[t.jsx(l.Col,{xs:24,md:18,children:t.jsx(l.Form,{form:q,onFinish:rt,layout:"vertical",children:t.jsx(l.Form.Item,{name:"search_book",label:"Search Book",children:t.jsx(l.Space.Compact,{style:{width:"100%"},children:x?t.jsx(l.Input,{autoFocus:!0,disabled:!d,addonBefore:t.jsxs(l.Space,{children:[t.jsx(he.BarcodeOutlined,{}),t.jsx(l.Checkbox,{checked:x,onChange:L=>p(L.target.checked)})]}),placeholder:"Scan barcode",allowClear:!0}):t.jsx(l.AutoComplete,{disabled:!d,options:Je,onSelect:yt,onSearch:nt,style:{width:"100%"},allowClear:!0,children:t.jsx(l.Input,{addonBefore:t.jsxs(l.Space,{children:[t.jsx(he.BarcodeOutlined,{}),t.jsx(l.Checkbox,{checked:x,onChange:L=>p(L.target.checked)})]}),placeholder:"Type book name",allowClear:!0})})})})})}),t.jsx(l.Col,{xs:24,md:6,children:t.jsx(l.Button,{style:{width:"100%"},icon:t.jsx(he.FilterOutlined,{}),onClick:()=>j(!0),children:"Filter"})})]}),t.jsx(l.Drawer,{open:k,onClose:()=>j(!1),title:"Filter",placement:"right",width:380,destroyOnClose:!0,children:t.jsxs("div",{style:{display:"grid",gap:16},children:[t.jsx(fe,{label:"Category",options:be,value:Q,onChange:L=>Z(L??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,name:"cat_id"}),t.jsx(fe,{label:"Class",options:F,value:T,onChange:L=>D(L??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,name:"class_id"}),t.jsx(fe,{label:"Subjects",options:je,value:R,onChange:L=>U(L??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,name:"subject_id"}),t.jsx(l.Button,{type:"primary",onClick:()=>j(!1),children:"Apply"})]})}),t.jsx(l.Divider,{}),t.jsx("div",{style:{width:"100%",overflowX:"auto"},children:t.jsx("div",{style:{minWidth:720},children:t.jsx(l.Table,{dataSource:v,columns:te,pagination:!1,rowKey:L=>L?.id??L?.book_id??L?.barcode??Math.random(),scroll:{x:"max-content"},size:"small"})})}),t.jsx(l.Divider,{}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(we,{type:"button",value:"Issue",onClick:G})})]})]}),t.jsx("div",{ref:E,style:{position:"fixed",left:-1e4,top:0,width:0,height:0,overflow:"hidden"}})]})}const br=e=>{const n=e?.data??e??[];return Array.isArray(n)?n:[]};function qo({token:e}){const n=e??localStorage.getItem("authToken")??"",[r,a]=h.useState({page:1,rowsPerPage:10}),[s,o]=h.useState(null),[i,c]=h.useState(null),[x,p]=h.useState(!1),[d,b]=h.useState(!1),[v,S]=h.useState(null),[g,u]=h.useState(!1),m="api/branchapi/academy/classdropdownlist",_="api/branchapi/academy/sectionoftheClass",P="api/branchapi/library/studenttableForLibrary",C="api/branchapi/library/addmembershipforStudent",k="api/branchapi/library/removemembershipforStudent",j=h.useMemo(()=>{if(!s?.value)return null;const f=_.includes("?")?"&":"?";return`${_}${f}class_id=${encodeURIComponent(String(s.value))}`},[_,s?.value]),Q=h.useMemo(()=>{if(!s?.value||!i?.value)return null;const f=P.includes("?")?"&":"?";return`${P}${f}cID=${encodeURIComponent(String(s.value))}&sID=${encodeURIComponent(String(i.value))}&page=${r.page}&per_page=${r.rowsPerPage}`},[r.page,r.rowsPerPage,s?.value,i?.value,P]),{data:Z}=se(n&&m?[m,n]:null,([f,y])=>le(f,y)),{data:T}=se(n&&j?[j,n]:null,([f,y])=>le(f,y)),{isLoading:D,error:R,data:U,mutate:I}=se(n&&Q?[Q,n]:null,([f,y])=>le(f,y)),H=h.useMemo(()=>br(Z),[Z]),J=h.useMemo(()=>br(T),[T]),pe=(f,y)=>{a({page:f,rowsPerPage:parseInt(y,10)})},M=f=>{const y=f?.id??f?.student_id??f?.member_id;S(y??null),b(!0),u(E=>!E)},z=async f=>{if(f.preventDefault(),!v)return;const y=new FormData(f.target);y.set("id",String(v));try{await We(C,y,n),N.success("Success! Added member.",{duration:1e3,icon:"🎉"}),b(!1),S(null),await I()}catch(E){N.error(E?.response?.data?.msg??"Failed to add the member.",{duration:1e3})}},ce=async f=>{try{await He(k,f,n),N.success("Success! Removed member.",{duration:1e3}),await I()}catch(y){N.error(y?.response?.data?.msg??"Failed to remove member.",{duration:1e3})}},W=h.useMemo(()=>[{title:"Library Card No",dataIndex:"library_card_no",key:"library_card_no",width:180,ellipsis:!0,fixed:"left"},{title:"Admission No",dataIndex:"admission_no",key:"admission_no",width:140,responsive:["sm"]},{title:"Roll No",dataIndex:"roll_no",key:"roll_no",width:90,responsive:["lg"]},{title:"First Name",dataIndex:"firstname",key:"firstname",width:140,responsive:["sm"]},{title:"Last Name",dataIndex:"lastname",key:"lastname",width:140,responsive:["lg"]},{title:"Class",dataIndex:"class",key:"class",width:120,responsive:["xl"]},{title:"Section",dataIndex:"section",key:"section",width:120,responsive:["xl"]},{title:"Mobile",dataIndex:"mobileno",key:"mobileno",width:140,responsive:["lg"]},{title:"Action",key:"action",width:80,fixed:"right",render:(f,y)=>(console.log("data______________",y),t.jsx("div",{style:{display:"flex",gap:8,alignItems:"center"},children:y?.library_card_no==null?t.jsx(l.Button,{type:"primary",size:"small",icon:t.jsx(he.UserAddOutlined,{}),onClick:()=>M(y)}):t.jsx(l.Button,{danger:!0,type:"text",size:"small",icon:t.jsx(he.DeleteOutlined,{}),onClick:()=>ce(y?.id??y?.student_id??y?.member_id)})}))}],[ce]);return t.jsxs("div",{style:{},children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(l.Modal,{open:d,title:"Add Member",onCancel:()=>{b(!1),S(null)},footer:null,destroyOnClose:!0,children:t.jsx("form",{onSubmit:z,children:t.jsxs("div",{style:{display:"grid",gap:16},children:[t.jsx(ae,{type:"text",label:"Library Card Number",name:"library_num",required:!0}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(we,{type:"submit",value:"Add",color:"primary"})})]})},`add-${g}`)}),t.jsx(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Add Student"}),children:t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:16,alignItems:"end"},children:[t.jsx(fe,{options:H,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",value:s,onChange:f=>{o(f??null),c(null),p(y=>!y)},name:"class_id",required:!0,allowSelectAll:!1}),t.jsx(fe,{options:J,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",value:i,onChange:f=>c(f??null),allowSelectAll:!1,name:"section_id",required:!0},`section-${x}`),t.jsx(we,{type:"submit",value:"Search",color:"primary",onClick:()=>{if(!s?.value||!i?.value){N.error("Select class and section.",{duration:1e3});return}a(f=>({...f,page:1}))}})]})}),t.jsx(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Students"}),children:t.jsx(Xe,{parentCallback:pe,data:{newData:U,columns:W,columnstype:"antd",action:!1,Loading:D,error:R}})})]})}function zo({token:e}){const n=e??localStorage.getItem("authToken")??"",[r,a]=h.useState({page:1,rowsPerPage:10}),[s]=l.Form.useForm(),[o]=l.Form.useForm(),[i,c]=h.useState(!1),[x,p]=h.useState(null),d="api/branchapi/library/BookCategorytable",b="api/branchapi/library/addBookCategory",v="api/branchapi/library/editBookCategory",S="api/branchapi/library/deleteBookCategory",g=h.useMemo(()=>{const R=d.includes("?")?"&":"?";return`${d}${R}page=${r.page}&per_page=${r.rowsPerPage}`},[d,r.page,r.rowsPerPage]),{isLoading:u,error:m,data:_,mutate:P}=se(n&&g?[g,n]:null,([R,U])=>le(R,U)),C=(R,U)=>{a({page:R,rowsPerPage:parseInt(U,10)})},k=async R=>{const U=new FormData;U.set("title",R?.title??"");try{await We(b,U,n),N.success("Success! Added new category.",{duration:1e3,icon:"🎉"}),s.resetFields(),await P()}catch(I){N.error(I?.response?.data?.msg??I?.message??"Failed to add category.",{duration:1e3})}},j=R=>{p(R??null),o.setFieldsValue({title:R?.name??""}),c(!0)},Q=()=>{c(!1),p(null),o.resetFields()},Z=async R=>{const U=x?.id??x?.category_id??x?.cat_id;if(!U){N.error("Missing category id.",{duration:1e3});return}const I=new FormData;I.set("id",String(U)),I.set("title",R?.title??"");try{await lt(v,I,n),N.success("Success! Updated category.",{duration:1e3,icon:"🚀"}),Q(),await P()}catch(H){N.error(H?.response?.data?.msg??H?.message??"Failed to update category.",{duration:1e3})}},T=async R=>{const U=R?.id??R?.category_id??R?.cat_id;if(!U){N.error("Missing category id.",{duration:1e3});return}try{await He(S,U,n),N.success("Success! Deleted category.",{duration:1e3}),await P()}catch(I){N.error(I?.response?.data?.msg??I?.message??"Failed to delete category.",{duration:1e3})}},D=h.useMemo(()=>[{title:"Category Name",dataIndex:"name",key:"name",ellipsis:!0},{title:"Action",key:"action",width:110,fixed:"right",render:(R,U)=>t.jsxs(l.Space,{size:6,children:[t.jsx(l.Button,{type:"text",size:"small",icon:t.jsx(he.EditOutlined,{}),onClick:()=>j(U)}),t.jsx(l.Popconfirm,{title:"Remove category?",okText:"Yes",cancelText:"No",onConfirm:()=>T(U),children:t.jsx(l.Button,{danger:!0,type:"text",size:"small",icon:t.jsx(he.DeleteOutlined,{})})})]})}],[T]);return t.jsxs("div",{children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsx(l.Modal,{open:i,title:"Edit Category",onCancel:Q,footer:null,destroyOnClose:!0,children:t.jsxs(l.Form,{form:o,layout:"vertical",onFinish:Z,children:[t.jsx(l.Form.Item,{label:"Name",name:"title",rules:[{required:!0,message:"Enter category name"}],children:t.jsx(l.Input,{placeholder:"Enter category name"})}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[t.jsx(l.Button,{onClick:Q,children:"Cancel"}),t.jsx(we,{type:"submit",value:"Update",color:"primary"})]})]})}),t.jsxs(l.Row,{gutter:[16,16],children:[t.jsx(l.Col,{xs:24,lg:8,children:t.jsx(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Add Category"}),children:t.jsxs(l.Form,{form:s,layout:"vertical",onFinish:k,children:[t.jsx(l.Form.Item,{label:"Name",name:"title",rules:[{required:!0,message:"Enter category name"}],children:t.jsx(l.Input,{placeholder:"Enter category name"})}),t.jsx(we,{type:"submit",value:"Add",color:"primary"})]})})}),t.jsx(l.Col,{xs:24,lg:16,children:t.jsx(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Category List"}),children:t.jsx(Xe,{parentCallback:C,data:{newData:_,columns:D,columnstype:"antd",action:!1,Loading:u,error:m}})})})]})]})}const fn=e=>{const n=e?.data??e??[];return Array.isArray(n)?n:[]};function Vo({token:e}){const[n,r]=h.useState([ge().format("YYYY-MM-DD"),ge().format("YYYY-MM-DD")]),[a,s]=h.useState(null),[o,i]=h.useState(null),[c,x]=h.useState(null),[p,d]=h.useState(!1),[b,v]=h.useState(!1),S="api/branchapi/academy/classdropdownlist",g="api/branchapi/academy/sectionoftheClass",u="api/branchapi/library/memberDropdown",m="api/report/libraryReport/libraryReport",_=h.useMemo(()=>{if(!a?.value)return null;const M=g.includes("?")?"&":"?";return`${g}${M}class_id=${encodeURIComponent(String(a.value))}`},[g,a?.value]),P=h.useMemo(()=>{if(!a?.value)return null;const M=u.includes("?")?"&":"?",z=`${u}${M}class=${encodeURIComponent(String(a.value))}`;return o?.value?`${z}&section=${encodeURIComponent(String(o.value))}`:z},[u,a?.value,o?.value]),{isLoading:C,error:k,data:j,mutate:Q}=se(e&&S?[S,e]:null,([M,z])=>le(M,z)),{data:Z}=se(e&&_?[_,e]:null,([M,z])=>le(M,z)),{data:T}=se(e&&P?[P,e]:null,([M,z])=>le(M,z)),D=h.useMemo(()=>fn(j),[j]),R=h.useMemo(()=>fn(Z),[Z]),U=h.useMemo(()=>fn(T),[T]),{trigger:I,data:H}=et(m,(M,z)=>$s(M,z,e));h.useEffect(()=>{(async()=>{v(!0);try{await I({duration:n})}finally{v(!1)}})()},[]);const J=async()=>{v(!0);try{await I({duration:n,class:a?.value??"",section:o?.value??"",student_id:c?.value??""})}finally{v(!1)}},pe=[{title:"Name",dataIndex:"full_name",render:(M,z)=>t.jsx(l.Typography.Text,{style:{fontSize:12},children:z?.full_name??""})},{title:"Roll No",dataIndex:"roll_no",render:(M,z)=>t.jsx(l.Typography.Text,{style:{fontSize:12},children:z?.roll_no??""})},{title:"Class",dataIndex:"Class",key:"Class",render:(M,z)=>t.jsxs(l.Typography.Text,{style:{fontSize:12},children:[z?.class??"","(",z?.section??"",")"]})},{title:"Book",dataIndex:"book_title",render:(M,z)=>t.jsx(l.Typography.Text,{style:{fontSize:12},children:z?.book_title??""})},{title:"Issue Date",key:"date",render:(M,z,ce)=>t.jsx(l.Typography.Text,{style:{fontSize:12},children:z?.issue_date??""})},{title:"Due Return Date",key:"date",render:(M,z,ce)=>t.jsx(l.Tag,{color:"orange",children:z?.return_date??""})},{title:"Return Date",key:"date",render:(M,z,ce)=>z?.retured_by_user?t.jsx(l.Tag,{color:"green",children:z?.retured_by_user??""}):null},{title:"Return Status",key:"date",render:(M,z,ce)=>String(z?.is_returned??"")==="1"?t.jsx(l.Tag,{color:"green",children:"Return"}):t.jsx(l.Tag,{color:"red",children:"Not Return"})},{title:"Fine",key:"amount",dataIndex:"late_fine",render:(M,z,ce)=>{const W=z?.late_fine?Number(z.late_fine):0;return W?t.jsx(l.Typography.Text,{style:{fontSize:12,color:"#cf1322"},children:W}):null}}];return t.jsxs("div",{children:[t.jsx(N.Toaster,{toastOptions:{position:"top-center"}}),t.jsxs(l.Card,{title:t.jsx(l.Typography.Title,{level:5,style:{margin:0},children:"Library Monthly Report"}),style:{borderRadius:16},children:[t.jsxs(l.Row,{gutter:[16,16],align:"bottom",children:[t.jsx(l.Col,{xs:24,md:8,children:t.jsxs("div",{children:[t.jsx("label",{className:"labelfont",children:"Duration"}),t.jsx(l.DatePicker.RangePicker,{style:{width:"100%"},value:[ge(n[0],"YYYY-MM-DD"),ge(n[1],"YYYY-MM-DD")],format:"YYYY-MM-DD",onChange:(M,z)=>{Array.isArray(z)&&z.length===2&&r([z[0],z[1]])}})]})}),t.jsx(l.Col,{xs:24,md:5,children:t.jsx(fe,{options:D,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Classes",name:"class_id",value:a,onChange:M=>{s(M??null),i(null),x(null),d(z=>!z)},allowSelectAll:!1})}),t.jsx(l.Col,{xs:24,md:5,children:t.jsx(fe,{options:R,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",name:"section_id",value:o,onChange:M=>{i(M??null),x(null)},allowSelectAll:!1},`section1${p}`)}),t.jsx(l.Col,{xs:24,md:5,children:t.jsx(fe,{options:U,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Student",name:"student",value:c,onChange:M=>x(M??null),allowSelectAll:!1})}),t.jsx(l.Col,{xs:24,md:1,children:t.jsx(l.Button,{type:"primary",icon:t.jsx(he.SearchOutlined,{}),onClick:J,style:{width:"100%"},children:"Search"})})]}),t.jsx("div",{style:{marginTop:16},children:t.jsx(l.Table,{columns:pe,pagination:!1,dataSource:Array.isArray(H?.data)?H.data:[],size:"small",rowKey:(M,z)=>M?.id??M?.issue_id??M?.fees_receipt_id??z,loading:b,scroll:{x:"max-content"},summary:M=>{const z=M.reduce((W,f)=>W+Number(f?.late_fine??0),0),ce=M.reduce((W,f)=>W+Number(f?.is_returned??0),0);return t.jsxs(l.Table.Summary.Row,{children:[t.jsx(l.Table.Summary.Cell,{colSpan:4,children:t.jsxs("span",{style:{fontWeight:700},children:["Total Book: ",M.length]})}),t.jsx(l.Table.Summary.Cell,{colSpan:2,children:t.jsxs("span",{style:{fontWeight:700},children:["Not Return: ",Number(M.length-ce)]})}),t.jsx(l.Table.Summary.Cell,{colSpan:2,children:t.jsxs("span",{style:{fontWeight:700},children:["Return: ",ce]})}),t.jsx(l.Table.Summary.Cell,{colSpan:1,children:t.jsxs("span",{style:{fontWeight:700},children:["Total Fine:",z.toLocaleString("en-IN")]})})]})}})})]})]})}const Wo=({routes:e=[],onNavigate:n})=>t.jsx(l.Row,{gutter:[16,16],children:e.map((r,a)=>t.jsx(l.Col,{xs:24,md:8,lg:8,children:t.jsx(oe,{children:t.jsx(wr,{icon:r?.icon??"",title:r?.title??"",path:r?.path??"",onClick:n})})},`${a}route001`))});exports.AddBook=No;exports.AddDriver=ko;exports.AdmissionEnquiry=po;exports.AssignStudentToTransport=Po;exports.AssignVehicles=wo;exports.BookList=Fo;exports.ErpDashboard=ea;exports.IssueReturn=Lo;exports.LibraryAssignStudent=qo;exports.LibraryCategory=zo;exports.LibraryReport=Vo;exports.MenuSubmenu=Ls;exports.RoutePage=Wo;exports.RouteTimeTable=Io;exports.Stoppage=Uo;exports.TransportRoutes=ho;exports.TransportVehicles=mo;exports.setBaseUrl=Bs;
59
+ `}),e.jsx(ne,{children:e.jsx("div",{style:{display:"flex",justifyContent:"space-between"},children:e.jsx(En,{data:{tableRef:$}})})}),e.jsxs("div",{className:"ubk-table-shell",ref:$,style:{marginTop:12},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,flexWrap:"wrap",marginBottom:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"#222"},children:[e.jsx("span",{children:"Show"}),e.jsx(o.Select,{size:"small",value:x.rowsPerPage,onChange:N=>q(1,N),options:[10,25,50,100].map(N=>({label:N,value:N})),style:{width:72}}),e.jsx("span",{children:"entries"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,color:"#222"},children:"Search:"}),e.jsx(o.Input,{size:"small",allowClear:!0,value:V,onChange:N=>{Z(N.target.value),R(G=>({...G,page:1}))},placeholder:"Enter search keyword",prefix:e.jsx(ce.SearchOutlined,{style:{color:"#a3a8cf"}}),style:{width:220,borderWidth:"0 0 1px 0",borderRadius:0,background:"transparent"}})]})]}),e.jsx("div",{className:"print-only",children:e.jsx(Gt,{})}),oe]}),i&&e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,marginTop:16,flexWrap:"wrap"},children:[e.jsx("div",{style:{fontSize:12,color:"#222"},children:`Showing ${ae} to ${de} of ${Be} entries`}),e.jsx(o.Pagination,{current:x.page,pageSize:x.rowsPerPage,total:Be||0,showSizeChanger:!1,onChange:q})]})]})]})},Ci=({token:t,type:n})=>{const[a,r]=l.useState({page:1,rowsPerPage:10}),s="api/branchapi/frontoffice/enquirytablelist",i=s.includes("?")?s.endsWith("?")||s.endsWith("&")?"":"&":"?",d=`${s}${i}page=${a.page}&per_page=${a.rowsPerPage}`,{isLoading:u,data:b,error:h}=X(t?[d,t]:null,([C,S])=>te(C,S)),[p,y]=l.useState(!1),v=(C,S)=>{r({page:C,rowsPerPage:parseInt(S)})},w=async C=>{},m=C=>{console.log("dsdsdsdsd",C),y(C)},c=()=>{},f=[{key:"Edit",status:!0},{key:"Delete",status:!0},{key:"View",status:!1}],T=l.useMemo(()=>[{id:"1",name:"Name",selector:"name",sortable:!0,sorter:{compare:(C,S)=>C.name.localeCompare(S.name)}},{id:"2",name:"Phone",selector:"contact",sortable:!0,sorter:(C,S)=>(C.contact||"").localeCompare(S.contact||"")},{id:"6",name:"Description",selector:"description",sortable:!0,sorter:(C,S)=>(C.description||"").localeCompare(S.description||"")},{id:"3",name:"Source",selector:"source_name",sortable:!0,sorter:(C,S)=>(C.source_name||"").localeCompare(S.source_name||"")},{id:"4",name:"Enquiry Date",selector:"date",sortable:!0,sorter:(C,S)=>new Date(C.date)-new Date(S.date)},{id:"5",name:"Next Follow Up Date",selector:"follow_up_date",sortable:!0,sorter:(C,S)=>new Date(C.follow_up_date)-new Date(S.follow_up_date)}]);return e.jsx("div",{children:e.jsx(Ee,{parentCallback:v,data:{newData:b,columns:T,action:!0,Loading:u,error:h,open:p,viewDetails:c,deleteTodoMutation:w,DrawerUpdate:m,ActionView:f}})})},Ti={minWidth:160,height:36,padding:"0 28px",border:"none",borderRadius:999,background:"linear-gradient(90deg, #f59b1c 0%, #ef3e7b 100%)",color:"#fff",fontSize:14,fontWeight:700,textTransform:"uppercase",cursor:"pointer",boxShadow:"none"},me=l.forwardRef(({error:t,success:n,disabled:a,style:r,...s},i)=>e.jsx("div",{className:"form-group",style:{marginBottom:0},children:e.jsx("input",{...s,ref:i,disabled:a,style:{...Ti,opacity:a?.7:1,cursor:a?"not-allowed":"pointer",...r||{}}})})),at=({id:t,funcName:n,disabled:a=!1})=>{const r="Data",[s,i]=l.useState(!1),d=()=>{i(!0),n(t),o.message.success(`${r} deleted successfully!`)},u=()=>{o.message.info(`Deletion of ${r} cancelled`)};return e.jsx(o.Popconfirm,{title:`Delete ${r}?`,description:`Are you sure you want to delete ${r}?`,onConfirm:d,onCancel:u,okText:"Yes",cancelText:"No",disabled:a||s,children:e.jsx(o.Button,{danger:!0,disabled:a,loading:s,icon:e.jsx(ce.DeleteOutlined,{}),size:"small"})})},We=t=>({optimisticData:n=>[...n.data,t],populateCache:(n,a)=>[...a.data,n]}),$e=t=>({optimisticData:n=>n.data.filter(a=>a.id!==t),populateCache:(n,a)=>a.data.filter(r=>r.id!==t)}),er={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function Ri({token:t}){const[n,a]=l.useState({pagination:{current:1,pageSize:10}}),[r,s]=l.useState(!1),[i,d]=l.useState(null),u=`api/branchapi/Transport/routeTableList?page=${n.pagination.current}&per_page=${n.pagination.pageSize}`,b="api/branchapi/Transport/addroute",h="api/branchapi/Transport/editroute",p="api/branchapi/Transport/deleteroute",{isLoading:y,data:v,error:w,mutate:m}=X(t?[u,t]:null,([I,O])=>te(I,O)),c=async(I,O)=>{try{await m(Ge(I,O,t),We(O)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch{A.error("Failed to add the new item.",{duration:1e3})}},f=I=>{I.preventDefault();const O=new FormData(I.target);c(b,O),I.target.reset()},T=(I,O)=>{a(k=>({...k,pagination:{current:I,pageSize:parseInt(O,10)}}))},C=async I=>{try{await m(nt(p,I,t),$e(I)),A.success("Success! Deleted item.",{duration:1e3})}catch{A.error("Failed to delete the item.",{duration:1e3})}},S=I=>{d(I),s(!0)},j=async I=>{try{await ft(h,I,t),await m(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null)}catch{A.error("Failed to update the item.",{duration:1e3})}},g=async I=>{I.preventDefault();const O=new FormData(I.target);O.append("id",i?.id),j(O)},_=[{title:"Route Title",dataIndex:"route_title",key:"route_title",sorter:{compare:(I,O)=>I.name.localeCompare(O.route_title)}},{title:"Fare (Monthly)",dataIndex:"fare",key:"fare",sorter:{compare:(I,O)=>I.fare-O.fare}},{title:"Note",dataIndex:"note",key:"note",sorter:{compare:(I,O)=>I.note.localeCompare(O.note)}},{title:"Action",key:"action",render:(I,O)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>S(O),style:{padding:2}}),e.jsx(at,{id:O?.id,funcName:C})]})}],P=i?.route_title?`Edit ${i.route_title}`:"Edit Route";return e.jsxs("div",{children:[e.jsx(o.Drawer,{open:r,title:P,placement:"right",width:420,onClose:()=>{s(!1),d(null)},children:e.jsx("form",{onSubmit:g,children:e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(z,{type:"text",name:"title",label:"Title",defaultValue:i?.route_title||"",required:"required"}),e.jsx(z,{type:"number",name:"fare",label:"Fare (Monthly)",defaultValue:i?.fare||"",required:"required"}),e.jsx(z,{type:"text",name:"note",label:"Note",defaultValue:i?.note||""}),e.jsx("div",{style:{display:"none"},children:e.jsx(z,{type:"text",name:"no_of_vehicle",label:"Note"})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null)},style:er,children:"Cancel"})]})]})})}),e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(ne,{pt:5,pb:1,children:e.jsxs("div",{children:[e.jsx("div",{children:e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Route"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:f,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(z,{type:"text",name:"title",label:"Title",placeholder:"Mumbai to Delhi",required:"required"}),e.jsx(z,{type:"number",name:"fare",label:"Fare (Monthly)",required:"required"}),e.jsx(z,{type:"text",name:"note",label:"Note"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Save",color:"primary"}),e.jsx(o.Button,{type:"text",htmlType:"reset",style:er,children:"Cancel"})]})]})})})]})}),e.jsx("div",{style:{marginTop:24},children:e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Route List"})}),e.jsx(ne,{children:e.jsx(Ee,{parentCallback:T,data:{newData:v,columns:_,columnstype:"antd",action:!1,Loading:y,error:w,deleteTodoMutation:C}})})]})})]})})]})}const tr={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function Di({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(!1),[i,d]=l.useState(null),u=`api/branchapi/Transport/vehiclesTableList?page=${n.page}&per_page=${n.rowsPerPage}`,b="api/branchapi/Transport/addvehicles",h="api/branchapi/Transport/editvehicle",p="api/branchapi/Transport/deletevehicle",{isLoading:y,data:v,error:w,mutate:m}=X(t?[u,t]:null,([I,O])=>te(I,O)),c=async(I,O)=>{try{await m(Ge(I,O,t),We(O)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch{A.error("Failed to add the new item.",{duration:1e3})}},f=I=>{I.preventDefault();const O=new FormData(I.target);c(b,O),I.target.reset()},T=async I=>{try{await m(nt(p,I,t),$e(I)),A.success("Success! Deleted item.",{duration:1e3})}catch{A.error("Failed to delete the item.",{duration:1e3})}},C=I=>{d(I),s(!0)},S=async I=>{try{await ft(h,I,t),await m(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null)}catch{A.error("Failed to update the item.",{duration:1e3})}},j=async I=>{I.preventDefault();const O=new FormData(I.target);O.append("id",i?.id),S(O)},g=(I,O)=>{a({page:I,rowsPerPage:parseInt(O,10)})},_=[{title:"Vehicle Number",dataIndex:"vehicle_no",key:"vehicle_no",sorter:{compare:(I,O)=>I.vehicle_no.localeCompare(O.vehicle_no)}},{title:"Vehicle Model",dataIndex:"vehicle_model",key:"vehicle_model",sorter:{compare:(I,O)=>I.vehicle_model.localeCompare(O.vehicle_model)}},{title:"Max Seating Capacity",dataIndex:"seating_capacity",key:"seating_capacity",sorter:{compare:(I,O)=>I.seating_capacity-O.seating_capacity}},{title:"Manufacture Year",dataIndex:"manufacture_year",key:"manufacture_year",sorter:{compare:(I,O)=>I.manufacture_year-O.manufacture_year}},{title:"Gps Url",key:"gps_url",sorter:{compare:(I,O)=>I.gps_url.localeCompare(O.gps_url)},render:(I,O)=>e.jsx("span",{title:O?.gps_url??"",style:{display:"inline-block",maxWidth:220,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:O?.gps_url})},{title:"Note",dataIndex:"note",key:"note",sorter:{compare:(I,O)=>I.note.localeCompare(O.note)}},{title:"Action",key:"action",render:(I,O)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>C(O),style:{padding:2}}),e.jsx(at,{id:O?.id,funcName:T})]})}],P=i?.vehicle_no?`Edit ${i.vehicle_no}`:"Edit Vehicle";return e.jsxs("div",{children:[e.jsx(o.Drawer,{open:r,title:P,placement:"right",width:420,onClose:()=>{s(!1),d(null)},children:e.jsx("form",{onSubmit:j,children:e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(z,{type:"text",name:"number",label:"Vehicle Number",defaultValue:i?.vehicle_no||"",required:"required"}),e.jsx(z,{type:"text",name:"model",label:"Vehicle Model",defaultValue:i?.vehicle_model||""}),e.jsx(z,{type:"number",name:"manufacture_year",label:"Manufacture Year",defaultValue:i?.manufacture_year||""}),e.jsx(z,{type:"number",name:"seating_capacity",label:"Max Seating Capacity",defaultValue:i?.seating_capacity||""}),e.jsx(z,{type:"text",name:"gps_url",label:"Gps Url",defaultValue:i?.gps_url||""}),e.jsx(z,{type:"text",name:"note",label:"Note",defaultValue:i?.note||""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null)},style:tr,children:"Cancel"})]})]})})}),e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(ne,{pt:5,pb:1,children:e.jsxs("div",{children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Vehicle"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:f,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(z,{type:"text",name:"number",label:"Vehicle Number",required:"required"}),e.jsx(z,{type:"text",name:"model",label:"Vehicle Model"}),e.jsx(z,{type:"number",name:"manufacture_year",label:"Manufacture Year"}),e.jsx(z,{type:"number",name:"seating_capacity",label:"Max Seating Capacity"}),e.jsx(z,{type:"text",name:"gps_url",label:"Gps Url"}),e.jsx(z,{type:"text",name:"note",label:"Note"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Save",color:"primary"}),e.jsx(o.Button,{type:"text",htmlType:"reset",style:tr,children:"Cancel"})]})]})})})]}),e.jsx("div",{style:{marginTop:24},children:e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Vehicle List"})}),e.jsx(ne,{children:e.jsx(Ee,{parentCallback:g,data:{newData:v,columns:_,columnstype:"antd",action:!1,Loading:y,error:w,deleteTodoMutation:T}})})]})})]})})]})}var Ai=rs();const Gn=ts(Ai),cs=()=>{};class ga extends l.Component{state={value:this.props.value||this.props.defaultValue||""};selectRef=null;setSelectRef=n=>{this.selectRef=n};componentDidUpdate(n){n.value!==this.props.value&&this.setState({value:this.props.value})}onChange=(n,a)=>{this.props.onChange(n,a),this.setState({value:n})};getValue=()=>{const{value:n}=this.state;return n?Array.isArray(n)?n.length?"valid":"":typeof n=="object"?n.value||"":n:""};render(){const{SelectComponent:n,required:a,...r}=this.props;console.log("sdsdsfsdddddddd",{...r});const{isDisabled:s}=this.props,i=!s;return e.jsxs("div",{children:[e.jsx(n,{...r,ref:this.setSelectRef,onChange:this.onChange}),i&&e.jsx("input",{tabIndex:-1,autoComplete:"off",style:{opacity:0,width:"100%",height:0,display:"block"},value:this.getValue(),onChange:cs,onFocus:()=>this.selectRef.focus(),required:a})]})}}ga.defaultProps={onChange:cs};ga.protoTypes={selectComponent:Gn.func.isRequired,onChange:Gn.func,required:Gn.bool};const Oi={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},Pi={menuPortal:t=>({...t,zIndex:9999}),control:(t,n)=>({...t,minHeight:40,height:40,fontSize:"14px",border:"none",borderBottom:`1px solid ${n.isFocused?"#222":"#d9d9d9"}`,borderRadius:0,boxShadow:"none",backgroundColor:"transparent",transition:"border-color 0.2s ease","&:hover":{border:"none",borderBottom:`1px solid ${n.isFocused?"#222":"#a8a8a8"}`}}),valueContainer:t=>({...t,height:40,padding:"0 0",display:"flex",alignItems:"center"}),input:t=>({...t,margin:0,padding:0}),indicatorSeparator:()=>({display:"none"}),indicatorsContainer:t=>({...t,height:40}),dropdownIndicator:(t,n)=>({...t,padding:"0 0 0 8px",color:n.isFocused?"#222":"#b5b5b5"}),singleValue:t=>({...t,color:"#222",marginLeft:0}),placeholder:t=>({...t,color:"#9f9f9f",marginLeft:0}),option:(t,n)=>({...t,fontSize:"14px",backgroundColor:n.isFocused?"#f8f8f8":"#fff",color:"#222",cursor:"pointer"})},us=t=>e.jsx(Ar.components.Input,{...t,className:"input-cont",required:!!t?.selectProps?.required}),Ii=t=>e.jsx(ga,{...t,SelectComponent:Ar,components:{Input:us},options:t.options}),le=l.forwardRef(({...t},n)=>e.jsxs("div",{className:"form-group",style:{height:"auto"},children:[t.label&&e.jsx("label",{className:"labelfont",style:Oi,children:t?.label}),e.jsx(Ii,{components:{Input:us},menuPortalTarget:document.body,styles:Pi,className:"input-cont",...t,ref:n})]})),Ei={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},nr=({dataIndex:t,title:n,record:a,children:r,isEditable:s,...i})=>e.jsx("td",{...i,children:s?e.jsx("div",{style:{display:"flex",marginLeft:"5%"},children:r}):r});function ki({token:t}){const[n,a]=l.useState(!1),[r,s]=l.useState({pagination:{current:1,pageSize:50}}),[i,d]=l.useState(null),[u,b]=l.useState([]),h="api/branchapi/Transport/getrouteDropdown",p="api/branchapi/Transport/getvehicleDropdown",y="api/branchapi/Transport/getchechkedVehicleData",v="api/branchapi/Transport/assignedVehicleTable",w="api/branchapi/transport/assignvehicle",m="api/branchapi/Transport/deleteassignvehicle",c=i?`${y}?route_id=${i}`:null,{isLoading:f,data:T,mutate:C}=X(t?[`${v}?page=${r.pagination.current}&per_page=${r.pagination.pageSize}`,t]:null,([R,$])=>te(R,$)),{data:S}=X(t&&h?[h,t]:null,([R,$])=>te(R,$)),{data:j}=X(t&&p?[p,t]:null,([R,$])=>te(R,$)),g=t&&c?[c,t]:null,{isLoading:_,data:P}=X(g,([R,$])=>te(R,$)),{Status:I="Failed",pagination:{total_rows:O=0}={}}=T||{},{data:k=[]}=I==="Success"?T:{},E=l.useMemo(()=>{const R=S?.data??S??[];return Array.isArray(R)?R:[]},[S]),D=l.useMemo(()=>{const R=j?.data??j??[];return(Array.isArray(R)?R:[]).map(q=>{if(q==null)return null;if(typeof q=="string"||typeof q=="number")return{label:String(q),value:q};const Q=q.value??q.vehicle_id??q.id??q.vehicleID,ue=q.label??q.vehicle_name??q.vehicle_no??q.vehicle_number??q.name??String(Q??"");return Q==null||ue===""?null:{label:String(ue),value:Q}}).filter(Boolean)},[j]),F=l.useMemo(()=>{const R=P?.data??P??[];return(Array.isArray(R)?R:[]).map(q=>q?.value??q?.vehicle_id??q?.id??q).filter(q=>q!=null)},[P]);l.useEffect(()=>{b(F)},[F,n]);const V=async(R,$,q)=>{try{await C(Ge(R,$,t),We($)),c&&X.mutate(g),a(Q=>!Q),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch(Q){A.error(Q?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},Z=R=>{R.preventDefault();const $=new FormData;$.append("route_id",i??""),u.length?u.forEach(q=>$.append("vehicle_ids[]",q)):$.append("vehicle_ids[]",""),V(w,$)},U=R=>{s($=>({...$,pagination:{current:R,pageSize:$.pagination.pageSize}}))},Y=async R=>{try{await C(nt(m,R,t),$e(R)),c&&X.mutate(g),A.success("Success! Deleted item.",{duration:1e3})}catch{A.error("Failed to delete the item.",{duration:1e3})}},W=[{title:"Route",dataIndex:"route_title"},{title:"Vehicle Numbers",render:(R,$,q)=>e.jsx(e.Fragment,{children:$.children.map((Q,ue,se)=>e.jsx("span",{children:`${Q.vehicle_name} ${ue+1===se.length?"":","}`},`${ue}vehicle001`))})},{title:"Action",render:(R,$,q)=>e.jsx(e.Fragment,{children:e.jsx(at,{id:$?.route_id,funcName:Y})})}],L=R=>{const $=["route_id","index"];for(let q=0;q<$.length;q++)if(R[$[q]])return R[$[q]]},x=R=>{const{children:$=[]}=R||{},q=[{title:"Vehicle Name",dataIndex:"vehicle_name",onCell:Q=>({isEditable:!0})},{title:"Driver Name",dataIndex:"driver_name",onCell:Q=>({isEditable:!0})},{title:"Driver Contact",dataIndex:"driver_contact_number",onCell:Q=>({isEditable:!0})},{title:"Driver Licence",dataIndex:"Driver_licence",onCell:Q=>({isEditable:!0})},{title:"Start Time",dataIndex:"start_time",onCell:Q=>({isEditable:!0})},{title:"Drop Time",dataIndex:"drop_time",onCell:Q=>({isEditable:!0})},{title:"Type",dataIndex:"type",onCell:Q=>({isEditable:!0})}];return e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx("div",{style:{width:"95%",margin:8},children:e.jsx(o.Table,{components:{body:{cell:nr}},expandable:{childrenColumnName:"changed"},bordered:!0,size:"small",columns:q,rowKey:Q=>L(Q)+"cell01",dataSource:$,pagination:!1})})})};return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(ne,{pt:5,pb:1,children:e.jsxs("div",{children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Assign Vehicle"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:Z,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(220px, 320px) 1fr auto",gap:20,alignItems:"end"},children:[e.jsx("div",{children:e.jsx(le,{options:E,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",required:!0,allowSelectAll:!1,onChange:R=>{d(R?.value??null),a($=>!$)}})}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:{display:"block",marginBottom:6,fontSize:14,fontWeight:500,color:"#222"},children:"Vehicles"}),e.jsx("div",{style:{borderBottom:"1px solid #d9d9d9",paddingBottom:8,maxHeight:140,overflow:"auto"},children:e.jsx(o.Checkbox.Group,{style:{display:"flex",flexWrap:"wrap",gap:12},options:D,value:u,onChange:R=>b(R),disabled:!i||_})},`check001${n}`)]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Save",color:"primary"}),e.jsx(o.Button,{type:"text",htmlType:"button",onClick:()=>{d(null),b([]),a(R=>!R)},style:Ei,children:"Cancel"})]})]})})})]}),e.jsx("div",{style:{marginTop:24},children:e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Vehicle List"})}),e.jsx(ne,{style:{padding:"10px 16px"},children:e.jsx(o.Table,{components:{body:{cell:nr}},columns:W,bordered:!0,rowKey:R=>L(R),dataSource:Array.isArray(k)?k:[],loading:f,expandable:{expandedRowRender:x,childrenColumnName:"changed"},pagination:{current:r.pagination.current,pageSize:r.pagination.pageSize,total:O,showSizeChanger:!0,onChange:U,onShowSizeChange:(R,$)=>{s(q=>({...q,pagination:{current:1,pageSize:$}}))},showTotal:(R,$)=>`${$[0]}-${$[1]} of ${R} items`}})})]})})]})})]})}const Mi={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},Fi={width:"100%",height:"40px",background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"},Bi=(t,n,a)=>n?t>ye(a).endOf("day")||t<ye(n).endOf("day"):!1,ps=l.forwardRef(function(n,a){const{...r}=n;return e.jsxs("div",{className:"form-group",children:[r.Desplay&&e.jsx("label",{className:`labelfont ${r.classnme?r.classnme:""}`,style:Mi,children:r.Desplay}),e.jsx(o.DatePicker,{...r,style:{...Fi,...r.style||{}},className:"form-group",disabledDate:s=>Bi(s,r.sessionStart||r.minDate?.subtract(1,"day").format("YYYY-MM-DD"),r.sessionEnd||r.maxDate?.format("YYYY-MM-DD")),required:!0,ref:a})]})}),ar={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},Qn=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]},Xn=(t,n,a)=>{if(n==null||n==="")return null;const r=t.find(s=>String(s.value)===String(n));return r||(a?{label:String(a),value:n}:{label:String(n),value:n})},Ni=()=>{try{return JSON.parse(localStorage.getItem("genrall_settings")||"{}")?.currency_symbol??""}catch{return""}},$i=t=>{if(t==null||t===""||t==="null"||t==="undefined")return"";if(Array.isArray(t))return t.filter(a=>a!=null&&a!==""&&String(a).toLowerCase()!=="null"&&String(a).toLowerCase()!=="undefined").join(", ");const n=String(t).trim();return!n||n.toLowerCase()==="null"||n.toLowerCase()==="undefined"?"":n};function Ui({token:t,assignmentId:n,studentName:a,onClose:r,onSuccess:s}){const i="api/branchapi/Transport/showRouteAssignStudent",d="api/branchapi/Transport/updateTransportRoutesStudent",u="api/branchapi/Transport/getrouteDropdown",b="api/branchapi/Transport/getvehicleListByRouteIdwithCount",h="api/branchapi/Transport/getStoppageDropdown",p="api/branchapi/Transport/routeShowdata",[y,v]=l.useState(null),[w,m]=l.useState(0),[c,f]=l.useState(0),{data:T,isLoading:C}=X(t&&n?[`${i}?id=${n}`,t]:null,([B,H])=>te(B,H)),S=l.useMemo(()=>{if(!T||T?.Status&&T.Status!=="Success")return null;const B=T?.data??T;return Array.isArray(B)?B[0]??null:B},[T]);l.useEffect(()=>{const B=S?.fk_route_id??S?.route_id;B!=null&&v(B)},[S]);const j=t&&y?`${b}?route_id=${y}`:null,g=t&&y?`${p}?id=${y}`:null,_=t&&y?`${h}?route_id=${y}`:null,{data:P}=X(t&&u?[u,t]:null,([B,H])=>te(B,H)),{data:I,isLoading:O}=X(j?[j,t]:null,([B,H])=>te(B,H)),{data:k,isLoading:E}=X(_?[_,t]:null,([B,H])=>te(B,H)),{data:D}=X(g?[g,t]:null,([B,H])=>te(B,H)),F=l.useMemo(()=>Qn(P),[P]),V=l.useMemo(()=>Qn(I),[I]),Z=l.useMemo(()=>Qn(k),[k]),U=D?.data?.[0]?.fare??S?.fare??S?.rootCost??S?.rootcost,Y=Ni(),W=a||[S?.firstname,S?.lastname].filter(Boolean).join(" ")||"",L=(B,H)=>{switch(H){case"route_id":v(B?.value??null),m(ie=>ie+1),f(ie=>ie+1);break;case"vehicle_id":f(ie=>ie+1);break}},x=async B=>{B.preventDefault();const H=new FormData(B.target);H.append("id",n);try{await ft(d,H,t),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s?.(),r?.()}catch(ie){A.error(ie?.message??"Failed to update the item.",{duration:1e3})}};if(C||!(S&&!C&&(!y||!O&&!E)))return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:48},children:e.jsx(o.Spin,{})});if(!S)return e.jsxs("div",{style:{padding:"8px 0"},children:[e.jsx("p",{style:{color:"#666",fontSize:14,marginBottom:16},children:"Unable to load assignment details. Please try again."}),e.jsx(o.Button,{type:"text",onClick:r,style:ar,children:"Close"})]});const $=S.fk_route_id??S.route_id,q=Xn(F,$,S.route_title),Q=Xn(V,S.vehicle_id,S.vehicle_name??S.vehicle_no),ue=Xn(Z,S.stop_id,S.stop_name??S.stoppage_name),se=S.start_date?ye(S.start_date):ye(),pe=$i(S?.service_push);return e.jsx("form",{onSubmit:x,children:e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(z,{type:"text",name:"title",label:"Student",defaultValue:W,readOnly:!0}),e.jsx("input",{type:"hidden",name:"student_id",value:S.fk_student_id??S.student_id??""}),e.jsx(le,{options:F,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"fk_route_id",required:!0,allowSelectAll:!1,defaultValue:q,onChange:B=>L(B,"route_id")}),e.jsx(le,{options:V,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",required:!0,allowSelectAll:!1,defaultValue:Q,onChange:B=>L(B,"vehicle_id")},`edit-vehicle-${w}`),e.jsx(le,{options:Z,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Stop",name:"stop_id",required:!0,allowSelectAll:!1,defaultValue:ue},`edit-stop-${c}`),e.jsx(z,{type:"text",label:"Route Cost",value:U!=null?`${Y}${U}`:"",readOnly:!0}),e.jsx("input",{type:"hidden",name:"rootCost",value:U??""}),e.jsx(ps,{defaultValue:se,Desplay:"Start Date",name:"start_date",placement:"bottomRight",format:"YYYY-MM-DD",allowClear:!1}),e.jsx(z,{type:"text",name:"puse_service",label:"Pause Service",defaultValue:pe,placeholder:"e.g. 01, 02, 03"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginTop:4},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:r,style:ar,children:"Cancel"})]})]})},`edit-${n}-${w}`)}const rr={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},Ut=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]},Li=t=>t||"",qi=()=>{try{return JSON.parse(localStorage.getItem("genrall_settings")||"{}")?.currency_symbol??""}catch{return""}},zi=t=>{const n=String(t??"Drawer").trim().toLowerCase().replace(/\s+/g,"");return n==="page"||n==="sendpage"?"page":"drawer"},Vi=(t,n)=>{const a=n||"/TransportDashboard/EditAssignStudentTransport?id={id}",r=t?.id??"",s=encodeURIComponent(String(r));if(a.includes("{id}"))return a.replaceAll("{id}",s);if(a.includes(":id"))return a.replace(":id",s);try{const d=new URL(a,"http://localhost");if(d.searchParams.has("id"))return d.searchParams.set("id",String(r)),`${d.pathname}${d.search}${d.hash}`}catch{}const i=a.includes("?")?"&":"?";return`${a}${i}id=${s}`};function Yi({token:t,editType:n,onNavigate:a,editPagePath:r}){const i=zi(n)==="drawer",d="api/branchapi/academy/classdropdownlist",u="api/branchapi/academy/sectionoftheClass",b="api/branchapi/Transport/routeStudentList",h="api/branchapi/Transport/getrouteDropdown",p="api/branchapi/Transport/getvehicleListByRouteIdwithCount",y="api/branchapi/Transport/getStoppageDropdown",v="api/branchapi/Transport/routeShowdata",w="api/branchapi/Transport/assignTransportRoutesStudent",m="api/branchapi/transport/removeStudentTransport",[c,f]=l.useState(null),[T,C]=l.useState(!1),[S,j]=l.useState(!1),[g,_]=l.useState(null),[P,I]=l.useState(null),[O,k]=l.useState(null),[E,D]=l.useState(null),[F,V]=l.useState(!1),[Z,U]=l.useState(!1),[Y,W]=l.useState({page:1,rowsPerPage:50}),[L,x]=l.useState(null),[R,$]=l.useState(!1),[q,Q]=l.useState(null),[ue,se]=l.useState(null),pe=(fe,xe)=>{switch(xe){case"class_id":x(`${u}?class_id=${fe.value}`),C(Xe=>!Xe);break;case"route_id":I(`${p}?route_id=${fe.value}`),k(`${v}?id=${fe.value}`),se(fe.value),V(Xe=>!Xe);break;case"vehicle_id":D(`${y}?route_id=${ue}`),U(Xe=>!Xe);break}},B=fe=>{if(i){_(fe),j(!0);return}const xe=Vi(fe,r);if(typeof a=="function"){a(xe,fe);return}typeof window<"u"&&xe&&window.location.assign(xe)},H=()=>{j(!1),_(null)},ie=g?`Edit — ${g.firstname??""} ${g.lastname??""}`.trim():"Edit Student Transport",{data:je}=X(t&&d?[d,t]:null,([fe,xe])=>te(fe,xe)),{data:K}=X(t&&L?[L,t]:null,([fe,xe])=>te(fe,xe)),{data:ve}=X(t&&P?[P,t]:null,([fe,xe])=>te(fe,xe)),{data:Pe}=X(t&&E?[E,t]:null,([fe,xe])=>te(fe,xe)),{data:ke}=X(t&&O?[O,t]:null,([fe,xe])=>te(fe,xe)),{data:rt}=X(t&&h?[h,t]:null,([fe,xe])=>te(fe,xe)),st=t&&c?`${c}&page=${Y.page}&per_page=${Y.rowsPerPage}`:null,{isLoading:Qe,error:He,data:Ue,mutate:Ke}=X(st?[st,t]:null,([fe,xe])=>te(fe,xe)),Be=l.useMemo(()=>Ut(je),[je]),Oe=l.useMemo(()=>Ut(K),[K]),Fe=l.useMemo(()=>Ut(ve),[ve]),ot=l.useMemo(()=>Ut(Pe),[Pe]),ae=l.useMemo(()=>Ut(rt),[rt]),de=ke?.data?.[0]?.fare,oe=async fe=>{try{await Ke(nt(m,fe,t),$e(fe)),A.success("Success! Deleted item.",{duration:1e3})}catch{A.error("Failed to delete the item.",{duration:1e3})}},N=[{title:"Route Status",key:"route_status",render:(fe,xe)=>xe.fk_route_id?e.jsx("span",{children:xe.route_title}):e.jsx("span",{children:"Not Assigned"})},{title:"Vehicle Assign Date",dataIndex:"start_date",key:"start_date",render:(fe,xe)=>Li(xe.start_date)},{title:"Admission No",dataIndex:"admission_no",key:"admission_no"},{title:"Roll No",dataIndex:"roll_no",key:"roll_no"},{title:"Name",key:"name",render:(fe,xe)=>`${xe.firstname} ${xe.lastname}`},{title:"Class",dataIndex:"class",key:"class"},{title:"Section",dataIndex:"section",key:"section"},{title:"Mobileno",dataIndex:"mobileno",key:"mobileno"},{title:"Action",key:"action",render:(fe,xe)=>e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:xe.fk_route_id?e.jsxs(e.Fragment,{children:[e.jsx(at,{id:xe?.id,funcName:oe}),e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>B(xe),style:{padding:2}})]}):e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.PlusOutlined,{}),onClick:()=>_e(xe.student_id),style:{padding:2}})})}],G=async(fe,xe)=>{try{await Ke(Ge(fe,xe,t),We(xe)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),$(!1),mt()}catch{A.error("Failed to add the new item.",{duration:1e3})}},re=fe=>{fe.preventDefault();const xe=fe?.target?.class_id?.value,Xe=fe?.target?.section_id?.value;f(`${b}?cID=${xe}&sID=${Xe}`),W(J=>({...J,page:1}))},we=(fe,xe)=>{W({page:fe,rowsPerPage:parseInt(xe,10)})},_e=fe=>{Q(fe),$(!0)},lt=fe=>{fe.preventDefault();const xe=new FormData(fe.target);G(w,xe)},mt=()=>{$(!1),I(null),k(null),D(null),se(null)},gt=qi();return e.jsxs("div",{children:[i&&e.jsx(o.Drawer,{open:S,title:ie,placement:"right",width:420,destroyOnClose:!0,onClose:H,children:g?.id&&e.jsx(Ui,{token:t,assignmentId:g.id,studentName:`${g.firstname??""} ${g.lastname??""}`.trim(),onClose:H,onSuccess:()=>Ke()})}),e.jsx(o.Modal,{open:R,title:"Assign Student to Transport",onCancel:mt,footer:null,width:640,destroyOnClose:!0,children:e.jsx("form",{onSubmit:lt,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20},children:[e.jsx(le,{options:ae,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"fk_route_id",required:!0,allowSelectAll:!1,onChange:fe=>pe(fe,"route_id")}),e.jsx(le,{options:Fe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",required:!0,allowSelectAll:!1,onChange:fe=>pe(fe,"vehicle_id")},`vehicle001${F}`),e.jsx(le,{options:ot,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Stop",name:"stop_id",required:!0,allowSelectAll:!1},`stop001${Z}`),e.jsx(ps,{defaultValue:ye(),Desplay:"Start Date",name:"start_date",placement:"bottomRight",format:"YYYY-MM-DD"}),e.jsx("input",{type:"hidden",value:q??"",name:"student_id"}),e.jsx(z,{className:"noDisplay",type:"text",name:"rootCost",value:de??""}),e.jsxs("div",{style:{gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:de!=null?`${gt}${de} — Assign`:"Assign",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:mt,style:rr,children:"Cancel"})]})]})})}),e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(ne,{pt:5,pb:1,children:e.jsxs("div",{children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Search Students"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:re,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{options:Be,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",onChange:fe=>pe(fe,"class_id"),name:"class_id",required:!0,allowSelectAll:!1}),e.jsx(le,{options:Oe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",allowSelectAll:!1,name:"section_id",required:!0},`section1${T}`),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Search",color:"primary"}),e.jsx(o.Button,{type:"text",htmlType:"button",onClick:()=>{f(null),x(null),C(fe=>!fe)},style:rr,children:"Cancel"})]})]})})})]}),c&&e.jsx("div",{style:{marginTop:24},children:e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Student List"})}),e.jsx(ne,{children:e.jsx(Ee,{parentCallback:we,data:{newData:Ue,columns:N,columnstype:"antd",action:!1,Loading:Qe,error:He,deleteTodoMutation:oe,pageController:Y}})})]})})]})})]})}const sr={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},rn={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"};function Wi({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:50}),[r,s]=l.useState(!1),[i,d]=l.useState(null),[u,b]=l.useState(""),[h,p]=l.useState(""),[y,v]=l.useState(""),[w,m]=l.useState(!1),c=`api/branchapi/Transport/getdriverTable?page=${n.page}&per_page=${n.rowsPerPage}`,f="api/branchapi/Transport/add_driver",T="api/branchapi/Transport/edit_driver",C="api/branchapi/Transport/deletedriver",S="api/branchapi/staff/uploadDocuments",j=l.useMemo(()=>String(S).startsWith("http")?S:`${pt()??""}${String(S).replace(/^\/+/,"")}`,[S]),g=pt()??"",{isLoading:_,data:P,error:I,mutate:O}=X(t?[c,t]:null,([L,x])=>te(L,x)),k=async(L,x)=>{try{await Ge(L,x,t),await O(),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),b("")}catch(R){A.error(R?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},E=L=>{L.preventDefault();const x=new FormData(L.target);k(f,x),L.target.reset()},D=async L=>{try{await O(nt(C,L,t),$e(L)),A.success("Success! Deleted item.",{duration:1e3})}catch{A.error("Failed to delete the item.",{duration:1e3})}},F=L=>{d(L),b(L?.image??""),s(!0)},V=async L=>{try{await ft(T,L,t),await O(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null),b("")}catch(x){A.error(x?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},Z=L=>{L.preventDefault();const x=new FormData(L.target);x.append("id",i?.id??""),V(x)},U=(L,x)=>{a({page:L,rowsPerPage:parseInt(x,10)})},Y=[{title:"Driver Name",dataIndex:"name",key:"name",sorter:{compare:(L,x)=>String(L?.name??"").localeCompare(String(x?.name??""))}},{title:"Driver Licence",dataIndex:"Driver_licence",key:"Driver_licence",sorter:{compare:(L,x)=>String(L?.Driver_licence??"").localeCompare(String(x?.Driver_licence??""))}},{title:"Contact",dataIndex:"contact_number",key:"contact_number",sorter:{compare:(L,x)=>Number(L?.contact_number??0)-Number(x?.contact_number??0)}},{title:"Address",dataIndex:"address",key:"address",sorter:{compare:(L,x)=>String(L?.address??"").localeCompare(String(x?.address??""))}},{title:"Image",key:"image",width:100,render:(L,x)=>{const R=x?.image?`${g}staff/document/${x.image}`:"";return R?e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(o.Image,{width:80,src:R,preview:{visible:!1,onVisibleChange:()=>{m(!0),p(R),v(x?.name??"Driver")}}})}):null}},{title:"Action",key:"action",render:(L,x)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>F(x),style:{padding:2}}),e.jsx(at,{id:x?.id,funcName:D})]})}],W=i?.name?`Edit ${i.name}`:"Edit Driver";return e.jsxs("div",{children:[e.jsx(o.Drawer,{open:r,title:W,placement:"right",width:420,destroyOnClose:!0,onClose:()=>{s(!1),d(null),b("")},children:e.jsx("form",{onSubmit:Z,children:e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(z,{type:"text",name:"name",label:"Driver Name",defaultValue:i?.name??"",required:"required"}),e.jsx(z,{type:"text",name:"Driver_licence",label:"Driver Licence",defaultValue:i?.Driver_licence??"",required:"required"}),e.jsx(z,{type:"number",name:"contact_number",label:"Driver Contact",defaultValue:i?.contact_number??"",required:"required"}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:rn,children:"Address"}),e.jsx(o.Input.TextArea,{name:"address",defaultValue:i?.address??"",rows:2,style:{width:"100%",border:0,borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none",paddingLeft:0,paddingRight:0}})]}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:rn,children:"Image"}),e.jsx(o.Upload,{maxCount:1,action:j,headers:t?{Authorization:t}:void 0,onChange:L=>{if(L?.file?.status!=="done")return;const x=L?.file?.response,R=x?.data??x?.filename??x?.file??x?.path??"";R&&b(String(R))},children:e.jsx(o.Button,{icon:e.jsx(ce.UploadOutlined,{}),disabled:!j,children:"Upload"})}),e.jsx("input",{type:"hidden",name:"file",value:u})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null),b("")},style:sr,children:"Cancel"})]})]})})}),e.jsx(o.Modal,{zIndex:9999,open:w,title:y,footer:null,onCancel:()=>m(!1),children:e.jsx("img",{alt:"preview",style:{width:"100%"},src:h})}),e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(ne,{pt:5,pb:1,children:e.jsxs("div",{children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Driver"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:E,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(z,{type:"text",name:"name",label:"Driver Name",required:"required"}),e.jsx(z,{type:"text",name:"Driver_licence",label:"Driver Licence",required:"required"}),e.jsx(z,{type:"number",name:"contact_number",label:"Driver Contact",required:"required"}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:rn,children:"Address"}),e.jsx(o.Input.TextArea,{name:"address",rows:2,style:{width:"100%",border:0,borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none",paddingLeft:0,paddingRight:0}})]}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:rn,children:"Image"}),e.jsx(o.Upload,{maxCount:1,action:j,headers:t?{Authorization:t}:void 0,onChange:L=>{if(L?.file?.status!=="done")return;const x=L?.file?.response,R=x?.data??x?.filename??x?.file??x?.path??"";R&&b(String(R))},children:e.jsx(o.Button,{icon:e.jsx(ce.UploadOutlined,{}),disabled:!j,children:"Upload"})}),e.jsx("input",{type:"hidden",name:"file",value:u})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Save",color:"primary"}),e.jsx(o.Button,{type:"text",htmlType:"reset",onClick:()=>b(""),style:sr,children:"Cancel"})]})]})})})]}),e.jsx("div",{style:{marginTop:24},children:e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Driver List"})}),e.jsx(ne,{children:e.jsx(Ee,{parentCallback:U,data:{newData:P,columns:Y,columnstype:"antd",action:!1,Loading:_,error:I,deleteTodoMutation:D}})})]})})]})})]})}const or={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},Tt={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},sn={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"},ir=[{label:"Pick",value:"pick"},{label:"Drop",value:"drop"}],on=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]};function Hi({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:50}),[r,s]=l.useState(!1),[i,d]=l.useState(!1),[u,b]=l.useState(null),[h,p]=l.useState(null),[y,v]=l.useState(null),[w,m]=l.useState(null),[c,f]=l.useState(ye()),[T,C]=l.useState(ye()),[S,j]=l.useState("pick"),[g,_]=l.useState(!1),[P,I]=l.useState(null),[O,k]=l.useState(null),[E,D]=l.useState(!1),[F,V]=l.useState(null),[Z,U]=l.useState(null),[Y,W]=l.useState(null),[L,x]=l.useState(null),[R,$]=l.useState(ye()),[q,Q]=l.useState(ye()),[ue,se]=l.useState("pick"),pe=`api/branchapi/Transport/assignRouteTimeList?page=${n.page}&per_page=${n.rowsPerPage}`,B="api/branchapi/Transport/assignRouteTime",H="api/branchapi/Transport/editAssignRouteTime",ie="api/branchapi/Transport/deleteAssignRouteTime",je="api/branchapi/Transport/driverDropdown",K="api/branchapi/transport/routeTimetableShowdata",ve="api/branchapi/Transport/getrouteDropdown",Pe="api/branchapi/Transport/getvehicleDropdown",{isLoading:ke,data:rt,error:st,mutate:Qe}=X(t?[pe,t]:null,([J,he])=>te(J,he)),{data:He}=X(t&&ve?[ve,t]:null,([J,he])=>te(J,he)),{data:Ue}=X(t&&je?[je,t]:null,([J,he])=>te(J,he)),Ke=l.useMemo(()=>u?`${Pe}?route_id=${u}`:null,[u,Pe]),{data:Be}=X(t&&Ke?[Ke,t]:null,([J,he])=>te(J,he)),Oe=l.useMemo(()=>on(He),[He]),Fe=l.useMemo(()=>on(Ue),[Ue]),ot=l.useMemo(()=>on(Be),[Be]),ae=(J,he)=>{a({page:J,rowsPerPage:parseInt(he,10)})},de=async J=>{J.preventDefault();const he=new FormData(J.target);he.set("route_id",h?.value??u??""),he.set("driver_id",y?.value??""),he.set("vehicle_id",w?.value??""),he.set("start_time",c?c.format("h:mm a"):""),he.set("drop_time",T?T.format("h:mm a"):""),he.set("type",S);try{await Ge(B,he,t),await Qe(),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),J.target.reset(),b(null),p(null),v(null),m(null),d(Ze=>!Ze),f(ye()),C(ye()),j("pick"),s(Ze=>!Ze)}catch(Ze){A.error(Ze?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},oe=async J=>{try{await nt(ie,J,t),await Qe(),A.success("Success! Deleted item.",{duration:1e3})}catch(he){A.error(he?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},N=J=>{I(J),_(!0);const he=J?.id??J?.route_time_id??J?.routeId??null;k(he);const Ze=J?.route_id??J?.routeId??J?.fk_route_id;V(Ze??null),U(Oe.find(xt=>xt?.value===(Ze??J?.route_id))??null),W(Fe.find(xt=>xt?.value===(J?.driver_id??J?.driverId))??null),x(null),D(xt=>!xt),$(J?.start_time?ye(J.start_time,["h:mm a","HH:mm"]):ye()),Q(J?.drop_time?ye(J.drop_time,["h:mm a","HH:mm"]):ye()),se(J?.type??"pick")},G=l.useMemo(()=>{if(!O)return null;const J=String(K).includes("?")?"&":"?";return`${K}${J}id=${encodeURIComponent(String(O))}`},[O,K]),{data:re,isLoading:we}=X(t&&G?[G,t]:null,([J,he])=>te(J,he)),_e=l.useMemo(()=>{const J=re?.data??re;return Array.isArray(J)?J[0]??null:Array.isArray(J?.data)?J.data[0]??null:J??null},[re]),lt=l.useMemo(()=>F?`${Pe}?route_id=${F}`:null,[F,Pe]),{data:mt}=X(t&&lt?[lt,t]:null,([J,he])=>te(J,he)),gt=l.useMemo(()=>on(mt),[mt]);l.useEffect(()=>{if(!_e)return;const J=_e?.route_id??_e?.fk_route_id??_e?.routeId;V(J??null),U(Oe.find(he=>he?.value===J)??null),W(Fe.find(he=>he?.value===_e?.driver_id)??null),x(null),$(_e?.start_time?ye(_e.start_time,["h:mm a","HH:mm"]):ye()),Q(_e?.drop_time?ye(_e.drop_time,["h:mm a","HH:mm"]):ye()),se(_e?.type??"pick"),D(he=>!he)},[Fe,_e,Oe]),l.useEffect(()=>{if(!_e)return;const J=_e?.vehicle_id??_e?.vehicleId;J&&x(gt.find(he=>he?.value===J)??null)},[_e,gt]);const fe=async J=>{if(J.preventDefault(),!O)return;const he=new FormData(J.target);he.set("id",String(O)),he.set("route_id",Z?.value??F??""),he.set("driver_id",Y?.value??""),he.set("vehicle_id",L?.value??""),he.set("start_time",R?R.format("h:mm a"):""),he.set("drop_time",q?q.format("h:mm a"):""),he.set("type",ue);try{await ft(H,he,t),await Qe(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),_(!1),I(null)}catch(Ze){A.error(Ze?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},xe=[{title:"Route Name",dataIndex:"route_title",key:"route_title"},{title:"Driver Name",dataIndex:"driver_name",key:"driver_name"},{title:"Vehicle Name",dataIndex:"vehicle_name",key:"vehicle_name"},{title:"Start Time",dataIndex:"start_time",key:"start_time"},{title:"End Time",dataIndex:"drop_time",key:"drop_time"},{title:"Type",dataIndex:"type",key:"type"},{title:"Action",key:"action",render:(J,he)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>N(he),style:{padding:2}}),e.jsx(at,{id:he?.id??he?.routeId??he?.route_time_id,funcName:oe})]})}],Xe=P?.route_title?`Edit ${P.route_title}`:"Edit Route Time";return e.jsxs("div",{children:[e.jsx(o.Drawer,{open:g,title:Xe,placement:"right",width:420,destroyOnClose:!0,onClose:()=>{_(!1),I(null),k(null),V(null),U(null),W(null),x(null)},children:e.jsx("form",{onSubmit:fe,children:e.jsxs("div",{style:{display:"grid",gap:20,opacity:we?.6:1},children:[e.jsx(le,{options:Oe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",required:!0,allowSelectAll:!1,value:Z,onChange:J=>{V(J?.value??null),U(J??null),x(null),D(he=>!he)}}),e.jsx(le,{options:Fe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Driver",name:"driver_id",required:!0,allowSelectAll:!1,value:Y,onChange:J=>W(J??null)}),e.jsx(le,{options:gt,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",required:!0,allowSelectAll:!1,value:L,onChange:J=>x(J??null)},`edit-vehicle-${E}`),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:Tt,children:"Start Time"}),e.jsx(o.TimePicker,{value:R,onChange:J=>$(J),use12Hours:!0,format:"h:mm a",allowClear:!1,style:sn})]}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:Tt,children:"Drop Time"}),e.jsx(o.TimePicker,{value:q,onChange:J=>Q(J),use12Hours:!0,format:"h:mm a",allowClear:!1,style:sn})]}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:Tt,children:"Type"}),e.jsx("div",{style:{borderBottom:"1px solid #d9d9d9",paddingBottom:6},children:e.jsx(o.Radio.Group,{options:ir,optionType:"button",buttonStyle:"solid",value:ue,onChange:J=>se(J.target.value)})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{_(!1),I(null)},style:or,children:"Cancel"})]})]})})}),e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(ne,{pt:5,pb:1,children:e.jsxs("div",{children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Route Time Table"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:de,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{options:Oe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",value:h,onChange:J=>{b(J?.value??null),p(J??null),m(null),d(he=>!he)},allowSelectAll:!1,required:!0}),e.jsx(le,{options:Fe,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Driver",name:"driver_id",value:y,onChange:J=>v(J??null),allowSelectAll:!1,required:!0}),e.jsx(le,{options:ot,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vehicle",name:"vehicle_id",value:w,onChange:J=>m(J??null),allowSelectAll:!1,required:!0},`vehicle-${i}`),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:Tt,children:"Start Time"}),e.jsx(o.TimePicker,{value:c,onChange:J=>f(J),use12Hours:!0,format:"h:mm a",allowClear:!1,style:sn})]}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:Tt,children:"Drop Time"}),e.jsx(o.TimePicker,{value:T,onChange:J=>C(J),use12Hours:!0,format:"h:mm a",allowClear:!1,style:sn})]}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("label",{className:"labelfont",style:Tt,children:"Type"}),e.jsx("div",{style:{borderBottom:"1px solid #d9d9d9",paddingBottom:6},children:e.jsx(o.Radio.Group,{options:ir,optionType:"button",buttonStyle:"solid",value:S,onChange:J=>j(J.target.value)})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Add",color:"primary"}),e.jsx(o.Button,{type:"text",htmlType:"reset",onClick:()=>{b(null),p(null),v(null),m(null),d(J=>!J),f(ye()),C(ye()),j("pick"),s(J=>!J)},style:or,children:"Cancel"})]})]})},`form-${r}`)})]}),e.jsx("div",{style:{marginTop:24},children:e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Route Time List"})}),e.jsx(ne,{children:e.jsx(Ee,{parentCallback:ae,data:{newData:rt,columns:xe,columnstype:"antd",action:!1,Loading:ke,error:st,deleteTodoMutation:oe}})})]})})]})})]})}const Ki={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},lr={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},dr={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"},cr=({dataIndex:t,title:n,record:a,children:r,isEditable:s,...i})=>e.jsx("td",{...i,children:s?e.jsx("div",{style:{display:"flex",marginLeft:"5%"},children:r}):r});let ur=2;function Ji({token:t}){const[n,a]=l.useState([]),[r,s]=l.useState(null),[i,d]=l.useState({pagination:{current:1,pageSize:50}}),{isLoading:u,data:b,mutate:h}=X(t?[`api/branchapi/transport/getrouteStoppageData?page=${i.pagination.current}&per_page=${i.pagination.pageSize}`,t]:null,([k,E])=>te(k,E)),{Status:p="Failed",pagination:{total_rows:y=0}={}}=b||{},{data:v=[]}=p==="Success"?b:{},{data:w}=X(t?["api/branchapi/Transport/getrouteDropdown",t]:null,([k,E])=>te(k,E)),m=l.useMemo(()=>{const k=w?.data??w??[];return Array.isArray(k)?k:[]},[w]),{data:c}=X(t&&r?["api/branchapi/transport/getrouteStoppageData?route_id="+r,t]:null,([k,E])=>te(k,E)),{Status:f="Failed"}=c||{},T=async(k,E)=>{try{await h(Ge(k,E,t),We(E)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch{A.error("Failed to add the new item.",{duration:1e3})}},C=k=>{k.preventDefault();const E=new FormData(k.target);T("/branchapi/transport/addstoppageToRoute",E)},S=()=>{a(k=>[...k,{idKey:ur++}])},j=k=>{if(n.length===1)return;const E=[...n];E.splice(k,1),a(E)},g=k=>{d(E=>({...E,pagination:{current:k,pageSize:E.pagination.pageSize}}))},_=async k=>{const E="/branchapi/Transport/deletevehicle";try{await h(nt(E,k,t),$e(k)),A.success("Success! Deleted item.",{duration:1e3})}catch{A.error("Failed to delete the item.",{duration:1e3})}};l.useEffect(()=>{if(f==="Success"){const k=Array.isArray(c?.data)?c.data:[];k.length>0?a(k):r&&a([{idKey:ur++}])}},[f,c,r]);const P=k=>{const{children:E=[]}=k||{},D=[{title:"Stop Name",dataIndex:"stop_name",onCell:F=>({isEditable:!0})},{title:"Pick Time",dataIndex:"pickup_time",onCell:F=>({isEditable:!0})},{title:"Drop Name",dataIndex:"drop_time",onCell:F=>({isEditable:!0})}];return e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx("div",{style:{width:"95%",margin:8},children:e.jsx(o.Table,{components:{body:{cell:cr}},expandable:{childrenColumnName:"changed"},bordered:!0,columns:D,rowKey:F=>I(F)+"cell01",dataSource:E,pagination:!1})})})},I=k=>{const E=["id","index"];for(let D=0;D<E.length;D++)if(k[E[D]])return k[E[D]]},O=[{title:"Route",dataIndex:"route_title"},{title:"Stoppages",render:(k,E,D)=>e.jsx(e.Fragment,{children:E.children?.map((F,V,Z)=>e.jsx("span",{children:`${F.stop_name} ${V+1===Z.length?"":","}`},`${V}vehicle001`))})},{title:"Action",render:(k,E,D)=>e.jsx(e.Fragment,{children:e.jsx(at,{id:E?.route_id,funcName:_})})}];return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsxs(ne,{pt:5,pb:1,children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Route Time Table"})}),e.jsx(ne,{px:3,pb:2,children:e.jsxs("form",{onSubmit:C,children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx("div",{children:e.jsx(le,{options:m,value:m.find(k=>k.value===r)??null,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Route",name:"route_id",onChange:k=>{s(k?.value??null),a([])},allowSelectAll:!1,required:!0})}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-start",gap:12},children:r&&e.jsx("button",{type:"button",style:{padding:2,border:"none",background:"transparent",cursor:"pointer",marginBottom:8},title:"Add Row",onClick:S,children:e.jsx(ce.PlusCircleOutlined,{style:{fontSize:24,color:"#28a745"}})})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[e.jsx(me,{type:"submit",value:"Add",color:"primary"}),e.jsx(o.Button,{type:"text",htmlType:"button",onClick:()=>{s(null),a([])},style:Ki,children:"Cancel"})]})]}),e.jsx("div",{style:{marginTop:20},children:n.length>0&&n.map((k,E)=>{const D=k.pickup_time?ye(k.pickup_time,"h:mm a"):ye(),F=k.drop_time?ye(k.drop_time,"h:mm a"):ye();return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr)) auto",gap:16,alignItems:"end",marginBottom:12},children:[e.jsx("div",{children:e.jsx(z,{defaultValue:k.stop_name??"",type:"text",name:`stoppage[${E}][name]`,label:"Place Name*",required:"required"})}),e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",style:lr,children:"Pick Time"}),e.jsx(o.TimePicker,{defaultValue:D,use12Hours:!0,format:"h:mm a",name:`stoppage[${E}][pickTime]`,allowClear:!1,style:dr})]}),e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",style:lr,children:"Drop Time"}),e.jsx(o.TimePicker,{defaultValue:F,use12Hours:!0,format:"h:mm a",name:`stoppage[${E}][drop_time]`,allowClear:!1,style:dr})]}),e.jsx("div",{style:{marginBottom:8},children:n.length>1&&e.jsx("button",{type:"button",style:{padding:2,border:"none",background:"transparent",cursor:"pointer"},onClick:()=>j(E),children:e.jsx(ce.MinusCircleOutlined,{style:{fontSize:20,color:"#dc3545"}})})})]},k.idKey?k.idKey+"exp":k.id+"exp")})})]})}),e.jsx(ne,{mx:2,mt:1,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Stoppage List"})}),e.jsx(ne,{style:{padding:"10px 16px"},children:e.jsx(o.Table,{components:{body:{cell:cr}},columns:O,bordered:!0,size:"small",rowKey:k=>I(k),dataSource:v,loading:u,expandable:{expandedRowRender:P,childrenColumnName:"changed"},pagination:{current:i.pagination.current,pageSize:i.pagination.pageSize,total:y,showSizeChanger:!0,onChange:g,onShowSizeChange:(k,E)=>{d(D=>({...D,pagination:{current:1,pageSize:E}}))},showTotal:(k,E)=>`${E[0]}-${E[1]} of ${k} items`}})})]})]})}const Gi=(t,n)=>{const a=String(t??"").replace(/\/+$/,""),r=String(n).replace(/^\/+/,"");return`${a}/${r}`};function Qi({token:t}){const n=t??localStorage.getItem("authToken")??"",[a,r]=l.useState(null),[s,i]=l.useState(null),[d,u]=l.useState(null),[b,h]=l.useState(null),[p,y]=l.useState(null),[v,w]=l.useState(null),[m,c]=l.useState(null),f="api/branchapi/library/bookCategorydropdown",T="api/branchapi/academy/classdropdownlist",C="api/branchapi/Academy/getClassSubjectdropdown",S="api/branchapi/library/addBook",j="api/branchapi/library/uploadcsv",{data:g}=X(n?[f,n]:null,([D,F])=>te(D,F)),{data:_}=X(n&&T?[T,n]:null,([D,F])=>te(D,F)),{data:P}=X(n&&C?[C,n]:null,([D,F])=>te(D,F)),I=l.useMemo(()=>Gi(pt(),j),[j]),O=async D=>{D.preventDefault();const F=new FormData(D.target);F.set("cat_id",p?.value??""),F.set("class_id",v?.value??""),F.set("subject_id",m?.value??"");try{await Ge(S,F,n),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"}),D.target.reset(),y(null),w(null),c(null)}catch(V){A.error(V?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},k=async D=>{if(D.preventDefault(),!a){A.error("Please select a CSV file.",{duration:1e3});return}const F=new FormData;F.append("file",a),F.append("cat_id",s?.value??""),F.append("class_id",d?.value??""),F.append("subject_id",b?.value??"");try{const V=await De.post(I,F,{headers:{Authorization:n,"Content-type":"multipart/form-data"}});V?.data?.Status==="Failed"?A.error(String(V?.data?.msg??"Upload failed."),{duration:1e3}):(A.success(String(V?.data?.msg??"Uploaded."),{duration:1e3,icon:"🚀"}),r(null),D.target.reset(),i(null),u(null),h(null))}catch(V){A.error(V?.response?.data?.msg??"Upload failed.",{duration:1e3})}},E=()=>{fetch("/books.csv").then(D=>{D.blob().then(F=>{const V=window.URL.createObjectURL(F);let Z=document.createElement("a");Z.href=V,Z.download="/books.csv",Z.click()})})};return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsxs(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Book in Bulk"}),extra:e.jsx(o.Button,{type:"link",icon:e.jsx(ce.DownloadOutlined,{}),onClick:E,children:"Download Sample"}),children:[e.jsx(o.Divider,{children:"Information"}),e.jsx(o.Typography.Paragraph,{style:{marginBottom:16},children:"1. Your CSV data should be in the format below. The first line of your CSV file should be the column headers as in the table example. Also make sure that your file is UTF-8 to avoid unnecessary encoding problems."}),e.jsx("form",{onSubmit:k,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{options:g,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category",allowSelectAll:!1,name:"cat_id",required:!0,value:s,onChange:D=>i(D??null)}),e.jsx(le,{options:_,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",name:"class_id",allowSelectAll:!1,value:d,onChange:D=>u(D??null)}),e.jsx(le,{options:P,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Subjects",name:"subject_id",allowSelectAll:!1,value:b,onChange:D=>h(D??null)}),e.jsx(z,{type:"file",label:"Upload CSV",name:"csv",accept:".csv",onChange:D=>r(D.target.files?.[0]??null),required:!0}),e.jsx(me,{type:"submit",value:"Save",color:"primary"})]})})]}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Book"}),children:e.jsx("form",{onSubmit:O,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(z,{type:"text",label:"Book Name",name:"title",required:!0}),e.jsx(z,{type:"text",label:"Author",name:"author",required:!0}),e.jsx(z,{type:"text",label:"Publication",name:"publisher"}),e.jsx(z,{type:"number",label:"Qty",name:"quantity",required:!0}),e.jsx(z,{type:"number",label:"Book Price",name:"price",required:!0}),e.jsx(z,{type:"number",label:"Fine Per Day",name:"fine",required:!0}),e.jsx(z,{type:"text",label:"Barcode",name:"barcode"}),e.jsx(le,{options:g,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category",allowSelectAll:!1,name:"cat_id",required:!0,value:p,onChange:D=>y(D??null)}),e.jsx(le,{options:_,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",name:"class_id",allowSelectAll:!1,value:v,onChange:D=>w(D??null)}),e.jsx(le,{options:P,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Subjects",name:"subject_id",allowSelectAll:!1,value:m,onChange:D=>c(D??null)}),e.jsx(me,{type:"submit",value:"Save",color:"primary"})]})})})]})}const Zn={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},ea=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]};function Xi({token:t}){const n=t??localStorage.getItem("authToken")??"",[a,r]=l.useState([]),[s,i]=l.useState([]),d=l.useRef(),u={selectedRowKeys:a,onChange:(B,H)=>{r(B),i(H)}},b=Vt.useReactToPrint({contentRef:d,documentTitle:"Book Barcodes"}),h=()=>{if(!(typeof window>"u")){if(!s.length){A.error("Select at least one book to print.",{duration:1e3});return}if(!d.current){A.error("Nothing to print.",{duration:1e3});return}b?.()}},[p,y]=l.useState(!1),[v,w]=l.useState(null),[m,c]=l.useState(null),[f,T]=l.useState(null),[C,S]=l.useState(null),[j,g]=l.useState({page:1,rowsPerPage:10}),_=(B,H)=>{g({page:B,rowsPerPage:parseInt(H,10)})},P="api/branchapi/library/booktable",I="api/branchapi/library/deletebooks",O="api/branchapi/library/editbook",k=`${P}?page=${j.page}&per_page=${j.rowsPerPage}`,{isLoading:E,error:D,data:F,mutate:V}=X(n?[k,n]:null,([B,H])=>te(B,H)),Z="api/branchapi/library/bookCategorydropdown",U="api/branchapi/academy/classdropdownlist",Y="api/branchapi/Academy/getClassSubjectdropdown",{data:W}=X(n?[Z,n]:null,([B,H])=>te(B,H)),{data:L}=X(n&&U?[U,n]:null,([B,H])=>te(B,H)),{data:x}=X(n&&Y?[Y,n]:null,([B,H])=>te(B,H)),R=l.useMemo(()=>ea(W),[W]),$=l.useMemo(()=>ea(L),[L]),q=l.useMemo(()=>ea(x),[x]),Q=async B=>{try{await nt(I,B,n),await V(),A.success("Success! Deleted item.",{duration:1e3})}catch(H){A.error(H?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},ue=B=>{w(B??null);const H=B?.cat_id??B?.fk_cat_id??B?.category_id,ie=B?.class_id??B?.fk_class_id,je=B?.subject_id??B?.fk_subject_id;c(R.find(K=>K?.value===H)??null),T($.find(K=>K?.value===ie)??null),S(q.find(K=>K?.value===je)??null),y(!0)},se=async B=>{B.preventDefault();const H=v?.id??v?.book_id??v?._id;if(!H)return;const ie=new FormData(B.target);ie.set("id",String(H)),ie.set("cat_id",m?.value??""),ie.set("class_id",f?.value??""),ie.set("subject_id",C?.value??"");try{await ft(O,ie,n),await V(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),y(!1),w(null)}catch(je){A.error(je?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},pe=l.useMemo(()=>[{title:"Name",dataIndex:"book_title",key:"book_title",width:220,ellipsis:!0,fixed:"left"},{title:"Barcode",dataIndex:"barcode",key:"barcode",width:140,responsive:["sm"]},{title:"Publisher",dataIndex:"publish",key:"publish",width:160,responsive:["lg"]},{title:"Author",dataIndex:"author",key:"author",width:160,responsive:["lg"]},{title:"Class",dataIndex:"class_name",key:"class_name",width:140,responsive:["xl"]},{title:"Subject",dataIndex:"subject_name",key:"subject_name",width:160,responsive:["xl"]},{title:"Avl Qty",dataIndex:"available_qty",key:"available_qty",width:90},{title:"Book Price",dataIndex:"perunitcost",key:"perunitcost",width:120,responsive:["xl"]},{title:"Fine Amount",dataIndex:"fine_amount",key:"fine_amount",width:120,responsive:["xl"]},{title:"Category",dataIndex:"cat_name",key:"cat_name",width:160,responsive:["xl"]},{title:"Action",key:"action",width:140,fixed:"right",render:(B,H)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>ue(H),style:{padding:2}}),e.jsx(o.Button,{type:"text",size:"small",danger:!0,onClick:()=>Q(H?.id??H?.book_id??H?._id),style:{padding:"2px 6px"},children:"Delete"})]})}],[R,$,Q,q]);return e.jsxs("div",{style:{},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Drawer,{open:p,title:"Edit Book",placement:"right",width:520,destroyOnClose:!0,onClose:()=>{y(!1),w(null)},children:e.jsx("form",{onSubmit:se,children:e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsx(z,{label:"Book Name",name:"title",defaultValue:v?.book_title??"",required:!0}),e.jsx(z,{label:"Author",name:"author",defaultValue:v?.author??"",required:!0}),e.jsx(z,{label:"Publication",name:"publish",defaultValue:v?.publish??""}),e.jsx(z,{label:"Qty",name:"quantity",type:"number",defaultValue:v?.quantity??""}),e.jsx(z,{label:"Book Price",name:"perunitcost",type:"number",defaultValue:v?.perunitcost??""}),e.jsx(z,{label:"Fine Amount",name:"fine_amount",type:"number",defaultValue:v?.fine_amount??""}),e.jsx(z,{label:"Barcode",name:"barcode",defaultValue:v?.barcode??""}),e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",style:Zn,children:"Category"}),e.jsx(le,{options:R,value:m,onChange:B=>c(B??null),name:"cat_id"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",style:Zn,children:"Class"}),e.jsx(le,{options:$,value:f,onChange:B=>T(B??null),name:"class_id"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",style:Zn,children:"Subject"}),e.jsx(le,{options:q,value:C,onChange:B=>S(B??null),name:"subject_id"})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{y(!1),w(null)},children:"Cancel"})]})]})})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Book List"}),extra:s.length>0?e.jsxs(o.Button,{type:"primary",onClick:h,children:["Print Barcode (",s.length,")"]}):null,children:e.jsx(Ee,{parentCallback:_,data:{newData:F,columns:pe,columnstype:"antd",action:!1,Loading:E,error:D,rowSelection:u}})}),e.jsx("div",{style:{position:"fixed",left:-1e4,top:0,width:0,height:0,overflow:"hidden"},children:e.jsx("div",{ref:d,style:{padding:"20px"},children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-start"},children:s.map((B,H)=>e.jsxs("div",{style:{margin:"10px",textAlign:"center",border:"1px dashed black",padding:"10px",borderRadius:"5px",width:"fit-content"},children:[e.jsx("div",{style:{fontSize:"12px",fontWeight:"bold",maxWidth:"200px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:B.book_title}),e.jsx(Or,{value:B.barcode?String(B.barcode):String(B.id),format:"CODE128",width:1.5,height:50,fontSize:12,displayValue:!0})]},H))})})})]})}const Zi=(t,n)=>{const a=String(t??"").replace(/\/+$/,""),r=String(n).replace(/^\/+/,"");return`${a}/${r}`},ht=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]};function el({token:t}){const n=t??localStorage.getItem("authToken")??"",a=JSON.parse(localStorage.getItem("genrall_settings")??"null")?.currency_symbol??"",[r,s]=l.useState("issue"),i=r==="return",[d,u]=l.useState(!1),[b,h]=l.useState(!1),[p,y]=l.useState(null),[v,w]=l.useState([]),[m,c]=l.useState([]),[f,T]=l.useState([]),[C,S]=l.useState(0),[j,g]=l.useState(!1),[_,P]=l.useState(null),[I,O]=l.useState(null),[k,E]=l.useState(null),[D,F]=l.useState(!1),[V,Z]=l.useState("Cash"),[U,Y]=l.useState(""),[W,L]=l.useState(""),[x,R]=l.useState(0),$=l.useRef(null),[q]=o.Form.useForm(),[Q]=o.Form.useForm(),ue="api/branchapi/library/bookCategorydropdown",se="api/branchapi/academy/classdropdownlist",pe="api/branchapi/Academy/getClassSubjectdropdown",{data:B}=X(n?[ue,n]:null,([ee,be])=>te(ee,be)),{data:H}=X(n&&se?[se,n]:null,([ee,be])=>te(ee,be)),{data:ie}=X(n&&pe?[pe,n]:null,([ee,be])=>te(ee,be)),je=l.useMemo(()=>ht(B),[B]),K=l.useMemo(()=>ht(H),[H]),ve=l.useMemo(()=>ht(ie),[ie]),Pe="api/branchapi/library/studentsearchByNameID",ke="api/branchapi/library/booksearchBybookname",rt="api/branchapi/library/issuedBookList",st="api/branchapi/library/issueLibrarybook",Qe="api/branchapi/library/returnedLibrarybook",{trigger:He,data:Ue}=ze(Pe,(ee,be)=>At(ee,be,n)),{trigger:Ke,data:Be}=ze(ke,(ee,be)=>At(ee,be,n)),{trigger:Oe,data:Fe}=ze(rt,(ee,be)=>At(ee,be,n)),{trigger:ot}=ze(i?Qe:st,(ee,be)=>es(ee,be,n)),ae=l.useMemo(()=>ht(Ue),[Ue]),de=l.useMemo(()=>ht(Be),[Be]),oe=l.useMemo(()=>ht(Fe),[Fe]),N=ee=>{const be=ye().format("YYYY-MM-DD");w(Ie=>Ie.some(Mt=>String(Mt?.id)===String(ee?.id))?Ie:[...Ie,{...ee,return_date:ee?.return_date?ee.return_date:be}])},G=ee=>{w(be=>be.filter(Ie=>String(Ie?.id)!==String(ee)))},re=async ee=>{if(n){if(!ee){y(null);return}d||await He({id:ee})}},we=async({search:ee})=>{if(!n||!d)return;const be=await He({id:ee}),Ie=ht(be);Ie.length===1&&(y(Ie[0]),await Oe({id:Ie[0]?.student_id}),q.resetFields())},_e=async(ee,be)=>{y(be??null),w([]),c([]),T([]),S(0),be?.student_id&&await Oe({id:be.student_id}),q.resetFields()},lt=async ee=>{n&&ee&&(b||await Ke({book:ee}))},mt=async({search_book:ee})=>{if(!n||!b)return;const be=await Ke({book:ee,catID:_?.value??"",sID:k?.value??"",cID:I?.value??""}),Ie=ht(be);Ie.length&&(N(Ie[0]),Q.resetFields())},gt=(ee,be)=>{N(be),Q.resetFields()},fe=async()=>{if(!p?.member_id){A.error("Select a student first.",{duration:1e3});return}if(!v.length){A.error("Select at least one book.",{duration:1e3});return}const ee=await ot({member_id:p.member_id,fine:!1,books:v});ee?.Status==="Success"?(A.success(String(ee?.msg??"Success"),{duration:1e3}),w([]),y(null),c([]),T([]),S(0)):A.error(String(ee?.msg??"Failed"),{duration:1e3})},xe=async()=>{if(!p?.member_id){A.error("Select a student first.",{duration:1e3});return}if(!f.length){A.error("Select at least one book to return.",{duration:1e3});return}if(Number(C)>0){F(!0);return}const ee=await ot({member_id:p.member_id,fine:!1,books:JSON.stringify(f)});ee?.Status==="Success"?(A.success(String(ee?.msg??"Success"),{duration:1e3}),c([]),T([]),S(0),await Oe({id:p?.student_id})):A.error(String(ee?.msg??"Failed"),{duration:1e3})},Xe=async()=>{if(!p?.member_id)return;const ee=Math.max(0,Number(C)-Number(x||0)),be={member_id:p.member_id,amount:ee,fine:!0,books:JSON.stringify(f),payment_type:V,notes:U,attchement:W,discount:x||0},Ie=await ot(be);F(!1),Ie?.Status==="Success"?(A.success(String(Ie?.msg??"Success"),{duration:1e3}),c([]),T([]),S(0),R(0),Y(""),L(""),await Oe({id:p?.student_id})):A.error(String(Ie?.msg??"Failed"),{duration:1e3})},J=l.useMemo(()=>Zi(pt(),"api/branchapi/frontoffice/uploadfrontofficeDocument"),[]),he=[{title:"Book",dataIndex:"book_title",key:"book_title",width:220,ellipsis:!0,fixed:"left"},{title:"Author",dataIndex:"author",key:"author",width:180,responsive:["lg"]},{title:"Return Date",key:"return_date",width:160,render:(ee,be)=>e.jsx(o.Input,{value:be?.return_date??"",onChange:Ie=>{const Mt=Ie.target.value;w(Fn=>Fn.map(Bn=>String(Bn?.id)===String(be?.id)?{...Bn,return_date:Mt}:Bn))},placeholder:"YYYY-MM-DD"})},{title:"Action",key:"action",width:120,fixed:"right",render:(ee,be)=>e.jsx(o.Button,{type:"text",danger:!0,onClick:()=>G(be?.id),children:"Remove"})}],Ze={selectedRowKeys:m,onChange:(ee,be)=>{c(ee),T(be);const Ie=(be??[]).reduce((Mt,Fn)=>Mt+Number(Fn?.totalfine??0),0);S(Ie)}},xt=[{title:"Book",dataIndex:"book_title",key:"book_title",width:220,ellipsis:!0,fixed:"left"},{title:"Barcode",dataIndex:"barcode",key:"barcode",width:140,responsive:["sm"]},{title:"Issue Date",dataIndex:"issue_date",key:"issue_date",width:140,responsive:["lg"]},{title:"Due Date",dataIndex:"due_date",key:"due_date",width:140,responsive:["lg"]},{title:"Fine",dataIndex:"totalfine",key:"totalfine",width:120,fixed:"right",render:ee=>e.jsxs("span",{children:[a," ",ee]})}];return e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:D,onCancel:()=>F(!1),footer:null,title:"Payment Options",destroyOnClose:!0,children:e.jsxs("div",{style:{display:"grid",gap:12},children:[e.jsx(o.Radio.Group,{value:V,onChange:ee=>Z(ee.target.value),options:[{label:"Cash",value:"Cash"},{label:"UPI",value:"UPI"},{label:"DD",value:"DD"},{label:"Bank",value:"Bank"},{label:"Internet Banking",value:"Internet Banking"},{label:"Cheque",value:"Cheque"}]}),e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",children:"Note"}),e.jsx(o.Input.TextArea,{rows:3,value:U,onChange:ee=>Y(ee.target.value)})]}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("label",{className:"labelfont",children:"Image Attachment"}),e.jsx(o.Upload,{action:J,headers:{Authorization:n},maxCount:1,onChange:ee=>{if(ee.file.status==="done"){const be=ee.file.response?.data??ee.file.response?.file??"";L(String(be??""))}},children:e.jsx(o.Button,{icon:e.jsx(ce.UploadOutlined,{}),children:"Upload"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",children:"Discount"}),e.jsx(o.Input,{type:"number",value:x,onChange:ee=>R(ee.target.value),placeholder:"0"})]}),e.jsxs(o.Button,{type:"primary",onClick:Xe,children:["Collect ",a,Math.max(0,Number(C)-Number(x||0))]})]})}),e.jsxs(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Issue / Return"}),children:[e.jsxs(o.Row,{gutter:[16,16],align:"middle",children:[e.jsx(o.Col,{xs:24,md:10,children:e.jsx(o.Radio.Group,{value:r,onChange:ee=>{const be=ee.target.value;s(be),w([]),c([]),T([]),S(0)},options:[{label:"Issue",value:"issue"},{label:"Return",value:"return"}],optionType:"button",buttonStyle:"solid"})}),e.jsx(o.Col,{xs:24,md:14,children:e.jsx(o.Form,{form:q,onFinish:we,layout:"vertical",children:e.jsx(o.Form.Item,{name:"search",label:"Search Student",children:e.jsx(o.Space.Compact,{style:{width:"100%"},children:d?e.jsx(o.Input,{autoFocus:!0,addonBefore:e.jsxs(o.Space,{children:[e.jsx(ce.BarcodeOutlined,{}),e.jsx(o.Checkbox,{checked:d,onChange:ee=>u(ee.target.checked)})]}),placeholder:"Scan barcode",allowClear:!0}):e.jsx(o.AutoComplete,{options:ae,onSelect:_e,onSearch:re,style:{width:"100%"},allowClear:!0,children:e.jsx(o.Input,{addonBefore:e.jsxs(o.Space,{children:[e.jsx(ce.BarcodeOutlined,{}),e.jsx(o.Checkbox,{checked:d,onChange:ee=>u(ee.target.checked)})]}),placeholder:"Type student name / id",allowClear:!0})})})})})})]}),p?e.jsxs(e.Fragment,{children:[e.jsx(o.Divider,{}),e.jsxs(o.Row,{gutter:[12,12],children:[e.jsxs(o.Col,{xs:24,md:8,children:[e.jsx(o.Typography.Text,{strong:!0,children:"Name:"})," ",p?.value??""]}),e.jsxs(o.Col,{xs:24,md:8,children:[e.jsx(o.Typography.Text,{strong:!0,children:"Card No:"})," ",p?.library_card_no??""]}),e.jsxs(o.Col,{xs:24,md:8,children:[e.jsx(o.Typography.Text,{strong:!0,children:"Member ID:"})," ",p?.member_id??""]})]})]}):null,e.jsx(o.Divider,{}),i?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{width:"100%",overflowX:"auto"},children:e.jsx("div",{style:{minWidth:760},children:e.jsx(o.Table,{dataSource:oe,columns:xt,rowSelection:Ze,pagination:!1,rowKey:ee=>ee?.id??ee?.issue_id??ee?.barcode??Math.random(),scroll:{x:"max-content"},size:"small"})})}),e.jsx(o.Divider,{}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[e.jsxs(o.Typography.Text,{strong:!0,children:["Total Fine: ",a,C]}),e.jsx(o.Button,{type:"primary",onClick:xe,disabled:!f.length,children:C>0?`Pay Now ${a}${Math.max(0,Number(C)-Number(x||0))}`:"Return Selected"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(o.Row,{gutter:[16,16],align:"middle",children:[e.jsx(o.Col,{xs:24,md:18,children:e.jsx(o.Form,{form:Q,onFinish:mt,layout:"vertical",children:e.jsx(o.Form.Item,{name:"search_book",label:"Search Book",children:e.jsx(o.Space.Compact,{style:{width:"100%"},children:b?e.jsx(o.Input,{autoFocus:!0,disabled:!p,addonBefore:e.jsxs(o.Space,{children:[e.jsx(ce.BarcodeOutlined,{}),e.jsx(o.Checkbox,{checked:b,onChange:ee=>h(ee.target.checked)})]}),placeholder:"Scan barcode",allowClear:!0}):e.jsx(o.AutoComplete,{disabled:!p,options:de,onSelect:gt,onSearch:lt,style:{width:"100%"},allowClear:!0,children:e.jsx(o.Input,{addonBefore:e.jsxs(o.Space,{children:[e.jsx(ce.BarcodeOutlined,{}),e.jsx(o.Checkbox,{checked:b,onChange:ee=>h(ee.target.checked)})]}),placeholder:"Type book name",allowClear:!0})})})})})}),e.jsx(o.Col,{xs:24,md:6,children:e.jsx(o.Button,{style:{width:"100%"},icon:e.jsx(ce.FilterOutlined,{}),onClick:()=>g(!0),children:"Filter"})})]}),e.jsx(o.Drawer,{open:j,onClose:()=>g(!1),title:"Filter",placement:"right",width:380,destroyOnClose:!0,children:e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsx(le,{label:"Category",options:je,value:_,onChange:ee=>P(ee??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,name:"cat_id"}),e.jsx(le,{label:"Class",options:K,value:I,onChange:ee=>O(ee??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,name:"class_id"}),e.jsx(le,{label:"Subjects",options:ve,value:k,onChange:ee=>E(ee??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,name:"subject_id"}),e.jsx(o.Button,{type:"primary",onClick:()=>g(!1),children:"Apply"})]})}),e.jsx(o.Divider,{}),e.jsx("div",{style:{width:"100%",overflowX:"auto"},children:e.jsx("div",{style:{minWidth:720},children:e.jsx(o.Table,{dataSource:v,columns:he,pagination:!1,rowKey:ee=>ee?.id??ee?.book_id??ee?.barcode??Math.random(),scroll:{x:"max-content"},size:"small"})})}),e.jsx(o.Divider,{}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"button",value:"Issue",onClick:fe})})]})]}),e.jsx("div",{ref:$,style:{position:"fixed",left:-1e4,top:0,width:0,height:0,overflow:"hidden"}})]})}const pr=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]};function tl({token:t}){const n=t??localStorage.getItem("authToken")??"",[a,r]=l.useState({page:1,rowsPerPage:10}),[s,i]=l.useState(null),[d,u]=l.useState(null),[b,h]=l.useState(!1),[p,y]=l.useState(!1),[v,w]=l.useState(null),[m,c]=l.useState(!1),f="api/branchapi/academy/classdropdownlist",T="api/branchapi/academy/sectionoftheClass",C="api/branchapi/library/studenttableForLibrary",S="api/branchapi/library/addmembershipforStudent",j="api/branchapi/library/removemembershipforStudent",g=l.useMemo(()=>{if(!s?.value)return null;const x=T.includes("?")?"&":"?";return`${T}${x}class_id=${encodeURIComponent(String(s.value))}`},[T,s?.value]),_=l.useMemo(()=>{if(!s?.value||!d?.value)return null;const x=C.includes("?")?"&":"?";return`${C}${x}cID=${encodeURIComponent(String(s.value))}&sID=${encodeURIComponent(String(d.value))}&page=${a.page}&per_page=${a.rowsPerPage}`},[a.page,a.rowsPerPage,s?.value,d?.value,C]),{data:P}=X(n&&f?[f,n]:null,([x,R])=>te(x,R)),{data:I}=X(n&&g?[g,n]:null,([x,R])=>te(x,R)),{isLoading:O,error:k,data:E,mutate:D}=X(n&&_?[_,n]:null,([x,R])=>te(x,R)),F=l.useMemo(()=>pr(P),[P]),V=l.useMemo(()=>pr(I),[I]),Z=(x,R)=>{r({page:x,rowsPerPage:parseInt(R,10)})},U=x=>{const R=x?.id??x?.student_id??x?.member_id;w(R??null),y(!0),c($=>!$)},Y=async x=>{if(x.preventDefault(),!v)return;const R=new FormData(x.target);R.set("id",String(v));try{await Ge(S,R,n),A.success("Success! Added member.",{duration:1e3,icon:"🎉"}),y(!1),w(null),await D()}catch($){A.error($?.response?.data?.msg??"Failed to add the member.",{duration:1e3})}},W=async x=>{try{await nt(j,x,n),A.success("Success! Removed member.",{duration:1e3}),await D()}catch(R){A.error(R?.response?.data?.msg??"Failed to remove member.",{duration:1e3})}},L=l.useMemo(()=>[{title:"Library Card No",dataIndex:"library_card_no",key:"library_card_no",width:180,ellipsis:!0,fixed:"left"},{title:"Admission No",dataIndex:"admission_no",key:"admission_no",width:140,responsive:["sm"]},{title:"Roll No",dataIndex:"roll_no",key:"roll_no",width:90,responsive:["lg"]},{title:"First Name",dataIndex:"firstname",key:"firstname",width:140,responsive:["sm"]},{title:"Last Name",dataIndex:"lastname",key:"lastname",width:140,responsive:["lg"]},{title:"Class",dataIndex:"class",key:"class",width:120,responsive:["xl"]},{title:"Section",dataIndex:"section",key:"section",width:120,responsive:["xl"]},{title:"Mobile",dataIndex:"mobileno",key:"mobileno",width:140,responsive:["lg"]},{title:"Action",key:"action",width:80,fixed:"right",render:(x,R)=>(console.log("data______________",R),e.jsx("div",{style:{display:"flex",gap:8,alignItems:"center"},children:R?.library_card_no==null?e.jsx(o.Button,{type:"primary",size:"small",icon:e.jsx(ce.UserAddOutlined,{}),onClick:()=>U(R)}):e.jsx(o.Button,{danger:!0,type:"text",size:"small",icon:e.jsx(ce.DeleteOutlined,{}),onClick:()=>W(R?.id??R?.student_id??R?.member_id)})}))}],[W]);return e.jsxs("div",{style:{},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:p,title:"Add Member",onCancel:()=>{y(!1),w(null)},footer:null,destroyOnClose:!0,children:e.jsx("form",{onSubmit:Y,children:e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsx(z,{type:"text",label:"Library Card Number",name:"library_num",required:!0}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Add",color:"primary"})})]})},`add-${m}`)}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Student"}),children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:16,alignItems:"end"},children:[e.jsx(le,{options:F,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",value:s,onChange:x=>{i(x??null),u(null),h(R=>!R)},name:"class_id",required:!0,allowSelectAll:!1}),e.jsx(le,{options:V,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",value:d,onChange:x=>u(x??null),allowSelectAll:!1,name:"section_id",required:!0},`section-${b}`),e.jsx(me,{type:"submit",value:"Search",color:"primary",onClick:()=>{if(!s?.value||!d?.value){A.error("Select class and section.",{duration:1e3});return}r(x=>({...x,page:1}))}})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Students"}),children:e.jsx(Ee,{parentCallback:Z,data:{newData:E,columns:L,columnstype:"antd",action:!1,Loading:O,error:k}})})]})}function nl({token:t}){const n=t??localStorage.getItem("authToken")??"",[a,r]=l.useState({page:1,rowsPerPage:10}),[s]=o.Form.useForm(),[i]=o.Form.useForm(),[d,u]=l.useState(!1),[b,h]=l.useState(null),p="api/branchapi/library/BookCategorytable",y="api/branchapi/library/addBookCategory",v="api/branchapi/library/editBookCategory",w="api/branchapi/library/deleteBookCategory",m=l.useMemo(()=>{const k=p.includes("?")?"&":"?";return`${p}${k}page=${a.page}&per_page=${a.rowsPerPage}`},[p,a.page,a.rowsPerPage]),{isLoading:c,error:f,data:T,mutate:C}=X(n&&m?[m,n]:null,([k,E])=>te(k,E)),S=(k,E)=>{r({page:k,rowsPerPage:parseInt(E,10)})},j=async k=>{const E=new FormData;E.set("title",k?.title??"");try{await Ge(y,E,n),A.success("Success! Added new category.",{duration:1e3,icon:"🎉"}),s.resetFields(),await C()}catch(D){A.error(D?.response?.data?.msg??D?.message??"Failed to add category.",{duration:1e3})}},g=k=>{h(k??null),i.setFieldsValue({title:k?.name??""}),u(!0)},_=()=>{u(!1),h(null),i.resetFields()},P=async k=>{const E=b?.id??b?.category_id??b?.cat_id;if(!E){A.error("Missing category id.",{duration:1e3});return}const D=new FormData;D.set("id",String(E)),D.set("title",k?.title??"");try{await ft(v,D,n),A.success("Success! Updated category.",{duration:1e3,icon:"🚀"}),_(),await C()}catch(F){A.error(F?.response?.data?.msg??F?.message??"Failed to update category.",{duration:1e3})}},I=async k=>{const E=k?.id??k?.category_id??k?.cat_id;if(!E){A.error("Missing category id.",{duration:1e3});return}try{await nt(w,E,n),A.success("Success! Deleted category.",{duration:1e3}),await C()}catch(D){A.error(D?.response?.data?.msg??D?.message??"Failed to delete category.",{duration:1e3})}},O=l.useMemo(()=>[{title:"Category Name",dataIndex:"name",key:"name",ellipsis:!0},{title:"Action",key:"action",width:110,fixed:"right",render:(k,E)=>e.jsxs(o.Space,{size:6,children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>g(E)}),e.jsx(o.Popconfirm,{title:"Remove category?",okText:"Yes",cancelText:"No",onConfirm:()=>I(E),children:e.jsx(o.Button,{danger:!0,type:"text",size:"small",icon:e.jsx(ce.DeleteOutlined,{})})})]})}],[I]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:d,title:"Edit Category",onCancel:_,footer:null,destroyOnClose:!0,children:e.jsxs(o.Form,{form:i,layout:"vertical",onFinish:P,children:[e.jsx(o.Form.Item,{label:"Name",name:"title",rules:[{required:!0,message:"Enter category name"}],children:e.jsx(o.Input,{placeholder:"Enter category name"})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx(o.Button,{onClick:_,children:"Cancel"}),e.jsx(me,{type:"submit",value:"Update",color:"primary"})]})]})}),e.jsxs(o.Row,{gutter:[16,16],children:[e.jsx(o.Col,{xs:24,lg:8,children:e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Category"}),children:e.jsxs(o.Form,{form:s,layout:"vertical",onFinish:j,children:[e.jsx(o.Form.Item,{label:"Name",name:"title",rules:[{required:!0,message:"Enter category name"}],children:e.jsx(o.Input,{placeholder:"Enter category name"})}),e.jsx(me,{type:"submit",value:"Add",color:"primary"})]})})}),e.jsx(o.Col,{xs:24,lg:16,children:e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Category List"}),children:e.jsx(Ee,{parentCallback:S,data:{newData:T,columns:O,columnstype:"antd",action:!1,Loading:c,error:f}})})})]})]})}const ta=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]};function al({token:t}){const[n,a]=l.useState([ye().format("YYYY-MM-DD"),ye().format("YYYY-MM-DD")]),[r,s]=l.useState(null),[i,d]=l.useState(null),[u,b]=l.useState(null),[h,p]=l.useState(!1),[y,v]=l.useState(!1),w="api/branchapi/academy/classdropdownlist",m="api/branchapi/academy/sectionoftheClass",c="api/branchapi/library/memberDropdown",f="api/report/libraryReport/libraryReport",T=l.useMemo(()=>{if(!r?.value)return null;const U=m.includes("?")?"&":"?";return`${m}${U}class_id=${encodeURIComponent(String(r.value))}`},[m,r?.value]),C=l.useMemo(()=>{if(!r?.value)return null;const U=c.includes("?")?"&":"?",Y=`${c}${U}class=${encodeURIComponent(String(r.value))}`;return i?.value?`${Y}&section=${encodeURIComponent(String(i.value))}`:Y},[c,r?.value,i?.value]),{isLoading:S,error:j,data:g,mutate:_}=X(t&&w?[w,t]:null,([U,Y])=>te(U,Y)),{data:P}=X(t&&T?[T,t]:null,([U,Y])=>te(U,Y)),{data:I}=X(t&&C?[C,t]:null,([U,Y])=>te(U,Y)),O=l.useMemo(()=>ta(g),[g]),k=l.useMemo(()=>ta(P),[P]),E=l.useMemo(()=>ta(I),[I]),{trigger:D,data:F}=ze(f,(U,Y)=>ha(U,Y,t));l.useEffect(()=>{(async()=>{v(!0);try{await D({duration:n})}finally{v(!1)}})()},[]);const V=async()=>{v(!0);try{await D({duration:n,class:r?.value??"",section:i?.value??"",student_id:u?.value??""})}finally{v(!1)}},Z=[{title:"Name",dataIndex:"full_name",render:(U,Y)=>e.jsx(o.Typography.Text,{style:{fontSize:12},children:Y?.full_name??""})},{title:"Roll No",dataIndex:"roll_no",render:(U,Y)=>e.jsx(o.Typography.Text,{style:{fontSize:12},children:Y?.roll_no??""})},{title:"Class",dataIndex:"Class",key:"Class",render:(U,Y)=>e.jsxs(o.Typography.Text,{style:{fontSize:12},children:[Y?.class??"","(",Y?.section??"",")"]})},{title:"Book",dataIndex:"book_title",render:(U,Y)=>e.jsx(o.Typography.Text,{style:{fontSize:12},children:Y?.book_title??""})},{title:"Issue Date",key:"date",render:(U,Y,W)=>e.jsx(o.Typography.Text,{style:{fontSize:12},children:Y?.issue_date??""})},{title:"Due Return Date",key:"date",render:(U,Y,W)=>e.jsx(o.Tag,{color:"orange",children:Y?.return_date??""})},{title:"Return Date",key:"date",render:(U,Y,W)=>Y?.retured_by_user?e.jsx(o.Tag,{color:"green",children:Y?.retured_by_user??""}):null},{title:"Return Status",key:"date",render:(U,Y,W)=>String(Y?.is_returned??"")==="1"?e.jsx(o.Tag,{color:"green",children:"Return"}):e.jsx(o.Tag,{color:"red",children:"Not Return"})},{title:"Fine",key:"amount",dataIndex:"late_fine",render:(U,Y,W)=>{const L=Y?.late_fine?Number(Y.late_fine):0;return L?e.jsx(o.Typography.Text,{style:{fontSize:12,color:"#cf1322"},children:L}):null}}];return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsxs(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Library Monthly Report"}),style:{borderRadius:16},children:[e.jsxs(o.Row,{gutter:[16,16],align:"bottom",children:[e.jsx(o.Col,{xs:24,md:8,children:e.jsxs("div",{children:[e.jsx("label",{className:"labelfont",children:"Duration"}),e.jsx(o.DatePicker.RangePicker,{style:{width:"100%"},value:[ye(n[0],"YYYY-MM-DD"),ye(n[1],"YYYY-MM-DD")],format:"YYYY-MM-DD",onChange:(U,Y)=>{Array.isArray(Y)&&Y.length===2&&a([Y[0],Y[1]])}})]})}),e.jsx(o.Col,{xs:24,md:5,children:e.jsx(le,{options:O,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Classes",name:"class_id",value:r,onChange:U=>{s(U??null),d(null),b(null),p(Y=>!Y)},allowSelectAll:!1})}),e.jsx(o.Col,{xs:24,md:5,children:e.jsx(le,{options:k,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",name:"section_id",value:i,onChange:U=>{d(U??null),b(null)},allowSelectAll:!1},`section1${h}`)}),e.jsx(o.Col,{xs:24,md:5,children:e.jsx(le,{options:E,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Student",name:"student",value:u,onChange:U=>b(U??null),allowSelectAll:!1})}),e.jsx(o.Col,{xs:24,md:1,children:e.jsx(o.Button,{type:"primary",icon:e.jsx(ce.SearchOutlined,{}),onClick:V,style:{width:"100%"},children:"Search"})})]}),e.jsx("div",{style:{marginTop:16},children:e.jsx(o.Table,{columns:Z,pagination:!1,dataSource:Array.isArray(F?.data)?F.data:[],size:"small",rowKey:(U,Y)=>U?.id??U?.issue_id??U?.fees_receipt_id??Y,loading:y,scroll:{x:"max-content"},summary:U=>{const Y=U.reduce((L,x)=>L+Number(x?.late_fine??0),0),W=U.reduce((L,x)=>L+Number(x?.is_returned??0),0);return e.jsxs(o.Table.Summary.Row,{children:[e.jsx(o.Table.Summary.Cell,{colSpan:4,children:e.jsxs("span",{style:{fontWeight:700},children:["Total Book: ",U.length]})}),e.jsx(o.Table.Summary.Cell,{colSpan:2,children:e.jsxs("span",{style:{fontWeight:700},children:["Not Return: ",Number(U.length-W)]})}),e.jsx(o.Table.Summary.Cell,{colSpan:2,children:e.jsxs("span",{style:{fontWeight:700},children:["Return: ",W]})}),e.jsx(o.Table.Summary.Cell,{colSpan:1,children:e.jsxs("span",{style:{fontWeight:700},children:["Total Fine:",Y.toLocaleString("en-IN")]})})]})}})})]})]})}const kn=t=>t??localStorage.getItem("authToken")??"",rl=(t,n)=>{const a=String(t??""),r=String(n);return a?r?a.endsWith("/")&&r.startsWith("/")?`${a}${r.slice(1)}`:!a.endsWith("/")&&!r.startsWith("/")?`${a}/${r}`:`${a}${r}`:a:r},Ae={upload:"api/branchapi/frontoffice/uploadfrontofficeDocument",academy:{classes:"api/branchapi/academy/classdropdownlist",sections:"api/branchapi/academy/sectionoftheClass"},student:{dropdown:"api/branchapi/student/studentDropdown"},vendor:{list:"api/accounts/vendor/vendorTable",add:"api/accounts/vendor/addvendor",edit:"api/accounts/vendor/editVendor",remove:"api/accounts/vendor/removecategory",dropdown:"api/accounts/vendor/vendorlist"},category:{list:"api/accounts/category/fetchcategorytable",add:"api/accounts/category/addcategory",edit:"api/accounts/category/editcategory",remove:"api/accounts/category/removecategory",dropdown:"api/accounts/category/categoryDropdown"},subCategory:{list:"api/accounts/category/fetchsubcategorytable",add:"api/accounts/category/addsubcategory",edit:"api/accounts/category/editsubcategory",remove:"api/accounts/category/removesubcategory",dropdown:"api/accounts/category/subcategoryDropdown"},unit:{list:"api/accounts/category/fetchunit",add:"api/accounts/category/addunit",edit:"api/accounts/category/editunit",remove:"api/accounts/category/removeunit",dropdown:"api/accounts/category/unitDropdown"},product:{list:"api/accounts/product/fetchproducttable",add:"api/accounts/product/addproduct",edit:"api/accounts/product/editproduct",remove:"api/accounts/product/removeproduct",dropdown:"api/accounts/product/productdropdown",search:"api/accounts/product/searchproductbyNameandBarcode",addStock:"api/accounts/product/addStock",sellProduct:"api/accounts/product/sellproduct",sellReports:"api/accounts/product/getstoreSellReports"},report:{stock:"api/report/StoreReport/stock_report"}},sl=()=>rl(pt(),Ae.upload),ol=async({baseUrl:t,page:n=1,perPage:a=10},r)=>{const s=t.includes("?")?"&":"?",i=`${t}${s}page=${encodeURIComponent(String(n))}&per_page=${encodeURIComponent(String(a))}`;return te(i,kn(r))},Qt=async(t,n,a)=>Ge(t,n,kn(a)),Et=async(t,n,a)=>ft(t,n,kn(a)),Xt=async(t,n,a)=>nt(t,n,kn(a)),il=t=>t?typeof t=="string"?t:typeof t?.data=="string"?t.data:typeof t?.filename=="string"?t.filename:typeof t?.file=="string"?t.file:"":"",Pt=({token:t,value:n,onChange:a})=>{const r=l.useMemo(()=>{if(t)return{Authorization:t}},[t]);return e.jsx(o.Upload,{maxCount:1,action:sl(),headers:r,onChange:s=>{if(s?.file?.status==="done"){const i=il(s?.file?.response);i&&a?.(i)}},children:e.jsx("div",{style:{cursor:"pointer",fontSize:12,color:"#1677ff"},children:"Upload"})})},gn=Ae.vendor,Zt=({baseUrl:t,page:n=1,perPage:a=10,token:r})=>X(r&&t?[t,n,a,r]:null,([i,d,u,b])=>ol({baseUrl:i,page:d,perPage:u},b)),ll=({token:t,page:n=1,perPage:a=10})=>Zt({baseUrl:gn.list,page:n,perPage:a,token:t}),dl={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},fr=[{name:"name",label:"Name*",required:!0,type:"text"},{name:"email",label:"Email*",required:!0,type:"text"},{name:"address",label:"Address*",required:!0,type:"text"},{name:"phone",label:"Phone*",required:!0,type:"number"},{name:"business_name",label:"Brand Name*",required:!0,type:"text"},{name:"acc_number",label:"Account Number",required:!1,type:"text"},{name:"ifsc_code",label:"IFSC Code",required:!1,type:"text"},{name:"acc_holder_name",label:"Account Holder Name",required:!1,type:"text"},{name:"gst_number",label:"GST Number",required:!1,type:"text"},{name:"cin_num",label:"CIN Number",required:!1,type:"text"},{name:"upi_id",label:"UPI ID",required:!1,type:"text"}];function cl({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(!1),[i,d]=l.useState(null),[u,b]=l.useState(""),{isLoading:h,error:p,data:y,mutate:v}=ll({token:t,page:n.page,perPage:n.rowsPerPage}),w=async j=>{try{await v(Qt(gn.add,j,t),We(j)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch(g){A.error(g?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},m=j=>{j.preventDefault();const g=new FormData(j.target);u&&g.set("image",u),w(g),j.target.reset(),b("")},c=(j,g)=>{a({page:j,rowsPerPage:parseInt(g,10)})},f=async j=>{try{await v(Xt(gn.remove,j,t),$e(j)),A.success("Success! Deleted item.",{duration:1e3})}catch(g){A.error(g?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},T=j=>{d(j),s(!0),b("")},C=async j=>{j.preventDefault();const g=new FormData(j.target);g.set("id",String(i?.id??"")),u&&g.set("image",u);try{await Et(gn.edit,g,t),await v(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null),b("")}catch(_){A.error(_?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},S=l.useMemo(()=>[{title:"Name",dataIndex:"name",key:"name",ellipsis:!0},{title:"Email",dataIndex:"email",key:"email",ellipsis:!0,responsive:["md"]},{title:"Address",dataIndex:"address",key:"address",ellipsis:!0,responsive:["lg"]},{title:"Phone",dataIndex:"phone",key:"phone",ellipsis:!0,responsive:["md"]},{title:"Branch Name",dataIndex:"business_name",key:"business_name",ellipsis:!0,responsive:["lg"]},{title:"Account Holder",dataIndex:"acc_holder_name",key:"acc_holder_name",ellipsis:!0,responsive:["xl"]},{title:"Account Number",dataIndex:"acc_number",key:"acc_number",ellipsis:!0,responsive:["xl"]},{title:"UPI ID",dataIndex:"upi_id",key:"upi_id",ellipsis:!0,responsive:["xl"]},{title:"Action",key:"action",width:100,fixed:"right",render:(j,g)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>T(g),style:{padding:2}}),e.jsx(at,{id:g?.id,funcName:f})]})}],[f]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Drawer,{open:r,title:i?.name?`Edit ${i.name}`:"Edit Vendor",placement:"right",width:520,onClose:()=>{s(!1),d(null),b("")},children:e.jsx("form",{onSubmit:C,children:e.jsxs("div",{style:{display:"grid",gap:14},children:[fr.map(j=>e.jsx(z,{type:j.type,name:j.name,label:j.label,defaultValue:i?.[j.name]??"",required:j.required?"required":void 0},j.name)),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{fontSize:12,color:"#222"},children:"Image"}),e.jsx(Pt,{token:t,value:u,onChange:b})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null),b("")},style:dl,children:"Cancel"})]})]})})}),e.jsxs(ne,{pt:5,pb:1,children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Vendor"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:m,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:16,alignItems:"end"},children:[fr.map(j=>e.jsx(z,{type:j.type,name:j.name,label:j.label,required:j.required?"required":void 0},j.name)),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{fontSize:12,color:"#222"},children:"Image"}),e.jsx(Pt,{token:t,value:u,onChange:b})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Add Vendor",color:"primary"})})]})})})]}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Vendors List"})}),e.jsx(ne,{pt:3,children:e.jsx(Ee,{parentCallback:c,data:{newData:y,columns:S,columnstype:"antd",action:!1,Loading:h,error:p}})})]})]})]})}const ul=({token:t})=>e.jsx(cl,{token:t}),pl={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},fl={width:"100%",minHeight:80,padding:"8px 0",fontSize:"14px",color:"#222",background:"transparent",border:0,borderTop:0,borderLeft:0,borderRight:0,borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none",outline:"none",resize:"vertical",transition:"border-color 0.2s ease"},da=({style:t,onFocus:n,onBlur:a,...r})=>{const[s,i]=l.useState(!1);return e.jsxs("div",{style:{width:"100%"},children:[r.label&&e.jsx("label",{className:"labelfont",style:pl,children:r.label}),e.jsx("textarea",{placeholder:r.placeholder||r.label,...r,onFocus:d=>{i(!0),n?.(d)},onBlur:d=>{i(!1),a?.(d)},style:{...fl,borderBottom:`1px solid ${s?"#222":"#d9d9d9"}`,...t||{}}})]})},xn=Ae.product,mr=Ae.vendor.dropdown,hr=Ae.category.dropdown,ml=Ae.subCategory.dropdown,yr=Ae.unit.dropdown,fs=({token:t,page:n=1,perPage:a=10})=>Zt({baseUrl:xn.list,page:n,perPage:a,token:t}),hl=({token:t})=>X(t&&mr?[mr,t]:null,([a,r])=>te(a,r)),yl=({token:t})=>X(t&&hr?[hr,t]:null,([a,r])=>te(a,r)),gl=({token:t})=>X(t&&yr?[yr,t]:null,([a,r])=>te(a,r)),xl=({token:t,categoryId:n})=>{const a=t&&n?`${ml}?category_id=${encodeURIComponent(String(n))}`:null;return X(a?[a,t]:null,([s,i])=>te(s,i))},ln=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]},bl={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function Sl({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(!1),[i,d]=l.useState(null),[u,b]=l.useState(""),[h,p]=l.useState(""),[y,v]=l.useState(""),[w,m]=l.useState(""),[c,f]=l.useState(""),{isLoading:T,error:C,data:S,mutate:j}=fs({token:t,page:n.page,perPage:n.rowsPerPage}),{data:g}=hl({token:t}),{data:_}=yl({token:t}),{data:P}=gl({token:t}),{data:I}=xl({token:t,categoryId:h}),O=l.useMemo(()=>ln(g),[g]),k=l.useMemo(()=>ln(_),[_]),E=l.useMemo(()=>ln(P),[P]),D=l.useMemo(()=>ln(I),[I]),F=async x=>{try{await j(Qt(xn.add,x,t),We(x)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch(R){A.error(R?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},V=x=>{x.preventDefault();const R=new FormData(x.target);h&&R.set("fk_categoryID",String(h)),y&&R.set("fk_sub_categoryID",String(y)),w&&R.set("vendor_id",String(w)),c&&R.set("unit",String(c)),u&&R.set("image",u),F(R),x.target.reset(),b(""),p(""),v(""),m(""),f("")},Z=(x,R)=>{a({page:x,rowsPerPage:parseInt(R,10)})},U=async x=>{try{await j(Xt(xn.remove,x,t),$e(x)),A.success("Success! Deleted item.",{duration:1e3})}catch(R){A.error(R?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},Y=x=>{d(x),s(!0),b(""),p(x?.fk_categoryID??x?.category_id??""),v(x?.fk_sub_categoryID??x?.sub_category_id??""),m(x?.vendor_id??""),f(x?.unit??x?.unit_id??"")},W=async x=>{x.preventDefault();const R=new FormData(x.target);R.set("id",String(i?.id??"")),h&&R.set("fk_categoryID",String(h)),y&&R.set("fk_sub_categoryID",String(y)),w&&R.set("vendor_id",String(w)),c&&R.set("unit",String(c)),u&&R.set("image",u);try{await Et(xn.edit,R,t),await j(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null),b("")}catch($){A.error($?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},L=l.useMemo(()=>[{title:"Name",dataIndex:"name",key:"name",ellipsis:!0,fixed:"left",width:180},{title:"Description",dataIndex:"description",key:"description",ellipsis:!0,responsive:["lg"]},{title:"Category",dataIndex:"storecategory",key:"storecategory",ellipsis:!0,responsive:["md"]},{title:"Quantity",dataIndex:"quantity",key:"quantity",ellipsis:!0,width:100,responsive:["md"]},{title:"Unit",dataIndex:"unit_name",key:"unit_name",ellipsis:!0,width:120,responsive:["md"]},{title:"Price",dataIndex:"price",key:"price",ellipsis:!0,width:100,responsive:["md"]},{title:"Barcode",dataIndex:"barcode",key:"barcode",ellipsis:!0,responsive:["xl"]},{title:"Hsn Code",dataIndex:"hsn_code",key:"hsn_code",ellipsis:!0,responsive:["xl"]},{title:"Action",key:"action",width:100,fixed:"right",render:(x,R)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>Y(R),style:{padding:2}}),e.jsx(at,{id:R?.id,funcName:U})]})}],[U]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Drawer,{open:r,title:i?.name?`Edit ${i.name}`:"Edit Product",placement:"right",width:520,onClose:()=>{s(!1),d(null),b("")},children:e.jsx("form",{onSubmit:W,children:e.jsxs("div",{style:{display:"grid",gap:14},children:[e.jsx(z,{type:"text",name:"name",label:"Product Name*",defaultValue:i?.name??"",required:"required"}),e.jsx(le,{options:k,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category*",name:"fk_categoryID",allowSelectAll:!1,required:!0,onChange:x=>{const R=x?.value??"";p(R),v("")},defaultValue:h?k.find(x=>String(x?.value)===String(h)):null}),e.jsx(le,{options:D,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"SubCategory",name:"fk_sub_categoryID",allowSelectAll:!1,onChange:x=>v(x?.value??""),defaultValue:y?D.find(x=>String(x?.value)===String(y)):null}),e.jsx(z,{type:"text",name:"barcode",label:"Barcode",defaultValue:i?.barcode??""}),e.jsx(le,{options:E,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Unit*",name:"unit",allowSelectAll:!1,required:!0,onChange:x=>f(x?.value??""),defaultValue:c?E.find(x=>String(x?.value)===String(c)):null}),e.jsx(z,{type:"number",name:"quantity",label:"Quantity*",defaultValue:i?.quantity??"",required:"required"}),e.jsx(z,{type:"number",name:"price",label:"Price*",defaultValue:i?.price??"",required:"required"}),e.jsx(le,{options:O,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vendor*",name:"vendor_id",allowSelectAll:!1,required:!0,onChange:x=>m(x?.value??""),defaultValue:w?O.find(x=>String(x?.value)===String(w)):null}),e.jsx(z,{type:"number",name:"hsn_code",label:"Hsn Code",defaultValue:i?.hsn_code??""}),e.jsx(da,{type:"text",label:"Description",name:"description",rows:3,defaultValue:i?.description??""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{fontSize:12,color:"#222"},children:"Image"}),e.jsx(Pt,{token:t,value:u,onChange:b})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null),b("")},style:bl,children:"Cancel"})]})]})})}),e.jsxs(ne,{pt:5,pb:1,children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Product"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:V,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:16,alignItems:"end"},children:[e.jsx(z,{type:"text",name:"name",label:"Product Name*",required:"required"}),e.jsx(le,{options:k,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category*",name:"fk_categoryID",allowSelectAll:!1,required:!0,onChange:x=>{const R=x?.value??"";p(R),v("")}}),e.jsx(le,{options:D,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"SubCategory",name:"fk_sub_categoryID",allowSelectAll:!1,onChange:x=>v(x?.value??"")},`subcat_${h}`),e.jsx(z,{type:"text",name:"barcode",label:"Barcode"}),e.jsx(le,{options:E,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Unit*",name:"unit",allowSelectAll:!1,required:!0,onChange:x=>f(x?.value??"")}),e.jsx(z,{type:"number",name:"quantity",label:"Quantity*",required:"required"}),e.jsx(z,{type:"number",name:"price",label:"Price*",required:"required"}),e.jsx(le,{options:O,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Vendor*",name:"vendor_id",allowSelectAll:!1,required:!0,onChange:x=>m(x?.value??"")}),e.jsx(z,{type:"number",name:"hsn_code",label:"Hsn Code"}),e.jsx(da,{type:"text",label:"Description",name:"description",rows:3}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{fontSize:12,color:"#222"},children:"Image"}),e.jsx(Pt,{token:t,value:u,onChange:b})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Add Product",color:"primary"})})]})})})]}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Products List"})}),e.jsx(ne,{pt:3,children:e.jsx(Ee,{parentCallback:Z,data:{newData:S,columns:L,columnstype:"antd",action:!1,Loading:T,error:C}})})]})]})]})}const jl=({token:t})=>e.jsx(Sl,{token:t}),bn=Ae.category,wl=({token:t,page:n=1,perPage:a=10})=>Zt({baseUrl:bn.list,page:n,perPage:a,token:t}),vl={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function _l({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(!1),[i,d]=l.useState(null),{isLoading:u,error:b,data:h,mutate:p}=wl({token:t,page:n.page,perPage:n.rowsPerPage}),y=async C=>{try{await p(Qt(bn.add,C,t),We(C)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch(S){A.error(S?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},v=C=>{C.preventDefault();const S=new FormData(C.target);y(S),C.target.reset()},w=(C,S)=>{a({page:C,rowsPerPage:parseInt(S,10)})},m=async C=>{try{await p(Xt(bn.remove,C,t),$e(C)),A.success("Success! Deleted item.",{duration:1e3})}catch(S){A.error(S?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},c=C=>{d(C),s(!0)},f=async C=>{C.preventDefault();const S=new FormData(C.target);S.set("id",String(i?.id??""));try{await Et(bn.edit,S,t),await p(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null)}catch(j){A.error(j?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},T=l.useMemo(()=>[{title:"Name",dataIndex:"name",key:"name",ellipsis:!0,sorter:{compare:(C,S)=>String(C?.name??"").localeCompare(String(S?.name??""))}},{title:"Description",dataIndex:"description",key:"description",ellipsis:!0,sorter:{compare:(C,S)=>String(C?.description??"").localeCompare(String(S?.description??""))}},{title:"Action",key:"action",width:100,fixed:"right",render:(C,S)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>c(S),style:{padding:2}}),e.jsx(at,{id:S?.id,funcName:m})]})}],[m]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Drawer,{open:r,title:i?.name?`Edit ${i.name}`:"Edit Category",placement:"right",width:420,onClose:()=>{s(!1),d(null)},children:e.jsx("form",{onSubmit:f,children:e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(z,{type:"text",name:"name",label:"Name",defaultValue:i?.name??"",required:"required"}),e.jsx(z,{type:"text",name:"description",label:"Description",defaultValue:i?.description??""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null)},style:vl,children:"Cancel"})]})]})})}),e.jsxs(ne,{pt:5,pb:1,children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Category"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:v,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(z,{type:"text",name:"name",label:"Name*",required:"required"}),e.jsx(z,{type:"text",name:"description",label:"Description"}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Save",color:"primary"})})]})})})]}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Category List"})}),e.jsx(ne,{pt:3,children:e.jsx(Ee,{parentCallback:w,data:{newData:h,columns:T,columnstype:"antd",action:!1,Loading:u,error:b}})})]})]})]})}const Cl=({token:t})=>e.jsx(_l,{token:t}),Sn=Ae.subCategory,gr=Ae.category.dropdown,Tl=({token:t,page:n=1,perPage:a=10})=>Zt({baseUrl:Sn.list,page:n,perPage:a,token:t}),Rl=({token:t})=>X(t&&gr?[gr,t]:null,([a,r])=>te(a,r)),Dl=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]},Al={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function Ol({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(!1),[i,d]=l.useState(null),[u,b]=l.useState(""),{isLoading:h,error:p,data:y,mutate:v}=Tl({token:t,page:n.page,perPage:n.rowsPerPage}),{data:w}=Rl({token:t}),m=l.useMemo(()=>Dl(w),[w]),c=async _=>{try{await v(Qt(Sn.add,_,t),We(_)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch(P){A.error(P?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},f=_=>{_.preventDefault();const P=new FormData(_.target);P.set("status","active"),P.set("img",u||""),c(P),_.target.reset(),b("")},T=(_,P)=>{a({page:_,rowsPerPage:parseInt(P,10)})},C=async _=>{try{await v(Xt(Sn.remove,_,t),$e(_)),A.success("Success! Deleted item.",{duration:1e3})}catch(P){A.error(P?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},S=_=>{d(_),s(!0)},j=async _=>{_.preventDefault();const P=new FormData(_.target);P.set("id",String(i?.id??"")),u&&P.set("img",u);try{await Et(Sn.edit,P,t),await v(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null),b("")}catch(I){A.error(I?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},g=l.useMemo(()=>[{title:"Name",dataIndex:"name",key:"name",ellipsis:!0,sorter:{compare:(_,P)=>String(_?.name??"").localeCompare(String(P?.name??""))}},{title:"Description",dataIndex:"description",key:"description",ellipsis:!0,sorter:{compare:(_,P)=>String(_?.description??"").localeCompare(String(P?.description??""))}},{title:"Action",key:"action",width:100,fixed:"right",render:(_,P)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>S(P),style:{padding:2}}),e.jsx(at,{id:P?.id,funcName:C})]})}],[C]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Drawer,{open:r,title:i?.name?`Edit ${i.name}`:"Edit Sub Category",placement:"right",width:420,onClose:()=>{s(!1),d(null),b("")},children:e.jsx("form",{onSubmit:j,children:e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(le,{options:m,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category",name:"category_id",defaultValue:i?.category_id?m.find(_=>String(_?.value)===String(i.category_id)):null,allowSelectAll:!1,required:!0}),e.jsx(z,{type:"text",name:"name",label:"Name*",defaultValue:i?.name??"",required:"required"}),e.jsx(z,{type:"text",name:"description",label:"Description",defaultValue:i?.description??""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{fontSize:12,color:"#222"},children:"Image"}),e.jsx(Pt,{token:t,value:u,onChange:b})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null),b("")},style:Al,children:"Cancel"})]})]})})}),e.jsxs(ne,{pt:5,pb:1,children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Sub Category"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:f,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{options:m,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Category",name:"category_id",allowSelectAll:!1,required:!0}),e.jsx(z,{type:"text",name:"name",label:"Name*",required:"required"}),e.jsx(z,{type:"text",name:"description",label:"Description"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("div",{style:{fontSize:12,color:"#222"},children:"Image"}),e.jsx(Pt,{token:t,value:u,onChange:b})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Save",color:"primary"})})]})})})]}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Sub Category List"})}),e.jsx(ne,{pt:3,children:e.jsx(Ee,{parentCallback:T,data:{newData:y,columns:g,columnstype:"antd",action:!1,Loading:h,error:p}})})]})]})]})}const Pl=({token:t})=>e.jsx(Ol,{token:t}),na=Ae.product,Il=Ae.academy.classes,El=Ae.academy.sections,kl=Ae.student.dropdown;function Lt(t){const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]}function dn(t,n){const a=Math.trunc(Number(t)||1),r=Math.max(1,a);return!Number.isFinite(Number(n))||Number(n)<=0?r:Math.min(r,Math.trunc(Number(n)))}function Le(t){return String(t??"")}function Ml({token:t}){const[n,a]=l.useState(""),[r,s]=l.useState(""),[i,d]=l.useState(""),[u,b]=l.useState(!1),[h,p]=l.useState(""),[y,v]=l.useState([]),[w,m]=l.useState({}),[c,f]=l.useState({}),[T,C]=l.useState(!1),[S,j]=l.useState(""),[g,_]=l.useState(0),[P,I]=l.useState(""),[O,k]=l.useState(ye()),[E,D]=l.useState([]),F={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"},V=!!(n&&r&&i),{data:Z}=X(t?[Il,t]:null,([ae,de])=>te(ae,de)),U=l.useMemo(()=>Lt(Z),[Z]),Y=t&&n?`${El}?class_id=${encodeURIComponent(String(n))}`:null,{data:W}=X(Y?[Y,t]:null,([ae,de])=>te(ae,de)),L=l.useMemo(()=>Lt(W),[W]),x=t&&n&&r?`${kl}?class=${encodeURIComponent(String(n))}&section=${encodeURIComponent(String(r))}`:null,{data:R}=X(x?[x,t]:null,([ae,de])=>te(ae,de)),$=l.useMemo(()=>Lt(R),[R]),q=V?`${na.list}?page=1&per_page=10000`:null,{data:Q,isLoading:ue}=X(t&&q?[q,t]:null,([ae,de])=>te(ae,de),{revalidateOnFocus:!1}),se=l.useMemo(()=>Lt(Q),[Q]),pe=l.useMemo(()=>{const ae=new Map;return(Array.isArray(se)?se:[]).forEach(de=>{ae.set(Le(de?.id),de)}),ae},[se]),B=l.useMemo(()=>{const ae=Object.entries(c||{});return ae.length===0?[]:ae.map(([de,oe])=>{const N=pe.get(Le(de));return N?{id:N?.id,name:N?.name,barcode:N?.barcode,stock:Number(N?.quantity||0),price:Number(N?.price||0),quantity:dn(oe,Number(N?.quantity||0))}:null}).filter(Boolean)},[c,pe]),H=l.useMemo(()=>new Set(B.map(ae=>Le(ae?.id))),[B]),ie=l.useMemo(()=>(Array.isArray(B)?B:[]).reduce((de,oe)=>de+Number(oe?.price||0)*Number(oe?.quantity||1),0),[B]),je=l.useMemo(()=>{const ae=Number(g||0);return!Number.isFinite(ae)||ae<=0?0:Math.min(ae,ie)},[g,ie]),K=l.useMemo(()=>Math.max(0,ie-je),[je,ie]),ve=l.useMemo(()=>(Array.isArray(se)?se:[]).slice(0,30).map(ae=>({value:Le(ae?.id),label:`${ae?.name??""}${ae?.barcode?` • ${ae.barcode}`:""}${ae?.quantity!==void 0&&ae?.quantity!==null?` • Stock: ${ae.quantity}`:""}`,product:ae})),[se]),{trigger:Pe}=ze(t&&V?na.search:null,(ae,{arg:de})=>At(ae,{arg:de},t));l.useEffect(()=>{if(!V){v([]);return}const ae=String(h||"").trim();if(ae.length<2){v(ve);return}let de=!0;const oe=setTimeout(async()=>{let N=[];try{if(Pe){const re=await Pe({search:ae});N=Lt(re)}}catch{N=[]}if(!Array.isArray(N)||N.length===0){const re=ae.toLowerCase();N=(Array.isArray(se)?se:[]).filter(we=>{const _e=String(we?.name??"").toLowerCase(),lt=String(we?.barcode??"").toLowerCase();return _e.includes(re)||lt.includes(re)}).slice(0,30)}const G=N.slice(0,30).map(re=>({value:Le(re?.id),label:`${re?.name??""}${re?.barcode?` • ${re.barcode}`:""}${re?.quantity!==void 0&&re?.quantity!==null?` • Stock: ${re.quantity}`:""}`,product:re}));de&&v(G)},250);return()=>{de=!1,clearTimeout(oe)}},[ve,V,Pe,se,h]),l.useEffect(()=>{f({}),m({}),p(""),v([]),C(!1),j(""),_(0),I(""),k(ye()),D([])},[n,r,i]);const ke=l.useCallback((ae,de=1)=>{const oe=ae?.id;if(!oe)return;const N=Number(ae?.quantity||0);if(N<=0){A.error("Out of stock.",{duration:1e3});return}const G=dn(de,N);f(re=>{const we=re||{};return Object.prototype.hasOwnProperty.call(we,Le(oe))?(A.error("Product already added.",{duration:1e3}),we):{...we,[Le(oe)]:G}})},[f]),rt=l.useCallback((ae,de,oe)=>{f(N=>{const G=N||{},re=Le(ae);return Object.prototype.hasOwnProperty.call(G,re)?{...G,[re]:dn(de,oe)}:G})},[]),st=l.useCallback(ae=>{f(de=>{const oe=de||{},N=Le(ae);if(!Object.prototype.hasOwnProperty.call(oe,N))return oe;const G={...oe};return delete G[N],G})},[]),Qe=l.useCallback((ae,de,oe)=>{m(N=>({...N||{},[Le(ae)]:dn(de,oe)}))},[]),He=l.useCallback((ae,de)=>{de?.product&&ke(de.product,1),p(""),v(ve)},[ke,ve]),Ue=l.useCallback(ae=>{if(ae.key!=="Enter")return;ae.preventDefault();const de=Array.isArray(y)&&y.length>0?y[0]:null;if(de?.product){ke(de.product,1),p(""),v(ve);return}const oe=String(h||"").trim().toLowerCase();if(oe.length===0)return;const N=(Array.isArray(se)?se:[]).find(G=>{const re=String(G?.name??"").toLowerCase(),we=String(G?.barcode??"").toLowerCase();return re.includes(oe)||we.includes(oe)});N&&(ke(N,1),p(""),v(ve))},[ke,ve,se,y,h]),Ke=()=>{if(!t){A.error("Missing token.",{duration:1e3});return}if(!n){A.error("Select class.",{duration:1e3});return}if(!r){A.error("Select section.",{duration:1e3});return}if(!i){A.error("Select student.",{duration:1e3});return}if(!B||B.length===0){A.error("Add at least one product.",{duration:1e3});return}C(!0)},{trigger:Be,isMutating:Oe}=ze(t?na.sellProduct:null,(ae,{arg:de})=>es(ae,{arg:de},t)),Fe=async()=>{if(!S){A.error("Select payment type.",{duration:1e3});return}const ae=(Array.isArray(B)?B:[]).map(oe=>({id:oe?.id,quantity:Number(oe?.quantity||1),price:Number(oe?.price||0),total_price:Number(oe?.total_price||0),fk_vendor_id:oe?.fk_vendor_id||"",fk_categoryID:oe?.fk_categoryID||"",name:oe?.name||"",class_id:oe?.class_id||"",fk_sub_categoryID:oe?.fk_sub_categoryID||"",description:oe?.description||"",min_quantity:Number(oe?.min_quantity||0),storecategory:Number(oe?.storecategory||0),barcode:oe?.barcode||""})),de={amount:ie,class:n,section:r,student_id:i,payment_type:S,discount:je,notes:P||"",receipt_date:O?ye(O).format("YYYY-MM-DD"):"",product:JSON.stringify(ae),total_payable_amount:ie,attchement:E[0]?.originFileObj||""};try{const N=Array.isArray(E)&&E.length>0&&E[0]?.originFileObj?(()=>{const re=new FormData;return Object.entries(de).forEach(([we,_e])=>{if(we==="products"){re.append("product",JSON.stringify(_e));return}re.append(we,String(_e??""))}),re.append("attachment",E[0].originFileObj),re})():de,G=await Be(N);G?.Status==="Success"?(A.success("Success! Product sold.",{duration:1e3}),C(!1),f({}),m({}),p(""),v(ve),j(""),_(0),I(""),k(ye()),D([])):A.error(G?.msg??"Failed to submit.",{duration:1e3})}catch{A.error("Failed to submit.",{duration:1e3})}},ot=l.useMemo(()=>[{title:"Product Name",dataIndex:"name",key:"name",ellipsis:!0},{title:"Barcode",dataIndex:"barcode",key:"barcode",width:160},{title:"Stock",dataIndex:"quantity",key:"quantity",width:110},{title:"Price",dataIndex:"price",key:"price",width:120},{title:"Quantity",key:"quantity",width:160,render:(ae,de)=>{const oe=Le(de?.id),N=Number(de?.quantity||0),G=H.has(oe),re=(G?c?.[oe]:w?.[oe])??1;return e.jsx(o.InputNumber,{min:1,max:Number.isFinite(N)&&N>0?N:void 0,value:re,onChange:we=>{G?rt(oe,we,N):Qe(oe,we,N)},disabled:N<=0})}},{title:"Amount",key:"amount",width:140,render:(ae,de)=>{const oe=Le(de?.id),N=(H.has(oe)?c?.[oe]:w?.[oe])??1;return Number(de?.price||0)*Number(N||1)}},{title:"Action",key:"action",width:120,render:(ae,de)=>{const oe=Le(de?.id),N=Number(de?.quantity||0),G=H.has(oe),re=(G?c?.[oe]:w?.[oe])??1;return G?e.jsx(o.Button,{type:"text",danger:!0,size:"small",icon:e.jsx(ce.DeleteOutlined,{}),onClick:()=>st(oe),style:{padding:2}}):e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.PlusOutlined,{}),disabled:N<=0,onClick:()=>ke(de,re),style:{padding:2}})}}],[ke,H,c,w,st,Qe,rt]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsxs(ne,{pt:5,pb:2,children:[e.jsxs(ne,{style:{padding:"12px 16px"},children:[e.jsx(ne,{children:"Sell Product"}),e.jsx(o.Card,{style:{borderRadius:16},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:16,alignItems:"end"},children:[e.jsx(le,{options:U,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",name:"class_id",placeholder:"Class",allowSelectAll:!1,required:!0,onChange:ae=>{const de=ae?.value??"";a(de),s(""),d(""),b(oe=>!oe)}}),e.jsx(le,{options:L,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",name:"section_id",placeholder:"Section",allowSelectAll:!1,required:!0,onChange:ae=>{const de=ae?.value??"";s(de),d("")}},`section_${u}`),e.jsx(le,{options:$,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Student",name:"student_id",placeholder:"Student",allowSelectAll:!1,required:!0,onChange:ae=>d(ae?.value??"")})]})})]}),e.jsx("div",{style:{padding:"0 16px"},children:e.jsxs(o.Card,{style:{borderRadius:16,marginTop:12},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(260px, 520px) 1fr",gap:12,alignItems:"center",marginBottom:12},children:[e.jsx(ne,{style:{marginTop:12},children:"Product Section"}),e.jsx(o.AutoComplete,{value:h,options:y,onSearch:p,onFocus:()=>{V&&String(h||"").trim().length<2&&v(ve)},onSelect:He,disabled:!V,children:e.jsx(o.Input,{placeholder:"Search by product name or barcode",onKeyDown:Ue,allowClear:!0})}),e.jsxs("div",{style:{justifySelf:"end",fontWeight:700},children:["Total: ",dt(ie)]})]}),e.jsx(o.Table,{rowKey:ae=>Le(ae?.id),columns:ot,dataSource:se,loading:ue,size:"small",bordered:!0,pagination:{pageSize:50,showSizeChanger:!0,pageSizeOptions:[25,50,100,200]},scroll:{x:"max-content"}}),e.jsxs("div",{style:{position:"sticky",bottom:0,background:"#fff",paddingTop:12,marginTop:12,borderTop:"1px solid #f0f0f0"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontWeight:700},children:[e.jsx("span",{children:"Selected Items"}),e.jsx("span",{children:B.length})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontWeight:700,marginTop:6},children:[e.jsx("span",{children:"Total Amount"}),e.jsx("span",{children:dt(ie)})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:12},children:[e.jsx(me,{type:"button",value:"Submit",disabled:!V||B.length===0,onClick:Ke,style:{flex:1,minWidth:140}}),e.jsx(o.Button,{type:"text",style:F,onClick:()=>{f({}),m({}),p(""),v(ve)},disabled:B.length===0,children:"Clear"})]})]})]})})]}),e.jsx(o.Modal,{open:T,title:"Payment",onCancel:()=>C(!1),onOk:Fe,confirmLoading:Oe,okText:"Submit",destroyOnClose:!0,children:e.jsxs("div",{style:{display:"grid",gap:12},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,marginBottom:6},children:"Payment Type"}),e.jsx(o.Select,{value:S||void 0,onChange:j,placeholder:"Select payment type",style:{width:"100%"},options:[{value:"Cash",label:"Cash"},{value:"UPI",label:"UPI"},{value:"Bank",label:"Bank"},{value:"Cheque",label:"Cheque"},{value:"DD",label:"DD"},{value:"Internet Banking",label:"Internet Banking"}]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,marginBottom:6},children:"Receipt Date"}),e.jsx(o.DatePicker,{value:O,onChange:ae=>k(ae),style:{width:"100%"},format:"YYYY-MM-DD"})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,marginBottom:6},children:"Discount"}),e.jsx(o.InputNumber,{min:0,max:ie,value:g,onChange:ae=>_(Number(ae||0)),style:{width:"100%"}})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,marginBottom:6},children:"Attachment"}),e.jsx(o.Upload,{fileList:E,beforeUpload:()=>!1,onChange:({fileList:ae})=>D((ae||[]).slice(-1)),maxCount:1,children:e.jsx(o.Button,{icon:e.jsx(ce.UploadOutlined,{}),children:"Upload"})})]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,marginBottom:6},children:"Notes"}),e.jsx(o.Input.TextArea,{value:P,onChange:ae=>I(ae.target.value),rows:3})]}),e.jsx(o.Card,{style:{borderRadius:12,background:"#fafcff"},children:e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{children:"Total Amount"}),e.jsx("span",{children:dt(ie)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[e.jsx("span",{children:"Discount"}),e.jsx("span",{children:dt(je)})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontWeight:700},children:[e.jsx("span",{children:"Net Amount"}),e.jsx("span",{children:dt(K)})]})]})})]})})]})}const Fl=({token:t})=>e.jsx(Ml,{token:t}),jn=Ae.unit,Bl=({token:t,page:n=1,perPage:a=10})=>Zt({baseUrl:jn.list,page:n,perPage:a,token:t}),Nl={height:36,padding:"0 14px",border:"none",background:"transparent",color:"#243a9b",fontSize:14,fontWeight:500,textTransform:"uppercase",boxShadow:"none"};function $l({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(!1),[i,d]=l.useState(null),{isLoading:u,error:b,data:h,mutate:p}=Bl({token:t,page:n.page,perPage:n.rowsPerPage}),y=async C=>{try{await p(Qt(jn.add,C,t),We(C)),A.success("Success! Added new item.",{duration:1e3,icon:"🎉"})}catch(S){A.error(S?.response?.data?.msg??"Failed to add the new item.",{duration:1e3})}},v=C=>{C.preventDefault();const S=new FormData(C.target);y(S),C.target.reset()},w=(C,S)=>{a({page:C,rowsPerPage:parseInt(S,10)})},m=async C=>{try{await p(Xt(jn.remove,C,t),$e(C)),A.success("Success! Deleted item.",{duration:1e3})}catch(S){A.error(S?.response?.data?.msg??"Failed to delete the item.",{duration:1e3})}},c=C=>{d(C),s(!0)},f=async C=>{C.preventDefault();const S=new FormData(C.target);S.set("id",String(i?.id??""));try{await Et(jn.edit,S,t),await p(),A.success("Success! Updated item.",{duration:1e3,icon:"🚀"}),s(!1),d(null)}catch(j){A.error(j?.response?.data?.msg??"Failed to update the item.",{duration:1e3})}},T=l.useMemo(()=>[{title:"Name",dataIndex:"name",key:"name",ellipsis:!0,sorter:{compare:(C,S)=>String(C?.name??"").localeCompare(String(S?.name??""))}},{title:"Description",dataIndex:"description",key:"description",ellipsis:!0,sorter:{compare:(C,S)=>String(C?.description??"").localeCompare(String(S?.description??""))}},{title:"Action",key:"action",width:100,fixed:"right",render:(C,S)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>c(S),style:{padding:2}}),e.jsx(at,{id:S?.id,funcName:m})]})}],[m]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Drawer,{open:r,title:i?.name?`Edit ${i.name}`:"Edit Unit",placement:"right",width:420,onClose:()=>{s(!1),d(null)},children:e.jsx("form",{onSubmit:f,children:e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(z,{type:"text",name:"name",label:"Unit Name",defaultValue:i?.name??"",required:"required"}),e.jsx(z,{type:"text",name:"description",label:"Description",defaultValue:i?.description??""}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(me,{type:"submit",value:"Update",color:"primary"}),e.jsx(o.Button,{type:"text",onClick:()=>{s(!1),d(null)},style:Nl,children:"Cancel"})]})]})})}),e.jsxs(ne,{pt:5,pb:1,children:[e.jsxs("div",{children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Add Unit"})}),e.jsx(ne,{px:3,pb:2,children:e.jsx("form",{onSubmit:v,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(z,{type:"text",name:"name",label:"Unit Name*",required:"required"}),e.jsx(z,{type:"text",name:"description",label:"Description"}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Save",color:"primary"})})]})})})]}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx(ne,{mx:2,mt:-3,py:1,px:1,variant:"gradient",bgColor:"info",borderRadius:"lg",coloredShadow:"info",children:e.jsx(Re,{variant:"h6",color:"white",children:"Unit List"})}),e.jsx(ne,{pt:3,children:e.jsx(Ee,{parentCallback:w,data:{newData:h,columns:T,columnstype:"antd",action:!1,Loading:u,error:b}})})]})]})]})}const Ul=({token:t})=>e.jsx($l,{token:t}),Ll=Ae.product.sellReports,ql=Ae.academy.classes,zl=Ae.academy.sections,Vl=Ae.student.dropdown,xr=t=>{const n=Number(t??0);return Number.isFinite(n)?n.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2}):String(t??"")};function Yl({token:t}){const n=l.useRef(null),[a,r]=l.useState(null),[s,i]=l.useState(""),[d,u]=l.useState(""),[b,h]=l.useState(""),[p,y]=l.useState(!1),v=D=>{const F=D?.data?.data??D?.data??D??[];return Array.isArray(F)?F:Array.isArray(F?.data)?F.data:[]},{data:w}=X(t?[ql,t]:null,([D,F])=>te(D,F)),m=l.useMemo(()=>v(w),[w]),c=t&&s?`${zl}?class_id=${encodeURIComponent(String(s))}`:null,{data:f}=X(c?[c,t]:null,([D,F])=>te(D,F)),T=l.useMemo(()=>v(f),[f]),C=t&&s&&d?`${Vl}?class=${encodeURIComponent(String(s))}&section=${encodeURIComponent(String(d))}`:null,{data:S}=X(C?[C,t]:null,([D,F])=>te(D,F)),j=l.useMemo(()=>v(S),[S]),{trigger:g,isMutating:_,data:P}=ze(Ll,(D,{arg:F})=>ha(D,{arg:F},t));l.useEffect(()=>{const F=new Date().toISOString().slice(0,10);g({duration:[F,F]})},[g]);const I=l.useMemo(()=>{const D=P?.data??P??[];return Array.isArray(D)?D:[]},[P]),O=D=>{const F=Array.isArray(D?.product_details)?D.product_details:[];return F.length===0?null:e.jsx(o.Table,{size:"small",bordered:!0,pagination:!1,rowKey:V=>`${D?.receipt_id??"r"}_${V?.product_name??V?.product_pricem??""}`,columns:[{title:"Product",dataIndex:"product_name",key:"product_name"},{title:"Amount",dataIndex:"product_pricem",key:"product_pricem",render:V=>xr(V)}],dataSource:F})},k=[{title:"Receipt No",dataIndex:"receipt_no",key:"receipt_no"},{title:"Date",dataIndex:"receipt_date",key:"receipt_date"},{title:"Amount",dataIndex:"receipt_amount",key:"receipt_amount",render:D=>xr(D)}],E=async()=>{if(!a||a.length!==2)return;const[D,F]=a;await g({duration:[D.format("YYYY-MM-DD"),F.format("YYYY-MM-DD")],class:s||"",section:d||"",student_id:b||""})};return e.jsx("div",{children:e.jsxs(o.Row,{gutter:[16,16],children:[e.jsx(o.Col,{xs:24,lg:8,children:e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Filters"}),style:{borderRadius:16},children:e.jsxs("div",{style:{display:"grid",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222",marginBottom:6},children:"Duration"}),e.jsx(o.DatePicker.RangePicker,{value:a,onChange:r,style:{width:"100%"}})]}),e.jsx(le,{options:m,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Class",placeholder:"Class",allowSelectAll:!1,onChange:D=>{const F=D?.value??"";i(F),u(""),h(""),y(V=>!V)}}),e.jsx(le,{options:T,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Section",placeholder:"Section",allowSelectAll:!1,onChange:D=>{const F=D?.value??"";u(F),h("")}},`section_${p}`),e.jsx(le,{options:j,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Student",placeholder:"Student",allowSelectAll:!1,onChange:D=>h(D?.value??"")}),e.jsx(me,{type:"button",value:_?"Searching...":"Search",disabled:_,onClick:E,style:{width:"100%"}})]})})}),e.jsx(o.Col,{xs:24,lg:16,children:e.jsx(o.Card,{title:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Sell Reports"}),e.jsx(En,{data:{tableRef:n}})]}),style:{borderRadius:16},children:e.jsxs("div",{ref:n,children:[e.jsx("div",{className:"print-only",children:e.jsx(Gt,{})}),e.jsx(o.Table,{bordered:!0,size:"small",loading:_,rowKey:D=>String(D?.receipt_id??D?.receipt_no??Math.random()),columns:k,expandable:{expandedRowRender:O},dataSource:I,pagination:{pageSize:20}})]})})})]})})}const Wl=({token:t})=>e.jsx(Yl,{token:t}),Hl=Ae.product;function Kl({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState([]),[i,d]=l.useState([]),[u,b]=l.useState(!1),[h,p]=l.useState(!1),[y,v]=l.useState(null),[w,m]=l.useState(0),[c,f]=l.useState(null),[T,C]=l.useState(""),S=l.useRef(null),j=Vt.useReactToPrint({contentRef:S,documentTitle:"Stock Barcodes"}),{isLoading:g,error:_,data:P,mutate:I}=fs({token:t,page:n.page,perPage:n.rowsPerPage}),O=(Z,U)=>{a({page:Z,rowsPerPage:parseInt(U,10)})},k={selectedRowKeys:r,onChange:(Z,U)=>{s(Z),d(U)}},E=Z=>{v(Z),m(Number(Z?.quantity??0)),f(null),C(""),b(!0)},D=()=>{b(!1),v(null),m(0),f(null),C("")},F=async()=>{if(!y?.id)return;p(!0);const Z=new FormData;Z.append("product_id",String(y.id)),Z.append("qty",String(w??0)),c&&Z.append("tran_date",c.format("YYYY-MM-DD")),T&&Z.append("remarks",T);try{const U=await Et(Hl.addStock,Z,t);U?.Status==="Success"?(A.success("Success! Updated quantity.",{duration:1e3}),D(),await I()):A.error(U?.msg??"Failed to update quantity.",{duration:1e3})}catch{A.error("Failed to update quantity.",{duration:1e3})}finally{p(!1)}},V=l.useMemo(()=>[{title:"Name",dataIndex:"name",key:"name",ellipsis:!0,fixed:"left",width:180},{title:"Category",dataIndex:"storecategory",key:"storecategory",ellipsis:!0,responsive:["md"]},{title:"Quantity",dataIndex:"quantity",key:"quantity",width:100},{title:"Unit",dataIndex:"unit_name",key:"unit_name",width:120,responsive:["md"]},{title:"Price",dataIndex:"price",key:"price",width:100,responsive:["md"]},{title:"Barcode",dataIndex:"barcode",key:"barcode",ellipsis:!0,responsive:["lg"]},{title:"Action",key:"action",width:160,fixed:"right",render:(Z,U)=>e.jsx("div",{style:{display:"flex",gap:8},children:e.jsx(o.Button,{size:"small",onClick:()=>E(U),children:"Update Qty"})})}],[]);return e.jsxs("div",{children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{title:y?.name?`Update Stock: ${y.name}`:"Update Stock",open:u,onCancel:D,onOk:F,okButtonProps:{loading:h},children:e.jsxs("div",{style:{display:"grid",gap:12},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,marginBottom:6},children:"Quantity"}),e.jsx(o.InputNumber,{min:0,style:{width:"100%"},value:w,onChange:Z=>m(Z??0)})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,marginBottom:6},children:"Date"}),e.jsx(o.DatePicker,{style:{width:"100%"},value:c,onChange:f})]}),e.jsx(da,{label:"Remarks",name:"remarks",rows:3,value:T,onChange:Z=>C(Z.target.value)})]})}),e.jsxs(ne,{pt:5,pb:2,children:[e.jsxs(ne,{children:["Manage Stock",e.jsx(me,{type:"button",value:"Print Barcodes",disabled:!i||i.length===0,onClick:()=>j?.(),style:{minWidth:170}})]}),e.jsx(ne,{style:{padding:"12px 16px"},children:e.jsx(o.Card,{style:{borderRadius:16},children:e.jsx(Ee,{parentCallback:O,data:{newData:P,columns:V,columnstype:"antd",action:!1,Loading:g,error:_,rowSelection:k}})})})]}),e.jsx("div",{style:{position:"absolute",left:-1e4,top:0},children:e.jsx("div",{ref:S,children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:16,padding:24},children:(Array.isArray(i)?i:[]).map(Z=>e.jsxs("div",{style:{border:"1px solid #ddd",padding:12},children:[e.jsx("div",{style:{marginBottom:6,fontSize:12},children:Z?.name??""}),e.jsx(Or,{value:String(Z?.barcode??Z?.id??""),height:50,width:1.6,displayValue:!0})]},Z?.id??Z?.barcode??Z?.name))})})})]})}const Jl=({token:t})=>e.jsx(Kl,{token:t}),Gl=Ae.report.stock,Ql=Ae.product.dropdown,Xl=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:[]};function Zl({token:t}){const n=l.useRef(null),[a,r]=l.useState(null),[s,i]=l.useState(""),{data:d}=X(t?[Ql,t]:null,([m,c])=>te(m,c)),u=l.useMemo(()=>Xl(d),[d]),{trigger:b,isMutating:h,data:p}=ze(Gl,(m,{arg:c})=>ha(m,{arg:c},t));l.useEffect(()=>{const c=new Date().toISOString().slice(0,10);b({duration:[c,c]})},[b]);const y=l.useMemo(()=>{const m=p?.data??p??[];return(Array.isArray(m)?m:[]).flatMap(f=>(Array.isArray(f?.ledger)?f.ledger:[]).map((T,C)=>({key:`${f.product_id??f.product_name??"p"}-${C}`,date:T?.date,product:f?.product_name,opening:T?.opening,inward:T?.inward,outward:T?.outward,closing:T?.closing})))},[p]),v=[{title:"Date",dataIndex:"date",key:"date"},{title:"Product",dataIndex:"product",key:"product"},{title:"Opening",dataIndex:"opening",key:"opening"},{title:"Inward",dataIndex:"inward",key:"inward"},{title:"Outward",dataIndex:"outward",key:"outward"},{title:"Closing",dataIndex:"closing",key:"closing",render:m=>e.jsx("span",{style:{color:Number(m)<0?"red":"green"},children:m})}],w=async()=>{if(!a||a.length!==2)return;const[m,c]=a;await b({duration:[m.format("YYYY-MM-DD"),c.format("YYYY-MM-DD")],product_id:s||""})};return e.jsxs(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Stock Report"}),style:{borderRadius:16},children:[e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginBottom:16,flexWrap:"wrap"},children:[e.jsx(o.DatePicker.RangePicker,{value:a,onChange:r}),e.jsxs("select",{value:s,onChange:m=>i(m.target.value),style:{height:32,borderRadius:6,border:"1px solid #d9d9d9",padding:"0 8px"},children:[e.jsx("option",{value:"",children:"All Products"}),u.map(m=>e.jsx("option",{value:String(m?.value??""),children:String(m?.label??"")},String(m?.value??m?.id??m?.label)))]}),e.jsx(o.Button,{type:"primary",onClick:w,loading:h,children:"Search"}),e.jsx("div",{style:{marginLeft:"auto"},children:e.jsx(En,{data:{tableRef:n}})})]}),e.jsxs("div",{ref:n,children:[e.jsx("div",{className:"print-only",children:e.jsx(Gt,{})}),e.jsx(o.Table,{bordered:!0,size:"small",loading:h,rowKey:"key",columns:v,dataSource:y,pagination:{pageSize:50}})]})]})}const ed=({token:t})=>e.jsx(Zl,{token:t}),Mn=t=>t??localStorage.getItem("authToken")??"",xa=(t,n)=>{const a=String(t??""),r=String(n??"");return a?r?a.endsWith("/")&&r.startsWith("/")?`${a}${r.slice(1)}`:!a.endsWith("/")&&!r.startsWith("/")?`${a}/${r}`:`${a}${r}`:a:r},Se={upload:"api/branchapi/frontoffice/uploadfrontofficeDocument",roleDropdown:"api/Branch/getRoledropdownforBranch",staff:{list:"api/branchapi/staff/stafflist",searchByRole:"api/branchapi/staff/staffsearchbyRole",searchByKeywords:"api/branchapi/staff/staffsearchbyKeywords",deactivate:"api/branchapi/staff/staff_deactive",basicById:"api/branchapi/staff/getbasicdetailsbyID",experienceById:"api/branchapi/staff/getworkexperencebyID",payrollById:"api/branchapi/staff/getpayrollbyID",lastEmpNo:"api/branchapi/staff/getLastStaffEMPnumber",addBasic:"api/branchapi/staff/addstaffbasicdetails",editBasic:"api/branchapi/staff/editstaffbasicdetails",addExperience:"api/branchapi/staff/addstaffExperience",editExperience:"api/branchapi/staff/editstaffExperience",addPayroll:"api/branchapi/staff/addstaffpayroll",editPayroll:"api/branchapi/staff/editstaffpayroll",uploadProfile:"api/branchapi/staff/uploadstaffProfilepicture",uploadDocuments:"api/branchapi/staff/uploadDocuments"},master:{shift:{dropdown:"api/branchapi/generalSettings/shiftDropdown",table:"api/branchapi/generalSettings/shiftTable",add:"api/branchapi/generalSettings/shiftTable",add:"api/branchapi/generalSettings/addshift",edit:"api/branchapi/generalSettings/addshift",edit:"api/branchapi/generalSettings/editshift",remove:"api/branchapi/generalSettings/deleteshift",show:"api/branchapi/generalSettings/shiftShowdata"},department:{dropdown:"api/branchapi/humanResource/departmentDropdown",table:"api/branchapi/humanResource/departmenttypeTable",add:"api/branchapi/humanResource/adddepartment",edit:"api/branchapi/humanResource/editdepartment",remove:"api/branchapi/humanResource/deletedepartment",show:"api/branchapi/humanResource/departmentShowdata"},designation:{dropdown:"api/branchapi/humanResource/designationDropdown",table:"api/branchapi/humanResource/designationTable",add:"api/branchapi/humanResource/adddesignation",edit:"api/branchapi/humanResource/editdesignation",remove:"api/branchapi/humanResource/deletedesignation",show:"api/branchapi/humanResource/designationShowdata"},leaveType:{dropdown:"api/branchapi/humanResource/leavetypeDropdown",table:"api/branchapi/humanResource/LeavetypeTable",add:"api/branchapi/humanResource/addleavetype",edit:"api/branchapi/humanResource/editleavetype",remove:"api/branchapi/humanResource/deleteleavetype",show:"api/branchapi/humanResource/leavetypeShowdata"}},leave:{table:"api/branchapi/humanResource/LeaveTable",apply:"api/branchapi/humanResource/applyLeave",requestTable:"api/branchapi/humanResource/leaverequestTable",approveRequest:"api/branchapi/humanResource/approveleaveRequest"},attendance:{staffListForAttendance:"api/staff/attendence/stafflistforAttendence",staffDropdownByRole:"api/staff/attendence/getStaffDropDownByRoleId",addAttendanceToStaffByBranch:"api/staff/attendence/addattendencetoStaffbyBranch",manualAttendance:"api/staff/attendence/staffMenualAttendance",staffShiftByStaffId:"api/branchapi/staff/getStaffShiftByStaffId",dailyAttendance:"api/staff/attendence/dailyAttendance",dailyAttendanceMultipleShift:"api/staff/attendence/dailyAttendanceMultipleShift"},attendanceReport:{monthlyStaffReport:"api/AttendenceReport/staffmonthlyAttendenceReport_new",staffAttendanceList:"api/AttendenceReport/staffAttendanceList",overallStaffReport:"api/staff/attendence/getAlloverAttendenceReportofStaff"},payroll:{monthlyGraph:"api/branchapi/reportGraph/monthlyPayroleReportgraph",staffPayrollByStaffId:"api/branchapi/humanResource/getStaffPayroleByStaffID",generatePayslip:"api/branchapi/humanResource/generatePayslip",payrollByRole:"api/branchapi/humanResource/getpayrolebyRole",monthlyReport:"api/branchapi/humanResource/monthlyPayRolereport"}},ms=()=>xa(pt(),Se.upload),td=()=>xa(pt(),Se.staff.uploadProfile),nd=()=>xa(pt(),Se.staff.uploadDocuments),ad=async({baseUrl:t,page:n=1,perPage:a=10},r)=>{const s=t.includes("?")?"&":"?",i=`${t}${s}page=${encodeURIComponent(String(n))}&per_page=${encodeURIComponent(String(a))}`;return te(i,Mn(r))},ut=async(t,n,a)=>Ge(t,n,Mn(a)),yt=async(t,n,a)=>ft(t,n,Mn(a)),en=async(t,n,a)=>nt(t,n,Mn(a)),jt=Se.staff,rd=Se.master.shift.dropdown,sd=Se.master.department.dropdown,od=Se.master.designation.dropdown,id=Se.roleDropdown,cn=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},ld=t=>t?typeof t=="string"?t:typeof t?.data=="string"?t.data:typeof t?.filename=="string"?t.filename:typeof t?.file=="string"?t.file:"":"",qt={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},br={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"};function dd({token:t,mode:n,staffId:a,initialValues:r,onSubmitted:s}){const i=l.useMemo(()=>{try{return JSON.parse(localStorage.getItem("genrall_settings"))}catch{return null}},[]),d=String(i?.multiple_shift??"").toLowerCase()==="yes",[u,b]=l.useState(r?.roleValue??null),[h,p]=l.useState(r?.departmentValue??null),[y,v]=l.useState(r?.designationValue??null),[w,m]=l.useState(r?.genderValue??null),[c,f]=l.useState(r?.shiftValue??(d?[]:null)),[T,C]=l.useState(r?.dob?ye(r.dob):null),[S,j]=l.useState(r?.doj?ye(r.doj):null),[g,_]=l.useState(r?.file??""),{data:P}=X(t?[rd,t]:null,([W,L])=>te(W,L)),{data:I}=X(t?[sd,t]:null,([W,L])=>te(W,L)),{data:O}=X(t?[od,t]:null,([W,L])=>te(W,L)),{data:k}=X(t?[id,t]:null,([W,L])=>te(W,L)),{data:E}=X(t?[jt.lastEmpNo,t]:null,([W,L])=>te(W,L)),D=l.useMemo(()=>cn(P),[P]),F=l.useMemo(()=>cn(I),[I]),V=l.useMemo(()=>cn(O),[O]),Z=l.useMemo(()=>cn(k),[k]),U=l.useMemo(()=>{const W=E?.data?.emp_number??E?.emp_number??E?.data??"";return String(W??"")},[E]),Y=async W=>{W.preventDefault();const L=new FormData(W.target);L.set("role",u?.value??u??""),L.set("department",h?.value??h??""),L.set("designation",y?.value??y??""),L.set("gender",w?.value??w??""),L.set("dob",T?T.format("YYYY-MM-DD"):""),L.set("doj",S?S.format("YYYY-MM-DD"):""),d?(L.delete("shift_id"),(Array.isArray(c)?c:[]).forEach(R=>{L.append("shift_id[]",R?.value??R??"")})):L.set("shift_id",c?.value??c??""),g&&L.set("file",g);try{const x=n==="edit"&&a,R=x?jt.editBasic:jt.addBasic;x&&L.set("staff_id",String(a));const $=x?await yt(R,L,t):await ut(R,L,t),q=$?.ID??$?.id??a??null;A.success("Success!",{duration:1e3}),s?.({staffId:q,basic:{roleValue:u,departmentValue:h,designationValue:y,genderValue:w,shiftValue:c,dob:T,doj:S,file:g}})}catch(x){A.error(x?.response?.data?.msg??x?.message??"Failed.",{duration:1e3})}};return e.jsx("form",{onSubmit:Y,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(z,{type:"number",name:"emp_number",label:"EMP No",defaultValue:r?.emp_number??U,required:!0}),e.jsx(z,{type:"text",name:"f_name",label:"First Name",defaultValue:r?.f_name??"",required:!0}),e.jsx(z,{type:"text",name:"l_name",label:"Last Name",defaultValue:r?.l_name??"",required:!0}),e.jsx(z,{type:"text",name:"pan_no",label:"PAN",defaultValue:r?.pan_no??""}),e.jsx(z,{type:"text",name:"adhar_no",label:"Aadhar",defaultValue:r?.adhar_no??""}),e.jsx(le,{label:"Role",options:Z,value:u,onChange:W=>b(W??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,required:!0}),e.jsx(le,{label:"Department",options:F,value:h,onChange:W=>p(W??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,required:!0}),e.jsx(le,{label:"Designation",options:V,value:y,onChange:W=>v(W??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,required:!0}),e.jsx(le,{label:"Gender",options:[{value:"Male",label:"Male"},{value:"Female",label:"Female"},{value:"Other",label:"Other"}],value:w,onChange:W=>m(W??null),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,required:!0}),e.jsx(z,{type:"text",name:"email",label:"Email",defaultValue:r?.email??""}),e.jsxs("div",{children:[e.jsx("div",{style:qt,children:"DOB"}),e.jsx(o.DatePicker,{value:T,onChange:W=>C(W),style:br,placeholder:"Select DOB"})]}),e.jsxs("div",{children:[e.jsx("div",{style:qt,children:"DOJ"}),e.jsx(o.DatePicker,{value:S,onChange:W=>j(W),style:br,placeholder:"Select DOJ"})]}),e.jsx(z,{type:"text",name:"bloodGroup",label:"Blood Group",defaultValue:r?.bloodGroup??""}),e.jsx(z,{type:"text",name:"contact_no",label:"Contact No",defaultValue:r?.contact_no??"",required:!0}),e.jsx(z,{type:"text",name:"education",label:"Education",defaultValue:r?.education??""}),e.jsxs("div",{children:[e.jsx("div",{style:qt,children:"Shift"}),e.jsx(le,{options:D,value:c,onChange:W=>f(W??(d?[]:null)),isMulti:d,closeMenuOnSelect:!d,hideSelectedOptions:!1,allowSelectAll:!1,required:!0})]}),e.jsxs("div",{style:{width:"100%"},children:[e.jsx("div",{style:qt,children:"Profile Picture"}),e.jsx(o.Upload,{maxCount:1,action:td(),headers:t?{Authorization:t}:void 0,onChange:W=>{if(W?.file?.status==="done"){const L=ld(W?.file?.response);L&&_(L)}W?.file?.status==="removed"&&_("")},children:e.jsx(o.Button,{type:"link",style:{paddingLeft:0},children:g?"Change":"Upload"})})]}),e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("div",{style:qt,children:"Address"}),e.jsx("textarea",{name:"address",rows:3,defaultValue:r?.address??"",placeholder:"Address",style:{width:"100%",resize:"vertical",padding:10,border:"1px solid #d9d9d9",borderRadius:8,outline:"none"}})]}),e.jsx("div",{style:{gridColumn:"1 / -1",display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Save & Next",color:"primary"})})]})})}const un={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},Sr={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"},cd=t=>t?typeof t=="string"?t:typeof t?.data=="string"?t.data:typeof t?.filename=="string"?t.filename:typeof t?.file=="string"?t.file:"":"",jr=t=>{if(!t)return null;const n=ye(t);return n.isValid()?n:null};function ud({token:t,mode:n,staffId:a,initialRows:r,onSubmitted:s,onBack:i}){const[d,u]=l.useState(()=>(Array.isArray(r)&&r.length?r:[{name:"",from:null,to:null,image:""}]).map(m=>({name:m?.name??"",from:jr(m?.from),to:jr(m?.to),image:m?.image??""}))),b=l.useMemo(()=>t?{Authorization:t}:void 0,[t]),h=(w,m)=>{u(c=>c.map((f,T)=>T===w?{...f,...m}:f))},p=()=>u(w=>[...w,{name:"",from:null,to:null,image:""}]),y=w=>u(m=>m.length<=1?m:m.filter((c,f)=>f!==w)),v=async w=>{if(w.preventDefault(),!a){A.error("Missing staff id.",{duration:1e3});return}const m=new FormData;m.append("staff_id",String(a)),d.forEach((c,f)=>{m.append(`experience[${f}][name]`,String(c?.name??"")),m.append(`experience[${f}][from]`,c?.from?c.from.format("YYYY-MM-DD"):""),m.append(`experience[${f}][to]`,c?.to?c.to.format("YYYY-MM-DD"):""),m.append(`experience[${f}][image]`,String(c?.image??""))});try{const c=n==="edit",f=c?jt.editExperience:jt.addExperience,T=c?await yt(f,m,t):await ut(f,m,t);A.success("Success!",{duration:1e3}),s?.({experience:d,result:T})}catch(c){A.error(c?.response?.data?.msg??c?.message??"Failed.",{duration:1e3})}};return e.jsx("form",{onSubmit:v,children:e.jsxs("div",{style:{display:"grid",gap:16},children:[d.map((w,m)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:16,alignItems:"end",border:"1px solid #eee",borderRadius:12,padding:14},children:[e.jsxs("div",{children:[e.jsx("div",{style:un,children:"Name"}),e.jsx("input",{value:w.name,onChange:c=>h(m,{name:c.target.value}),placeholder:"Company / School",style:{width:"100%",height:40,border:"none",borderBottom:"1px solid #d9d9d9",outline:"none",background:"transparent"}})]}),e.jsxs("div",{children:[e.jsx("div",{style:un,children:"From"}),e.jsx(o.DatePicker,{value:w.from,onChange:c=>h(m,{from:c}),style:Sr})]}),e.jsxs("div",{children:[e.jsx("div",{style:un,children:"To"}),e.jsx(o.DatePicker,{value:w.to,onChange:c=>h(m,{to:c}),style:Sr})]}),e.jsxs("div",{children:[e.jsx("div",{style:un,children:"Document"}),e.jsx(o.Upload,{maxCount:1,action:nd(),headers:b,onChange:c=>{if(c?.file?.status==="done"){const f=cd(c?.file?.response);f&&h(m,{image:f})}c?.file?.status==="removed"&&h(m,{image:""})},children:e.jsx(o.Button,{icon:e.jsx(ce.UploadOutlined,{}),children:"Upload"})}),!!w.image&&e.jsx("div",{style:{fontSize:12,color:"#666",marginTop:6},children:w.image})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:e.jsx(o.Button,{type:"text",icon:e.jsx(ce.DeleteOutlined,{}),danger:!0,onClick:()=>y(m),disabled:d.length<=1})})]},`exp-${m}`)),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[e.jsx(o.Button,{icon:e.jsx(ce.PlusOutlined,{}),onClick:p,children:"Add Experience"}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsx(o.Button,{onClick:i,children:"Back"}),e.jsx(me,{type:"submit",value:"Save & Next",color:"primary"})]})]})]})})}const wr=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:n??[]},zt=[{label:"Per Hour",value:"Hourly"},{label:"Per Lecture",value:"lecture_wise"}];function pd({token:t,mode:n,staffId:a,initialValues:r,onSubmitted:s,onBack:i}){const[d,u]=l.useState(r?.type??"Permanent"),[b,h]=l.useState(r?.salary_type??zt[0]?.value),[p,y]=l.useState(Number(r?.amount??0)),[v,w]=l.useState(Number(r?.basic_pay??0)),[m,c]=l.useState(r?.declarationPERyear??""),{data:f}=X(t?[ri,t]:null,([_,P])=>te(_,P),{revalidateOnFocus:!1}),T=l.useMemo(()=>wr(f?.Allowances),[f]),C=l.useMemo(()=>wr(f?.Dedection),[f]),S=l.useMemo(()=>{const _=Number(v||0),P=(Array.isArray(T)?T:[]).map(D=>{const F=D?.amount_type??D?.amountType??D?.type,V=Number(D?.Amount??D?.amount??0),Z=String(F).toLowerCase()==="flat"?V:Number(_)/100*Number(V||0);return{...D,value:Number.isFinite(Z)?Z:0}}),I=(Array.isArray(C)?C:[]).map(D=>{const F=D?.amount_type??D?.amountType??D?.type,V=Number(D?.Amount??D?.amount??0),Z=String(F).toLowerCase()==="flat"?V:Number(_)/100*Number(V||0);return{...D,value:Number.isFinite(Z)?Z:0}}),O=P.reduce((D,F)=>D+Number(F?.value||0),0),k=I.reduce((D,F)=>D+Number(F?.value||0),0),E=Math.max(0,Number(_)+O-k);return{allowances:P,deductions:I,netAmount:E}},[T,C,v]),j=async _=>{if(_.preventDefault(),!a){A.error("Missing staff id.",{duration:1e3});return}const P=new FormData;P.append("staff_id",String(a)),P.append("type",d),d==="Nonpermanent"?(P.append("salary_type",b??""),P.append("amount",String(p||"")),P.append("Allowances",JSON.stringify([])),P.append("Dedection",JSON.stringify([]))):(P.append("basic_pay",String(v||"")),P.append("declarationPERyear",String(m??"")),P.append("Allowances",JSON.stringify(S.allowances||[])),P.append("Dedection",JSON.stringify(S.deductions||[])),P.append("amount",String(S.netAmount||0)));try{const I=n==="edit",O=I?jt.editPayroll:jt.addPayroll,k=I?await yt(O,P,t):await ut(O,P,t);A.success("Success!",{duration:1e3}),s?.({payroll:{staffType:d,salaryType:b,amount:p,basicPay:v,declaration:m},result:k})}catch(I){A.error(I?.response?.data?.msg??I?.message??"Failed.",{duration:1e3})}},g=l.useMemo(()=>[{title:"Title",dataIndex:"title",key:"title",ellipsis:!0},{title:"Amount",key:"amount",width:160,render:(_,P)=>`${P?.Amount??""} / ${P?.amount_type??""}`},{title:"Value",dataIndex:"value",key:"value",width:120}],[]);return e.jsx("form",{onSubmit:j,children:e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{label:"Employment Type",options:[{label:"Permanent",value:"Permanent"},{label:"Non Permanent",value:"Nonpermanent"}],value:{label:d==="Nonpermanent"?"Non Permanent":"Permanent",value:d},onChange:_=>u(_?.value??"Permanent"),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,required:!0}),d==="Nonpermanent"?e.jsxs(e.Fragment,{children:[e.jsx(le,{label:"Type",options:zt,value:zt.find(_=>_.value===b)??zt[0],onChange:_=>h(_?.value??zt[0]?.value),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,required:!0}),e.jsx(z,{type:"number",label:"Amount",value:p,onChange:_=>y(Number(_.target.value||0)),required:!0})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{type:"number",label:"Basic Pay",value:v,onChange:_=>w(Number(_.target.value||0)),required:!0}),e.jsx(z,{type:"text",label:"IT Declarations/Year",value:m,onChange:_=>c(_.target.value)}),e.jsx(z,{type:"number",label:"Net Amount",value:S.netAmount,disabled:!0})]})]}),d==="Permanent"&&e.jsxs(e.Fragment,{children:[e.jsx(o.Card,{size:"small",title:e.jsx("div",{style:{fontWeight:600},children:"Allowances"}),children:e.jsx(o.Table,{bordered:!0,size:"small",rowKey:(_,P)=>`${_?.title??"a"}-${P}`,columns:g,dataSource:S.allowances,pagination:!1})}),e.jsx(o.Card,{size:"small",title:e.jsx("div",{style:{fontWeight:600},children:"Deductions"}),children:e.jsx(o.Table,{bordered:!0,size:"small",rowKey:(_,P)=>`${_?.title??"d"}-${P}`,columns:g,dataSource:S.deductions,pagination:!1})})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[e.jsx(Button,{onClick:i,children:"Back"}),e.jsx(me,{type:"submit",value:"Finish",color:"primary"})]})]})})}const fd=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]};function md({token:t,mode:n="add",staffId:a,onFinished:r}){const[s,i]=l.useState(0),[d,u]=l.useState(a??null),[b,h]=l.useState(null),[p,y]=l.useState(null),[v,w]=l.useState(null),m=n==="edit"?a??d:null,c=l.useMemo(()=>m?`${Se.staff.basicById}?staff_id=${encodeURIComponent(String(m))}`:null,[m]),f=l.useMemo(()=>m?`${Se.staff.experienceById}?staff_id=${encodeURIComponent(String(m))}`:null,[m]),T=l.useMemo(()=>m?`${Se.staff.payrollById}?staff_id=${encodeURIComponent(String(m))}`:null,[m]),{data:C}=X(t&&c?[c,t]:null,([O,k])=>te(O,k)),{data:S}=X(t&&f?[f,t]:null,([O,k])=>te(O,k)),{data:j}=X(t&&T?[T,t]:null,([O,k])=>te(O,k)),g=l.useMemo(()=>{const O=fd(C)[0]??C?.data??C??null;return O?{emp_number:O?.emp_number??O?.empNo??"",f_name:O?.f_name??O?.firstname??O?.first_name??"",l_name:O?.l_name??O?.lastname??O?.last_name??"",pan_no:O?.pan_no??"",adhar_no:O?.adhar_no??"",email:O?.email??"",dob:O?.dob??"",doj:O?.doj??"",bloodGroup:O?.bloodGroup??O?.blood_group??"",contact_no:O?.contact_no??O?.phone??"",education:O?.education??"",address:O?.address??"",file:O?.file??O?.profile_picture??""}:null},[C]),_=l.useMemo(()=>{const O=S?.data??S??null;return(Array.isArray(O?.experience)?O.experience:Array.isArray(O)?O:[]).map(E=>({name:E?.name??"",from:E?.from??"",to:E?.to??"",image:E?.image??""}))},[S]),P=l.useMemo(()=>{const O=j?.data??j??null;return O?{type:O?.type??"Permanent",salary_type:O?.salary_type??"",amount:O?.amount??"",basic_pay:O?.basic_pay??"",declarationPERyear:O?.declarationPERyear??""}:null},[j]),I=l.useMemo(()=>[{title:"Basic"},{title:"Experience"},{title:"Payroll"}],[]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:n==="edit"?"Edit Staff":"Add Staff"}),children:e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsx(o.Steps,{current:s,items:I}),s===0&&e.jsx(dd,{token:t,mode:n,staffId:m,initialValues:g,onSubmitted:({staffId:O})=>{O&&u(O),i(1)}}),s===1&&e.jsx(ud,{token:t,mode:n,staffId:m??d,initialRows:_,onBack:()=>i(0),onSubmitted:()=>i(2)}),s===2&&e.jsx(pd,{token:t,mode:n,staffId:m??d,initialValues:P,onBack:()=>i(1),onSubmitted:()=>{A.success("Completed.",{duration:1e3}),r?.({staffId:m??d})}})]})})]})}function hd({token:t}){return e.jsx(md,{token:t,mode:"add"})}const yd=({token:t})=>e.jsx(hd,{token:t}),pn=Se.staff,gd=Se.roleDropdown,xd=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},bd=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]};function Sd({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(""),[i,d]=l.useState(""),{data:u}=X(t?[gd,t]:null,([T,C])=>te(T,C)),b=l.useMemo(()=>xd(u),[u]),h=l.useMemo(()=>{const T=n.page,C=n.rowsPerPage,S=r&&!i?`${pn.searchByRole}?role_id=${encodeURIComponent(String(r))}`:i?`${pn.searchByKeywords}?key=${encodeURIComponent(String(i))}`:pn.list,j=S.includes("?")?"&":"?";return`${S}${j}page=${encodeURIComponent(String(T))}&per_page=${encodeURIComponent(String(C))}`},[n.page,n.rowsPerPage,i,r]),{isLoading:p,error:y,data:v,mutate:w}=X(t?[h,t]:null,([T,C])=>te(T,C)),m=l.useMemo(()=>bd(v),[v]),c=async T=>{const C=T?.id??T?.fk_staffID??T?.staff_id;if(C)try{await en(pn.deactivate,C,t),A.success("Success! Staff deactivated.",{duration:1e3}),await w()}catch(S){A.error(S?.response?.data?.msg??S?.message??"Failed to deactivate staff.",{duration:1e3})}},f=l.useMemo(()=>[{title:"Name",key:"name",ellipsis:!0,render:(T,C)=>`${C?.firstname??C?.first_name??""} ${C?.lastname??C?.last_name??""}`.trim()||C?.name||""},{title:"Role",dataIndex:"role_name",key:"role_name",ellipsis:!0,responsive:["md"]},{title:"Phone",dataIndex:"phone",key:"phone",ellipsis:!0,responsive:["md"]},{title:"Email",dataIndex:"email",key:"email",ellipsis:!0,responsive:["lg"]},{title:"Status",dataIndex:"status",key:"status",width:120,responsive:["lg"]},{title:"Action",key:"action",width:90,fixed:"right",render:(T,C)=>e.jsx(o.Button,{type:"text",danger:!0,size:"small",icon:e.jsx(ce.DeleteOutlined,{}),onClick:()=>c(C),style:{padding:2}})}],[t]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(320px, 1fr))",gap:20,alignItems:"start"},children:[e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:3,style:{margin:0},children:"Filters"}),children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{options:[{value:"",label:"All Roles"},...b],closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Role",placeholder:"Role",allowSelectAll:!1,onChange:T=>{s(T?.value??""),a(C=>({...C,page:1}))}}),e.jsx(z,{type:"text",label:"Keyword",value:i,onChange:T=>d(T.target.value),placeholder:"Search by keywords"}),e.jsx(me,{type:"button",value:"Refresh",onClick:()=>w()})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:7,style:{margin:0},children:"Staff Directory"}),children:e.jsx(o.Table,{bordered:!0,size:"small",loading:p,rowKey:T=>String(T?.id??T?.fk_staffID??T?.staff_id??Math.random()),columns:f,dataSource:m,pagination:{current:n.page,pageSize:n.rowsPerPage,onChange:(T,C)=>a({page:T,rowsPerPage:C}),showSizeChanger:!0},scroll:{x:"max-content"}})})]})]})}const jd=({token:t})=>e.jsx(Sd,{token:t}),wd=Se.attendance,vd=Se.roleDropdown,vr=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},fn={display:"block",marginBottom:6,fontSize:"14px",fontWeight:500,color:"#222"},_r={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"};function _d({token:t,open:n,onClose:a,roleId:r,onSaved:s}){const[i,d]=l.useState(null),[u,b]=l.useState(""),[h,p]=l.useState(ye()),[y,v]=l.useState(ye()),[w,m]=l.useState(ye()),c=l.useMemo(()=>r?`${Se.attendance.staffDropdownByRole}?role_id=${encodeURIComponent(String(r))}`:null,[r]),{data:f}=X(t&&c?[c,t]:null,([_,P])=>te(_,P)),T=l.useMemo(()=>vr(f),[f]),{trigger:C,data:S}=ze(t?Se.attendance.staffShiftByStaffId:null,(_,{arg:P})=>At(_,{arg:P},t)),j=l.useMemo(()=>vr(S),[S]),g=async()=>{if(!i?.value){A.error("Select staff.",{duration:1e3});return}if(!u){A.error("Select shift.",{duration:1e3});return}const _=new FormData;_.set("staffID",String(i.value)),_.set("shift_id",String(u)),_.set("attendance_date",h?h.format("YYYY-MM-DD"):""),_.set("intime",y?y.format("h:mm a"):""),_.set("outime",w?w.format("h:mm a"):"");try{await ut(Se.attendance.manualAttendance,_,t),A.success("Success!",{duration:1e3}),s?.(),a?.(),d(null),b(""),p(ye()),v(ye()),m(ye())}catch(P){A.error(P?.response?.data?.msg??P?.message??"Failed.",{duration:1e3})}};return e.jsx(o.Modal,{open:n,onCancel:a,footer:null,destroyOnClose:!0,title:"Attendance",width:620,children:e.jsx(o.Card,{children:e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsx(le,{label:"Staff",options:T,value:i,onChange:async _=>{if(d(_??null),b(""),_?.value&&C)try{await C({staff_id:_.value})}catch{}},closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1,required:!0}),e.jsxs("div",{children:[e.jsx("div",{style:fn,children:"Shift"}),e.jsx(o.Radio.Group,{value:u,onChange:_=>b(_.target.value),style:{display:"grid",gap:8},children:j.map(_=>e.jsx(o.Radio,{value:_?.value,children:_?.label??_?.name??_?.title??String(_?.value??"")},String(_?.value)))})]}),e.jsxs("div",{children:[e.jsx("div",{style:fn,children:"Date"}),e.jsx(o.DatePicker,{value:h,onChange:_=>_&&p(_),style:{width:"100%"}})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},children:[e.jsxs("div",{children:[e.jsx("div",{style:fn,children:"Start Time"}),e.jsx(o.TimePicker,{value:y,onChange:_=>_&&v(_),use12Hours:!0,format:"h:mm a",style:_r})]}),e.jsxs("div",{children:[e.jsx("div",{style:fn,children:"End Time"}),e.jsx(o.TimePicker,{value:w,onChange:_=>_&&m(_),use12Hours:!0,format:"h:mm a",style:_r})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[e.jsx(o.Button,{onClick:a,children:"Cancel"}),e.jsx(me,{type:"button",value:"Save",color:"primary",onClick:g})]})]})})})}const Cd=({tableRef:t,excelDisabled:n})=>{const a=new Date().getTime(),r=Vt.useReactToPrint({content:()=>t?.current});return e.jsx(o.Row,{justify:"end",children:e.jsx(o.Col,{children:e.jsxs(o.Row,{gutter:8,children:[e.jsx(o.Col,{children:e.jsx(o.Button,{type:"text",icon:e.jsx(ce.PrinterOutlined,{style:{color:"#5080f8"}}),onClick:r})}),e.jsx(o.Col,{children:n?e.jsx(o.Button,{type:"text",icon:e.jsx(ce.FileTextOutlined,{style:{color:"gray"}}),onClick:()=>A.error("You must save attendance before download",{duration:2e3})}):e.jsx(ds.DownloadTableExcel,{filename:a,sheet:"users",currentTableRef:t?.current,children:e.jsx(o.Button,{type:"text",icon:e.jsx(ce.FileTextOutlined,{style:{color:"#5080f8"}})})})})]})})})},Td=(t,n)=>{const a=t?.data?.data??t?.data??t??null;return a?n==="student"?Array.isArray(a?.student)?a.student:[]:Array.isArray(a?.staff)?a.staff:[]:[]},Rd=t=>{const n=t?.pagination?.total_rows??t?.data?.pagination?.total_rows??t?.total??t?.total_rows,a=Number(n);return Number.isFinite(a)&&a>=0?a:0},Dd=(t,n)=>{const a=t?.data?.data??t?.data??t??null;return a?n==="student"?{sunday:String(a?.sunday??"").toLowerCase()==="yes",holiday:String(a?.holiday??"").toLowerCase()==="yes"}:{sunday:!!a?.sunday,holiday:!!a?.holiday}:{sunday:!1,holiday:!1}};function Ad({token:t,url:n,columns:a,reload:r,setReload:s,saveBtnRef:i,setSaveBtnDisabled:d,date:u,type:b="staff"}){const h=l.useRef(null),[p,y]=l.useState({page:0,rowsPerPage:10}),[v,w]=l.useState(!1),[m,c]=l.useState(!1),[f,T]=l.useState(null),[C,S]=l.useState([]),[j,g]=l.useState({sunday:!1,holiday:!1}),[_,P]=l.useState(!0);l.useEffect(()=>{y(E=>({...E,page:0}))},[n]),l.useEffect(()=>{let E=!0;return(async()=>{if(!(!t||!n)){w(!0);try{const F=String(n).includes("?")?"&":"?",V=`${n}${F}page=${p.page+1}&per_page=${p.rowsPerPage}`,Z=await te(V,t);if(!E)return;T(Z),Z?.Status==="Success"?(d?.(!1),S(Td(Z,b)),g(Dd(Z,b))):(d?.(!0),S([]),g({sunday:!1,holiday:!1}))}catch{if(!E)return;d?.(!0),S([])}finally{E&&w(!1)}}})(),()=>{E=!1}},[p.page,p.rowsPerPage,r,d,t,b,n]);const I=l.useMemo(()=>Rd(f),[f]);l.useEffect(()=>{const E=(Array.isArray(C)?C:[]).find(D=>D?.attendence_type_id===null);P(!!E)},[C]);const O=async()=>{if(t){c(!0);try{if(b==="staff"){const E=(Array.isArray(C)?C:[]).map(D=>({staff_id:D?.staff_id,attendence_type_id:D?.attendence_type_id?D.attendence_type_id:"1",in_time:D?.intime,out_time:D?.outtime,date:u}));await ut(Se.attendance.addAttendanceToStaffByBranch,E,t),A.success("Attendance saved successfully",{duration:2e3}),s?.(D=>!D)}else A.error("Student attendance save is not migrated yet.",{duration:2e3})}catch(E){A.error(E?.response?.data?.msg??E?.message??"Failed required dates",{duration:2e3})}finally{c(!1)}}},k=l.useMemo(()=>(Array.isArray(a)?a:[]).map(D=>D?.selector==="attendence_type_id"?{title:D?.name??"Attendance",dataIndex:D.selector,key:D.selector,render:F=>F==null||F===""?e.jsx(o.Tag,{color:"orange",children:"Not Set"}):String(F)==="1"?e.jsx(o.Tag,{color:"green",children:"Present"}):String(F)==="4"?e.jsx(o.Tag,{color:"red",children:"Absent"}):String(F)==="3"?e.jsx(o.Tag,{color:"orange",children:"Late"}):e.jsx(o.Tag,{children:String(F)})}:D?.selector==="snum"?{title:D?.name??"Sl",key:D.selector,render:(F,V,Z)=>Z+1}:{title:D?.name??D?.selector,dataIndex:D?.selector,key:D?.selector}),[a]);return e.jsxs("div",{style:{width:"100%"},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsxs(o.Card,{children:[e.jsx(Cd,{tableRef:h,excelDisabled:_}),e.jsx(o.Modal,{open:m,footer:null,closable:!1,centered:!0,children:e.jsxs("div",{style:{display:"grid",placeItems:"center",gap:12,padding:12},children:[e.jsx(o.Spin,{size:"large"}),e.jsx("div",{children:"Please wait..."})]})}),j.sunday?e.jsx("div",{style:{textAlign:"center",fontWeight:600,padding:"16px 0"},children:"Weekly Off"}):j.holiday?e.jsx("div",{style:{textAlign:"center",padding:"16px 0"},children:e.jsx("div",{style:{fontWeight:700,marginBottom:6},children:"Holiday"})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:h,children:e.jsx(o.Table,{bordered:!0,size:"small",rowKey:(E,D)=>String(E?.id??E?.staff_id??D),columns:k,dataSource:C,loading:v,pagination:{current:p.page+1,pageSize:p.rowsPerPage,total:I,showSizeChanger:!0,onChange:(E,D)=>y({page:E-1,rowsPerPage:D})},scroll:{x:"max-content"}})}),e.jsx("button",{type:"button",onClick:O,ref:i,style:{display:"none"},children:"hidden"})]})]})]})}const Od=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},Pd={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"};function Id({token:t}){const[n,a]=l.useState(""),[r,s]=l.useState(ye().format("YYYY-MM-DD")),[i,d]=l.useState(!1),[u,b]=l.useState(null),[h,p]=l.useState(!1),[y,v]=l.useState(!0),[w,m]=l.useState(!1),c=l.useRef(null),{data:f}=X(t?[vd,t]:null,([S,j])=>te(S,j)),T=l.useMemo(()=>Od(f),[f]),C=l.useMemo(()=>[{id:"1",name:"Staff Id",selector:"employee_id",sortable:!0},{id:"2",name:"Name",selector:"full_name",sortable:!0},{id:"4",name:"Contact",selector:"contact_no",sortable:!0},{id:"3",name:"Attendance",selector:"attendence_type_id",sortable:!0},{id:"5",name:"In Time",selector:"intime",sortable:!0},{id:"6",name:"Out Time",selector:"outtime",sortable:!0}],[]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Staff Attendance"}),children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{options:T,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Roles",placeholder:"Roles",allowSelectAll:!1,onChange:S=>a(S?.value??""),required:!0}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222",marginBottom:6},children:"Date"}),e.jsx(o.DatePicker,{defaultValue:ye(),onChange:S=>S&&s(S.format("YYYY-MM-DD")),style:Pd,allowClear:!1})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"button",value:"Search",color:"primary",onClick:()=>{!n||!r||(b(`${wd.staffListForAttendance}?role=${encodeURIComponent(String(n))}&date=${encodeURIComponent(String(r))}`),d(S=>!S))}})})]})}),e.jsxs(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Staff Attendance List"}),children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginBottom:12},children:[e.jsx(o.Button,{size:"small",type:h?"primary":"default",onClick:()=>p(S=>!S),children:h?"Marked":"Mark As Holiday"}),e.jsx(o.Button,{size:"small",type:"default",disabled:y,onClick:()=>m(!0),children:"Give Attendance"})]}),u?e.jsx(Ad,{token:t,url:u,columns:C,reload:i,setReload:d,saveBtnRef:c,setSaveBtnDisabled:v,date:r,type:"staff",holidayChecked:h}):null]}),e.jsx(_d,{token:t,open:w,onClose:()=>m(!1),roleId:n,onSaved:()=>d(S=>!S)})]})}const Ed=({token:t})=>e.jsx(Id,{token:t}),Cr=Se.attendanceReport.monthlyStaffReport,kd=Se.roleDropdown,Md=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]};function Fd({token:t}){const n=l.useRef(null),[a,r]=l.useState(!1),[s,i]=l.useState([]),[d,u]=l.useState({role:"",rolllabel:"",year:"",month:""}),b=l.useMemo(()=>ss(5),[]),{data:h}=X(t?[kd,t]:null,([E,D])=>te(E,D)),p=l.useMemo(()=>Md(h),[h]),[y,v]=l.useState([]),[w,m]=l.useState(1),[c,f]=l.useState(!1),[T,C]=l.useState(!1),[S,j]=l.useState(null),g=l.useMemo(()=>{try{return JSON.parse(localStorage.getItem("genrall_settings"))?.session_id??"1"}catch{return"1"}},[]),{trigger:_}=ze(t&&Cr?`${Cr}?page=${w}&per_page=3`:null,(E,{arg:D})=>At(E,{arg:D},t),{onSuccess:E=>{f(!1);const D=Array.isArray(E)?E:[];D.length>0&&v(F=>[...F||[],...D]),D.length>1?m(F=>F+1):C(!1)},onError:()=>{f(!1),C(!1)}});l.useEffect(()=>{T&&_&&S&&_(S)},[T,w,S,_]);const P=l.useMemo(()=>{const E=[{title:"Staff Id",dataIndex:"employee_id",key:"employee_id",align:"center"},{title:"Name",dataIndex:"full_name",key:"full_name",render:(D,F)=>e.jsx("span",{className:"attendanceFont",style:{cursor:"pointer",whiteSpace:"nowrap",color:"blue",textDecoration:"underline"},children:F?.full_name??""})}];return Array.isArray(y)&&y.length>0&&((y[0]?.monthly_data??[]).forEach((F,V)=>{E.push({title:V+1,align:"center",key:String(V+1),render:(Z,U)=>{const Y=U?.monthly_data?.[V]?.[0]?.data?.[0]??{},W=Y?.intime??"",L=Y?.outtime??"",x=Y?.attendance_type??"";return e.jsx(o.Tooltip,{title:e.jsxs("div",{style:{fontSize:12},children:[e.jsxs("div",{children:["In Time ",W]}),e.jsxs("div",{children:["Out Time ",L]})]}),placement:"top",children:e.jsx("span",{className:"attendanceFont",style:{fontSize:10,display:"flex",justifyContent:"center"},children:_t(x)})})}})}),E.push({title:"Total",key:"Total",render:(F,V)=>{const Z=V?.monthly_data??[],U=Z.filter(W=>W?.[0]?.data?.[0]?.attendance_type==="A").length,Y=Z.filter(W=>W?.[0]?.data?.[0]?.attendance_type==="P").length;return e.jsx("span",{className:"attendanceFont",children:e.jsxs("b",{children:["A : ",U," P : ",Y]})})}})),E},[y]),I=l.useMemo(()=>[{label:"Present",el:_t("P")},{label:"Absent",el:_t("A")},{label:"Leave",el:_t("L")},{label:"Weekly Off",el:_t("W")},{label:"Holiday",el:_t("H")}],[]),O=l.useMemo(()=>d.month?s.find(E=>E?.value==d.month)?.label??d.month??"--":"--",[d.month,s]),k=async E=>{if(E.preventDefault(),!d.role||!d.year||!d.month)return;m(1),f(!0),v([]);const D={session:g,year:d.year,month:d.month,day:"01",role:d.role};j(D),C(!0),await _?.(D)};return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(o.Card,{className:"d-print-none",title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Attendance Report"}),children:e.jsx("form",{onSubmit:k,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(le,{options:p,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Roles",allowSelectAll:!1,name:"role",required:!0,onChange:E=>u(D=>({...D,role:E?.value??"",rolllabel:E?.label??""}))}),e.jsx(le,{options:b,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Year",allowSelectAll:!1,name:"year",required:!0,onChange:E=>{const D=os(E?.value);i(D),r(F=>!F),u(F=>({...F,year:E?.label??""}))}}),e.jsx(le,{options:s,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Month",allowSelectAll:!1,name:"month",required:!0,onChange:E=>u(D=>({...D,month:E?.value??""}))},`month-${a}`),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Search",color:"primary"})})]})})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Monthly Attendance Report"}),children:e.jsxs("div",{ref:n,children:[e.jsx("div",{className:"print-only",children:e.jsx(Gt,{})}),e.jsxs("div",{style:{border:"1px solid #ddd",borderRadius:8,padding:16,marginBottom:24,backgroundColor:"#f8f9fa"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:12,alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:18,fontWeight:600,marginBottom:6},children:"Staff Attendance Summary"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:10,fontSize:13},children:[e.jsxs("div",{children:["Role: ",e.jsx("span",{style:{fontWeight:700},children:d.rolllabel||"--"})]}),e.jsxs("div",{children:["Year: ",e.jsx("span",{style:{fontWeight:700},children:d.year||"--"})]}),e.jsxs("div",{children:["Month: ",e.jsx("span",{style:{fontWeight:700},children:O})]})]})]}),e.jsx("div",{className:"d-print-none",style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(En,{data:{tableRef:n}})})]}),e.jsx("div",{style:{marginTop:14,paddingTop:14,borderTop:"1px solid #e0e0e0"},children:e.jsx("div",{style:{display:"flex",justifyContent:"center",flexWrap:"wrap",gap:12,fontSize:12},children:I.map(E=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsxs("div",{children:[E.label," :"]}),e.jsx("div",{children:E.el})]},E.label))})})]}),e.jsx(o.Skeleton,{active:!0,loading:c,paragraph:{rows:10},children:e.jsx(o.Table,{size:"small",bordered:!0,className:"my-zero-padding-table",columns:P,dataSource:y,pagination:!1,scroll:{x:"max-content"},rowKey:(E,D)=>String(E?.staff_id??E?.id??D)})})]})})]})}const Bd=({token:t})=>e.jsx(Fd,{token:t}),Tr=Se.payroll,Nd=Se.roleDropdown,$d=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},Ud=t=>t?.data?.data??t?.data??t??[];function Ld({token:t,receiptDetailsPath:n="/HumanResourceDashboard/PayrollReceiptDetails",onOpenReceiptDetails:a}){const[r,s]=l.useState({page:1,rowsPerPage:10}),[i,d]=l.useState(!1),[u,b]=l.useState([]),[h,p]=l.useState({role:"",roleLabel:"",year:"",month:""}),[y,v]=l.useState(null),w=P=>{if(!P)return;if(typeof a=="function"){a(P);return}const I=`${n}?id=${encodeURIComponent(String(P))}`;typeof window<"u"&&window?.location&&(window.location.href=I)},{data:m}=X(t?[Nd,t]:null,([P,I])=>te(P,I)),c=l.useMemo(()=>$d(m),[m]),f=l.useMemo(()=>ss(5),[]),{isLoading:T,error:C,data:S}=X(t&&y?[y,t]:null,([P,I])=>te(P,I)),j=l.useMemo(()=>{const P=Ud(S);return Array.isArray(P)?P:[]},[S]),g=l.useMemo(()=>{const P=S?.pagination?.total_rows??S?.data?.pagination?.total_rows??S?.total??S?.total_rows,I=Number(P);return Number.isFinite(I)&&I>=0?I:j.length},[S,j.length]),_=l.useMemo(()=>[{title:"Sl No.",key:"sl",width:70,render:(P,I,O)=>O+1},{title:"Name",dataIndex:"full_name",key:"full_name",ellipsis:!0},{title:"Designations",dataIndex:"designations",key:"designations",ellipsis:!0,responsive:["md"]},{title:"Mobile No",dataIndex:"contact_no",key:"contact_no",width:140,responsive:["md"]},{title:"Status",dataIndex:"status",key:"status",width:120,align:"center",render:(P,I)=>{const O=I?.id??I?.staff_id??I?.staffId;return e.jsx(o.Button,{type:"link",size:"small",style:{padding:0,fontSize:12},onClick:()=>{w(O)},children:is(I?.status)})}}],[]);return e.jsx("div",{style:{display:"grid",gap:20},children:e.jsxs(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Payroll"}),children:[e.jsx("form",{onSubmit:P=>{if(P.preventDefault(),!h.role||!h.year||!h.month)return;const I=`${Tr.payrollByRole}?page=${encodeURIComponent(String(r.page))}&per_page=${encodeURIComponent(String(r.rowsPerPage))}&role=${encodeURIComponent(String(h.role))}&year=${encodeURIComponent(String(h.year))}&month=${encodeURIComponent(String(h.month))}`;v(I)},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end",marginBottom:14,padding:14,borderRadius:12,border:"1px solid #eee",background:"#fafafa"},children:[e.jsx(le,{options:c,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Roles",placeholder:"Roles",allowSelectAll:!1,name:"role",required:!0,onChange:P=>p(I=>({...I,role:P?.value??"",roleLabel:P?.label??""}))}),e.jsx(le,{options:f,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Year",allowSelectAll:!1,name:"year",required:!0,onChange:P=>{const I=os(P?.value);b(I),d(O=>!O),p(O=>({...O,year:P?.label??"",month:""}))}}),e.jsx(le,{options:u,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Month",allowSelectAll:!1,name:"month",required:!0,onChange:P=>p(I=>({...I,month:P?.value??""}))},`month-${i}`),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"submit",value:"Search",color:"primary",onClick:()=>s(P=>({...P,page:1}))})})]})}),e.jsx(o.Table,{bordered:!0,size:"small",loading:T,rowKey:(P,I)=>String(P?.id??P?.staff_id??I),columns:_,dataSource:j,pagination:{current:r.page,pageSize:r.rowsPerPage,total:g,showSizeChanger:!0,onChange:(P,I)=>{s({page:P,rowsPerPage:I}),!(!h.role||!h.year||!h.month)&&v(`${Tr.payrollByRole}?page=${encodeURIComponent(String(P))}&per_page=${encodeURIComponent(String(I))}&role=${encodeURIComponent(String(h.role))}&year=${encodeURIComponent(String(h.year))}&month=${encodeURIComponent(String(h.month))}`)}},scroll:{x:"max-content"}})]})})}const qd=({token:t})=>e.jsx(Ld,{token:t}),hs=Se.leave,kt=({baseUrl:t,page:n=1,perPage:a=10,token:r})=>X(r&&t?[t,n,a,r]:null,([i,d,u,b])=>ad({baseUrl:i,page:d,perPage:u},b)),zd=({token:t,page:n=1,perPage:a=10})=>kt({token:t,baseUrl:hs.requestTable,page:n,perPage:a}),Vd=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},Yd=(t,n)=>{const a=new FormData;return Object.entries(t??{}).forEach(([r,s])=>{s!=null&&a.append(r,String(s))}),a.set("status",n),a};function Wd({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),{isLoading:r,error:s,data:i,mutate:d}=zd({token:t,page:n.page,perPage:n.rowsPerPage}),u=l.useMemo(()=>Vd(i),[i]),b=async(p,y)=>{try{const v=Yd(p,y),w=await yt(hs.approveRequest,v,t);w?.Status==="Success"?A.success("Success! Updated request.",{duration:1e3,icon:"🚀"}):A.error(w?.msg??"Failed to update request.",{duration:1e3}),await d()}catch(v){A.error(v?.response?.data?.msg??v?.message??"Failed to update request.",{duration:1e3})}},h=l.useMemo(()=>[{title:"Name",key:"full_name",ellipsis:!0,render:(p,y)=>y?.full_name??y?.staff_name??""},{title:"From",key:"leave_from",width:120,render:(p,y)=>y?.leave_from??y?.from_date??""},{title:"To",key:"leave_to",width:120,render:(p,y)=>y?.leave_to??y?.to_date??""},{title:"Leave Type",key:"leavetype",ellipsis:!0,render:(p,y)=>y?.leavetype??y?.leave_type??""},{title:"Leave Days",key:"leave_days",width:110,render:(p,y)=>y?.leave_days??""},{title:"Remarks",key:"employee_remark",ellipsis:!0,responsive:["md"],render:(p,y)=>y?.employee_remark??y?.reason??""},{title:"View",key:"document_file",width:140,render:(p,y)=>{const v=y?.document_file;return v?e.jsx(o.Button,{size:"small",onClick:()=>window.open(v,"_blank","noopener,noreferrer"),children:"View Document"}):"-"}},{title:"Status",dataIndex:"status",key:"status",width:140,align:"center",render:(p,y)=>{const v=String(y?.status??"").toLowerCase();return v==="approved"?e.jsx(o.Tag,{color:"green",children:"Approved"}):v==="declined"?e.jsx(o.Tag,{color:"red",children:"Declined"}):e.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:10},children:[e.jsx(o.Button,{type:"text",size:"small",onClick:()=>b(y,"approved"),icon:e.jsx(ce.CheckOutlined,{style:{color:"#06c937"}})}),e.jsx(o.Button,{type:"text",size:"small",onClick:()=>b(y,"declined"),icon:e.jsx(ce.CloseOutlined,{style:{color:"#e80911"}})})]})}}],[t]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Approve Leave Requests"}),children:e.jsx(o.Table,{bordered:!0,size:"small",loading:r,rowKey:(p,y)=>String(p?.id??p?.leave_id??y),columns:h,dataSource:u,pagination:{current:n.page,pageSize:n.rowsPerPage,onChange:(p,y)=>a({page:p,rowsPerPage:y}),showSizeChanger:!0},scroll:{x:"max-content"}})})]})}const Hd=({token:t})=>e.jsx(Wd,{token:t}),Kd=t=>t?typeof t=="string"?t:typeof t?.data=="string"?t.data:typeof t?.filename=="string"?t.filename:typeof t?.file=="string"?t.file:"":"",Jd=({token:t,value:n,onChange:a})=>{const r=l.useMemo(()=>{if(t)return{Authorization:t}},[t]);return e.jsx(o.Upload,{maxCount:1,action:ms(),headers:r,onChange:s=>{if(s?.file?.status==="done"){const i=Kd(s?.file?.response);i&&a?.(i)}},children:e.jsx("div",{style:{cursor:"pointer",fontSize:12,color:"#1677ff"},children:n?"Change":"Upload"})})},ys=Se.leave,Gd=Se.master.leaveType.dropdown,Qd=({token:t,page:n=1,perPage:a=10})=>kt({token:t,baseUrl:ys.table,page:n,perPage:a}),Xd=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},aa={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"};function Zd({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r,s]=l.useState(!1),[i,d]=l.useState(""),[u]=o.Form.useForm(),{isLoading:b,error:h,data:p,mutate:y}=Qd({token:t,page:n.page,perPage:n.rowsPerPage}),{data:v}=X(t?[Gd,t]:null,([j,g])=>te(j,g)),w=l.useMemo(()=>Xd(v),[v]),m=(j,g)=>a({page:j,rowsPerPage:parseInt(g,10)}),c=()=>{d(""),u.resetFields(),u.setFieldsValue({apply_date:ye()}),s(!0)},f=()=>{s(!1),d(""),u.resetFields()},T=async j=>{const g=new FormData;g.set("apply_date",j?.apply_date?j.apply_date.format("YYYY-MM-DD"):""),g.set("leave_type",j?.leave_type?.value??j?.leave_type??""),g.set("from_date",j?.from_date?j.from_date.format("YYYY-MM-DD"):""),g.set("to_date",j?.to_date?j.to_date.format("YYYY-MM-DD"):""),g.set("reason",j?.reason??""),i&&g.set("file",i);try{await ut(ys.apply,g,t),A.success("Success! Leave request submitted.",{duration:1e3}),f(),await y()}catch(_){A.error(_?.response?.data?.msg??_?.message??"Failed to submit leave request.",{duration:1e3})}},C=l.useMemo(()=>{const j=p?.data??p??[];return Array.isArray(j)?j:Array.isArray(j?.data)?j.data:[]},[p]),S=l.useMemo(()=>[{title:"Leave Type",key:"leavetype",render:(j,g)=>g?.leavetype??g?.leave_type??""},{title:"Apply Date",key:"date",width:130,render:(j,g)=>g?.date??g?.apply_date??""},{title:"From",key:"leave_from",width:130,render:(j,g)=>g?.leave_from??g?.from_date??""},{title:"To",key:"leave_to",width:130,render:(j,g)=>g?.leave_to??g?.to_date??""},{title:"Approval Status",dataIndex:"status",key:"status",width:140},{title:"Remark",key:"employee_remark",render:(j,g)=>g?.employee_remark??"",ellipsis:!0,responsive:["md"]}],[]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:r,title:"Add Leave Request",onCancel:f,footer:null,destroyOnClose:!0,children:e.jsxs(o.Form,{form:u,layout:"vertical",onFinish:T,children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(o.Form.Item,{name:"apply_date",rules:[{required:!0,message:"Select date"}],children:e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222",marginBottom:6},children:"Date"}),e.jsx(o.DatePicker,{style:aa})]})}),e.jsx(o.Form.Item,{name:"leave_type",rules:[{required:!0,message:"Select leave type"}],children:e.jsx(le,{options:w,closeMenuOnSelect:!0,hideSelectedOptions:!1,label:"Leave Type",allowSelectAll:!1})}),e.jsx(o.Form.Item,{name:"from_date",rules:[{required:!0,message:"Select from date"}],children:e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222",marginBottom:6},children:"From"}),e.jsx(o.DatePicker,{style:aa})]})}),e.jsx(o.Form.Item,{name:"to_date",rules:[{required:!0,message:"Select to date"}],children:e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222",marginBottom:6},children:"To"}),e.jsx(o.DatePicker,{style:aa})]})}),e.jsx(o.Form.Item,{name:"reason",rules:[{required:!0,message:"Enter reason"}],children:e.jsx(z,{type:"text",label:"Reason",placeholder:"Reason"})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:22},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222"},children:"Attachment"}),e.jsx(Jd,{token:t,value:i,onChange:d})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:12},children:[e.jsx(o.Button,{onClick:f,children:"Cancel"}),e.jsx(me,{type:"submit",value:"Save",color:"primary"})]})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Apply Leave"}),extra:e.jsx(me,{type:"button",value:"Add Leave Request",onClick:c})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Leave Requests"}),children:e.jsx(o.Table,{bordered:!0,size:"small",loading:b,rowKey:(j,g)=>String(j?.id??j?.leave_id??g),columns:S,dataSource:C,pagination:{current:n.page,pageSize:n.rowsPerPage,onChange:(j,g)=>m(j,g),showSizeChanger:!0},scroll:{x:"max-content"}})})]})}const ec=({token:t})=>e.jsx(Zd,{token:t}),wn=Se.master.leaveType,tc=({token:t,page:n=1,perPage:a=10})=>kt({token:t,baseUrl:wn.table,page:n,perPage:a});function nc({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r]=o.Form.useForm(),[s]=o.Form.useForm(),[i,d]=l.useState(!1),[u,b]=l.useState(null),{isLoading:h,error:p,data:y,mutate:v}=tc({token:t,page:n.page,perPage:n.rowsPerPage}),w=(j,g)=>{a({page:j,rowsPerPage:parseInt(g,10)})},m=async j=>{const g=new FormData;g.set("title",j?.title??"");try{await v(ut(wn.add,g,t),We(g)),A.success("Success! Added new leave type.",{duration:1e3,icon:"🎉"}),r.resetFields()}catch(_){A.error(_?.response?.data?.msg??_?.message??"Failed to add leave type.",{duration:1e3})}},c=j=>{b(j??null),s.setFieldsValue({title:j?.leave_type_name??j?.name??""}),d(!0)},f=()=>{d(!1),b(null),s.resetFields()},T=async j=>{const g=u?.id??u?.leave_type_id;if(!g){A.error("Missing leave type id.",{duration:1e3});return}const _=new FormData;_.set("id",String(g)),_.set("title",j?.title??"");try{await yt(wn.edit,_,t),await v(),A.success("Success! Updated leave type.",{duration:1e3,icon:"🚀"}),f()}catch(P){A.error(P?.response?.data?.msg??P?.message??"Failed to update leave type.",{duration:1e3})}},C=async j=>{const g=j?.id??j?.leave_type_id;if(g)try{await v(en(wn.remove,g,t),$e(g)),A.success("Success! Deleted leave type.",{duration:1e3})}catch(_){A.error(_?.response?.data?.msg??_?.message??"Failed to delete leave type.",{duration:1e3})}},S=l.useMemo(()=>[{title:"Name",dataIndex:"type",key:"type",ellipsis:!0},{title:"Action",key:"action",width:110,fixed:"right",render:(j,g)=>e.jsxs(o.Space,{size:6,children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>c(g)}),e.jsx(o.Popconfirm,{title:"Remove leave type?",okText:"Yes",cancelText:"No",onConfirm:()=>C(g),children:e.jsx(o.Button,{danger:!0,type:"text",size:"small",icon:e.jsx(ce.DeleteOutlined,{})})})]})}],[u]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:i,title:"Edit Leave Type",onCancel:f,footer:null,destroyOnClose:!0,children:e.jsxs(o.Form,{form:s,layout:"vertical",onFinish:T,children:[e.jsx(o.Form.Item,{name:"title",rules:[{required:!0,message:"Enter leave type name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx(o.Button,{onClick:f,children:"Cancel"}),e.jsx(me,{type:"submit",value:"Update",color:"primary"})]})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Leave Type"}),children:e.jsxs(o.Form,{form:r,layout:"vertical",onFinish:m,children:[e.jsx(o.Form.Item,{name:"title",rules:[{required:!0,message:"Enter leave type name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsx(me,{type:"submit",value:"Save",color:"primary"})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Leave Type List"}),children:e.jsx(Ee,{parentCallback:w,data:{newData:y,columns:S,columnstype:"antd",action:!1,Loading:h,error:p}})})]})}const ac=({token:t})=>e.jsx(nc,{token:t}),vn=Se.master.department,rc=({token:t,page:n=1,perPage:a=10})=>kt({token:t,baseUrl:vn.table,page:n,perPage:a});function sc({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r]=o.Form.useForm(),[s]=o.Form.useForm(),[i,d]=l.useState(!1),[u,b]=l.useState(null),{isLoading:h,error:p,data:y,mutate:v}=rc({token:t,page:n.page,perPage:n.rowsPerPage}),w=(j,g)=>{a({page:j,rowsPerPage:parseInt(g,10)})},m=async j=>{const g=new FormData;g.set("title",j?.title??"");try{await v(ut(vn.add,g,t),We(g)),A.success("Success! Added new department.",{duration:1e3,icon:"🎉"}),r.resetFields()}catch(_){A.error(_?.response?.data?.msg??_?.message??"Failed to add department.",{duration:1e3})}},c=j=>{b(j??null),s.setFieldsValue({title:j?.department_name??j?.name??""}),d(!0)},f=()=>{d(!1),b(null),s.resetFields()},T=async j=>{const g=u?.id??u?.department_id;if(!g){A.error("Missing department id.",{duration:1e3});return}const _=new FormData;_.set("id",String(g)),_.set("title",j?.title??"");try{await yt(vn.edit,_,t),await v(),A.success("Success! Updated department.",{duration:1e3,icon:"🚀"}),f()}catch(P){A.error(P?.response?.data?.msg??P?.message??"Failed to update department.",{duration:1e3})}},C=async j=>{const g=j?.id??j?.department_id;if(g)try{await v(en(vn.remove,g,t),$e(g)),A.success("Success! Deleted department.",{duration:1e3})}catch(_){A.error(_?.response?.data?.msg??_?.message??"Failed to delete department.",{duration:1e3})}},S=l.useMemo(()=>[{title:"Name",dataIndex:"department_name",key:"department_name",ellipsis:!0},{title:"Action",key:"action",width:110,fixed:"right",render:(j,g)=>e.jsxs(o.Space,{size:6,children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>c(g)}),e.jsx(o.Popconfirm,{title:"Remove department?",okText:"Yes",cancelText:"No",onConfirm:()=>C(g),children:e.jsx(o.Button,{danger:!0,type:"text",size:"small",icon:e.jsx(ce.DeleteOutlined,{})})})]})}],[u]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:i,title:"Edit Department",onCancel:f,footer:null,destroyOnClose:!0,children:e.jsxs(o.Form,{form:s,layout:"vertical",onFinish:T,children:[e.jsx(o.Form.Item,{name:"title",rules:[{required:!0,message:"Enter department name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx(o.Button,{onClick:f,children:"Cancel"}),e.jsx(me,{type:"submit",value:"Update",color:"primary"})]})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Department"}),children:e.jsxs(o.Form,{form:r,layout:"vertical",onFinish:m,children:[e.jsx(o.Form.Item,{name:"title",rules:[{required:!0,message:"Enter department name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsx(me,{type:"submit",value:"Save",color:"primary"})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Department List"}),children:e.jsx(Ee,{parentCallback:w,data:{newData:y,columns:S,columnstype:"antd",action:!1,Loading:h,error:p}})})]})}const oc=({token:t})=>e.jsx(sc,{token:t}),_n=Se.master.designation,ic=({token:t,page:n=1,perPage:a=10})=>kt({token:t,baseUrl:_n.table,page:n,perPage:a});function lc({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r]=o.Form.useForm(),[s]=o.Form.useForm(),[i,d]=l.useState(!1),[u,b]=l.useState(null),{isLoading:h,error:p,data:y,mutate:v}=ic({token:t,page:n.page,perPage:n.rowsPerPage}),w=(j,g)=>{a({page:j,rowsPerPage:parseInt(g,10)})},m=async j=>{const g=new FormData;g.set("title",j?.title??"");try{await v(ut(_n.add,g,t),We(g)),A.success("Success! Added new designation.",{duration:1e3,icon:"🎉"}),r.resetFields()}catch(_){A.error(_?.response?.data?.msg??_?.message??"Failed to add designation.",{duration:1e3})}},c=j=>{b(j??null),s.setFieldsValue({title:j?.designation??""}),d(!0)},f=()=>{d(!1),b(null),s.resetFields()},T=async j=>{const g=u?.id??u?.designation_id;if(!g){A.error("Missing designation id.",{duration:1e3});return}const _=new FormData;_.set("id",String(g)),_.set("title",j?.title??"");try{await yt(_n.edit,_,t),await v(),A.success("Success! Updated designation.",{duration:1e3,icon:"🚀"}),f()}catch(P){A.error(P?.response?.data?.msg??P?.message??"Failed to update designation.",{duration:1e3})}},C=async j=>{const g=j?.id??j?.designation_id;if(g)try{await v(en(_n.remove,g,t),$e(g)),A.success("Success! Deleted designation.",{duration:1e3})}catch(_){A.error(_?.response?.data?.msg??_?.message??"Failed to delete designation.",{duration:1e3})}},S=l.useMemo(()=>[{title:"Name",dataIndex:"designation",key:"designation",ellipsis:!0},{title:"Action",key:"action",width:110,fixed:"right",render:(j,g)=>e.jsxs(o.Space,{size:6,children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>c(g)}),e.jsx(o.Popconfirm,{title:"Remove designation?",okText:"Yes",cancelText:"No",onConfirm:()=>C(g),children:e.jsx(o.Button,{danger:!0,type:"text",size:"small",icon:e.jsx(ce.DeleteOutlined,{})})})]})}],[u]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:i,title:"Edit Designation",onCancel:f,footer:null,destroyOnClose:!0,children:e.jsxs(o.Form,{form:s,layout:"vertical",onFinish:T,children:[e.jsx(o.Form.Item,{name:"title",rules:[{required:!0,message:"Enter designation name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx(o.Button,{onClick:f,children:"Cancel"}),e.jsx(me,{type:"submit",value:"Update",color:"primary"})]})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Designation"}),children:e.jsxs(o.Form,{form:r,layout:"vertical",onFinish:m,children:[e.jsx(o.Form.Item,{name:"title",rules:[{required:!0,message:"Enter designation name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsx(me,{type:"submit",value:"Save",color:"primary"})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Designation List"}),children:e.jsx(Ee,{parentCallback:w,data:{newData:y,columns:S,columnstype:"antd",action:!1,Loading:h,error:p}})})]})}const dc=({token:t})=>e.jsx(lc,{token:t}),Cn=Se.master.shift,cc=({token:t,page:n=1,perPage:a=10})=>kt({token:t,baseUrl:Cn.table,page:n,perPage:a}),qe="hh:mm A",Rt=t=>{const n=String(t??"");if(!n)return null;const a=ye(n,[qe,"HH:mm","HH:mm:ss"],!0);return a.isValid()?a:null},Dt=t=>t?t.format(qe):"",tt={width:"100%",height:40,background:"transparent",border:"none",borderBottom:"1px solid #d9d9d9",borderRadius:0,boxShadow:"none"};function uc({token:t}){const[n,a]=l.useState({page:1,rowsPerPage:10}),[r]=o.Form.useForm(),[s]=o.Form.useForm(),[i,d]=l.useState(!1),[u,b]=l.useState(null),{isLoading:h,error:p,data:y,mutate:v}=cc({token:t,page:n.page,perPage:n.rowsPerPage}),w=(_,P)=>{a({page:_,rowsPerPage:parseInt(P,10)})},m=(_,P)=>{const I=new FormData;return P&&I.set("id",String(P)),I.set("name",_?.name??""),I.set("start_time",Dt(_?.start_time)),I.set("end_time",Dt(_?.end_time)),I.set("shift_start_from",Dt(_?.shift_start_from)),I.set("shift_start_to",Dt(_?.shift_start_to)),I.set("shift_end_from",Dt(_?.shift_end_from)),I.set("shift_end_to",Dt(_?.shift_end_to)),I},c=async _=>{try{const P=m(_);await v(ut(Cn.add,P,t),We(P)),A.success("Success! Added new shift.",{duration:1e3,icon:"🎉"}),r.resetFields()}catch(P){A.error(P?.response?.data?.msg??P?.message??"Failed to add shift.",{duration:1e3})}},f=_=>{b(_??null),s.setFieldsValue({name:_?.shift_name??_?.name??"",start_time:Rt(_?.start_time),end_time:Rt(_?.end_time),shift_start_from:Rt(_?.shift_start_from),shift_start_to:Rt(_?.shift_start_to),shift_end_from:Rt(_?.shift_end_from),shift_end_to:Rt(_?.shift_end_to)}),d(!0)},T=()=>{d(!1),b(null),s.resetFields()},C=async _=>{const P=u?.id??u?.shift_id;if(!P){A.error("Missing shift id.",{duration:1e3});return}try{const I=m(_,P);await yt(Cn.edit,I,t),await v(),A.success("Success! Updated shift.",{duration:1e3,icon:"🚀"}),T()}catch(I){A.error(I?.response?.data?.msg??I?.message??"Failed to update shift.",{duration:1e3})}},S=async _=>{const P=_?.id??_?.shift_id;if(P)try{await v(en(Cn.remove,P,t),$e(P)),A.success("Success! Deleted shift.",{duration:1e3})}catch(I){A.error(I?.response?.data?.msg??I?.message??"Failed to delete shift.",{duration:1e3})}},j=l.useMemo(()=>[{title:"Name",dataIndex:"shift_name",key:"shift_name",ellipsis:!0,fixed:"left",width:160},{title:"Start Time",dataIndex:"start_time",key:"start_time",width:120},{title:"End Time",dataIndex:"end_time",key:"end_time",width:120},{title:"Start From",dataIndex:"shift_start_from",key:"shift_start_from",width:120,responsive:["md"]},{title:"Start To",dataIndex:"shift_start_to",key:"shift_start_to",width:120,responsive:["md"]},{title:"End From",dataIndex:"shift_end_from",key:"shift_end_from",width:120,responsive:["md"]},{title:"End To",dataIndex:"shift_end_to",key:"shift_end_to",width:120,responsive:["md"]},{title:"Action",key:"action",width:110,fixed:"right",render:(_,P)=>e.jsxs(o.Space,{size:6,children:[e.jsx(o.Button,{type:"text",size:"small",icon:e.jsx(ce.EditOutlined,{}),onClick:()=>f(P)}),e.jsx(o.Popconfirm,{title:"Remove shift?",okText:"Yes",cancelText:"No",onConfirm:()=>S(P),children:e.jsx(o.Button,{danger:!0,type:"text",size:"small",icon:e.jsx(ce.DeleteOutlined,{})})})]})}],[]),g=[{required:!0,message:"Select time"}];return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(A.Toaster,{toastOptions:{position:"top-center"}}),e.jsx(o.Modal,{open:i,title:"Edit Shift",onCancel:T,footer:null,destroyOnClose:!0,children:e.jsxs(o.Form,{form:s,layout:"vertical",onFinish:C,children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(o.Form.Item,{name:"name",rules:[{required:!0,message:"Enter shift name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsx(o.Form.Item,{name:"start_time",label:"Start Time",rules:g,children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"end_time",label:"End Time",rules:g,children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_start_from",label:"Start Time From",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_start_to",label:"Start Time To",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_end_from",label:"End Time From",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_end_to",label:"End Time To",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx(o.Button,{onClick:T,children:"Cancel"}),e.jsx(me,{type:"submit",value:"Update",color:"primary"})]})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Add Shift"}),children:e.jsx(o.Form,{form:r,layout:"vertical",onFinish:c,children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end"},children:[e.jsx(o.Form.Item,{name:"name",rules:[{required:!0,message:"Enter shift name"}],children:e.jsx(z,{type:"text",label:"Name"})}),e.jsx(o.Form.Item,{name:"start_time",label:"Start Time",rules:g,children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"end_time",label:"End Time",rules:g,children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_start_from",label:"Start Time From",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_start_to",label:"Start Time To",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_end_from",label:"End Time From",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(o.Form.Item,{name:"shift_end_to",label:"End Time To",children:e.jsx(o.TimePicker,{format:qe,use12Hours:!0,style:tt})}),e.jsx(me,{type:"submit",value:"Save",color:"primary"})]})})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Shift List"}),children:e.jsx(Ee,{parentCallback:w,data:{newData:y,columns:j,columnstype:"antd",action:!1,Loading:h,error:p}})})]})}const pc=({token:t})=>e.jsx(uc,{token:t}),Rr=Se.attendance;function fc({data:t}){return t?e.jsx("div",{style:{margin:15,fontSize:13,padding:10},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{}),e.jsx("th",{}),(t?.shifts??[]).map((n,a)=>e.jsx("th",{colSpan:"2",style:{border:"1px solid #000",paddingLeft:10},children:n?.shift_name??""},`${a}heading1`))]}),e.jsxs("tr",{children:[e.jsx("th",{style:{border:"1px solid #000",paddingLeft:10},children:"Sl.No"}),e.jsx("th",{style:{border:"1px solid #000",paddingLeft:10},children:"Teacher's Name"}),(t?.shifts??[]).map((n,a)=>e.jsxs(l.Fragment,{children:[e.jsx("th",{style:{border:"1px solid #000",paddingLeft:10},children:"In Time"}),e.jsx("th",{style:{border:"1px solid #000",paddingLeft:10},children:"Out Time"})]},`${a}heading2`))]})]}),e.jsx("tbody",{children:(t?.data??[]).map((n,a)=>e.jsxs("tr",{children:[e.jsx("td",{style:{border:"1px solid #000",paddingLeft:10},children:e.jsx("div",{style:{paddingLeft:10},children:a+1})}),e.jsx("td",{style:{border:"1px solid #000",paddingLeft:10},children:e.jsx("div",{style:{paddingLeft:10},children:`${n?.name??""} ${n?.surname??""}`.trim()})}),(t?.shifts??[]).map((r,s)=>e.jsxs(l.Fragment,{children:[e.jsx("td",{style:{border:"1px solid #000",paddingLeft:10},children:e.jsx("div",{style:{paddingLeft:10},children:n?.attendance_data?(n.attendance_data?.[r?.office_shift_id]?.checkintime??"").toUpperCase():""})}),e.jsx("td",{style:{border:"1px solid #000",paddingLeft:10},children:e.jsx("div",{style:{paddingLeft:10},children:n?.attendance_data?(n.attendance_data?.[r?.office_shift_id]?.checkouttime??"").toUpperCase():""})})]},`${s}cells${a}`))]},`${a}row`))})]})}):null}const mc=t=>{const n=t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},hc=t=>{const n=String(t??"").toLowerCase();return n==="present"?e.jsx(o.Tag,{color:"green",children:"Present"}):n==="absent"?e.jsx(o.Tag,{color:"red",children:"Absent"}):n==="leave"?e.jsx(o.Tag,{color:"orange",children:"Leave"}):e.jsx(o.Tag,{children:t??""})};function yc({token:t}){const[n,a]=l.useState(ye()),[r,s]=l.useState(!1),[i,d]=l.useState(0),u=l.useMemo(()=>`${r?Rr.dailyAttendanceMultipleShift:Rr.dailyAttendance}?attendance_date=${encodeURIComponent(n.format("YYYY-MM-DD"))}`,[n,r,i]),{isLoading:b,error:h,data:p}=X(t?[u,t]:null,([c,f])=>te(c,f)),y=l.useMemo(()=>mc(p),[p]),v=l.useMemo(()=>r?p?.data?.data??p?.data??p??null:null,[p,r]),w=Vt.useReactToPrint({content:()=>document.getElementById("ubk-hr-daily-attendance-print")}),m=l.useMemo(()=>[{title:"Sl No.",key:"sl",width:70,render:(c,f,T)=>T+1},{title:"Name",key:"name",render:(c,f)=>`${f?.name??""} ${f?.surname??""}`.trim(),ellipsis:!0},{title:"Designations",dataIndex:"designations",key:"designations",ellipsis:!0,responsive:["md"]},{title:"Status",key:"attendance",width:160,render:(c,f)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[hc(f?.attendance),f?.late_time?e.jsx(o.Tag,{color:"red",children:"L"}):null]})},{title:"In Time",key:"intime",width:120,render:(c,f)=>f?.attendance_data?.[0]?.intime??""},{title:"Out Time",key:"outtime",width:120,render:(c,f)=>f?.attendance_data?.[0]?.outtime??""},{title:"Late",key:"late",width:100,render:(c,f)=>f?.late_time?e.jsx(o.Tag,{color:"red",children:f.late_time}):""}],[]);return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Staff Daily Attendance"}),children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:20,alignItems:"end",padding:14,borderRadius:12,border:"1px solid #eee",background:"#fafafa"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222",marginBottom:6},children:"Date"}),e.jsx(o.DatePicker,{value:n,onChange:c=>c&&a(c),style:{width:"100%"},allowClear:!1})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:22},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#222"},children:"Multiple Shift"}),e.jsx(o.Switch,{checked:r,onChange:s})]}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx(me,{type:"button",value:"Search",onClick:()=>d(c=>c+1)})})]})}),e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Staff Attendance List"}),extra:e.jsx(ce.PrinterOutlined,{style:{color:"#5080f8",fontSize:18,cursor:"pointer"},onClick:w}),children:e.jsxs("div",{id:"ubk-hr-daily-attendance-print",children:[e.jsx("div",{className:"print-only",children:e.jsx(Gt,{})}),r?e.jsx(fc,{data:v}):e.jsx(o.Table,{bordered:!0,size:"small",loading:b,rowKey:(c,f)=>String(c?.id??c?.staff_id??f),columns:m,dataSource:y,pagination:{pageSize:20},scroll:{x:"max-content"}})]})})]})}const gc=({token:t})=>e.jsx(yc,{token:t}),Dr=t=>{const n=t?.data?.data??t?.data??t??[];return Array.isArray(n)?n:Array.isArray(n?.data)?n.data:[]},xc=t=>t?typeof t=="string"?t:typeof t?.data=="string"?t.data:typeof t?.filename=="string"?t.filename:typeof t?.file=="string"?t.file:"":"";function bc({token:t,staffId:n}){const[a,r]=l.useState(!1),[s,i]=l.useState(null),[d,u]=l.useState({value:"Cash",label:"Cash"}),[b,h]=l.useState(""),[p,y]=l.useState(""),v=l.useMemo(()=>{try{return JSON.parse(localStorage.getItem("genrall_settings"))?.currency_icon??""}catch{return""}},[]),w=O=>{const k=Number(O??0),E=Number.isFinite(k)?k.toLocaleString("en-IN"):"0";return`${v?`${v} `:""}${E}`},m=l.useMemo(()=>n?`${Se.staff.basicById}?staff_id=${encodeURIComponent(String(n))}`:null,[n]),c=l.useMemo(()=>n?`${Se.payroll.staffPayrollByStaffId}?staff_id=${encodeURIComponent(String(n))}`:null,[n]),{data:f}=X(t&&m?[m,t]:null,([O,k])=>te(O,k)),{data:T,isLoading:C,mutate:S}=X(t&&c?[c,t]:null,([O,k])=>te(O,k)),j=l.useMemo(()=>Dr(f)[0]??f?.data??f??null,[f]),g=l.useMemo(()=>Dr(T),[T]),_=l.useMemo(()=>[{title:"Month",dataIndex:"month",key:"month",width:120,align:"center"},{title:"Basic Salary",dataIndex:"basic_salary",key:"basic_salary",width:140,align:"center",render:(O,k)=>e.jsx("div",{style:{fontSize:11},children:dt(k?.basic_salary)})},{title:"Gross Salary",dataIndex:"gross_salary",key:"gross_salary",width:140,align:"center",render:(O,k)=>e.jsx("div",{style:{fontSize:11},children:dt(k?.gross_salary)})},{title:"Net Salary",dataIndex:"net_amount",key:"net_amount",width:140,align:"center",render:(O,k)=>e.jsx("div",{style:{fontSize:11},children:dt(k?.net_amount)})},{title:"Payable",dataIndex:"Total_Payable_Amount",key:"Total_Payable_Amount",width:140,align:"center",render:(O,k)=>e.jsx("div",{style:{fontSize:11},children:dt(k?.Total_Payable_Amount)})},{title:"Status",dataIndex:"status",key:"status",width:140,align:"center",render:(O,k)=>e.jsx("div",{style:{cursor:k?.status==="due"?"pointer":"default"},onClick:()=>{k?.status==="due"&&(i(k),r(!0))},children:is(k?.status)})}],[]),P=l.useMemo(()=>[{value:"Cash",label:"Cash"},{value:"UPI",label:"UPI"},{value:"DD",label:"DD"},{value:"Bank",label:"Bank"},{value:"Internet Banking",label:"Internet Banking"},{value:"Cheque",label:"Cheque"}],[]),I=async()=>{if(!s)return;const O={...s,staff_id:n,payment_type:d?.value??"",notes:b,attchement:p};try{await Ge(Se.payroll.generatePayslip,{arg:O},t),A.success("Success!",{duration:1e3}),r(!1),i(null),h(""),y(""),await S()}catch(k){A.error(k?.response?.data?.msg??k?.message??"Failed.",{duration:1e3})}};return e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Payroll Receipt Details"}),children:e.jsxs("div",{style:{display:"grid",gap:14},children:[e.jsx("div",{style:{fontSize:13,color:"#444"},children:j?`${j?.f_name??j?.firstname??""} ${j?.l_name??j?.lastname??""}`.trim():""}),e.jsx(o.Table,{bordered:!0,size:"small",loading:C,rowKey:(O,k)=>String(O?.id??`${O?.month}-${k}`),columns:_,dataSource:g,pagination:{pageSize:12},scroll:{x:"max-content"}})]})}),e.jsx(o.Modal,{open:a,onCancel:()=>{r(!1),i(null)},footer:null,destroyOnClose:!0,title:"Payment Options",width:640,children:e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsx(le,{label:"Pay",options:P,value:d,onChange:O=>u(O??P[0]),closeMenuOnSelect:!0,hideSelectedOptions:!1,allowSelectAll:!1}),e.jsxs("div",{children:[e.jsx("div",{style:{marginBottom:6,fontSize:14,fontWeight:500,color:"#222"},children:"Note"}),e.jsx(o.Input.TextArea,{rows:4,placeholder:"Note",value:b,onChange:O=>h(O.target.value)})]}),e.jsxs("div",{children:[e.jsx("div",{style:{marginBottom:6,fontSize:14,fontWeight:500,color:"#222"},children:"Attachment"}),e.jsx(o.Upload,{maxCount:1,action:ms(),headers:t?{Authorization:t}:void 0,onChange:O=>{if(O?.file?.status==="done"){const k=xc(O?.file?.response);k&&y(k)}O?.file?.status==="removed"&&y("")},children:e.jsx(o.Button,{icon:e.jsx(ce.UploadOutlined,{}),children:"Upload"})}),!!p&&e.jsx("div",{style:{fontSize:12,color:"#666",marginTop:6},children:p})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[e.jsx(o.Button,{onClick:()=>r(!1),children:"Cancel"}),e.jsx(me,{type:"button",value:s?.Total_Payable_Amount?`Pay ${w(s.Total_Payable_Amount)}`:"Pay",onClick:I})]})]})})]})}function Sc({token:t,staffId:n}){const a=l.useMemo(()=>{if(n!=null&&String(n).trim()!=="")return n;if(typeof window>"u")return null;const r=new URLSearchParams(window.location.search).get("id");return r||null},[n]);return a?e.jsx(bc,{token:t,staffId:a}):e.jsx(o.Card,{title:e.jsx(o.Typography.Title,{level:5,style:{margin:0},children:"Payroll Receipt Details"}),children:e.jsx("div",{style:{fontSize:13,color:"#666"},children:"Missing staff id."})})}const jc=({routes:t=[],onNavigate:n})=>e.jsx(o.Row,{gutter:[16,16],children:t.map((a,r)=>e.jsx(o.Col,{xs:24,md:8,lg:8,children:e.jsx(ne,{children:e.jsx(Pr,{icon:a?.icon??"",title:a?.title??"",path:a?.path??"",onClick:n})})},`${r}route001`))});exports.AddBook=Qi;exports.AddDriver=Wi;exports.AddStaff=yd;exports.AdmissionEnquiry=Ci;exports.ApplyLeave=ec;exports.AprroveLeaveRequest=Hd;exports.AssignStudentToTransport=Yi;exports.AssignVehicles=ki;exports.BookList=Xi;exports.BuySellProduct=Fl;exports.Category=Cl;exports.Department=oc;exports.Designation=dc;exports.ErpDashboard=xs;exports.IssueReturn=el;exports.LeaveType=ac;exports.LibraryAssignStudent=tl;exports.LibraryCategory=nl;exports.LibraryReport=al;exports.ManageStock=Jl;exports.MenuSubmenu=si;exports.Payroll=qd;exports.PayrollReceiptDetails=Sc;exports.Products=jl;exports.RoutePage=jc;exports.RouteTimeTable=Hi;exports.SellReports=Wl;exports.Shift=pc;exports.StaffAttendance=Ed;exports.StaffAttendanceReport=Bd;exports.StaffDailyAttendance=gc;exports.StaffDirectory=jd;exports.StockReport=ed;exports.Stoppage=Ji;exports.SubCategory=Pl;exports.TransportRoutes=Ri;exports.TransportVehicles=Di;exports.Unit=Ul;exports.Vendor=ul;exports.setBaseUrl=ni;