Here is a stronger, cleaner, production-level prompt you can give to the developer/agents:

```text
You are an elite senior software engineering team specializing in the latest stable PHP Laravel, MySQL/PostgreSQL, HTML, CSS, Bootstrap, JavaScript, API design, database architecture, accounting systems, and school management platforms.

Your task is to build a fully functional, production-ready School Management System for Southend Private School, Blantyre.

Primary reference files:
1. SouthendSchool_Developer Guide.docx
2. SouthendSchool.html

The developer guide is the master functional specification. The HTML file is the existing UI prototype and visual foundation. You must study both files carefully before writing code. If there is any conflict, the developer guide controls the business logic, accounting rules, workflows, data structure, and module behavior, while the HTML file controls the starting UI direction.

The final system must be a complete Laravel application with frontend, backend, database, APIs, authentication, authorization, reports, dashboards, portals, and production deployment support.

This must not be a demo, static template, or partial prototype. It must be a real working system ready for live school operations.

====================================================================
CORE TECHNOLOGY REQUIREMENTS
====================================================================

Build the system using:

- Latest stable Laravel version
- PHP latest stable supported version
- Blade templates
- HTML5
- CSS3
- Bootstrap or Tailwind only if already suitable, but Bootstrap is preferred
- JavaScript where needed for interactivity
- MySQL or PostgreSQL database
- Laravel migrations, seeders, factories, policies, middleware, requests, services, jobs, events, notifications, and API resources where appropriate
- Laravel authentication
- Role-based access control
- REST API endpoints for all major modules
- Responsive design for desktop, tablet, and mobile
- Clean MVC architecture
- Service-layer architecture for financial calculations and complex workflows
- Reusable Blade components and layouts
- Separate CSS and JS files, not one giant HTML file

The application must work correctly when hosted on:

- localhost
- main domain
- subdomain
- cPanel hosting
- VPS hosting

All routes, assets, storage links, uploads, and URLs must use environment-aware Laravel helpers. Do not hard-code localhost, domain names, absolute paths, or temporary development URLs.

====================================================================
IMPORTANT STARTING POINT
====================================================================

The system has already been designed in `SouthendSchool.html`.

You must convert this single HTML prototype into a properly structured Laravel application:

- Create a master layout file
- Create reusable sidebar, navbar, topbar, footer, card, table, modal, form, alert, badge, and dashboard components
- Move CSS into proper files under public or resources
- Move JavaScript into proper files
- Put every page into its own Blade file
- Group module views into organized folders
- Make the sidebar/navbar openable and closable
- Make the layout responsive on all screen sizes
- Preserve and improve the professional visual style of the prototype
- Ensure all text, icons, tables, buttons, cards, forms, modals, and charts are clearly visible
- Avoid clutter, overlapping, poor spacing, hidden text, broken mobile layout, and inconsistent styling

The UI should feel like a premium enterprise school management platform, not a basic admin panel.

====================================================================
SYSTEM MODULES TO IMPLEMENT
====================================================================

Implement every module described in `SouthendSchool_Developer Guide.docx`.

PHASE 1: ACCOUNTING CORE

1. Chart of Accounts
- Account creation, editing, status management, and validation
- Account code ranges
- Account categories: Asset, Liability, Equity, Income, Expense
- Account types
- Normal balance rules
- Opening balances
- Opening Balance Equity account
- Current balances calculated from journal entries
- Grouped account listing
- Drill-down into General Ledger

2. Journal
- Double-entry journal engine
- Journal entry headers and lines
- Auto-generated reference numbers
- Debit and credit validation
- Manual journal entries
- Source tracking
- Posted and voided status
- Void reason and audit trail
- Never physically delete financial history
- All financial modules must post through this journal engine

3. General Ledger
- Account-based transaction history
- Opening balance
- Total movement
- Closing balance
- Running balance
- Date filters
- Export to PDF, Excel, and CSV

4. Trial Balance
- Debit and credit column reporting
- Balanced or not balanced indicator
- Opening balance equity warning
- Date/period filtering
- Export support

5. Fixed Assets Register
- Asset records
- Purchase value
- Depreciation method
- Accumulated depreciation
- Net book value
- Insurance information where required
- Journal posting for depreciation

6. Bank Reconciliation
- Bank account selection
- Statement import or manual entry
- Matching transactions
- Bank charges and interest posting
- Reconciliation status
- Audit trail

PHASE 2: FINANCE MODULES

1. Full Accounting / Financial Reports
- Income Statement
- Balance Sheet
- Cashflow report
- Financial position summaries
- Reports must come from the accounting core, not duplicated data

2. Student & Parent Billing
- Student fee assignment
- Parent/guardian billing
- Fee statements
- Outstanding balances
- Term-based billing
- Account Receivable integration
- Automatic journal posting

3. Payment Reconciliation
- Match payments to invoices/student accounts
- Partial payments
- Overpayments
- Unmatched payments
- Payment method support
- Journal posting to bank/cash and receivables

4. Invoicing & Quotations
- Create invoice
- Create quotation
- Convert quotation to invoice
- Line items mapped to correct income accounts
- Invoice status workflow
- PDF generation
- Email/download support

5. Purchases & Expense Management
- Expense recording
- Supplier management
- Paid immediately or on credit
- Accounts Payable integration
- Expense category must map to Chart of Accounts
- Approval workflow where required
- Journal posting

6. Budgeting & Forecasting
- Budget setup by account/department/term/year
- Budget vs actual
- Forecasting
- Variance analysis

7. Receipts Management
- Receipt generation
- Receipt numbers
- Student/parent payment receipts
- Download/print PDF
- Linked journal entries

8. Bulk Invoicing
- Generate invoices for many students
- Class, term, fee type, and student filters
- Preview before posting
- Safe batch processing
- Rollback on error
- Journal posting

PHASE 3: CORE SCHOOL MANAGEMENT

1. Admin Dashboard
- School-wide overview
- Finance summary
- Student count
- Staff count
- Attendance summary
- Pending approvals
- Recent activity
- Alerts

2. Student Management
- Student profiles
- Admission numbers
- Class assignment
- Parent/guardian links
- Academic status
- Documents
- Search and filters
- Import/export

3. Staff Management
- Staff profiles
- Teacher assignment
- Roles
- Departments
- Contact details
- Employment details

4. Timetable
- Class timetable
- Teacher timetable
- Subject allocation
- Room allocation if applicable
- Conflict detection

5. Attendance
- Student attendance
- Class attendance
- Daily/term reports
- Teacher attendance view
- Parent read-only attendance view

6. Library
- Books
- Borrowing
- Returning
- Overdue tracking
- Student/staff borrower records

7. Disciplinary Records
- Student incidents
- Action taken
- Parent communication
- Record history
- Role-based visibility

PHASE 4: GRADING & RESULTS SYSTEM

1. Grading Scale Configuration
- Grade ranges
- Remarks
- Pass/fail rules
- Term/year support

2. Results Compilation
- Subject marks
- Class results
- Teacher mark entry
- Validation
- Approval workflow

3. Report Card Generation
- Student report cards
- Term report cards
- PDF generation
- Parent portal access
- Academic summaries

PHASE 5: PORTALS, ACCESS CONTROL & ANALYTICS

1. Teacher Portal
- My Classes
- Attendance teacher view
- Gradebook
- Submit results
- Messages and announcements

2. Parent Portal
- Child profile
- Fee statement
- Pay fees
- Report card view
- Attendance view
- Messages and announcements

3. Messages & Announcements
- Admin/front desk send view
- Teacher receive view
- Parent receive view
- Target by role, class, student, or group
- Read status

4. User Roles & Access Control
- Super Admin
- Administrator
- Bursar / Finance Officer
- Accountant
- Teacher
- Registrar
- Librarian
- Front Desk
- Parent / Guardian
- Student
- Auditor / Read-only role

Every page, route, API endpoint, action, button, report, and data record must respect permissions.

5. Analytics & Insights
Implement analytics modules described in the guide:

- Financial Analytics
- Revenue & Collections Analytics
- Student Analytics
- Academic Performance Analytics
- Staff & Teacher Analytics
- Attendance Analytics
- Asset & Insurance Analytics

Analytics must be based on real system data, not hard-coded numbers.

====================================================================
DATABASE REQUIREMENTS
====================================================================

Design a clean, normalized database.

Required database standards:

- Use migrations for all tables
- Use foreign keys
- Use indexes on searchable/filterable fields
- Use soft deletes where appropriate, but never for financial journal history unless specifically handled with voiding
- Use audit logs for sensitive actions
- Store money using safe decimal fields
- Never use floating point for financial calculations
- Use transactions for all multi-step financial operations
- Ensure rollback if any journal posting or linked record creation fails
- Seed default roles, permissions, Chart of Accounts, system settings, demo admin user, and required reference data
- Avoid duplicated financial data
- Reports must be calculated from source-of-truth tables

Create all necessary models, relationships, migrations, seeders, policies, controllers, requests, services, views, routes, and tests.

====================================================================
ACCOUNTING RULES THAT MUST BE 100% CORRECT
====================================================================

The accounting engine is the backbone of the system.

Every financial event must create a balanced journal entry.

For every journal entry:

Total Debit = Total Credit

This must be enforced at validation level, service level, and database/service transaction level.

Never allow:
- Unbalanced journal entries
- Missing account mappings
- Deleting posted journal entries
- Editing posted journal entries directly
- Expense categories not linked to Chart of Accounts
- Income items not linked to Chart of Accounts
- Payments without correct receipt/journal posting
- Duplicate posting
- Broken running balances
- Reports using fake or duplicated totals

All finance modules must use the same centralized accounting service.

====================================================================
API REQUIREMENTS
====================================================================

Create secure API endpoints for all major modules.

API must support:

- Authentication
- Role-based authorization
- CRUD where appropriate
- Search
- Filters
- Pagination
- Validation errors
- JSON responses
- Student records
- Staff records
- Finance records
- Invoices
- Receipts
- Payments
- Attendance
- Results
- Parent portal data
- Teacher portal data
- Analytics summaries

Do not expose sensitive financial or student data to unauthorized users.

====================================================================
UI / UX REQUIREMENTS
====================================================================

The UI must be professional, responsive, and polished.

Requirements:

- Convert the existing HTML design into Laravel Blade
- Create separate page files
- Create reusable layout components
- CSS must be separated from HTML
- JavaScript must be separated where practical
- Sidebar must open/close
- Mobile sidebar must behave properly
- Tables must be readable on mobile
- Forms must have validation messages
- Use consistent buttons, badges, cards, tables, and modals
- Add loading states where needed
- Add empty states where needed
- Add confirmation dialogs for destructive or sensitive actions
- Add success/error alerts
- Add search and filters to list pages
- Add export buttons where reports require them
- All pages must match the Southend School brand and existing prototype style

Do not leave placeholder pages. Every menu item must open a real implemented page.

====================================================================
SECURITY REQUIREMENTS
====================================================================

Implement strong security:

- Authentication
- Password hashing
- Role-based permissions
- CSRF protection
- Request validation
- Input sanitization
- File upload validation
- Secure storage for documents
- Audit trail for sensitive actions
- Login/logout tracking
- Permission checks in both UI and backend
- Prevent unauthorized API access
- Prevent mass assignment vulnerabilities
- Protect financial records from tampering
- Do not expose debug errors in production

====================================================================
AGENT TASK SPLITTING
====================================================================

Split the work into smaller chunks for multiple agents. Each agent must work from the same developer guide and HTML prototype.

Agent 1: System Architect
- Read the full developer guide
- Read the HTML prototype
- Define application architecture
- Define module boundaries
- Define database structure
- Define naming conventions
- Define service-layer structure
- Define routes and folder structure

Agent 2: UI Conversion Agent
- Convert SouthendSchool.html into Laravel Blade
- Create layouts, partials, and components
- Move CSS into separate files
- Move JS into separate files
- Make navbar/sidebar openable and closable
- Ensure responsive design
- Build reusable UI components

Agent 3: Authentication & RBAC Agent
- Implement login/logout
- Implement users
- Implement roles and permissions
- Implement policies/middleware
- Protect all pages and API endpoints
- Seed default roles and permissions

Agent 4: Accounting Core Agent
- Implement Chart of Accounts
- Implement Journal
- Implement General Ledger
- Implement Trial Balance
- Implement Fixed Assets
- Implement Bank Reconciliation
- Build centralized accounting service
- Ensure debit/credit accuracy

Agent 5: Finance Modules Agent
- Implement billing
- Implement invoices and quotations
- Implement receipts
- Implement payment reconciliation
- Implement expenses and purchases
- Implement budgeting
- Implement bulk invoicing
- Ensure every financial operation posts correct journal entries

Agent 6: School Management Agent
- Implement student management
- Implement staff management
- Implement timetable
- Implement attendance
- Implement library
- Implement disciplinary records
- Implement admin dashboard

Agent 7: Results & Academic Agent
- Implement grading scale
- Implement gradebook
- Implement results compilation
- Implement report cards
- Implement academic reports
- Implement teacher result submission workflow

Agent 8: Portals Agent
- Implement teacher portal
- Implement parent portal
- Implement child profile
- Implement fee statement
- Implement parent report card view
- Implement parent attendance view
- Implement messages and announcements

Agent 9: Analytics & Reports Agent
- Implement all analytics modules
- Implement financial analytics
- Implement revenue and collections analytics
- Implement student analytics
- Implement academic analytics
- Implement staff analytics
- Implement attendance analytics
- Implement asset and insurance analytics
- Ensure analytics use real database records

Agent 10: API Agent
- Build REST APIs for all major modules
- Add authentication and authorization
- Add pagination, filtering, validation, and JSON resources
- Ensure APIs are secure and documented

Agent 11: QA, Testing & Production Agent
- Write feature tests
- Write unit tests for financial calculations
- Test role permissions
- Test all major workflows
- Test responsive UI
- Test imports/exports
- Test PDF generation
- Test deployment on localhost, domain, and subdomain
- Fix all errors, broken pages, invalid calculations, and UI issues

====================================================================
QUALITY EXPECTATION
====================================================================

Build this like a billion-dollar school management platform.

The final system must be:

- Fully functional
- Secure
- Responsive
- Professional
- Accurate
- Well structured
- Scalable
- Maintainable
- Production ready
- Easy to deploy
- Easy to extend
- Free from broken links, unfinished modules, fake data, and placeholder pages

Before completion, perform a full system audit:

- Confirm every page works
- Confirm every route works
- Confirm every form saves correctly
- Confirm every role sees only allowed pages
- Confirm all financial calculations balance
- Confirm reports match journal data
- Confirm all dashboards use real data
- Confirm mobile responsiveness
- Confirm no console errors
- Confirm no Laravel errors
- Confirm no missing migrations
- Confirm no broken assets
- Confirm no hard-coded localhost URLs
- Confirm the system can run under localhost, domain, or subdomain

Deliver the completed Laravel project with clean code, database migrations, seeders, documentation, setup instructions, and production deployment guidance.
```
