diff --git a/amp-client/src/Pages/ClientPages/ClientProfile/ClientProfile.jsx b/amp-client/src/Pages/ClientPages/ClientProfile/ClientProfile.jsx
index fa1548b2..3113fc77 100644
--- a/amp-client/src/Pages/ClientPages/ClientProfile/ClientProfile.jsx
+++ b/amp-client/src/Pages/ClientPages/ClientProfile/ClientProfile.jsx
@@ -1,12 +1,94 @@
import "./styles.css";
+import { useState } from "react";
+import { toast } from "react-toastify";
+import { useNavigate } from "react-router-dom";
+import "react-toastify/dist/ReactToastify.css";
+import axiosBaseUrl from "../../../Axios/axios";
+import ActionButton from "../../../Components/CommonComponents/ActionButton/ActionButton";
const ClientProfile = () => {
+ const [currentPassword, setCurrentPassword] = useState("");
+ const [newPassword, setNewPassword] = useState("");
+ const [confirmPassword, setConfirmPassword] = useState("");
+
+ const navigate = useNavigate();
+
+ const handleSubmit = async (e) => {
+ e.preventDefault();
+
+ if (newPassword !== confirmPassword) {
+ toast.error("New password and confirmation do not match.");
+ return;
+ }
+
+ const password = newPassword;
+
+ try {
+ const response = await axiosBaseUrl.post("/clients/editProfile", {
+ password,
+ });
+
+ if (response.data.success) {
+ toast.success("Password updated successfully.");
+ setTimeout(() => navigate("/client/dashboard"), 1000);
+ } else {
+ toast.error(response.data.message || "Failed to update password.");
+ }
+ } catch (error) {
+ toast.error("An error occurred. Please try again.");
+ }
+ };
+
return (
- <>
-
-
Client Profile
-
- >
+
);
};
diff --git a/amp-client/src/Pages/ClientPages/ClientProfile/styles.css b/amp-client/src/Pages/ClientPages/ClientProfile/styles.css
index df2fe767..11c9a09e 100644
--- a/amp-client/src/Pages/ClientPages/ClientProfile/styles.css
+++ b/amp-client/src/Pages/ClientPages/ClientProfile/styles.css
@@ -1,3 +1,47 @@
.client-profile-container {
- padding: 20px;
-}
\ No newline at end of file
+ padding: 20px;
+ background-color: #fff9f3;
+ max-width: 500px;
+ margin: 50px auto;
+ border-radius: 10px;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+}
+
+h2 {
+ margin-bottom: 30px;
+}
+
+.password-form {
+ display: flex;
+ flex-direction: column;
+}
+
+.form-group {
+ margin-bottom: 20px;
+}
+
+.form-group h4 {
+ display: block;
+ margin-bottom: 5px;
+}
+
+.password-form input {
+ padding: 10px;
+ font-size: 16px;
+ border: 1px solid #ccc;
+ border-radius: 6px;
+ width: 95%;
+}
+
+.form-message {
+ margin-top: 15px;
+ color: #d00;
+ font-weight: 500;
+}
+
+.password-form label {
+ font-weight: 500;
+ margin-bottom: 5px;
+ margin-top: 10px;
+ display: block;
+}
diff --git a/amp-client/src/Pages/ProviderPages/ProviderDashboard/ProviderDashboard.jsx b/amp-client/src/Pages/ProviderPages/ProviderDashboard/ProviderDashboard.jsx
index 65903481..71d2e650 100644
--- a/amp-client/src/Pages/ProviderPages/ProviderDashboard/ProviderDashboard.jsx
+++ b/amp-client/src/Pages/ProviderPages/ProviderDashboard/ProviderDashboard.jsx
@@ -532,38 +532,6 @@ const ProviderDashboard = () => {
No detailed metrics data available.
)}
-
- {/*
-
All Metrics
- {allMetrics && Object.keys(allMetrics).length > 0 ? (
-
-
-
- | ID |
- Voltage |
- Current |
- Power |
- Energy |
- Timestamp |
-
-
-
- {allMetrics.map((metric, index) => (
-
- | {metric.id} |
- {metric.voltage} |
- {metric.current} |
- {metric.power} |
- {metric.energy} |
- {new Date(metric.created_at).toLocaleString()} |
-
- ))}
-
-
- ) : (
-
No detailed metrics data available.
- )}
-
*/}
)}
diff --git a/amp-laravel/app/Http/Requests/Client/EditProfileRequest.php b/amp-laravel/app/Http/Requests/Client/EditProfileRequest.php
index b62f13b4..1dd049aa 100644
--- a/amp-laravel/app/Http/Requests/Client/EditProfileRequest.php
+++ b/amp-laravel/app/Http/Requests/Client/EditProfileRequest.php
@@ -22,8 +22,6 @@ public function authorize(): bool
public function rules(): array
{
return [
- 'name' => 'sometimes|required|string|max:255',
- 'email' => 'sometimes|required|email|max:255',
'password' => 'sometimes|nullable|string|min:6',
];
}
diff --git a/amp-laravel/app/Services/Client/ClientEditProfileService.php b/amp-laravel/app/Services/Client/ClientEditProfileService.php
index cd01a309..9db334de 100644
--- a/amp-laravel/app/Services/Client/ClientEditProfileService.php
+++ b/amp-laravel/app/Services/Client/ClientEditProfileService.php
@@ -9,14 +9,6 @@ class ClientEditProfileService
public static function editProfile(array $data)
{
$user = JWTAuth::user();
-
- if (isset($data['name'])) {
- $user->name = $data['name'];
- }
-
- if (isset($data['email'])) {
- $user->email = $data['email'];
- }
if (!empty($data['password'])) {
$user->password = bcrypt($data['password']);