eleven-solutions-common-website-unique-web 10.0.10 → 10.0.12
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.
- package/dist/components/admin/Taxionomies.d.ts +4 -1
- package/dist/components/admin/Taxionomies.js +3 -3
- package/dist/components/admin/TaxonomyForm.d.ts +4 -1
- package/dist/components/admin/TaxonomyForm.js +21 -25
- package/dist/components/admin/Template.d.ts +4 -1
- package/dist/components/admin/Template.js +3 -3
- package/dist/components/admin/TemplateForm.d.ts +4 -1
- package/dist/components/admin/TemplateForm.js +4 -4
- package/dist/components/admin/UserForm.d.ts +4 -1
- package/dist/components/admin/UserForm.js +4 -4
- package/dist/components/admin/Users.d.ts +4 -1
- package/dist/components/admin/Users.js +6 -6
- package/dist/components/api/taxonomy.d.ts +8 -8
- package/dist/components/api/taxonomy.js +16 -16
- package/dist/components/api/template.d.ts +5 -5
- package/dist/components/api/template.js +10 -10
- package/dist/components/api/user.d.ts +5 -5
- package/dist/components/api/user.js +10 -10
- package/package.json +1 -1
- package/src/components/admin/Taxionomies.tsx +7 -3
- package/src/components/admin/TaxonomyForm.tsx +24 -20
- package/src/components/admin/Template.tsx +7 -3
- package/src/components/admin/TemplateForm.tsx +8 -4
- package/src/components/admin/UserForm.tsx +8 -4
- package/src/components/admin/Users.tsx +9 -4
- package/src/components/api/taxonomy.ts +16 -12
- package/src/components/api/template.ts +18 -16
- package/src/components/api/user.ts +11 -8
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { useState, useEffect } from "react";
|
12
12
|
import { FaPlus } from "react-icons/fa";
|
13
13
|
import { fetchTaxonomiessApi } from "../api/taxonomy";
|
14
|
-
const Taxionomies = () => {
|
14
|
+
const Taxionomies = ({ url }) => {
|
15
15
|
const [taxonomy, setTaxonomy] = useState([]);
|
16
16
|
const fetchTaxonomiesData = () => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
-
const data = yield fetchTaxonomiessApi();
|
17
|
+
const data = yield fetchTaxonomiessApi(url);
|
18
18
|
if (data) {
|
19
19
|
const uniqueTaxonomies = data.reduce((acc, item) => {
|
20
20
|
if (!item.parentId &&
|
@@ -62,7 +62,7 @@ const Taxionomies = () => {
|
|
62
62
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
63
63
|
};
|
64
64
|
return (_jsxs("div", { className: "container px-4 mx-auto mt-6 h-full", children: [_jsx("div", { className: "w-3/4", children: _jsx("h1", { className: "text-3xl font-bold text-blue-600 mb-5", children: "Taxonomy" }) }), _jsx("div", { className: "flex-grow ml-0 w-full mt-10", children: _jsxs("form", { className: "w-full ", children: [_jsx("label", { htmlFor: "default-search", className: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white", children: "Search" }), _jsxs("div", { className: "relative w-full", children: [_jsx("div", { className: "absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none", children: _jsx("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: _jsx("path", { stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" }) }) }), _jsx("input", { type: "search", id: "default-search", className: "inline-block min-w-full p-3 ps-10 outline-none text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500", placeholder: "Search Taxonomies", required: true }), _jsx("button", { type: "submit", className: "text-white absolute end-1.5 bottom-1.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", children: "Search" })] })] }) }), _jsx("div", { className: "flex-grow ml-0 w-3/4", children: _jsx("form", { className: "w-auto" }) }), _jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" }), _jsx("th", { scope: "col", className: "py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Type" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900", children: paginatedTaxonomies
|
65
|
-
.filter((taxonomy) => taxonomy.isView)
|
65
|
+
.filter((taxonomy) => taxonomy.isView)
|
66
66
|
.map((taxonomy, index) => (_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsx("div", { className: "flex items-center gap-x-6", children: taxonomy.isEdit ? (_jsx("button", { type: "button", onClick: (event) => {
|
67
67
|
handleViewClick(event, "/admin/taxinomies/taxonomyform?", taxonomy.id, taxonomy.type);
|
68
68
|
}, className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) })) : taxonomy.isView ? (_jsx("button", { onClick: (event) => {
|
@@ -12,7 +12,7 @@ import React from "react";
|
|
12
12
|
import { useState, useEffect } from "react";
|
13
13
|
import { addTaxonomyApi, fetchTaxonomyByIdApi, updateTaxonomyApi, fetchTaxonomiessApi, addMultipleTaxonomiesApi, deleteTaxonomyApi, isMultipleApi, addSubTypeApi, } from "../api/taxonomy";
|
14
14
|
import { FaPlus } from "react-icons/fa";
|
15
|
-
const TaxonomyForm = () => {
|
15
|
+
const TaxonomyForm = ({ url }) => {
|
16
16
|
const [type, setType] = useState("");
|
17
17
|
const [inputType, setInputType] = useState("");
|
18
18
|
const [code, setCode] = useState("");
|
@@ -36,7 +36,7 @@ const TaxonomyForm = () => {
|
|
36
36
|
useEffect(() => {
|
37
37
|
const fetchAllTaxonomies = () => __awaiter(void 0, void 0, void 0, function* () {
|
38
38
|
try {
|
39
|
-
const fetchedTaxonomies = yield fetchTaxonomiessApi();
|
39
|
+
const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
|
40
40
|
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
41
41
|
setAllTaxonomies(fetchedTaxonomies);
|
42
42
|
}
|
@@ -54,9 +54,9 @@ const TaxonomyForm = () => {
|
|
54
54
|
};
|
55
55
|
const handleDeleteSubTypeClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
56
56
|
try {
|
57
|
-
yield deleteTaxonomyApi(id);
|
57
|
+
yield deleteTaxonomyApi(url, id);
|
58
58
|
alert("Taxonomy deleted successfully");
|
59
|
-
const fetchedTaxonomies = yield fetchTaxonomiessApi();
|
59
|
+
const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
|
60
60
|
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
61
61
|
setAllTaxonomies(fetchedTaxonomies);
|
62
62
|
}
|
@@ -81,7 +81,7 @@ const TaxonomyForm = () => {
|
|
81
81
|
if (id) {
|
82
82
|
const fetchTaxonomyData = () => __awaiter(void 0, void 0, void 0, function* () {
|
83
83
|
try {
|
84
|
-
const fetchedTaxonomy = yield fetchTaxonomyByIdApi(id);
|
84
|
+
const fetchedTaxonomy = yield fetchTaxonomyByIdApi(url, id);
|
85
85
|
if (fetchedTaxonomy) {
|
86
86
|
const taxonomy = fetchedTaxonomy;
|
87
87
|
setIsEditMode(true);
|
@@ -101,7 +101,7 @@ const TaxonomyForm = () => {
|
|
101
101
|
useEffect(() => {
|
102
102
|
const handleFetchSimilarTaxonomies = () => __awaiter(void 0, void 0, void 0, function* () {
|
103
103
|
try {
|
104
|
-
const response = yield fetchTaxonomiessApi();
|
104
|
+
const response = yield fetchTaxonomiessApi(url);
|
105
105
|
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
|
106
106
|
setSimilarTaxonomies(filteredTaxonomies);
|
107
107
|
}
|
@@ -122,12 +122,12 @@ const TaxonomyForm = () => {
|
|
122
122
|
event.preventDefault();
|
123
123
|
try {
|
124
124
|
if (isEditMode) {
|
125
|
-
yield addMultipleTaxonomiesApi(tempTaxonomy);
|
125
|
+
yield addMultipleTaxonomiesApi(url, tempTaxonomy);
|
126
126
|
setTempTaxonomy([]);
|
127
127
|
alert("Taxonomies saved successfully");
|
128
128
|
}
|
129
129
|
else {
|
130
|
-
yield addTaxonomyApi(inputType, Number(code), value);
|
130
|
+
yield addTaxonomyApi(url, inputType, Number(code), value);
|
131
131
|
alert("Taxonomy added successfully");
|
132
132
|
}
|
133
133
|
window.history.pushState({}, "", "/admin/taxinomies");
|
@@ -145,11 +145,11 @@ const TaxonomyForm = () => {
|
|
145
145
|
return;
|
146
146
|
try {
|
147
147
|
if (isEditMode) {
|
148
|
-
yield updateTaxonomyApi(id, inputType, Number(code), value);
|
148
|
+
yield updateTaxonomyApi(url, id, inputType, Number(code), value);
|
149
149
|
alert("Taxonomy updated successfully");
|
150
150
|
}
|
151
151
|
else {
|
152
|
-
yield addTaxonomyApi(inputType, Number(code), value);
|
152
|
+
yield addTaxonomyApi(url, inputType, Number(code), value);
|
153
153
|
alert("Taxonomy added successfully");
|
154
154
|
}
|
155
155
|
window.location.href = "/admin/taxinomies";
|
@@ -162,7 +162,7 @@ const TaxonomyForm = () => {
|
|
162
162
|
useEffect(() => {
|
163
163
|
const fetchIsMultiple = () => __awaiter(void 0, void 0, void 0, function* () {
|
164
164
|
try {
|
165
|
-
const result = yield isMultipleApi(type);
|
165
|
+
const result = yield isMultipleApi(url, type);
|
166
166
|
setIsMultiple(typeof result === "boolean");
|
167
167
|
}
|
168
168
|
catch (error) {
|
@@ -237,9 +237,9 @@ const TaxonomyForm = () => {
|
|
237
237
|
};
|
238
238
|
const handleSubTypeAddClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
239
239
|
try {
|
240
|
-
yield addSubTypeApi(selectedTaxonomyId, subType, Number(subCode), subValue);
|
240
|
+
yield addSubTypeApi(url, selectedTaxonomyId, subType, Number(subCode), subValue);
|
241
241
|
alert("SubType added successfully");
|
242
|
-
const fetchedTaxonomies = yield fetchTaxonomiessApi();
|
242
|
+
const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
|
243
243
|
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
244
244
|
setAllTaxonomies(fetchedTaxonomies);
|
245
245
|
}
|
@@ -254,9 +254,9 @@ const TaxonomyForm = () => {
|
|
254
254
|
});
|
255
255
|
const handleSubTypeEditClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
256
256
|
try {
|
257
|
-
yield updateTaxonomyApi(selectedTaxonomyId, subType, Number(subCode), subValue);
|
257
|
+
yield updateTaxonomyApi(url, selectedTaxonomyId, subType, Number(subCode), subValue);
|
258
258
|
alert("SubType edited successfully");
|
259
|
-
const fetchedTaxonomies = yield fetchTaxonomiessApi();
|
259
|
+
const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
|
260
260
|
if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
|
261
261
|
setAllTaxonomies(fetchedTaxonomies);
|
262
262
|
}
|
@@ -280,14 +280,14 @@ const TaxonomyForm = () => {
|
|
280
280
|
};
|
281
281
|
const handleEditTaxClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
282
282
|
try {
|
283
|
-
yield updateTaxonomyApi(selectedTaxonomyId, type, Number(newCode), newValue);
|
283
|
+
yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(newCode), newValue);
|
284
284
|
alert("Taxonomy updated successfully");
|
285
285
|
}
|
286
286
|
catch (error) {
|
287
287
|
console.error("Error updating Taxonomy:", error);
|
288
288
|
}
|
289
289
|
setIsModalOpen(false);
|
290
|
-
const response = yield fetchTaxonomiessApi();
|
290
|
+
const response = yield fetchTaxonomiessApi(url);
|
291
291
|
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
|
292
292
|
setSimilarTaxonomies(filteredTaxonomies);
|
293
293
|
});
|
@@ -297,10 +297,10 @@ const TaxonomyForm = () => {
|
|
297
297
|
return;
|
298
298
|
}
|
299
299
|
try {
|
300
|
-
yield addMultipleTaxonomiesApi(tempTaxonomy);
|
300
|
+
yield addMultipleTaxonomiesApi(url, tempTaxonomy);
|
301
301
|
setTempTaxonomy([]);
|
302
302
|
alert("Multiple taxonomies added successfully");
|
303
|
-
const response = yield fetchTaxonomiessApi();
|
303
|
+
const response = yield fetchTaxonomiessApi(url);
|
304
304
|
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === inputType);
|
305
305
|
setSimilarTaxonomies(filteredTaxonomies);
|
306
306
|
}
|
@@ -311,7 +311,7 @@ const TaxonomyForm = () => {
|
|
311
311
|
});
|
312
312
|
const handleDeleteClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
313
313
|
try {
|
314
|
-
yield deleteTaxonomyApi(id);
|
314
|
+
yield deleteTaxonomyApi(url, id);
|
315
315
|
alert("Taxonomy deleted successfully");
|
316
316
|
setSimilarTaxonomies((prevTaxonomies) => prevTaxonomies.filter((taxonomy) => taxonomy.id !== id));
|
317
317
|
}
|
@@ -325,11 +325,7 @@ const TaxonomyForm = () => {
|
|
325
325
|
}, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: "Delete" })) })) }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("button", { type: "submit", onClick: handleSave, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: isEditMode ? "Save" : "Add" })), !similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
|
326
326
|
!isEditMode && (_jsx("button", { type: "submit", onClick: handleSave, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: isEditMode ? "Save" : "Add" })), _jsx("button", { onClick: handleCancelClick, type: "button", className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: "Cancel" })] })] })] })), isSimilarTaxonomyOpen && isMultiple && isEditMode && (_jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" })), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { className: "divide-y divide-gray-200", children: similarTaxonomies.map((taxonomy, index) => {
|
327
327
|
const hasChildren = allTaxonomies.some((item) => item.parentId === taxonomy.id);
|
328
|
-
return (_jsxs(React.Fragment, { children: [_jsxs("tr", { children: [taxonomy.isEdit && (_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => handleDeleteClick(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }), _jsx("button", { type: "button", onClick: () => handleEditClick(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) }), _jsx("button", { type: "button", onClick: () => handleAddSubType(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) }) })] }) })), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: taxonomy.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { children: taxonomy.value }), hasChildren && (_jsx("button", { type: "button", onClick: () => toggleRowExpansion(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-600 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: expandedRows.indexOf(taxonomy.id) !== -1 ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 15.75l-7.5-7.5-7.5 7.5" }) })) }))] }) })] }, index), expandedRows.indexOf(taxonomy.id) !== -1 && (_jsx("tr", { children: _jsx("td", { colSpan: 3, children: _jsxs("table", { className: "min-w-full divide-y ", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
329
|
-
// <th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
|
330
|
-
// Actions
|
331
|
-
// </th>
|
332
|
-
_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" })), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Sub Type" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { children: allTaxonomies
|
328
|
+
return (_jsxs(React.Fragment, { children: [_jsxs("tr", { children: [taxonomy.isEdit && (_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => handleDeleteClick(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }), _jsx("button", { type: "button", onClick: () => handleEditClick(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) }), _jsx("button", { type: "button", onClick: () => handleAddSubType(index, taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) }) })] }) })), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: taxonomy.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { children: taxonomy.value }), hasChildren && (_jsx("button", { type: "button", onClick: () => toggleRowExpansion(taxonomy.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-blue-600 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: expandedRows.indexOf(taxonomy.id) !== -1 ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 15.75l-7.5-7.5-7.5 7.5" }) })) }))] }) })] }, index), expandedRows.indexOf(taxonomy.id) !== -1 && (_jsx("tr", { children: _jsx("td", { colSpan: 3, children: _jsxs("table", { className: "min-w-full divide-y ", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" })), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Sub Type" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { children: allTaxonomies
|
333
329
|
.filter((item) => item.parentId === taxonomy.id)
|
334
330
|
.map((child, key) => (_jsxs("tr", { children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => handleDeleteSubTypeClick(child.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }), _jsx("button", { onClick: () => handleSubEdit(child), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) })] }) })), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: child.type }), _jsx("td", { className: "px-4 py-2 text-sm text-gray-500 dark:text-gray-400", children: child.code }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-900 dark:text-white", children: child.value })] }, key))) })] }) }) }))] }, taxonomy.id));
|
335
331
|
}) })] }) }), similarTaxonomies.some((taxonomy) => taxonomy.isEdit && taxonomy.isMultiple) && (_jsx("div", { className: "flex space-x-4 mt-6 justify-start", children: _jsxs("button", { type: "button", onClick: handleOpenModal, className: "flex items-center justify-center px-6 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80", children: [_jsx(FaPlus, { className: "mr-2 font-medium" }), "Add Multiple Values"] }) }))] })), isEditMode && (_jsx(_Fragment, { children: tempTaxonomy.length > 0 && (_jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", style: { width: "200px" }, children: "Actions" }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400", children: "Code" }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left text-gray-500 dark:text-gray-400", children: "Value" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:bg-gray-800 dark:divide-gray-700", children: [...tempTaxonomy].map((item, index) => (_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { type: "button", onClick: () => {
|
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { useState, useEffect } from "react";
|
12
12
|
import { FaPlus } from "react-icons/fa";
|
13
13
|
import { fetchTemplatesApi, deleteTemplateApi } from "../api/template";
|
14
|
-
const Template = () => {
|
14
|
+
const Template = ({ url }) => {
|
15
15
|
const [templates, setTemplates] = useState([]);
|
16
16
|
const fetchTemplatesData = () => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
-
const data = yield fetchTemplatesApi();
|
17
|
+
const data = yield fetchTemplatesApi(url);
|
18
18
|
if (data) {
|
19
19
|
setTemplates(data);
|
20
20
|
}
|
@@ -55,7 +55,7 @@ const Template = () => {
|
|
55
55
|
};
|
56
56
|
const handleDeleteClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
57
57
|
try {
|
58
|
-
yield deleteTemplateApi(id);
|
58
|
+
yield deleteTemplateApi(url, id);
|
59
59
|
alert("Template deleted successfully");
|
60
60
|
fetchTemplatesData();
|
61
61
|
}
|
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { useState, useEffect, useRef, useMemo } from "react";
|
12
12
|
import { addTemplateApi, fetchTemplateByIdApi, updateTemplateApi, } from "../api/template";
|
13
13
|
import Editor from "./Editor";
|
14
|
-
const TemplateForm = () => {
|
14
|
+
const TemplateForm = ({ url }) => {
|
15
15
|
const [name, setName] = useState("");
|
16
16
|
const [content, setContent] = useState("");
|
17
17
|
const placeholder = "";
|
@@ -34,7 +34,7 @@ const TemplateForm = () => {
|
|
34
34
|
if (id) {
|
35
35
|
const fetchTemplateData = () => __awaiter(void 0, void 0, void 0, function* () {
|
36
36
|
try {
|
37
|
-
const fetchedUser = yield fetchTemplateByIdApi(id);
|
37
|
+
const fetchedUser = yield fetchTemplateByIdApi(url, id);
|
38
38
|
if (fetchedUser) {
|
39
39
|
const user = fetchedUser;
|
40
40
|
setIsEditMode(true);
|
@@ -55,11 +55,11 @@ const TemplateForm = () => {
|
|
55
55
|
return;
|
56
56
|
try {
|
57
57
|
if (isEditMode) {
|
58
|
-
yield updateTemplateApi(id, name, content);
|
58
|
+
yield updateTemplateApi(url, id, name, content);
|
59
59
|
alert("Template updated successfully");
|
60
60
|
}
|
61
61
|
else {
|
62
|
-
yield addTemplateApi(name, content);
|
62
|
+
yield addTemplateApi(url, name, content);
|
63
63
|
alert("Template added successfully");
|
64
64
|
}
|
65
65
|
window.history.pushState({}, "", "/admin/template");
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11
11
|
import { useState, useEffect } from "react";
|
12
12
|
import { addUserApi, updateUserApi, fetchUserByIdApi } from "../api/user";
|
13
|
-
const UserForm = () => {
|
13
|
+
const UserForm = ({ url }) => {
|
14
14
|
const [userName, setUserName] = useState("");
|
15
15
|
const [email, setEmail] = useState("");
|
16
16
|
const [mobile, setMobile] = useState("");
|
@@ -30,7 +30,7 @@ const UserForm = () => {
|
|
30
30
|
if (id) {
|
31
31
|
const fetchUserData = () => __awaiter(void 0, void 0, void 0, function* () {
|
32
32
|
try {
|
33
|
-
const fetchedUser = yield fetchUserByIdApi(id);
|
33
|
+
const fetchedUser = yield fetchUserByIdApi(url, id);
|
34
34
|
if (fetchedUser) {
|
35
35
|
const user = fetchedUser;
|
36
36
|
setIsEditMode(true);
|
@@ -54,11 +54,11 @@ const UserForm = () => {
|
|
54
54
|
return;
|
55
55
|
try {
|
56
56
|
if (isEditMode) {
|
57
|
-
yield updateUserApi(id, userName, mobile, address, roleType);
|
57
|
+
yield updateUserApi(url, id, userName, mobile, address, roleType);
|
58
58
|
alert("User updated successfully");
|
59
59
|
}
|
60
60
|
else {
|
61
|
-
yield addUserApi(userName, email, mobile, address, roleType);
|
61
|
+
yield addUserApi(url, userName, email, mobile, address, roleType);
|
62
62
|
alert("User added successfully");
|
63
63
|
}
|
64
64
|
// window.location.href = "/admin/users";
|
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { useState, useEffect } from "react";
|
12
12
|
import { FaPlus } from "react-icons/fa";
|
13
13
|
import { fetchUsersApi, deleteUserApi } from "../api/user";
|
14
|
-
|
14
|
+
const Users = ({ url }) => {
|
15
15
|
const [users, setUsers] = useState([]);
|
16
|
-
const fetchUsersData = () => __awaiter(
|
17
|
-
const data = yield fetchUsersApi();
|
16
|
+
const fetchUsersData = () => __awaiter(void 0, void 0, void 0, function* () {
|
17
|
+
const data = yield fetchUsersApi(url);
|
18
18
|
if (data) {
|
19
19
|
setUsers(data);
|
20
20
|
}
|
@@ -47,9 +47,9 @@ function Users() {
|
|
47
47
|
setCurrentPage(pageNumber);
|
48
48
|
};
|
49
49
|
const paginatedUsers = users.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage);
|
50
|
-
const handleDeleteClick = (id) => __awaiter(
|
50
|
+
const handleDeleteClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
51
51
|
try {
|
52
|
-
yield deleteUserApi(id);
|
52
|
+
yield deleteUserApi(url, id);
|
53
53
|
alert("User deleted successfully");
|
54
54
|
fetchUsersData();
|
55
55
|
}
|
@@ -65,5 +65,5 @@ function Users() {
|
|
65
65
|
return (_jsxs("div", { className: "container px-4 mx-auto mt-6", children: [_jsx("div", { className: "w-3/4", children: _jsx("h1", { className: "text-3xl font-bold text-blue-600 mb-5", children: "Users" }) }), _jsx("div", { className: "flex-grow ml-0 w-full mt-10", children: _jsxs("form", { className: "w-full ", children: [_jsx("label", { htmlFor: "default-search", className: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white", children: "Search" }), _jsxs("div", { className: "relative w-full", children: [_jsx("div", { className: "absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none", children: _jsx("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: _jsx("path", { stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" }) }) }), _jsx("input", { type: "search", id: "default-search", className: "inline-block min-w-full p-3 ps-10 outline-none text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500", placeholder: "Search Users", required: true }), _jsx("button", { type: "submit", className: "text-white absolute end-1.5 bottom-1.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800", children: "Search" })] })] }) }), _jsx("div", { className: "flex-grow ml-0 w-3/4", children: _jsx("form", { className: "w-auto" }) }), _jsxs("div", { className: "flex-grow ml-0 mt-4 w-full", children: [_jsx("div", { className: "overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6", children: _jsxs("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-gray-800", children: _jsxs("tr", { children: [_jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Edit/Delete" }), _jsx("th", { scope: "col", className: "py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: _jsx("div", { className: "flex items-center gap-x-3", children: _jsx("span", { children: "Name" }) }) }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: _jsx("button", { className: "flex items-center gap-x-2", children: _jsx("span", { children: "Email" }) }) }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: _jsx("button", { className: "flex items-center gap-x-2", children: _jsx("span", { children: "Mobile" }) }) }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Address" }), _jsx("th", { scope: "col", className: "px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Role Type" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900", children: paginatedUsers.map((user, index) => (_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsxs("div", { className: "flex items-center gap-x-6", children: [_jsx("button", { onClick: () => handleDeleteClick(user.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }), _jsx("button", { onClick: (event) => handleEditClick(event, "/admin/users/userform?id=", user.id), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "w-5 h-5", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" }) }) })] }) }), _jsx("td", { className: "px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap", children: _jsx("div", { className: "inline-flex items-center gap-x-3", children: _jsx("div", { className: "flex items-center gap-x-2", children: _jsx("div", { children: _jsx("h2", { className: " text-sm font-medium text-gray-800 dark:text-white ", children: user.name }) }) }) }) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.email }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.mobile) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: (user === null || user === void 0 ? void 0 : user.address) || "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.roleType === "1" ? "Guest" : "Admin" })] }, user.id || index))) })] }) }), _jsxs("div", { className: "flex items-center justify-between mt-6", children: [_jsxs("button", { onClick: handlePreviousPage, disabled: currentPage === 1, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18" }) }), _jsx("span", { children: "previous" })] }), _jsx("div", { className: "items-center hidden lg:flex gap-x-3", children: Array.from({ length: totalPages }, (_, index) => (_jsx("button", { onClick: () => handlePageClick(index + 1), className: `px-2 py-1 text-sm ${currentPage === index + 1
|
66
66
|
? "text-blue-500 bg-blue-100"
|
67
67
|
: "text-gray-500 hover:bg-gray-100"} rounded-md`, children: index + 1 }, index + 1))) }), _jsxs("button", { onClick: handleNextPage, disabled: currentPage === totalPages, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("span", { children: "Next" }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3" }) })] })] }), _jsx("div", { className: "flex-grow ml-0 mt-4 w-0", children: _jsxs("button", { type: "button", onClick: (event) => handleNavigation(event, "/admin/users/userform"), className: "flex items-center justify-center px-6 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80", children: [_jsx(FaPlus, { className: "mr-2 font-medium" }), "User"] }) })] })] }));
|
68
|
-
}
|
68
|
+
};
|
69
69
|
export default Users;
|
@@ -1,14 +1,14 @@
|
|
1
|
-
export declare const addTaxonomyApi: (type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
|
2
|
-
export declare const fetchTaxonomiessApi: () => Promise<unknown>;
|
3
|
-
export declare const deleteTaxonomyApi: (id: string) => Promise<{
|
1
|
+
export declare const addTaxonomyApi: (url: string, type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
|
2
|
+
export declare const fetchTaxonomiessApi: (url: string) => Promise<unknown>;
|
3
|
+
export declare const deleteTaxonomyApi: (url: string, id: string) => Promise<{
|
4
4
|
id: string;
|
5
5
|
}>;
|
6
|
-
export declare const fetchTaxonomyByIdApi: (taxonomyId: string) => Promise<unknown>;
|
7
|
-
export declare const updateTaxonomyApi: (id: string, type: string, code: number, value: string) => Promise<unknown>;
|
8
|
-
export declare const addMultipleTaxonomiesApi: (taxonomies: {
|
6
|
+
export declare const fetchTaxonomyByIdApi: (url: string, taxonomyId: string) => Promise<unknown>;
|
7
|
+
export declare const updateTaxonomyApi: (url: string, id: string, type: string, code: number, value: string) => Promise<unknown>;
|
8
|
+
export declare const addMultipleTaxonomiesApi: (url: string, taxonomies: {
|
9
9
|
type: string;
|
10
10
|
code: number;
|
11
11
|
value: string;
|
12
12
|
}[]) => Promise<Axios.AxiosXHR<unknown>>;
|
13
|
-
export declare const isMultipleApi: (type: string) => Promise<unknown>;
|
14
|
-
export declare const addSubTypeApi: (parentid: string, type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
|
13
|
+
export declare const isMultipleApi: (url: string, type: string) => Promise<unknown>;
|
14
|
+
export declare const addSubTypeApi: (url: string, parentid: string, type: string, code: number, value: string) => Promise<Axios.AxiosXHR<unknown>>;
|
@@ -11,10 +11,10 @@ import axios from "axios";
|
|
11
11
|
import Cookies from "universal-cookie";
|
12
12
|
const apiUrl = "http://localhost:5260";
|
13
13
|
const cookies = new Cookies();
|
14
|
-
export const addTaxonomyApi = (type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
|
14
|
+
export const addTaxonomyApi = (url, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
|
15
15
|
const token = cookies.get("authToken");
|
16
16
|
try {
|
17
|
-
const response = yield axios.post(`${
|
17
|
+
const response = yield axios.post(`${url}/taxonomy/add`, {
|
18
18
|
Type: type,
|
19
19
|
Code: code,
|
20
20
|
Value: value,
|
@@ -30,10 +30,10 @@ export const addTaxonomyApi = (type, code, value) => __awaiter(void 0, void 0, v
|
|
30
30
|
throw error;
|
31
31
|
}
|
32
32
|
});
|
33
|
-
export const fetchTaxonomiessApi = () => __awaiter(void 0, void 0, void 0, function* () {
|
33
|
+
export const fetchTaxonomiessApi = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
34
34
|
const token = cookies.get("authToken");
|
35
35
|
try {
|
36
|
-
const response = yield axios.get(`${
|
36
|
+
const response = yield axios.get(`${url}/taxonomy/gettaxonomy`, {
|
37
37
|
headers: {
|
38
38
|
Authorization: `Bearer ${token}`,
|
39
39
|
},
|
@@ -45,12 +45,12 @@ export const fetchTaxonomiessApi = () => __awaiter(void 0, void 0, void 0, funct
|
|
45
45
|
return false;
|
46
46
|
}
|
47
47
|
});
|
48
|
-
export const deleteTaxonomyApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
48
|
+
export const deleteTaxonomyApi = (url, id) => __awaiter(void 0, void 0, void 0, function* () {
|
49
49
|
const token = cookies.get("authToken");
|
50
50
|
try {
|
51
51
|
const response = yield axios.request({
|
52
52
|
method: "DELETE",
|
53
|
-
url: `${
|
53
|
+
url: `${url}/taxonomy/delete`,
|
54
54
|
headers: {
|
55
55
|
Authorization: `Bearer ${token}`,
|
56
56
|
"Content-Type": "application/json",
|
@@ -66,11 +66,11 @@ export const deleteTaxonomyApi = (id) => __awaiter(void 0, void 0, void 0, funct
|
|
66
66
|
throw error;
|
67
67
|
}
|
68
68
|
});
|
69
|
-
export const fetchTaxonomyByIdApi = (taxonomyId) => __awaiter(void 0, void 0, void 0, function* () {
|
69
|
+
export const fetchTaxonomyByIdApi = (url, taxonomyId) => __awaiter(void 0, void 0, void 0, function* () {
|
70
70
|
const cookies = new Cookies();
|
71
71
|
const token = cookies.get("authToken");
|
72
72
|
try {
|
73
|
-
const response = yield axios.get(`${
|
73
|
+
const response = yield axios.get(`${url}/taxonomy/gettaxonomybyid/${taxonomyId}`, {
|
74
74
|
headers: {
|
75
75
|
Authorization: `Bearer ${token}`,
|
76
76
|
},
|
@@ -82,10 +82,10 @@ export const fetchTaxonomyByIdApi = (taxonomyId) => __awaiter(void 0, void 0, vo
|
|
82
82
|
return false;
|
83
83
|
}
|
84
84
|
});
|
85
|
-
export const updateTaxonomyApi = (id, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
|
85
|
+
export const updateTaxonomyApi = (url, id, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
|
86
86
|
const token = cookies.get("authToken");
|
87
87
|
try {
|
88
|
-
const response = yield axios.post(`${
|
88
|
+
const response = yield axios.post(`${url}/taxonomy/updatetaxonomy`, {
|
89
89
|
Id: id,
|
90
90
|
Type: type,
|
91
91
|
Code: code,
|
@@ -101,11 +101,11 @@ export const updateTaxonomyApi = (id, type, code, value) => __awaiter(void 0, vo
|
|
101
101
|
throw error;
|
102
102
|
}
|
103
103
|
});
|
104
|
-
export const addMultipleTaxonomiesApi = (taxonomies) => __awaiter(void 0, void 0, void 0, function* () {
|
104
|
+
export const addMultipleTaxonomiesApi = (url, taxonomies) => __awaiter(void 0, void 0, void 0, function* () {
|
105
105
|
var _a;
|
106
106
|
const token = cookies.get("authToken");
|
107
107
|
try {
|
108
|
-
const response = yield axios.post(`${
|
108
|
+
const response = yield axios.post(`${url}/taxonomy/addmultipletaxonomies`, taxonomies, {
|
109
109
|
headers: {
|
110
110
|
Authorization: `Bearer ${token}`,
|
111
111
|
"Content-Type": "application/json",
|
@@ -118,10 +118,10 @@ export const addMultipleTaxonomiesApi = (taxonomies) => __awaiter(void 0, void 0
|
|
118
118
|
throw error;
|
119
119
|
}
|
120
120
|
});
|
121
|
-
export const isMultipleApi = (type) => __awaiter(void 0, void 0, void 0, function* () {
|
121
|
+
export const isMultipleApi = (url, type) => __awaiter(void 0, void 0, void 0, function* () {
|
122
122
|
const token = cookies.get("authToken");
|
123
123
|
try {
|
124
|
-
const response = yield axios.get(`${
|
124
|
+
const response = yield axios.get(`${url}/taxonomy/IsTaxonomyMultipleByType/${type}`, {
|
125
125
|
headers: {
|
126
126
|
Authorization: `Bearer ${token}`,
|
127
127
|
},
|
@@ -133,10 +133,10 @@ export const isMultipleApi = (type) => __awaiter(void 0, void 0, void 0, functio
|
|
133
133
|
throw error;
|
134
134
|
}
|
135
135
|
});
|
136
|
-
export const addSubTypeApi = (parentid, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
|
136
|
+
export const addSubTypeApi = (url, parentid, type, code, value) => __awaiter(void 0, void 0, void 0, function* () {
|
137
137
|
const token = cookies.get("authToken");
|
138
138
|
try {
|
139
|
-
const response = yield axios.post(`${
|
139
|
+
const response = yield axios.post(`${url}/taxonomy/addsubtype`, {
|
140
140
|
ParentId: parentid,
|
141
141
|
Type: type,
|
142
142
|
Code: code,
|
@@ -1,5 +1,5 @@
|
|
1
|
-
export declare const addTemplateApi: (name: string, content: string) => Promise<Axios.AxiosXHR<unknown>>;
|
2
|
-
export declare const fetchTemplatesApi: () => Promise<unknown>;
|
3
|
-
export declare const fetchTemplateByIdApi: (id: string) => Promise<unknown>;
|
4
|
-
export declare const updateTemplateApi: (id: string, name: string, content: string) => Promise<unknown>;
|
5
|
-
export declare const deleteTemplateApi: (id: string) => Promise<unknown>;
|
1
|
+
export declare const addTemplateApi: (url: string, name: string, content: string) => Promise<Axios.AxiosXHR<unknown>>;
|
2
|
+
export declare const fetchTemplatesApi: (url: string) => Promise<unknown>;
|
3
|
+
export declare const fetchTemplateByIdApi: (url: string, id: string) => Promise<unknown>;
|
4
|
+
export declare const updateTemplateApi: (url: string, id: string, name: string, content: string) => Promise<unknown>;
|
5
|
+
export declare const deleteTemplateApi: (url: string, id: string) => Promise<unknown>;
|
@@ -11,10 +11,10 @@ import axios from "axios";
|
|
11
11
|
import Cookies from "universal-cookie";
|
12
12
|
const apiUrl = "http://localhost:5260";
|
13
13
|
const cookies = new Cookies();
|
14
|
-
export const addTemplateApi = (name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
14
|
+
export const addTemplateApi = (url, name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
15
15
|
const token = cookies.get("authToken");
|
16
16
|
try {
|
17
|
-
const response = yield axios.post(`${
|
17
|
+
const response = yield axios.post(`${url}/template/add`, {
|
18
18
|
Name: name,
|
19
19
|
Content: content,
|
20
20
|
}, {
|
@@ -29,10 +29,10 @@ export const addTemplateApi = (name, content) => __awaiter(void 0, void 0, void
|
|
29
29
|
throw error;
|
30
30
|
}
|
31
31
|
});
|
32
|
-
export const fetchTemplatesApi = () => __awaiter(void 0, void 0, void 0, function* () {
|
32
|
+
export const fetchTemplatesApi = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
33
33
|
const token = cookies.get("authToken");
|
34
34
|
try {
|
35
|
-
const response = yield axios.get(`${
|
35
|
+
const response = yield axios.get(`${url}/template/gettemplate`, {
|
36
36
|
headers: {
|
37
37
|
Authorization: `Bearer ${token}`,
|
38
38
|
},
|
@@ -44,11 +44,11 @@ export const fetchTemplatesApi = () => __awaiter(void 0, void 0, void 0, functio
|
|
44
44
|
return false;
|
45
45
|
}
|
46
46
|
});
|
47
|
-
export const fetchTemplateByIdApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
47
|
+
export const fetchTemplateByIdApi = (url, id) => __awaiter(void 0, void 0, void 0, function* () {
|
48
48
|
const cookies = new Cookies();
|
49
49
|
const token = cookies.get("authToken");
|
50
50
|
try {
|
51
|
-
const response = yield axios.get(`${
|
51
|
+
const response = yield axios.get(`${url}/template/gettemplatebyid/${id}`, {
|
52
52
|
headers: {
|
53
53
|
Authorization: `Bearer ${token}`,
|
54
54
|
},
|
@@ -60,10 +60,10 @@ export const fetchTemplateByIdApi = (id) => __awaiter(void 0, void 0, void 0, fu
|
|
60
60
|
return false;
|
61
61
|
}
|
62
62
|
});
|
63
|
-
export const updateTemplateApi = (id, name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
63
|
+
export const updateTemplateApi = (url, id, name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
64
64
|
const token = cookies.get("authToken");
|
65
65
|
try {
|
66
|
-
const response = yield axios.post(`${
|
66
|
+
const response = yield axios.post(`${url}/template/updatetemplate`, {
|
67
67
|
id: id,
|
68
68
|
name: name,
|
69
69
|
content: content,
|
@@ -78,10 +78,10 @@ export const updateTemplateApi = (id, name, content) => __awaiter(void 0, void 0
|
|
78
78
|
throw error;
|
79
79
|
}
|
80
80
|
});
|
81
|
-
export const deleteTemplateApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
81
|
+
export const deleteTemplateApi = (url, id) => __awaiter(void 0, void 0, void 0, function* () {
|
82
82
|
const token = cookies.get("authToken");
|
83
83
|
try {
|
84
|
-
const response = yield axios.post(`${
|
84
|
+
const response = yield axios.post(`${url}/template/deletetemplate`, {
|
85
85
|
id: id,
|
86
86
|
}, {
|
87
87
|
headers: {
|