update summery report
This commit is contained in:
parent
aebf7d0667
commit
486d54348f
@ -18,10 +18,12 @@ $templates = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ($templates as $t) {
|
foreach ($templates as $t) {
|
||||||
|
// Check if exists
|
||||||
$stmt = $pdo->prepare("SELECT id FROM notification_templates WHERE event_name = ?");
|
$stmt = $pdo->prepare("SELECT id FROM notification_templates WHERE event_name = ?");
|
||||||
$stmt->execute([$t['event_name']]);
|
$stmt->execute([$t['event_name']]);
|
||||||
|
$existing = $stmt->fetch();
|
||||||
if (!$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 (?, ?, ?, ?, ?, ?, ?)";
|
$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([
|
$pdo->prepare($sql)->execute([
|
||||||
$t['event_name'],
|
$t['event_name'],
|
||||||
@ -34,7 +36,21 @@ foreach ($templates as $t) {
|
|||||||
]);
|
]);
|
||||||
echo "Added template: {$t['event_name']}\n";
|
echo "Added template: {$t['event_name']}\n";
|
||||||
} else {
|
} 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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +111,26 @@ $translations = [
|
|||||||
'dashboard' => 'Dashboard',
|
'dashboard' => 'Dashboard',
|
||||||
'shipments' => 'Shipments',
|
'shipments' => 'Shipments',
|
||||||
'reports' => 'Reports',
|
'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',
|
'analytics' => 'Analytics',
|
||||||
'shipper_shipments' => 'Shipper Shipments',
|
'shipper_shipments' => 'Shipper Shipments',
|
||||||
'truck_owners_statements' => 'Truck Owners Statements',
|
'truck_owners_statements' => 'Truck Owners Statements',
|
||||||
@ -334,6 +354,26 @@ $translations = [
|
|||||||
'dashboard' => 'لوحة القيادة',
|
'dashboard' => 'لوحة القيادة',
|
||||||
'shipments' => 'الشحنات',
|
'shipments' => 'الشحنات',
|
||||||
'reports' => 'التقارير',
|
'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' => 'التحليلات',
|
'analytics' => 'التحليلات',
|
||||||
'shipper_shipments' => 'شحنات الشاحنين',
|
'shipper_shipments' => 'شحنات الشاحنين',
|
||||||
'truck_owners_statements' => 'كشوف حساب أصحاب الشاحنات',
|
'truck_owners_statements' => 'كشوف حساب أصحاب الشاحنات',
|
||||||
@ -671,4 +711,4 @@ function has_permission(string $permissionSlug, ?int $userId = null): bool
|
|||||||
function format_currency(float $amount): string
|
function format_currency(float $amount): string
|
||||||
{
|
{
|
||||||
return number_format($amount, 3) . ' OMR';
|
return number_format($amount, 3) . ' OMR';
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user