diff --git a/index.html b/index.html
index 7cef13f..72652e9 100644
--- a/index.html
+++ b/index.html
@@ -2,7 +2,7 @@
-
+
Tanami Admin
diff --git a/src/Pages/Admin/Notification.jsx b/src/Pages/Admin/Notification.jsx
index feb30d6..d4aaef1 100644
--- a/src/Pages/Admin/Notification.jsx
+++ b/src/Pages/Admin/Notification.jsx
@@ -1,22 +1,161 @@
-import { Box, Image, Text } from "@chakra-ui/react"
-// import error from "../assets/Error.svg"
-import robot from "../../assets/robot.png"
-// import robot from "../assets/robot.png"
-const Notification = () => {
- return (
-
-
-
- {/* The requested URL was not found on this server. */}
-
- )
-}
+import React, { useContext, useEffect, useState } from "react";
+import {
+ Box,
+ useToast,
+} from "@chakra-ui/react";
+import { useForm} from "react-hook-form";
+import { yupResolver } from "@hookform/resolvers/yup";
+import * as yup from "yup";
+import { useNavigate } from "react-router-dom";
+import { OPACITY_ON_LOAD } from "../../Layout/animations";
+import FormInputMain from "../../Components/FormInputMain";
+import {
+ useGetContactQuery,
+ useUpdateContactMutation,
+} from "../../Services/contact.service";
+import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders";
+import ToastBox from "../../Components/ToastBox";
-export default Notification
\ No newline at end of file
+export const notification = yup.object().shape({
+ investmentNameEnglish: yup
+ .string()
+ .required("Investment Name is required"),
+ ManualDate: yup
+ .date()
+ .required("Manual Date is required")
+ .typeError("Invalid date format"),
+ ManualTime: yup
+ .string()
+ .required("Manual Time is required")
+ .matches(
+ /^([01]\d|2[0-3]):?([0-5]\d)$/,
+ "Invalid time format, must be in HH:mm"
+ ),
+ expectedReturn: yup
+ .string()
+ .required("Expected Return is required")
+ .matches(
+ /^[0-9]+(\.[0-9]{1,2})?$/,
+ "Expected Return must be a valid number with up to 2 decimal places"
+ ),
+});
+
+
+
+const Notification = () => {
+ const toast = useToast();
+ const navigate = useNavigate();
+ const [form, setForm] = useState({});
+ const [isLoading, setIsLoading] = useState(false);
+
+ const {
+ control,
+ reset,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(notification),
+ });
+
+ console.log(errors);
+
+ const {
+ data: contact,
+ isLoading: contactLoading,
+ error,
+ } = useGetContactQuery();
+ const [updateContact] = useUpdateContactMutation();
+
+ useEffect(() => {
+ if (contact) {
+ reset({
+ phoneNumber: contact?.data[0]?.phoneNumber,
+ emailAddress: contact?.data[0]?.emailAddress,
+ websiteUrl: contact?.data[0]?.websiteUrl,
+ });
+ }
+ }, [contact, reset]);
+
+ if (contactLoading) {
+ return ;
+ }
+
+ const formFields = [
+ {
+ label: "Investment Name",
+ placeHolder: " ",
+ name: "investmentNameEnglish",
+ type: "text",
+ isRequired: true,
+ section: "Add Details",
+ // value: contact?.phoneNumber || "",
+ },
+ {
+ label: "Manual Date",
+ name: "ManualDate",
+ placeHolder: " ",
+ type: "date",
+ isRequired: true,
+ section: "Add Details",
+ // value: contact?.emailAddress || "",
+ },
+ {
+ label: "Manual Time",
+ name: "ManualTime",
+ placeHolder: " ",
+ type: "time",
+ isRequired: true,
+ section: "Add Details",
+ // value: contact?.websiteUrl || "",
+ },
+ {
+ label: "Expected Return",
+ name: "expectedReturn",
+ placeHolder: " ",
+ type: "text",
+ isRequired: true,
+ section: "Add Details",
+ // value: contact?.websiteUrl || "",
+ },
+ ];
+
+ const groupedFields = formFields.reduce((groups, field) => {
+ const { section } = field;
+ if (!groups[section]) {
+ groups[section] = [];
+ }
+ groups[section].push(field);
+ return groups;
+ }, {});
+
+ const onSubmit = async (data) => {
+ setIsLoading(true);
+ try {
+ const res = await updateContact(data);
+ if (res?.data?.statusCode === 200) {
+ toast({
+ render: () => ,
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {
+ console.log(error);
+
+ setIsLoading(false);
+ }
+ };
+
+ return (
+
+
+
+ );
+};
+
+export default Notification;
diff --git a/src/Routes/Nav.js b/src/Routes/Nav.js
index fec6745..6bf4945 100644
--- a/src/Routes/Nav.js
+++ b/src/Routes/Nav.js
@@ -181,11 +181,11 @@ export const nav = [
path: "/academy",
icon: GrManual,
},
- // {
- // title: "Notification",
- // path: "/notification",
- // icon: MdNotificationsNone,
- // },
+ {
+ title: "Notification",
+ path: "/notification",
+ icon: MdNotificationsNone,
+ },
{
title: "Contact Details",
path: "/contact",
diff --git a/src/Routes/Routes.js b/src/Routes/Routes.js
index c898268..122264e 100644
--- a/src/Routes/Routes.js
+++ b/src/Routes/Routes.js
@@ -100,8 +100,8 @@ export const RouteLink = [
// { path: "/bank-investor", Component: UnderConstruction },
// { path: "/academy", Component: Academy },
{ path: "/academy", Component: UnderConstruction },
- // { path: "/notification", Component: Notification },
- { path: "/notification", Component: UnderConstruction },
+ { path: "/notification", Component: Notification },
+ // { path: "/notification", Component: UnderConstruction },
{ path: "/contact", Component: Contact },
// { path: "/contact", Component: UnderConstruction },
// { path: "/users", Component: Users },