eleven-solutions-common-website-unique-web 2.0.24 → 2.0.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,23 +58,16 @@ const Taxionomies = () => {
58
58
  window.history.pushState({}, "", path);
59
59
  window.dispatchEvent(new PopStateEvent("popstate"));
60
60
  };
61
- // const handleViewClick = (
62
- // event: React.MouseEvent,
63
- // path: string,
64
- // id: string,
65
- // type: string
66
- // ) => {
67
- // event.preventDefault();
68
- // window.history.pushState({}, "", path + { state: { id, type} });
69
- // window.dispatchEvent(new PopStateEvent("popstate"));
70
- // };
71
61
  const handleViewClick = (event, path, id, type) => {
72
62
  event.preventDefault();
73
63
  const state = { id, type };
74
64
  window.history.pushState(state, "", path);
75
65
  window.dispatchEvent(new PopStateEvent("popstate"));
76
66
  };
77
- 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: "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 h-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: "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.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) => handleViewClick(event, "/admin/taxinomies/taxonomyform?", taxonomy.id, taxonomy.type), 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) => handleViewClick(event, "/admin/taxinomies/taxonomyform?", taxonomy.id, taxonomy.type), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: _jsxs("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: "M12 4.5c4.142 0 7.788 2.93 9 7.5-1.212 4.57-4.858 7.5-9 7.5s-7.788-2.93-9-7.5c1.212-4.57 4.858-7.5 9-7.5z" }), _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M12 9a3 3 0 100 6 3 3 0 000-6z" })] }) })) : null }) }), _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: taxonomy.type }) }) }) }) })] }, taxonomy.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
67
+ 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: "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 h-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: "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.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) => {
68
+ console.log(taxonomy, taxonomy.id);
69
+ handleViewClick(event, "/admin/taxinomies/taxonomyform?", taxonomy.id, taxonomy.type);
70
+ }, 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) => handleViewClick(event, "/admin/taxinomies/taxonomyform?", taxonomy.id, taxonomy.type), className: "text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none", children: _jsxs("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: "M12 4.5c4.142 0 7.788 2.93 9 7.5-1.212 4.57-4.858 7.5-9 7.5s-7.788-2.93-9-7.5c1.212-4.57 4.858-7.5 9-7.5z" }), _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M12 9a3 3 0 100 6 3 3 0 000-6z" })] }) })) : null }) }), _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: taxonomy.type }) }) }) }) })] }, taxonomy.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
78
71
  ? "text-blue-500 bg-blue-100"
79
72
  : "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/taxinomies/taxonomyform"), 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" }), "Taxonomy"] }) })] })] }));
80
73
  };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
- import { addTaxonomyApi, fetchTaxonomyByIdApi, updateTaxonomyApi, fetchTaxonomiessApi, addMultipleTaxonomiesApi, deleteTaxonomyApi, isMultipleApi, } from "../api/taxonomy";
12
+ import { addTaxonomyApi, fetchTaxonomyByIdApi, updateTaxonomyApi, fetchTaxonomiessApi, addMultipleTaxonomiesApi, deleteTaxonomyApi, } from "../api/taxonomy";
13
13
  import { FaPlus } from "react-icons/fa";
14
14
  const TaxonomyForm = () => {
15
15
  const [type, setType] = useState("");
@@ -121,18 +121,17 @@ const TaxonomyForm = () => {
121
121
  alert("Failed to add/update Taxonomy");
122
122
  }
123
123
  });
124
- useEffect(() => {
125
- const fetchIsMultiple = () => __awaiter(void 0, void 0, void 0, function* () {
126
- try {
127
- const result = yield isMultipleApi(type);
128
- setIsMultiple(typeof result === "boolean");
129
- }
130
- catch (error) {
131
- console.error("Error checking if taxonomy is multiple:", error);
132
- }
133
- });
134
- fetchIsMultiple();
135
- }, [type]);
124
+ // useEffect(() => {
125
+ // const fetchIsMultiple = async () => {
126
+ // try {
127
+ // const result = await isMultipleApi(type);
128
+ // setIsMultiple(typeof result === "boolean");
129
+ // } catch (error) {
130
+ // console.error("Error checking if taxonomy is multiple:", error);
131
+ // }
132
+ // };
133
+ // fetchIsMultiple();
134
+ // }, [type]);
136
135
  const handleCancelClick = () => {
137
136
  setType("");
138
137
  setCode("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "2.0.24",
3
+ "version": "2.0.25",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -69,17 +69,6 @@ const Taxionomies = () => {
69
69
  window.dispatchEvent(new PopStateEvent("popstate"));
70
70
  };
71
71
 
72
- // const handleViewClick = (
73
- // event: React.MouseEvent,
74
- // path: string,
75
- // id: string,
76
- // type: string
77
- // ) => {
78
- // event.preventDefault();
79
- // window.history.pushState({}, "", path + { state: { id, type} });
80
- // window.dispatchEvent(new PopStateEvent("popstate"));
81
- // };
82
-
83
72
  const handleViewClick = (
84
73
  event: React.MouseEvent,
85
74
  path: string,
@@ -169,14 +158,15 @@ const Taxionomies = () => {
169
158
  {taxonomy.isEdit ? (
170
159
  <button
171
160
  type="button"
172
- onClick={(event) =>
161
+ onClick={(event) => {
162
+ console.log(taxonomy, taxonomy.id);
173
163
  handleViewClick(
174
164
  event,
175
165
  "/admin/taxinomies/taxonomyform?",
176
166
  taxonomy.id,
177
167
  taxonomy.type
178
- )
179
- }
168
+ );
169
+ }}
180
170
  className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none"
181
171
  >
182
172
  {/* Edit icon */}
@@ -149,18 +149,18 @@ const TaxonomyForm = () => {
149
149
  }
150
150
  };
151
151
 
152
- useEffect(() => {
153
- const fetchIsMultiple = async () => {
154
- try {
155
- const result = await isMultipleApi(type);
156
- setIsMultiple(typeof result === "boolean");
157
- } catch (error) {
158
- console.error("Error checking if taxonomy is multiple:", error);
159
- }
160
- };
161
-
162
- fetchIsMultiple();
163
- }, [type]);
152
+ // useEffect(() => {
153
+ // const fetchIsMultiple = async () => {
154
+ // try {
155
+ // const result = await isMultipleApi(type);
156
+ // setIsMultiple(typeof result === "boolean");
157
+ // } catch (error) {
158
+ // console.error("Error checking if taxonomy is multiple:", error);
159
+ // }
160
+ // };
161
+
162
+ // fetchIsMultiple();
163
+ // }, [type]);
164
164
 
165
165
  const handleCancelClick = () => {
166
166
  setType("");