@msrajawat298/do-graphs 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +1 -1
  2. package/dist/App.js +124 -124
  3. package/dist/App.test.js +8 -8
  4. package/dist/Components/Charts/Bar/Form.js +231 -231
  5. package/dist/Components/Charts/Bar/Format.js +43 -43
  6. package/dist/Components/Charts/Bar/index.js +106 -106
  7. package/dist/Components/Charts/DoughnutAndPie/Form.js +232 -232
  8. package/dist/Components/Charts/DoughnutAndPie/Format.js +52 -52
  9. package/dist/Components/Charts/DoughnutAndPie/index.js +106 -106
  10. package/dist/Components/Charts/DrawGraph.js +32 -32
  11. package/dist/Components/Charts/Line/Form.js +231 -231
  12. package/dist/Components/Charts/Line/Format.js +47 -47
  13. package/dist/Components/Charts/Line/index.js +106 -106
  14. package/dist/Components/Charts/MixedChart/index.js +107 -107
  15. package/dist/Components/Charts/Options.js +139 -139
  16. package/dist/Components/Charts/PolarArea/Form.js +225 -225
  17. package/dist/Components/Charts/PolarArea/Format.js +42 -42
  18. package/dist/Components/Charts/PolarArea/index.js +106 -106
  19. package/dist/Components/Charts/Progess/Form.js +107 -107
  20. package/dist/Components/Charts/Progess/index.js +119 -119
  21. package/dist/Components/Charts/Scatter/Form.js +225 -225
  22. package/dist/Components/Charts/Scatter/Format.js +45 -45
  23. package/dist/Components/Charts/Scatter/index.js +106 -106
  24. package/dist/Components/Charts/Table/Form.js +70 -70
  25. package/dist/Components/Charts/Table/Styles.js +27 -27
  26. package/dist/Components/Charts/Table/index.js +56 -56
  27. package/dist/Components/Common/CustomComponent/index.js +83 -83
  28. package/dist/Components/Common/Menu/DynamicMenu/List.js +43 -43
  29. package/dist/Components/Common/Menu/DynamicMenu/index.js +155 -155
  30. package/dist/Components/Common/Menu/index.js +24 -24
  31. package/dist/Components/Common/Model/Model.js +56 -56
  32. package/dist/Components/Common/MultipleSelectDropdown/index.js +124 -124
  33. package/dist/Components/Common/NotFound/index.js +19 -19
  34. package/dist/Components/Common/Title/Form.js +36 -36
  35. package/dist/Components/Common/Title/Styles.js +16 -16
  36. package/dist/Components/Common/Title/index.js +41 -41
  37. package/dist/Components/Common/Widget/index.js +407 -407
  38. package/dist/Pages/Dashboard/CreatePage.js +115 -115
  39. package/dist/Pages/Dashboard/index.js +150 -150
  40. package/dist/Pages/LayoutPages/index.js +143 -143
  41. package/dist/Pages/Layouts/index.js +52 -52
  42. package/dist/Services/Menu.js +58 -58
  43. package/dist/Services/Routing.js +80 -80
  44. package/dist/Utility/Contexts.js +20 -20
  45. package/dist/Utility/Main.js +368 -368
  46. package/dist/Utility/Routes.js +10 -10
  47. package/dist/index.js +15 -15
  48. package/dist/reportWebVitals.js +13 -13
  49. package/dist/setupTests.js +5 -5
  50. package/package.json +4 -3
  51. package/dist/Assets/Fonts/NotoSans-Bold.ttf +0 -0
  52. package/dist/Assets/Fonts/NotoSans-Medium.ttf +0 -0
  53. package/dist/Assets/Fonts/NotoSans-Regular.ttf +0 -0
  54. package/dist/Assets/Fonts/NotoSans-SemiBold.ttf +0 -0
  55. package/dist/Assets/Images/analytic-graph.png +0 -0
  56. package/dist/Assets/Images/bar-graph.png +0 -0
  57. package/dist/Assets/Images/bubble-chart.png +0 -0
  58. package/dist/Assets/Images/coding.png +0 -0
  59. package/dist/Assets/Images/doughnut.png +0 -0
  60. package/dist/Assets/Images/horizontal-bar-graph.png +0 -0
  61. package/dist/Assets/Images/line-chart.png +0 -0
  62. package/dist/Assets/Images/mixed-chart.png +0 -0
  63. package/dist/Assets/Images/pie-chart.png +0 -0
  64. package/dist/Assets/Images/polar-chart.png +0 -0
  65. package/dist/Assets/Images/progress-bar.png +0 -0
  66. package/dist/Assets/Images/scatter-graph.png +0 -0
  67. package/dist/Assets/Images/table.png +0 -0
  68. package/dist/Assets/Images/travel.png +0 -0
@@ -1,115 +1,115 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
- if (ar || !(i in from)) {
51
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
- ar[i] = from[i];
53
- }
54
- }
55
- return to.concat(ar || Array.prototype.slice.call(from));
56
- };
57
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
58
- import { useContext, useState } from "react";
59
- import './CreatePage.css';
60
- import { create } from "../../Services/Routing";
61
- import { toast } from "react-toastify";
62
- import { PopUpContext } from "../../Utility/Contexts";
63
- export var CreatePage = function (props) {
64
- var _a;
65
- var _b = useState(props === null || props === void 0 ? void 0 : props.data), data = _b[0], setData = _b[1];
66
- var _c = useContext(PopUpContext), setshowPopup = _c.setshowPopup, setRoutePages = _c.setRoutePages, routePages = _c.routePages;
67
- var handleChange = function (e) {
68
- var _a;
69
- var _b = e.target, name = _b.name, value = _b.value;
70
- if (name === 'title') {
71
- data['title'] = __assign(__assign({}, data['title']), { name: value });
72
- setData(__assign({}, data));
73
- }
74
- else {
75
- setData(__assign(__assign({}, data), (_a = {}, _a[name] = value, _a)));
76
- }
77
- };
78
- var handleSubmit = function (e) { return __awaiter(void 0, void 0, void 0, function () {
79
- var config, result, obj, getIds, getMaxId, error_1;
80
- return __generator(this, function (_a) {
81
- switch (_a.label) {
82
- case 0:
83
- e.preventDefault();
84
- _a.label = 1;
85
- case 1:
86
- _a.trys.push([1, 4, , 5]);
87
- if (!((data === null || data === void 0 ? void 0 : data.title) && (data === null || data === void 0 ? void 0 : data.route))) return [3 /*break*/, 3];
88
- config = {
89
- method: 'POST',
90
- body: JSON.stringify(data),
91
- headers: __assign({ "Content-Type": "application/json" }, props === null || props === void 0 ? void 0 : props.headers)
92
- };
93
- return [4 /*yield*/, create(props === null || props === void 0 ? void 0 : props.backendUrl, config)];
94
- case 2:
95
- result = _a.sent();
96
- toast.success(result === null || result === void 0 ? void 0 : result.message);
97
- obj = data;
98
- getIds = (routePages === null || routePages === void 0 ? void 0 : routePages.map(function (it) { return it === null || it === void 0 ? void 0 : it.id; })) || [];
99
- getMaxId = (getIds === null || getIds === void 0 ? void 0 : getIds.length) > 0 ? Math.max.apply(Math, getIds) : 0;
100
- obj['id'] = (result === null || result === void 0 ? void 0 : result.id) || getMaxId + 1;
101
- setRoutePages(__spreadArray(__spreadArray([], routePages, true), [obj], false));
102
- setshowPopup(false);
103
- _a.label = 3;
104
- case 3: return [3 /*break*/, 5];
105
- case 4:
106
- error_1 = _a.sent();
107
- toast.error(error_1 === null || error_1 === void 0 ? void 0 : error_1.toString());
108
- return [3 /*break*/, 5];
109
- case 5: return [2 /*return*/];
110
- }
111
- });
112
- }); };
113
- return (_jsxs("div", __assign({ className: "crt-pge-st col-md-6" }, { children: [_jsxs("div", __assign({ className: "form-group" }, { children: [_jsx("label", { children: "Title:" }), _jsx("input", { type: "text", name: "title", className: "form-control", value: (_a = data === null || data === void 0 ? void 0 : data.title) === null || _a === void 0 ? void 0 : _a.name, onChange: function (e) { return handleChange(e); } })] })), _jsxs("div", __assign({ className: "form-group" }, { children: [_jsx("label", { children: "Route:" }), _jsx("input", { type: "text", name: "route", className: "form-control", value: data === null || data === void 0 ? void 0 : data.route, onChange: function (e) { return handleChange(e); } })] })), _jsx("div", __assign({ className: "button" }, { children: _jsx("button", __assign({ className: "btn add-btn", onClick: function (e) { return handleSubmit(e); } }, { children: "Submit" })) }))] })));
114
- };
115
- export default CreatePage;
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
57
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
58
+ import { useContext, useState } from "react";
59
+ import './CreatePage.css';
60
+ import { create } from "../../Services/Routing";
61
+ import { toast } from "react-toastify";
62
+ import { PopUpContext } from "../../Utility/Contexts";
63
+ export var CreatePage = function (props) {
64
+ var _a;
65
+ var _b = useState(props === null || props === void 0 ? void 0 : props.data), data = _b[0], setData = _b[1];
66
+ var _c = useContext(PopUpContext), setshowPopup = _c.setshowPopup, setRoutePages = _c.setRoutePages, routePages = _c.routePages;
67
+ var handleChange = function (e) {
68
+ var _a;
69
+ var _b = e.target, name = _b.name, value = _b.value;
70
+ if (name === 'title') {
71
+ data['title'] = __assign(__assign({}, data['title']), { name: value });
72
+ setData(__assign({}, data));
73
+ }
74
+ else {
75
+ setData(__assign(__assign({}, data), (_a = {}, _a[name] = value, _a)));
76
+ }
77
+ };
78
+ var handleSubmit = function (e) { return __awaiter(void 0, void 0, void 0, function () {
79
+ var config, result, obj, getIds, getMaxId, error_1;
80
+ return __generator(this, function (_a) {
81
+ switch (_a.label) {
82
+ case 0:
83
+ e.preventDefault();
84
+ _a.label = 1;
85
+ case 1:
86
+ _a.trys.push([1, 4, , 5]);
87
+ if (!((data === null || data === void 0 ? void 0 : data.title) && (data === null || data === void 0 ? void 0 : data.route))) return [3 /*break*/, 3];
88
+ config = {
89
+ method: 'POST',
90
+ body: JSON.stringify(data),
91
+ headers: __assign({ "Content-Type": "application/json" }, props === null || props === void 0 ? void 0 : props.headers)
92
+ };
93
+ return [4 /*yield*/, create(props === null || props === void 0 ? void 0 : props.backendUrl, config)];
94
+ case 2:
95
+ result = _a.sent();
96
+ toast.success(result === null || result === void 0 ? void 0 : result.message);
97
+ obj = data;
98
+ getIds = (routePages === null || routePages === void 0 ? void 0 : routePages.map(function (it) { return it === null || it === void 0 ? void 0 : it.id; })) || [];
99
+ getMaxId = (getIds === null || getIds === void 0 ? void 0 : getIds.length) > 0 ? Math.max.apply(Math, getIds) : 0;
100
+ obj['id'] = (result === null || result === void 0 ? void 0 : result.id) || getMaxId + 1;
101
+ setRoutePages(__spreadArray(__spreadArray([], routePages, true), [obj], false));
102
+ setshowPopup(false);
103
+ _a.label = 3;
104
+ case 3: return [3 /*break*/, 5];
105
+ case 4:
106
+ error_1 = _a.sent();
107
+ toast.error(error_1 === null || error_1 === void 0 ? void 0 : error_1.toString());
108
+ return [3 /*break*/, 5];
109
+ case 5: return [2 /*return*/];
110
+ }
111
+ });
112
+ }); };
113
+ return (_jsxs("div", __assign({ className: "crt-pge-st col-md-6" }, { children: [_jsxs("div", __assign({ className: "form-group" }, { children: [_jsx("label", { children: "Title:" }), _jsx("input", { type: "text", name: "title", className: "form-control", value: (_a = data === null || data === void 0 ? void 0 : data.title) === null || _a === void 0 ? void 0 : _a.name, onChange: function (e) { return handleChange(e); } })] })), _jsxs("div", __assign({ className: "form-group" }, { children: [_jsx("label", { children: "Route:" }), _jsx("input", { type: "text", name: "route", className: "form-control", value: data === null || data === void 0 ? void 0 : data.route, onChange: function (e) { return handleChange(e); } })] })), _jsx("div", __assign({ className: "button" }, { children: _jsx("button", __assign({ className: "btn add-btn", onClick: function (e) { return handleSubmit(e); } }, { children: "Submit" })) }))] })));
114
+ };
115
+ export default CreatePage;
@@ -1,150 +1,150 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
- if (ar || !(i in from)) {
51
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
- ar[i] = from[i];
53
- }
54
- }
55
- return to.concat(ar || Array.prototype.slice.call(from));
56
- };
57
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
58
- import { faFile, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
59
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
60
- import { useContext, useEffect, useState } from 'react';
61
- import './index.css';
62
- import { faPlusCircle, faSearch } from '@fortawesome/free-solid-svg-icons';
63
- import { GraphConfigs, ModelTypes, Modules } from '../../Utility/Main';
64
- import { PopUpContext, RouteContext } from '../../Utility/Contexts';
65
- import Model from '../../Components/Common/Model/Model';
66
- import { deletePageById } from '../../Services/Routing';
67
- import { useNavigate } from 'react-router-dom';
68
- import { toast } from 'react-toastify';
69
- import Menu from '../../Components/Common/Menu';
70
- import { LayoutTitleStyles } from '../../Components/Common/Title/Styles';
71
- export var CustomDashboard = function (_a) {
72
- var routeBackendUrl = _a.routeBackendUrl, isMenuLayoutPresent = _a.isMenuLayoutPresent, headers = _a.headers;
73
- var navigate = useNavigate();
74
- var _b = useContext(RouteContext), routePages = _b.routePages, setRoutePages = _b.setRoutePages;
75
- var _c = useState(false), showPopup = _c[0], setshowPopup = _c[1];
76
- var _d = useState([]), searchedResult = _d[0], setSearchedResult = _d[1];
77
- var _e = useState({
78
- headTitle: '',
79
- module: '',
80
- data: {},
81
- type: ''
82
- }), modelData = _e[0], setModelData = _e[1];
83
- var srchStr = '';
84
- var _f = useState({
85
- title: {
86
- name: '',
87
- customStyles: LayoutTitleStyles()
88
- },
89
- route: '',
90
- component: [],
91
- menu_id: null
92
- }), page = _f[0], setPage = _f[1];
93
- var showForm = function (formName, title, data, type) {
94
- setshowPopup(true);
95
- setModelData({
96
- headTitle: title,
97
- module: formName,
98
- data: data,
99
- type: type
100
- });
101
- };
102
- var deletePage = function (id) { return __awaiter(void 0, void 0, void 0, function () {
103
- var config, result, findById, getIndex, error_1;
104
- return __generator(this, function (_a) {
105
- switch (_a.label) {
106
- case 0:
107
- _a.trys.push([0, 2, , 3]);
108
- config = { method: 'DELETE', headers: __assign({}, headers) };
109
- return [4 /*yield*/, deletePageById(routeBackendUrl, config, id)];
110
- case 1:
111
- result = _a.sent();
112
- if ((result === null || result === void 0 ? void 0 : result.status) === 'OK') {
113
- findById = routePages.find(function (it) { return (it === null || it === void 0 ? void 0 : it.id) === id; });
114
- getIndex = routePages.indexOf(findById);
115
- routePages.splice(getIndex, 1);
116
- setRoutePages(__spreadArray([], routePages, true));
117
- toast.success(result === null || result === void 0 ? void 0 : result.message);
118
- }
119
- return [3 /*break*/, 3];
120
- case 2:
121
- error_1 = _a.sent();
122
- toast.error(error_1 === null || error_1 === void 0 ? void 0 : error_1.toString());
123
- return [3 /*break*/, 3];
124
- case 3: return [2 /*return*/];
125
- }
126
- });
127
- }); };
128
- var handleChange = function (e) {
129
- var _a, _b;
130
- var value = e.target.value;
131
- srchStr = value;
132
- var arr = [];
133
- for (var i = 0; i < (routePages === null || routePages === void 0 ? void 0 : routePages.length); i++) {
134
- var srchLwr = srchStr === null || srchStr === void 0 ? void 0 : srchStr.toLowerCase();
135
- if ((_b = (_a = routePages[i]['title']['name']) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(srchLwr)) {
136
- arr.push(routePages[i]);
137
- }
138
- }
139
- setSearchedResult(arr);
140
- };
141
- useEffect(function () { }, [routePages]);
142
- return (_jsx(PopUpContext.Provider, __assign({ value: { showPopup: showPopup, setshowPopup: setshowPopup, modelData: modelData, setModelData: setModelData, routePages: routePages, setRoutePages: setRoutePages } }, { children: _jsxs("div", __assign({ className: 'container w-1400' }, { children: [_jsxs("div", __assign({ className: 'row mar-0' }, { children: [!isMenuLayoutPresent && _jsx("div", __assign({ className: 'col-md-2' }, { children: _jsx(Menu, {}) })), _jsx("div", __assign({ className: "".concat(isMenuLayoutPresent ? 'col-md-12' : 'col-md-10', " pad-l-0") }, { children: _jsxs("div", __assign({ className: 'dashboard-section' }, { children: [_jsx("h5", __assign({ className: 'd-title' }, { children: "Dashboard" })), _jsxs("div", __assign({ className: 'dashboard-page-srch' }, { children: [_jsx("input", { type: 'text', name: 'page', className: 'form-control', placeholder: 'search page..', onChange: function (e) { return handleChange(e); } }), _jsx("button", __assign({ className: 'btn srch-icon' }, { children: _jsx(FontAwesomeIcon, { icon: faSearch }) }))] })), _jsxs("div", __assign({ className: 'dashboard-page-lists' }, { children: [_jsx("h5", { children: "Pages" }), _jsxs("ul", __assign({ className: 'list-unstyled row mar-0' }, { children: [_jsx("li", __assign({ className: 'col-md-2', style: { cursor: 'pointer' }, onClick: function () { return showForm(Modules.DASHBOARD, 'Create New Page', page, ModelTypes.FORM); } }, { children: _jsxs("div", __assign({ className: 'create-page-section' }, { children: [_jsx(FontAwesomeIcon, { icon: faPlusCircle, className: 'icon', size: '2x', color: GraphConfigs.DEFAULT_BGCOLOR[1] }), _jsx("p", { children: "Create Page" })] })) })), (searchedResult === null || searchedResult === void 0 ? void 0 : searchedResult.length) > 0 ? searchedResult === null || searchedResult === void 0 ? void 0 : searchedResult.map(function (it, n) {
143
- var _a;
144
- return (_jsx("li", __assign({ className: 'col-md-2' }, { children: _jsxs("div", __assign({ className: 'pg-lst' }, { children: [_jsx(FontAwesomeIcon, { icon: faFile, className: 'icon', size: '2x', onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }), " ", _jsx("p", __assign({ onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }, { children: (_a = it === null || it === void 0 ? void 0 : it.title) === null || _a === void 0 ? void 0 : _a.name })), " ", _jsx(FontAwesomeIcon, { icon: faTrashAlt, color: 'red', cursor: 'pointer', className: 'pge-dlte', onClick: function () { return deletePage(it === null || it === void 0 ? void 0 : it.id); } }), " "] })) }), n));
145
- }) : (routePages === null || routePages === void 0 ? void 0 : routePages.length) > 0 && (routePages === null || routePages === void 0 ? void 0 : routePages.map(function (it, n) {
146
- var _a;
147
- return (_jsx("li", __assign({ className: 'col-md-2' }, { children: _jsxs("div", __assign({ className: 'pg-lst' }, { children: [_jsx(FontAwesomeIcon, { icon: faFile, className: 'icon', size: '2x', onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }), " ", _jsx("p", __assign({ onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }, { children: (_a = it === null || it === void 0 ? void 0 : it.title) === null || _a === void 0 ? void 0 : _a.name })), " ", _jsx(FontAwesomeIcon, { icon: faTrashAlt, color: 'red', cursor: 'pointer', className: 'pge-dlte', onClick: function () { return deletePage(it === null || it === void 0 ? void 0 : it.id); } }), " "] })) }), n));
148
- }))] }))] }))] })) }))] })), showPopup && _jsx(Model, { headTitle: modelData === null || modelData === void 0 ? void 0 : modelData.headTitle, module: modelData === null || modelData === void 0 ? void 0 : modelData.module, data: modelData === null || modelData === void 0 ? void 0 : modelData.data, type: modelData === null || modelData === void 0 ? void 0 : modelData.type, backendUrl: routeBackendUrl, headers: headers })] })) })));
149
- };
150
- export default CustomDashboard;
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
57
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
58
+ import { faFile, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
59
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
60
+ import { useContext, useEffect, useState } from 'react';
61
+ import './index.css';
62
+ import { faPlusCircle, faSearch } from '@fortawesome/free-solid-svg-icons';
63
+ import { GraphConfigs, ModelTypes, Modules } from '../../Utility/Main';
64
+ import { PopUpContext, RouteContext } from '../../Utility/Contexts';
65
+ import Model from '../../Components/Common/Model/Model';
66
+ import { deletePageById } from '../../Services/Routing';
67
+ import { useNavigate } from 'react-router-dom';
68
+ import { toast } from 'react-toastify';
69
+ import Menu from '../../Components/Common/Menu';
70
+ import { LayoutTitleStyles } from '../../Components/Common/Title/Styles';
71
+ export var CustomDashboard = function (_a) {
72
+ var routeBackendUrl = _a.routeBackendUrl, isMenuLayoutPresent = _a.isMenuLayoutPresent, headers = _a.headers;
73
+ var navigate = useNavigate();
74
+ var _b = useContext(RouteContext), routePages = _b.routePages, setRoutePages = _b.setRoutePages;
75
+ var _c = useState(false), showPopup = _c[0], setshowPopup = _c[1];
76
+ var _d = useState([]), searchedResult = _d[0], setSearchedResult = _d[1];
77
+ var _e = useState({
78
+ headTitle: '',
79
+ module: '',
80
+ data: {},
81
+ type: ''
82
+ }), modelData = _e[0], setModelData = _e[1];
83
+ var srchStr = '';
84
+ var _f = useState({
85
+ title: {
86
+ name: '',
87
+ customStyles: LayoutTitleStyles()
88
+ },
89
+ route: '',
90
+ component: [],
91
+ menu_id: null
92
+ }), page = _f[0], setPage = _f[1];
93
+ var showForm = function (formName, title, data, type) {
94
+ setshowPopup(true);
95
+ setModelData({
96
+ headTitle: title,
97
+ module: formName,
98
+ data: data,
99
+ type: type
100
+ });
101
+ };
102
+ var deletePage = function (id) { return __awaiter(void 0, void 0, void 0, function () {
103
+ var config, result, findById, getIndex, error_1;
104
+ return __generator(this, function (_a) {
105
+ switch (_a.label) {
106
+ case 0:
107
+ _a.trys.push([0, 2, , 3]);
108
+ config = { method: 'DELETE', headers: __assign({}, headers) };
109
+ return [4 /*yield*/, deletePageById(routeBackendUrl, config, id)];
110
+ case 1:
111
+ result = _a.sent();
112
+ if ((result === null || result === void 0 ? void 0 : result.status) === 'OK') {
113
+ findById = routePages.find(function (it) { return (it === null || it === void 0 ? void 0 : it.id) === id; });
114
+ getIndex = routePages.indexOf(findById);
115
+ routePages.splice(getIndex, 1);
116
+ setRoutePages(__spreadArray([], routePages, true));
117
+ toast.success(result === null || result === void 0 ? void 0 : result.message);
118
+ }
119
+ return [3 /*break*/, 3];
120
+ case 2:
121
+ error_1 = _a.sent();
122
+ toast.error(error_1 === null || error_1 === void 0 ? void 0 : error_1.toString());
123
+ return [3 /*break*/, 3];
124
+ case 3: return [2 /*return*/];
125
+ }
126
+ });
127
+ }); };
128
+ var handleChange = function (e) {
129
+ var _a, _b;
130
+ var value = e.target.value;
131
+ srchStr = value;
132
+ var arr = [];
133
+ for (var i = 0; i < (routePages === null || routePages === void 0 ? void 0 : routePages.length); i++) {
134
+ var srchLwr = srchStr === null || srchStr === void 0 ? void 0 : srchStr.toLowerCase();
135
+ if ((_b = (_a = routePages[i]['title']['name']) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes(srchLwr)) {
136
+ arr.push(routePages[i]);
137
+ }
138
+ }
139
+ setSearchedResult(arr);
140
+ };
141
+ useEffect(function () { }, [routePages]);
142
+ return (_jsx(PopUpContext.Provider, __assign({ value: { showPopup: showPopup, setshowPopup: setshowPopup, modelData: modelData, setModelData: setModelData, routePages: routePages, setRoutePages: setRoutePages } }, { children: _jsxs("div", __assign({ className: 'container w-1400' }, { children: [_jsxs("div", __assign({ className: 'row mar-0' }, { children: [!isMenuLayoutPresent && _jsx("div", __assign({ className: 'col-md-2' }, { children: _jsx(Menu, {}) })), _jsx("div", __assign({ className: "".concat(isMenuLayoutPresent ? 'col-md-12' : 'col-md-10', " pad-l-0") }, { children: _jsxs("div", __assign({ className: 'dashboard-section' }, { children: [_jsx("h5", __assign({ className: 'd-title' }, { children: "Dashboard" })), _jsxs("div", __assign({ className: 'dashboard-page-srch' }, { children: [_jsx("input", { type: 'text', name: 'page', className: 'form-control', placeholder: 'search page..', onChange: function (e) { return handleChange(e); } }), _jsx("button", __assign({ className: 'btn srch-icon' }, { children: _jsx(FontAwesomeIcon, { icon: faSearch }) }))] })), _jsxs("div", __assign({ className: 'dashboard-page-lists' }, { children: [_jsx("h5", { children: "Pages" }), _jsxs("ul", __assign({ className: 'list-unstyled row mar-0' }, { children: [_jsx("li", __assign({ className: 'col-md-2', style: { cursor: 'pointer' }, onClick: function () { return showForm(Modules.DASHBOARD, 'Create New Page', page, ModelTypes.FORM); } }, { children: _jsxs("div", __assign({ className: 'create-page-section' }, { children: [_jsx(FontAwesomeIcon, { icon: faPlusCircle, className: 'icon', size: '2x', color: GraphConfigs.DEFAULT_BGCOLOR[1] }), _jsx("p", { children: "Create Page" })] })) })), (searchedResult === null || searchedResult === void 0 ? void 0 : searchedResult.length) > 0 ? searchedResult === null || searchedResult === void 0 ? void 0 : searchedResult.map(function (it, n) {
143
+ var _a;
144
+ return (_jsx("li", __assign({ className: 'col-md-2' }, { children: _jsxs("div", __assign({ className: 'pg-lst' }, { children: [_jsx(FontAwesomeIcon, { icon: faFile, className: 'icon', size: '2x', onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }), " ", _jsx("p", __assign({ onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }, { children: (_a = it === null || it === void 0 ? void 0 : it.title) === null || _a === void 0 ? void 0 : _a.name })), " ", _jsx(FontAwesomeIcon, { icon: faTrashAlt, color: 'red', cursor: 'pointer', className: 'pge-dlte', onClick: function () { return deletePage(it === null || it === void 0 ? void 0 : it.id); } }), " "] })) }), n));
145
+ }) : (routePages === null || routePages === void 0 ? void 0 : routePages.length) > 0 && (routePages === null || routePages === void 0 ? void 0 : routePages.map(function (it, n) {
146
+ var _a;
147
+ return (_jsx("li", __assign({ className: 'col-md-2' }, { children: _jsxs("div", __assign({ className: 'pg-lst' }, { children: [_jsx(FontAwesomeIcon, { icon: faFile, className: 'icon', size: '2x', onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }), " ", _jsx("p", __assign({ onClick: function () { return navigate("/layout/".concat(it === null || it === void 0 ? void 0 : it.id)); } }, { children: (_a = it === null || it === void 0 ? void 0 : it.title) === null || _a === void 0 ? void 0 : _a.name })), " ", _jsx(FontAwesomeIcon, { icon: faTrashAlt, color: 'red', cursor: 'pointer', className: 'pge-dlte', onClick: function () { return deletePage(it === null || it === void 0 ? void 0 : it.id); } }), " "] })) }), n));
148
+ }))] }))] }))] })) }))] })), showPopup && _jsx(Model, { headTitle: modelData === null || modelData === void 0 ? void 0 : modelData.headTitle, module: modelData === null || modelData === void 0 ? void 0 : modelData.module, data: modelData === null || modelData === void 0 ? void 0 : modelData.data, type: modelData === null || modelData === void 0 ? void 0 : modelData.type, backendUrl: routeBackendUrl, headers: headers })] })) })));
149
+ };
150
+ export default CustomDashboard;