ifnex/01_Documents/IFNEX_File_Map.md
Kazem Alghasi e032fceb34 docs(docs): update project documentation for phase 3.6 progress
Update all project documentation including README, Roadmap, Status,
and Agent guides to reflect the transition to Phase 3.6 (Client Meeting
Adjustments).

Key documentation updates:
- Documented the new order approval flow (pending_approval -> approved).
- Added details for shipment commitment forms and document download system.
- Included Kavenegar SMS integration and Audit Log implementation.
- Updated API endpoint references for new verification and commitment routes.
- Reflected increased project metrics (migrations, models, and API endpoints).
- Updated deployment notes regarding SMS configuration.
2026-09-11 21:53:05 +03:30

273 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# نقشه فایل‌های پروژه IFNEX
> **آخرین بروزرسانی:** 2026-09-10
> **وضعیت کلی:** فاز ۰، ۱، ۲، ۳، ۳.۵ تکمیل ✅ — فاز ۳.۶ در حال تکمیل (۸۰%) 🟡
---
## ۱. Migrations (۴۰ فایل)
| # | فایل | فاز |
|---|------|-----|
| 1 | `0001_01_01_000000_create_users_table.php` | ۰ |
| 2 | `0001_01_01_000001_create_cache_table.php` | ۰ |
| 3 | `0001_01_01_000002_create_jobs_table.php` | ۰ |
| 4 | `2026_08_02_000001_create_countries_table.php` | ۰ |
| 5 | `2026_08_02_000002_create_shipments_table.php` | ۰ |
| 6 | `2026_08_02_000003_create_shipping_rates_table.php` | ۰ |
| 7 | `2026_08_02_000004_create_shipment_carrier_mappings_table.php` | ۰ |
| 8 | `2026_08_02_000005_create_shipment_tracking_events_table.php` | ۰ |
| 9 | `2026_08_02_000006_create_system_settings_table.php` | ۰ |
| 10 | `2026_08_02_000007_update_users_table.php` | ۰ |
| 11 | `2026_08_05_135016_create_wallets_table.php` | ۲ |
| 12 | `2026_08_05_135022_create_wallet_transactions_table.php` | ۲ |
| 13 | `2026_08_05_135026_create_discount_codes_table.php` | ۲ |
| 14 | `2026_08_05_140000_create_payments_table.php` | ۲ |
| 15 | `2026_08_07_000001_create_wallet_activity_logs_table.php` | ۲ |
| 16 | `2026_08_07_033748_create_personal_access_tokens_table.php` | ۰ (Sanctum) |
| 17 | `2026_08_08_000001_create_shipment_items_table.php` | ۰ |
| 18 | `2026_08_08_000001_fix_discount_codes_type_enum.php` | ۲ |
| 19 | `2026_08_09_012526_create_notifications_table.php` | ۲ |
| 20 | `2026_08_09_220409_create_permission_tables.php` | ۲ (spatie) |
| 21 | `2026_08_09_231738_create_exchange_rate_history_table.php` | ۲ |
| 22 | `2026_08_10_020410_update_shipments_status_enum.php` | ۰ |
| 23 | `2026_08_10_080853_add_wallet_to_payment_gateway_enum.php` | ۲ |
| 24 | `2026_08_10_082121_add_system_to_tracking_source_enum.php` | ۲ |
| 25 | `2026_08_24_000001_add_missing_fields_to_shipments_table.php` | ۳ |
| 26 | `2026_08_24_100001_create_currencies_table.php` | ۲ |
| 27 | `2026_08_24_200001_create_shipment_packages_table.php` | ۳.۵ |
| 28 | `2026_08_24_300001_create_shipment_status_histories_table.php` | ۲ |
| 29 | `2026_08_28_233839_add_calling_code_to_countries_table.php` | ۳ |
| 30 | `2026_08_29_021506_fix_shipment_items_table.php` | ۳.۵ |
| 31 | `2026_08_29_021631_make_name_nullable_in_shipment_items.php` | ۳.۵ |
| 32 | `2026_09_03_000001_add_approval_statuses_to_shipments_table.php` | ۳.۶ (فلوی تأیید) |
| 33 | `2026_09_03_000002_create_commitment_forms_table.php` | ۳.۶ (تعهدنامه) |
| 34 | `2026_09_03_000003_add_credit_fields_to_users_table.php` | ۳.۶ (اعتبار) |
| 35 | `2026_09_03_000004_create_shipment_checklists_table.php` | ۳.۶ (چک‌لیست) |
| 36 | `2026_09_03_000005_create_audit_logs_table.php` | ۳.۶ (Audit Log) |
| 37 | `2026_09_03_000006_add_import_invoice_fields_to_shipments_table.php` | ۳.۶ (فاکتور واردات) |
| 38 | `2026_09_09_000001_create_shipment_commitment_forms_table.php` | ۳.۶ (تعهدنامه امضاشده) |
| 39 | `2026_09_09_000002_create_shipment_status_history_table.php` | ۳.۶ |
| 40 | `2026_09_09_000003_add_reason_to_shipment_status_history_table.php` | ۳.۶ |
---
## ۲. Models (۲۲ مدل)
| # | فایل | توضیح |
|---|------|-------|
| 1 | `Country.php` | ۲۳۳ کشور + ۴ زون + calling_code |
| 2 | `Shipment.php` | مدل مرکزی مرسوله (casts enum + روابط کامل) |
| 3 | `ShipmentCarrierMapping.php` | نگاشت شرکت‌های حمل |
| 4 | `ShipmentTrackingEvent.php` | رویدادهای ترکینگ |
| 5 | `ShipmentItem.php` | اقلام گمرکی فاکتور |
| 6 | `ShipmentPackage.php` | بسته‌های چندگانه + محاسبه وزن حجمی |
| 7 | `ShipmentStatusHistory.php` | تاریخچه تغییر وضعیت (from/to/reason) |
| 8 | `ShippingRate.php` | تعرفه‌ها (zone_1..zone_10) |
| 9 | `SystemSetting.php` | تنظیمات key-value |
| 10 | `User.php` | کاربران + اعتبار (credit_limit/credit_used) |
| 11 | `Currency.php` | ارزها |
| 12 | `Wallet.php` | کیف پول |
| 13 | `WalletTransaction.php` | تراکنش‌ها (polymorphic) |
| 14 | `WalletActivityLog.php` | لاگ فعالیت کیف پول |
| 15 | `DiscountCode.php` | کدهای تخفیف |
| 16 | `Payment.php` | پرداخت‌های درگاه |
| 17 | `ExchangeRateHistory.php` | تاریخچه نرخ ارز |
| 18 | `Role.php` | نقش‌ها (spatie) |
| 19 | `CommitmentForm.php` | فرم‌های تعهدنامه پایه |
| 20 | `ShipmentCommitmentForm.php` | تعهدنامه امضاشده هر سفارش |
| 21 | `ShipmentChecklist.php` | چک‌لیست کارمند |
| 22 | `AuditLog.php` | لاگ تغییرات (polymorphic) |
---
## ۳. Enums (۹ فایل)
| # | فایل | مقادیر |
|---|------|--------|
| 1 | `ShipmentStatus.php` | pending_approval, approved, pending_payment, cancelled, processed, picked_up, in_transit, out_for_delivery, failed, delivered, returned, archived |
| 2 | `ShipmentDirection.php` | import, export |
| 3 | `ShipmentType.php` | DOC_NORMAL, DOC_ECONOMY, PARCEL |
| 4 | `CarrierCode.php` | DHL, FEDEX, UPS, ARAMEX, NAGHEL, EMX, APSITEX, IMPEX, OTHER |
| 5 | `PaymentGateway.php` | zarinpal, wallet, manual, system |
| 6 | `TransactionType.php` | deposit, withdrawal, order_payment, refund |
| 7 | `TransactionStatus.php` | pending, completed, failed, refunded |
| 8 | `TrackingSource.php` | manual, api, import, system, customer |
| 9 | `UserRole.php` | super_admin, tracking_operator, data_entry, customer |
---
## ۴. Controllers
### app/Http/Controllers/Api (۱۲ کنترلر)
| # | فایل | توضیح |
|---|------|-------|
| 1 | `TrackController.php` | رهگیری عمومی (API Key) |
| 2 | `PricingController.php` | محاسبه قیمت |
| 3 | `AuthController.php` | ورود/خروج Sanctum |
| 4 | `BridgeAuthController.php` | Bridge Auth وردپرس |
| 5 | `Customer/CustomerOrderController.php` | سفارشات مشتری (۶۷۲ خط — بزرگ‌ترین فایل اپ) |
| 6 | `WalletController.php` | کیف پول + ادمین |
| 7 | `PaymentController.php` | درگاه + callback (فلوی تأیید سفارش) |
| 8 | `DiscountCodeController.php` | کدهای تخفیف |
| 9 | `MockGatewayController.php` | درگاه شبیه‌سازی |
| 10 | `StaffOrderController.php` | تأیید/رد سفارشات کارمند |
| 11 | `CustomerFinancialController.php` | وضعیت مالی مشتری (بدهی به تفکیک ارز) |
| 12 | `CommitmentFormController.php` | تعهدنامه‌ها + آپلود امضاشده |
| 13 | `MobileVerificationController.php` | تأیید موبایل (کد SMS) |
### app/Http/Controllers (وب)
| # | فایل | توضیح |
|---|------|-------|
| 1 | `ShipmentPdfController.php` | AWB / Invoice / Label / Import-Invoice |
| 2 | `OrderController.php` | فلوی legacy Blade (deprecated) |
| 3 | `PricingPageController.php` | صفحه استعلام قیمت |
---
## ۵. Services (۸ سرویس)
| # | فایل | توضیح |
|---|------|-------|
| 1 | `PriceCalculatorService.php` | موتور قیمت‌گذاری (۴ زون + VAT + تخفیف) |
| 2 | `PdfService.php` | تولید PDF با بارکد base64 |
| 3 | `TrackingService.php` | تایم‌لاین و رویدادهای رهگیری |
| 4 | `OrderPaymentService.php` | پرداخت سفارش (کیف پول + درگاه) |
| 5 | `WalletService.php` | شارژ/برداشت/تسویه کیف پول |
| 6 | `ZarinpalService.php` | درگاه واقعی زرین‌پال |
| 7 | `MockZarinpalService.php` | درگاه شبیه‌سازی تست |
| 8 | `ExchangeRateService.php` | نرخ ارز + تاریخچه |
| 9 | `KavenegarSmsService.php` | سرویس پیامک کاوه‌نگار |
---
## ۶. Notifications / Observers / Traits
| # | فایل | توضیح |
|---|------|-------|
| 1 | `Notifications/ShipmentUpdatedNotification.php` | نوتیفیکیشن دیتابیسی تغییر سفارش |
| 2 | `Notifications/ShipmentApprovedSms.php` | SMS تأیید سفارش |
| 3 | `Notifications/ShipmentRejectedSms.php` | SMS رد سفارش |
| 4 | `Notifications/PaymentSuccessSms.php` | SMS پرداخت موفق |
| 5 | `Notifications/TrackingUpdatedSms.php` | SMS بروزرسانی ترکینگ |
| 6 | `Notifications/Channels/SmsChannel.php` | کانال ارسال SMS |
| 7 | `Observers/ShipmentObserver.php` | تریگر خودکار نوتیفیکیشن/SMS روی تغییر وضعیت |
| 8 | `Traits/Auditable.php` | لاگ خودکار تغییرات مدل‌ها |
---
## ۷. Filament (پنل ادمین `/panel`)
### Resources (۱۶)
| # | Resource | توضیح |
|---|----------|-------|
| 1 | ShipmentResource | مرسوله‌ها + اکشن تأیید/رد + RelationManagers |
| 2 | ShipmentItemResource | اقلام گمرکی |
| 3 | ShipmentChecklistResource | چک‌لیست کارمند |
| 4 | CommitmentFormResource | تعهدنامه‌ها (آپلود مدیر) |
| 5 | CustomerCreditResource | اعتبار مشتریان |
| 6 | AuditLogResource | لاگ تغییرات |
| 7 | CountryResource | کشورها |
| 8 | CurrencyResource | ارزها |
| 9 | ShippingRateResource | تعرفه‌ها |
| 10 | UserResource | کاربران |
| 11 | RoleResource | نقش‌ها |
| 12 | WalletResource | کیف پول‌ها |
| 13 | WalletTransactionResource | تراکنش‌ها |
| 14 | PaymentResource | پرداخت‌ها |
| 15 | DiscountCodeResource | کدهای تخفیف |
| 16 | ExchangeRateHistoryResource | تاریخچه نرخ ارز |
### Pages
| # | فایل | توضیح |
|---|------|-------|
| 1 | `Dashboard.php` | داشبورد |
| 2 | `IfnexSettingsPage.php` | تنظیمات سیستم + کلیدهای SMS |
| 3 | `ImportRatesPage.php` | آپلود اکسل نرخ‌ها |
| 4 | `PriceTestPage.php` | تست قیمت‌گذاری (⚠️ خراب — در لیست رفع) |
| 5 | `BulkTrackingImport.php` | ایمپورت گروهی وضعیت ترکینگ (CSV) |
| 6 | `Reports/FinancialReport.php` | گزارش مالی |
### Widgets (۵)
DashboardInfoWidget، ExchangeRateWidget، FinanceOverviewWidget، WalletStats، RecentTransactionsWidget، TransactionChartWidget
### RelationManagers (Shipment)
CarrierMappingsRelationManager، TrackingEventsRelationManager
---
## ۸. سایر اجزای لاراول
| # | فایل | توضیح |
|---|------|-------|
| 1 | `Imports/OldShipmentsImport.php` | ایمپورت مرسولات تاریخی |
| 2 | `Imports/ShippingRatesImport.php` | ایمپورت نرخ‌ها (۵ شیت) |
| 3 | `Exports/ShippingRatesTemplateExport.php` | قالب اکسل نرخ‌ها |
| 4 | `Http/Middleware/ApiKeyMiddleware.php` | احراز API Key |
| 5 | `Console/Commands` | ifnex:import:rates, ifnex:import:shipments, ifnex:import:tracking, ifnex:sync-wp-users, ifnex:update-rates, ifnex:token (+ ifnex:debug:import) |
| 6 | `config/ifnex.php` + `config/cors.php` | تنظیمات اختصاصی |
| 7 | `views/pdfs/awb.blade.php` | بارنامه با بارکد |
| 8 | `views/pdfs/invoice.blade.php` | فاکتور (PARCEL) |
| 9 | `views/pdfs/label.blade.php` | لیبل A5 با بارکد |
| 10 | `views/pdfs/import_invoice.blade.php` | فاکتور واردات (مطابق شیت ENG) |
| 11 | `database/seeders/` | CountriesTableSeeder، SystemSettingSeeder، RoleAndPermissionSeeder، SampleShippingRatesSeeder، SampleDataSeeder، DatabaseSeeder |
---
## ۹. وردپرس — پلاگین IFNEX Bridge
| # | فایل | توضیح |
|---|------|-------|
| 1 | `ifnex-bridge.php` | فایل اصلی + صفحه تنظیمات + enqueue ها |
| 2 | `includes/api-client.php` | کلاینت API ترکینگ |
| 3 | `includes/user-bridge.php` | Bridge Auth + توکن Sanctum + هندلرهای AJAX (کیف پول، سفارش، پرداخت، کشورها) |
| 4 | `includes/shortcodes.php` | ۱۰+ شورت‌کد پورتال مشتری (~۱۴۰۰ خط) |
| 5 | `includes/tracking-form.php` | فرم رهگیری + هندلر AJAX |
| 6 | `assets/css/ifnex-bridge.css` | استایل رهگیری/کیف پول/تراکنش |
| 7 | `assets/css/ifnex-orders.css` | استایل فرم سفارش/داشبورد/پرداخت |
| 8 | `assets/js/ifnex-order-form.js` | فرم ۵ مرحله‌ای (بسته‌ها + اقلام + محاسبه) |
**شورت‌کدها:** `[ifnex_tracking_form]`, `[ifnex_tracking_status]`, `[ifnex_customer_dashboard]`, `[ifnex_orders_list]`, `[ifnex_order_form]`, `[ifnex_order_detail]`, `[ifnex_order_payment]`, `[ifnex_user_profile]`, `[ifnex_wallet_balance]`, `[ifnex_transactions]`
⚠️ `[ifnex_wallet_charge]` هنوز ثبت نشده (صفحه /wallet/ خراب است).
---
## ۱۰. وردپرس — قالب IFNEX
| # | فایل | توضیح |
|---|------|-------|
| 1 | `style.css` | دیزاین‌سیستم کامل (~۵۹KB) |
| 2 | `functions.php` | پشتیبانی‌ها، منوها، Polylang، enqueue |
| 3 | `header.php` / `footer.php` | سربرگ/پابرگ با سوییچ زبان |
| 4 | `front-page.php` | لندینگ اصلی (Hero + خدمات + CTA) |
| 5 | `template-login.php` | صفحه ورود سفارشی |
| 6 | `inc/customizer.php` | تنظیمات قالب (لوگو، متن‌ها FA/EN) |
| 7 | `inc/enqueue.php` | (stub) |
| 8 | `assets/js/main.js` | افکت‌ها + ریدایرکت رهگیری Hero |
| 9 | `template-parts/` | ۶ پارشل (در حال حاضر استفاده نمی‌شوند) |
| 10 | `404.php`, `index.php`, `page.php`, `single.php`, `archive.php` | قالب‌های عمومی |
---
## ۱۱. صفحات وردپرس و شورت‌کدها
| آدرس | شورت‌کد | وضعیت |
|------|---------|--------|
| `/my-account/` | `[ifnex_customer_dashboard]` | ✅ (تب‌ها: dashboard, orders, new-order, wallet, transactions, tracking, profile) |
| `/new-order/` | `[ifnex_order_form]` | ✅ |
| `/my-orders/` | `[ifnex_orders_list]` | ✅ |
| `/order-detail/` | `[ifnex_order_detail]` | ✅ |
| `/order-payment/` | `[ifnex_order_payment]` | ✅ |
| `/tracking/` | `[ifnex_tracking_form]` | ✅ |
| `/wallet/` | `[ifnex_wallet_charge]` | ❌ شورت‌کد ثبت نشده |
> مجموع: **۴۰ migration، ۲۲ مدل، ۹ Enum، ۱۳ کنترلر API، ۹ سرویس، ۱۶ Resource فیلمنت، ۱۰+ شورت‌کد وردپرس**
> 2026 VernaSoft Group. Internal use only.