eleven-solutions-common-website-unique-web 14.0.2 → 14.0.4

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.
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
- import { FaPlus } from "react-icons/fa";
13
12
  import { fetchTaxonomiessApi } from "../api/taxonomy";
14
13
  const Taxionomies = ({ url }) => {
15
14
  const [taxonomy, setTaxonomy] = useState([]);
@@ -69,6 +68,6 @@ const Taxionomies = ({ url }) => {
69
68
  handleViewClick(event, "/admin/taxinomies/taxonomyform?", taxonomy.id, taxonomy.type);
70
69
  }, 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
71
70
  ? "text-blue-500 bg-blue-100"
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"] }) })] })] }));
71
+ : "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" }) })] })] })] })] }));
73
72
  };
74
73
  export default Taxionomies;
@@ -139,27 +139,24 @@ const TaxonomyForm = ({ url }) => {
139
139
  }
140
140
  });
141
141
  // Handle save operation
142
- const handleSave = (event) => __awaiter(void 0, void 0, void 0, function* () {
143
- event.preventDefault();
144
- if (!validateForm())
145
- return;
146
- try {
147
- if (isEditMode) {
148
- yield updateTaxonomyApi(url, id, inputType, Number(code), value);
149
- alert("Taxonomy updated successfully");
150
- }
151
- else {
152
- yield addTaxonomyApi(url, inputType, Number(code), value);
153
- alert("Taxonomy added successfully");
154
- }
155
- window.history.pushState({}, "", "/admin/taxinomies");
156
- window.dispatchEvent(new PopStateEvent("popstate"));
157
- }
158
- catch (error) {
159
- console.error("Error adding/updating Taxonomy:", error);
160
- alert("Failed to add/update Taxonomy");
161
- }
162
- });
142
+ // const handleSave = async (event: React.MouseEvent<HTMLButtonElement>) => {
143
+ // event.preventDefault();
144
+ // if (!validateForm()) return;
145
+ // try {
146
+ // if (isEditMode) {
147
+ // await updateTaxonomyApi(url, id, inputType, Number(code), value);
148
+ // alert("Taxonomy updated successfully");
149
+ // } else {
150
+ // await addTaxonomyApi(url, inputType, Number(code), value);
151
+ // alert("Taxonomy added successfully");
152
+ // }
153
+ // window.history.pushState({}, "", "/admin/taxinomies");
154
+ // window.dispatchEvent(new PopStateEvent("popstate"));
155
+ // } catch (error) {
156
+ // console.error("Error adding/updating Taxonomy:", error);
157
+ // alert("Failed to add/update Taxonomy");
158
+ // }
159
+ // };
163
160
  useEffect(() => {
164
161
  const fetchIsMultiple = () => __awaiter(void 0, void 0, void 0, function* () {
165
162
  try {
@@ -322,7 +319,8 @@ const TaxonomyForm = ({ url }) => {
322
319
  });
323
320
  return (_jsxs("div", { className: `${
324
321
  // isEditMode && isMultiple ? "w-full" : "max-w-4xl"
325
- isEditMode ? "w-full" : "max-w-4xl"} p-6 mx-auto dark:bg-gray-800`, children: [_jsxs("div", { className: `transition duration-300 ${isModalOpen ? "filter blur-sm" : ""}`, children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? "Edit Taxonomy" : "Add Taxonomy" }), _jsx("h1", { className: "text-2xl text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? `Taxonomy Type: ${type}` : "" }), isSimilarTaxonomyOpen && 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) => {
322
+ isEditMode ? "w-full" : "max-w-4xl"} p-6 mx-auto dark:bg-gray-800`, children: [_jsxs("div", { className: `transition duration-300 ${isModalOpen ? "filter blur-sm" : ""}`, children: [_jsx("h1", { className: "text-3xl font-bold text-center text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? "Edit Taxonomy" : "Add Taxonomy" }), _jsx("h1", { className: "text-2xl text-blue-600 capitalize dark:text-white mb-4", children: isEditMode ? `Taxonomy Type: ${type}` : "" }), isSimilarTaxonomyOpen && 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: [_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: similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
323
+ "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) => {
326
324
  const hasChildren = allTaxonomies.some((item) => item.parentId === taxonomy.id);
327
325
  return (_jsxs(React.Fragment, { children: [_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: taxonomy.isEdit && (_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: "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
326
  .filter((item) => item.parentId === taxonomy.id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "14.0.2",
3
+ "version": "14.0.4",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -307,7 +307,7 @@ const Taxionomies = ({ url }: TaxionomiesProps) => {
307
307
  </button>
308
308
  </div>
309
309
 
310
- <div className="flex-grow ml-0 mt-4 w-0 ">
310
+ {/* <div className="flex-grow ml-0 mt-4 w-0 ">
311
311
  <button
312
312
  type="button"
313
313
  onClick={(event) =>
@@ -318,7 +318,7 @@ const Taxionomies = ({ url }: TaxionomiesProps) => {
318
318
  <FaPlus className="mr-2 font-medium" />
319
319
  Taxonomy
320
320
  </button>
321
- </div>
321
+ </div> */}
322
322
  </div>
323
323
  </div>
324
324
  );
@@ -180,25 +180,25 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
180
180
  };
181
181
 
182
182
  // Handle save operation
183
- const handleSave = async (event: React.MouseEvent<HTMLButtonElement>) => {
184
- event.preventDefault();
185
- if (!validateForm()) return;
186
-
187
- try {
188
- if (isEditMode) {
189
- await updateTaxonomyApi(url, id, inputType, Number(code), value);
190
- alert("Taxonomy updated successfully");
191
- } else {
192
- await addTaxonomyApi(url, inputType, Number(code), value);
193
- alert("Taxonomy added successfully");
194
- }
195
- window.history.pushState({}, "", "/admin/taxinomies");
196
- window.dispatchEvent(new PopStateEvent("popstate"));
197
- } catch (error) {
198
- console.error("Error adding/updating Taxonomy:", error);
199
- alert("Failed to add/update Taxonomy");
200
- }
201
- };
183
+ // const handleSave = async (event: React.MouseEvent<HTMLButtonElement>) => {
184
+ // event.preventDefault();
185
+ // if (!validateForm()) return;
186
+
187
+ // try {
188
+ // if (isEditMode) {
189
+ // await updateTaxonomyApi(url, id, inputType, Number(code), value);
190
+ // alert("Taxonomy updated successfully");
191
+ // } else {
192
+ // await addTaxonomyApi(url, inputType, Number(code), value);
193
+ // alert("Taxonomy added successfully");
194
+ // }
195
+ // window.history.pushState({}, "", "/admin/taxinomies");
196
+ // window.dispatchEvent(new PopStateEvent("popstate"));
197
+ // } catch (error) {
198
+ // console.error("Error adding/updating Taxonomy:", error);
199
+ // alert("Failed to add/update Taxonomy");
200
+ // }
201
+ // };
202
202
 
203
203
  useEffect(() => {
204
204
  const fetchIsMultiple = async () => {
@@ -539,15 +539,14 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
539
539
  <table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
540
540
  <thead className="bg-gray-50 dark:bg-gray-800">
541
541
  <tr>
542
- {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
543
- <th
544
- scope="col"
545
- className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
546
- style={{ width: "200px" }}
547
- >
548
- Actions
549
- </th>
550
- )}
542
+ <th
543
+ scope="col"
544
+ className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
545
+ style={{ width: "200px" }}
546
+ >
547
+ {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
548
+ "Actions"}
549
+ </th>
551
550
  <th className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400">
552
551
  Code
553
552
  </th>