-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent---src-pages-account-store-js-81c12622c86c286338a9.js
2 lines (2 loc) · 9.95 KB
/
component---src-pages-account-store-js-81c12622c86c286338a9.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[16,12,13,15],{RWYn:function(e,t,a){"use strict";a.r(t);var n=a("q1tI"),r=a.n(n),c=a("VwWJ"),o=a("fhwx"),l=a.n(o),u=a("463D"),i=a("sWYD"),s=a("4+6U");t.default=function(e){var t=e.id,a=[{property:"objectId",headerText:"",primaryKey:!0,render:function(e){return r.a.createElement(r.a.Fragment,null," ")}},{property:"name",headerText:"Name"},{property:"Description",headerText:"Info",type:"Textarea",render:function(e){return r.a.createElement(r.a.Fragment,null," ",l()(e.description)," ")}},{property:"bidEndAt",headerText:"BidEnd",type:"DateTimePicker",render:function(e){return r.a.createElement(r.a.Fragment,null," ",e.bidEndAt?Object(i.a)(Object(s.a)(e.bidEndAt.iso),"yyyy MMM dd HH:mm:s"):"Not Set"," ")}},{property:"available",headerText:"Show",type:"CheckBox",render:function(e){return r.a.createElement(r.a.Fragment,null," ",e.available?"Yes":"No"," ")}},{property:"startBid",headerText:"startBid",render:function(e){return r.a.createElement(r.a.Fragment,null," ",e.startBid," ")}},{headerText:"Image",render:function(e){return r.a.createElement(r.a.Fragment,null," ",e.photo?r.a.createElement(u.a,{href:e.photo.url}," View "):"Empty"," ")}}];return r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,{suffix:"",objectClass:"Product",columns:a,query:function(e){return e},fetchData:{action:"searchProduct",params:{query:{storeId:{f:"equalTo",v:t}}}}}))}},SO6N:function(e,t,a){"use strict";a.r(t);var n=a("q1tI"),r=a.n(n),c=a("VwWJ"),o=a("fhwx"),l=a.n(o),u=a("jCe7");function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}var s=function(e){return r.a.createElement(u.a,i({viewBox:"0 0 24 24",a11yTitle:"Cluster"},e),r.a.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"}))},d=(a("LXcg"),a("ZaGI")),m=a("xtVq"),p=a("Wbzz"),f=[{property:"name",headerText:"Name"},{property:"description",headerText:"Info",type:"Textarea",render:function(e){return r.a.createElement(r.a.Fragment,null," ",l()(e.description)," ")}},{property:"whatsapp",headerText:"Whatsapp",render:function(e){return r.a.createElement(r.a.Fragment,null," ",l()(e.whatsapp)," ")}},{property:"objectId",headerText:"Product",render:function(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement(s,{onClick:function(){Object(p.b)("/account/store/manageproduct2/"+e.objectId)}}))}}];t.default=function(){var e=r.a.useContext(m.a),t=Object(n.useState)([]),a=t[0],o=t[1];return Object(n.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&&Object(d.a)(t,999).then((function(e){o(e)}))}),[e]),r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,{width:"100%",objectClass:"Store",columns:f,query:function(e){return e},datasource:a,afterAction:function(){return e.refresh()}}))}},ZaGI:function(e,t,a){"use strict";a.d(t,"a",(function(){return r}));a("q1tI");var n=a("LXcg"),r=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=1),Object(n.z)("Store",{ascending:"createdAt",role:{c:"_Role",f:"containedIn",v:e,t:"pointer"}})}},b3Vd:function(e,t,a){"use strict";a.r(t);var n=a("o0o1"),r=a.n(n),c=(a("ls82"),a("HaE+")),o=a("q1tI"),l=a.n(o),u=a("otPn"),i=a("P3Am"),s=a("463D"),d=a("ZmBq"),m=a("XDYV"),p=a("evJi"),f=a("ebn3"),h=function(e){var t=e.data,a=e.onConfigure,n=e.onDelete;return l.a.createElement(l.a.Fragment,null,l.a.createElement(d.a,{columns:[{property:"name",header:l.a.createElement(m.a,null,"Name"),primary:!0},{property:"description",header:l.a.createElement(m.a,null,"Description")},{property:"startBid",header:l.a.createElement(m.a,null,"Start Bid")},{property:"instantClosePrice",header:l.a.createElement(m.a,null,"Instant Close Price")},{property:"Status",header:l.a.createElement(m.a,null,"Status")},{property:"available",header:l.a.createElement(m.a,null,"Display")},{property:"",header:l.a.createElement(m.a,null,"Action"),render:function(e){return l.a.createElement(l.a.Fragment,null,l.a.createElement(p.a,{onClick:function(){return a&&a(e)},style:{cursor:"pointer"}}),l.a.createElement(f.a,{onClick:function(){return n&&n(e)},style:{cursor:"pointer"}}))}}],data:t}))},b=a("ACV0"),E=a("omfP"),g=a("T1Te"),j=a("pngH"),v=a("yzbm"),y=a("LXcg"),O=function(e){var t=e.formModal,a=e.onModal,n=e.mode,r=void 0===n?"create":n,c=(e.onDelete,e.onUpdate,Object(o.useState)(t)),s=c[0],d=c[1],m=l.a.useState(!0),p=m[0],f=m[1],h=Object(o.useState)(null)[1],O=function(e,t){return{value:t[e],onChange:function(a){var n;return d(Object.assign({},t,((n={})[e]=a.target.value,n)))}}},x=Object(o.useCallback)((function(e){!function(e){new y.g.File(e.name,e).save().then((function(e){h(e.url()),d(Object.assign({},s,{photo:e,available:!!p}))}))}(e&&e[0])}),[s,p]),w=Object(v.a)({onDrop:x}),C=w.getRootProps,S=w.getInputProps,I=w.isDragActive;return l.a.createElement(u.a,null,"delete"===r&&l.a.createElement(l.a.Fragment,null,l.a.createElement(b.a,{level:2},"Are you sure?"),s&&s.photo&&s.photo.url&&l.a.createElement(u.a,{height:"small",width:"small"},l.a.createElement(E.a,{fit:"cover",src:s.photo.url})),l.a.createElement(g.a,{label:"delete",onClick:function(){a&&a(r,Object.assign({},s,{available:!!p}))}})),["create","update"].includes(r)&&l.a.createElement(l.a.Fragment,null,l.a.createElement(b.a,{level:3},"Upload Product"),l.a.createElement(i.a,Object.assign({placeholder:"Product Name"},O("name",s))),l.a.createElement(u.a,{direction:"row"},l.a.createElement("div",C(),l.a.createElement("input",S()),s&&s.photo&&s.photo.url&&l.a.createElement(u.a,{height:"small",width:"small"},l.a.createElement(E.a,{fit:"cover",src:s.photo.url})),I?l.a.createElement("p",null,"Drop the files here ..."):l.a.createElement("p",null,"Drag 'n' drop some files here, or click to select files"))),l.a.createElement(i.a,Object.assign({},O("startBid",s),{placeholder:"Start Bid"})),l.a.createElement(i.a,Object.assign({},O("instantClosePrice",s),{placeholder:"Instant Close"})),l.a.createElement(j.a,{checked:p,label:"Display On Store",onChange:function(e){f(e.target.checked)}}),l.a.createElement(g.a,{label:r,onClick:function(){return a&&a(r,Object.assign({},s,{available:!!p}))}})))},x=a("/Q2I"),w=a("zpb6");t.default=function(e){var t=e.id,a=y.g&&y.g.Object&&y.g.Object.extend("Store"),n=Object(o.useState)({}),d=n[0],m=n[1],p=Object(o.useState)(a&&new a)[0],f=Object(o.useState)({}),b=f[0],E=f[1],g=Object(o.useState)(!1),j=g[0],v=g[1],C=Object(o.useState)(null),S=C[0],I=C[1],k=Object(o.useState)([]),T=k[0],L=k[1],P=Object(o.useState)("create"),F=P[0],D=P[1];return Object(o.useEffect)((function(){(function(){var e=Object(c.a)(r.a.mark((function e(){var a;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(y.m)();case 2:a=e.sent,I(a.find((function(e){return e.id===t})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[t]),Object(o.useEffect)((function(){S&&(E({name:S.get("name")}),function(){var e=Object(c.a)(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=L,e.next=3,Object(y.n)(S);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)}}()())}),[S]),l.a.createElement(l.a.Fragment,null,l.a.createElement(u.a,{fill:!0,justify:"center",align:"center",alignContent:"center"},l.a.createElement(l.a.Fragment,null,l.a.createElement(u.a,{fill:!0,gap:"small",direction:"row"},l.a.createElement(i.a,{plain:!1,placeholder:"choose a store name",value:b.name,onChange:function(e){E(Object.assign({},b,{objectId:p&&p.id,name:e.target.value}))}}),l.a.createElement(s.a,{onClick:function(){return v(!0)}},"Change Store Name"),l.a.createElement(s.a,{onClick:function(){D("create"),m({}),v(!0)}},"Add Product")),l.a.createElement(u.a,{fill:!0},l.a.createElement(h,{data:T?T.map((function(e){return e.toJSON()})):[],onConfigure:function(e){D("update"),m(e),v(!0)},onDelete:function(e){D("delete"),m(e),v(!0)}})))),j&&l.a.createElement(x.a,{onClose:function(){return v(!1)}},l.a.createElement(O,{mode:F,formModal:d,onModal:function(){var e=Object(c.a)(r.a.mark((function e(t,a){var n,c;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=["name","photo","startBid","instantClosePrice","objectId","available"],c=S.id,a=Object(w.cloneJSONKey)(a,n),"create"!==t){e.next=6;break}return e.next=6,Object(y.e)(a,S.id);case 6:if("update"!==t){e.next=9;break}return e.next=9,Object(y.E)(Object.assign({},a,{productId:a.objectId,storeId:c}));case 9:if("delete"!==t){e.next=12;break}return e.next=12,Object(y.h)({productId:a.objectId,storeId:c});case 12:setTimeout((function(){return Object(y.n)(S).then((function(e){L(e),v(!1)}))}),1e3);case 13:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}}(),onClose:function(){return v(!1)}})))}},r8tk:function(e,t,a){"use strict";a.r(t);var n=a("q1tI"),r=a.n(n),c=a("YwZP"),o=a("SO6N"),l=a("xPmw"),u=a("b3Vd"),i=a("RWYn"),s=a("otPn");t.default=function(){return r.a.createElement(s.a,{fill:!0},r.a.createElement(c.Router,{basepath:"/account/store"},r.a.createElement(l.default,{path:"/editstore/:id"}),r.a.createElement(o.default,{path:"/"}),r.a.createElement(u.default,{path:"/manageproduct/:id"}),r.a.createElement(i.default,{path:"/manageproduct2/:id"})))}},xPmw:function(e,t,a){"use strict";a.r(t);var n=a("q1tI"),r=a.n(n),c=a("VwWJ"),o=a("fhwx"),l=a.n(o);t.default=function(){var e=[{property:"name",headerText:"Name"},{property:"description",headerText:"Description",type:"Textarea",render:function(e){return r.a.createElement(r.a.Fragment,null," ",l()(e.description)," ")}}];return r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,{objectClass:"Store",columns:e,query:function(e){return e},fetchData:{action:"findStore"}}))}}}]);
//# sourceMappingURL=component---src-pages-account-store-js-81c12622c86c286338a9.js.map