> ## Documentation Index
> Fetch the complete documentation index at: https://docs.criar.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Admission Form Module

> SKOLE-ADMN — Admission Form Module

# SKOLE-ADMN — Admission Form Module

**Module ID:** `SKOLE-ADMN` | **Version:** 1.0 | **Status:** Active\
**Products:** Web App (admin) · Public-facing form (no auth required)

***

## 1. Overview

| Field              | Value                                                                                                                                                                                                                                      |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Module Name**    | Admission Form                                                                                                                                                                                                                             |
| **Module Code**    | ADMN                                                                                                                                                                                                                                       |
| **Business Value** | Replaces paper admission forms. Parents fill a multi-section digital form to enroll their child. Data flows directly into the student registry, parent details, guardian, and address tables. Triggers parent app PIN setup on completion. |

### Scope In

* Multi-step admission: student info → parent/guardian info → address info
* Public endpoints (no JWT) so prospective parents can submit
* Edit each section individually after initial submission
* Grade lookup and student info lookup by roll\_no

### Scope Out

* Payment collection during admission
* Document upload (birth certificate, ID proof)

***

## 2. Requirements

### Functional Requirements (FR)

*What the module must DO — actions, behaviors, and outcomes.*

* **SKOLE-ADMN-FR001:** The module shall allow any user with a school link to submit an admission form without requiring authentication.
* **SKOLE-ADMN-FR002:** The module shall capture comprehensive student, parent, guardian, and address information through a multi-step flow.
* **SKOLE-ADMN-FR003:** The module shall automatically create synchronized records in `students`, `parent_details`, `student_guardian`, and `student_address` tables upon submission.
* **SKOLE-ADMN-FR004:** The module shall allow admins to query submitted records by skole\_id and roll number.
* **SKOLE-ADMN-FR005:** The module shall provide available grades for the school in a dynamic dropdown.
* **SKOLE-ADMN-FR006:** The module shall enable section-level updates for student, parent, guardian, and address info post-submission.

### Non-Functional Requirements (NFR)

*How well the module must do it — performance, security, and reliability.*

* **SKOLE-ADMN-NFR001:** The module shall perform as a public-facing gateway by marking all admission endpoints as `@Public()`.
* **SKOLE-ADMN-NFR002:** The module shall behave reliably by identifying the target school via the `skole_id` provided in the query or form body.

### Constraints

*Rules and boundaries — tech choices and platform restrictions.*

* **C001:** We must utilize database transactions during admission creation to ensure all related records (student, parent, guardian, etc.) are created atomically.
* **C002:** We must ensure the public form is stateless as it cannot rely on JWT-based sessions.

***

## 3. Sub-modules / Backlog

| ID                 | Sub-module                         | Priority | Status | Estimate | Linked FR   |
| ------------------ | ---------------------------------- | -------- | ------ | -------- | ----------- |
| `SKOLE-ADMN-SM001` | Multi-step admission form (create) | P0       | Done   | 3d       | FR001–FR003 |
| `SKOLE-ADMN-SM002` | Section-level update forms         | P1       | Done   | 2d       | FR005       |
| `SKOLE-ADMN-SM003` | Grade lookup API                   | P1       | Done   | 0.5d     | FR006       |
| `SKOLE-ADMN-SM004` | Student info lookup                | P1       | Done   | 0.5d     | FR004       |

***

## 4. Logical Implementation

### Admission Create Flow

```text theme={null}
POST /web-app/admission-form
  ├─ Input: { student: StudentDto, parent: ParentDetailsDto,
  │           guardian: StudentGuardianDto, address: StudentAddressDto }
  ├─ BEGIN TRANSACTION
  │    ├─ INSERT students (or find existing by roll_no)
  │    ├─ INSERT parent_details
  │    ├─ INSERT student_guardian
  │    └─ INSERT student_address
  └─ COMMIT → return { success, student_id, roll_no }
```

### Grade Lookup

```text theme={null}
GET /web-app/grades?skole_id=
  --> SELECT DISTINCT grade FROM students WHERE skole_id = ?
```

***

## 5. UI Requirements

### Web App — Admission Form

| ID                 | Screen         | Route                           | Description                                            |
| ------------------ | -------------- | ------------------------------- | ------------------------------------------------------ |
| `SKOLE-ADMN-UI001` | Admission Form | `/public/:skoleId/registration` | Multi-step form: Student → Parent → Guardian → Address |
| `SKOLE-ADMN-UI002` | Student Edit   | `/:skoleId/students/:id/edit`   | Admin section edit                                     |

**Components:**

| ID                 | Component           | Props                                        |
| ------------------ | ------------------- | -------------------------------------------- |
| `SKOLE-ADMN-UC001` | `MultiStepForm`     | `steps[]`, `currentStep`, `onNext`, `onBack` |
| `SKOLE-ADMN-UC002` | `StudentInfoForm`   | `initialValues`, `onSubmit`                  |
| `SKOLE-ADMN-UC003` | `ParentDetailsForm` | `initialValues`, `onSubmit`                  |
| `SKOLE-ADMN-UC004` | `GuardianForm`      | `initialValues`, `onSubmit`                  |
| `SKOLE-ADMN-UC005` | `AddressForm`       | `initialValues`, `onSubmit`                  |
| `SKOLE-ADMN-UC006` | `GradeDropdown`     | `skole_id`, `selected`, `onChange`           |

***

## 6. Conditional Expressions

| ID                 | Expression                   | Trigger             | True Action                   | False Action       |
| ------------------ | ---------------------------- | ------------------- | ----------------------------- | ------------------ |
| `SKOLE-ADMN-CE001` | `currentStep === totalSteps` | MultiStepForm       | Show Submit button            | Show Next button   |
| `SKOLE-ADMN-CE002` | `student found by roll_no`   | Student info lookup | Pre-fill form                 | Show empty form    |
| `SKOLE-ADMN-CE003` | `submission success`         | Create admission    | Show success + PIN setup link | Show error message |

***

## 7. Database Tables

| ID                 | Table              | Role                           |
| ------------------ | ------------------ | ------------------------------ |
| `SKOLE-ADMN-TB001` | `students`         | Student record created         |
| `SKOLE-ADMN-TB002` | `parent_details`   | Parent info created            |
| `SKOLE-ADMN-TB003` | `student_guardian` | Guardian info                  |
| `SKOLE-ADMN-TB004` | `student_address`  | Address info                   |
| `SKOLE-ADMN-TB005` | `registrations`    | Lead tracking (school signups) |

***

## 8. API Endpoints

| ID                 | Method | Route                      | Auth   | Description                     |
| ------------------ | ------ | -------------------------- | ------ | ------------------------------- |
| `SKOLE-ADMN-EP001` | POST   | `/web-app/admission-form`  | Public | Submit admission form           |
| `SKOLE-ADMN-EP002` | GET    | `/web-app/student-info`    | Public | Lookup student by roll\_no      |
| `SKOLE-ADMN-EP003` | GET    | `/web-app/grades`          | Public | Get available grades for school |
| `SKOLE-ADMN-EP004` | PATCH  | `/web-app/update-student`  | Public | Update student section          |
| `SKOLE-ADMN-EP005` | PATCH  | `/web-app/update-parent`   | Public | Update parent section           |
| `SKOLE-ADMN-EP006` | PATCH  | `/web-app/update-guardian` | Public | Update guardian section         |
| `SKOLE-ADMN-EP007` | PATCH  | `/web-app/update-address`  | Public | Update address section          |
