-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent---src-pages-account-store-js-337dd752e0303fd635dc.js
2 lines (2 loc) · 9.56 KB
/
component---src-pages-account-store-js-337dd752e0303fd635dc.js
1
2
"use strict";(self.webpackChunkgatsby_starter_hello_world=self.webpackChunkgatsby_starter_hello_world||[]).push([[787,242,36,333],{7282:function(e,t,n){n.d(t,{i:function(){return a}});n(7294);var r=n(4278),a=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=1),(0,r.kp)("Store",{ascending:"createdAt",role:{c:"_Role",f:"containedIn",v:e,t:"pointer"}})}},651:function(e,t,n){n.r(t);var r=n(7294),a=n(6386),o=n(9493);t.default=function(){var e=[{property:"name",headerText:"Name"},{property:"description",headerText:"Description",type:"Textarea",render:function(e){return r.createElement(r.Fragment,null," ",(0,o.ZP)(e.description)," ")}}];return r.createElement(r.Fragment,null,r.createElement(a.Z,{objectClass:"Store",columns:e,query:function(e){return e},fetchData:{action:"findStore"}}))}},8822:function(e,t,n){n.r(t),n.d(t,{default:function(){return k}});var r=n(2137),a=n(7757),o=n.n(a),c=n(7294),l=n(6289),u=n(3966),i=n(3277),s=n(202),d=n(8169),m=n(6421),p=n(8263),f=function(e){var t=e.data,n=e.onConfigure,r=e.onDelete;return c.createElement(c.Fragment,null,c.createElement(s.w,{columns:[{property:"name",header:c.createElement(d.x,null,"Name"),primary:!0},{property:"description",header:c.createElement(d.x,null,"Description")},{property:"startBid",header:c.createElement(d.x,null,"Start Bid")},{property:"instantClosePrice",header:c.createElement(d.x,null,"Instant Close Price")},{property:"Status",header:c.createElement(d.x,null,"Status")},{property:"available",header:c.createElement(d.x,null,"Display")},{property:"",header:c.createElement(d.x,null,"Action"),render:function(e){return c.createElement(c.Fragment,null,c.createElement(m.T,{onClick:function(){return n&&n(e)},style:{cursor:"pointer"}}),c.createElement(p.x,{onClick:function(){return r&&r(e)},style:{cursor:"pointer"}}))}}],data:t}))},h=n(6354),E=n(733),g=n(1686),y=n(3090),v=n(8842),x=n(4278),b=function(e){var t=e.formModal,n=e.onModal,r=e.mode,a=void 0===r?"create":r,o=(e.onDelete,e.onUpdate,(0,c.useState)(t)),i=o[0],s=o[1],d=c.useState(!0),m=d[0],p=d[1],f=(0,c.useState)(null)[1],b=function(e,t){return{value:t[e],onChange:function(n){var r;return s(Object.assign({},t,((r={})[e]=n.target.value,r)))}}},C=(0,c.useCallback)((function(e){!function(e){new x.ZP.File(e.name,e).save().then((function(e){f(e.url()),s(Object.assign({},i,{photo:e,available:!!m}))}))}(e&&e[0])}),[i,m]),S=(0,v.u)({onDrop:C}),k=S.getRootProps,j=S.getInputProps,w=S.isDragActive;return c.createElement(l.x,null,"delete"===a&&c.createElement(c.Fragment,null,c.createElement(h.X,{level:2},"Are you sure?"),i&&i.photo&&i.photo.url&&c.createElement(l.x,{height:"small",width:"small"},c.createElement(E.E,{fit:"cover",src:i.photo.url})),c.createElement(g.z,{label:"delete",onClick:function(){n&&n(a,Object.assign({},i,{available:!!m}))}})),["create","update"].includes(a)&&c.createElement(c.Fragment,null,c.createElement(h.X,{level:3},"Upload Product"),c.createElement(u.o,Object.assign({placeholder:"Product Name"},b("name",i))),c.createElement(l.x,{direction:"row"},c.createElement("div",k(),c.createElement("input",j()),i&&i.photo&&i.photo.url&&c.createElement(l.x,{height:"small",width:"small"},c.createElement(E.E,{fit:"cover",src:i.photo.url})),w?c.createElement("p",null,"Drop the files here ..."):c.createElement("p",null,"Drag 'n' drop some files here, or click to select files"))),c.createElement(u.o,Object.assign({},b("startBid",i),{placeholder:"Start Bid"})),c.createElement(u.o,Object.assign({},b("instantClosePrice",i),{placeholder:"Instant Close"})),c.createElement(y.J,{checked:m,label:"Display On Store",onChange:function(e){p(e.target.checked)}}),c.createElement(g.z,{label:a,onClick:function(){return n&&n(a,Object.assign({},i,{available:!!m}))}})))},C=n(7752),S=n(2842),k=function(e){var t=e.id,n=x.ZP&&x.ZP.Object&&x.ZP.Object.extend("Store"),a=(0,c.useState)({}),s=a[0],d=a[1],m=(0,c.useState)(n&&new n)[0],p=(0,c.useState)({}),h=p[0],E=p[1],g=(0,c.useState)(!1),y=g[0],v=g[1],k=(0,c.useState)(null),j=k[0],w=k[1],Z=(0,c.useState)([]),P=Z[0],T=Z[1],F=(0,c.useState)("create"),I=F[0],O=F[1];return(0,c.useEffect)((function(){(function(){var e=(0,r.Z)(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,x.UT)();case 2:n=e.sent,w(n.find((function(e){return e.id===t})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[t]),(0,c.useEffect)((function(){j&&(E({name:j.get("name")}),function(){var e=(0,r.Z)(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=T,e.next=3,(0,x.V_)(j);case 3:e.t1=e.sent,(0,e.t0)(e.t1);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()())}),[j]),c.createElement(c.Fragment,null,c.createElement(l.x,{fill:!0,justify:"center",align:"center",alignContent:"center"},c.createElement(c.Fragment,null,c.createElement(l.x,{fill:!0,gap:"small",direction:"row"},c.createElement(u.o,{plain:!1,placeholder:"choose a store name",value:h.name,onChange:function(e){E(Object.assign({},h,{objectId:m&&m.id,name:e.target.value}))}}),c.createElement(i.e,{onClick:function(){return v(!0)}},"Change Store Name"),c.createElement(i.e,{onClick:function(){O("create"),d({}),v(!0)}},"Add Product")),c.createElement(l.x,{fill:!0},c.createElement(f,{data:P?P.map((function(e){return e.toJSON()})):[],onConfigure:function(e){O("update"),d(e),v(!0)},onDelete:function(e){O("delete"),d(e),v(!0)}})))),y&&c.createElement(C.Z,{onClose:function(){return v(!1)}},c.createElement(b,{mode:I,formModal:s,onModal:function(){var e=(0,r.Z)(o().mark((function e(t,n){var r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=["name","photo","startBid","instantClosePrice","objectId","available"],a=j.id,n=(0,S.cloneJSONKey)(n,r),"create"!==t){e.next=6;break}return e.next=6,(0,x.OA)(n,j.id);case 6:if("update"!==t){e.next=9;break}return e.next=9,(0,x.iz)(Object.assign({},n,{productId:n.objectId,storeId:a}));case 9:if("delete"!==t){e.next=12;break}return e.next=12,(0,x.gb)({productId:n.objectId,storeId:a});case 12:setTimeout((function(){return(0,x.V_)(j).then((function(e){T(e),v(!1)}))}),1e3);case 13:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),onClose:function(){return v(!1)}})))}},9507:function(e,t,n){n.r(t);var r=n(7294),a=n(6386),o=n(9493),c=n(3277),l=n(1490),u=n(259);t.default=function(e){var t=e.id,n=[{property:"objectId",headerText:"",primaryKey:!0,render:function(e){return r.createElement(r.Fragment,null," ")}},{property:"name",headerText:"Name"},{property:"Description",headerText:"Info",type:"Textarea",render:function(e){return r.createElement(r.Fragment,null," ",(0,o.ZP)(e.description)," ")}},{property:"bidEndAt",headerText:"BidEnd",type:"DateTimePicker",render:function(e){return r.createElement(r.Fragment,null," ",e.bidEndAt?(0,l.Z)((0,u.Z)(e.bidEndAt.iso),"yyyy MMM dd HH:mm:s"):"Not Set"," ")}},{property:"available",headerText:"Show",type:"CheckBox",render:function(e){return r.createElement(r.Fragment,null," ",e.available?"Yes":"No"," ")}},{property:"startBid",headerText:"startBid",render:function(e){return r.createElement(r.Fragment,null," ",e.startBid," ")}},{headerText:"Image",render:function(e){return r.createElement(r.Fragment,null," ",e.photo?r.createElement(c.e,{href:e.photo.url}," View "):"Empty"," ")}}];return r.createElement(r.Fragment,null,r.createElement(a.Z,{suffix:"",objectClass:"Product",columns:n,query:function(e){return e},fetchData:{action:"searchProduct",params:{query:{storeId:{f:"equalTo",v:t}}}}}))}},6352:function(e,t,n){n.r(t),n.d(t,{default:function(){return p}});var r=n(7294),a=n(6386),o=n(9493),c=n(9638);function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var u=function(e){return r.createElement(c.x,l({viewBox:"0 0 24 24",a11yTitle:"Cluster"},e),r.createElement("path",{fill:"none",stroke:"#000",strokeWidth:"2",d:"M8,9 L16,9 L16,1 L8,1 L8,9 Z M1,23 L9,23 L9,15 L1,15 L1,23 Z M15,23 L23,23 L23,15 L15,15 L15,23 Z M5,15 L8,9 L5,15 Z M10,19 L14,19 L10,19 Z M16,9 L19,15 L16,9 Z"}))},i=(n(4278),n(7282)),s=n(8905),d=n(5444),m=[{property:"name",headerText:"Name"},{property:"description",headerText:"Info",type:"Textarea",render:function(e){return r.createElement(r.Fragment,null," ",(0,o.ZP)(e.description)," ")}},{property:"whatsapp",headerText:"Whatsapp",render:function(e){return r.createElement(r.Fragment,null," ",(0,o.ZP)(e.whatsapp)," ")}},{property:"objectId",headerText:"Product",render:function(e){return r.createElement(r.Fragment,null,r.createElement(u,{onClick:function(){(0,d.c4)("/account/store/manageproduct2/"+e.objectId)}}))}}],p=function(){var e=r.useContext(s.Z),t=(0,r.useState)([]),n=t[0],o=t[1];return(0,r.useEffect)((function(){var t=e&&e.roleObjects.filter((function(e){return e.get("name").includes("Store-")})).map((function(e){return e.id}))||[];t&&t.length&&(0,i.i)(t,999).then((function(e){o(e)}))}),[e]),r.createElement(r.Fragment,null,r.createElement(a.Z,{width:"100%",objectClass:"Store",columns:m,query:function(e){return e},datasource:n,afterAction:function(){return e.refresh()}}))}},1005:function(e,t,n){n.r(t);var r=n(7294),a=n(9499),o=n(6352),c=n(651),l=n(8822),u=n(9507),i=n(6289);t.default=function(){return r.createElement(i.x,{fill:!0},r.createElement(a.Router,{basepath:"/account/store"},r.createElement(c.default,{path:"/editstore/:id"}),r.createElement(o.default,{path:"/"}),r.createElement(l.default,{path:"/manageproduct/:id"}),r.createElement(u.default,{path:"/manageproduct2/:id"})))}}}]);
//# sourceMappingURL=component---src-pages-account-store-js-337dd752e0303fd635dc.js.map