eleven-solutions-common-website-unique-web 10.0.24 → 11.0.1

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.
@@ -152,7 +152,8 @@ const TaxonomyForm = ({ url }) => {
152
152
  yield addTaxonomyApi(url, inputType, Number(code), value);
153
153
  alert("Taxonomy added successfully");
154
154
  }
155
- window.location.href = "/admin/taxinomies";
155
+ window.history.pushState({}, "", "/admin/taxinomies");
156
+ window.dispatchEvent(new PopStateEvent("popstate"));
156
157
  }
157
158
  catch (error) {
158
159
  console.error("Error adding/updating Taxonomy:", error);
@@ -237,7 +238,7 @@ const TaxonomyForm = ({ url }) => {
237
238
  };
238
239
  const handleSubTypeAddClick = () => __awaiter(void 0, void 0, void 0, function* () {
239
240
  try {
240
- yield addSubTypeApi(url, selectedTaxonomyId, subType, Number(subCode), subValue);
241
+ yield addSubTypeApi(url, selectedTaxonomyId, type, Number(subCode), subValue);
241
242
  alert("SubType added successfully");
242
243
  const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
243
244
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
@@ -254,7 +255,7 @@ const TaxonomyForm = ({ url }) => {
254
255
  });
255
256
  const handleSubTypeEditClick = () => __awaiter(void 0, void 0, void 0, function* () {
256
257
  try {
257
- yield updateTaxonomyApi(url, selectedTaxonomyId, subType, Number(subCode), subValue);
258
+ yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(subCode), subValue);
258
259
  alert("SubType edited successfully");
259
260
  const fetchedTaxonomies = yield fetchTaxonomiessApi(url);
260
261
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
@@ -325,7 +326,7 @@ const TaxonomyForm = ({ url }) => {
325
326
  }, 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
327
  !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
328
  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) && (_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
329
+ 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: "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
329
330
  .filter((item) => item.parentId === taxonomy.id)
330
331
  .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));
331
332
  }) })] }) }), 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: () => {
@@ -340,7 +341,7 @@ const TaxonomyForm = ({ url }) => {
340
341
  : "Add SubType"
341
342
  : editTaxonomyItem
342
343
  ? "Edit Values"
343
- : "Add Values" }), _jsx("button", { onClick: handleCloseModal, className: "text-xl text-gray-600 dark:text-gray-400 h-6 w-6", children: "\u00D7" })] }), isAddingSubType ? (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Type" }), _jsx("input", { type: "text", value: subType, onChange: (e) => setSubType(e.target.value), placeholder: "Enter Type", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: subCode, onChange: (e) => setSubCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: subValue, onChange: (e) => setSubValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" }), _jsx("button", { onClick: editTaxonomyItem
344
+ : "Add Values" }), _jsx("button", { onClick: handleCloseModal, className: "text-xl text-gray-600 dark:text-gray-400 h-6 w-6", children: "\u00D7" })] }), isAddingSubType ? (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: subCode, onChange: (e) => setSubCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: subValue, onChange: (e) => setSubValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" }), _jsx("button", { onClick: editTaxonomyItem
344
345
  ? handleSubTypeEditClick
345
346
  : handleSubTypeAddClick, 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: editTaxonomyItem ? "Edit SubType" : "Add SubType" })] })] })) : (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: newCode, onChange: (e) => setNewCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: newValue, onChange: (e) => setNewValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" }), _jsx("button", { onClick: editTaxonomyItem ? handleEditTaxClick : handleAddClick, 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: editTaxonomyItem || editTempTaxonomyItem ? "Edit" : "Add" })] })] }))] }) })] }));
346
347
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "10.0.24",
3
+ "version": "11.0.1",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -1,331 +1,3 @@
1
- // import React from "react";
2
- // import { useState, useEffect } from "react";
3
-
4
- // import { FaPlus } from "react-icons/fa";
5
- // import { fetchTaxonomiessApi } from "../api/taxonomy";
6
-
7
- // interface TaxionomiesProps {
8
- // url: string;
9
- // }
10
-
11
- // const Taxionomies = ({ url }: TaxionomiesProps) => {
12
- // const [taxonomy, setTaxonomy] = useState<any[]>([]);
13
-
14
- // const fetchTaxonomiesData = async () => {
15
- // const data = await fetchTaxonomiessApi(url);
16
- // if (data) {
17
- // const uniqueTaxonomies = (data as any[]).reduce(
18
- // (acc: any[], item: any) => {
19
- // if (
20
- // !item.parentId &&
21
- // !acc.some((taxonomy) => taxonomy.type === item.type)
22
- // ) {
23
- // acc.push(item);
24
- // }
25
- // return acc;
26
- // },
27
- // []
28
- // );
29
-
30
- // setTaxonomy(uniqueTaxonomies);
31
- // } else {
32
- // console.error("Failed to fetch taxonomies");
33
- // }
34
- // };
35
-
36
- // useEffect(() => {
37
- // fetchTaxonomiesData();
38
- // }, []);
39
-
40
- // const [currentPage, setCurrentPage] = useState(1);
41
- // const itemsPerPage = 10;
42
-
43
- // const totalPages = Math.ceil(taxonomy.length / itemsPerPage);
44
-
45
- // const handleNextPage = () => {
46
- // if (currentPage < totalPages) {
47
- // setCurrentPage(currentPage + 1);
48
- // }
49
- // };
50
-
51
- // const handlePreviousPage = () => {
52
- // if (currentPage > 1) {
53
- // setCurrentPage(currentPage - 1);
54
- // }
55
- // };
56
-
57
- // const handlePageClick = (pageNumber: number) => {
58
- // setCurrentPage(pageNumber);
59
- // };
60
-
61
- // const paginatedTaxonomies = taxonomy.slice(
62
- // (currentPage - 1) * itemsPerPage,
63
- // currentPage * itemsPerPage
64
- // );
65
-
66
- // const handleNavigation = (event: React.MouseEvent, path: string) => {
67
- // event.preventDefault();
68
- // window.history.pushState({}, "", path);
69
- // window.dispatchEvent(new PopStateEvent("popstate"));
70
- // };
71
-
72
- // const handleViewClick = (
73
- // event: React.MouseEvent,
74
- // path: string,
75
- // id: string,
76
- // type: string
77
- // ) => {
78
- // event.preventDefault();
79
-
80
- // const queryParams = new URLSearchParams({ id, type });
81
- // const fullPath = `${path}${queryParams.toString()}`;
82
-
83
- // window.history.pushState({ id, type }, "", fullPath);
84
-
85
- // window.dispatchEvent(new PopStateEvent("popstate"));
86
- // };
87
-
88
- // return (
89
- // <div className="container px-4 mx-auto mt-6 h-full">
90
- // <div className="w-3/4">
91
- // <h1 className="text-3xl font-bold text-blue-600 mb-5">Taxonomy</h1>
92
- // </div>
93
- // <div className="flex-grow ml-0 w-full mt-10">
94
- // <form className="w-full ">
95
- // <label
96
- // htmlFor="default-search"
97
- // className="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white"
98
- // >
99
- // Search
100
- // </label>
101
- // <div className="relative w-full">
102
- // <div className="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
103
- // <svg
104
- // className="w-4 h-4 text-gray-500 dark:text-gray-400"
105
- // aria-hidden="true"
106
- // xmlns="http://www.w3.org/2000/svg"
107
- // fill="none"
108
- // viewBox="0 0 20 20"
109
- // >
110
- // <path
111
- // stroke="currentColor"
112
- // stroke-linecap="round"
113
- // stroke-linejoin="round"
114
- // stroke-width="2"
115
- // d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
116
- // />
117
- // </svg>
118
- // </div>
119
- // <input
120
- // type="search"
121
- // id="default-search"
122
- // 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"
123
- // placeholder="Search Taxonomies"
124
- // required
125
- // />
126
- // <button
127
- // type="submit"
128
- // 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"
129
- // >
130
- // Search
131
- // </button>
132
- // </div>
133
- // </form>
134
- // </div>
135
- // <div className="flex-grow ml-0 w-3/4">
136
- // <form className="w-auto">{/* Search Form */}</form>
137
- // </div>
138
- // <div className="flex-grow ml-0 mt-4 w-full">
139
- // <div className="overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6">
140
- // <table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
141
- // <thead className="bg-gray-50 dark:bg-gray-800">
142
- // <tr>
143
- // <th
144
- // scope="col"
145
- // className="px-4 py-3.5 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
146
- // style={{ width: "200px" }}
147
- // >
148
- // Actions
149
- // </th>
150
- // <th
151
- // scope="col"
152
- // className="py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
153
- // >
154
- // Type
155
- // </th>
156
- // </tr>
157
- // </thead>
158
- // <tbody className="bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900">
159
- // {paginatedTaxonomies
160
- // .filter((taxonomy) => taxonomy.isView)
161
- // .map((taxonomy, index) => (
162
- // <tr key={taxonomy.id || index}>
163
- // <td className="px-4 py-4 text-sm whitespace-nowrap">
164
- // <div className="flex items-center gap-x-6">
165
- // {taxonomy.isEdit ? (
166
- // <button
167
- // type="button"
168
- // onClick={(event) => {
169
- // handleViewClick(
170
- // event,
171
- // "/admin/taxinomies/taxonomyform?",
172
- // taxonomy.id,
173
- // taxonomy.type
174
- // );
175
- // }}
176
- // className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none"
177
- // >
178
- // {/* Edit icon */}
179
- // <svg
180
- // xmlns="http://www.w3.org/2000/svg"
181
- // fill="none"
182
- // viewBox="0 0 24 24"
183
- // stroke-width="1.5"
184
- // stroke="currentColor"
185
- // className="w-5 h-5"
186
- // >
187
- // <path
188
- // stroke-linecap="round"
189
- // stroke-linejoin="round"
190
- // 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"
191
- // />
192
- // </svg>
193
- // </button>
194
- // ) : taxonomy.isView ? (
195
- // <button
196
- // onClick={(event) => {
197
- // handleViewClick(
198
- // event,
199
- // "/admin/taxinomies/taxonomyform?",
200
- // taxonomy.id,
201
- // taxonomy.type
202
- // );
203
- // }}
204
- // className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-blue-500 focus:outline-none"
205
- // >
206
- // {/* Eye icon */}
207
- // <svg
208
- // xmlns="http://www.w3.org/2000/svg"
209
- // fill="none"
210
- // viewBox="0 0 24 24"
211
- // stroke-width="1.5"
212
- // stroke="currentColor"
213
- // className="w-5 h-5"
214
- // >
215
- // <path
216
- // stroke-linecap="round"
217
- // stroke-linejoin="round"
218
- // 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"
219
- // />
220
- // <path
221
- // stroke-linecap="round"
222
- // stroke-linejoin="round"
223
- // d="M12 9a3 3 0 100 6 3 3 0 000-6z"
224
- // />
225
- // </svg>
226
- // </button>
227
- // ) : null}
228
- // </div>
229
- // </td>
230
- // <td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
231
- // <div className="inline-flex items-center gap-x-3">
232
- // <div className="flex items-center gap-x-2">
233
- // <div>
234
- // <h2 className=" text-sm font-medium text-gray-800 dark:text-white ">
235
- // {taxonomy.type}
236
- // </h2>
237
- // </div>
238
- // </div>
239
- // </div>
240
- // </td>
241
- // </tr>
242
- // ))}
243
- // </tbody>
244
- // </table>
245
- // </div>
246
-
247
- // <div className="flex items-center justify-between mt-6">
248
- // <button
249
- // onClick={handlePreviousPage}
250
- // disabled={currentPage === 1}
251
- // 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"
252
- // >
253
- // <svg
254
- // xmlns="http://www.w3.org/2000/svg"
255
- // fill="none"
256
- // viewBox="0 0 24 24"
257
- // stroke-width="1.5"
258
- // stroke="currentColor"
259
- // className="w-5 h-5 rtl:-scale-x-100"
260
- // >
261
- // <path
262
- // stroke-linecap="round"
263
- // stroke-linejoin="round"
264
- // d="M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18"
265
- // />
266
- // </svg>
267
-
268
- // <span>previous</span>
269
- // </button>
270
-
271
- // <div className="items-center hidden lg:flex gap-x-3">
272
- // {Array.from({ length: totalPages }, (_, index) => (
273
- // <button
274
- // key={index + 1}
275
- // onClick={() => handlePageClick(index + 1)}
276
- // className={`px-2 py-1 text-sm ${
277
- // currentPage === index + 1
278
- // ? "text-blue-500 bg-blue-100"
279
- // : "text-gray-500 hover:bg-gray-100"
280
- // } rounded-md`}
281
- // >
282
- // {index + 1}
283
- // </button>
284
- // ))}
285
- // </div>
286
- // <button
287
- // onClick={handleNextPage}
288
- // disabled={currentPage === totalPages}
289
- // 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"
290
- // >
291
- // <span>Next</span>
292
-
293
- // <svg
294
- // xmlns="http://www.w3.org/2000/svg"
295
- // fill="none"
296
- // viewBox="0 0 24 24"
297
- // stroke-width="1.5"
298
- // stroke="currentColor"
299
- // className="w-5 h-5 rtl:-scale-x-100"
300
- // >
301
- // <path
302
- // stroke-linecap="round"
303
- // stroke-linejoin="round"
304
- // d="M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3"
305
- // />
306
- // </svg>
307
- // </button>
308
- // </div>
309
-
310
- // <div className="flex-grow ml-0 mt-4 w-0 ">
311
- // <button
312
- // type="button"
313
- // onClick={(event) =>
314
- // handleNavigation(event, "/admin/taxinomies/taxonomyform")
315
- // }
316
- // 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"
317
- // >
318
- // <FaPlus className="mr-2 font-medium" />
319
- // Taxonomy
320
- // </button>
321
- // </div>
322
- // </div>
323
- // </div>
324
- // );
325
- // };
326
-
327
- // export default Taxionomies;
328
-
329
1
  import React from "react";
330
2
  import { useState, useEffect } from "react";
331
3
 
@@ -192,7 +192,8 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
192
192
  await addTaxonomyApi(url, inputType, Number(code), value);
193
193
  alert("Taxonomy added successfully");
194
194
  }
195
- window.location.href = "/admin/taxinomies";
195
+ window.history.pushState({}, "", "/admin/taxinomies");
196
+ window.dispatchEvent(new PopStateEvent("popstate"));
196
197
  } catch (error) {
197
198
  console.error("Error adding/updating Taxonomy:", error);
198
199
  alert("Failed to add/update Taxonomy");
@@ -297,7 +298,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
297
298
  await addSubTypeApi(
298
299
  url,
299
300
  selectedTaxonomyId,
300
- subType,
301
+ type,
301
302
  Number(subCode),
302
303
  subValue
303
304
  );
@@ -320,7 +321,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
320
321
  await updateTaxonomyApi(
321
322
  url,
322
323
  selectedTaxonomyId,
323
- subType,
324
+ type,
324
325
  Number(subCode),
325
326
  subValue
326
327
  );
@@ -562,8 +563,8 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
562
563
  return (
563
564
  <React.Fragment key={taxonomy.id}>
564
565
  <tr key={index}>
565
- {taxonomy.isEdit && (
566
- <td className="px-4 py-4 text-sm whitespace-nowrap">
566
+ <td className="px-4 py-4 text-sm whitespace-nowrap">
567
+ {taxonomy.isEdit && (
567
568
  <div className="flex items-center gap-x-6">
568
569
  <button
569
570
  type="button"
@@ -632,8 +633,9 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
632
633
  </svg>
633
634
  </button>
634
635
  </div>
635
- </td>
636
- )}
636
+ )}
637
+ </td>
638
+
637
639
  <td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-400">
638
640
  {taxonomy.code}
639
641
  </td>
@@ -971,7 +973,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
971
973
 
972
974
  {isAddingSubType ? (
973
975
  <>
974
- <label className="text-gray-900 dark:text-gray-200 font-semibold">
976
+ {/* <label className="text-gray-900 dark:text-gray-200 font-semibold">
975
977
  Type
976
978
  </label>
977
979
  <input
@@ -980,7 +982,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
980
982
  onChange={(e) => setSubType(e.target.value)}
981
983
  placeholder="Enter Type"
982
984
  className="w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md"
983
- />
985
+ /> */}
984
986
  <label className="text-gray-900 dark:text-gray-200 font-semibold">
985
987
  Code
986
988
  </label>