@extends('layout.app', ['title' => 'Promotions']) @push('style') @vite(['resources/css/layout/banner_main.css', 'resources/css/landing.css']) @vite(['resources/css/promotion.css', 'resources/css/curriculum.css']) @endpush @php use App\Enums\CourseType; use App\Enums\PromotionStatus; use App\Enums\PromotionType; use App\Enums\UserRole; use App\Enums\BannerType; use Carbon\Carbon; function getStatusPromotion(int $status): array { return [ 'class' => $status === PromotionStatus::ACTIVE->value ? 'activeDate' : ($status === PromotionStatus::UP_COMING->value ? 'upComingDate' : ''), 'text' => $status === PromotionStatus::ACTIVE->value ? PromotionStatus::ACTIVE->name() : ($status === PromotionStatus::UP_COMING->value ? PromotionStatus::UP_COMING->name() : ''), ]; } function getTitlePromotion($coursePrice, int $promotionType, $newStudentPromotion = null): string { if ( Auth::check() && Auth::user()->role_id == UserRole::USER->value && $newStudentPromotion && $newStudentPromotion->time == $coursePrice->package_time->time ) { $newUser = true; } else { $newUser = false; } $title = ''; if ($promotionType == PromotionType::DISCOUNT->value) { if ($newUser) { $title = 'Tài khoản mới Free các khóa ' . $coursePrice->package_time->time . ' tháng - ' . ($coursePrice->grade ? $coursePrice->grade->name : 'AP'); } else { $title = 'Khuyến mãi ' . $coursePrice->discount . '% Các khóa ' . $coursePrice->package_time->time . ' tháng - ' . ($coursePrice->grade ? $coursePrice->grade->name : 'AP'); } } if ($promotionType == PromotionType::MONTH_GIFT->value) { $title = 'Tặng thêm ' . $coursePrice->month_gift . ' tháng Các khóa ' . $coursePrice->package_time->time . ' tháng - ' . ($coursePrice->grade ? $coursePrice->grade->name : 'AP'); } return $title; } @endphp @section('content')
@include('layout.landing_banner', [ 'title' => 'Chương trình khuyến mãi', 'description' => '', ]) {{-- section course combo --}}
@if (isset($comboDatas))
@if (isset($bannerCombo) && $bannerCombo)
Combo banner
@endif
@foreach ($comboDatas as $comboData)
Giảm {{ $comboData['discount'] }} %
Combo image
{{ $comboData['combo_name'] }}
@foreach ($comboData['courses'] as $course) @if ($course['type_course'] == 1) @else @endif {{-- --}} {{ $course['course_name'] }} @endforeach
{{ number_format($comboData['total_price'], 0, '.', '.') }} Vnd {{ number_format($comboData['price'], 0, '.', '.') }} Vnd
$comboData['combo_id']]) }} class="btn-register-combo fs-14 fw-semibold text-uppercase px-4 py-3"> Đăng ký học
Ngày hết hạn: {{ Carbon::parse($comboData['day_end'])->format('d/m/Y') }}
Đã đăng ký: {{ $comboData['count_register'] }}
{!! $comboData['description'] !!}
Xem thêm
@endforeach
@endif
{{-- end section course combo --}} {{-- section promotion --}}
@foreach ($promotionDatas['coursePrices'] as $coursePrice) @if ($coursePrice->countCourse > 0) @if ( $coursePrice->discount_status === PromotionStatus::ACTIVE->value || $coursePrice->discount_status === PromotionStatus::UP_COMING->value) @endif @if ( $coursePrice->month_gift_status === PromotionStatus::ACTIVE->value || $coursePrice->month_gift_status === PromotionStatus::UP_COMING->value) @endif @endif @endforeach
{{-- end section promotion --}}
@endsection @push('script') @vite(['resources/js/course_combo.js']) @endpush