Introduce a comprehensive set of commercial features including a multi-step order approval workflow, customer credit management, and specialized import service invoicing. Key changes: - Implement `pending_approval` and `approved` shipment statuses to allow staff verification before customer payment. - Add a credit system to `User` model with `credit_limit` and `credit_used` to manage customer balances and debts. - Develop a new `importInvoice` PDF generation service following the "Sheet ENG Invoice" specification for import services. - Add Filament resources for managing Audit Logs, Commitment Forms, Customer Credits, and Shipment Checklists. - Implement staff-specific APIs for order approval/rejection and customer financial status monitoring. - Integrate Kavenegar SMS service for mobile verification and notifications. - Add bulk tracking import functionality via CSV/Excel. - Update WordPress bridge assets (CSS/JS) to support the new multi-step order form UI and updated redirection logic. - Update deployment configurations and documentation to reflect new production domains and feature sets.
67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\CommitmentForm;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class CommitmentFormController extends Controller
|
|
{
|
|
/**
|
|
* دریافت لیست فایلهای تعهدنامه فعال
|
|
* GET /api/v1/commitment-forms
|
|
*/
|
|
public function index(): JsonResponse
|
|
{
|
|
$forms = CommitmentForm::query()
|
|
->where('is_active', true)
|
|
->orderBy('sort_order')
|
|
->orderBy('created_at', 'desc')
|
|
->get()
|
|
->map(fn ($form) => [
|
|
'id' => $form->id,
|
|
'title' => $form->title,
|
|
'description' => $form->description,
|
|
'file_url' => $form->file_url,
|
|
'file_type' => strtoupper(pathinfo($form->file_path, PATHINFO_EXTENSION)),
|
|
'direction' => $form->direction,
|
|
]);
|
|
|
|
return response()->json([
|
|
'success' => true,
|
|
'data' => $forms,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* دریافت تعهدنامهها بر اساس جهت ارسال
|
|
* GET /api/v1/commitment-forms/{direction}
|
|
*/
|
|
public function byDirection(string $direction): JsonResponse
|
|
{
|
|
$forms = CommitmentForm::query()
|
|
->where('is_active', true)
|
|
->where(function ($query) use ($direction) {
|
|
$query->where('direction', 'both')
|
|
->orWhere('direction', $direction);
|
|
})
|
|
->orderBy('sort_order')
|
|
->orderBy('created_at', 'desc')
|
|
->get()
|
|
->map(fn ($form) => [
|
|
'id' => $form->id,
|
|
'title' => $form->title,
|
|
'description' => $form->description,
|
|
'file_url' => $form->file_url,
|
|
'file_type' => strtoupper(pathinfo($form->file_path, PATHINFO_EXTENSION)),
|
|
'direction' => $form->direction,
|
|
]);
|
|
|
|
return response()->json([
|
|
'success' => true,
|
|
'data' => $forms,
|
|
]);
|
|
}
|
|
}
|