eleven-solutions-common-website-unique-web 2.0.27 → 2.0.28
Sign up to get free protection for your applications and to get access to all the features.
@@ -92,7 +92,7 @@ const TaxonomyForm = () => {
|
|
92
92
|
alert("Taxonomy added successfully");
|
93
93
|
}
|
94
94
|
// window.location.href = "/admin/taxinomies";
|
95
|
-
window.history.pushState({}, "", "/admin/
|
95
|
+
window.history.pushState({}, "", "/admin/users");
|
96
96
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
97
97
|
}
|
98
98
|
catch (error) {
|
@@ -225,9 +225,7 @@ const TaxonomyForm = () => {
|
|
225
225
|
console.error("Error deleting Taxonomy:", error);
|
226
226
|
}
|
227
227
|
});
|
228
|
-
return (_jsxs("div", { className: `${
|
229
|
-
// isEditMode && isMultiple ? "w-full" : "max-w-4xl"
|
230
|
-
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}` : "" }), _jsxs("form", { children: [!isEditMode && (_jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Type ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: type, onChange: (e) => setType(e.target.value), type: "text", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Type" })] })), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Code ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: code, onChange: (e) => setCode(e.target.value === "" ? "" : Number(e.target.value)), type: "number", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Code", disabled: similarTaxonomies.some((taxonomy) => taxonomy.isEdit === false) })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Value ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: value, onChange: (e) => setValue(e.target.value), type: "text", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Value", disabled: similarTaxonomies.some((taxonomy) => taxonomy.isEdit === false) })] }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-between", children: [_jsx("div", { children: isEditMode && (
|
228
|
+
return (_jsxs("div", { className: `${isEditMode && isMultiple ? "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}` : "" }), !isMultiple && (_jsxs("form", { children: [!isEditMode && (_jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Type ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: type, onChange: (e) => setType(e.target.value), type: "text", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Type" })] })), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Code ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: code, onChange: (e) => setCode(e.target.value === "" ? "" : Number(e.target.value)), type: "number", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Code", disabled: similarTaxonomies.some((taxonomy) => taxonomy.isEdit === false) })] }), _jsxs("div", { className: "mb-6 w-full", children: [_jsxs("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: ["Value ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx("input", { required: true, value: value, onChange: (e) => setValue(e.target.value), type: "text", className: "w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring", placeholder: "Enter Value", disabled: similarTaxonomies.some((taxonomy) => taxonomy.isEdit === false) })] }), _jsxs("div", { className: "flex space-x-4 mt-6 justify-between", children: [_jsx("div", { children: isEditMode && (
|
231
229
|
// <div>
|
232
230
|
// {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
233
231
|
// <button
|
@@ -246,7 +244,7 @@ const TaxonomyForm = () => {
|
|
246
244
|
handleDeleteClick(id);
|
247
245
|
window.location.href = "/admin/taxinomies";
|
248
246
|
}, 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) &&
|
249
|
-
!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 && 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", { 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", { 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) => (_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: () => 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", "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", { type: "button", onClick: () => {
|
247
|
+
!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", { 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", { 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) => (_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: () => 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", "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", { type: "button", onClick: () => {
|
250
248
|
handleEditClick(index, taxonomy.id);
|
251
249
|
}, 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" }) }) })] }) })), _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: taxonomy.value })] }, index))) })] }) }), similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_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", children: "Edit/Delete" }), _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: () => {
|
252
250
|
const newTempTaxonomy = [...tempTaxonomy];
|
@@ -254,7 +252,7 @@ const TaxonomyForm = () => {
|
|
254
252
|
setTempTaxonomy(newTempTaxonomy);
|
255
253
|
}, 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", { type: "button", onClick: () => {
|
256
254
|
handleTempEditClick(index);
|
257
|
-
}, 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" }) }) })] }) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: item.code }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: item.value })] }, index))) })] }) }), _jsx("div", { className: "flex space-x-4 mt-6 justify-start", children: _jsx("button", { type: "button", onClick: handleSaveClick, 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: "Save" }) })] })) })), _jsxs("div", { className: "flex space-x-4 mt-6 justify-end", children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("button", { type: "submit", onClick: handleSubmit, 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" })] })] }), _jsx("div", { className: `fixed inset-y-0 right-0 z-50 w-1/3 bg-white dark:bg-gray-800 p-6 shadow-lg transform ${isModalOpen ? "translate-x-0" : "translate-x-full"} transition-transform duration-300`, children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "flex justify-between", children: [_jsx("h2", { className: "text-xl font-bold text-blue-600 mb-4 ", children: editTaxonomyItem || editTempTaxonomyItem
|
255
|
+
}, 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" }) }) })] }) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: item.code }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-400", children: item.value })] }, index))) })] }) }), _jsx("div", { className: "flex space-x-4 mt-6 justify-start", children: _jsx("button", { type: "button", onClick: handleSaveClick, 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: "Save" }) })] })) })), isMultiple && (_jsxs("div", { className: "flex space-x-4 mt-6 justify-end", children: [similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (_jsx("button", { type: "submit", onClick: handleSubmit, 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" })] }))] }), _jsx("div", { className: `fixed inset-y-0 right-0 z-50 w-1/3 bg-white dark:bg-gray-800 p-6 shadow-lg transform ${isModalOpen ? "translate-x-0" : "translate-x-full"} transition-transform duration-300`, children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "flex justify-between", children: [_jsx("h2", { className: "text-xl font-bold text-blue-600 mb-4 ", children: editTaxonomyItem || editTempTaxonomyItem
|
258
256
|
? "Edit Values"
|
259
257
|
: "Add Values" }), _jsx("button", { onClick: handleCloseModal, className: "text-xl text-gray-600 dark:text-gray-400 h-6 w-6", children: "\u00D7" })] }), _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" })] })] }) })] }));
|
260
258
|
};
|
package/package.json
CHANGED
@@ -121,7 +121,7 @@ const TaxonomyForm = () => {
|
|
121
121
|
alert("Taxonomy added successfully");
|
122
122
|
}
|
123
123
|
// window.location.href = "/admin/taxinomies";
|
124
|
-
window.history.pushState({}, "", "/admin/
|
124
|
+
window.history.pushState({}, "", "/admin/users");
|
125
125
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
126
126
|
} catch (error) {
|
127
127
|
console.error("Error adding/updating Taxonomy:", error);
|
@@ -280,8 +280,7 @@ const TaxonomyForm = () => {
|
|
280
280
|
return (
|
281
281
|
<div
|
282
282
|
className={`${
|
283
|
-
|
284
|
-
isEditMode ? "w-full" : "max-w-4xl"
|
283
|
+
isEditMode && isMultiple ? "w-full" : "max-w-4xl"
|
285
284
|
} p-6 mx-auto dark:bg-gray-800`}
|
286
285
|
>
|
287
286
|
<div
|
@@ -296,104 +295,94 @@ const TaxonomyForm = () => {
|
|
296
295
|
{isEditMode ? `Taxonomy Type: ${type}` : ""}
|
297
296
|
</h1>
|
298
297
|
|
299
|
-
{
|
300
|
-
|
301
|
-
|
298
|
+
{!isMultiple && (
|
299
|
+
<form>
|
300
|
+
{!isEditMode && (
|
301
|
+
<div className="mb-6 w-full">
|
302
|
+
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
303
|
+
Type <span className="text-red-500">*</span>
|
304
|
+
</label>
|
305
|
+
<input
|
306
|
+
required
|
307
|
+
value={type}
|
308
|
+
onChange={(e) => setType(e.target.value)}
|
309
|
+
type="text"
|
310
|
+
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
311
|
+
placeholder="Enter Type"
|
312
|
+
/>
|
313
|
+
</div>
|
314
|
+
)}
|
315
|
+
<div className="mb-6 w-full">
|
316
|
+
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
317
|
+
Code <span className="text-red-500">*</span>
|
318
|
+
</label>
|
319
|
+
<input
|
320
|
+
required
|
321
|
+
value={code}
|
322
|
+
onChange={(e) =>
|
323
|
+
setCode(e.target.value === "" ? "" : Number(e.target.value))
|
324
|
+
}
|
325
|
+
type="number"
|
326
|
+
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
327
|
+
placeholder="Enter Code"
|
328
|
+
disabled={similarTaxonomies.some(
|
329
|
+
(taxonomy) => taxonomy.isEdit === false
|
330
|
+
)}
|
331
|
+
/>
|
332
|
+
</div>
|
302
333
|
<div className="mb-6 w-full">
|
303
334
|
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
304
|
-
|
335
|
+
Value <span className="text-red-500">*</span>
|
305
336
|
</label>
|
306
337
|
<input
|
307
338
|
required
|
308
|
-
value={
|
309
|
-
onChange={(e) =>
|
339
|
+
value={value}
|
340
|
+
onChange={(e) => setValue(e.target.value)}
|
310
341
|
type="text"
|
311
342
|
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
312
|
-
placeholder="Enter
|
343
|
+
placeholder="Enter Value"
|
344
|
+
disabled={similarTaxonomies.some(
|
345
|
+
(taxonomy) => taxonomy.isEdit === false
|
346
|
+
)}
|
313
347
|
/>
|
314
348
|
</div>
|
315
|
-
)}
|
316
|
-
<div className="mb-6 w-full">
|
317
|
-
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
318
|
-
Code <span className="text-red-500">*</span>
|
319
|
-
</label>
|
320
|
-
<input
|
321
|
-
required
|
322
|
-
value={code}
|
323
|
-
onChange={(e) =>
|
324
|
-
setCode(e.target.value === "" ? "" : Number(e.target.value))
|
325
|
-
}
|
326
|
-
type="number"
|
327
|
-
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
328
|
-
placeholder="Enter Code"
|
329
|
-
disabled={similarTaxonomies.some(
|
330
|
-
(taxonomy) => taxonomy.isEdit === false
|
331
|
-
)}
|
332
|
-
/>
|
333
|
-
</div>
|
334
|
-
<div className="mb-6 w-full">
|
335
|
-
<label className="text-gray-900 dark:text-gray-200 font-semibold">
|
336
|
-
Value <span className="text-red-500">*</span>
|
337
|
-
</label>
|
338
|
-
<input
|
339
|
-
required
|
340
|
-
value={value}
|
341
|
-
onChange={(e) => setValue(e.target.value)}
|
342
|
-
type="text"
|
343
|
-
className="w-full px-4 py-2 mt-2 text-gray-800 bg-white border border-gray-400 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-800 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring"
|
344
|
-
placeholder="Enter Value"
|
345
|
-
disabled={similarTaxonomies.some(
|
346
|
-
(taxonomy) => taxonomy.isEdit === false
|
347
|
-
)}
|
348
|
-
/>
|
349
|
-
</div>
|
350
349
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
350
|
+
<div className="flex space-x-4 mt-6 justify-between">
|
351
|
+
<div>
|
352
|
+
{isEditMode && (
|
353
|
+
// <div>
|
354
|
+
// {similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
355
|
+
// <button
|
356
|
+
// type="button"
|
357
|
+
// onClick={() => {
|
358
|
+
// handleDeleteClick(id);
|
359
|
+
// navigate("/admin/taxonomy");
|
360
|
+
// }}
|
361
|
+
// 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"
|
362
|
+
// >
|
363
|
+
// Delete
|
364
|
+
// </button>
|
365
|
+
// )}
|
366
|
+
// </div>
|
367
|
+
<div>
|
368
|
+
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
369
|
+
<button
|
370
|
+
type="button"
|
371
|
+
onClick={() => {
|
372
|
+
handleDeleteClick(id);
|
373
|
+
window.location.href = "/admin/taxinomies";
|
374
|
+
}}
|
375
|
+
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"
|
376
|
+
>
|
377
|
+
Delete
|
378
|
+
</button>
|
379
|
+
)}
|
380
|
+
</div>
|
381
|
+
)}
|
382
|
+
</div>
|
384
383
|
|
385
|
-
|
386
|
-
|
387
|
-
<button
|
388
|
-
type="submit"
|
389
|
-
onClick={handleSave}
|
390
|
-
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"
|
391
|
-
>
|
392
|
-
{isEditMode ? "Save" : "Add"}
|
393
|
-
</button>
|
394
|
-
)}
|
395
|
-
{!similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
|
396
|
-
!isEditMode && (
|
384
|
+
<div className="flex space-x-4 justify-end">
|
385
|
+
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
397
386
|
<button
|
398
387
|
type="submit"
|
399
388
|
onClick={handleSave}
|
@@ -402,21 +391,30 @@ const TaxonomyForm = () => {
|
|
402
391
|
{isEditMode ? "Save" : "Add"}
|
403
392
|
</button>
|
404
393
|
)}
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
394
|
+
{!similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
|
395
|
+
!isEditMode && (
|
396
|
+
<button
|
397
|
+
type="submit"
|
398
|
+
onClick={handleSave}
|
399
|
+
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"
|
400
|
+
>
|
401
|
+
{isEditMode ? "Save" : "Add"}
|
402
|
+
</button>
|
403
|
+
)}
|
404
|
+
<button
|
405
|
+
onClick={handleCancelClick}
|
406
|
+
type="button"
|
407
|
+
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"
|
408
|
+
>
|
409
|
+
Cancel
|
410
|
+
</button>
|
411
|
+
</div>
|
412
412
|
</div>
|
413
|
-
</
|
414
|
-
|
415
|
-
{/* // )} */}
|
413
|
+
</form>
|
414
|
+
)}
|
416
415
|
|
417
416
|
{/* Table for Displaying Similar Taxonomies */}
|
418
|
-
{
|
419
|
-
{isSimilarTaxonomyOpen && isEditMode && (
|
417
|
+
{isSimilarTaxonomyOpen && isMultiple && isEditMode && (
|
420
418
|
<div className="flex-grow ml-0 mt-4 w-full">
|
421
419
|
<div className="overflow-hidden border border-gray-200 dark:border-gray-700 md:rounded-lg mt-6">
|
422
420
|
<table className="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
@@ -623,26 +621,26 @@ const TaxonomyForm = () => {
|
|
623
621
|
</>
|
624
622
|
)}
|
625
623
|
|
626
|
-
{
|
627
|
-
|
628
|
-
|
624
|
+
{isMultiple && (
|
625
|
+
<div className="flex space-x-4 mt-6 justify-end">
|
626
|
+
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
627
|
+
<button
|
628
|
+
type="submit"
|
629
|
+
onClick={handleSubmit}
|
630
|
+
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"
|
631
|
+
>
|
632
|
+
{isEditMode ? "Save " : "Add "}
|
633
|
+
</button>
|
634
|
+
)}
|
629
635
|
<button
|
630
|
-
|
631
|
-
|
636
|
+
onClick={handleCancelClick}
|
637
|
+
type="button"
|
632
638
|
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"
|
633
639
|
>
|
634
|
-
|
640
|
+
Cancel
|
635
641
|
</button>
|
636
|
-
|
637
|
-
|
638
|
-
onClick={handleCancelClick}
|
639
|
-
type="button"
|
640
|
-
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"
|
641
|
-
>
|
642
|
-
Cancel
|
643
|
-
</button>
|
644
|
-
</div>
|
645
|
-
{/* // )} */}
|
642
|
+
</div>
|
643
|
+
)}
|
646
644
|
</div>
|
647
645
|
|
648
646
|
{/* Drawer */}
|