├── src ├── app │ ├── todo │ │ └── page.tsx │ ├── favicon.ico │ ├── page.tsx │ ├── employee │ │ ├── add │ │ │ └── page.tsx │ │ └── list │ │ │ └── page.tsx │ ├── globals.css │ ├── not-found.tsx │ ├── layout.tsx │ └── posts │ │ ├── [postId] │ │ └── page.tsx │ │ └── page.tsx ├── type │ └── type.ts ├── utils │ └── axiosConfig.ts ├── components │ ├── GoBack.tsx │ ├── EmployeeTable.tsx │ └── AddEmployeeForm.tsx ├── lib │ └── api.ts └── context │ └── EmployeeContext.tsx ├── .eslintrc.json ├── public ├── not-found.png ├── vercel.svg ├── window.svg ├── file.svg ├── globe.svg └── next.svg ├── eslint.config.js ├── .github ├── ISSUE_TEMPLATE │ ├── custom.md │ ├── feature_request.md │ └── bug_report.md ├── workflows │ └── lint.yml └── PULL_REQUEST_TEMPLATE.md ├── postcss.config.mjs ├── next.config.js ├── tailwind.config.ts ├── .gitignore ├── tsconfig.json ├── SECURITY.md ├── package.json ├── .prettierrc.json ├── LICENSE ├── CONTRIBUTING.md ├── README.md └── CODE_OF_CONDUCT.md /src/app/todo/page.tsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next/core-web-vitals", "next/typescript"] 3 | } 4 | -------------------------------------------------------------------------------- /src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frau-azadeh/Employee-Management-System/HEAD/src/app/favicon.ico -------------------------------------------------------------------------------- /src/type/type.ts: -------------------------------------------------------------------------------- 1 | export interface PostPage { 2 | id: number; 3 | title: string; 4 | body: string; 5 | } 6 | -------------------------------------------------------------------------------- /public/not-found.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frau-azadeh/Employee-Management-System/HEAD/public/not-found.png -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | // eslint.config.js 2 | import js from "@eslint/js"; 3 | import next from "eslint-config-next"; 4 | 5 | export default [js.configs.recommended, next]; 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: "" 5 | labels: "" 6 | assignees: "" 7 | --- 8 | -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | // next.config.js 2 | /** @type {import('next').NextConfig} */ 3 | const nextConfig = { 4 | reactStrictMode: true, 5 | // تنظیمات دیگه 6 | }; 7 | 8 | module.exports = nextConfig; 9 | -------------------------------------------------------------------------------- /src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { AddEmployeeForm } from "@/components/AddEmployeeForm"; 2 | 3 | export default function Home() { 4 | return ( 5 |
6 | 7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /src/app/employee/add/page.tsx: -------------------------------------------------------------------------------- 1 | import { AddEmployeeForm } from "@/components/AddEmployeeForm"; 2 | 3 | export default function AddEmployee() { 4 | return ( 5 |
6 | 7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /src/utils/axiosConfig.ts: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | 3 | const api = axios.create({ 4 | baseURL: "https://679a1892747b09cdcccdac6b.mockapi.io", 5 | headers: { 6 | "Content-Type": "application/json", 7 | }, 8 | }); 9 | 10 | export default api; 11 | -------------------------------------------------------------------------------- /src/components/GoBack.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import React from "react"; 4 | 5 | import { useRouter } from "next/navigation"; 6 | 7 | const GoBack = () => { 8 | const router = useRouter(); 9 | return ; 10 | }; 11 | 12 | export default GoBack; 13 | -------------------------------------------------------------------------------- /public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | on: 3 | push: 4 | branches: ["master"] 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | lint: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4.2.1 13 | 14 | - uses: actions/setup-node@v4 15 | with: 16 | node-version: 20 17 | 18 | - name: Install Dependencies 19 | run: npm i 20 | -------------------------------------------------------------------------------- /src/app/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --background: #ffffff; 7 | --foreground: #171717; 8 | } 9 | 10 | @media (prefers-color-scheme: dark) { 11 | :root { 12 | --background: #0a0a0a; 13 | --foreground: #ededed; 14 | } 15 | } 16 | 17 | body { 18 | color: var(--foreground); 19 | background: var(--background); 20 | font-family: Arial, Helvetica, sans-serif; 21 | } 22 | -------------------------------------------------------------------------------- /tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from "tailwindcss"; 2 | 3 | export default { 4 | content: [ 5 | "./src/pages/**/*.{js,ts,jsx,tsx,mdx}", 6 | "./src/components/**/*.{js,ts,jsx,tsx,mdx}", 7 | "./src/app/**/*.{js,ts,jsx,tsx,mdx}", 8 | ], 9 | theme: { 10 | extend: { 11 | colors: { 12 | background: "var(--background)", 13 | foreground: "var(--foreground)", 14 | }, 15 | }, 16 | }, 17 | plugins: [], 18 | } satisfies Config; 19 | -------------------------------------------------------------------------------- /src/app/not-found.tsx: -------------------------------------------------------------------------------- 1 | import Image from "next/image"; 2 | 3 | import GoBack from "@/components/GoBack"; 4 | 5 | export default function NotFoundPage() { 6 | return ( 7 |
8 | not-found 16 | 17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | Please provide a brief description of the changes you made. 4 | 5 | ## Related Issue 6 | 7 | If this pull request is related to an issue, please link it here. 8 | 9 | ## Checklist 10 | 11 | - [ ] My code follows the style guidelines of this project. 12 | - [ ] I have performed a self-review of my code. 13 | - [ ] I have commented my code, particularly in hard-to-understand areas. 14 | - [ ] I have made corresponding changes to the documentation. 15 | - [ ] My changes generate no new warnings. 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | 3 | import { EmployeeProvider } from "@/context/EmployeeContext"; 4 | 5 | import "./globals.css"; 6 | 7 | export const metadata: Metadata = { 8 | title: "Employee Managment System", 9 | description: "Employee Managment System App", 10 | }; 11 | 12 | export default function RootLayout({ 13 | children, 14 | }: Readonly<{ 15 | children: React.ReactNode; 16 | }>) { 17 | return ( 18 | 19 | 20 | 21 |
{children}
22 |
23 | 24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "" 5 | labels: "" 6 | assignees: "" 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": [ 26 | "next-env.d.ts", 27 | "**/*.ts", 28 | "**/*.tsx", 29 | ".next/types/**/*.ts", 30 | "next.config.js" 31 | ], 32 | "exclude": ["node_modules"] 33 | } 34 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | If you discover a security vulnerability, please email us at [designweb.azadeh@gmail.com]. 23 | -------------------------------------------------------------------------------- /src/app/posts/[postId]/page.tsx: -------------------------------------------------------------------------------- 1 | import { getPostById } from "@/lib/api"; 2 | import { notFound } from "next/navigation"; 3 | 4 | import GoBack from "@/components/GoBack"; 5 | 6 | interface PostPageProps { 7 | params: { 8 | postId: string; 9 | }; 10 | } 11 | 12 | export default async function SinglePostPage({ params }: PostPageProps) { 13 | const post = await getPostById(params.postId); 14 | 15 | if (!post) { 16 | notFound(); 17 | } 18 | return ( 19 |
20 |
21 |

{post.title}

22 |

{post.body}

23 |
24 | 25 |
26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /src/app/posts/page.tsx: -------------------------------------------------------------------------------- 1 | import { getPost } from "@/lib/api"; 2 | import { ChevronRightIcon } from "lucide-react"; 3 | import Link from "next/link"; 4 | 5 | export default async function PostsPage() { 6 | const posts = await getPost(); 7 | return ( 8 |
9 | {posts.map((post) => ( 10 |
14 |

{post.title}

15 |

{post.body}

16 | 20 | Read More 21 | 22 | 23 |
24 | ))} 25 |
26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-next-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint", 10 | "prettier:check": "prettier --check .", 11 | "prettier:fix": "prettier --write ." 12 | }, 13 | "dependencies": { 14 | "@trivago/prettier-plugin-sort-imports": "^5.2.2", 15 | "axios": "^1.7.9", 16 | "lucide-react": "^0.511.0", 17 | "next": "^14.2.29", 18 | "prettier": "^3.5.3", 19 | "react": "^18.3.1", 20 | "react-dom": "^18.3.1", 21 | "react-hook-form": "^7.54.2" 22 | }, 23 | "devDependencies": { 24 | "@eslint/eslintrc": "^3", 25 | "@eslint/js": "^9.28.0", 26 | "@types/node": "^20", 27 | "@types/react": "^19", 28 | "@types/react-dom": "^19", 29 | "eslint": "^9.28.0", 30 | "eslint-config-next": "^15.3.3", 31 | "postcss": "^8", 32 | "tailwindcss": "^3.4.1", 33 | "typescript": "^5" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /public/globe.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "" 5 | labels: "" 6 | assignees: "" 7 | --- 8 | 9 | **Describe the bug** 10 | A clear and concise description of what the bug is. 11 | 12 | **To Reproduce** 13 | Steps to reproduce the behavior: 14 | 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | 28 | - OS: [e.g. iOS] 29 | - Browser [e.g. chrome, safari] 30 | - Version [e.g. 22] 31 | 32 | **Smartphone (please complete the following information):** 33 | 34 | - Device: [e.g. iPhone6] 35 | - OS: [e.g. iOS8.1] 36 | - Browser [e.g. stock browser, safari] 37 | - Version [e.g. 22] 38 | 39 | **Additional context** 40 | Add any other context about the problem here. 41 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["@trivago/prettier-plugin-sort-imports"], 3 | "importOrder": [ 4 | "^(vite|@vitejs)(/(.*))?$", 5 | "^(react|react-dom)(/(.*))?$", 6 | "^react-router(/(.*))?$", 7 | "^react-error-boundary(/(.*))?$", 8 | "^(immer|use-immer)(/(.*))?$", 9 | "^@tanstack(/(.*))?$", 10 | "^@dnd-kit(/(.*))?$", 11 | "^react-toastify(/(.*))?$", 12 | "^(react-hook-form|@hookform/resolvers|zod)(/(.*))?$", 13 | "^clsx(/(.*))?$", 14 | "", 15 | "^@/api", 16 | "^@/components", 17 | "^@/context", 18 | "^@/data", 19 | "^@/dto", 20 | "^@/hooks", 21 | "^@/icons", 22 | "^@/layouts", 23 | "^@/modals", 24 | "^@/pages", 25 | "^@/providers", 26 | "^@/reducers", 27 | "^@/schemas", 28 | "^@/stores", 29 | "^@/types", 30 | "^@/utils", 31 | "^@/styles", 32 | "^(\\.|\\.\\.)/(.(?!.css))*$", 33 | "\\.css$" 34 | ], 35 | "importOrderSeparation": true, 36 | "importOrderSortSpecifiers": true, 37 | "importOrderGroupNamespaceSpecifiers": true 38 | } 39 | -------------------------------------------------------------------------------- /src/lib/api.ts: -------------------------------------------------------------------------------- 1 | import { PostPage } from "@/type/type"; 2 | import axios, { AxiosError } from "axios"; 3 | 4 | const jsonApi = axios.create({ 5 | baseURL: "https://jsonplaceholder.typicode.com", 6 | timeout: 5000, 7 | }); 8 | 9 | export async function getPost(): Promise { 10 | const res = await jsonApi.get("/posts"); 11 | return res.data; 12 | } 13 | 14 | export async function getPostById(id: string): Promise { 15 | const postId = Number(id); 16 | if (!Number.isInteger(postId)) { 17 | console.warn(`Invalid by id=${id}`); 18 | return null; 19 | } 20 | try { 21 | const response = await jsonApi.get(`/posts/${postId}`); 22 | return response.data; 23 | } catch (error) { 24 | if (error instanceof AxiosError) { 25 | const status = error.response?.status; 26 | if (status === 404) { 27 | console.warn(`Post not found: id=${postId}`); 28 | } else { 29 | console.error(`Failed to fetch id=${postId}`, error.message); 30 | } 31 | } 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/app/employee/list/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import React, { useEffect, useState } from "react"; 4 | 5 | import EmployeeTable from "@/components/EmployeeTable"; 6 | 7 | import api from "@/utils/axiosConfig"; 8 | 9 | interface Employee { 10 | id: string; 11 | name: string; 12 | position: string; 13 | email: string; 14 | } 15 | 16 | export default function EmployeesPage() { 17 | const [employees, setEmployees] = useState([]); 18 | 19 | useEffect(() => { 20 | const fetchEmployees = async () => { 21 | try { 22 | const response = await api.get("/employee/managment"); 23 | setEmployees(response.data); 24 | console.log("Fetched Employees:", response.data); 25 | } catch (error) { 26 | console.error("Error fetching employees:", error); 27 | } 28 | }; 29 | fetchEmployees(); 30 | }, []); 31 | 32 | return ( 33 |
34 |

35 | Employees List 36 |

37 | 38 |
39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Azadeh Sharifi Soltani 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/EmployeeTable.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import React from "react"; 4 | 5 | interface Employee { 6 | id: string; 7 | name: string; 8 | position: string; 9 | email: string; 10 | } 11 | 12 | interface EmployeeTableProps { 13 | employees: Employee[]; 14 | } 15 | 16 | const EmployeeTable: React.FC = ({ employees }) => { 17 | return ( 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {employees.length > 0 ? ( 29 | employees.map((employee) => ( 30 | 34 | 35 | 36 | 37 | 38 | )) 39 | ) : ( 40 | 41 | 44 | 45 | )} 46 | 47 |
NamePositionEmail
{employee.name}{employee.position}{employee.email}
42 | No employees found. 43 |
48 |
49 | ); 50 | }; 51 | 52 | export default EmployeeTable; 53 | -------------------------------------------------------------------------------- /src/context/EmployeeContext.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { 4 | ReactNode, 5 | createContext, 6 | useContext, 7 | useEffect, 8 | useState, 9 | } from "react"; 10 | 11 | import api from "@/utils/axiosConfig"; 12 | 13 | interface Employee { 14 | id: string; 15 | name: string; 16 | position: string; 17 | email: string; 18 | } 19 | 20 | interface EmployeeContextType { 21 | employees: Employee[]; 22 | addEmployee: (employee: Omit) => void; 23 | } 24 | 25 | const EmployeeContext = createContext( 26 | undefined, 27 | ); 28 | export const EmployeeProvider = ({ children }: { children: ReactNode }) => { 29 | const [employees, setEmployees] = useState([]); 30 | 31 | useEffect(() => { 32 | const fetchEmployees = async () => { 33 | try { 34 | const response = await api.get("/employee/managment"); 35 | console.log("fetched Employee", response.data); 36 | } catch (error) { 37 | console.error("Error fetching employees:", error); 38 | } 39 | }; 40 | fetchEmployees(); 41 | }, []); 42 | 43 | const addEmployee = async (employee: Omit) => { 44 | try { 45 | const response = await api.post("/employee/managment", employee); 46 | 47 | console.log("Server Response:", response.data); 48 | 49 | setEmployees((prev) => [...prev, response.data]); 50 | 51 | console.log("Updated Employees List:", employees); 52 | } catch (error) { 53 | console.error("Error adding employee:", error); 54 | } 55 | }; 56 | 57 | return ( 58 | 59 | {children} 60 | 61 | ); 62 | }; 63 | 64 | export const useEmployeeContext = () => { 65 | const context = useContext(EmployeeContext); 66 | if (!context) { 67 | throw new Error( 68 | "useEmployeeContext must be use within an EmployeeProvider", 69 | ); 70 | } 71 | return context; 72 | }; 73 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 🚀 Contributing to Our Project 2 | 3 | We are thrilled that you are interested in contributing to our project. Your support and involvement are what make our community strong and our project better. Whether you're fixing a bug, adding a feature, or simply improving documentation, every contribution is valuable. 💪 4 | 5 | ## 📝 How to Contribute 6 | 7 | ### 1. Fork the Repository 8 | 9 | Click the _Fork_ button at the top right of this page to create a copy of the repository under your GitHub account. 10 | 11 | ### 2. Clone Your Fork 12 | 13 | bash 14 | git clone https://github.com/frau-azadeh/Employee-Managment-System.git 15 | cd REPOSITORY_NAME 16 | 17 | ### 3. Create a Branch 18 | 19 | Create a new branch for your changes: 20 | 21 | git checkout -b your-feature-name 22 | 23 | ### 4. Make Your Changes 24 | 25 | Edit the code, fix bugs, or improve the documentation. Remember to write clean and well-documented code. 26 | 27 | ### 5. Commit Your Changes 28 | 29 | git add . 30 | git commit -m "Brief description of your changes" 31 | 32 | ### 6. Push to Your Fork 33 | 34 | git push origin your-feature-name 35 | 36 | ### 7. Create a Pull Request 37 | 38 | Go to the original repository, click on _Pull Requests, and select \*\*New Pull Request_. Choose your branch and submit the PR for review. 39 | 40 | ## ✅ Contribution Guidelines 41 | 42 | - Ensure your code follows the existing style and conventions. 43 | - Write clear, concise commit messages. 44 | - Provide a detailed description of your changes in the pull request. 45 | - Test your changes before submitting. 46 | 47 | ## 🌟 Additional Ways to Contribute 48 | 49 | - Report issues 🐛 50 | - Suggest new features ✨ 51 | - Improve documentation 📖 52 | - Share the project with others 💬 53 | 54 | ## 🤝 Code of Conduct 55 | 56 | Please note that we follow a [Code of Conduct](CODE_OF_CONDUCT.md) to ensure a welcoming and inclusive environment. 57 | 58 | ## 💬 Need Help? 59 | 60 | If you need any help or have questions, feel free to open an issue or reach out to us. We’re happy to help! 🚀 61 | 62 | Thank you for helping us make this project better! ❤️ 63 | -------------------------------------------------------------------------------- /src/components/AddEmployeeForm.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import React from "react"; 4 | 5 | import { useForm } from "react-hook-form"; 6 | 7 | import { useEmployeeContext } from "@/context/EmployeeContext"; 8 | 9 | interface FormInput { 10 | name: string; 11 | position: string; 12 | email: string; 13 | } 14 | 15 | export const AddEmployeeForm: React.FC = () => { 16 | const { addEmployee } = useEmployeeContext(); 17 | const { register, handleSubmit, reset } = useForm(); 18 | 19 | const onSubmit = async (data: FormInput) => { 20 | console.log("Form Data:", data); 21 | await addEmployee(data); 22 | reset(); 23 | }; 24 | 25 | return ( 26 |
27 |
31 |

Add Employee

32 |
33 | 34 | 39 |
40 |
41 | 44 | 49 |
50 |
51 | 54 | 60 |
61 | 67 |
68 |
69 | ); 70 | }; 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🏢 Employee Management System 2 | 3 | A modern **Employee Management System** built with **React**, **TypeScript**, **Tailwind CSS**, **React Hook Form**, **Context API**, and **Axios**. This project allows you to manage employee data efficiently with features like adding, editing, filtering, and deleting employees. 4 | 5 | --- 6 | 7 | ## 🚀 Features 8 | 9 | - **View Employees**: Display a list of employees with details like name, position, and email. 10 | - **Add Employees**: Use a form to add new employees with validations. 11 | - **Edit Employees**: Modify employee information with an easy-to-use form. 12 | - **Delete Employees**: Remove employees from the list with a single click. 13 | - **Filter Employees**: Search for employees by name or position. 14 | - **Notification System**: Displays success or error messages for user actions. 15 | - **API Integration**: Fetch and save employee data with Axios. 16 | 17 | --- 18 | 19 | ## 🛠️ Technologies Used 20 | 21 | - **React** ⚛️: Frontend library for building the user interface. 22 | - **TypeScript** 🟦: For strong typing and better developer experience. 23 | - **Tailwind CSS** 🎨: For fast and responsive UI styling. 24 | - **React Hook Form** 📝: For managing forms and validation. 25 | - **Context API** 🌐: For managing global state across the application. 26 | - **Axios** 📡: For API requests and data fetching. 27 | 28 | --- 29 | 30 | ## 🚀 Getting Started 31 | 32 | Follow these steps to get started with the project: 33 | 34 | 1️. Prerequisites 35 | 36 | Make sure you have the following installed: 37 | 38 | Node.js: Download Node.js 39 | 40 | npm or yarn package manager. 41 | 42 | 2️. Installation 43 | 44 | Clone the repository and install dependencies: 45 | 46 | git clone https://github.com/azadeh-frau/Employee-Management-System.git 47 | 48 | cd employee-management-system 49 | 50 | npm install 51 | 52 | 3️. Run the Application 53 | 54 | Start the development server: 55 | 56 | npm start 57 | 58 | The app will be available at http://localhost:3000. 59 | 60 | ## ⚙️ Features in Detail: 61 | 62 | ### 🖥️ View Employees: 63 | 64 | Displays a list of employees with name, position, and email. 65 | Designed for fast and responsive performance. 66 | 67 | ### ➕ Add Employees: 68 | 69 | Simple form for adding new employees. 70 | Input validation using React Hook Form and Yup. 71 | 72 | ### ✏️ Edit Employees: 73 | 74 | Editable forms for updating employee details. 75 | Changes are immediately reflected in the list. 76 | 77 | ### ❌ Delete Employees: 78 | 79 | Remove employees with a single click. 80 | Confirmation alerts can be added as an enhancement. 81 | 82 | ### 🔍 Filter Employees: 83 | 84 | Quickly search for employees by name or position. 85 | Filters update dynamically as you type. 86 | 87 | ### 📡 API Integration: 88 | 89 | Uses Axios for seamless data fetching and manipulation. 90 | Can be connected to a custom backend or mock API. 91 | 92 | ## 🛠️ Development Workflow: 93 | 94 | ### Context API: 95 | 96 | Manage global state for employee data. 97 | Functions for adding, editing, and deleting employees. 98 | 99 | ### React Hook Form: 100 | 101 | Use for form validation and submission. 102 | Simplifies handling of form data. 103 | 104 | ### Tailwind CSS: 105 | 106 | Create a clean and responsive UI. 107 | Use utility-first classes for fast development. 108 | 109 | ### Axios Integration: 110 | 111 | Fetch data from an API for employees. 112 | Use services for reusable API calls. 113 | 114 | ## 🌟 Future Enhancements 115 | 116 | Add pagination for the employee list. 117 | Implement authentication for managing employee data. 118 | Add confirmation modals for critical actions (e.g., deleting employees). 119 | Build a dashboard with charts for employee statistics. 120 | 121 | ## 🤝 Contributing 122 | 123 | 🌻 Azadeh Sharifi Soltani 124 | 125 | Feel free to contribute to this project by submitting a pull request or opening an issue! Made with 💻, ☕, and 🌻 by Azadeh Sharifi Soltani 126 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | - Demonstrating empathy and kindness toward other people 21 | - Being respectful of differing opinions, viewpoints, and experiences 22 | - Giving and gracefully accepting constructive feedback 23 | - Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | - Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | - The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | - Trolling, insulting or derogatory comments, and personal or political attacks 33 | - Public or private harassment 34 | - Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | - Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | designweb.azadeh@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | --------------------------------------------------------------------------------