eleven-solutions-common-website-unique-web 9.0.31 → 9.0.33

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.
@@ -1,11 +1,53 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { useState, useEffect } from "react";
2
12
  import { FaPlus } from "react-icons/fa";
13
+ import { fetchTemplatesApi } from "../api/template";
3
14
  const Template = () => {
15
+ const [templates, setTemplates] = useState([]);
16
+ const fetchTemplatesData = () => __awaiter(void 0, void 0, void 0, function* () {
17
+ const data = yield fetchTemplatesApi();
18
+ if (data) {
19
+ setTemplates(data);
20
+ }
21
+ else {
22
+ console.error("Failed to fetch templates");
23
+ }
24
+ });
25
+ useEffect(() => {
26
+ fetchTemplatesData();
27
+ });
4
28
  const handleNavigation = (event, path) => {
5
29
  event.preventDefault();
6
30
  window.history.pushState({}, "", path);
7
31
  window.dispatchEvent(new PopStateEvent("popstate"));
8
32
  };
9
- 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: "Template" }) }), _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 Templates", 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: _jsx("div", { className: "flex items-center gap-x-3", children: _jsx("span", { children: "Name" }) }) }), _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: _jsx("div", { className: "flex items-center gap-x-3", children: _jsx("span", { children: "Content" }) }) })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900", children: _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", { 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", { 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-700 whitespace-nowrap", children: _jsx("div", { className: "inline-flex items-center gap-x-3", children: _jsx("div", { className: "flex items-center gap-x-2", children: _jsx("div", { children: _jsx("h2", { className: " text-sm font-medium text-gray-800 dark:text-white ", children: "Name" }) }) }) }) }), _jsx("td", { className: "px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap", children: "Content" })] }) })] }) }), _jsx("div", { className: "flex-grow ml-0 mt-4 w-0", children: _jsxs("button", { type: "button", onClick: (event) => handleNavigation(event, "/admin/template/templateform"), 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" }), "Template"] }) })] })] }));
33
+ //Pagination
34
+ const [currentPage, setCurrentPage] = useState(1);
35
+ const itemsPerPage = 10;
36
+ const totalPages = Math.ceil(templates.length / itemsPerPage);
37
+ const handleNextPage = () => {
38
+ if (currentPage < totalPages) {
39
+ setCurrentPage(currentPage + 1);
40
+ }
41
+ };
42
+ const handlePreviousPage = () => {
43
+ if (currentPage > 1) {
44
+ setCurrentPage(currentPage - 1);
45
+ }
46
+ };
47
+ const handlePageClick = (pageNumber) => {
48
+ setCurrentPage(pageNumber);
49
+ };
50
+ const paginatedTemplates = templates.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage);
51
+ 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: "Template" }) }), _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 Templates", 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: _jsx("div", { className: "flex items-center gap-x-3", children: _jsx("span", { children: "Name" }) }) })] }) }), _jsx("tbody", { className: "bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900", children: paginatedTemplates.map((template, 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", { 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", { 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-700 whitespace-nowrap", children: _jsx("div", { className: "inline-flex items-center gap-x-3", children: _jsx("div", { className: "flex items-center gap-x-2", children: _jsx("div", { children: _jsx("h2", { className: " text-sm font-medium text-gray-800 dark:text-white ", children: template.name }) }) }) }) })] }, template.id || index))) })] }) }), _jsx("div", { className: "flex-grow ml-0 mt-4 w-0", children: _jsxs("button", { type: "button", onClick: (event) => handleNavigation(event, "/admin/template/templateform"), 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" }), "Template"] }) })] })] }));
10
52
  };
11
53
  export default Template;
@@ -14,11 +14,11 @@ import JoditEditor from "jodit-react";
14
14
  const TemplateForm = () => {
15
15
  const [name, setName] = useState("");
16
16
  const [content, setContent] = useState("");
17
- const [placeholder, setPlaceholder] = React.useState("Default placeholder");
17
+ const [placeholder, setPlaceholder] = React.useState("Enter Content Here.");
18
18
  const editor = useRef(null);
19
19
  const config = useMemo(() => ({
20
- readonly: false, // Make the editor editable
21
- placeholder: placeholder || "Start typing...", // Custom placeholder
20
+ readonly: false,
21
+ placeholder: placeholder || "Start typing...",
22
22
  }), [placeholder]);
23
23
  const validateForm = () => {
24
24
  if (!name || !content) {
@@ -1 +1,2 @@
1
1
  export declare const addTemplateApi: (name: string, content: string) => Promise<Axios.AxiosXHR<unknown>>;
2
+ export declare const fetchTemplatesApi: () => Promise<unknown>;
@@ -29,3 +29,18 @@ 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* () {
33
+ const token = cookies.get("token");
34
+ try {
35
+ const response = yield axios.get(`${apiUrl}/template/gettemplate`, {
36
+ headers: {
37
+ Authorization: `Bearer ${token}`,
38
+ },
39
+ });
40
+ return response.data;
41
+ }
42
+ catch (error) {
43
+ console.error(error);
44
+ return false;
45
+ }
46
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "9.0.31",
3
+ "version": "9.0.33",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -1,13 +1,58 @@
1
1
  import React from "react";
2
+ import { useState, useEffect } from "react";
2
3
  import { FaPlus } from "react-icons/fa";
4
+ import { fetchTemplatesApi } from "../api/template";
3
5
 
4
6
  const Template = () => {
7
+ const [templates, setTemplates] = useState<any[]>([]);
8
+
9
+ const fetchTemplatesData = async () => {
10
+ const data = await fetchTemplatesApi();
11
+ if (data) {
12
+ setTemplates(data as any[]);
13
+ } else {
14
+ console.error("Failed to fetch templates");
15
+ }
16
+ };
17
+
18
+ useEffect(() => {
19
+ fetchTemplatesData();
20
+ });
21
+
5
22
  const handleNavigation = (event: React.MouseEvent, path: string) => {
6
23
  event.preventDefault();
7
24
  window.history.pushState({}, "", path);
8
25
  window.dispatchEvent(new PopStateEvent("popstate"));
9
26
  };
10
27
 
28
+ //Pagination
29
+
30
+ const [currentPage, setCurrentPage] = useState(1);
31
+ const itemsPerPage = 10;
32
+
33
+ const totalPages = Math.ceil(templates.length / itemsPerPage);
34
+
35
+ const handleNextPage = () => {
36
+ if (currentPage < totalPages) {
37
+ setCurrentPage(currentPage + 1);
38
+ }
39
+ };
40
+
41
+ const handlePreviousPage = () => {
42
+ if (currentPage > 1) {
43
+ setCurrentPage(currentPage - 1);
44
+ }
45
+ };
46
+
47
+ const handlePageClick = (pageNumber: number) => {
48
+ setCurrentPage(pageNumber);
49
+ };
50
+
51
+ const paginatedTemplates = templates.slice(
52
+ (currentPage - 1) * itemsPerPage,
53
+ currentPage * itemsPerPage
54
+ );
55
+
11
56
  return (
12
57
  <div className="container px-4 mx-auto mt-6 h-full">
13
58
  <div className="w-3/4">
@@ -78,70 +123,61 @@ const Template = () => {
78
123
  <span>Name</span>
79
124
  </div>
80
125
  </th>
81
- <th
82
- scope="col"
83
- className="py-3.5 px-4 text-md font-normal text-left rtl:text-right text-gray-500 dark:text-gray-400"
84
- >
85
- <div className="flex items-center gap-x-3">
86
- <span>Content</span>
87
- </div>
88
- </th>
89
126
  </tr>
90
127
  </thead>
91
128
  <tbody className="bg-white divide-y divide-gray-200 dark:divide-gray-700 dark:bg-gray-900">
92
- <tr>
93
- <td className="px-4 py-4 text-sm whitespace-nowrap">
94
- <div className="flex items-center gap-x-6">
95
- <button className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none">
96
- <svg
97
- xmlns="http://www.w3.org/2000/svg"
98
- fill="none"
99
- viewBox="0 0 24 24"
100
- stroke-width="1.5"
101
- stroke="currentColor"
102
- className="w-5 h-5"
103
- >
104
- <path
105
- stroke-linecap="round"
106
- stroke-linejoin="round"
107
- 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"
108
- />
109
- </svg>
110
- </button>
129
+ {paginatedTemplates.map((template, index) => (
130
+ <tr key={template.id || index}>
131
+ <td className="px-4 py-4 text-sm whitespace-nowrap">
132
+ <div className="flex items-center gap-x-6">
133
+ <button className="text-gray-500 transition-colors duration-200 dark:hover:text-red-600 dark:text-gray-300 hover:text-red-500 focus:outline-none">
134
+ <svg
135
+ xmlns="http://www.w3.org/2000/svg"
136
+ fill="none"
137
+ viewBox="0 0 24 24"
138
+ stroke-width="1.5"
139
+ stroke="currentColor"
140
+ className="w-5 h-5"
141
+ >
142
+ <path
143
+ stroke-linecap="round"
144
+ stroke-linejoin="round"
145
+ 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"
146
+ />
147
+ </svg>
148
+ </button>
111
149
 
112
- <button className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none">
113
- <svg
114
- xmlns="http://www.w3.org/2000/svg"
115
- fill="none"
116
- viewBox="0 0 24 24"
117
- strokeWidth="1.5"
118
- stroke="currentColor"
119
- className="w-5 h-5"
120
- >
121
- <path
122
- strokeLinecap="round"
123
- strokeLinejoin="round"
124
- 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"
125
- />
126
- </svg>
127
- </button>
128
- </div>
129
- </td>
130
- <td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
131
- <div className="inline-flex items-center gap-x-3">
132
- <div className="flex items-center gap-x-2">
133
- <div>
134
- <h2 className=" text-sm font-medium text-gray-800 dark:text-white ">
135
- Name
136
- </h2>
150
+ <button className="text-gray-500 transition-colors duration-200 dark:hover:text-yellow-500 dark:text-gray-300 hover:text-yellow-500 focus:outline-none">
151
+ <svg
152
+ xmlns="http://www.w3.org/2000/svg"
153
+ fill="none"
154
+ viewBox="0 0 24 24"
155
+ strokeWidth="1.5"
156
+ stroke="currentColor"
157
+ className="w-5 h-5"
158
+ >
159
+ <path
160
+ strokeLinecap="round"
161
+ strokeLinejoin="round"
162
+ 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"
163
+ />
164
+ </svg>
165
+ </button>
166
+ </div>
167
+ </td>
168
+ <td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
169
+ <div className="inline-flex items-center gap-x-3">
170
+ <div className="flex items-center gap-x-2">
171
+ <div>
172
+ <h2 className=" text-sm font-medium text-gray-800 dark:text-white ">
173
+ {template.name}
174
+ </h2>
175
+ </div>
137
176
  </div>
138
177
  </div>
139
- </div>
140
- </td>
141
- <td className="px-4 py-4 text-sm text-gray-500 dark:text-gray-300 whitespace-nowrap">
142
- Content
143
- </td>
144
- </tr>
178
+ </td>
179
+ </tr>
180
+ ))}
145
181
  </tbody>
146
182
  </table>
147
183
  </div>
@@ -5,13 +5,13 @@ import JoditEditor from "jodit-react";
5
5
  const TemplateForm = () => {
6
6
  const [name, setName] = useState("");
7
7
  const [content, setContent] = useState("");
8
- const [placeholder, setPlaceholder] = React.useState("Default placeholder");
8
+ const [placeholder, setPlaceholder] = React.useState("Enter Content Here.");
9
9
 
10
10
  const editor = useRef(null);
11
11
  const config: Record<string, any> = useMemo(
12
12
  () => ({
13
- readonly: false, // Make the editor editable
14
- placeholder: placeholder || "Start typing...", // Custom placeholder
13
+ readonly: false,
14
+ placeholder: placeholder || "Start typing...",
15
15
  }),
16
16
  [placeholder]
17
17
  );
@@ -75,7 +75,7 @@ const TemplateForm = () => {
75
75
  ref={editor}
76
76
  value={content}
77
77
  config={config}
78
- onBlur={(newContent) => setContent(newContent)} // Update content on blur
78
+ onBlur={(newContent) => setContent(newContent)}
79
79
  onChange={(newContent) => {}}
80
80
  />
81
81
  </div>
@@ -227,7 +227,6 @@ function Users() {
227
227
  />
228
228
  </svg>
229
229
  </button>
230
- {/* </a> */}
231
230
  </div>
232
231
  </td>
233
232
  <td className="px-4 py-4 text-sm font-medium text-gray-700 whitespace-nowrap">
@@ -25,3 +25,19 @@ export const addTemplateApi = async (name: string, content: string) => {
25
25
  throw error;
26
26
  }
27
27
  };
28
+
29
+ export const fetchTemplatesApi = async () => {
30
+ const token = cookies.get("token");
31
+
32
+ try {
33
+ const response = await axios.get(`${apiUrl}/template/gettemplate`, {
34
+ headers: {
35
+ Authorization: `Bearer ${token}`,
36
+ },
37
+ });
38
+ return response.data;
39
+ } catch (error) {
40
+ console.error(error);
41
+ return false;
42
+ }
43
+ };