PageSourceSearch

https://sendunlimitedemail.com/sue/mod-2AFGo7dm.js

js sendunlimitedemail.com collected 2026-10-05 06:25:14 UTC 7,003 bytes, 1 lines download raw bytes

1import{r as a,e as n,t as d,j as e}from"./edge-BOITG1XR.js";function F(){const[p,j]=a.useState([]),[h,N]=a.useState([]),[v,w]=a.useState([]),[_,g]=a.useState(!0),[o,y]=a.useState(!1),[i,f]=a.useState(!1),[c,S]=a.useState("all"),[s,l]=a.useState({from_warehouse_id:"",to_warehouse_id:"",product_id:"",quantity:1,notes:""});a.useEffect(()=>{x()},[c]);const x=async()=>{try{g(!0);const t=c!=="all"?`?status=${c}`:"",[r,m,k]=await Promise.all([n.get(`/admin/transfers${t}`),n.get("/admin/warehouses"),n.get("/products")]);j(r.data?.data||r.data),N(m.data);const b=k.data;w(b?.data||b)}catch{d.error("Failed to fetch transfers")}finally{g(!1)}},C=async t=>{if(t.preventDefault(),!o){y(!0);try{await n.post("/admin/transfers",s),d.success("Transfer created"),f(!1),l({from_warehouse_id:"",to_warehouse_id:"",product_id:"",quantity:1,notes:""}),x()}catch(r){d.error(r.response?.data?.message||"Failed to create transfer")}finally{y(!1)}}},u=async(t,r)=>{try{await n.put(`/admin/transfers/${t}/${r}`),d.success(`Transfer ${r==="ship"?"shipped":r==="complete"?"completed":"cancelled"}`),x()}catch(m){d.error(m.response?.data?.message||"Failed to update transfer")}},T=t=>{switch(t){case"completed":return"bg-green-100 text-green-800";case"in_transit":return"bg-blue-100 text-blue-800";
1case"pending":return"bg-yellow-100 text-yellow-800";case"cancelled":return"bg-red-100 text-red-800";default:return"bg-gray-100 text-gray-800"}};return e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Inventory Transfers"}),e.jsx("button",{onClick:()=>f(!i),className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700",children:i?"Cancel":"New Transfer"})]}),i&&e.jsxs("form",{onSubmit:C,className:"bg-white rounded-xl shadow-sm p-6 mb-6",children:[e.jsx("h2",{className:"font-semibold mb-4",children:"Create Transfer Request"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"From Warehouse *"}),e.jsxs("select",{value:s.from_warehouse_id,onChange:t=>l({...s,from_warehouse_id:t.target.value}),className:"w-full border rounded-lg px-3 py-2",required:!0,children:[e.jsx("option",{value:"",children:"Select source..."}),h.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.code,")"]},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"To Warehouse *"}),e.jsxs("select",{value:s.to_warehouse_id,onChange:t=>l({...s,to_warehouse_id:t.target.value}),className:"w-full border rounded-lg px-3 py-2",required:!0,children:[e.jsx("option",{value:"",children:"Select destination..."}),h.filter(t=>t.id!=s.from_warehouse_id).map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.code,")"]},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Product *"}),e.jsxs("select",{value:s.product_id,onChange:t=>l({...s,product_id:t.target.value}),className:"w-full border rounded-lg px-3 py-2",required:!0,children:[e.jsx("option",{value:"",children:"Select product..."}),v.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Quantity *"}),e.jsx("input",{type:"number",min:"1",value:s.quantity,onChange:t=>l({...s,quantity:parseInt(t.target.value)}),className:"w-full border rounded-lg px-3 py-2",required:!0})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Notes"}),e.jsx("input",{type:"text",value:s.notes,onChange:t=>l({...s,notes:t.target.value}),className:"w-full border rounded-lg px-3 py-2",placeholder:"Optional notes..."})]})]}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{type:"submit",disabled:o,className:"bg-green-600 text-white px-6 py-2 rounded-lg hover:bg-green-700 disabled:opacity-50",children:o?"Creating…":"Create Transfer"})})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","in_transit","completed","cancelled"].map(t=>e.jsx("button",{onClick:()=>S(t),className:`px-4 py-2 rounded-lg text-sm font-medium capitalize ${c===t?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:t.replace("_"," ")},t))}),e.jsx("div",{className:"bg-white rounded-xl shadow-sm overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Reference"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Product"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"From"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"To"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Qty"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:_?e.jsx("tr",{children:e.jsx("td",{colSpan:"7",className:"text-center py-8",children:"Loading..."})}):p.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:"7",className:"text-center py-8 text-gray-500",children:"No transfers found"})}):p.map(t=>e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-3 font-mono text-sm",children:t.reference_number}),e.jsx("td",{className:"px-4 py-3 font-medium",children:t.product?.name||"N/A"}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.from_warehouse?.name}),e.jsx("td",{className:"px-4 py-3 text-sm",children:t.to_warehouse?.name}),e.jsx("td",{className:"px-4 py-3 font-medium",children:t.quantity}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs capitalize ${T(t.status)}`,children:t.status.replace("_"," ")})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex gap-2",children:[t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>u(t.id,"ship"),className:"text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded hover:bg-blue-200",children:"Ship"}),e.jsx("button",{onClick:()=>u(t.id,"cancel"),className:"text-xs bg-red-100 text-red-700 px-2 py-1 rounded hover:bg-red-200",children:"Cancel"})]}),t.status==="in_transit"&&e.jsx("button",{onClick:()=>u(t.id,"complete"),className:"text-xs bg-green-100 text-green-700 px-2 py-1 rounded hover:bg-green-200",children:"Complete"})]})})]},t.id))})]})})]})}export{F 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.