-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent---src-pages-account-store-js-81c12622c86c286338a9.js.map
1 lines (1 loc) · 24.9 KB
/
component---src-pages-account-store-js-81c12622c86c286338a9.js.map
1
{"version":3,"sources":["webpack:///./src/pages/account/manageProduct2.js","webpack:///./node_modules/grommet-icons/es6/icons/Cluster.js","webpack:///./src/pages/account/mystore.js","webpack:///./src/library/store.js","webpack:///./src/components/DataGrid/index.js","webpack:///./src/components/Forms/Product.js","webpack:///./src/pages/account/manageProduct.js","webpack:///./src/pages/account/store.js","webpack:///./src/pages/account/editstore.js"],"names":["App","id","configureCol","property","headerText","primaryKey","render","data","type","ReactHtmlParser","description","bidEndAt","format","parseISO","iso","available","startBid","photo","href","url","suffix","objectClass","columns","query","q","fetchData","action","params","storeId","f","v","_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","props","createElement","StyledIcon","viewBox","a11yTitle","fill","stroke","strokeWidth","d","whatsapp","onClick","navigate","objectId","_userContext","React","useContext","UserContext","useState","datasource","setDatasource","useEffect","storeRoles","roleObjects","filter","ro","get","includes","map","getStoreByRole","then","ds","DataGrid","width","afterAction","refresh","limit","searchObject","ascending","role","c","t","Component","onConfigure","onDelete","DataTable","header","Text","primary","datum","Configure","style","cursor","Close","formModal","onModal","mode","onUpdate","modal","setModal","checked","setChecked","setProductImage","textInputProps","modalObject","value","onChange","event","onDrop","useCallback","acceptedFiles","file","Parse","File","name","save","parseFile","uploadFile","useDropzone","getRootProps","getInputProps","isDragActive","Box","Heading","level","height","Image","fit","src","Button","label","TextInput","placeholder","direction","CheckBox","Store","extend","setformModal","activeStore","editModal","setEditModal","showModal","setShowModal","store","setStore","myProducts","setMyProducts","productFormMode","setProductFormMode","a","findMyStore","stores","find","e","run","findProduct","loadProduct","justify","align","alignContent","gap","plain","Anchor","toJSON","Modal","onClose","Product","keyToSend","cloneJSONKey","createOneProduct","updateOneProduct","productId","deleteOneProduct","setTimeout","r","basepath","path"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D,CAAKkD,MAAM,GACT,kBAAC,SAAD,CAAQiI,SAAS,kBACf,kBAAC,UAAD,CAAWC,KAAK,mBAChB,kBAAC,UAAD,CAASA,KAAK,MACd,kBAAC,UAAD,CAAoBA,KAAK,uBACzB,kBAAC,UAAD,CAAqBA,KAAK,4B,kCCflC,iEA8BepL,UA1BH,WACV,IAAME,EAAe,CACnB,CACEC,SAAU,OACVC,WAAY,QAEd,CACED,SAAU,cACVC,WAAY,cACZI,KAAM,WACNF,OAAQ,SAACC,GAAD,OAAU,wCAAIE,IAAgBF,EAAKG,aAAzB,QAGtB,OACE,oCACE,kBAAC,IAAD,CACEW,YAAY,QACZC,QAASpB,EACTqB,MAAO,SAACC,GAAD,OAAOA,GACdC,UAAW,CACTC,OAAQ","file":"component---src-pages-account-store-js-81c12622c86c286338a9.js","sourcesContent":["import React from \"react\";\nimport DataGrid from \"../../containers/DataGrid\";\nimport ReactHtmlParser from \"react-html-parser\";\nimport { Anchor } from \"grommet\";\nimport { format, parseISO } from \"date-fns\";\n\nconst App = ({ id }) => {\n const configureCol = [\n {\n property: \"objectId\",\n headerText: \"\",\n primaryKey: true,\n render: (data) => <> </>,\n },\n {\n property: \"name\",\n headerText: \"Name\",\n },\n {\n property: \"Description\",\n headerText: \"Info\",\n type: \"Textarea\",\n render: (data) => <> {ReactHtmlParser(data.description)} </>,\n },\n {\n property: \"bidEndAt\",\n headerText: \"BidEnd\",\n type: \"DateTimePicker\",\n render: (data) => (\n <>\n {\" \"}\n {data.bidEndAt\n ? format(parseISO(data.bidEndAt.iso), \"yyyy MMM dd HH:mm:s\")\n : \"Not Set\"}{\" \"}\n </>\n ),\n },\n {\n property: \"available\",\n headerText: \"Show\",\n type: \"CheckBox\",\n render: (data) => <> {data.available ? \"Yes\" : \"No\"} </>,\n },\n {\n property: \"startBid\",\n headerText: \"startBid\",\n render: (data) => <> {data.startBid} </>,\n },\n {\n headerText: \"Image\",\n render: (data) => (\n <>\n {\" \"}\n {data.photo ? (\n <Anchor href={data.photo.url}> View </Anchor>\n ) : (\n \"Empty\"\n )}{\" \"}\n </>\n ),\n },\n ];\n return (\n <>\n <DataGrid\n suffix=\"\"\n objectClass=\"Product\"\n columns={configureCol}\n query={(q) => q}\n fetchData={{\n action: \"searchProduct\",\n params: {\n query: {\n storeId: {\n f: \"equalTo\",\n v: id,\n },\n },\n },\n }}\n />\n </>\n );\n};\nexport default App;\n","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nimport React from 'react';\nimport { StyledIcon } from '../StyledIcon';\nexport var Cluster = function Cluster(props) {\n return /*#__PURE__*/React.createElement(StyledIcon, _extends({\n viewBox: \"0 0 24 24\",\n a11yTitle: \"Cluster\"\n }, props), /*#__PURE__*/React.createElement(\"path\", {\n fill: \"none\",\n stroke: \"#000\",\n strokeWidth: \"2\",\n 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\"\n }));\n};","import React, { useState, useEffect } from \"react\";\nimport DataGrid from \"../../containers/DataGrid\";\nimport ReactHtmlParser from \"react-html-parser\";\nimport { Cluster } from \"grommet-icons\";\nimport Parse from \"../../library/parse\";\nimport { getStoreByRole } from \"../../library/store\";\n\nimport UserContext from \"../../context/UserContext\";\nimport { navigate } from \"gatsby\";\nconst configureCol = [\n {\n property: \"name\",\n headerText: \"Name\",\n },\n {\n property: \"description\",\n headerText: \"Info\",\n type: \"Textarea\",\n render: (data) => <> {ReactHtmlParser(data.description)} </>,\n },\n {\n property: \"whatsapp\",\n headerText: \"Whatsapp\",\n render: (data) => <> {ReactHtmlParser(data.whatsapp)} </>,\n },\n {\n property: \"objectId\",\n headerText: \"Product\",\n render: (data) => (\n <>\n <Cluster\n onClick={() => {\n navigate(`/account/store/manageproduct2/${data.objectId}`);\n }}\n />\n </>\n ),\n },\n];\n\nconst App = () => {\n const _userContext = React.useContext(UserContext);\n const [datasource, setDatasource] = useState([]);\n\n useEffect(() => {\n const storeRoles =\n (_userContext &&\n _userContext.roleObjects\n .filter((ro) => ro.get(\"name\").includes(\"Store-\"))\n .map((ro) => ro.id)) ||\n [];\n if (storeRoles && storeRoles.length) {\n getStoreByRole(storeRoles, 999).then((ds) => {\n setDatasource(ds);\n });\n }\n }, [_userContext]);\n return (\n <>\n <DataGrid\n width=\"100%\"\n objectClass=\"Store\"\n columns={configureCol}\n query={(q) => q}\n datasource={datasource}\n afterAction={() => _userContext.refresh()}\n />\n </>\n );\n};\nexport default App;\n","import React, { useEffect, useState } from \"react\";\nimport { searchObject } from \"./parse\";\n\nexport const getStoreByRole = (storeRoles = [], limit = 1) => {\n return searchObject(\"Store\", {\n ascending: \"createdAt\",\n role: {\n c: \"_Role\",\n f: \"containedIn\",\n v: storeRoles,\n t: \"pointer\",\n },\n });\n};\n","import React from \"react\";\nimport { DataTable, Text } from \"grommet\";\nimport { Close, Configure } from \"grommet-icons\";\nconst Component = ({ data, onConfigure, onDelete }) => {\n return (\n <>\n <DataTable\n columns={[\n {\n property: \"name\",\n header: <Text>Name</Text>,\n primary: true,\n },\n {\n property: \"description\",\n header: <Text>Description</Text>,\n },\n {\n property: \"startBid\",\n header: <Text>Start Bid</Text>,\n },\n {\n property: \"instantClosePrice\",\n header: <Text>Instant Close Price</Text>,\n },\n {\n property: \"Status\",\n header: <Text>Status</Text>,\n },\n {\n property: \"available\",\n header: <Text>Display</Text>,\n },\n {\n property: \"\",\n header: <Text>Action</Text>,\n render: (datum) => (\n <>\n <Configure\n onClick={() => onConfigure && onConfigure(datum)}\n style={{ cursor: \"pointer\" }}\n />\n <Close\n onClick={() => onDelete && onDelete(datum)}\n style={{ cursor: \"pointer\" }}\n />\n </>\n ),\n },\n ]}\n data={data}\n />\n </>\n );\n};\n\nexport default Component;\n","import React, { useState, useCallback } from \"react\";\nimport { Box, Button, TextInput, Heading, Image, CheckBox } from \"grommet\";\nimport { useDropzone } from \"react-dropzone\";\nimport Parse from \"../../library/parse\";\nconst Component = ({\n formModal,\n onModal,\n mode = \"create\",\n onDelete,\n onUpdate,\n}) => {\n const [modal, setModal] = useState(formModal);\n const [checked, setChecked] = React.useState(true);\n const [, setProductImage] = useState(null);\n\n const textInputProps = (key, modalObject) => ({\n value: modalObject[key],\n onChange: (event) =>\n setModal({\n ...modalObject,\n [key]: event.target.value,\n }),\n });\n\n const onDrop = useCallback(\n (acceptedFiles) => {\n const uploadFile = (file) => {\n var parseFile = new Parse.File(file.name, file);\n parseFile.save().then(function (parseFile) {\n setProductImage(parseFile.url());\n setModal({\n ...modal,\n photo: parseFile,\n available: !!checked,\n });\n });\n };\n const file = acceptedFiles && acceptedFiles[0];\n uploadFile(file);\n },\n [modal, checked]\n );\n const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop });\n\n return (\n <Box>\n {mode === \"delete\" && (\n <>\n <Heading level={2}>Are you sure?</Heading>\n {modal && modal.photo && modal.photo.url && (\n <Box height=\"small\" width=\"small\">\n <Image fit=\"cover\" src={modal.photo.url} />\n </Box>\n )}\n <Button\n label=\"delete\"\n onClick={() => {\n onModal &&\n onModal(mode, {\n ...modal,\n available: !!checked,\n });\n }}\n />\n </>\n )}\n {[\"create\", \"update\"].includes(mode) && (\n <>\n <Heading level={3}>Upload Product</Heading>\n <TextInput\n placeholder=\"Product Name\"\n {...textInputProps(\"name\", modal)}\n />\n <Box direction=\"row\">\n <div {...getRootProps()}>\n <input {...getInputProps()} />\n {modal && modal.photo && modal.photo.url && (\n <Box height=\"small\" width=\"small\">\n <Image fit=\"cover\" src={modal.photo.url} />\n </Box>\n )}\n {isDragActive ? (\n <p>Drop the files here ...</p>\n ) : (\n <p>Drag 'n' drop some files here, or click to select files</p>\n )}\n </div>\n </Box>\n <TextInput\n {...textInputProps(\"startBid\", modal)}\n placeholder=\"Start Bid\"\n />\n <TextInput\n {...textInputProps(\"instantClosePrice\", modal)}\n placeholder=\"Instant Close\"\n />\n <CheckBox\n checked={checked}\n label=\"Display On Store\"\n onChange={(event) => {\n setChecked(event.target.checked);\n }}\n />\n <Button\n label={mode}\n onClick={() =>\n onModal &&\n onModal(mode, {\n ...modal,\n available: !!checked,\n })\n }\n />\n </>\n )}\n </Box>\n );\n};\n\nexport default Component;\n","import React, { useEffect, useState } from \"react\";\nimport { Box, TextInput, Anchor } from \"grommet\";\nimport ProductGrid from \"../../components/DataGrid\";\nimport ProductForm from \"../../components/Forms/Product\";\nimport Modal from \"../../components/Modal\";\nimport {\n findMyStore,\n findProduct,\n deleteOneProduct,\n updateOneProduct,\n createOneProduct,\n} from \"../../library/parse\";\nimport { cloneJSONKey } from \"../../helpers\";\nimport Parse from \"../../library/parse\";\n\nconst App = ({ id }) => {\n const Store = Parse && Parse.Object && Parse.Object.extend(\"Store\");\n const [formModal, setformModal] = useState({});\n const [activeStore] = useState(Store && new Store());\n const [editModal, setEditModal] = useState({});\n const [showModal, setShowModal] = useState(false);\n const [store, setStore] = useState(null);\n const [myProducts, setMyProducts] = useState([]);\n const [productFormMode, setProductFormMode] = useState(\"create\");\n\n useEffect(() => {\n const run = async () => {\n const stores = await findMyStore();\n setStore(stores.find((e) => e.id === id));\n };\n run();\n }, [id]);\n\n useEffect(() => {\n if (store) {\n setEditModal({\n name: store.get(\"name\"),\n });\n const loadProduct = async () => {\n setMyProducts(await findProduct(store));\n };\n loadProduct();\n }\n }, [store]);\n return (\n <>\n <Box fill={true} justify=\"center\" align=\"center\" alignContent=\"center\">\n {\n <>\n <Box fill={true} gap=\"small\" direction=\"row\">\n <TextInput\n plain={false}\n placeholder=\"choose a store name\"\n value={editModal.name}\n onChange={(event) => {\n setEditModal({\n ...editModal,\n objectId: activeStore && activeStore.id,\n name: event.target.value,\n });\n }}\n />\n <Anchor onClick={() => setShowModal(true)}>\n Change Store Name\n </Anchor>\n <Anchor\n onClick={() => {\n setProductFormMode(\"create\");\n setformModal({});\n setShowModal(true);\n }}\n >\n Add Product\n </Anchor>\n </Box>\n <Box fill={true}>\n <ProductGrid\n data={myProducts ? myProducts.map((e) => e.toJSON()) : []}\n onConfigure={(modal) => {\n setProductFormMode(\"update\");\n setformModal(modal);\n setShowModal(true);\n }}\n onDelete={(modal) => {\n setProductFormMode(\"delete\");\n setformModal(modal);\n setShowModal(true);\n }}\n />\n </Box>\n </>\n }\n </Box>\n {showModal && (\n <Modal onClose={() => setShowModal(false)}>\n <ProductForm\n mode={productFormMode}\n formModal={formModal}\n onModal={async (action, modal) => {\n const keyToSend = [\n \"name\",\n \"photo\",\n \"startBid\",\n \"instantClosePrice\",\n \"objectId\",\n \"available\",\n ];\n const storeId = store.id;\n modal = cloneJSONKey(modal, keyToSend);\n\n if (action === \"create\") {\n await createOneProduct(modal, store.id);\n }\n if (action === \"update\") {\n await updateOneProduct({\n ...modal,\n productId: modal.objectId,\n storeId,\n });\n }\n if (action === \"delete\") {\n await deleteOneProduct({\n productId: modal.objectId,\n storeId,\n });\n }\n setTimeout(\n () =>\n findProduct(store).then((r) => {\n setMyProducts(r);\n setShowModal(false);\n }),\n 1000\n );\n }}\n onClose={() => setShowModal(false)}\n />\n </Modal>\n )}\n </>\n );\n};\nexport default App;\n","import React from \"react\";\nimport { Router } from \"@reach/router\";\nimport MyStore from \"./mystore\";\nimport EditStore from \"./editstore\";\nimport ManageStoreProduct from \"./manageProduct\";\nimport ManageStoreProduct2 from \"./manageProduct2\";\nimport { Box } from \"grommet\";\n\nconst App = () => {\n return (\n <Box fill={true}>\n <Router basepath=\"/account/store\">\n <EditStore path=\"/editstore/:id\" />\n <MyStore path=\"/\" />\n <ManageStoreProduct path=\"/manageproduct/:id\" />\n <ManageStoreProduct2 path=\"/manageproduct2/:id\" />\n </Router>\n </Box>\n );\n};\nexport default App;\n","import React from \"react\";\nimport DataGrid from \"../../containers/DataGrid\";\nimport ReactHtmlParser from \"react-html-parser\";\n\nconst App = () => {\n const configureCol = [\n {\n property: \"name\",\n headerText: \"Name\",\n },\n {\n property: \"description\",\n headerText: \"Description\",\n type: \"Textarea\",\n render: (data) => <> {ReactHtmlParser(data.description)} </>,\n },\n ];\n return (\n <>\n <DataGrid\n objectClass=\"Store\"\n columns={configureCol}\n query={(q) => q}\n fetchData={{\n action: \"findStore\",\n }}\n />\n </>\n );\n};\nexport default App;\n"],"sourceRoot":""}