1 line
68 KiB
JSON
1 line
68 KiB
JSON
|
{"ast":null,"code":"import _objectSpread from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\n\nvar _this = this,\n _jsxFileName = \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/src/pages/Crud.js\";\n\nimport React, { useState, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport { DataTable } from 'primereact/datatable';\nimport { Column } from 'primereact/column';\nimport { Toast } from 'primereact/toast';\nimport { Button } from 'primereact/button';\nimport { FileUpload } from 'primereact/fileupload';\nimport { Rating } from 'primereact/rating';\nimport { Toolbar } from 'primereact/toolbar';\nimport { InputTextarea } from 'primereact/inputtextarea';\nimport { RadioButton } from 'primereact/radiobutton';\nimport { InputNumber } from 'primereact/inputnumber';\nimport { Dialog } from 'primereact/dialog';\nimport { InputText } from 'primereact/inputtext';\nimport { ProductService } from '../service/ProductService';\n\nvar Crud = function Crud() {\n var emptyProduct = {\n id: null,\n name: '',\n image: null,\n description: '',\n category: null,\n price: 0,\n quantity: 0,\n rating: 0,\n inventoryStatus: 'INSTOCK'\n };\n\n var _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n products = _useState2[0],\n setProducts = _useState2[1];\n\n var _useState3 = useState(false),\n _useState4 = _slicedToArray(_useState3, 2),\n productDialog = _useState4[0],\n setProductDialog = _useState4[1];\n\n var _useState5 = useState(false),\n _useState6 = _slicedToArray(_useState5, 2),\n deleteProductDialog = _useState6[0],\n setDeleteProductDialog = _useState6[1];\n\n var _useState7 = useState(false),\n _useState8 = _slicedToArray(_useState7, 2),\n deleteProductsDialog = _useState8[0],\n setDeleteProductsDialog = _useState8[1];\n\n var _useState9 = useState(emptyProduct),\n _useState10 = _slicedToArray(_useState9, 2),\n product = _useState10[0],\n setProduct = _useState10[1];\n\n var _useState11 = useState(null),\n _useState12 = _slicedToArray(_useState11, 2),\n selectedProducts = _useState12[0],\n setSelectedProducts = _useState12[1];\n\n var _useState13 = useState(false),\n _useState14 = _slicedToArray(_useState13, 2),\n submitted = _useState14[0],\n setSubmitted = _useState14[1];\n\n var _useState15 = useState(null),\n _useState16 = _slicedToArray(_useState15, 2),\n globalFilter = _useState16[0],\n setGlobalFilter = _useState16[1];\n\n var toast = useRef(null);\n var dt = useRef(null);\n useEffect(function () {\n var productService = new ProductService();\n productService.getProducts().then(function (data) {\n return setProducts(data);\n });\n }, []);\n\n var formatCurrency = function formatCurrency(value) {\n return value.toLocaleString('en-US', {\n style: 'currency',\n currency: 'USD'\n });\n };\n\n var openNew = function openNew() {\n setProduct(emptyProduct);\n setSubmitted(false);\n setProductDialog(true);\n };\n\n var hideDialog = function hideDialog() {\n setSubmitted(false);\n setProductDialog(false);\n };\n\n var hideDeleteProductDialog = function hideDeleteProductDialog() {\n setDeleteProductDialog(false);\n };\n\n var hideDeleteProductsDialog = function hideDeleteProductsDialog() {\n setDeleteProductsDialog(false);\n };\n\n var saveProduct = function saveProduct() {\n setSubmitted(true);\n\n if (product.name.t
|