Skip to content

Commit

Permalink
refactor(my-schedule) : change date format and set button submit to d…
Browse files Browse the repository at this point in the history
…isable after clicked
  • Loading branch information
aaaroz committed Dec 13, 2023
1 parent f571c9f commit 11d7cbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/components/shared-components/ModalConfirmSchedule.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Modal } from "antd";
import { useState } from "react";
import { Button, Modal } from "antd";
import { useDispatch } from "react-redux";
import { IoIosWarning } from "react-icons/io";

Expand All @@ -14,8 +14,11 @@ export function ModalConfirmSchedule({
textDate,
}) {
const [isModalOpen, setIsModalOpen] = useState(true);
const [isSubmitting, setIsSubmitting] = useState(false);
const dispatch = useDispatch();
const handleOk = async () => {
setIsSubmitting(true);

if (payload.doctor_available) {
try {
await APISchedule.updateActiveSchedule(payload);
Expand Down Expand Up @@ -64,18 +67,19 @@ export function ModalConfirmSchedule({
id="button-confirm-schedule"
key="ok"
onClick={handleOk}
className="mb-2 mt-5 h-10 rounded-lg bg-[#FEA53F] text-sm text-white sm:px-7 sm:text-base sm:font-medium"
className="mb-2 mt-5 h-10 rounded-lg bg-warning text-sm text-white disabled:bg-warning/70 sm:px-7 sm:text-base sm:font-medium"
style={{
border: "transparent",
}}
disabled={isSubmitting}
>
Ya, Saya yakin
</Button>
<Button
id="button-cancel-schedule"
key="cancel"
onClick={handleCancel}
className="ms-4 mt-5 h-10 rounded-lg border-[#FEA53F] text-sm text-[#FEA53F] sm:px-7 sm:text-base sm:font-medium"
className="ms-4 mt-5 h-10 rounded-lg border-warning text-sm text-warning sm:px-7 sm:text-base sm:font-medium"
>
Tidak, Batalkan
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/MapListData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function formatStrDayJs(date) {
return date?.format("DD-MM-YYYY");
return date?.format("YYYY-MM-DD");
}

export function mapListData(data, eventDate) {
Expand Down

0 comments on commit 11d7cbf

Please sign in to comment.