# Institute Management System — Project Overview

## What Is This System?

This is a **web-based Institute Management System** built with **Laravel (PHP)**. It helps educational institutes manage students, fees, advisors, cashiers, notices, and grievances — all from one central platform.

---

## Technology Stack

| Layer       | Technology                         |
|-------------|-------------------------------------|
| Backend     | Laravel 10 (PHP)                    |
| Frontend    | Blade Templates + Vite (CSS/JS)     |
| Database    | MySQL                               |
| PDF Reports | DomPDF (via barryvdh/laravel-dompdf)|
| Auth        | Laravel Session Auth + Sanctum      |

---

## User Roles

The system has **4 roles**. Each role has its own dashboard and set of permissions.

| Role        | URL Prefix   | What They Can Do                                         |
|-------------|--------------|----------------------------------------------------------|
| **Admin**   | `/admin`     | Full control — manages everything                        |
| **Advisor** | `/advisor`   | Views assigned students, manages own profile             |
| **Cashier** | `/cashier`   | Records fee payments, prints receipts, views reports     |
| **Student** | `/student`   | Views own profile, fee history, notices, raises grievances |

---

## How Login Works

1. All users visit `/login` and enter email + password.
2. On successful login, the system checks the user's **role** and redirects them to their respective dashboard.
3. If a user's account is **deactivated**, login is blocked with a message.
4. Each role's panel is protected by middleware — users cannot access panels they don't belong to.

---

## Core Modules

### 1. Institutes
- Admin can create, edit, and manage multiple institutes.
- Each institute has a name, code, address, contact info, and logo.

### 2. Academic Sessions
- Admin manages academic sessions (e.g., 2024–25).
- Fee payments are linked to sessions.

### 3. Courses
- Admin creates courses with a name, code, type, duration (years), and semesters.
- Students are enrolled into courses.

### 4. Students
- Admin can add students manually or **import them via CSV file**.
- Each student has: personal details, enrollment number, institute, course, session, assigned advisor, and photo.
- The system automatically tracks **total fees paid** and **outstanding balance** per student.

### 5. Student Advisors
- Advisors are registered by the admin with a commission rate.
- Each student can be assigned an advisor.
- Reports show how much fee was collected through each advisor and their commission amount.

### 6. Cashiers
- Admin registers cashier users.
- Cashiers handle all fee collection at the counter.

### 7. Fee Payments
- Cashiers search for a student, enter the payment amount and mode (cash/cheque/online), and record the transaction.
- Every payment generates a **receipt** with a unique receipt number.
- Receipts can be viewed and **printed as PDF**.

### 8. Fee Structures
- Each student can have a total course fee assigned.
- The system calculates dues automatically: `Total Fee − Total Paid = Due`.

### 9. Notices
- Admin publishes notices (announcements) visible to students.

### 10. Grievances
- Students can raise grievances/complaints through the portal.
- Admin reviews and responds to each grievance, updating its status: `Pending → In Progress → Resolved → Closed`.
- Students can track the status of their grievances.

### 11. Reports & PDF Export
- **Admin** can generate:
  - Collection report (filtered by session, course, institute, date range)
  - Advisor-wise collection report with commission calculation
  - Institute-wise and course-wise breakdowns
- **Cashier** can generate:
  - Their own collection report for any date range
  - Daily trend charts
  - Payment mode breakdown (Cash / Cheque / Online)
- All reports can be **exported as PDF** (A4 landscape).

---

## Database Overview

| Table                    | Purpose                                  |
|--------------------------|------------------------------------------|
| `users`                  | All user accounts (all roles)            |
| `institutes`             | Institute records                        |
| `academic_sessions`      | Academic year/session records            |
| `courses`                | Course details                           |
| `student_advisors`       | Advisor profiles linked to users         |
| `students`               | Student profiles linked to users         |
| `student_fee_structures` | Total course fee per student             |
| `fee_payments`           | Individual fee payment records           |
| `grievances`             | Student-raised complaints                |
| `grievance_responses`    | Admin responses to grievances            |
| `notices`                | Announcements from admin                 |

---

## URL Structure Summary

```
/                          → Redirects to /login
/login                     → Login page (all users)
/logout                    → Logout

/admin/dashboard           → Admin home
/admin/institutes          → Manage institutes
/admin/sessions            → Manage academic sessions
/admin/courses             → Manage courses
/admin/students            → Manage students (+ CSV import)
/admin/advisors            → Manage advisors
/admin/cashiers            → Manage cashiers
/admin/notices             → Manage notices
/admin/grievances          → View & respond to grievances
/admin/fees                → View all fee payments
/admin/receipts/{id}       → View/print receipt
/admin/reports             → Collection & advisor reports (PDF)

/advisor/dashboard         → Advisor home
/advisor/students          → View assigned students
/advisor/profile           → Edit own profile

/cashier/dashboard         → Cashier home
/cashier/fees              → Record fee payments
/cashier/receipts          → View/print receipts
/cashier/reports           → View own collection reports (PDF)

/student/dashboard         → Student home
/student/profile           → Edit own profile & photo
/student/fees              → View fee history & download receipts
/student/notices           → View notices
/student/grievances        → Raise & track grievances
```

---

## Key Business Flow

```
Admin sets up:
  Institutes → Courses → Academic Sessions

Admin registers:
  Advisors → Students (with fee structure) → Cashiers

Student comes to pay fee:
  Cashier searches student → Records payment → Prints receipt

Student logs in:
  Views fee history → Downloads receipt PDF → Reads notices → Raises grievance if needed

Admin monitors:
  Dashboard stats → Reports → Grievances → All payments
```

---

## Security Features

- Role-based middleware protects every panel.
- Passwords are hashed using Laravel's bcrypt hashing.
- Inactive accounts are blocked at login.
- CSRF protection is enabled on all forms.
- Session is regenerated on login and invalidated on logout.
