the Request page is done

Kahdooei
yasaman 2023-12-06 15:04:53 +03:30
parent e68ac50286
commit 526ef9a38b
7 changed files with 309 additions and 9 deletions

10
app/Request/page.tsx Normal file
View File

@ -0,0 +1,10 @@
import Request from "@/components/Request";
import React from "react";
export default function page() {
return (
<div className="flex justify-center items-center content-center h-full">
<Request />
</div>
);
}

View File

@ -33,7 +33,8 @@ export default function Landing() {
<div className="flex justify-between gap-6 w-full mx-auto -mt-24 max-md:mt-0 max-sm:flex-wrap max-sm:justify-around "> <div className="flex justify-between gap-6 w-full mx-auto -mt-24 max-md:mt-0 max-sm:flex-wrap max-sm:justify-around ">
{boxItems.map((item, index) => { {boxItems.map((item, index) => {
return ( return (
<div
<Link
className="group bg-white shadow-md rounded-lg p-10 h-64 w-64 flex items-end justify-center z-10 relative className="group bg-white shadow-md rounded-lg p-10 h-64 w-64 flex items-end justify-center z-10 relative
hover:bg-blue transition-all duration-700 ease-in-out text-center hover:bg-blue transition-all duration-700 ease-in-out text-center
hover:flex-col-reverse hover:justify-evenly hover:items-center hover:cursor-pointer hover:flex-col-reverse hover:justify-evenly hover:items-center hover:cursor-pointer
@ -42,6 +43,7 @@ export default function Landing() {
max-md:shadow-[0px_0px_8px_0px_#00000040] max-md:shadow-[0px_0px_8px_0px_#00000040]
" "
key={index} key={index}
href={item.link}
> >
<p className="text-xs text-center font-medium text-gray hidden group-hover:flex "> <p className="text-xs text-center font-medium text-gray hidden group-hover:flex ">
{item.description} {item.description}
@ -72,7 +74,8 @@ export default function Landing() {
key={index} key={index}
className=" w-[45%] h-[45%] hidden group-hover:flex" className=" w-[45%] h-[45%] hidden group-hover:flex"
/> />
</div> </Link>
); );
})} })}
</div> </div>

View File

@ -9,14 +9,15 @@ import { Button } from "./ui/button";
export default function Navbar() { export default function Navbar() {
return ( return (
<div className="absolute left-0 right-0 top-0"> <div className="absolute left-0 right-0 top-0">
<div className="flex justify-between items-center w-full py-2 px-8 z-10 border-b-[#C9CFD7] border-b-[1px] border-solid">
<div className="flex justify-between items-center w-full px-8 py-2 z-10 border-b-[#C9CFD7] border-b-[1px] border-solid">
<h1 className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text"> <h1 className="bg-gradient-to-r from-gradient1 to-gradient2 inline-block text-transparent bg-clip-text">
سال 1402 | مهارم تورم، رشد تولید سال 1402 | مهارم تورم، رشد تولید
</h1> </h1>
<div className=" flex items-center gap-10"> <div className=" flex items-center gap-10">
<div className=" relative flex bg-gray-300 rounded-xl items-center"> <div className=" relative flex bg-gray-300 rounded-xl items-center">
<Input <Input
className=" h-9 bg-slate-300 border-none focus-visible:none w-64 rounded-xl" className="mb-0 h-8 bg-slate-300 border-none focus-visible:none w-64 rounded-xl"
placeholder="جستجو..." placeholder="جستجو..."
/> />
<button className="absolute left-0"> <button className="absolute left-0">

261
components/Request.tsx Normal file
View File

@ -0,0 +1,261 @@
"use client";
import React from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import * as z from "zod";
import { Button } from "@/components/ui/button";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { toast } from "@/components/ui/use-toast";
import { Textarea } from "@/components/ui/textarea";
import Image from "next/image";
import LoginIcon from "../public/img/login-icon.svg";
const FormSchema = z.object({
firstName: z.string().min(2, {
message: "firstName must be at least 2 characters.",
}),
lastName: z.string().min(2, {
message: "lastName must be at least 2 characters.",
}),
nationalCode: z.number().min(10, {
message: "nationalCode must be at least 10 characters.",
}),
phoneNumber: z.number().min(11, {
message: "phoneNumber must be at least 11 characters.",
}),
subject: z.string().min(2, {
message: "subject must be at least 2 characters.",
}),
organisation: z.string().min(2, {
message: "organisation must be at least 2 characters.",
}),
person: z.string().min(2, {
message: "personName must be at least 2 characters.",
}),
description: z
.string()
.min(5, {
message: "description must be at least 5 characters.",
})
.max(200, {
message: "description must not be longer than 200 characters.",
}),
});
export default function Request() {
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
firstName: "",
lastName: "",
// nationalCode: ,
// phoneNumber: ,
subject: "",
organisation: "",
person: "",
description: "",
},
});
function onSubmit(data: z.infer<typeof FormSchema>) {
toast({
title: "You submitted the following values:",
description: (
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
</pre>
),
});
console.log(data);
}
return (
<div className="w-full h-full sm:w-2/3 md:w-2/4 max-sm:p-4 ">
<div className="space-y-3 md:space-y-4 h-full flex flex-col justify-center">
<p className="text-base font-bold leading-tight tracking-tight text-blue dark:text-white">
لطفا جهت ارسال درخواست فرم زیر را تکمیل نمایید.
</p>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="w-full flex flex-col "
>
<div className="flex flex-row flex-wrap justify-between">
<FormField
control={form.control}
name="firstName"
render={({ field }) => (
<FormItem className="w-full sm:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium">
نام
</FormLabel>
<FormControl>
<Input placeholder="نام خود را وارد نمایید" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="lastName"
render={({ field }) => (
<FormItem className="w-full sm:w-[48%] ">
<FormLabel className="text-[#7C838A] text-sm font-medium">
نام خانوادگی
</FormLabel>
<FormControl>
<Input
placeholder="نام خانوادگی خود را وارد نمایید"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="nationalCode"
render={({ field }) => (
<FormItem className="w-full sm:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
کد ملی
</FormLabel>
<FormControl>
<Input
type="number"
placeholder="کد ملی خود را وارد نمایید "
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="phoneNumber"
render={({ field }) => (
<FormItem className=" w-full sm:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
شماره تماس
</FormLabel>
<FormControl>
<Input
type="number"
placeholder="شماره تماس خود را وارد نمایید "
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
<FormField
control={form.control}
name="subject"
render={({ field }) => (
<FormItem>
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
*موضوع شکایت
</FormLabel>
<FormControl>
<Input
placeholder="موضوع شکایت خود را بنویسید"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="flex flex-row flex-wrap justify-between">
<FormField
control={form.control}
name="organisation"
render={({ field }) => (
<FormItem className="w-full sm:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
*دستگاه مربوطه
</FormLabel>
<FormControl>
<Input
placeholder="دستگاه مربوطه را انتخاب کنید"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="person"
render={({ field }) => (
<FormItem className=" w-full sm:w-[48%]">
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">
فرد مربوطه
</FormLabel>
<FormControl>
<Input
placeholder="نام فرد مورد نظر خود را بنویسید"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
<FormField
control={form.control}
name="description"
render={({ field }) => (
<FormItem>
<FormLabel className="text-[#7C838A] text-sm font-medium mt-7">توضیحات</FormLabel>
<FormControl>
<Textarea
placeholder="متن توضیحات خود را بنویسید"
className="resize-none"
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="flex justify-center sm:justify-end gap-2 w-full mt-8">
<Button
type="submit"
className="w-1/2 sm:w-1/3 lg:w-1/4 bg-blue text-white p-3 rounded-xl"
>
ارسال درخواست
</Button>
</div>
</form>
</Form>
</div>
</div>
);
}

View File

@ -11,8 +11,8 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input <input
type={type} type={type}
className={cn( className={cn(
`flex h-10 w-full rounded-md border border-input px-3 py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 `flex h-12 w-full rounded-md border border-input px-3 py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50
text-black text-opacity-50 text-xs font-normal bg-slate-200`, text-black text-opacity-50 text-xs font-normal bg-slate-200 mb-3`,
className className
)} )}
ref={ref} ref={ref}

View File

@ -0,0 +1,25 @@
import * as React from "react"
import { cn } from "@/lib/utils"
export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
return (
<textarea
className={cn(
`flex min-h-[198px] w-full rounded-md border border-input px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50
text-black text-opacity-50 text-xs font-normal bg-slate-200 `,
className
)}
ref={ref}
{...props}
/>
)
}
)
Textarea.displayName = "Textarea"
export { Textarea }

View File

@ -7,9 +7,9 @@ export const menuItems = [
]; ];
export const boxItems = [ export const boxItems = [
{ id: 1, name: "ثبت شکایت", icon: "/img/box1.svg" , icon2: "/img/box1-hover.svg" , description:"ارسال درخواست نارضایتی از پرسنل"}, { id: 1, name: "ثبت شکایت", icon: "/img/box1.svg" , icon2: "/img/box1-hover.svg" , description:"ارسال درخواست نارضایتی از پرسنل", link:"/Request"},
{ id: 2, name: "پیگیری شکایت", icon: "/img/box2.svg" , icon2: "/img/box2-hover.svg" , description:"پیگیری درخواست ارسال شده" }, { id: 2, name: "پیگیری شکایت", icon: "/img/box2.svg" , icon2: "/img/box2-hover.svg" , description:"پیگیری درخواست ارسال شده" , link:"/"},
{ id: 3, name: "مشاهده آمار", icon: "/img/box3.svg" , icon2: "/img/box3-hover.svg" , description:"مشاهده آمار و گزارشات درخواست ها" }, { id: 3, name: "مشاهده آمار", icon: "/img/box3.svg" , icon2: "/img/box3-hover.svg" , description:"مشاهده آمار و گزارشات درخواست ها" , link:"/"},
]; ];
export const newsItems = [ export const newsItems = [