Order Form
The platform admin order form feature allows operators to create, store, and export a formal sales order form for each organization's subscription.
Overview
- Platform admins create/edit order forms in the platform console under each organization
- Forms capture customer/provider details, plan info, fees, limits, and signatory data
- Documents (signed contracts, receipts) can be attached
- PDF generation exports the form as an A4 document (Arabic RTL, Bahij Nassim font)
API Endpoints
All endpoints require platform.admin middleware.
Get order form
GET /api/platform/organizations/{organizationId}/order-form
Returns { data: { order_form, documents, subscription_context, from_subscription } }. Creates a blank form payload if none exists.
Save order form
PUT /api/platform/organizations/{organizationId}/order-form
Content-Type: application/json
{
"status": "draft",
"customer_organization_name": "Acme Corp",
"license_fee": 5000,
"maintenance_fee": 1000,
...
}
Creates or updates the order form for the organization. All fields are optional (sometimes validation).
Download PDF
GET /api/platform/organizations/{organizationId}/order-form/pdf
POST /api/platform/organizations/{organizationId}/order-form/pdf
Streams a PDF download using the barryvdh/laravel-dompdf package.
Requirements:
composer require barryvdh/laravel-dompdfmust be run (already incomposer.json)- Optionally place
Bahij Nassim-Regular.ttfandBahij Nassim-Bold.ttfinpublic/fonts/for proper Arabic rendering. If not present, falls back toDejaVu Sans.
Upload document
POST /api/platform/organizations/{organizationId}/order-form/documents
Content-Type: multipart/form-data
file=<file>
category=signed_order_form|contract|signed_contract|order_form_template|payment_receipt|supporting_document|identity_document|other
title=<optional>
notes=<optional>
Max 20 MB. Allowed types: pdf, jpg, jpeg, png, gif, webp, doc, docx, xls, xlsx.
Download document
GET /api/platform/organizations/{organizationId}/order-form/documents/{documentId}/download
Delete document
DELETE /api/platform/organizations/{organizationId}/order-form/documents/{documentId}
PDF Template
The Blade template at backend/resources/views/platform/organization-order-form-pdf.blade.php renders in Arabic/Pashto (RTL). Sections:
- Party details (customer + provider)
- Plan, fees, and discount
- Limits, timeline, and implementation
- Special requirements and terms
- Signatures
- Document attachments
Order Form Statuses
| Status | Meaning |
|---|---|
draft | Being prepared |
pending_review | Sent for customer review |
approved | Customer approved |
signed | Fully executed |
cancelled | Cancelled |
Database
Table: organization_order_forms
Documents table: order_form_documents
Both tables have organization_id (FK → organizations) and soft-delete support.
Setup Notes
- After running
composer install, dompdf is available automatically. - For Arabic/Pashto fonts: download Bahij Nassim from GitHub and place in
backend/public/fonts/. - Without the font files, text renders in DejaVu Sans (Latin only — Arabic characters may not display correctly).