eleven-solutions-common-website-unique-web 10.0.11 → 10.0.13
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.
- package/dist/components/admin/Taxionomies.js +1 -1
- package/dist/components/admin/Template.d.ts +4 -1
- package/dist/components/admin/Template.js +3 -3
- package/dist/components/admin/TemplateForm.d.ts +4 -1
- package/dist/components/admin/TemplateForm.js +4 -4
- package/dist/components/api/template.d.ts +5 -5
- package/dist/components/api/template.js +10 -10
- package/package.json +1 -1
- package/src/components/admin/Taxionomies.tsx +1 -1
- package/src/components/admin/Template.tsx +7 -3
- package/src/components/admin/TemplateForm.tsx +8 -4
- package/src/components/api/template.ts +18 -16
|
@@ -62,7 +62,7 @@ const Taxionomies = ({ url }) => {
|
|
|
62
62
|
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
63
63
|
};
|
|
64
64
|
return (_jsxs("div", { className: "container px-4 mx-auto mt-6 h-full", children: [_jsx("div", { className: "w-3/4", children: _jsx("h1", { className: "text-3xl font-bold text-blue-600 mb-5", children: "Taxonomy" }) }), _jsx("div", { className: "flex-grow ml-0 w-full mt-10", children: _jsxs("form", { className: "w-full ", children: [_jsx("label", { htmlFor: "default-search", className: "mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white", children: "Search" }), _jsxs("div", { className: "relative w-full", children: [_jsx("div", { className: "absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none", children: _jsx("svg", { className: "w-4 h-4 text-gray-500 dark:text-gray-400", "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: _jsx("path", { stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z" }) }) }), _jsx("input", { type: "search", id: "default-search", 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", placeholder: "Search Taxonomies", required: true }), _jsx("button", { type: "submit", 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", children: "Search" })] })] }) }), _jsx("div", { className: "flex-grow ml-0 w-3/4", children: _jsx("form", { className: "w-auto" }) }), _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: "py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400", children: "Type" })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900", children: paginatedTaxonomies
|
|
65
|
-
.filter((taxonomy) => taxonomy.isView)
|
|
65
|
+
// .filter((taxonomy) => taxonomy.isView)
|
|
66
66
|
.map((taxonomy, index) => (_jsxs("tr", { children: [_jsx("td", { className: "px-4 py-4 text-sm whitespace-nowrap", children: _jsx("div", { className: "flex items-center gap-x-6", children: taxonomy.isEdit ? (_jsx("button", { type: "button", onClick: (event) => {
|
|
67
67
|
handleViewClick(event, "/admin/taxinomies/taxonomyform?", taxonomy.id, taxonomy.type);
|
|
68
68
|
}, 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" }) }) })) : taxonomy.isView ? (_jsx("button", { onClick: (event) => {
|
|
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
import { useState, useEffect } from "react";
|
|
12
12
|
import { FaPlus } from "react-icons/fa";
|
|
13
13
|
import { fetchTemplatesApi, deleteTemplateApi } from "../api/template";
|
|
14
|
-
const Template = () => {
|
|
14
|
+
const Template = ({ url }) => {
|
|
15
15
|
const [templates, setTemplates] = useState([]);
|
|
16
16
|
const fetchTemplatesData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
const data = yield fetchTemplatesApi();
|
|
17
|
+
const data = yield fetchTemplatesApi(url);
|
|
18
18
|
if (data) {
|
|
19
19
|
setTemplates(data);
|
|
20
20
|
}
|
|
@@ -55,7 +55,7 @@ const Template = () => {
|
|
|
55
55
|
};
|
|
56
56
|
const handleDeleteClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
57
|
try {
|
|
58
|
-
yield deleteTemplateApi(id);
|
|
58
|
+
yield deleteTemplateApi(url, id);
|
|
59
59
|
alert("Template deleted successfully");
|
|
60
60
|
fetchTemplatesData();
|
|
61
61
|
}
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
import { useState, useEffect, useRef, useMemo } from "react";
|
|
12
12
|
import { addTemplateApi, fetchTemplateByIdApi, updateTemplateApi, } from "../api/template";
|
|
13
13
|
import Editor from "./Editor";
|
|
14
|
-
const TemplateForm = () => {
|
|
14
|
+
const TemplateForm = ({ url }) => {
|
|
15
15
|
const [name, setName] = useState("");
|
|
16
16
|
const [content, setContent] = useState("");
|
|
17
17
|
const placeholder = "";
|
|
@@ -34,7 +34,7 @@ const TemplateForm = () => {
|
|
|
34
34
|
if (id) {
|
|
35
35
|
const fetchTemplateData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
36
|
try {
|
|
37
|
-
const fetchedUser = yield fetchTemplateByIdApi(id);
|
|
37
|
+
const fetchedUser = yield fetchTemplateByIdApi(url, id);
|
|
38
38
|
if (fetchedUser) {
|
|
39
39
|
const user = fetchedUser;
|
|
40
40
|
setIsEditMode(true);
|
|
@@ -55,11 +55,11 @@ const TemplateForm = () => {
|
|
|
55
55
|
return;
|
|
56
56
|
try {
|
|
57
57
|
if (isEditMode) {
|
|
58
|
-
yield updateTemplateApi(id, name, content);
|
|
58
|
+
yield updateTemplateApi(url, id, name, content);
|
|
59
59
|
alert("Template updated successfully");
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
yield addTemplateApi(name, content);
|
|
62
|
+
yield addTemplateApi(url, name, content);
|
|
63
63
|
alert("Template added successfully");
|
|
64
64
|
}
|
|
65
65
|
window.history.pushState({}, "", "/admin/template");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const addTemplateApi: (name: string, content: string) => Promise<Axios.AxiosXHR<unknown>>;
|
|
2
|
-
export declare const fetchTemplatesApi: () => Promise<unknown>;
|
|
3
|
-
export declare const fetchTemplateByIdApi: (id: string) => Promise<unknown>;
|
|
4
|
-
export declare const updateTemplateApi: (id: string, name: string, content: string) => Promise<unknown>;
|
|
5
|
-
export declare const deleteTemplateApi: (id: string) => Promise<unknown>;
|
|
1
|
+
export declare const addTemplateApi: (url: string, name: string, content: string) => Promise<Axios.AxiosXHR<unknown>>;
|
|
2
|
+
export declare const fetchTemplatesApi: (url: string) => Promise<unknown>;
|
|
3
|
+
export declare const fetchTemplateByIdApi: (url: string, id: string) => Promise<unknown>;
|
|
4
|
+
export declare const updateTemplateApi: (url: string, id: string, name: string, content: string) => Promise<unknown>;
|
|
5
|
+
export declare const deleteTemplateApi: (url: string, id: string) => Promise<unknown>;
|
|
@@ -11,10 +11,10 @@ import axios from "axios";
|
|
|
11
11
|
import Cookies from "universal-cookie";
|
|
12
12
|
const apiUrl = "http://localhost:5260";
|
|
13
13
|
const cookies = new Cookies();
|
|
14
|
-
export const addTemplateApi = (name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
export const addTemplateApi = (url, name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
const token = cookies.get("authToken");
|
|
16
16
|
try {
|
|
17
|
-
const response = yield axios.post(`${
|
|
17
|
+
const response = yield axios.post(`${url}/template/add`, {
|
|
18
18
|
Name: name,
|
|
19
19
|
Content: content,
|
|
20
20
|
}, {
|
|
@@ -29,10 +29,10 @@ export const addTemplateApi = (name, content) => __awaiter(void 0, void 0, void
|
|
|
29
29
|
throw error;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
export const fetchTemplatesApi = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
export const fetchTemplatesApi = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
33
|
const token = cookies.get("authToken");
|
|
34
34
|
try {
|
|
35
|
-
const response = yield axios.get(`${
|
|
35
|
+
const response = yield axios.get(`${url}/template/gettemplate`, {
|
|
36
36
|
headers: {
|
|
37
37
|
Authorization: `Bearer ${token}`,
|
|
38
38
|
},
|
|
@@ -44,11 +44,11 @@ export const fetchTemplatesApi = () => __awaiter(void 0, void 0, void 0, functio
|
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
export const fetchTemplateByIdApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
export const fetchTemplateByIdApi = (url, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
48
|
const cookies = new Cookies();
|
|
49
49
|
const token = cookies.get("authToken");
|
|
50
50
|
try {
|
|
51
|
-
const response = yield axios.get(`${
|
|
51
|
+
const response = yield axios.get(`${url}/template/gettemplatebyid/${id}`, {
|
|
52
52
|
headers: {
|
|
53
53
|
Authorization: `Bearer ${token}`,
|
|
54
54
|
},
|
|
@@ -60,10 +60,10 @@ export const fetchTemplateByIdApi = (id) => __awaiter(void 0, void 0, void 0, fu
|
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
|
-
export const updateTemplateApi = (id, name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
export const updateTemplateApi = (url, id, name, content) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
64
|
const token = cookies.get("authToken");
|
|
65
65
|
try {
|
|
66
|
-
const response = yield axios.post(`${
|
|
66
|
+
const response = yield axios.post(`${url}/template/updatetemplate`, {
|
|
67
67
|
id: id,
|
|
68
68
|
name: name,
|
|
69
69
|
content: content,
|
|
@@ -78,10 +78,10 @@ export const updateTemplateApi = (id, name, content) => __awaiter(void 0, void 0
|
|
|
78
78
|
throw error;
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
-
export const deleteTemplateApi = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
+
export const deleteTemplateApi = (url, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
82
|
const token = cookies.get("authToken");
|
|
83
83
|
try {
|
|
84
|
-
const response = yield axios.post(`${
|
|
84
|
+
const response = yield axios.post(`${url}/template/deletetemplate`, {
|
|
85
85
|
id: id,
|
|
86
86
|
}, {
|
|
87
87
|
headers: {
|
package/package.json
CHANGED
|
@@ -157,7 +157,7 @@ const Taxionomies = ({ url }: TaxionomiesProps) => {
|
|
|
157
157
|
</thead>
|
|
158
158
|
<tbody className="bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900">
|
|
159
159
|
{paginatedTaxonomies
|
|
160
|
-
.filter((taxonomy) => taxonomy.isView)
|
|
160
|
+
// .filter((taxonomy) => taxonomy.isView)
|
|
161
161
|
.map((taxonomy, index) => (
|
|
162
162
|
<tr key={taxonomy.id || index}>
|
|
163
163
|
<td className="px-4 py-4 text-sm whitespace-nowrap">
|
|
@@ -3,11 +3,15 @@ import { useState, useEffect } from "react";
|
|
|
3
3
|
import { FaPlus } from "react-icons/fa";
|
|
4
4
|
import { fetchTemplatesApi, deleteTemplateApi } from "../api/template";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface TemplateProps {
|
|
7
|
+
url: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Template = ({ url }: TemplateProps) => {
|
|
7
11
|
const [templates, setTemplates] = useState<any[]>([]);
|
|
8
12
|
|
|
9
13
|
const fetchTemplatesData = async () => {
|
|
10
|
-
const data = await fetchTemplatesApi();
|
|
14
|
+
const data = await fetchTemplatesApi(url);
|
|
11
15
|
if (data) {
|
|
12
16
|
setTemplates(data as any[]);
|
|
13
17
|
} else {
|
|
@@ -65,7 +69,7 @@ const Template = () => {
|
|
|
65
69
|
|
|
66
70
|
const handleDeleteClick = async (id: string) => {
|
|
67
71
|
try {
|
|
68
|
-
await deleteTemplateApi(id);
|
|
72
|
+
await deleteTemplateApi(url, id);
|
|
69
73
|
alert("Template deleted successfully");
|
|
70
74
|
|
|
71
75
|
fetchTemplatesData();
|
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import Editor from "./Editor";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
interface TemplateFormProps {
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const TemplateForm = ({ url }: TemplateFormProps) => {
|
|
11
15
|
const [name, setName] = useState("");
|
|
12
16
|
const [content, setContent] = useState("");
|
|
13
17
|
const placeholder = "";
|
|
@@ -38,7 +42,7 @@ const TemplateForm = () => {
|
|
|
38
42
|
if (id) {
|
|
39
43
|
const fetchTemplateData = async () => {
|
|
40
44
|
try {
|
|
41
|
-
const fetchedUser = await fetchTemplateByIdApi(id);
|
|
45
|
+
const fetchedUser = await fetchTemplateByIdApi(url, id);
|
|
42
46
|
if (fetchedUser) {
|
|
43
47
|
const user = fetchedUser as {
|
|
44
48
|
name: string;
|
|
@@ -62,10 +66,10 @@ const TemplateForm = () => {
|
|
|
62
66
|
|
|
63
67
|
try {
|
|
64
68
|
if (isEditMode) {
|
|
65
|
-
await updateTemplateApi(id, name, content);
|
|
69
|
+
await updateTemplateApi(url, id, name, content);
|
|
66
70
|
alert("Template updated successfully");
|
|
67
71
|
} else {
|
|
68
|
-
await addTemplateApi(name, content);
|
|
72
|
+
await addTemplateApi(url, name, content);
|
|
69
73
|
alert("Template added successfully");
|
|
70
74
|
}
|
|
71
75
|
window.history.pushState({}, "", "/admin/template");
|
|
@@ -3,12 +3,16 @@ import Cookies from "universal-cookie";
|
|
|
3
3
|
const apiUrl = "http://localhost:5260";
|
|
4
4
|
const cookies = new Cookies();
|
|
5
5
|
|
|
6
|
-
export const addTemplateApi = async (
|
|
6
|
+
export const addTemplateApi = async (
|
|
7
|
+
url: string,
|
|
8
|
+
name: string,
|
|
9
|
+
content: string
|
|
10
|
+
) => {
|
|
7
11
|
const token = cookies.get("authToken");
|
|
8
12
|
|
|
9
13
|
try {
|
|
10
14
|
const response = await axios.post(
|
|
11
|
-
`${
|
|
15
|
+
`${url}/template/add`,
|
|
12
16
|
{
|
|
13
17
|
Name: name,
|
|
14
18
|
Content: content,
|
|
@@ -26,11 +30,11 @@ export const addTemplateApi = async (name: string, content: string) => {
|
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
|
|
29
|
-
export const fetchTemplatesApi = async () => {
|
|
33
|
+
export const fetchTemplatesApi = async (url: string) => {
|
|
30
34
|
const token = cookies.get("authToken");
|
|
31
35
|
|
|
32
36
|
try {
|
|
33
|
-
const response = await axios.get(`${
|
|
37
|
+
const response = await axios.get(`${url}/template/gettemplate`, {
|
|
34
38
|
headers: {
|
|
35
39
|
Authorization: `Bearer ${token}`,
|
|
36
40
|
},
|
|
@@ -42,19 +46,16 @@ export const fetchTemplatesApi = async () => {
|
|
|
42
46
|
}
|
|
43
47
|
};
|
|
44
48
|
|
|
45
|
-
export const fetchTemplateByIdApi = async (id: string) => {
|
|
49
|
+
export const fetchTemplateByIdApi = async (url: string, id: string) => {
|
|
46
50
|
const cookies = new Cookies();
|
|
47
51
|
const token = cookies.get("authToken");
|
|
48
52
|
|
|
49
53
|
try {
|
|
50
|
-
const response = await axios.get(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
}
|
|
57
|
-
);
|
|
54
|
+
const response = await axios.get(`${url}/template/gettemplatebyid/${id}`, {
|
|
55
|
+
headers: {
|
|
56
|
+
Authorization: `Bearer ${token}`,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
58
59
|
|
|
59
60
|
return response.data;
|
|
60
61
|
} catch (error) {
|
|
@@ -64,6 +65,7 @@ export const fetchTemplateByIdApi = async (id: string) => {
|
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
export const updateTemplateApi = async (
|
|
68
|
+
url: string,
|
|
67
69
|
id: string,
|
|
68
70
|
name: string,
|
|
69
71
|
content: string
|
|
@@ -72,7 +74,7 @@ export const updateTemplateApi = async (
|
|
|
72
74
|
|
|
73
75
|
try {
|
|
74
76
|
const response = await axios.post(
|
|
75
|
-
`${
|
|
77
|
+
`${url}/template/updatetemplate`,
|
|
76
78
|
{
|
|
77
79
|
id: id,
|
|
78
80
|
name: name,
|
|
@@ -90,12 +92,12 @@ export const updateTemplateApi = async (
|
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
94
|
|
|
93
|
-
export const deleteTemplateApi = async (id: string) => {
|
|
95
|
+
export const deleteTemplateApi = async (url: string, id: string) => {
|
|
94
96
|
const token = cookies.get("authToken");
|
|
95
97
|
|
|
96
98
|
try {
|
|
97
99
|
const response = await axios.post(
|
|
98
|
-
`${
|
|
100
|
+
`${url}/template/deletetemplate`,
|
|
99
101
|
{
|
|
100
102
|
id: id,
|
|
101
103
|
},
|