now displayed cancel and submit button at initially - bug643

This commit is contained in:
Pramod Mahajan 2025-07-04 11:47:02 +05:30
parent 20c9dca759
commit afac84dc9b

View File

@ -8,8 +8,10 @@ import { useSelector } from "react-redux";
const workAreaSchema = z.object({ const workAreaSchema = z.object({
id: z.string().optional(), id: z.string().optional(),
buildingId: z.string().min(1, "Building is required"), buildingId: z.string().refine((val) => val !== "0", {
floorId: z.string().min(1, "Floor is required"), message: "Building is required",
}),
floorId: z.string().refine((val)=>val !== "0",{message:"Floor is required"}),
areaName: z.string().min(3, "Work Area Name must be at least 3 characters"), areaName: z.string().min(3, "Work Area Name must be at least 3 characters"),
}); });
@ -183,8 +185,9 @@ const WorkAreaModel = ({ project, onSubmit, onClose }) => {
<p className="danger-text">{errors.areaName.message}</p> <p className="danger-text">{errors.areaName.message}</p>
)} )}
</div> </div>
</>
<div className="col-12 text-center"> )}
<div className="col-12 text-center">
<button type="submit" className="btn btn-sm btn-primary me-3" disabled={isPending}> <button type="submit" className="btn btn-sm btn-primary me-3" disabled={isPending}>
{isPending ? "Please Wait.." : watchWorkAreaId === "0" ? "Add Work Area" : "Update Work Area"} {isPending ? "Please Wait.." : watchWorkAreaId === "0" ? "Add Work Area" : "Update Work Area"}
</button> </button>
@ -192,8 +195,6 @@ const WorkAreaModel = ({ project, onSubmit, onClose }) => {
Cancel Cancel
</button> </button>
</div> </div>
</>
)}
</form> </form>
); );
}; };