eleven-solutions-common-website-unique-web 21.0.18 → 21.0.20
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.
@@ -66,13 +66,6 @@ const TaxonomyForm = ({ url }) => {
|
|
66
66
|
const [editTaxonomyItem, setEditTaxonomyItem] = useState(null);
|
67
67
|
const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState(null);
|
68
68
|
const [selectedTaxonomyId, setSelectedTaxonomyId] = useState("");
|
69
|
-
const validateForm = () => {
|
70
|
-
if (!inputType || !code || !value) {
|
71
|
-
alert("Please fill in all required fields: Type, Code, and Value.");
|
72
|
-
return false;
|
73
|
-
}
|
74
|
-
return true;
|
75
|
-
};
|
76
69
|
const queryParams = new URLSearchParams(window.location.search);
|
77
70
|
const id = queryParams.get("id");
|
78
71
|
useEffect(() => {
|
@@ -156,31 +149,6 @@ const TaxonomyForm = ({ url }) => {
|
|
156
149
|
setSubCode("");
|
157
150
|
setSubValue("");
|
158
151
|
};
|
159
|
-
const handleAddClick = () => {
|
160
|
-
if (newCode === "" || newValue === "") {
|
161
|
-
alert("Please fill in all required fields: Code, and Value.");
|
162
|
-
return;
|
163
|
-
}
|
164
|
-
const newTaxonomyItem = { type: type, code: newCode, value: newValue };
|
165
|
-
if (editTempTaxonomyItem) {
|
166
|
-
const updatedTempTaxonomy = tempTaxonomy.map((item) => item === editTempTaxonomyItem ? newTaxonomyItem : item);
|
167
|
-
setTempTaxonomy(updatedTempTaxonomy);
|
168
|
-
setEditTempTaxonomyItem(null);
|
169
|
-
}
|
170
|
-
else {
|
171
|
-
setTempTaxonomy([...tempTaxonomy, newTaxonomyItem]);
|
172
|
-
}
|
173
|
-
setNewCode("");
|
174
|
-
setNewValue("");
|
175
|
-
setIsModalOpen(false);
|
176
|
-
};
|
177
|
-
const handleTempEditClick = (index) => {
|
178
|
-
const item = tempTaxonomy[index];
|
179
|
-
setEditTempTaxonomyItem(item);
|
180
|
-
setNewCode(item.code);
|
181
|
-
setNewValue(item.value);
|
182
|
-
setIsModalOpen(true);
|
183
|
-
};
|
184
152
|
const handleEditClick = (index, id) => {
|
185
153
|
setIsAddingSubType(false);
|
186
154
|
const item = similarTaxonomies.find((taxonomy) => taxonomy.id === id);
|
@@ -260,24 +228,6 @@ const TaxonomyForm = ({ url }) => {
|
|
260
228
|
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
|
261
229
|
setSimilarTaxonomies(filteredTaxonomies);
|
262
230
|
});
|
263
|
-
const handleSaveClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
264
|
-
if (tempTaxonomy.length === 0) {
|
265
|
-
alert("No taxonomies to add.");
|
266
|
-
return;
|
267
|
-
}
|
268
|
-
try {
|
269
|
-
yield addMultipleTaxonomiesApi(url, tempTaxonomy);
|
270
|
-
setTempTaxonomy([]);
|
271
|
-
alert("Multiple taxonomies added successfully");
|
272
|
-
const response = yield fetchTaxonomiessApi(url);
|
273
|
-
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
|
274
|
-
setSimilarTaxonomies(filteredTaxonomies);
|
275
|
-
}
|
276
|
-
catch (error) {
|
277
|
-
console.error("Error adding multiple taxonomies:", error);
|
278
|
-
alert("Failed to add multiple taxonomies");
|
279
|
-
}
|
280
|
-
});
|
281
231
|
const addTaxonomyClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
282
232
|
if (!newCode || !newValue) {
|
283
233
|
alert("Please fill out both Code and Value fields before adding.");
|
@@ -100,6 +100,6 @@ const Users = ({ url }) => {
|
|
100
100
|
: "Not Provided" }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: user.roleType === 1 ? "Guest" : "Admin" })] }, user.id || index))) })] }) }), _jsxs("div", { className: "flex items-center justify-between mt-6", children: [_jsxs("button", { onClick: handlePreviousPage, disabled: currentPage === 1, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18" }) }), _jsx("span", { children: "previous" })] }), _jsx("div", { className: "items-center hidden lg:flex gap-x-3", children: Array.from({ length: totalPages }, (_, index) => (_jsx("button", { onClick: () => handlePageClick(index + 1), className: `px-2 py-1 text-sm ${currentPage === index + 1
|
101
101
|
? "text-blue-500 bg-blue-100"
|
102
102
|
: "text-gray-500 hover:bg-gray-100"} rounded-md`, children: index + 1 }, index + 1))) }), _jsxs("button", { onClick: handleNextPage, disabled: currentPage === totalPages, className: "flex items-center px-5 py-2 text-sm text-gray-700 capitalize transition-colors duration-200 bg-white border rounded-md gap-x-2 hover:bg-gray-100 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800", children: [_jsx("span", { children: "Next" }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "w-5 h-5 rtl:-scale-x-100", children: _jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3" }) })] })] }), _jsx("div", { className: "flex-grow ml-0 mt-4 w-0", children: _jsxs("button", { type: "button", onClick: (event) => handleNavigation(event, "/admin/users/userform"), className: "flex items-center justify-center px-6 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-600 rounded-lg hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80", children: [_jsx(FaPlus, { className: "mr-2 font-medium" }), "User"] }) })] }), _jsx("div", { className: "inset-0 bg-gray-800 bg-opacity-50 z-50 transition-opacity duration-300", children: _jsxs("div", { className: `fixed top-0 right-0 h-full w-[300px] md:w-[500px] bg-white p-4 rounded-md shadow-lg transform transition-transform duration-500 ease-in-out
|
103
|
-
${filterModal ? "translate-x-0" : "translate-x-full"}`, children: [_jsx("h1", { className: "text-2xl md:text-3xl font-bold text-blue-600 mb-4 md:mb-6", children: "Filter" }), _jsx("button", { onClick: () => setFilterModal(false), className: "absolute top-1 right-3 text-gray-400 hover:text-gray-600 text-2xl", children: "\u00D7" }), _jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "mb-4 flex flex-col", children: [_jsx("label", { className: "block text-gray-700 mb-2", children: "Role Type" }), _jsx("div", { className: "w-full", children: _jsxs("select", { value: Number(selectedRoleType), onChange: handleRoleTypeChange, required: true, className: "w-full px-4 py-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", children: [_jsx("option", { value: "", children: "All" }), _jsx("option", { value: "1", children: "Guest" }), _jsx("option", { value: "2", children: "Admin" })] }) })] }), _jsx("button", { onClick: resetFilter, className: "mt-2 px-4 py-2 bg-blue-500 text-white rounded-md w-1/2", children: "Reset" })] })] }) })] }));
|
103
|
+
${filterModal ? "translate-x-0" : "translate-x-full"}`, children: [_jsx("h1", { className: "text-2xl md:text-3xl font-bold text-blue-600 mb-4 md:mb-6", children: "Filter" }), _jsx("button", { onClick: () => setFilterModal(false), className: "absolute top-1 right-3 text-gray-400 hover:text-gray-600 text-2xl", children: "\u00D7" }), _jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "mb-4 flex flex-col", children: [_jsx("label", { className: "block text-gray-700 mb-2", children: "Role Type" }), _jsx("div", { className: "w-full", children: _jsxs("select", { value: Number(selectedRoleType), onChange: handleRoleTypeChange, required: true, className: "w-full px-4 py-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", children: [_jsx("option", { value: "", children: "All" }), _jsx("option", { value: "1", children: "Guest" }), _jsx("option", { value: "2", children: "Admin" })] }) })] }), _jsx("div", { className: "flex flex-row gap-3", children: _jsx("button", { onClick: resetFilter, className: "mt-2 px-4 py-2 bg-blue-500 text-white rounded-md w-1/2", children: "Reset" }) })] })] }) })] }));
|
104
104
|
};
|
105
105
|
export default Users;
|
package/package.json
CHANGED
@@ -96,14 +96,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
96
96
|
|
97
97
|
const [selectedTaxonomyId, setSelectedTaxonomyId] = useState<string>("");
|
98
98
|
|
99
|
-
const validateForm = () => {
|
100
|
-
if (!inputType || !code || !value) {
|
101
|
-
alert("Please fill in all required fields: Type, Code, and Value.");
|
102
|
-
return false;
|
103
|
-
}
|
104
|
-
return true;
|
105
|
-
};
|
106
|
-
|
107
99
|
const queryParams = new URLSearchParams(window.location.search);
|
108
100
|
const id = queryParams.get("id");
|
109
101
|
|
@@ -200,37 +192,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
200
192
|
setSubValue("");
|
201
193
|
};
|
202
194
|
|
203
|
-
const handleAddClick = () => {
|
204
|
-
if (newCode === "" || newValue === "") {
|
205
|
-
alert("Please fill in all required fields: Code, and Value.");
|
206
|
-
return;
|
207
|
-
}
|
208
|
-
|
209
|
-
const newTaxonomyItem = { type: type, code: newCode, value: newValue };
|
210
|
-
|
211
|
-
if (editTempTaxonomyItem) {
|
212
|
-
const updatedTempTaxonomy = tempTaxonomy.map((item) =>
|
213
|
-
item === editTempTaxonomyItem ? newTaxonomyItem : item
|
214
|
-
);
|
215
|
-
setTempTaxonomy(updatedTempTaxonomy);
|
216
|
-
setEditTempTaxonomyItem(null);
|
217
|
-
} else {
|
218
|
-
setTempTaxonomy([...tempTaxonomy, newTaxonomyItem]);
|
219
|
-
}
|
220
|
-
|
221
|
-
setNewCode("");
|
222
|
-
setNewValue("");
|
223
|
-
setIsModalOpen(false);
|
224
|
-
};
|
225
|
-
|
226
|
-
const handleTempEditClick = (index: number) => {
|
227
|
-
const item = tempTaxonomy[index];
|
228
|
-
setEditTempTaxonomyItem(item);
|
229
|
-
setNewCode(item.code);
|
230
|
-
setNewValue(item.value);
|
231
|
-
setIsModalOpen(true);
|
232
|
-
};
|
233
|
-
|
234
195
|
const handleEditClick = (index: number, id: string) => {
|
235
196
|
setIsAddingSubType(false);
|
236
197
|
|
@@ -344,26 +305,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
344
305
|
setSimilarTaxonomies(filteredTaxonomies);
|
345
306
|
};
|
346
307
|
|
347
|
-
const handleSaveClick = async () => {
|
348
|
-
if (tempTaxonomy.length === 0) {
|
349
|
-
alert("No taxonomies to add.");
|
350
|
-
return;
|
351
|
-
}
|
352
|
-
try {
|
353
|
-
await addMultipleTaxonomiesApi(url, tempTaxonomy);
|
354
|
-
setTempTaxonomy([]);
|
355
|
-
alert("Multiple taxonomies added successfully");
|
356
|
-
const response = await fetchTaxonomiessApi(url);
|
357
|
-
const filteredTaxonomies = (response as { type: string }[]).filter(
|
358
|
-
(taxonomy: { type: string }) => taxonomy.type === type
|
359
|
-
);
|
360
|
-
setSimilarTaxonomies(filteredTaxonomies);
|
361
|
-
} catch (error) {
|
362
|
-
console.error("Error adding multiple taxonomies:", error);
|
363
|
-
alert("Failed to add multiple taxonomies");
|
364
|
-
}
|
365
|
-
};
|
366
|
-
|
367
308
|
const addTaxonomyClick = async () => {
|
368
309
|
if (!newCode || !newValue) {
|
369
310
|
alert("Please fill out both Code and Value fields before adding.");
|
@@ -447,12 +447,14 @@ const Users = ({ url }: UsersProps) => {
|
|
447
447
|
</select>
|
448
448
|
</div>
|
449
449
|
</div>
|
450
|
-
<
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
450
|
+
<div className="flex flex-row gap-3">
|
451
|
+
<button
|
452
|
+
onClick={resetFilter}
|
453
|
+
className="mt-2 px-4 py-2 bg-blue-500 text-white rounded-md w-1/2"
|
454
|
+
>
|
455
|
+
Reset
|
456
|
+
</button>
|
457
|
+
</div>
|
456
458
|
</div>
|
457
459
|
</div>
|
458
460
|
</div>
|