-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintcache
1 lines (1 loc) · 63.8 KB
/
.eslintcache
1
[{"C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\client\\Client.jsx":"1","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\order\\Order.jsx":"2","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\Sale.jsx":"3","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\payment\\Payment.jsx":"4","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\payment\\Payments.jsx":"5","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\TableItem.jsx":"6","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\order\\Items.jsx":"7","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\TabItem.jsx":"8","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\AutomaticTabPanel.jsx":"9","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\ManualTabPanel.jsx":"10","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\client\\Client.jsx":"11","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\Sale.jsx":"12","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\order\\Order.jsx":"13","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\Payment.jsx":"14","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\Payments.jsx":"15","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\TableItem.jsx":"16","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\TabItem.jsx":"17","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\order\\Items.jsx":"18","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\AutomaticTabPanel.jsx":"19","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\ManualTabPanel.jsx":"20","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\auth\\Login.jsx":"21","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\auth\\FormLogin.jsx":"22","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\category\\Category.jsx":"23","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\validators\\Validator.jsx":"24","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\supplier\\Supplier.jsx":"25","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\product\\Product.jsx":"26","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\index.jsx":"27","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\report\\Report.jsx":"28","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\report\\OnProducts.jsx":"29","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\report\\OnClients.jsx":"30","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\context\\AuthContext.js":"31","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\PaymentPanel.jsx":"32","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\OrdersTable.jsx":"33","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\services\\Api.js":"34","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\Localization.js":"35","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\App.jsx":"36","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\error\\NotFoundPage.jsx":"37","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\styles.js":"38","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\order\\styles.js":"39","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\ErrorBoundary.jsx":"40","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\Dashboard.jsx":"41","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\styles.js":"42","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\ListItems.jsx":"43","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\Routes.jsx":"44","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\NavBar.jsx":"45"},{"size":7793,"mtime":1610289557941,"results":"46","hashOfConfig":"47"},{"size":3973,"mtime":1610289699415,"results":"48","hashOfConfig":"47"},{"size":3766,"mtime":1605722136590,"results":"49","hashOfConfig":"47"},{"size":5047,"mtime":1610289897164,"results":"50","hashOfConfig":"47"},{"size":3218,"mtime":1610321007322,"results":"51","hashOfConfig":"47"},{"size":2712,"mtime":1602617740314,"results":"52","hashOfConfig":"47"},{"size":3248,"mtime":1605722827848,"results":"53","hashOfConfig":"47"},{"size":1271,"mtime":1602004892056,"results":"54","hashOfConfig":"47"},{"size":5285,"mtime":1605723144287,"results":"55","hashOfConfig":"47"},{"size":6650,"mtime":1605723093451,"results":"56","hashOfConfig":"47"},{"size":6134,"mtime":1614881158230,"results":"57","hashOfConfig":"58"},{"size":3803,"mtime":1614881327463,"results":"59","hashOfConfig":"58"},{"size":2938,"mtime":1614881252192,"results":"60","hashOfConfig":"58"},{"size":613,"mtime":1615679764828,"results":"61","hashOfConfig":"58"},{"size":2193,"mtime":1614881274393,"results":"62","hashOfConfig":"58"},{"size":2707,"mtime":1614881339535,"results":"63","hashOfConfig":"58"},{"size":1274,"mtime":1614881334039,"results":"64","hashOfConfig":"58"},{"size":2511,"mtime":1615761725159,"results":"65","hashOfConfig":"58"},{"size":5363,"mtime":1614881312824,"results":"66","hashOfConfig":"58"},{"size":6486,"mtime":1614881319909,"results":"67","hashOfConfig":"58"},{"size":1566,"mtime":1615058387085,"results":"68","hashOfConfig":"58"},{"size":2756,"mtime":1614106186874,"results":"69","hashOfConfig":"58"},{"size":5038,"mtime":1614881106438,"results":"70","hashOfConfig":"58"},{"size":913,"mtime":1612288868353,"results":"71","hashOfConfig":"58"},{"size":5482,"mtime":1614881349903,"results":"72","hashOfConfig":"58"},{"size":8945,"mtime":1614881282149,"results":"73","hashOfConfig":"58"},{"size":392,"mtime":1615058773495,"results":"74","hashOfConfig":"58"},{"size":1375,"mtime":1614881303981,"results":"75","hashOfConfig":"58"},{"size":3327,"mtime":1615762786402,"results":"76","hashOfConfig":"58"},{"size":4080,"mtime":1615763121552,"results":"77","hashOfConfig":"58"},{"size":480,"mtime":1614887857813,"results":"78","hashOfConfig":"79"},{"size":4464,"mtime":1615679755721,"results":"80","hashOfConfig":"58"},{"size":3482,"mtime":1614191868301,"results":"81","hashOfConfig":"58"},{"size":2505,"mtime":1614882061053,"results":"82","hashOfConfig":"58"},{"size":1548,"mtime":1614878925892,"results":"83","hashOfConfig":"58"},{"size":512,"mtime":1615761990255,"results":"84","hashOfConfig":"58"},{"size":446,"mtime":1615678218974,"results":"85","hashOfConfig":"58"},{"size":597,"mtime":1615761244860,"results":"86","hashOfConfig":"58"},{"size":701,"mtime":1615762651901,"results":"87","hashOfConfig":"58"},{"size":946,"mtime":1615762464542,"results":"88","hashOfConfig":"58"},{"size":4452,"mtime":1615762036639,"results":"89","hashOfConfig":"58"},{"size":2452,"mtime":1615761882655,"results":"90","hashOfConfig":"58"},{"size":3095,"mtime":1615761945387,"results":"91","hashOfConfig":"58"},{"size":1452,"mtime":1615762309480,"results":"92","hashOfConfig":"58"},{"size":1504,"mtime":1615762340796,"results":"93","hashOfConfig":"58"},{"filePath":"94","messages":"95","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"96","usedDeprecatedRules":"97"},"iafhjt",{"filePath":"98","messages":"99","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"100","usedDeprecatedRules":"97"},{"filePath":"101","messages":"102","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"103","usedDeprecatedRules":"97"},{"filePath":"104","messages":"105","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"106","usedDeprecatedRules":"97"},{"filePath":"107","messages":"108","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"109","usedDeprecatedRules":"97"},{"filePath":"110","messages":"111","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"112","usedDeprecatedRules":"97"},{"filePath":"113","messages":"114","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"115","usedDeprecatedRules":"97"},{"filePath":"116","messages":"117","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"118","usedDeprecatedRules":"97"},{"filePath":"119","messages":"120","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"121","usedDeprecatedRules":"122"},{"filePath":"123","messages":"124","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"125","usedDeprecatedRules":"97"},{"filePath":"126","messages":"127","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},"1fqpc1a",{"filePath":"129","messages":"130","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"131","messages":"132","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"133","messages":"134","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"135","messages":"136","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"137","messages":"138","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"139","messages":"140","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"141","messages":"142","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"143","messages":"144","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"145","messages":"146","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"147","messages":"148","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"149","messages":"150","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"151","messages":"152","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"153","messages":"154","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"155","messages":"156","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"157","messages":"158","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"159","messages":"160","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"161","messages":"162","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"163","messages":"164","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"165","messages":"166","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"167","messages":"168","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1heku9p",{"filePath":"169","messages":"170","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"171","messages":"172","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"173","messages":"174","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"175","messages":"176","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"177","messages":"178","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"179","messages":"180","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"181","messages":"182","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"128"},{"filePath":"183","messages":"184","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"185","messages":"186","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"187","messages":"188","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"189","messages":"190","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"191","messages":"192","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"193","messages":"194","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"195","messages":"196","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\client\\Client.jsx",["197"],"import React, { useState } from 'react';\r\nimport MaterialTable from 'material-table';\r\nimport Alert from '@material-ui/lab/Alert';\r\nimport AddShoppingCartIcon from '@material-ui/icons/AddShoppingCart';\r\nimport PaymentIcon from '@material-ui/icons/Payment';\r\n\r\nconst baseURL = \"https://estoquapp.herokuapp.com/api/Client\";\r\n\r\nconst isOk = (response) => {\r\n if (response !== null && response.ok) {\r\n return response;\r\n } else {\r\n throw Error(response.status);\r\n }\r\n}\r\n\r\nconst columns =\r\n [\r\n { title: \"id\", field: \"id\", hidden: true },\r\n {\r\n title: 'Nome', field: 'name', type: 'string',\r\n validate: (rowData) => ((rowData.name != null && rowData.name.length >= 10 && rowData.name.length <= 50)\r\n ? true : '⚠️ Nome deve ter entre 10 e 50 caracteres.')\r\n },\r\n {\r\n title: 'Endereço', field: 'address', type: 'string',\r\n validate: rowData => ((rowData.address != null && rowData.address.length >= 10 && rowData.address.length <= 100)\r\n ? true : '⚠️ Endereço deve ter entre 10 e 100 caracteres.')\r\n },\r\n {\r\n title: 'Telefone', field: 'phoneNumber', type: 'string',\r\n validate: rowData => ((rowData.phoneNumber != null && rowData.phoneNumber.length === 11)\r\n ? true : '⚠️ Número de telefone deve ter 11 dígitos.')\r\n },\r\n {\r\n title: 'Status', field: 'status', lookup: { 0: 'Inativo', 1: 'Ativo' }, editable: 'never'\r\n },\r\n {\r\n title: 'Débito', field: 'debt', type: 'currency', editable: 'never'\r\n },\r\n {\r\n title: 'Última compra', field: 'lastPurchase', type: 'date', editable: 'never'\r\n },\r\n ];\r\n\r\nconst localization = {\r\n body: {\r\n emptyDataSourceMessage: 'Nenhum registro para exibir',\r\n addTooltip: 'Adicionar',\r\n deleteTooltip: 'Apagar',\r\n editTooltip: 'Editar',\r\n editRow: {\r\n deleteText: 'Voulez-vous supprimer cette ligne?',\r\n cancelTooltip: 'Cancelar',\r\n saveTooltip: 'Salvar'\r\n }\r\n },\r\n toolbar: {\r\n searchTooltip: 'Pesquisar',\r\n searchPlaceholder: 'Pesquisar',\r\n exportTitle: 'Exportar',\r\n exportAriaLabel: 'Exportar',\r\n },\r\n pagination: {\r\n labelRowsSelect: 'linhas',\r\n labelDisplayedRows: '{count} de {from}-{to}',\r\n firstTooltip: 'Primeira página',\r\n previousTooltip: 'Página anterior',\r\n nextTooltip: 'Próxima página',\r\n lastTooltip: 'Última página'\r\n },\r\n header: {\r\n actions: 'Ações'\r\n }\r\n}\r\nconst operations = (query, data) => {\r\n //Searching\r\n data = data.filter(p =>\r\n p.name.toLowerCase().includes(query.search.toLowerCase()) ||\r\n p.address.toLowerCase().includes(query.search.toLowerCase()) ||\r\n p.phoneNumber.includes(query.search) ||\r\n p.debt.toString().includes(query.search)\r\n )\r\n //Sorting \r\n if (query.orderBy != null) {\r\n let orderBy = query.orderBy.field;\r\n data.sort(function (a, b) {\r\n if (b[orderBy] < a[orderBy]) {\r\n return -1;\r\n }\r\n if (b[orderBy] > a[orderBy]) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n }\r\n return data;\r\n};\r\n\r\nexport default function Client(props) {\r\n const [data, setData] = useState([]);\r\n const [errorMessages, setErrorMessages] = useState('');\r\n const [iserror, setIserror] = useState(false);\r\n\r\n\r\n const handleRowAdd = (newData, resolve) => {\r\n fetch(baseURL, {\r\n method: 'Post',\r\n headers: { 'Content-type': 'application/json' },\r\n body: JSON.stringify(newData)\r\n })\r\n .then(res => isOk(res))\r\n .then(response => response.json())\r\n .then(product => {\r\n let dataToAdd = [...data];\r\n dataToAdd.push(product);\r\n setData(dataToAdd);\r\n resolve()\r\n setErrorMessages([])\r\n setIserror(false)\r\n })\r\n .catch(error => {\r\n setErrorMessages(`Não foi possível enviar os dados ao servidor. ${error}`)\r\n setIserror(true)\r\n resolve()\r\n })\r\n }\r\n\r\n const handleRowUpdate = (newData, oldData, resolve) => {\r\n newData.status = Number(newData.status);\r\n fetch(baseURL,\r\n {\r\n method: 'Put',\r\n headers: { 'Content-type': 'application/json' },\r\n body: JSON.stringify(newData)\r\n })\r\n .then(res => isOk(res))\r\n .then(response => response.json())\r\n .then(product => {\r\n const dataUpdate = [...data];\r\n const index = oldData.tableData.id;\r\n dataUpdate[index] = product;\r\n setData([...dataUpdate]);\r\n resolve()\r\n setIserror(false)\r\n setErrorMessages([])\r\n })\r\n .catch(error => {\r\n setErrorMessages(`Não foi possível atualizar o cliente. ${error}`)\r\n setIserror(true)\r\n resolve()\r\n })\r\n\r\n }\r\n\r\n return (\r\n <>\r\n <div>\r\n {iserror &&\r\n <Alert severity=\"error\">{errorMessages}</Alert>\r\n }\r\n </div>\r\n <MaterialTable\r\n title=\"Clientes\"\r\n columns={columns}\r\n localization={localization}\r\n options={{\r\n exportButton: true,\r\n headerStyle: {\r\n backgroundColor: '#01579b',\r\n color: '#FFF'\r\n }\r\n }}\r\n data={query =>\r\n new Promise((resolve, reject) => {\r\n let url = 'api/Client?'\r\n url += 'per_page=' + query.pageSize\r\n url += '&page=' + (query.page + 1)\r\n fetch(url)\r\n .then(response => response.json())\r\n .then(result => {\r\n resolve({\r\n data: operations(query, result.data),\r\n page: result.page - 1,\r\n totalCount: result.total\r\n })\r\n }).catch(err => console.log(err))\r\n })\r\n }\r\n actions={[\r\n {\r\n icon: () => <AddShoppingCartIcon />,\r\n tooltip: 'Nova venda',\r\n onClick: (event, rowData) => props.history.push(`/sale/client/${rowData.id}`)\r\n }\r\n , {\r\n icon: () => <PaymentIcon />,\r\n tooltip: 'Pagar',\r\n onClick: (event, rowData) =>\r\n props\r\n .history\r\n .push(`/payment/client/${rowData.id}`)\r\n }\r\n ]}\r\n editable={{\r\n onRowAdd: newData =>\r\n new Promise((resolve) => {\r\n handleRowAdd(newData, resolve)\r\n }),\r\n onRowUpdate: (newData, oldData) =>\r\n new Promise((resolve) => {\r\n handleRowUpdate(newData, oldData, resolve);\r\n }),\r\n }}\r\n />\r\n </>\r\n )\r\n};\r\n\r\n",["198","199"],"C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\order\\Order.jsx",["200"],"import React from 'react';\r\nimport MaterialTable from 'material-table';\r\nimport PaymentIcon from '@material-ui/icons/Payment';\r\nimport Items from './Items';\r\n\r\nconst columns =\r\n [\r\n { title: \"id\", field: \"id\", hidden: true },\r\n { title: \"cLientId\", field: \"cLientId\", hidden: true },\r\n {\r\n title: 'Cliente', field: 'client.name', type: 'string'\r\n },\r\n {\r\n title: 'Valor', field: 'value', type: 'currency'\r\n },\r\n {\r\n title: 'Status', field: 'status', type: 'numeric',\r\n lookup: { 0: 'Pago', 1: 'Pendende' }\r\n },\r\n {\r\n title: 'Data', field: 'date', type: 'date'\r\n },\r\n ];\r\n\r\nconst localization = {\r\n body: {\r\n emptyDataSourceMessage: 'Nenhum registro para exibir',\r\n addTooltip: 'Adicionar',\r\n deleteTooltip: 'Apagar',\r\n editTooltip: 'Editar',\r\n editRow: {\r\n deleteText: 'Voulez-vous supprimer cette ligne?',\r\n cancelTooltip: 'Cancelar',\r\n saveTooltip: 'Salvar'\r\n }\r\n },\r\n toolbar: {\r\n searchTooltip: 'Pesquisar',\r\n searchPlaceholder: 'Pesquisar',\r\n exportTitle: 'Exportar',\r\n exportAriaLabel: 'Exportar',\r\n },\r\n pagination: {\r\n labelRowsSelect: 'linhas',\r\n labelDisplayedRows: '{count} de {from}-{to}',\r\n firstTooltip: 'Primeira página',\r\n previousTooltip: 'Página anterior',\r\n nextTooltip: 'Próxima página',\r\n lastTooltip: 'Última página'\r\n },\r\n header: {\r\n actions: 'Ações'\r\n }\r\n}\r\nconst operations = (query, data) => {\r\n //Searching \r\n data = data.filter(o => \r\n o.client.name.toLowerCase().includes(query.search.toLowerCase()) ||\r\n o.value.toString().includes(query.search) || \r\n new Date(o.date).toLocaleDateString().includes(query.search)\r\n )\r\n //Sorting \r\n if (query.orderBy != null) {\r\n let orderBy = query.orderBy.field;\r\n data.sort(function (a, b) {\r\n if (b[orderBy] < a[orderBy]) {\r\n return -1;\r\n }\r\n if (b[orderBy] > a[orderBy]) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n }\r\n return data;\r\n};\r\n\r\nexport default function Order(props) {\r\n\r\n return (\r\n <MaterialTable\r\n title=\"Pedidos\"\r\n columns={columns}\r\n localization={localization}\r\n options={{\r\n exportButton: true,\r\n headerStyle: {\r\n backgroundColor: '#01579b',\r\n color: '#FFF'\r\n }\r\n }}\r\n data={query =>\r\n new Promise((resolve, reject) => {\r\n let url = 'https://estoquapp.herokuapp.com/api/Order?'\r\n url += 'per_page=' + query.pageSize\r\n url += '&page=' + (query.page + 1)\r\n fetch(url)\r\n .then(response => response.json())\r\n .then(result => {\r\n resolve({\r\n data: operations(query, result.data),\r\n page: result.page - 1,\r\n totalCount: result.total\r\n })\r\n }).catch(err => console.log(err))\r\n })\r\n }\r\n actions={[\r\n {\r\n icon: () => <PaymentIcon />,\r\n tooltip: 'Pagar',\r\n onClick: (event, rowData) =>\r\n props\r\n .history\r\n .push(`/payment/client/${rowData.cLientId}`)\r\n }\r\n ]}\r\n detailPanel={rowData => {\r\n return (\r\n <Items orderId={rowData.id} />\r\n )\r\n }}\r\n />\r\n\r\n )\r\n};\r\n\r\n","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\Sale.jsx",["201"],"import React, { useState } from 'react';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport Grid from '@material-ui/core/Grid';\r\nimport Alert from '@material-ui/lab/Alert';\r\n\r\nimport { TableItem } from './TableItem';\r\nimport { TabItem } from './TabItem';\r\n\r\nconst baseURL = \"api/Order\";\r\n\r\nconst isOk = (response) => {\r\n if (response !== null && response.ok) {\r\n return response;\r\n } else {\r\n throw Error(response.status);\r\n }\r\n}\r\n\r\n\r\nexport default function Sale(props) {\r\n const [errorMessages, setErrorMessages] = useState('');\r\n const [successMessages, setSuccessMessages] = useState('');\r\n const [iserror, setIserror] = useState(false);\r\n const [ismessage, setIsmessage] = useState(false);\r\n const [products, setProducts] = useState([]);\r\n const clientId = props.match.params.clientId;\r\n\r\n const useStyles = makeStyles((theme) => ({\r\n root: {\r\n flexGrow: 1,\r\n },\r\n paper: {\r\n padding: theme.spacing(2),\r\n textAlign: 'center',\r\n color: theme.palette.text.secondary,\r\n },\r\n }));\r\n\r\n const onAdd = (product) => {\r\n setProducts([...products, product]);\r\n }\r\n\r\n const handleSaveItems = () => {\r\n if (products.length === 0) {\r\n setErrorMessages(`Erro. Pedido deve ter ao menos um item.`);\r\n setIserror(true);\r\n } else {\r\n let order = {\r\n clientId: Number(clientId),\r\n items: products.map(p => ({ 'ProductId': Number(p.productid), 'Quantity': Number(p.quantity) }))\r\n }\r\n fetch(baseURL, {\r\n method: 'Post',\r\n headers: { 'Content-type': 'application/json' },\r\n body: JSON.stringify(order)\r\n })\r\n .then(response => isOk(response))\r\n .then(response => response.json())\r\n .then(result => { \r\n setProducts([]);\r\n setErrorMessages([]);\r\n setSuccessMessages(`Pedido registrado com sucesso!. ${result.status}`);\r\n setIserror(false);\r\n setIsmessage(true);\r\n }).catch(error => {\r\n setErrorMessages(`Não foi possível enviar os dados para o servidor. ${error}`);\r\n setIserror(true);\r\n });\r\n }\r\n\r\n }\r\n const handleRowUpdate = (newData, oldData, resolve) => {\r\n let objIndex = products.findIndex(p => p.code === oldData.code);\r\n let productscopy = [...products];\r\n productscopy[objIndex] = newData;\r\n setProducts(productscopy);\r\n resolve();\r\n }\r\n\r\n const handleRowDelete = (oldData, resolve) => {\r\n let newproducts = products.filter(p => p.code !== oldData.code);\r\n setProducts(newproducts);\r\n resolve();\r\n }\r\n\r\n const classes = useStyles();\r\n return (<>\r\n <div>\r\n {iserror &&\r\n <Alert severity=\"error\">{errorMessages}</Alert>\r\n }\r\n {ismessage &&\r\n <Alert severity=\"success\">{successMessages}</Alert>\r\n }\r\n\r\n </div>\r\n <div className={classes.root}>\r\n <Grid container spacing={3}>\r\n <Grid item xs={8}>\r\n <TableItem products={products}\r\n onRowUpdate={handleRowUpdate}\r\n onRowDelete={handleRowDelete}\r\n onSaveItems={handleSaveItems}\r\n />\r\n </Grid>\r\n <Grid item xs={4}>\r\n <TabItem onAdd={onAdd} />\r\n </Grid>\r\n </Grid>\r\n </div>\r\n </>\r\n );\r\n\r\n};\r\n\r\n\r\n\r\n","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\payment\\Payment.jsx",["202"],"import React, { useState, useEffect } from 'react';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport TextField from '@material-ui/core/TextField';\r\nimport Button from '@material-ui/core/Button';\r\nimport Alert from '@material-ui/lab/Alert';\r\n\r\nconst URL = \"https://estoquapp.herokuapp.com/api/Payment\";\r\n\r\nconst useInputStyles = makeStyles((theme) => ({\r\n text: {\r\n '& > *': {\r\n margin: theme.spacing(1),\r\n width: '40ch',\r\n },\r\n },\r\n button: {\r\n '& > *': {\r\n margin: theme.spacing(1),\r\n },\r\n },\r\n}));\r\n\r\n\r\nexport default function Payment(props) {\r\n\r\n const [disabled, setDisabled] = useState(true);\r\n const [amount, setAmount] = useState('');\r\n const [value, setValue] = useState('');\r\n const [valueerror, setValueError] = useState({ value: { valid: true, text: \"\" } });\r\n const [errorMessages, setErrorMessages] = useState('');\r\n const [successMessages, setSuccessMessages] = useState('');\r\n const [iserror, setIserror] = useState(false);\r\n const [ismessage, setIsmessage] = useState(false);\r\n\r\n const clientId = props.match.params.clientId;\r\n\r\n const inputStyles = useInputStyles();\r\n\r\n const onSubmit = (event) => {\r\n event.preventDefault();\r\n let payment = {\r\n clientId: Number(clientId),\r\n value: Number(value)\r\n }\r\n\r\n fetch(URL, {\r\n method: 'Post',\r\n headers: { 'Content-type': 'application/json' },\r\n body: JSON.stringify(payment)\r\n })\r\n .then(res => isOk(res))\r\n .then(response => response.json())\r\n .then(payment => {\r\n console.log(payment);\r\n setAmount(amount - value);\r\n setValue('');\r\n setSuccessMessages('Pagamento enviado com sucesso!')\r\n setIsmessage(true);\r\n setErrorMessages('');\r\n setIserror(false)\r\n })\r\n .catch(error => {\r\n setErrorMessages([`Não foi possível enviar os dados ao servidor. ${error}`])\r\n setIserror(true);\r\n setSuccessMessages('');\r\n setIsmessage(false);\r\n })\r\n\r\n }\r\n\r\n const isOk = (response) => {\r\n if (response !== null && response.ok) {\r\n return response;\r\n } else {\r\n throw new Error(response.statusText);\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n /*The last line with an array is necessary or You'll get a \r\n * 'React Hook useEffect has a missing dependency: 'props.orderId'. \r\n * Either include it or remove the dependency array.'*/\r\n fetch(`${URL}/${clientId}`)\r\n .then(res => isOk(res))\r\n .then(response => response.json())\r\n .then(data => { setAmount(data.debt) })\r\n .catch(err => console.log(err));\r\n }, [clientId]);\r\n\r\n useEffect(() => {\r\n if (value <= 0 || value > amount) {\r\n setDisabled(true);\r\n } else {\r\n setDisabled(false);\r\n }\r\n }, [value, amount]);\r\n return (\r\n <>\r\n <div>\r\n {iserror &&\r\n <Alert severity=\"error\">{errorMessages}</Alert>\r\n }\r\n {ismessage &&\r\n <Alert severity=\"success\">{successMessages}</Alert>\r\n }\r\n\r\n </div>\r\n <form className={inputStyles.text} autoComplete=\"off\" onSubmit={onSubmit}>\r\n <TextField\r\n disabled id=\"amount\"\r\n value={amount}\r\n label=\"Total\"\r\n variant=\"outlined\"\r\n />\r\n <TextField\r\n required type=\"number\"\r\n id=\"valut\"\r\n label=\"Valor\"\r\n variant=\"outlined\"\r\n value={value}\r\n error={!valueerror.value.valid}\r\n helperText={valueerror.value.text}\r\n onChange={(event) => {\r\n let v = event.target.value;\r\n if (v <= 0 || v > amount) {\r\n setValueError(\r\n {\r\n value:\r\n {\r\n valid: false,\r\n text: `O valor precisa ser maior que 0 e menor que ${amount}`\r\n }\r\n });\r\n } else {\r\n setValueError({ value: { valid: true, text: \"\" } });\r\n }\r\n setValue(v);\r\n }}\r\n />\r\n\r\n <div className={inputStyles.button}>\r\n <Button disabled={disabled} type=\"submit\" variant=\"contained\" color=\"primary\">Debitar</Button>\r\n </div>\r\n </form>\r\n </>);\r\n\r\n}","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\payment\\Payments.jsx",["203"],"import React from 'react';\r\nimport MaterialTable from 'material-table';\r\n\r\nlet URL = \"https://estoquapp.herokuapp.com/api/Payment?\";\r\n\r\nconst columns =\r\n [\r\n { title: \"id\", field: \"id\", hidden: true },\r\n {\r\n title: 'Cliente', field: 'client.name', type: 'string', editable: 'never'\r\n },\r\n {\r\n title: 'Valor', field: 'amount', type: 'currency', editable: 'never'\r\n },\r\n {\r\n title: 'Data', field: 'date', type: 'date', editable: 'never'\r\n },\r\n ];\r\n\r\nconst localization = {\r\n body: {\r\n emptyDataSourceMessage: 'Nenhum registro para exibir',\r\n addTooltip: 'Adicionar',\r\n deleteTooltip: 'Apagar',\r\n editTooltip: 'Editar',\r\n editRow: {\r\n deleteText: 'Voulez-vous supprimer cette ligne?',\r\n cancelTooltip: 'Cancelar',\r\n saveTooltip: 'Salvar'\r\n }\r\n },\r\n toolbar: {\r\n searchTooltip: 'Pesquisar',\r\n searchPlaceholder: 'Pesquisar',\r\n exportTitle: 'Exportar',\r\n exportAriaLabel: 'Exportar',\r\n },\r\n pagination: {\r\n labelRowsSelect: 'linhas',\r\n labelDisplayedRows: '{count} de {from}-{to}',\r\n firstTooltip: 'Primeira página',\r\n previousTooltip: 'Página anterior',\r\n nextTooltip: 'Próxima página',\r\n lastTooltip: 'Última página'\r\n },\r\n header: {\r\n actions: 'Ações'\r\n }\r\n}\r\n\r\nconst operations = (query, data) => {\r\n //Searching\r\n data = data.filter(p =>\r\n p.client.name.toLowerCase().includes(query.search.toLowerCase()) ||\r\n p.amount.toString().includes(query.search) ||\r\n new Date(p.date).toLocaleDateString().includes(query.search)\r\n )\r\n //Sorting \r\n if (query.orderBy != null) {\r\n let orderBy = query.orderBy.field;\r\n data.sort(function (a, b) {\r\n if (b[orderBy] < a[orderBy]) {\r\n return -1;\r\n }\r\n if (b[orderBy] > a[orderBy]) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n }\r\n return data;\r\n};\r\n\r\nexport default function Client(props) {\r\n return (\r\n <MaterialTable\r\n title=\"Pagamentos\"\r\n columns={columns}\r\n localization={localization}\r\n options={{\r\n exportButton: true,\r\n headerStyle: {\r\n backgroundColor: '#01579b',\r\n color: '#FFF'\r\n }\r\n }}\r\n data={query =>\r\n new Promise((resolve, reject) => { \r\n URL += 'per_page=' + query.pageSize\r\n URL += '&page=' + (query.page + 1)\r\n fetch(URL)\r\n .then(response => response.json())\r\n .then(result => {\r\n resolve({\r\n data: operations(query, result.data),\r\n page: result.page - 1,\r\n totalCount: result.total\r\n })\r\n }).catch(err => console.log(err))\r\n })\r\n }\r\n />\r\n )\r\n};\r\n\r\n","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\TableItem.jsx",["204"],"import React from 'react';\r\nimport MaterialTable from 'material-table';\r\n\r\n\r\nconst columns =\r\n [\r\n { title: \"id\", field: \"productid\", hidden: true },\r\n {\r\n title: 'Produto', field: 'description', type: 'string', editable: 'never'\r\n },\r\n {\r\n title: 'Valor', field: 'price', type: 'currency', editable: 'never'\r\n },\r\n {\r\n title: 'Quantidade', field: 'quantity', type: 'numeric',\r\n validate: rowData => rowData.quantity <= 0 ? '⚠️ Quantidade não pode ser menor que zero' : ''\r\n },\r\n {\r\n title: 'SubTotal', field: 'subtotal', type: 'currency', editable: 'never'\r\n }\r\n ];\r\n\r\nconst localization = {\r\n body: {\r\n emptyDataSourceMessage: 'Nenhum registro para exibir',\r\n addTooltip: 'Adicionar',\r\n deleteTooltip: 'Apagar',\r\n editTooltip: 'Editar',\r\n editRow: {\r\n deleteText: 'Deseja apagar este item?',\r\n cancelTooltip: 'Cancelar',\r\n saveTooltip: 'Salvar'\r\n }\r\n },\r\n toolbar: {\r\n searchTooltip: 'Pesquisar',\r\n searchPlaceholder: 'Pesquisar',\r\n exportTitle: 'Exportar',\r\n exportAriaLabel: 'Exportar',\r\n },\r\n pagination: {\r\n labelRowsSelect: 'linhas',\r\n labelDisplayedRows: '{count} de {from}-{to}',\r\n firstTooltip: 'Primeira página',\r\n previousTooltip: 'Página anterior',\r\n nextTooltip: 'Próxima página',\r\n lastTooltip: 'Última página'\r\n },\r\n header: {\r\n actions: 'Ações'\r\n }\r\n}\r\n\r\n\r\nexport function TableItem(props) {\r\n\r\n return (\r\n <MaterialTable\r\n title=\"Itens\"\r\n columns={columns}\r\n localization={localization}\r\n data={props.products}\r\n options={{\r\n exportButton: true,\r\n headerStyle: {\r\n backgroundColor: '#01579b',\r\n color: '#FFF'\r\n }\r\n }}\r\n actions={[\r\n {\r\n icon: 'save',\r\n tooltip: 'Salvar items',\r\n isFreeAction: true,\r\n onClick: (event) => { props.onSaveItems() }\r\n }\r\n ]}\r\n editable={{\r\n onRowUpdate: (newData, oldData) =>\r\n new Promise((resolve) => {\r\n props.onRowUpdate(newData, oldData, resolve);\r\n }),\r\n onRowDelete: (oldData) =>\r\n new Promise((resolve) => {\r\n props.onRowDelete(oldData, resolve);\r\n }),\r\n }}\r\n />\r\n )\r\n}","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\order\\Items.jsx",["205"],"import React, { useEffect } from 'react';\r\nimport { withStyles, makeStyles } from '@material-ui/core/styles';\r\nimport Table from '@material-ui/core/Table';\r\nimport TableBody from '@material-ui/core/TableBody';\r\nimport TableCell from '@material-ui/core/TableCell';\r\nimport TableContainer from '@material-ui/core/TableContainer';\r\nimport TableHead from '@material-ui/core/TableHead';\r\nimport TableRow from '@material-ui/core/TableRow';\r\nimport Paper from '@material-ui/core/Paper';\r\n\r\nconst StyledTableCell = withStyles((theme) => ({\r\n head: {\r\n backgroundColor: '#01579b',\r\n color: '#FFF'\r\n },\r\n body: {\r\n fontSize: 14,\r\n },\r\n}))(TableCell);\r\n\r\n\r\nconst StyledTableRow = withStyles((theme) => ({\r\n root: {\r\n '&:nth-of-type(odd)': {\r\n backgroundColor: theme.palette.action.hover,\r\n },\r\n },\r\n}))(TableRow);\r\n\r\nconst useStyles = makeStyles({\r\n table: {\r\n minWidth: 650,\r\n },\r\n});\r\n\r\nconst isOk = (response) => {\r\n if (response !== null && response.ok) {\r\n return response;\r\n } else {\r\n throw Error(response.status);\r\n }\r\n}\r\nexport default function Items(props) {\r\n const classes = useStyles();\r\n const [items, setItems] = React.useState([]);\r\n\r\n useEffect(() => {\r\n /*The last line with an array is necessary or You'll get a\r\n * 'React Hook useEffect has a missing dependency: 'props.orderId'.\r\n * Either include it or remove the dependency array.'*/\r\n fetch(`/api/Item/${props.orderId}`)\r\n .then(res => isOk(res))\r\n .then(response => response.json())\r\n .then(data => { setItems(data) })\r\n .catch(err => console.log(err));\r\n }, [props.orderId]);\r\n\r\n return (\r\n <TableContainer component={Paper}>\r\n <Table className={classes.table} size=\"small\" aria-label=\"customized table\">\r\n <TableHead>\r\n <TableRow>\r\n <StyledTableCell>Produto</StyledTableCell>\r\n <StyledTableCell align=\"right\">Quantidade</StyledTableCell>\r\n <StyledTableCell align=\"right\">Preço</StyledTableCell>\r\n <StyledTableCell align=\"right\">Desconto</StyledTableCell>\r\n <StyledTableCell align=\"right\">Subtotal</StyledTableCell>\r\n </TableRow>\r\n </TableHead>\r\n <TableBody>\r\n {items.map((item) => (\r\n <StyledTableRow key={item.id}>\r\n <StyledTableCell component=\"th\" scope=\"row\">\r\n {item.product.description}\r\n </StyledTableCell>\r\n <StyledTableCell align=\"right\">{item.quantity}</StyledTableCell>\r\n <StyledTableCell align=\"right\">{item.value}</StyledTableCell>\r\n <StyledTableCell align=\"right\">{item.discound}</StyledTableCell>\r\n <StyledTableCell align=\"right\">{item.value * item.quantity}</StyledTableCell>\r\n </StyledTableRow>\r\n ))}\r\n </TableBody>\r\n </Table>\r\n </TableContainer>\r\n );\r\n}\r\n","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\TabItem.jsx",["206"],"import React, { useState } from 'react';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport AppBar from '@material-ui/core/AppBar';\r\nimport Tabs from '@material-ui/core/Tabs';\r\nimport Tab from '@material-ui/core/Tab';\r\nimport { ManualTabPanel } from '../sale/ManualTabPanel'\r\nimport { AutomaticTabPanel } from '../sale/AutomaticTabPanel'\r\n\r\nconst useStyles = makeStyles((theme) => ({\r\n root: {\r\n flexGrow: 1,\r\n backgroundColor: theme.palette.background.paper,\r\n },\r\n}));\r\n\r\nexport function TabItem(props) {\r\n const [selectedTab, setSelectedTab] = useState(0);\r\n\r\n const handleTabChange = (event, newValue) => {\r\n setSelectedTab(newValue);\r\n }\r\n\r\n const classes = useStyles();\r\n\r\n return (\r\n <div className={classes.root}>\r\n <AppBar position=\"static\">\r\n <Tabs value={selectedTab} onChange={handleTabChange} aria-label=\"simple tabs example\">\r\n <Tab label=\"Busca automática\" />\r\n <Tab label=\"Busca manual\" />\r\n </Tabs>\r\n </AppBar>\r\n {selectedTab === 0 && <AutomaticTabPanel onAdd={props.onAdd} />}\r\n {selectedTab === 1 && <ManualTabPanel onAdd={props.onAdd} />}\r\n </div>\r\n );\r\n\r\n}\r\n\r\n\r\n","C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\AutomaticTabPanel.jsx",["207"],"import React, { useState, useEffect } from 'react';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport TextField from '@material-ui/core/TextField';\r\nimport Button from '@material-ui/core/Button';\r\n\r\nconst useStyles = makeStyles((theme) => ({\r\n text: {\r\n '& > *': {\r\n margin: theme.spacing(1),\r\n width: '40ch',\r\n },\r\n },\r\n button: {\r\n '& > *': {\r\n margin: theme.spacing(1),\r\n },\r\n },\r\n}));\r\n\r\n\r\nexport function AutomaticTabPanel(props) {\r\n const [disabled, setDisabled] = useState(true);\r\n const [productid, setProductid] = useState('');\r\n const [code, setCode] = useState('');\r\n const [description, setDescription] = useState('');\r\n const [price, setPrice] = useState('');\r\n const [quantity, setQuantity] = useState('');\r\n const [quantityAvailable, setQuantityAvailable] = useState('');\r\n const [codeerror, setCodeError] = useState({ code: { valid: true, text: \"\" } });\r\n const [quantityerror, setQuantityErrors] = useState({ quantity: { valid: true, text: \"\" } });\r\n const classes = useStyles();\r\n\r\n useEffect(() => {\r\n if (code.length === 0 || description.length === 0 || quantity <= 0 || quantity > quantityAvailable) {\r\n setDisabled(true);\r\n } else {\r\n setDisabled(false);\r\n }\r\n }, [code.length, description.length, quantity, quantityAvailable]);\r\n\r\n const isOk = (response) => {\r\n if (response !== null && response.ok) {\r\n return response;\r\n } else {\r\n throw new Error(response.statusText);\r\n }\r\n }\r\n\r\n const onClick = () => {\r\n //7896591527269\r\n return fetch(`api/Product/Code?code=${code}`, { method: 'GET' })\r\n .then(res => isOk(res))\r\n .then(res => res.json())\r\n .then((product) => {\r\n setProductid(product.id);\r\n setDescription(product.description);\r\n setPrice(product.salePrice);\r\n setQuantityAvailable(product.quantity);\r\n })\r\n .catch(err => { console.log(err) });\r\n }\r\n\r\n const onSubmit = (event) => {\r\n event.preventDefault();\r\n props.onAdd({ productid, code, description, price, quantity, subtotal: price * quantity });\r\n\r\n setProductid('');\r\n setCode('');\r\n setDescription('');\r\n setPrice('');\r\n setQuantity('');\r\n setQuantityAvailable('');\r\n }\r\n\r\n return (\r\n <form className={classes.text} autoComplete=\"off\"\r\n onSubmit={onSubmit}>\r\n\r\n <TextField\r\n fullWidth required\r\n id=\"code\"\r\n value={code}\r\n label=\"Código\"\r\n variant=\"outlined\"\r\n error={!codeerror.code.valid}\r\n helperText={codeerror.code.text}\r\n onChange={(event) => {\r\n let c = event.target.value;\r\n if (c.length < 9 || c.length > 13) {\r\n setCodeError(\r\n {\r\n code:\r\n {\r\n valid: false,\r\n text: \"O código precisa ter entre 9 e 13 dígitos.\"\r\n }\r\n });\r\n } else {\r\n setCodeError({ code: { valid: true, text: \"\" } });\r\n }\r\n setCode(c);\r\n }}\r\n />\r\n <TextField\r\n disabled id=\"description\"\r\n value={description}\r\n label=\"Descrição\"\r\n variant=\"outlined\"\r\n />\r\n <TextField\r\n disabled id=\"price\"\r\n value={price}\r\n label=\"Preço\"\r\n variant=\"outlined\"\r\n />\r\n <TextField\r\n required type=\"number\"\r\n id=\"quantity\"\r\n label=\"Quantidade\"\r\n variant=\"outlined\"\r\n value={quantity}\r\n error={!quantityerror.quantity.valid}\r\n helperText={quantityerror.quantity.text}\r\n onChange={(event) => {\r\n let q = event.target.value;\r\n if (q <= 0 || q > quantityAvailable) {\r\n setQuantityErrors(\r\n {\r\n quantity:\r\n {\r\n valid: false,\r\n text: `A quantidade precisa ser maior que 0 e menor que ${quantityAvailable}`\r\n }\r\n });\r\n } else {\r\n setQuantityErrors({ quantity: { valid: true, text: \"\" } });\r\n }\r\n setQuantity(q);\r\n }}\r\n />\r\n\r\n <div className={classes.button}>\r\n <Button variant=\"contained\" onClick={onClick}>Buscar</Button>\r\n <Button disabled={disabled} type=\"submit\" variant=\"contained\" color=\"primary\">Adicionar</Button>\r\n </div>\r\n </form>\r\n )\r\n}",["208","209"],"C:\\Users\\Renan\\source\\repos\\stock-front-end\\src\\components\\sale\\ManualTabPanel.jsx",["210"],"import React, { useState, useEffect } from 'react';\r\nimport { makeStyles } from '@material-ui/core/styles';\r\nimport InputLabel from '@material-ui/core/InputLabel';\r\nimport MenuItem from '@material-ui/core/MenuItem';\r\nimport FormControl from '@material-ui/core/FormControl';\r\nimport Select from '@material-ui/core/Select';\r\nimport TextField from '@material-ui/core/TextField';\r\nimport Button from '@material-ui/core/Button';\r\n\r\nconst useSelectStyles = makeStyles((theme) => ({\r\n formControl: {\r\n margin: theme.spacing(1),\r\n minWidth: 120,\r\n width: '40ch',\r\n },\r\n selectEmpty: {\r\n marginTop: theme.spacing(2),\r\n },\r\n}));\r\n\r\nconst useInputStyles = makeStyles((theme) => ({\r\n text: {\r\n '& > *': {\r\n margin: theme.spacing(1),\r\n width: '40ch',\r\n },\r\n },\r\n button: {\r\n '& > *': {\r\n margin: theme.spacing(1),\r\n },\r\n },\r\n}));\r\n\r\nexport function ManualTabPanel(props) {\r\n const [disabled, setDisabled] = useState(true);\r\n const [categories, setCategories] = useState([]);\r\n const [products, setProducts] = React.useState([]);\r\n const [currentCategory, setcurrentCategory] = useState('');\r\n const [currentProduct, setcurrentProduct] = React.useState('');\r\n const [price, setPrice] = useState('');\r\n const [quantity, setQuantity] = useState('');\r\n const [quantityAvailable, setQuantityAvailable] = useState('');\r\n const [quantityerror, setQuantityErrors] = useState({ quantity: { valid: true, text: \"\" } });\r\n\r\n const handleCategoryChange = (event) => {\r\n let categoryId = event.target.value;\r\n setcurrentCategory(categoryId)\r\n fetch(`api/Product/ByCategory?id=${categoryId}`)\r\n .then(res => isOk(res))\r\n .then(response => response.json())\r\n .then(data => { setProducts(data) })\r\n .catch(err => console.log(err));\r\n };\r\n\r\n const handleProductChange = (event) => {\r\n let productId = event.target.value;\r\n setcurrentProduct(productId)\r\n let p = products.find(p => p.id === productId);\r\n setPrice(p.salePrice);\r\n setQuantityAvailable(p.quantity);\r\n };\r\n\r\n const selectStyles = useSelectStyles();\r\n const inputStyles = useInputStyles();\r\n\r\n const onSubmit = (event) => {\r\n event.preventDefault();\r\n let p = products.find(p => p.id === currentProduct)\r\n let productid = p.id;\r\n let description = p.description;\r\n setcurrentProduct('')\r\n setPrice('');\r\n setQuantity('');\r\n setQuantityAvailable('');\r\n props.onAdd({ productid, description, price, quantity, subtotal: price * quantity });\r\n }\r\n\r\n const isOk = (response) => {\r\n if (response !== null && response.ok) {\r\n return response;\r\n } else {\r\n throw new Error(response.statusText);\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n fetch('/api/Category/All')\r\n .then(res => isOk(res))\r\n .then(response => response.json())\r\n .then(data => { setCategories(data) })\r\n .catch(err => console.log(err));\r\n }, []);\r\n\r\n useEffect(() => {\r\n /*React Hook useEffect contains a call to 'setDisabled'.\r\n * Without a list of dependencies, this can lead to an infinite chain of updates. To fix this, \r\n * pass [currentCategory.length, currentProduct.length, quantity, quantityAvailable] as a second \r\n * argument to the useEffect Hook react-hooks/exhaustive-deps*/\r\n if (currentCategory.length === 0 || currentProduct.length === 0 || quantity <= 0 || quantity > quantityAvailable) {\r\n setDisabled(true);\r\n } else {\r\n setDisabled(false);\r\n }\r\n }, [currentCategory.length, currentProduct.length, quantity, quantityAvailable]);\r\n\r\n return (\r\n <form className={inputStyles.text} autoComplete=\"off\"\r\n onSubmit={onSubmit}>\r\n <FormControl variant=\"outlined\" className={selectStyles.formControl}>\r\n <InputLabel id=\"demo-simple-select-label\">Categoria</InputLabel>\r\n <Select\r\n labelId=\"demo-simple-select-label\"\r\n id=\"demo-simple-select\"\r\n value={currentCategory}\r\n onChange={handleCategoryChange}\r\n >\r\n {categories.map((category) =>\r\n <MenuItem value={category.id}>{category.title}</MenuItem>\r\n )}\r\n\r\n </Select>\r\n </FormControl>\r\n <FormControl variant=\"outlined\" className={selectStyles.formControl}>\r\n <InputLabel id=\"demo-simple-select-label\">Produto</InputLabel>\r\n <Select\r\n labelId=\"demo-simple-select-label\"\r\n id=\"demo-simple-select\"\r\n value={currentProduct}\r\n onChange={handleProductChange}\r\n >\r\n {products.map((product) =>\r\n <MenuItem value={product.id}>{product.description}</MenuItem>\r\n )}\r\n </Select>\r\n </FormControl>\r\n <TextField\r\n disabled id=\"price\"\r\n value={price}\r\n label=\"Preço\"\r\n variant=\"outlined\"\r\n />\r\n <TextField\r\n required type=\"number\"\r\n id=\"quantity\"\r\n label=\"Quantidade\"\r\n variant=\"outlined\"\r\n value={quantity}\r\n error={!quantityerror.quantity.valid}\r\n helperText={quantityerror.quantity.text}\r\n onChange={(event) => {\r\n let q = event.target.value;\r\n if (q <= 0 || q > quantityAvailable) {\r\n setQuantityErrors(\r\n {\r\n quantity:\r\n {\r\n valid: false,\r\n text: `A quantidade precisa ser maior que 0 e menor que ${quantityAvailable}`\r\n }\r\n });\r\n } else {\r\n setQuantityErrors({ quantity: { valid: true, text: \"\" } });\r\n }\r\n setQuantity(q);\r\n }}\r\n />\r\n\r\n <div className={inputStyles.button}>\r\n <Button disabled={disabled} type=\"submit\" variant=\"contained\" color=\"primary\">Adicionar</Button>\r\n </div>\r\n </form>\r\n\r\n )\r\n}","C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\client\\Client.jsx",[],["211","212"],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\Sale.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\order\\Order.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\Payment.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\Payments.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\TableItem.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\TabItem.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\order\\Items.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\AutomaticTabPanel.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\sale\\ManualTabPanel.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\auth\\Login.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\auth\\FormLogin.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\category\\Category.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\validators\\Validator.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\supplier\\Supplier.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\product\\Product.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\index.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\report\\Report.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\report\\OnProducts.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\report\\OnClients.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\context\\AuthContext.js",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\PaymentPanel.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\OrdersTable.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\services\\Api.js",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\Localization.js",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\App.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\error\\NotFoundPage.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\payment\\styles.js",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\order\\styles.js",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\ErrorBoundary.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\Dashboard.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\styles.js",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\ListItems.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\Routes.jsx",[],"C:\\Users\\Renan\\source\\repos\\Stock-front-end\\src\\components\\dashboad\\NavBar.jsx",[],{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"217"},{"ruleId":"218","replacedBy":"219"},{"ruleId":"220","replacedBy":"221"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"222"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"223"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"224"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"225"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"226"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"227"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"228"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"229"},{"ruleId":"218","replacedBy":"230"},{"ruleId":"220","replacedBy":"231"},{"ruleId":"213","severity":1,"message":"214","line":1,"column":1,"nodeType":"215","messageId":"216","fix":"232"},{"ruleId":"218","replacedBy":"233"},{"ruleId":"220","replacedBy":"234"},"unicode-bom","Unexpected Unicode BOM (Byte Order Mark).","Program","unexpected",{"range":"235","text":"236"},"no-native-reassign",["237"],"no-negated-in-lhs",["238"],{"range":"239","text":"236"},{"range":"240","text":"236"},{"range":"241","text":"236"},{"range":"242","text":"236"},{"range":"243","text":"236"},{"range":"244","text":"236"},{"range":"245","text":"236"},{"range":"246","text":"236"},["237"],["238"],{"range":"247","text":"236"},["237"],["238"],[-1,0],"","no-global-assign","no-unsafe-negation",[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0],[-1,0]]