1. Project Information

Project Name

Sabaragamuwa Province School Computer Hardware Survey System

Short Name

SPCHS

Version

1.0

Platform

PHP 8
MariaDB 10.6
Bootstrap 5.3
Fetch API
SweetAlert2
FontAwesome
XAMPP

2. Folder Structure

spchs/

admin/
    ajax/

assets/
    css/
    js/
    images/

config/

includes/

survey/

uploads/

database/



3. Authentication

Authentication already exists.

Never redesign it.

Always use

require_once __DIR__.'/../includes/auth.php';

depending on folder level.

4. Roles
admin

zonal_director

user

Never rename roles.

5. Database

Never redesign existing tables.

Existing tables remain authoritative.

users

schools

surveys

equipment_master

unit_master

unit_equipment

survey_equipment_details

6. Coding Standards

Always use

✔ Prepared Statements

✔ Fetch API

✔ Bootstrap 5

✔ SweetAlert2

✔ Responsive

✔ Mobile First

✔ JSON AJAX responses

Never use

mysql

jQuery

inline SQL variables
7. AJAX Rules

Every AJAX file

header('Content-Type: application/json');

Always return

{
    "success":true,
    "message":"..."
}

Never use

header("Location: ...")

inside AJAX.

8. CRUD Standard

Every CRUD page uses

One page

Bootstrap Modal

Fetch API

JSON

Reload

Never create

add.php

edit.php

update.php

separately.

9. Includes

Inside admin

include '../includes/header.php';

include '../includes/navbar.php';

include '../includes/footer.php';

Never

include 'includes/...'
10. Assets

Always use

<?= BASE_URL ?>assets/js/file.js?v=<?= SYSTEM_VERSION ?>

Never use relative

assets/js/file.js
11. BASE_URL Rule
define('BASE_URL','http://localhost/spchs/');

Always ends with

/

Therefore

Correct

<?= BASE_URL ?>dashboard.php

Wrong

<?= BASE_URL ?>/dashboard.php
12. Module List
Module 0

Foundation

Status

Completed
Module 1

Users

Status

Existing
Module 2

Schools

Status

Existing
Module 3

Units

Status

Completed
Module 4

Equipment

Status

In Progress
Module 5

Survey Wizard

Pending
Module 6

Survey Management

Pending
Module 7

Reports

Pending
Module 8

Dashboard

Existing
13. Survey Wizard

Workflow

School Details

↓

Computer Lab

↓

Language Unit

↓

Media Unit

↓

Office

↓

Other Units

↓

Summary

↓

Submit

Never change.

14. Equipment Rules

Every equipment has

Working

Not Working

Repair

All default

0

Never store totals.

Always calculate totals.

15. Other Units

User may create

Library

Staff Room

AI Lab

Smart Room

User may add equipment dynamically.

Never hardcode Other Units.

16. Security

Always

CSRF

Prepared Statements

Role Validation

Input Validation

Output Escaping

Never remove.

17. Mobile

All pages must work on

Desktop

Tablet

Mobile

Bootstrap only.

18. Before Writing Code

Codex must first:

Analyze the project.
Understand the existing architecture.
Modify only the requested files.
Never redesign the project.
19. Current Progress
Module 0

Completed
Module 3

Completed
Module 4

Needs backend rewrite
Module 5

Not started
20. IMPORTANT

Never create duplicate pages.

Never create another architecture.

Modify existing files only.

Never redesign the project.