Skip to content

Commit

Permalink
salary issue fixed from Admin,HR and registration page
Browse files Browse the repository at this point in the history
  • Loading branch information
Abubokkor98 committed Jan 27, 2025
1 parent ce7d49c commit d189323
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 41 deletions.
10 changes: 5 additions & 5 deletions .firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
_redirects,1733640044703,812d9c82ff05e58e930356d8882aa4e52f4c52d768831f011f529707f938b193
index.html,1737646760623,1547fa7198e018e340011a328215653f471abacf88c2801294690a8ac6d0f4a3
work.svg,1737578148925,2cf2ca64c3751717fe9ec697ad72b50b4cd5112a8fef82dc8c0ef8fd0a6d014d
assets/index-tokceSQU.css,1737646760626,1d28d3baeeeea914a81bfbae0abfc266b14638fcd58e30a68cd710a96a3331ed
assets/default-avatar-DVE6JZcB.png,1737646760625,fcb2010c531eb12e0670e1f7aebf51fb79845156e605db81a461d7ee220218dd
assets/error-CqimAJ7d.png,1737646760626,fd58779b38c93d50a6160c6fafa3c4da1be51d8acbdc82e97ae1c1015a24788d
assets/index-iBbBmAoG.js,1737646760632,44a572cf48585d4769910706e600a958f903d64f1d2d0e5e97c3fe4c09f5cce9
index.html,1737956600480,7ae796ff1a9990acc34a31af3e665f816db4f449e4f9acf599f61280d537729d
assets/index-tokceSQU.css,1737956600483,1d28d3baeeeea914a81bfbae0abfc266b14638fcd58e30a68cd710a96a3331ed
assets/default-avatar-DVE6JZcB.png,1737956600480,fcb2010c531eb12e0670e1f7aebf51fb79845156e605db81a461d7ee220218dd
assets/error-CqimAJ7d.png,1737956600483,fd58779b38c93d50a6160c6fafa3c4da1be51d8acbdc82e97ae1c1015a24788d
assets/index-B4JWivXI.js,1737956600484,0ac6e44e7da336986ab592c9490c70d914c2b3359f482c3fdfdf683beb0acf71
36 changes: 20 additions & 16 deletions src/pages/auth/Register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,22 +224,26 @@ export default function Register() {
</div>

{/* Salary */}
<div className="form-control">
<label className="label">
<span className="label-text">Salary</span>
</label>
<input
type="number"
placeholder="Enter your salary"
className="w-full px-4 py-3 border border-primary rounded-xl focus:outline-none focus:ring-2 focus:ring-primary bg-background text-text placeholder-gray-400"
{...register("salary", { required: "Salary is required" })}
/>
{errors.salary && (
<span className="text-red-500 text-sm mt-2">
{errors.salary.message}
</span>
)}
</div>
<div className="form-control">
<label className="label">
<span className="label-text">Salary</span>
</label>
<input
type="number"
placeholder="Enter your salary"
className="w-full px-4 py-3 border border-primary rounded-xl focus:outline-none focus:ring-2 focus:ring-primary bg-background text-text placeholder-gray-400"
{...register("salary", {
required: "Salary is required",
validate: value => value >= 100 || "Salary must be 100 or more"
})}
/>
{errors.salary && (
<span className="text-red-500 text-sm mt-2">
{errors.salary.message}
</span>
)}
</div>


{/* Password */}
<div className="relative form-control">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboard/Admin/PaymentModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function PaymentModal({ isOpen, onClose, employee, refetch }) {
paymentStatus: "paid",
transactionId: paymentIntent.id,
payingDate: currentDate,
status: "pending",
// status: "pending",
};

const res = await axiosSecure.patch(
Expand Down
73 changes: 54 additions & 19 deletions src/pages/dashboard/HR/PayModal.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import Modal from "react-modal";
import { useForm } from "react-hook-form";
import { useEffect } from "react";

// Set the app element for React Modal
Modal.setAppElement("#root");

export default function PayModal({ isOpen, onClose, employee, onPay }) {
const { register, handleSubmit, reset } = useForm();
const {
register,
handleSubmit,
reset,
formState: { errors },
} = useForm();

const handlePay = (data) => {
onPay(data);
reset();
onClose();
reset();
onClose();
};

useEffect(() => {
if (!isOpen) {
reset();
}
}, [isOpen, reset]);

return (
<Modal
isOpen={isOpen}
Expand All @@ -32,39 +46,60 @@ export default function PayModal({ isOpen, onClose, employee, onPay }) {
</label>
<select
id="month"
{...register("month", { required: true })}
{...register("month", { required: "Month is required" })}
className="w-full px-3 py-2 border rounded-md"
>
<option value="">Select Month</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
{[
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
].map((month) => (
<option key={month} value={month}>
{month}
</option>
))}
</select>
{errors.month && (
<span className="text-red-500 text-sm mt-1">
{errors.month.message}
</span>
)}
</div>
<div className="mb-4">
<label className="block text-sm font-medium mb-1" htmlFor="year">
Year
</label>
<input
id="year"
type="text"
{...register("year", { required: true })}
type="number"
{...register("year", {
required: "Year is required",
})}
onKeyDown={(e) => {
if (["e", "E", "+", "-"].includes(e.key)) e.preventDefault();
}}
className="w-full px-3 py-2 border rounded-md"
placeholder="Enter Year"
/>
{errors.year && (
<span className="text-red-500 text-sm mt-1">
{errors.year.message}
</span>
)}
</div>
<button
type="submit"
className="px-4 py-2 bg-primary text-white rounded-md w-full"
className="px-4 py-2 bg-primary text-white rounded-md w-full hover:bg-primary-dark active:scale-95"
>
Pay
</button>
Expand Down

0 comments on commit d189323

Please sign in to comment.