PageSourceSearch

https://www.kalpvaig.com/build/assets/Index-CTLjnaST.js

js kalpvaig.com collected 2026-10-02 14:04:32 UTC 15,901 bytes, 1 lines download raw bytes

1import{q as K,f as m,j as e,J as f}from"./app-5HZrl6Of.js";import{f as X}from"./DateUtils-DjqI7lRG.js";import{M as B}from"./MainLayout-DNKHYpUT.js";import{P as G}from"./Pagination-Dle0y1KH.js";import{T as Q}from"./Table-CKQ0weq6.js";import{a as r,aT as Y,aU as Z,e as z,F as ee,C as l,q as se,P as te,aV as re,aW as ae,aX as oe,i as ie}from"./vendor-lucide-BJGcDKZJ.js";import{d as ne}from"./debounce-EasG6AMs.js";import le from"./CreateAssetDialog-OGXkxpxw.js";import de from"./EditAssetDialog-DeBTBGaI.js";import ce from"./AssignAssetDialog-COEDh6Ev.js";import ue from"./ReturnAssetDialog-C7lv7VDc.js";import me from"./MaintenanceAssetDialog-Cbrvo-Pt.js";import{u as xe}from"./useCurrency-BmI98oGu.js";import"./vendor-quill-SpU0cbOg.js";/* empty css            */import"./index-DEM8G5sc.js";import"./index-jBAOEj5c.js";import"./FlashMessages-DkQE8oma.js";import"./Alert--2VNXs2a.js";import"./Logo-BlXFyvP5.js";import"./button-qEnUdDhi.js";import"./index-DEAvTe4H.js";import"./index-CZxli20t.js";import"./vendor-charts-BZef9nxL.js";import"./vendor-leaflet-1W-YrAnr.js";import"./utils-qJUb9sMD.js";import"./dialog-B6qCKv9Q.js";import"./index-CqDWfTw7.js";import"./input-BGk0Tamr.js";import"./label-DosFNneP.js";const ge=()=>{const{symbol:b}=xe(),{assets:O,filters:t,assetTypes:$,conditions:M}=K().props,{data:E,current_page:pe,links:W}=O,[u,j]=r.useState(t?.search||""),[p,R]=r.useState(!1),[a,N]=r.useState(t?.asset_type_id||"All Asset Types"),[o,A]=r.useState(t?.status||"All Statuses"),[i,w]=r.useState(t?.condition||"All Conditions"),[d,C]=r.useState(t?.date_from||""),[c,_]=r.useState(t?.date_to||""),[x,S]=r.useState(t?.per_page||"10"),[k,U]=r.useState(0),[L,D]=r.useState(!1),[q,F]=r.useState(!1),[J,T]=r.useState(!1),[V,P]=r.useState(!1),[g,h]=r.useState(null);r.useEffect(()=>{let s=0;u&&s++,a&&a!=="All Asset Types"&&s++,o&&o!=="All Statuses"&&s++,i&&i!=="All Conditions"&&s++,d&&s++,c&&s++,U(s)},[u,a,o,i,d,c]);const v=()=>{m.get(route("admin.assets.index"),{search:u,asset_type_id:a==="All Asset Types"?void 0:a,status:o==="All Statuses"?void 0:o,condition:i==="All Conditions"?void 0:i,date_from:d||void 0,date_to:c||void 0,per_page:x,sort:t.sort,direction:t.direction},{preserveState:!0,replace:!0})},H=()=>{j(""),N("All Asset Types"),A("All Statuses"),w("All Conditions"),C(""),_(""),S("10"),m.get(route("admin.assets.index"),{},{preserveState:!0,replace:!0})};r.useCallback(ne(s=>{m.get(route("admin.assets.index"),{search:s,asset_type_id:a==="All Asset Types"?void 0:a,status:o==="All Statuses"?void 0:o,condition:i==="All Conditions"?void 0:i,date_from:d||void 0,date_to:c||void 0,per_page:x,sort:t.sort,direction:t.direction},{preserveState:!0,replace:!0})},300),[a,o,i,d,c,x,t.sort,t.direction]);const y=s=>{const n=t.sort===s&&t.direction==="asc"?"desc":"asc";m.get(route("admin.assets.index"),{search:u,asset_type_id:a==="All Asset Types"?void 0:a,status:o==="All Statuses"?void 0:o,condition:i==="All Conditions"?void 0:i,date_from:d||void 0,date_to:c||void 0,sort:s,direction:n,per_page:x},{preserveState:!0,replace:!0})},I=s=>{const n=s.target.value;S(n),m.get(route("admin.assets.index"),{search:u,asset_type_id:a==="All Asset Types"?void 0:a,status:o==="All Statuses"?void 0:o,condition:i==="All Conditions"?void 0:i,date_from:d||void 0,date_to:c||void 0,per_page:n,sort:t.sort,direction:t.direction},{preserveState:!0,replace:!0})};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between mb-6 gap-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-800",children:"Asset Management"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Manage and track company assets and equipment"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(f,{href:route("admin.assets.depreciation"),children:e.jsxs("button",{className:"bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 px-4 py-2 rounded-md font-medium text-sm flex items-center gap-2 transition-colors",children:[e.jsx(Y,{size:16}),"Depreciation"]})}
1),e.jsx(f,{href:route("admin.assets.dashboard"),children:e.jsxs("button",{className:"bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 px-4 py-2 rounded-md font-medium text-sm flex items-center gap-2 transition-colors",children:[e.jsx(Z,{size:16}),"Dashboard"]})}),e.jsx(le,{})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center mb-6 space-y-4 md:space-y-0",children:[e.jsxs("div",{className:"flex items-center space-x-2 w-full md:w-auto",children:[e.jsxs("div",{className:"relative w-full md:w-80",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(z,{className:"h-5 w-5 text-gray-400"})}),e.jsx("input",{type:"text",placeholder:"Search...",value:u,onChange:s=>j(s.target.value),onKeyDown:s=>s.key==="Enter"&&v(),className:"block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus-visible:outline-none focus:placeholder-gray-400 focus-visible:border-green-500 focus-visible:ring-1 focus-visible:ring-green-500 sm:text-sm"})]}),e.jsxs("button",{onClick:v,className:"bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-md text-sm font-medium flex items-center gap-2 transition-colors",children:[e.jsx(z,{size:16}),"Search"]}),e.jsxs("button",{onClick:()=>R(!p),className:`flex items-center space-x-2 border text-gray-700 px-4 py-2 rounded-md hover:bg-gray-50 text-sm font-medium transition-colors relative ${p?"bg-gray-100 border-gray-400":"bg-white border-gray-300"}`,children:[e.jsx(ee,{size:16}),e.jsx("span",{children:p?"Hide Filters":"Filters"}),k>0&&e.jsx("span",{className:"flex items-center justify-center w-5 h-5 text-[10px] font-bold text-white bg-green-500 rounded-full ml-1",children:k})]})]}),e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[e.jsx("span",{children:"Per Page:"}),e.jsxs("div",{className:"relative group",children:[e.jsxs("select",{value:x,onChange:I,className:"block w-20 pl-3 pr-8 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg shadow-sm appearance-none bg-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-green-500 focus-visible:border-green-500 transition-all duration-200 hover:border-gray-300 cursor-pointer",children:[e.jsx("option",{value:"10",children:"10"}),e.jsx("option",{value:"20",children:"20"}),e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"})]}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-400 group-hover:text-gray-600 transition-colors duration-200",children:e.jsx(l,{size:14,strokeWidth:2.5})})]})]})]}),p&&e.jsx("div",{className:"bg-white p-4 border border-gray-200 rounded-lg mb-6 shadow-sm",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 items-end",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Asset Type"}),e.jsxs("div",{className:"relative group",children:[e.jsxs("select",{value:a,onChange:s=>N(s.target.value),className:"block w-full pl-4 pr-10 py-2.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg shadow-sm appearance-none bg-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-green-500 focus-visible:border-green-500 transition-all duration-200 hover:border-gray-300 cursor-pointer",children:[e.jsx("option",{children:"All Asset Types"}),$.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-gray-400 group-hover:text-gray-600 transition-colors duration-200",children:e.jsx(l,{size:16,strokeWidth:2.5})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Status"}),e.jsxs("div",{className:"relative group",children:[e.jsxs("select",{value:o,onChange:s=>A(s.target.value),className:"block w-full pl-4 pr-10 py-2.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg shadow-sm appearance-none bg-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-green-500 focus-visible:border-green-500 transition-all duration-200 hover:border-gray-300 cursor-pointer",children:[e.jsx("option",{children:"All Statuses"}),e.jsx("option",{value:"Available",children:"Available"}),e.jsx("option",{value:"Assigned",children:"Assigned"}),e.jsx("option",{value:"Under Maintenance",children:"Under Maintenance"}),e.jsx("option",{value:"Disposed",children:"Disposed"})]}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-gray-400 group-hover:text-gray-600 transition-colors duration-200",children:e.jsx(l,{size:16,strokeWidth:2.5})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Condition"}),e.jsxs("div",{className:"relative group",children:[e.jsxs("select",{value:i,onChange:s=>w(s.target.value),className:"block w-full pl-4 pr-10 py-2.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg shadow-sm appearance-none bg-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-green-500 focus-visible:border-green-500 transition-all duration-200 hover:border-gray-300 cursor-pointer",children:[e.jsx("option",{children:"All Conditions"}),M.map(s=>e.jsx("option",{value:s,children:s},s))]}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-gray-400 group-hover:text-gray-600 transition-colors duration-200",children:e.jsx(l,{size:16,strokeWidth:2.5})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Purchase Date From"}),e.jsx("input",{type:"date",value:d,onChange:s=>C(s.target.value),className:"block w-full px-4 py-2.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-green-500 focus-visible:border-green-500 transition-all duration-200 hover:border-gray-300 placeholder-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Purchase Date To"}),e.jsx("input",{type:"date",value:c,onChange:s=>_(s.target.value),className:"block w-full px-4 py-2.5 text-sm font-medium text-gray-700 bg-white border border-gray-200 rounded-lg shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-green-500 focus-visible:border-green-500 transition-all duration-200 hover:border-gray-300 placeholder-gray-400"})]}),e.jsxs("div",{className:"flex items-center space-x-2 pb-0.5",children:[e.jsx("button",{onClick:v,className:"bg-green-500 hover:bg-green-600 text-white px-4 py-2.5 rounded-md font-medium text-sm transition-colors",children:"Apply Filters"}),e.jsx("button",{onClick:H,className:"bg-white border border-gray-300 text-gray-700 px-4 py-2.5 rounded-md hover:bg-gray-50 text-sm font-medium transition-colors",children:"Reset Filters"})]})]})}),e.jsx(Q,{columns:[{label:e.jsxs("div",{className:"flex items-center cursor-pointer group",onClick:()=>y("name"),children:["Name",e.jsxs("div",{className:"ml-2 flex flex-col",children:[e.jsx(l,{className:`h-3 w-3 -mb-1 transform rotate-180 ${t.sort==="name"&&t.direction==="asc"?"text-gray-900 group-hover:text-gray-900":"text-gray-300 group-hover:text-gray-500"}`}),e.jsx(l,{className:`h-3 w-3 ${t.sort==="name"&&t.direction==="desc"?"text-gray-900 group-hover:text-gray-900":"text-gray-300 group-hover:text-gray-500"}`})]})]}),name:"name",className:"min-w-[200px] font-medium text-gray-900",renderCell:s=>e.jsxs("div",{children:[e.jsx("div",{className:"text-gray-900 font-medium",children:s.name}),e.jsx("div",{className:"text-xs text-gray-500",children:s.type?.name})]})},{label:"Asset Code",name:"asset_code",className:"text-gray-500 min-w-[120px]",renderCell:s=>s.asset_code},{label:"Status",name:"status",className:"w-32 whitespace-nowrap",renderCell:s=>{let n="bg-gray-100 text-gray-800";return s.status==="Available"?n="bg-green-100 text-green-800":s.status==="Assigned"?n="bg-blue-100 text-blue-800":s.status==="Under Maintenance"?n="bg-yellow-100 text-yellow-800":s.status==="Disposed"&&(n="bg-red-100 text-red-800"),e.jsx("span",{className:`px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${n}`,children:s.status})}},{label:"Assigned To",name:"assigned_to",className:"text-gray-900",renderCell:s=>s.latest_assignment?.employee?.name||"-"},{label:e.jsxs("div",{className:"flex items-center cursor-pointer group",onClick:()=>y("purchase_date"),children:["Purchase Date",e.jsxs("div",{className:"ml-2 flex flex-col",children:[e.jsx(l,{className:`h-3 w-3 -mb-1 transform rotate-180 ${t.sort==="purchase_date"&&t.direction==="asc"?"text-gray-900 group-hover:text-gray-900":"text-gray-300 group-hover:text-gray-500"}`}),e.jsx(l,{className:`h-3 w-3 ${t.sort==="purchase_date"&&t.direction==="desc"?"text-gray-900 group-hover:text-gray-900":"text-gray-300 group-hover:text-gray-500"}`})]})]}),name:"purchase_date",className:"w-40",renderCell:s=>s.purchase_date?X(s.purchase_date):"-"},{label:e.jsxs("div",{className:"flex items-center cursor-pointer group",onClick:()=>y("purchase_cost"),children:["Purchase Cost",e.jsxs("div",{className:"ml-2 flex flex-col",children:[e.jsx(l,{className:`h-3 w-3 -mb-1 transform rotate-180 ${t.sort==="purchase_cost"&&t.direction==="asc"?"text-gray-900 group-hover:text-gray-900":"text-gray-300 group-hover:text-gray-500"}`}),e.jsx(l,{className:`h-3 w-3 ${t.sort==="purchase_cost"&&t.direction==="desc"?"text-gray-900 group-hover:text-gray-900":"text-gray-300 group-hover:text-gray-500"}`})]})]}),name:"purchase_cost",className:"w-40",renderCell:s=>s.purchase_cost?`${b}
1${Number(s.purchase_cost).toLocaleString()}`:"-"},{label:"Actions",name:"actions",className:"w-48 text-right",renderCell:s=>e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(f,{href:route("admin.assets.show",{asset:s.id,source:"list"}),children:e.jsx("button",{className:"p-1.5 text-green-600 hover:bg-blue-50 rounded-md transition-colors duration-200",title:"View",children:e.jsx(se,{size:18})})}),e.jsx("button",{onClick:()=>{h(s),D(!0)},className:"p-1.5 text-orange-500 hover:bg-orange-50 rounded-md transition-colors duration-200",title:"Edit",children:e.jsx(te,{size:18})}),e.jsx("button",{onClick:()=>{h(s),F(!0)},disabled:s.status==="Disposed",className:`p-1.5 rounded-md transition-colors duration-200 ${s.status==="Disposed"?"text-gray-300 cursor-not-allowed":"text-green-600 hover:bg-green-50"}`,title:"Assign",children:e.jsx(re,{size:18})}),e.jsx("button",{onClick:()=>{h(s),T(!0)},disabled:s.status!=="Assigned",className:`p-1.5 rounded-md transition-colors duration-200 ${s.status!=="Assigned"?"text-gray-300 cursor-not-allowed":"text-purple-500 hover:bg-purple-50"}`,title:"Return",children:e.jsx(ae,{size:18})}),e.jsx("button",{onClick:()=>{h(s),P(!0)},className:"p-1.5 text-blue-500 hover:bg-blue-50 rounded-md transition-colors duration-200",title:"Maintenance",children:e.jsx(oe,{size:18})}),e.jsx("button",{onClick:()=>{confirm("Delete this item?")&&m.delete(route("admin.assets.destroy",s.id))},className:"p-1.5 text-red-600 hover:bg-red-50 rounded-md transition-colors duration-200",title:"Delete",children:e.jsx(ie,{size:18})})]})}],rows:E}),e.jsx("div",{className:"mt-6",children:e.jsx(G,{links:W})}),g&&e.jsxs(e.Fragment,{children:[e.jsx(de,{asset:g,open:L,setOpen:D}),e.jsx(ce,{asset:g,open:q,setOpen:F}),e.jsx(ue,{asset:g,open:J,setOpen:T}),e.jsx(me,{asset:g,open:V,setOpen:P})]})]})};ge.layout=b=>e.jsx(B,{title:"Assets",children:b});export{ge as default};

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