1"use strict";(self.webpackChunkParkAdda=self.webpackChunkParkAdda||[]).push([[3435],{53570(t,e,n){n.d(e,{NU:()=>u,cy:()=>r,pw:()=>o,xx:()=>s});var a=n(93533).wm.VENDORPAY,o="parkadda_vendor_token";function r(t){"undefined"!==typeof window&&(t?window.localStorage.setItem(o,t):window.localStorage.removeItem(o))}async function l(t){var e;try{e=await t.json()}catch(o){e=null}if(401===t.status){r(null);var n=new Error(e&&e.message||"Session expired");throw n.status=401,n}if(!t.ok||e&&!1===e.success){var a=e&&e.message||"Request failed";throw new Error("string"===typeof a?a:JSON.stringify(a))}return e&&e.payload}function i(t){if(!t)return"";var e=[];return Object.keys(t).forEach(function(n){var a=t[n];void 0!==a&&null!==a&&""!==a&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(a))}),e.length?"?"+e.join("&"):""}async function c(t,e){var n="undefined"!==typeof window?window.localStorage.getItem(o):null,r=Object.assign({"Content-Type":"application/json"},e&&e.headers||{});return n&&(r.Authorization="Bearer "+n),l(await fetch(a+t,Object.assign({},e||{},{headers:r})))}var s={login:function(t,e){return fetch(a+"/portal/login/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mobile:t,password:e})}).then(l)},logout:function(){return c("/portal/logout/",{method:"POST",body:"{}"})},session:function(){return c("/portal/session/")},get:function(t,e){return c(t+i(e),{method:"GET"})},post:function(t,e){return c(t,{method:"POST",body:JSON.stringify(e||{})})},listStock:function(t){return c("/stock/"+i(t),{method:"GET"})},adjustStock:function(t){return c("/stock/adjust/",{method:"POST",body:JSON.stringify(t)})},loadStock:function(t){return c("/stock/load/",{method:"POST",body:JSON.stringify(t)})},listOrders:function(t){return c("/orders/"+i(t),{method:"GET"})},getOrder:function(t){return c("/orders/"+encodeURIComponent(t)+"/",{method:"GET"})},dashboardVendor:function(t){return c("/dashboard/vendor/"+i(t),{method:"GET"})},verifyOrder:function(t){return c("/orders/verify/",{method:"POST",body:JSON.stringify(t)})},fulfillOrder:function(t){return c("/orders/fulfill/",{method:"POST",body:JSON.stringify(t)})},notifyOrder:function(t){return c("/orders/notify/",{method:"POST",body:JSON.stringify(t)})}};function u(t){return"https://server.parkadda.com".replace(/\/+$/,"")+"/api/vendorpay/e-invoice/"+encodeURIComponent(t)+"/"}},62834(t,e,n){var a=n(65043),o=n(62582),r=n(59557),l=n(25806);n(61512);const i=function(t){var e=(0,l.U)();if("loading"===e.status)return a.createElement("div",{className:"vp-shell"},a.createElement("div",{className:"vp-main",style:{textAlign:"center",paddingTop:48}},"Loading\u2026"));if("authenticated"!==e.status)return a.createElement(r.rd,{to:"/vendor-portal/login"});var n=e.operator;return a.createElement("div",{className:"vp-shell"},a.createElement("header",{className:"vp-topbar"},a.createElement("div",null,a.createElement("h1",null,n?n.stall_name||n.vendor_name:"Vendor"),a.createElement("div",{style:{fontSize:11,opacity:.85}},e.staff&&e.staff.name)),a.createElement("button",{type:"button",className:"vp-btn vp-btn--ghost",style:{width:"auto",padding:"6px 12px",fontSize:12,color:"#fff",borderColor:"rgba(255,255,255,0.4)"},onClick:function(){e.logout()}},"Logout")),a.createElement("main",{className:"vp-main"},t.children),a.createElement("nav",{className:"vp-nav"},a.createElement(o.NavLink,{exact:!0,to:"/vendor-portal",activeClassName:"vp-nav--active"},"Home"),a.createElement(o.NavLink,{to:"/vendor-portal/stock",activeClassName:"vp-nav--active"},"Stock"),a.createElement(o.NavLink,{to:"/vendor-portal/orders",activeClassName:"vp-nav--active"},"Orders")))};n.d(e,["A",0,i])},83435(t,e,n){n.r(e);var a=n(65043),o=n(62834),r=n(53570),l=n(25806);const i=function(){var t=(0,l.U)(),e=(0,a.useState)([]),n=e[0],i=e[1],c=(0,a.useState)(""),s=c[0],u=c[1],d=(0,a.useState)(""),f=d[0],m=d[1],p=(0,a.useCallback)(function(){t.eventId&&t.stallId&&r.xx.listStock({event_id:t.eventId,stall_id:t.stallId}).then(function(t){i(t&&t.inventory||[])}).catch(function(t){u(t.message)})},[t.eventId,t.stallId]);(0,a.useEffect)(function(){p()},[p]);
1var v=function(t,e){u(""),r.xx.adjustStock({inventory_id:t.id,adjustment_type:"MANUAL",quantity:e,notes:"Vendor portal adjustment"}).then(function(){m("Stock updated"),p()}).catch(function(t){u(t.message)})};return a.createElement(o.A,null,a.createElement("h2",{style:{margin:"0 0 12px",fontSize:16}},"Inventory"),s?a.createElement("div",{className:"vp-err"},s):null,f?a.createElement("div",{className:"vp-card",style:{background:"#ecfdf5",color:"#047857"}},f):null,a.createElement("div",{className:"vp-card stf-card--flush"},0===n.length?a.createElement("p",{style:{margin:0,color:"#64748b"}},"No stock rows. Ask ParkAdda staff to load opening stock."):a.createElement("table",{className:"vp-table"},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Item"),a.createElement("th",null,"On hand"),a.createElement("th",null))),a.createElement("tbody",null,n.map(function(t){return a.createElement("tr",{key:t.id},a.createElement("td",null,t.item_name||t.vendor_item_name),a.createElement("td",null,t.current_stock),a.createElement("td",{style:{whiteSpace:"nowrap"}},a.createElement("button",{type:"button",className:"vp-btn vp-btn--ghost",style:{width:"auto",padding:"4px 8px",marginRight:4},onClick:function(){v(t,-1)}},"\u22121"),a.createElement("button",{type:"button",className:"vp-btn vp-btn--ghost",style:{width:"auto",padding:"4px 8px"},onClick:function(){v(t,1)}},"+1")))})))))};n.d(e,["default",0,i])},25806(t,e,n){n.d(e,{U:()=>s});var a=n(65043),o=n(53570),r=n(87153),l=[],i=null;function c(){for(var t=0;t<l.length;t++)try{l[t](i)}catch(e){}}function s(){var t=(0,a.useState)(function(){return"undefined"!==typeof window&&window.localStorage.getItem(o.pw)?"loading":"unauthenticated"}),e=t[0],n=t[1],s=(0,a.useState)(null),u=s[0],d=s[1];(0,a.useEffect)(function(){function t(t){d(t),n(t?"authenticated":"unauthenticated")}return l.push(t),i=u,"loading"===e&&o.xx.session().then(function(t){i=t.staff,d(t.staff),n("authenticated"),c()}).catch(function(){(0,o.cy)(null),n("unauthenticated")}),function(){l=l.filter(function(e){return e!==t})}},[]);var f=(0,a.useCallback)(function(t,e){var a=(0,r.Y)(t);return o.xx.login(a,e).then(function(t){(0,o.cy)(t.token),i=t.staff,d(t.staff),n("authenticated"),c()})},[]),m=(0,a.useCallback)(function(){return o.xx.logout().finally(function(){(0,o.cy)(null),i=null,d(null),n("unauthenticated"),c()})},[]),p=u&&u.operator;return{status:e,staff:u,operator:p,eventId:p&&p.event_id,stallId:p&&p.stall_id,vendorId:p&&p.vendor_id,login:f,logout:m}}},87153(t,e,n){function a(t){const e=String(t||"").replace(/\D/g,"");return e.length<=10?e:e.slice(-10)}function o(t){return/^\d{10}$/.test(String(t||"").trim())}n.d(e,{Y:()=>a,Z:()=>o})},61512(){}}]); 2//# sourceMappingURL=3435.def279d5.chunk.js.map
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.