eleven-solutions-common-website-unique-web 4.0.5 → 4.0.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -141,7 +141,7 @@ const TaxonomyForm = () => {
|
|
141
141
|
useEffect(() => {
|
142
142
|
const fetchIsMultiple = () => __awaiter(void 0, void 0, void 0, function* () {
|
143
143
|
try {
|
144
|
-
const result = yield isMultipleApi(
|
144
|
+
const result = yield isMultipleApi(type);
|
145
145
|
setIsMultiple(typeof result === "boolean");
|
146
146
|
}
|
147
147
|
catch (error) {
|
@@ -149,7 +149,7 @@ const TaxonomyForm = () => {
|
|
149
149
|
}
|
150
150
|
});
|
151
151
|
fetchIsMultiple();
|
152
|
-
}, [
|
152
|
+
}, [type]);
|
153
153
|
// useEffect(() => {
|
154
154
|
// const fetchIsMultiple = async () => {
|
155
155
|
// try {
|
@@ -269,8 +269,7 @@ const TaxonomyForm = () => {
|
|
269
269
|
}, 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) &&
|
270
270
|
!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: () => {
|
271
271
|
handleEditClick(index, taxonomy.id);
|
272
|
-
}, 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) &&
|
273
|
-
similarTaxonomies.some((taxonomy) => taxonomy.isView) && (_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: () => {
|
272
|
+
}, 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: () => {
|
274
273
|
const newTempTaxonomy = [...tempTaxonomy];
|
275
274
|
newTempTaxonomy.splice(index, 1);
|
276
275
|
setTempTaxonomy(newTempTaxonomy);
|
@@ -8,4 +8,4 @@ export declare const addMultipleTaxonomiesApi: (taxonomies: {
|
|
8
8
|
code: number;
|
9
9
|
value: string;
|
10
10
|
}[]) => Promise<Axios.AxiosXHR<unknown>>;
|
11
|
-
export declare const isMultipleApi: (
|
11
|
+
export declare const isMultipleApi: (type: string) => Promise<unknown>;
|
@@ -118,10 +118,10 @@ export const addMultipleTaxonomiesApi = (taxonomies) => __awaiter(void 0, void 0
|
|
118
118
|
throw error;
|
119
119
|
}
|
120
120
|
});
|
121
|
-
export const isMultipleApi = (
|
121
|
+
export const isMultipleApi = (type) => __awaiter(void 0, void 0, void 0, function* () {
|
122
122
|
const token = cookies.get("token");
|
123
123
|
try {
|
124
|
-
const response = yield axios.get(`${apiUrl}/taxonomy/IsTaxonomyMultipleByType/${
|
124
|
+
const response = yield axios.get(`${apiUrl}/taxonomy/IsTaxonomyMultipleByType/${type}`, {
|
125
125
|
headers: {
|
126
126
|
Authorization: `Bearer ${token}`,
|
127
127
|
},
|
package/package.json
CHANGED
@@ -175,7 +175,7 @@ const TaxonomyForm = () => {
|
|
175
175
|
useEffect(() => {
|
176
176
|
const fetchIsMultiple = async () => {
|
177
177
|
try {
|
178
|
-
const result = await isMultipleApi(
|
178
|
+
const result = await isMultipleApi(type);
|
179
179
|
setIsMultiple(typeof result === "boolean");
|
180
180
|
} catch (error) {
|
181
181
|
console.error("Error checking if taxonomy is multiple:", error);
|
@@ -183,7 +183,7 @@ const TaxonomyForm = () => {
|
|
183
183
|
};
|
184
184
|
|
185
185
|
fetchIsMultiple();
|
186
|
-
}, [
|
186
|
+
}, [type]);
|
187
187
|
|
188
188
|
// useEffect(() => {
|
189
189
|
// const fetchIsMultiple = async () => {
|
@@ -533,19 +533,18 @@ const TaxonomyForm = () => {
|
|
533
533
|
</tbody>
|
534
534
|
</table>
|
535
535
|
</div>
|
536
|
-
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) &&
|
537
|
-
|
538
|
-
<
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
)}
|
536
|
+
{similarTaxonomies.some((taxonomy) => taxonomy.isEdit) && (
|
537
|
+
<div className="flex space-x-4 mt-6 justify-start">
|
538
|
+
<button
|
539
|
+
type="button"
|
540
|
+
onClick={handleOpenModal}
|
541
|
+
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"
|
542
|
+
>
|
543
|
+
<FaPlus className="mr-2 font-medium" />
|
544
|
+
Add Multiple Values
|
545
|
+
</button>
|
546
|
+
</div>
|
547
|
+
)}
|
549
548
|
</div>
|
550
549
|
)}
|
551
550
|
|
@@ -146,12 +146,12 @@ export const addMultipleTaxonomiesApi = async (
|
|
146
146
|
}
|
147
147
|
};
|
148
148
|
|
149
|
-
export const isMultipleApi = async (
|
149
|
+
export const isMultipleApi = async (type: string) => {
|
150
150
|
const token = cookies.get("token");
|
151
151
|
|
152
152
|
try {
|
153
153
|
const response = await axios.get(
|
154
|
-
`${apiUrl}/taxonomy/IsTaxonomyMultipleByType/${
|
154
|
+
`${apiUrl}/taxonomy/IsTaxonomyMultipleByType/${type}`,
|
155
155
|
{
|
156
156
|
headers: {
|
157
157
|
Authorization: `Bearer ${token}`,
|