From 486d54348ffdf954add11102016130807376a227 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Fri, 13 Mar 2026 18:37:17 +0000 Subject: [PATCH] update summery report --- db/migrations/add_welcome_template.php | 26 +++++++++++++--- includes/app.php | 42 +++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/db/migrations/add_welcome_template.php b/db/migrations/add_welcome_template.php index 3cec9df..4d4bf63 100644 --- a/db/migrations/add_welcome_template.php +++ b/db/migrations/add_welcome_template.php @@ -18,10 +18,12 @@ $templates = [ ]; foreach ($templates as $t) { + // Check if exists $stmt = $pdo->prepare("SELECT id FROM notification_templates WHERE event_name = ?"); $stmt->execute([$t['event_name']]); - - if (!$stmt->fetch()) { + $existing = $stmt->fetch(); + + if (!$existing) { $sql = "INSERT INTO notification_templates (event_name, email_subject_en, email_body_en, email_subject_ar, email_body_ar, whatsapp_body_en, whatsapp_body_ar) VALUES (?, ?, ?, ?, ?, ?, ?)"; $pdo->prepare($sql)->execute([ $t['event_name'], @@ -34,7 +36,21 @@ foreach ($templates as $t) { ]); echo "Added template: {$t['event_name']}\n"; } else { - echo "Template already exists: {$t['event_name']}\n"; + // Update existing template to match file content (useful for development) + $sql = "UPDATE notification_templates SET + email_subject_en = ?, email_body_en = ?, + email_subject_ar = ?, email_body_ar = ?, + whatsapp_body_en = ?, whatsapp_body_ar = ? + WHERE event_name = ?"; + $pdo->prepare($sql)->execute([ + $t['email_subject_en'], + $t['email_body_en'], + $t['email_subject_ar'], + $t['email_body_ar'], + $t['whatsapp_body_en'], + $t['whatsapp_body_ar'], + $t['event_name'] + ]); + echo "Updated template: {$t['event_name']}\n"; } -} - +} \ No newline at end of file diff --git a/includes/app.php b/includes/app.php index 27343fc..ca54225 100644 --- a/includes/app.php +++ b/includes/app.php @@ -111,6 +111,26 @@ $translations = [ 'dashboard' => 'Dashboard', 'shipments' => 'Shipments', 'reports' => 'Reports', + 'summary_report' => 'Summary Report', + 'shipments_by_origin_country' => 'Shipments by Origin Country', + 'shipments_by_dest_country' => 'Shipments by Destination Country', + 'shipments_by_origin_city' => 'Shipments by Origin City', + 'shipments_by_dest_city' => 'Shipments by Destination City', + 'shipments_by_shipper' => 'Shipments by Shipper', + 'generated' => 'Generated', + 'report_type' => 'Report Type', + 'period' => 'Period', + 'analyze_performance' => 'Analyze platform performance and metrics.', + 'print' => 'Print', + 'start_date' => 'Start Date', + 'end_date' => 'End Date', + 'apply_filter' => 'Apply Filter', + 'no_paid_shipments' => 'No paid shipments found for this period.', + 'name' => 'Name', + 'total_amount' => 'Total Amount', + 'profit' => 'Profit', + 'total_label' => 'Total', + 'printed_by' => 'Printed By', 'analytics' => 'Analytics', 'shipper_shipments' => 'Shipper Shipments', 'truck_owners_statements' => 'Truck Owners Statements', @@ -334,6 +354,26 @@ $translations = [ 'dashboard' => 'لوحة القيادة', 'shipments' => 'الشحنات', 'reports' => 'التقارير', + 'summary_report' => 'تقرير ملخص', + 'shipments_by_origin_country' => 'الشحنات حسب بلد المنشأ', + 'shipments_by_dest_country' => 'الشحنات حسب بلد الوجهة', + 'shipments_by_origin_city' => 'الشحنات حسب مدينة المنشأ', + 'shipments_by_dest_city' => 'الشحنات حسب مدينة الوجهة', + 'shipments_by_shipper' => 'الشحنات حسب الشاحن', + 'generated' => 'تم الإنشاء', + 'report_type' => 'نوع التقرير', + 'period' => 'الفترة', + 'analyze_performance' => 'تحليل أداء المنصة والمقاييس.', + 'print' => 'طباعة', + 'start_date' => 'تاريخ البدء', + 'end_date' => 'تاريخ الانتهاء', + 'apply_filter' => 'تطبيق الفلتر', + 'no_paid_shipments' => 'لم يتم العثور على شحنات مدفوعة لهذه الفترة.', + 'name' => 'الاسم', + 'total_amount' => 'المبلغ الإجمالي', + 'profit' => 'الربح', + 'total_label' => 'المجموع', + 'printed_by' => 'طبع بواسطة', 'analytics' => 'التحليلات', 'shipper_shipments' => 'شحنات الشاحنين', 'truck_owners_statements' => 'كشوف حساب أصحاب الشاحنات', @@ -671,4 +711,4 @@ function has_permission(string $permissionSlug, ?int $userId = null): bool function format_currency(float $amount): string { return number_format($amount, 3) . ' OMR'; -} +} \ No newline at end of file