-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be0bd43
commit 58a885d
Showing
14 changed files
with
383 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,12 +142,10 @@ const Header = () => { | |
" horizontal-logo flex items-center justify-between ltr:mr-2 rtl:ml-2 mr-2" | ||
} | ||
> | ||
<Link href="/" className="main-logo flex shrink-0 items-center"> | ||
<img | ||
className="inline w-8 ltr:-ml-1 rtl:-mr-1" | ||
src="/assets/images/logo.svg" | ||
alt="logo" | ||
/> | ||
<Link | ||
href="/admin" | ||
className="main-logo flex shrink-0 items-center" | ||
> | ||
<span className="hidden align-middle text-2xl font-semibold transition-all duration-300 ltr:ml-1.5 rtl:mr-1.5 dark:text-white-light md:inline"> | ||
Studera Koranen | ||
</span> | ||
|
@@ -330,179 +328,6 @@ const Header = () => { | |
</button> | ||
)} | ||
</div> | ||
<div className="dropdown flex shrink-0"> | ||
<Dropdown | ||
offset={[0, 8]} | ||
placement={`${isRtl ? "bottom-start" : "bottom-end"}`} | ||
btnClassName="relative group block" | ||
button={ | ||
<img | ||
className="h-9 w-9 rounded-full object-cover saturate-50 group-hover:saturate-100" | ||
src="/assets/images/user-profile.jpeg" | ||
alt="userProfile" | ||
/> | ||
} | ||
> | ||
<ul className="w-[230px] !py-0 font-semibold text-dark dark:text-white-dark dark:text-white-light/90"> | ||
<li> | ||
<div className="flex items-center px-4 py-4"> | ||
<img | ||
className="h-10 w-10 rounded-md object-cover" | ||
src="/assets/images/user-profile.jpeg" | ||
alt="userProfile" | ||
/> | ||
<div className="ltr:pl-4 rtl:pr-4"> | ||
<h4 className="text-base"> | ||
John Doe | ||
<span className="rounded bg-success-light px-1 text-xs text-success ltr:ml-2 rtl:ml-2"> | ||
Pro | ||
</span> | ||
</h4> | ||
<button | ||
type="button" | ||
className="text-black/60 hover:text-primary dark:text-dark-light/60 dark:hover:text-white" | ||
> | ||
[email protected] | ||
</button> | ||
</div> | ||
</div> | ||
</li> | ||
<li> | ||
<Link | ||
href="/users/profile" | ||
className="dark:hover:text-white" | ||
> | ||
<svg | ||
className="ltr:mr-2 rtl:ml-2" | ||
width="18" | ||
height="18" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<circle | ||
cx="12" | ||
cy="6" | ||
r="4" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
/> | ||
<path | ||
opacity="0.5" | ||
d="M20 17.5C20 19.9853 20 22 12 22C4 22 4 19.9853 4 17.5C4 15.0147 7.58172 13 12 13C16.4183 13 20 15.0147 20 17.5Z" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
/> | ||
</svg> | ||
Profile | ||
</Link> | ||
</li> | ||
<li> | ||
<Link | ||
href="/apps/mailbox" | ||
className="dark:hover:text-white" | ||
> | ||
<svg | ||
className="ltr:mr-2 rtl:ml-2" | ||
width="18" | ||
height="18" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
opacity="0.5" | ||
d="M2 12C2 8.22876 2 6.34315 3.17157 5.17157C4.34315 4 6.22876 4 10 4H14C17.7712 4 19.6569 4 20.8284 5.17157C22 6.34315 22 8.22876 22 12C22 15.7712 22 17.6569 20.8284 18.8284C19.6569 20 17.7712 20 14 20H10C6.22876 20 4.34315 20 3.17157 18.8284C2 17.6569 2 15.7712 2 12Z" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
/> | ||
<path | ||
d="M6 8L8.1589 9.79908C9.99553 11.3296 10.9139 12.0949 12 12.0949C13.0861 12.0949 14.0045 11.3296 15.8411 9.79908L18 8" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
strokeLinecap="round" | ||
/> | ||
</svg> | ||
Inbox | ||
</Link> | ||
</li> | ||
<li> | ||
<Link | ||
href="/auth/boxed-lockscreen" | ||
className="dark:hover:text-white" | ||
> | ||
<svg | ||
className="ltr:mr-2 rtl:ml-2" | ||
width="18" | ||
height="18" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M2 16C2 13.1716 2 11.7574 2.87868 10.8787C3.75736 10 5.17157 10 8 10H16C18.8284 10 20.2426 10 21.1213 10.8787C22 11.7574 22 13.1716 22 16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H8C5.17157 22 3.75736 22 2.87868 21.1213C2 20.2426 2 18.8284 2 16Z" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
/> | ||
<path | ||
opacity="0.5" | ||
d="M6 10V8C6 4.68629 8.68629 2 12 2C15.3137 2 18 4.68629 18 8V10" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
strokeLinecap="round" | ||
/> | ||
<g opacity="0.5"> | ||
<path | ||
d="M9 16C9 16.5523 8.55228 17 8 17C7.44772 17 7 16.5523 7 16C7 15.4477 7.44772 15 8 15C8.55228 15 9 15.4477 9 16Z" | ||
fill="currentColor" | ||
/> | ||
<path | ||
d="M13 16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16C11 15.4477 11.4477 15 12 15C12.5523 15 13 15.4477 13 16Z" | ||
fill="currentColor" | ||
/> | ||
<path | ||
d="M17 16C17 16.5523 16.5523 17 16 17C15.4477 17 15 16.5523 15 16C15 15.4477 15.4477 15 16 15C16.5523 15 17 15.4477 17 16Z" | ||
fill="currentColor" | ||
/> | ||
</g> | ||
</svg> | ||
Lock Screen | ||
</Link> | ||
</li> | ||
<li className="border-t border-white-light dark:border-white-light/10"> | ||
<Link | ||
href="/auth/boxed-signin" | ||
className="!py-3 text-danger" | ||
> | ||
<svg | ||
className="rotate-90 ltr:mr-2 rtl:ml-2" | ||
width="18" | ||
height="18" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
opacity="0.5" | ||
d="M17 9.00195C19.175 9.01406 20.3529 9.11051 21.1213 9.8789C22 10.7576 22 12.1718 22 15.0002V16.0002C22 18.8286 22 20.2429 21.1213 21.1215C20.2426 22.0002 18.8284 22.0002 16 22.0002H8C5.17157 22.0002 3.75736 22.0002 2.87868 21.1215C2 20.2429 2 18.8286 2 16.0002L2 15.0002C2 12.1718 2 10.7576 2.87868 9.87889C3.64706 9.11051 4.82497 9.01406 7 9.00195" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
strokeLinecap="round" | ||
/> | ||
<path | ||
d="M12 15L12 2M12 2L15 5.5M12 2L9 5.5" | ||
stroke="currentColor" | ||
strokeWidth="1.5" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
Sign Out | ||
</Link> | ||
</li> | ||
</ul> | ||
</Dropdown> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import { GetServerSideProps } from "next"; | ||
import FileInput from "../Fields/FileInput"; | ||
import InputField from "../Fields/InputField"; | ||
import TextField from "../Fields/TextField"; | ||
import { useForm } from "react-hook-form"; | ||
import { useRouter } from "next/router"; | ||
import Swal from "sweetalert2"; | ||
import PanelSelectField from "../Fields/PanelSelectField"; | ||
|
||
type Props = { | ||
quize?: any; | ||
lessons?: any; | ||
}; | ||
|
||
const QuizeForm = ({ quize, lessons }: Props) => { | ||
const router = useRouter(); | ||
const handleSubmit = (e: any) => { | ||
e.preventDefault(); | ||
var formdata = new FormData(); | ||
formdata.append("lesson_id", e.target.lesson_id.value); | ||
formdata.append("question", e.target.question.value); | ||
formdata.append("o1", e.target.o1.value); | ||
formdata.append("o2", e.target.o2.value); | ||
formdata.append("o3", e.target.o3.value); | ||
formdata.append("o4", e.target.o4.value); | ||
formdata.append("answer", e.target.answer.value); | ||
if (quize) { | ||
fetch("/api/v1/quize/update?id=" + quize.id, { | ||
method: "POST", | ||
body: formdata, | ||
redirect: "follow", | ||
}) | ||
.then((response) => response.json()) | ||
.then(({ success, msg, result }) => { | ||
Swal.fire({ | ||
icon: success ? "success" : "error", | ||
title: success ? "Success" : "Error", | ||
text: msg, | ||
padding: "2em", | ||
customClass: "sweet-alerts", | ||
}); | ||
}) | ||
.catch((error) => console.log("error", error)); | ||
} else { | ||
fetch("/api/v1/quize/add", { | ||
method: "POST", | ||
body: formdata, | ||
redirect: "follow", | ||
}) | ||
.then((response) => response.json()) | ||
.then(({ success, msg, result }) => { | ||
if (success) { | ||
router.push("/admin/quize/list"); | ||
} | ||
}) | ||
.catch((error) => console.log("error", error)); | ||
} | ||
}; | ||
return ( | ||
<form onSubmit={handleSubmit} className="flex flex-col gap-5"> | ||
<PanelSelectField | ||
label="Lesson" | ||
name="lesson_id" | ||
options={lessons} | ||
defaultValue={quize?.lesson_id} | ||
/> | ||
<InputField | ||
name="question" | ||
label="Question" | ||
required | ||
defaultValue={quize?.question} | ||
/> | ||
<div className="grid md:grid-cols-2 xl:grid-cols-4 gap-5"> | ||
<InputField | ||
name="o1" | ||
label="Option 1" | ||
required | ||
defaultValue={quize?.o1} | ||
/> | ||
<InputField | ||
name="o2" | ||
label="Option 2" | ||
required | ||
defaultValue={quize?.o2} | ||
/> | ||
<InputField | ||
name="o3" | ||
label="Option 3" | ||
required | ||
defaultValue={quize?.o3} | ||
/> | ||
<InputField | ||
name="o4" | ||
label="Option 4" | ||
required | ||
defaultValue={quize?.o4} | ||
/> | ||
</div> | ||
<button type="submit" className="btn btn-primary w-max px-10"> | ||
Submit | ||
</button> | ||
</form> | ||
); | ||
}; | ||
|
||
export default QuizeForm; |
Oops, something went wrong.