| @ -0,0 +1,18 @@ | |||
| node_modules/ | |||
| .DS_Store | |||
| *.log | |||
| .idea/ | |||
| .metadata/ | |||
| .vscode | |||
| package-lock.json | |||
| /trash/* | |||
| .Trash | |||
| *~* | |||
| *#* | |||
| config/_development.json | |||
| config/_production.json | |||
| @ -0,0 +1,3 @@ | |||
| /* | |||
| * Development dynamic configurations is here. | |||
| */ | |||
| @ -0,0 +1,3 @@ | |||
| /* | |||
| * Production dynamic configurations is here. | |||
| */ | |||
| @ -0,0 +1,13 @@ | |||
| /** | |||
| HERE YOUR CUSTOM CSS | |||
| **/ | |||
| .navbar, .navbar-inverse { | |||
| background-color: #5b5ce1 !important; | |||
| } | |||
| .dev .navbar, .dev .navbar-inverse { | |||
| background-color: #333333 !important; | |||
| } | |||
| @ -0,0 +1,22 @@ | |||
| _config.set("_lang", _config.get("_lang:default")) | |||
| if (_env.is("dev") | |||
| && (_url.equals("/") || _url.equals("/Index.netuno"))) { | |||
| _config | |||
| .set("_login:user", "dev") | |||
| .set("_login:pass", "dev") | |||
| .set("_login:auto", _req.getString("action") != "logout") | |||
| } | |||
| /** | |||
| * DISABLE BROWSER CACHE | |||
| */ | |||
| if (_url.download.isDownloadable()) { | |||
| if (_env.is("dev") && _url.indexOf("/public/scripts/main.js") > 0) { | |||
| _header.noCache() | |||
| } else { | |||
| _header.cache(2628000) | |||
| } | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| /** | |||
| * FIREBASE - Set your listeners | |||
| */ | |||
| // _firebase.listener("my-test", _header.baseURL() + "/services/firebase/listener/my-test.netuno") | |||
| @ -0,0 +1,17 @@ | |||
| if (!_out.isClosed()) { | |||
| _out.print( | |||
| "### SERVER ERROR ###" | |||
| ) | |||
| /* | |||
| // Is insecure but the code below will print errors with more details... | |||
| _out.print( | |||
| "SERVER ERROR # " + | |||
| _error.data().getString("file") | |||
| +":"+ | |||
| _error.data().getString("line") | |||
| +" # "+ | |||
| _error.data().getString("message") | |||
| ) | |||
| */ | |||
| } | |||
| @ -0,0 +1,2 @@ | |||
| _config.set("_script:_request_end", true) | |||
| @ -0,0 +1,14 @@ | |||
| // _log.info(_url.url()) | |||
| /** | |||
| * ALLOW CORS | |||
| */ | |||
| /* | |||
| _header.response.set("Access-Control-Allow-Origin", "https://www.netuno.org") | |||
| _header.response.set("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS") | |||
| _header.response.set("Access-Control-Allow-Headers", "content-type,x-requested-with,authorization") | |||
| _header.response.set("Access-Control-Allow-Credentials", true) | |||
| */ | |||
| _url.to(_url.request()) | |||
| @ -0,0 +1,13 @@ | |||
| /** | |||
| * When service need public access... | |||
| */ | |||
| if (_env.is("dev")) { | |||
| _service.allow() | |||
| } | |||
| /* | |||
| if (_service.path == 'samples/my-service') { | |||
| _service.allow() | |||
| } | |||
| */ | |||
| @ -0,0 +1,5 @@ | |||
| /* | |||
| // Print error: | |||
| _log.fatal("Service "+ _service.path, _error.data().get("throwable")) | |||
| */ | |||
| @ -0,0 +1,7 @@ | |||
| { | |||
| "name": "server", | |||
| "version": "1.0.0", | |||
| "description": "Server modules dependencies.", | |||
| "author": "netuno.org", | |||
| "license": "ISC" | |||
| } | |||
| @ -0,0 +1,6 @@ | |||
| const dbCategorias = _db.query( | |||
| `select categoria.tipo | |||
| from categoria | |||
| `) | |||
| _out.json(dbCategorias) | |||
| @ -0,0 +1,11 @@ | |||
| const dbFarmaciaProdutos = _db.query( | |||
| `select produto.nome, produto.categoria_id, produto.stock, produto.preco | |||
| from produto | |||
| inner join categoria | |||
| on produto.categoria_id = categoria.id | |||
| inner join farmacia | |||
| on produto.farmacia_id = farmacia.id | |||
| where farmacia.id = ? | |||
| `) | |||
| _out.json(dbFarmaciaProdutos) | |||
| @ -0,0 +1,6 @@ | |||
| const dbFarmacia = _db.query( | |||
| `select farmacia.lab | |||
| from farmacia | |||
| `) | |||
| _out.json(dbFarmacia) | |||
| @ -0,0 +1,40 @@ | |||
| const dbProdutos = _db.query( | |||
| `select produto.nome, categoria.tipo as "Categoria", produto.stock, produto.preco | |||
| from produto, categoria | |||
| where produto.categoria_id = categoria.id | |||
| `) | |||
| const dados = _val.list() | |||
| for(const dbProduto of dbProdutos){ | |||
| // const dbCategorias = _db.query( | |||
| // `select categoria.tipo | |||
| // from categoria inner join produto | |||
| // on categoria.id = produto.categoria_id | |||
| // where produto.categoria_id = ?` | |||
| // , dbProduto.getInt("id")) | |||
| // const dbFarmacia = _db.query(` | |||
| // select farmacia.lab | |||
| // from farmacia inner join produto | |||
| // on farmacia.id = produto.farmacia_id | |||
| // where produto.farmacia_id = ? | |||
| // `, dbProduto.getInt("id")) | |||
| dados.add( | |||
| _val.map() | |||
| .set("id", dbProduto.getInt("id")) | |||
| .set("nome", dbProduto.getString("nome")) | |||
| .set("categoria", dbProduto.getString("categoria")) | |||
| .set("stock", dbProduto.getString("stock")) | |||
| .set("preco", dbProduto.getFloat("preco").toFixed(2)) | |||
| ) | |||
| } | |||
| _out.json(dados) | |||
| @ -0,0 +1,57 @@ | |||
| /** | |||
| * | |||
| * CODE GENERATED AUTOMATICALLY | |||
| * | |||
| * THIS FILE SHOULD NOT BE EDITED BY HAND | |||
| * | |||
| */ | |||
| _form.createIfNotExists( | |||
| _val.init() | |||
| .set("big", false) | |||
| .set("control_active", true) | |||
| .set("control_group", false) | |||
| .set("control_user", false) | |||
| .set("displayname", "Categoria") | |||
| .set("export_id", false) | |||
| .set("export_json", true) | |||
| .set("export_lastchange", false) | |||
| .set("export_uid", true) | |||
| .set("export_xls", true) | |||
| .set("export_xml", true) | |||
| .set("firebase", "") | |||
| .set("name", "categoria") | |||
| .set("report", false) | |||
| .set("show_id", true) | |||
| .set("uid", "f67a8e70-a8d9-42e6-a102-8d0eddc6920e") | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "f67a8e70-a8d9-42e6-a102-8d0eddc6920e", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Tipo") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "tipo") | |||
| .set("notnull", true) | |||
| .set("primarykey", true) | |||
| .set("properties", "{\"MASK_REVERSE\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK_SELECTONFOCUS\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK\":{\"default\":\"\",\"type\":\"STRING\",\"value\":\"\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "text") | |||
| .set("uid", "a3b558ce-df53-49a7-8d2c-946e493cbd86") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 1) | |||
| ) | |||
| @ -0,0 +1,57 @@ | |||
| /** | |||
| * | |||
| * CODE GENERATED AUTOMATICALLY | |||
| * | |||
| * THIS FILE SHOULD NOT BE EDITED BY HAND | |||
| * | |||
| */ | |||
| _form.createIfNotExists( | |||
| _val.init() | |||
| .set("big", false) | |||
| .set("control_active", true) | |||
| .set("control_group", false) | |||
| .set("control_user", false) | |||
| .set("displayname", "Farm\u00E1cia") | |||
| .set("export_id", false) | |||
| .set("export_json", true) | |||
| .set("export_lastchange", false) | |||
| .set("export_uid", true) | |||
| .set("export_xls", true) | |||
| .set("export_xml", true) | |||
| .set("firebase", "") | |||
| .set("name", "farmacia") | |||
| .set("report", false) | |||
| .set("show_id", true) | |||
| .set("uid", "691775e8-c269-4f18-9140-3c7c51513475") | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "691775e8-c269-4f18-9140-3c7c51513475", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Laborat\u00F3rio") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "lab") | |||
| .set("notnull", true) | |||
| .set("primarykey", true) | |||
| .set("properties", "{\"MASK_REVERSE\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK_SELECTONFOCUS\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK\":{\"default\":\"\",\"type\":\"STRING\",\"value\":\"\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "text") | |||
| .set("uid", "216b144a-85f1-4797-a1a0-ed851dd28e7b") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 1) | |||
| ) | |||
| @ -0,0 +1,177 @@ | |||
| /** | |||
| * | |||
| * CODE GENERATED AUTOMATICALLY | |||
| * | |||
| * THIS FILE SHOULD NOT BE EDITED BY HAND | |||
| * | |||
| */ | |||
| _form.createIfNotExists( | |||
| _val.init() | |||
| .set("big", false) | |||
| .set("control_active", true) | |||
| .set("control_group", false) | |||
| .set("control_user", false) | |||
| .set("displayname", "Produto") | |||
| .set("export_id", false) | |||
| .set("export_json", true) | |||
| .set("export_lastchange", false) | |||
| .set("export_uid", true) | |||
| .set("export_xls", true) | |||
| .set("export_xml", true) | |||
| .set("firebase", "") | |||
| .set("name", "produto") | |||
| .set("report", false) | |||
| .set("show_id", true) | |||
| .set("uid", "d912b013-cebb-499e-ad74-dce70bdd569f") | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "d912b013-cebb-499e-ad74-dce70bdd569f", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Categoria") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "categoria_id") | |||
| .set("notnull", true) | |||
| .set("primarykey", false) | |||
| .set("properties", "{\"MAX_COLUMN_LENGTH\":{\"default\":\"0\",\"type\":\"INTEGER\",\"value\":\"0\"},\"COLUMN_SEPARATOR\":{\"default\":\" - \",\"type\":\"LINK_SEPARATOR\",\"value\":\" - \"},\"LINK\":{\"default\":\"\",\"type\":\"LINK\",\"value\":\"categoria:tipo\"},\"SERVICE\":{\"default\":\"com/Select.netuno\",\"type\":\"STRING\",\"value\":\"com/Select.netuno\"},\"ONLY_ACTIVES\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "select") | |||
| .set("uid", "9e6d3dcf-7d9f-46ec-b40a-38dd59657be9") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 2) | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "d912b013-cebb-499e-ad74-dce70bdd569f", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Farmacia_Multi") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "farmacia_multi") | |||
| .set("notnull", false) | |||
| .set("primarykey", false) | |||
| .set("properties", "{\"ITEM_SEPARATOR\":{\"default\":\" # \",\"type\":\"STRING\",\"value\":\" # \"},\"MAX_COLUMN_LENGTH\":{\"default\":\"0\",\"type\":\"INTEGER\",\"value\":\"0\"},\"COLUMN_SEPARATOR\":{\"default\":\" - \",\"type\":\"LINK_SEPARATOR\",\"value\":\" - \"},\"REFERENCE\":{\"default\":\"\",\"type\":\"LINK\",\"value\":\"farmacia_produto:farmacia_nova_tabela_id\"},\"LINK\":{\"default\":\"\",\"type\":\"LINK\",\"value\":\"farmacia_produto:produto_nova_tabela_id\"},\"SERVICE\":{\"default\":\"com/MultiSelect.netuno\",\"type\":\"STRING\",\"value\":\"com/MultiSelect.netuno\"},\"ONLY_ACTIVES\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "multiselect") | |||
| .set("uid", "55cc95a0-d1a2-42b1-89f9-c29c95af4579") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 5) | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "d912b013-cebb-499e-ad74-dce70bdd569f", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Nome") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "nome") | |||
| .set("notnull", true) | |||
| .set("primarykey", false) | |||
| .set("properties", "{\"MASK_REVERSE\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK_SELECTONFOCUS\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK\":{\"default\":\"\",\"type\":\"STRING\",\"value\":\"\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "text") | |||
| .set("uid", "43b48d26-41a7-4a49-8b4a-360ffdc4d39f") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 1) | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "d912b013-cebb-499e-ad74-dce70bdd569f", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Preco") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "preco") | |||
| .set("notnull", true) | |||
| .set("primarykey", false) | |||
| .set("properties", "{\"MASK_REVERSE\":{\"default\":\"true\",\"type\":\"BOOLEAN\",\"value\":\"true\"},\"MASK_SELECTONFOCUS\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK\":{\"default\":\"#.##0,00\",\"type\":\"STRING\",\"value\":\"#.##0,00\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "textfloat") | |||
| .set("uid", "69834fb1-5bef-4bc4-adf4-c162a39c4909") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 4) | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "d912b013-cebb-499e-ad74-dce70bdd569f", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Stock") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "stock") | |||
| .set("notnull", true) | |||
| .set("primarykey", false) | |||
| .set("properties", "{\"MASK_REVERSE\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK_SELECTONFOCUS\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"},\"MASK\":{\"default\":\"\",\"type\":\"STRING\",\"value\":\"\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "textnum") | |||
| .set("uid", "8060084f-286a-4f31-85a1-0998e8e171a2") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 3) | |||
| ) | |||
| @ -0,0 +1,88 @@ | |||
| /** | |||
| * | |||
| * CODE GENERATED AUTOMATICALLY | |||
| * | |||
| * THIS FILE SHOULD NOT BE EDITED BY HAND | |||
| * | |||
| */ | |||
| _form.createIfNotExists( | |||
| _val.init() | |||
| .set("big", false) | |||
| .set("control_active", true) | |||
| .set("control_group", false) | |||
| .set("control_user", false) | |||
| .set("displayname", "Farmacia") | |||
| .set("export_id", false) | |||
| .set("export_json", true) | |||
| .set("export_lastchange", false) | |||
| .set("export_uid", true) | |||
| .set("export_xls", true) | |||
| .set("export_xml", true) | |||
| .set("firebase", "") | |||
| .set("name", "farmacia_produto") | |||
| .set("parent_uid", "d912b013-cebb-499e-ad74-dce70bdd569f") | |||
| .set("report", false) | |||
| .set("show_id", true) | |||
| .set("uid", "7371be2c-0650-417f-a511-bba740c40196") | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "7371be2c-0650-417f-a511-bba740c40196", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Farmacia") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "farmacia_nova_tabela_id") | |||
| .set("notnull", false) | |||
| .set("primarykey", false) | |||
| .set("properties", "{\"MAX_COLUMN_LENGTH\":{\"default\":\"0\",\"type\":\"INTEGER\",\"value\":\"0\"},\"COLUMN_SEPARATOR\":{\"default\":\" - \",\"type\":\"LINK_SEPARATOR\",\"value\":\" - \"},\"LINK\":{\"default\":\"\",\"type\":\"LINK\",\"value\":\"farmacia:lab\"},\"SERVICE\":{\"default\":\"com/Select.netuno\",\"type\":\"STRING\",\"value\":\"com/Select.netuno\"},\"ONLY_ACTIVES\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "select") | |||
| .set("uid", "a4061b86-4f65-4d52-9eb0-26f4a7e30897") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 1) | |||
| ) | |||
| _form.createComponentIfNotExists( | |||
| "7371be2c-0650-417f-a511-bba740c40196", | |||
| _val.init() | |||
| .set("colspan", 0) | |||
| .set("displayname", "Produto") | |||
| .set("firebase", "") | |||
| .set("group_id", 0) | |||
| .set("height", 0) | |||
| .set("max", 0) | |||
| .set("min", 0) | |||
| .set("name", "produto_nova_tabela_id") | |||
| .set("notnull", false) | |||
| .set("primarykey", false) | |||
| .set("properties", "{\"MAX_COLUMN_LENGTH\":{\"default\":\"0\",\"type\":\"INTEGER\",\"value\":\"0\"},\"COLUMN_SEPARATOR\":{\"default\":\" - \",\"type\":\"LINK_SEPARATOR\",\"value\":\" - \"},\"LINK\":{\"default\":\"\",\"type\":\"LINK\",\"value\":\"produto:nome\"},\"SERVICE\":{\"default\":\"com/Select.netuno\",\"type\":\"STRING\",\"value\":\"com/Select.netuno\"},\"ONLY_ACTIVES\":{\"default\":\"false\",\"type\":\"BOOLEAN\",\"value\":\"false\"}}") | |||
| .set("rowspan", 0) | |||
| .set("tdheight", 0) | |||
| .set("tdwidth", 0) | |||
| .set("type", "select") | |||
| .set("uid", "972902d3-7485-47a1-ab8c-06c892d0c791") | |||
| .set("user_id", 0) | |||
| .set("whenedit", true) | |||
| .set("whenexport", true) | |||
| .set("whenfilter", true) | |||
| .set("whennew", true) | |||
| .set("whenresult", true) | |||
| .set("whenview", true) | |||
| .set("width", 0) | |||
| .set("x", 1) | |||
| .set("y", 2) | |||
| ) | |||
| @ -0,0 +1,24 @@ | |||
| <div class="row"> | |||
| <div class="col-lg-12"> | |||
| <div class="with-form"> | |||
| <h1 class="page-header"> | |||
| _{&lang=netuno.main.dashboard.title} | |||
| </h1> | |||
| </div> | |||
| <div class="no-form"> | |||
| <h1 class="page-header"> | |||
| _{&lang=netuno.main.dashboard.welcome_netuno} | |||
| </h1> | |||
| <p>_{&lang=netuno.main.dashboard.you_not_form}</p> | |||
| <p>_{&lang=netuno.main.dashboard.you_can_start_by_clicking_top_bar}</p> | |||
| <br> | |||
| <img src="_{netuno-config=url-styles}/build-button-tutorial.png" height="80"> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="app-dashboard"></div> | |||
| @ -0,0 +1,31 @@ | |||
| <div class="row"> | |||
| <div class="col-lg-12"> | |||
| <div class="with-form"> | |||
| <h1 class="page-header"> | |||
| _{&lang=netuno.main.dashboard.title} | |||
| </h1> | |||
| <p>_{&lang=netuno.main.dashboard.description}</p> | |||
| </div> | |||
| <div class="no-form"> | |||
| <h1 class="page-header"> | |||
| _{&lang=netuno.main.dashboard.welcome_netuno} | |||
| </h1> | |||
| <p>_{&lang=netuno.dev.main.you_not_form}</p> | |||
| <p>_{&lang=netuno.dev.main.you_can_start_by_clicking_top_bar}</p> | |||
| <br> | |||
| <img src="_{netuno-config=url-styles}/build-button-tutorial-dev.png" height="200"> | |||
| </div> | |||
| #macro(listFormItems $items) | |||
| <ul> | |||
| #foreach($item in $items) | |||
| <li> | |||
| <a href="#" netuno-dev-form="$item.getString('name')">$item.getString('text')</a> | |||
| #listFormItems($item.get('items')) | |||
| </li> | |||
| #end | |||
| </ul> | |||
| #end | |||
| #listFormItems($data.get('menu').get('forms')) | |||
| </div> | |||
| </div> | |||
| @ -0,0 +1 @@ | |||
| <script src="_{netuno-config=url-app-scripts}/main.js?_{util=requestuuid}"></script> | |||
| @ -0,0 +1 @@ | |||
| <link href='_{netuno-config=url-app-styles}/main.css' rel='stylesheet' /> | |||
| @ -0,0 +1 @@ | |||
| <link href='_{netuno-config=url-app-styles}/main.css' rel='stylesheet' /> | |||
| @ -0,0 +1,4 @@ | |||
| Secure data files comes here... | |||
| Only accessible for logged users! | |||
| @ -0,0 +1,2 @@ | |||
| Public storage files comes here... | |||
| @ -0,0 +1,4 @@ | |||
| Secure data files comes here... | |||
| Only accessible through server side! | |||
| @ -0,0 +1,9 @@ | |||
| { | |||
| "presets": [ | |||
| "@babel/preset-env", | |||
| "@babel/preset-react" | |||
| ], | |||
| "plugins": [ | |||
| ["import", { "libraryName": "antd", "style": true } ] | |||
| ] | |||
| } | |||
| @ -0,0 +1,18 @@ | |||
| node_modules/ | |||
| .DS_Store | |||
| *.log | |||
| .idea/ | |||
| .metadata/ | |||
| .vscode | |||
| package-lock.json | |||
| yarn.lock | |||
| .Trash | |||
| *~* | |||
| *#* | |||
| @ -0,0 +1,24 @@ | |||
| ### Install Packages | |||
| `npm install` | |||
| ### Watch changes and auto recompile | |||
| `npm run watch` | |||
| ### Installation requirements | |||
| On Windows with an Administrator terminal, run: | |||
| ``` | |||
| npm install --global --production windows-build-tools | |||
| npm install --global node-gyp | |||
| ``` | |||
| With others Python version, then configure the Python 2.7 path: | |||
| ``` | |||
| node-gyp --python /path/to/python2.7 | |||
| npm config set python /path/to/executable/python2.7 | |||
| ``` | |||
| @ -0,0 +1,36 @@ | |||
| { | |||
| "name": "public", | |||
| "version": "1.0.0", | |||
| "description": "", | |||
| "main": "index.js", | |||
| "scripts": { | |||
| "test": "echo \"Error: no test specified\" && exit 1", | |||
| "build": "webpack --mode production", | |||
| "watch": "webpack --mode development --watch" | |||
| }, | |||
| "keywords": [], | |||
| "author": "", | |||
| "license": "ISC", | |||
| "devDependencies": { | |||
| "@babel/core": "^7.9.0", | |||
| "@babel/plugin-proposal-object-rest-spread": "^7.9.0", | |||
| "@babel/preset-env": "^7.9.0", | |||
| "@babel/preset-react": "^7.9.4", | |||
| "babel-loader": "^8.1.0", | |||
| "babel-plugin-import": "^1.13.0", | |||
| "less": "^3.11.1", | |||
| "less-loader": "^5.0.0", | |||
| "css-loader": "^3.4.2", | |||
| "style-loader": "^1.1.3", | |||
| "prop-types": "^15.7.2", | |||
| "react": "^16.13.1", | |||
| "react-dom": "^16.13.1", | |||
| "webpack": "^4.42.1", | |||
| "webpack-cli": "^3.3.11" | |||
| }, | |||
| "dependencies": { | |||
| "antd": "^4.1.0", | |||
| "chart.js": "^2.9.3", | |||
| "react-chartjs-2": "^2.9.0" | |||
| } | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| import React from "react"; | |||
| import PropTypes from "prop-types"; | |||
| import Button from 'antd/lib/button'; | |||
| const MyButton = ({ buttonRef, text, click }) => ( | |||
| <div ref={ buttonRef }><Button type="primary" onClick={ click }> | |||
| { text } | |||
| </Button></div> | |||
| ); | |||
| MyButton.propTypes = { | |||
| buttonRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }), | |||
| text: PropTypes.string.isRequired, | |||
| click: PropTypes.func.isRequired | |||
| }; | |||
| export default MyButton; | |||
| @ -0,0 +1,58 @@ | |||
| import React, { useState, useEffect } from "react"; | |||
| import Table from 'antd/lib/table'; | |||
| import Column from "antd/lib/table/Column"; | |||
| import Tag from "antd/lib/tag"; | |||
| const columns = [ | |||
| { | |||
| title: "Tipo", | |||
| dataIndex: "tipo" | |||
| } | |||
| ]; | |||
| const TabelaCategoria = () => { | |||
| const [data, setData] = useState([]); | |||
| useEffect(() => { | |||
| const fail = () => { | |||
| this.setState({ loading: false }); | |||
| notification["error"]({ | |||
| message: 'Erro', | |||
| description: 'Tabela de Categoria com erros existentes', | |||
| style: { | |||
| marginTop: 100, | |||
| } | |||
| }); | |||
| }; | |||
| netuno.service({ | |||
| url: '/services/categorias', | |||
| method: 'POST', | |||
| credentials: 'include', | |||
| headers: { | |||
| 'Content-Type': 'application/json' | |||
| }, | |||
| success: (response) => { | |||
| if (response.json) { | |||
| setData(response.json); | |||
| } else { | |||
| fail(); | |||
| } | |||
| }, | |||
| fail: () => { | |||
| fail(); | |||
| } | |||
| }); | |||
| }, []); | |||
| return <Table columns={columns} dataSource={data} /> | |||
| }; | |||
| export default TabelaCategoria; | |||
| @ -0,0 +1,74 @@ | |||
| import React, { useState, useEffect } from "react"; | |||
| import PropTypes from "prop-types"; | |||
| import Modal from 'antd/lib/modal'; | |||
| import Spin from 'antd/lib/spin'; | |||
| import Typography from 'antd/lib/typography'; | |||
| const { Title } = Typography; | |||
| const StockBotao = ({ produto, onClose }) => { | |||
| const [ loading, setLoading ] = useState(false); | |||
| const [ data, setData ] = useState([]); | |||
| useEffect(() => { | |||
| setLoading(true); | |||
| const fail = ()=> { | |||
| setLoading(false); | |||
| notification["error"]({ | |||
| message: 'Lista de Stock', | |||
| description: 'Houve uma falha ao carregar o stock de produtos...', | |||
| style: { | |||
| marginTop: 100, | |||
| } | |||
| }); | |||
| }; | |||
| netuno.service({ | |||
| url: '/services/produtos', | |||
| method: 'POST', | |||
| credentials: 'include', | |||
| headers: { | |||
| 'Content-Type': 'application/json' | |||
| }, | |||
| body: JSON.stringify({ | |||
| uid: produto.uid | |||
| }), | |||
| success: (response)=> { | |||
| if (response.json) { | |||
| setData(response.json); | |||
| setLoading(false); | |||
| } else { | |||
| fail(); | |||
| } | |||
| }, | |||
| fail: ()=> { | |||
| fail(); | |||
| } | |||
| }); | |||
| }, []); | |||
| return <Modal | |||
| title="Produtos" | |||
| visible={true} | |||
| onOk={()=> { onClose() } } | |||
| onCancel={()=> { onClose() } }> | |||
| { loading && <Spin /> } | |||
| { data.length > 0 ? | |||
| data.map( | |||
| (item)=> ( | |||
| <div> | |||
| <Title level={3}>{item.nome}</Title> | |||
| <p>Categoria: {item.categoria}</p> | |||
| <p>Preco: {item.preco}</p> | |||
| <p>Stock: {item.stock}</p> | |||
| </div> | |||
| ) | |||
| ) | |||
| : <p>Não existe.</p> } | |||
| </Modal>; | |||
| }; | |||
| StockBotao.propTypes = { | |||
| produto: PropTypes.object.isRequired, | |||
| onClose: PropTypes.func.isRequired | |||
| }; | |||
| export default StockBotao; | |||
| @ -0,0 +1,86 @@ | |||
| import React, { useState, useEffect } from "react"; | |||
| import Table from 'antd/lib/table'; | |||
| import Column from "antd/lib/table/Column"; | |||
| import Tag from "antd/lib/tag"; | |||
| import Button from 'antd/lib/button'; | |||
| import StockBotao from "./StockBotao/index.jsx"; | |||
| const TabelaFarmacia = () => { | |||
| const [data, setData] = useState([]); | |||
| const [ stock, setStock ] = useState(null); | |||
| useEffect(() => { | |||
| const fail = () => { | |||
| this.setState({ loading: false }); | |||
| notification["error"]({ | |||
| message: 'Erro', | |||
| description: 'Tabela de Farmácia com erros...', | |||
| style: { | |||
| marginTop: 100, | |||
| } | |||
| }); | |||
| }; | |||
| netuno.service({ | |||
| url: '/services/farmacias', | |||
| method: 'GET', | |||
| credentials: 'include', | |||
| headers: { | |||
| 'Content-Type': 'application/json' | |||
| }, | |||
| success: (response) => { | |||
| if (response.json) { | |||
| setData(response.json); | |||
| } else { | |||
| fail(); | |||
| } | |||
| }, | |||
| fail: () => { | |||
| fail(); | |||
| } | |||
| }); | |||
| }, []); | |||
| const columns = [ | |||
| { | |||
| title: "Farmácia", | |||
| dataIndex: "lab" | |||
| }, | |||
| { | |||
| title: "Stock de Farmácias", | |||
| render: (text, record, index) => ( | |||
| <div> | |||
| { <Button onClick={ () => setStock(record) }>Ver Stock</Button>} | |||
| </div> | |||
| ) | |||
| } | |||
| ]; | |||
| return <> | |||
| { !!stock && <StockBotao | |||
| produto={stock} | |||
| onClose={ () => setStock(null) } | |||
| /> } | |||
| <Table dataSource={data} {... { columns}} /> | |||
| </> | |||
| }; | |||
| export default TabelaFarmacia; | |||
| @ -0,0 +1,72 @@ | |||
| import React, { useState, useEffect } from "react"; | |||
| import Table from 'antd/lib/table'; | |||
| import Column from "antd/lib/table/Column"; | |||
| import Tag from "antd/lib/tag"; | |||
| const columns = [ | |||
| { | |||
| title: "Nome", | |||
| dataIndex: "nome" | |||
| }, | |||
| { | |||
| title: "Categoria", | |||
| dataIndex: "categoria" | |||
| }, | |||
| { | |||
| title: "Stock", | |||
| dataIndex: "stock" | |||
| }, | |||
| { | |||
| title: "Preco", | |||
| dataIndex: "preco" | |||
| } | |||
| ]; | |||
| const TabelaProduto = () => { | |||
| const [data, setData] = useState([]); | |||
| useEffect(() => { | |||
| const fail = () => { | |||
| this.setState({ loading: false }); | |||
| notification["error"]({ | |||
| message: 'Erro', | |||
| description: 'Tabela dos Produtos com erros existentes', | |||
| style: { | |||
| marginTop: 100, | |||
| } | |||
| }); | |||
| }; | |||
| netuno.service({ | |||
| url: '/services/produtos', | |||
| method: 'POST', | |||
| credentials: 'include', | |||
| headers: { | |||
| 'Content-Type': 'application/json' | |||
| }, | |||
| success: (response) => { | |||
| if (response.json) { | |||
| setData(response.json); | |||
| } else { | |||
| fail(); | |||
| } | |||
| }, | |||
| fail: () => { | |||
| fail(); | |||
| } | |||
| }); | |||
| }, []); | |||
| return <Table columns={columns} dataSource={data} /> | |||
| }; | |||
| export default TabelaProduto; | |||
| @ -0,0 +1,60 @@ | |||
| import React, { Component } from "react"; | |||
| import MyButton from "../../components/MyButton/index.jsx"; | |||
| import "./index.less"; | |||
| // import { message } from 'antd'; | |||
| // import ListServices from "../ListServices/index.jsx"; | |||
| // import DataVisualization from "../DataVisualization/index.jsx"; | |||
| import TabelaProduto from "../../components/TabelaProdutos/index.jsx"; | |||
| import TabelaCategoria from "../../components/TabelaCategorias/index.jsx"; | |||
| import TabelaFarmacia from "../../components/TabelaFarmacia/index.jsx"; | |||
| export default class DashboardContainer extends Component { | |||
| constructor(props) { | |||
| super(props); | |||
| this.state = { | |||
| counter: 0, | |||
| // produto: [], | |||
| // categoria: [] | |||
| }; | |||
| this.button = React.createRef(); | |||
| this.click = this.click.bind(this); | |||
| } | |||
| componentWillMount() { | |||
| } | |||
| componentDidUpdate(prevProps, prevState, snapshot) { | |||
| $(this.button.current).fadeOut(250).fadeIn(250); | |||
| } | |||
| click() { | |||
| this.setState({ counter: this.state.counter + 1 }); | |||
| } | |||
| render() { | |||
| const { counter } = this.state; | |||
| return ( | |||
| <div className="my-dashboard"> | |||
| <TabelaProduto /> | |||
| <TabelaCategoria /> | |||
| <TabelaFarmacia /> | |||
| {/* <div className="my-dashboard__button"> | |||
| <MyButton mainRef={ this.button } text={ `ReactJS ⚡ Ant.Design 👉 Click me! ${ counter }` } click={ this.click } /> | |||
| </div> */} | |||
| </div> | |||
| ); | |||
| } | |||
| } | |||
| @ -0,0 +1,8 @@ | |||
| .my-dashboard { | |||
| width: 100%; | |||
| &__button { | |||
| padding: 80px; | |||
| text-align: center; | |||
| } | |||
| } | |||
| @ -0,0 +1,42 @@ | |||
| import React from "react"; | |||
| import ReactDOM from "react-dom"; | |||
| import DashboardContainer from "./containers/DashboardContainer/index.jsx"; | |||
| const dashboardDiv = document.getElementById("app-dashboard"); | |||
| const dashboardContainer = dashboardDiv ? ReactDOM.render(<DashboardContainer />, dashboardDiv) : false; | |||
| netuno.addNavigationLoad(() => { | |||
| $('[netuno-navigation]').find('a').on('netuno:click', (e)=> { | |||
| const link = $(e.target); | |||
| if (dashboardContainer && link.is('[netuno-navigation-dashboard]')) { | |||
| // Menu > Dashboard > Clicked! | |||
| } | |||
| }); | |||
| }); | |||
| netuno.addContentLoad((container) => { | |||
| // When any content is loaded dinamically this is executed... | |||
| if (container.is('[netuno-form-search="YOUR_FORM_NAME"]')) { | |||
| // When search page is loaded... | |||
| } else if (container.is('[netuno-form-edit="YOUR_FORM_NAME"]')) { | |||
| // When form edit is loaded... | |||
| } | |||
| }); | |||
| netuno.addPageLoad(() => { | |||
| // When page is loaded... | |||
| let modal = $('#app-dashboard-modal-form'); | |||
| modal.on('hidden.bs.modal', ()=> { | |||
| modal.find('[netuno-form-edit]').empty(); | |||
| }); | |||
| $('#app-dashboard-modal-form-button').on('click', ()=> { | |||
| modal.modal('show'); | |||
| netuno.loadFormEdit(modal.find('[netuno-form]')); | |||
| }); | |||
| modal.find('[netuno-form]').on('netuno:save', ()=> { | |||
| modal.modal('hide'); | |||
| }); | |||
| }); | |||
| @ -0,0 +1,4 @@ | |||
| /*** GLOBAL CSS ***/ | |||
| @import '~antd/dist/antd'; | |||
| @ -0,0 +1,81 @@ | |||
| const path = require('path'); | |||
| module.exports = { | |||
| entry: [ './src/index.jsx', './src/styles/main.less' ], | |||
| devtool: "source-map", | |||
| output: { | |||
| path: __dirname +'/../public/scripts', | |||
| filename: 'main.js' | |||
| }, | |||
| module: { | |||
| rules: [ | |||
| { | |||
| test: /\.jsx$/, | |||
| include: [ | |||
| path.resolve(__dirname, 'src') | |||
| ], | |||
| exclude: /node_modules/, | |||
| use: [{ | |||
| loader: 'babel-loader' | |||
| }] | |||
| }, | |||
| { | |||
| test: /\.js$/, | |||
| include: [ | |||
| path.resolve(__dirname, 'src') | |||
| ], | |||
| exclude: /node_modules/, | |||
| use: [{ | |||
| loader: 'babel-loader' | |||
| }] | |||
| }, | |||
| { | |||
| test: /\.less$/, | |||
| include: [ | |||
| path.resolve(__dirname, 'src') | |||
| ], | |||
| exclude: /node_modules/, | |||
| use: [ | |||
| { | |||
| loader: 'style-loader' // creates style nodes from JS strings | |||
| }, | |||
| { | |||
| loader: 'css-loader', // translates CSS into CommonJ, | |||
| options: { | |||
| sourceMap: true/*, | |||
| modules: { | |||
| mode: 'local', | |||
| localIdentName: "[local]___[hash:base64:5]", | |||
| context: path.resolve(__dirname, 'src'), | |||
| hashPrefix: 'app', | |||
| }*/ | |||
| } | |||
| }, | |||
| { | |||
| loader: 'less-loader', // compiles Less to CSS | |||
| options: { | |||
| modifyVars: { | |||
| 'primary-color': '#5b5ce1', | |||
| 'link-color': '#5b5ce1', | |||
| 'border-radius-base': '5px' | |||
| }, | |||
| javascriptEnabled: true | |||
| } | |||
| } | |||
| ] | |||
| }, | |||
| { | |||
| test: /\.css$/, | |||
| include: [ | |||
| path.resolve(__dirname, 'src') | |||
| ], | |||
| exclude: /node_modules/, | |||
| use: [ | |||
| 'style-loader', | |||
| 'css-loader' | |||
| ] | |||
| } | |||
| ] | |||
| } | |||
| }; | |||