(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{233:function(e,t){!function(e){var t={TWO:"2.1",THREE:"3.0",FOUR:"4.0"},n={Version:t,Entry:{ADDRESS:{version:[t.TWO,t.THREE,t.FOUR],key:"ADR",format:";;{0};{2};{4};{1};{3}","@comment":"usage: addAdr(street, code, city, country, state)"},AGENT:{version:[t.TWO,t.THREE],key:"AGENT"},ANNIVERSARY:{version:[t.FOUR],key:"ANNIVERSARY"},BIRTHDAY:{version:[t.TWO,t.THREE,t.FOUR],key:"BDAY"},CALENDARADDURI:{version:[t.FOUR],key:"CALADRURI"},CALENDARURI:{version:[t.FOUR],key:"CALURI"},CATEGORIES:{version:[t.TWO,t.THREE,t.FOUR],key:"CATEGORIES"},CLASS:{version:[t.THREE],key:"CLASS"},CLIENTPIDMAP:{version:[t.FOUR],key:"CLIENTPIDMAP"},EMAIL:{version:[t.TWO,t.THREE,t.FOUR],key:"EMAIL"},FBURL:{version:[t.FOUR],key:"FBURL"},FORMATTEDNAME:{version:[t.TWO,t.THREE,t.FOUR],key:"FN"},GENDER:{version:[t.FOUR],key:"GENDER"},GEO:{version:[t.TWO,t.THREE,t.FOUR],key:"GEO"},IMPP:{version:[t.THREE,t.FOUR],key:"IMPP"},KIND:{version:[t.FOUR],key:"KIND"},LABEL:{version:[t.TWO,t.THREE],key:"LABEL"},MAILER:{version:[t.TWO,t.THREE],key:"MAILER"},MEMBER:{version:[t.FOUR],key:"MEMBER"},NAME:{version:[t.TWO,t.THREE,t.FOUR],key:"N",format:"{1};{0};;{2}","@comment":"usage: addName(firstname, lastname, title)"},NICKNAME:{version:[t.THREE,t.FOUR],key:"NICKNAME"},NOTE:{version:[t.TWO,t.THREE,t.FOUR],key:"NOTE"},ORGANIZATION:{version:[t.TWO,t.THREE,t.FOUR],key:"ORG"},PRODID:{version:[t.THREE,t.FOUR],key:"PRODID"},PROFILE:{version:[t.TWO,t.THREE],key:"PROFILE"},RELATED:{version:[t.FOUR],key:"RELATED"},REVISION:{version:[t.TWO,t.THREE,t.FOUR],key:"REV"},ROLE:{version:[t.TWO,t.THREE,t.FOUR],key:"ROLE"},SORTSTRING:{version:[t.TWO,t.THREE,t.FOUR],key:"SORT-STRING"},SOURCE:{version:[t.TWO,t.THREE,t.FOUR],key:"SOURCE"},PHONE:{version:[t.TWO,t.THREE,t.FOUR],key:"TEL"},TITLE:{version:[t.TWO,t.THREE,t.FOUR],key:"TITLE"},TIMEZONE:{version:[t.TWO,t.THREE,t.FOUR],key:"TZ"},UID:{version:[t.TWO,t.THREE,t.FOUR],key:"UID"},URL:{version:[t.TWO,t.THREE,t.FOUR],key:"URL"},XML:{version:[t.FOUR],key:"XML"}},Type:{HOME:"HOME",WORK:"WORK",CELL:"CELL",MAIN:"MAIN",OTHER:"OTHER"},create:function(e){for(var t in this.Version)if(this.Version[t]===e)return new r(e);throw new Error("Unknown vCard version")},dump:function(e){var t="BEGIN:VCARD\n";for(var n in e){var r=e[n];if("function"!==typeof r)if("[object Array]"===Object.prototype.toString.call(r))for(var a=0,i=r.length;a>>2],r+=n[(3&e.charCodeAt(t))<<4|e.charCodeAt(t+1)>>>4],r+=n[(15&e.charCodeAt(t+1))<<2|e.charCodeAt(t+2)>>>6],r+=n[63&e.charCodeAt(t+2)];return a%3===2?(r+=n[e.charCodeAt(t)>>>2],r+=n[(3&e.charCodeAt(t))<<4|e.charCodeAt(t+1)>>>4],r+=n[(15&e.charCodeAt(t+1))<<2],r+="="):a%3===1&&(r+=n[e.charCodeAt(t)>>>2],r+=n[(3&e.charCodeAt(t))<<4],r+="=="),r}))},r=function e(t){for(var r in this.version=t,console.log(this),n.Entry){var a=n.Entry[r];if(a.version&&!(a.version.indexOf(t)<0)){var i="add"+r[0].toUpperCase()+r.slice(1).toLowerCase();e.prototype[i]=function(e,t){return function(){var r=Array.prototype.slice.call(arguments),a=r.length>0?r[r.length-1]:void 0,i=n.Type.hasOwnProperty(a)?r.slice(0,r.length-1):r,c=t&&t.replace(/\{([0-9]*)\}/g,(function(e,t){return i[parseInt(t)]||""}))||i[0];this.add(e,c,n.Type.hasOwnProperty(a)&&a)}}(a.key,a.format)}}this.add=function(e,t,n){var r="object"===typeof e&&e.key?e.key:e;!this[r]&&(this[r]=[]);var a={value:t};n&&(a.type=n),this[r].push(a)}};e.vCard=n}(this)},271:function(e,t,n){},272:function(e,t,n){},430:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),i=n(39),c=n.n(i),s=(n(271),n.p,n(272),n(5)),o=n(1);var l,u,d=n(15),p=n(237),j=n(4),b=n(13),O=n(473),f=n(57),h=n(8),v=n(12),m=n(21),E=n(232),x=n(467),y=n(152),R=n(458),g=n(459),T=function(){return Object(o.jsx)("svg",{width:"81.8mm",height:"67.836mm",version:"1.1",viewBox:"0 0 81.8 67.836",xmlns:"http://www.w3.org/2000/svg",children:Object(o.jsxs)("g",{transform:"translate(-96.389 -100.48)",children:[Object(o.jsx)("ellipse",{cx:"145.43",cy:"139.3",rx:"31.907",ry:"28.16",fill:"#012169",stroke:"#fff","stroke-width":"1.6956"}),Object(o.jsx)("ellipse",{cx:"119.55",cy:"142.71",rx:"23.161",ry:"20.776",fill:"#418fde","fill-opacity":".81526"}),Object(o.jsx)("ellipse",{cx:"132.66",cy:"117.17",rx:"18.222",ry:"16.689",fill:"#a20067","fill-opacity":".67872"})]})})},_=n(233),C=n(457),N=function(e){var t=e.contactData,n=e.buttonText;return Object(o.jsx)("div",{className:"add-to-contacts-button-container",children:Object(o.jsxs)("button",{onClick:function(){!function(){var e={version:"4.0"};e.n=t["supplier_db.org_name"]+";;",e.fn=t["suppleir_db.org_name"],e.fn=t["supplier_db.org_name"],e.title="UPick Berry Farm",e.adr={},e.adr.value=";;"+(t["supplier_db.address_line_1"]?t["supplier_db.address_line_1"]+";":"")+(t["supplier_db.city"]?t["supplier_db.city"]+";":"")+(t["supplier_db.state_or_province"]?t["supplier_db.state_or_province"]+";":"")+(t["supplier_db.postal_code"]?t["supplier_db.postal_code"].includes("-")?t["suppleir_db.postal_code"]+";":t["supplier_db.postal_code"]+";":"")+(t["supplier_db.country_name"]?"United States"===t["supplier_db.country_name"]?"USA":t["supplier_db.country_name"]:""),e.adr.type="work",e.email=t["supplier_db.email"]?t["supplier_db.email"]:"",e.url=t["supplier_db.website"]?t["supplier_db.website"]:"",_.vCard.export(e,e.fn.replace(" ","-"),!0)}()},className:"add-to-contacts-button",children:[Object(o.jsx)("div",{className:"add-to-contacts-icon",children:Object(o.jsx)(C.a,{})})," ",n]})})},k=function(e){var t,n=e.dataRow,r=e.offerings;return Object(o.jsx)(o.Fragment,{children:Object(o.jsxs)(O.a,{className:"card-container",children:[Object(o.jsxs)("div",{className:"card-supplier-name-container",children:[Object(o.jsx)("h4",{className:"card-supplier-name",children:Object(o.jsx)("b",{children:n["supplier_db.org_name"]})}),Object(o.jsx)(N,{contactData:n,buttonText:"Add to Contacts"})]}),Object(o.jsxs)("div",{className:"card-details",children:[Object(o.jsx)("p",{children:n["supplier_db.address_line_1"]}),Object(o.jsxs)("p",{children:[n["supplier_db.city"],", ",n["supplier_db.state_or_province"]," ",n["supplier_db.postal_code"]]}),Object(o.jsxs)("p",{children:[" ",n["supplier_db.country_name"]]})]}),Object(o.jsx)("div",{className:"divider",style:{paddingTop:"10px"}}),Object(o.jsxs)("div",{className:"card-details",children:[Object(o.jsx)("p",{children:n["supplier_db.member_name"]}),Object(o.jsxs)("p",{style:{display:"flex"},children:[n["supplier_db.email"]?Object(o.jsx)(o.Fragment,{children:Object(o.jsx)("a",{href:"mailto: ".concat(n["supplier_db.email"]),children:Object(o.jsx)("div",{className:"card-icon",children:Object(o.jsx)(R.a,{style:{fill:"black"}})})})}):"",n["impexium_orgs.website"]?Object(o.jsx)(o.Fragment,{children:Object(o.jsx)("a",{href:n["impexium_orgs.website"],children:Object(o.jsx)("div",{className:"card-icon",children:Object(o.jsx)(g.a,{style:{fill:"black"}})})})}):""]})]}),Object(o.jsx)("div",{className:"tag-list",children:null===(t=n["supplier_db.market_scopes"])||void 0===t?void 0:t.split(", ").map((function(e){return Object(o.jsx)("div",{className:"tag market-scope",style:{backgroundColor:r[e]},children:e})}))}),Object(o.jsx)("div",{className:"background-img",children:Object(o.jsx)(T,{})})]})})},F=n(10),A=n(88),U=n.n(A),S="...",w=function(e,t){var n=t-e+1;return Array.from({length:n},(function(t,n){return n+e}))},L=function(e){var t=e.onPageChange,n=e.totalCount,a=e.siblingCount,i=void 0===a?1:a,c=e.currentPage,s=e.pageSize,l=e.className,u=function(e){var t=e.totalCount,n=e.pageSize,a=e.siblingCount,i=void 0===a?1:a,c=e.currentPage;return Object(r.useMemo)((function(){var e=Math.ceil(t/n);if(i+5>=e)return w(1,e);var r=Math.max(c-i,1),a=Math.min(c+i,e),s=r>2,o=ar?1:0})):[]};return Object(o.jsx)(o.Fragment,{children:Object(o.jsxs)(O.a,{className:"filter-container",children:[Object(o.jsx)(K,{optionLabel:"Product Offerings",options:l(t),setCurrentFilter:s,currentFilter:c,name:"supplier_db.product_offerings"}),Object(o.jsx)(K,{optionLabel:"Customer Categories",options:l(n),setCurrentFilter:s,currentFilter:c,name:"supplier_db.customer_categories"}),Object(o.jsx)(K,{optionLabel:"Availabilities",options:l(a),setCurrentFilter:s,currentFilter:c,name:"supplier_db.availability"}),Object(o.jsx)(K,{optionLabel:"Certifications",options:l(i),setCurrentFilter:s,currentFilter:c,name:"supplier_db.certifications"}),Object(o.jsx)(K,{optionLabel:"Market Scopes",options:l(r),setCurrentFilter:s,currentFilter:c,name:"supplier_db.market_scopes"})]})})},J=n(477),Z=n(468),q=n(431),X=n(469),$=function(e){Object(E.a)(e);var t=a.a.useState([]),n=Object(s.a)(t,2),i=n[0],c=n[1],l=a.a.useState([]),u=Object(s.a)(l,2),d=u[0],p=u[1],b=a.a.useState([]),R=Object(s.a)(b,2),g=R[0],T=R[1],_=a.a.useState([]),C=Object(s.a)(_,2),N=C[0],F=C[1],A=a.a.useState([]),U=Object(s.a)(A,2),S=U[0],w=U[1],I=a.a.useState([]),M=Object(s.a)(I,2),P=M[0],H=M[1],D=a.a.useState([]),W=Object(s.a)(D,2),B=W[0],G=W[1],V=a.a.useState({}),Y=Object(s.a)(V,2),K=Y[0],$=Y[1],Q=a.a.useState(),ee=Object(s.a)(Q,2),te=ee[0],ne=ee[1],re=a.a.useState(!0),ae=Object(s.a)(re,2),ie=ae[0],ce=ae[1],se=a.a.useState(!1),oe=Object(s.a)(se,2),le=oe[0],ue=oe[1],de=a.a.useState(!1),pe=Object(s.a)(de,2),je=pe[0],be=pe[1],Oe=a.a.useState(!1),fe=Object(s.a)(Oe,2),he=fe[0],ve=fe[1],me=a.a.useState(!1),Ee=Object(s.a)(me,2),xe=Ee[0],ye=Ee[1];Object(j.n)();Object(r.useEffect)((function(){var e=function(){var e=Object(m.a)(Object(h.a)().mark((function e(){return Object(h.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fetch("/api/supplier/getData").then((function(e){return e.json()})).then((function(e){console.log("GetData Response",e);var t=Re(Object(v.a)(e));return c(t),p(e),e})).then((function(e){var t=[],n=[],r=[],a=[],i=[];e.forEach((function(e){Te(e,"supplier_db.product_offerings",n),Te(e,"supplier_db.customer_categories",t),Te(e,"supplier_db.market_scopes",r),Te(e,"supplier_db.availability",a),Te(e,"supplier_db.certifications",i)})),T(n),F(t),w(r),H(a),G(i)})).then((function(e){ce(!1),ye(!0)})).catch((function(e){return ce(!1)}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e(),ne(1)}),[]);var Re=function(e){for(var t,n=e.length;n>0;){t=Math.floor(Math.random()*n),n--;var r=[e[t],e[n]];e[n]=r[0],e[t]=r[1]}return e},ge=Object(r.useMemo)((function(){if(console.log(te),!te)return[];var e=16*(te-1),t=e+16;return null===i||void 0===i?void 0:i.slice(e,t)}),[te,i]),Te=function(e,t,n){var r=e[t];null===r||void 0===r||r.split(", ").map((function(e){" "!=e&&(n.includes(Object(y.trim)(e))||n.push(Object(y.trim)(e)))}))};Object(r.useEffect)((function(){if(xe&&K){Object(v.a)(d);var e=Object(f.a)({},K);console.log(e),console.log([]);var t=[];Object.keys(K).map((function(e){K[e].length>0&&K[e].map((function(n){t.push("matches_filter(${"+e+"}, `%"+n+"%`)")}))})),console.log(K),console.log(t),fetch("/api/supplier/run_query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filter:t.join(" AND "),type:"json"})}).then((function(e){return e.json()})).then((function(e){var t=Re(e);c(t)})).then((function(e){return ne(1)})).then((function(e){return ue(!1)}))}}),[K]);var _e=function(e,t){var n=new Blob([e],{type:"csv"}),r=document.createElement("a");r.download=t,r.href=window.URL.createObjectURL(n);var a=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});r.dispatchEvent(a),r.remove()},Ce=function(){ve(!he)};return Object(o.jsxs)(o.Fragment,{children:[Object(o.jsx)(J.a,{open:ie,className:"load-backdrop",children:Object(o.jsx)("div",{className:"loader"})}),Object(o.jsxs)(x.a,{style:{alignItems:"flex-start"},children:[Object(o.jsxs)(O.a,{style:{width:"100%"},children:[Object(o.jsxs)(x.a,{className:"data-details",children:[Object(o.jsxs)("h3",{className:"page-statistics",children:["Showing ",i.length," results"]}),Object(o.jsx)(Z.a,{style:{fontFamily:"Poppins"},color:"primary",variant:"contained",onClick:function(){var e=[];Object.keys(K).map((function(t){K[t].length>0&&K[t].map((function(n){e.push("matches_filter(${"+t+"}, `%"+n+"%`)")}))})),be(!0),fetch("/api/supplier/run_query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filter:e.join(" AND "),type:"csv"})}).then((function(e){return e.json()})).then((function(e){return _e(e,"supplier_db.csv")})).then((function(e){return be(!1)}))},href:"#",children:"Download data"}),Object(o.jsx)(Z.a,{style:{fontFamily:"Poppins"},color:"primary",variant:"contained",className:"show-filter-button",onClick:Ce,href:"#",children:"Show Filters"}),je?Object(o.jsx)("div",{className:"loader relative-position"}):""]}),le?Object(o.jsx)("div",{className:"data-loading-backdrop",children:Object(o.jsx)("div",{className:"loader"})}):Object(o.jsx)(o.Fragment,{children:Object(o.jsx)("div",{className:"grid-card-layout",children:null===ge||void 0===ge?void 0:ge.map((function(e){return Object(o.jsx)(k,{dataRow:e,offerings:g})}))})})]}),Object(o.jsxs)(O.a,{style:{width:"300px"},className:he?"filter-section active":"filter-section",children:[Object(o.jsxs)(x.a,{children:[Object(o.jsx)("h3",{children:"Filter By"}),Object(o.jsx)(q.a,{onClick:Ce,className:"mobile-button-exit",color:"primary",children:Object(o.jsx)(X.a,{style:{color:"black",width:"20px"}})})]}),Object(o.jsx)(z,{data:i,offerings:g,customerCategories:N,marketScopes:S,availabilities:P,certifications:B,currentFilter:K,setCurrentFilter:$})]})]}),Object(o.jsx)(L,{className:"pagination-bar",currentPage:te,totalCount:i.length,pageSize:16,onPageChange:function(e){return ne(e)}})]})};!function(e){e.APP_HOME="/",e.APP_HOME_PARAMS="/:params",e.CONFIG_ROUTE="/config"}(u||(u={}));var Q=function(e){e.route,e.routeState;return Object(o.jsx)(p.a,{children:Object(o.jsx)(j.c,{children:Object(o.jsx)(j.a,{path:u.APP_HOME,element:Object(o.jsx)($,{})})})})},ee=(Object(b.c)(O.a)(l||(l=Object(d.a)(["\n display: grid;\n grid-gap: 20px;\n grid-template-columns: 200px auto;\n width: 100vw;\n"]))),n(470)),te=function(){return Object(o.jsx)("div",{className:"App",children:Object(o.jsx)("header",{className:"App-header",children:Object(o.jsx)(ee.a,{loadGoogleFonts:!0,children:Object(o.jsx)(Q,{})})})})},ne=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,478)).then((function(t){var n=t.getCLS,r=t.getFID,a=t.getFCP,i=t.getLCP,c=t.getTTFB;n(e),r(e),a(e),i(e),c(e)}))};c.a.render(Object(o.jsx)(a.a.StrictMode,{children:Object(o.jsx)(te,{})}),document.getElementById("root")),ne()}},[[430,1,2]]]); //# sourceMappingURL=main.bc710f9c.chunk.js.map