@php $title = request()->routeIs('dashboard') ? 'Dashboard' : 'Katalog Iklan'; $navMenus = \App\Support\PortalNavigation::menus(); $activeNav = 'dashboard'; @endphp @extends('layouts.portal') @push('styles') @endpush @section('content') @php $campaignTotalLabel = $campaignTotal === null ? '-' : (string) $campaignTotal; $campaignSmsLabel = $campaignSmsTotal === null ? '-' : (string) $campaignSmsTotal; $campaignWaLabel = $campaignWaTotal === null ? '-' : (string) $campaignWaTotal; $clientId = (string) session()->get('myads.merchant_id', ''); $clientLabel = $clientId !== '' ? 'Client ID: ' . $clientId : null; @endphp @include('partials.membership-offer') @php // The Status Membership card is shown only to merchants with a membership (offer, active or expired). $hasMembership = is_array($memberQuota ?? null); @endphp

Selamat Datang,

{{ session('myads.user.name', 'User') }}

@if ($clientLabel)

{{ $clientLabel }}

@endif
@php // Status Membership: Member (active) or Non-Member; the quota list opens in a modal. $quotaActive = is_array($memberQuota ?? null) && (bool) data_get($memberQuota, 'active', false); $quotaExpires = null; if ($hasMembership && data_get($memberQuota, 'expires_at')) { // null until the merchant joins. try { $quotaExpires = \Illuminate\Support\Carbon::parse((string) data_get($memberQuota, 'expires_at'), 'UTC')->timezone('Asia/Jakarta')->format('d/m/Y H:i').' WIB'; } catch (\Throwable) { $quotaExpires = null; } } $quotaRows = []; if ($quotaActive) { foreach (['sms' => 'SMS', 'mms' => 'MMS', 'waba' => 'WA Business'] as $quotaChannel => $quotaChannelLabel) { foreach (['broadcast' => 'Broadcast', 'targeted' => 'Targeted', 'lba' => 'LBA'] as $quotaKind => $quotaKindLabel) { $quotaService = $quotaChannel.'_'.$quotaKind; // null limit = unlimited; 0 = no quota for this service (not listed). $quotaLimit = data_get($memberQuota, $quotaService.'_limit', 0); if ($quotaLimit === null || (int) $quotaLimit > 0) { $quotaRows[] = ['label' => $quotaChannelLabel.' '.$quotaKindLabel, 'limit' => $quotaLimit === null ? null : (int) $quotaLimit, 'used' => (int) data_get($memberQuota, 'used.'.$quotaService, 0), 'remaining' => (int) data_get($memberQuota, 'remaining.'.$quotaService, 0)]; } } } } @endphp @if ($hasMembership)

Status Membership

@if ($quotaActive) Member @else Non-Member @endif

@if ($quotaExpires)

{{ $quotaActive ? 'Berlaku s/d '.$quotaExpires : 'Berakhir '.$quotaExpires }}

@endif
@if ($quotaActive)
@endif
@endif @unless (config('myads.membership_only')) @endunless
@if ($quotaActive)

Kuota Membership

@if ($quotaExpires)

Berlaku s/d {{ $quotaExpires }}

@endif
@if ($quotaRows === [])

Belum ada kuota layanan. Hubungi Admin.

@else @endif

@if (config('myads.membership_only'))Satu penerima memakai satu kuota. Pastikan sisa kuota cukup sebelum mengirim iklan.@else Iklan yang jumlah penerimanya muat di sisa kuota tidak memotong Saldo Utama.@endif

@endif

Ringkasan Dashboard

{{ $campaignTotalLabel }}

Total iklan

{{ $campaignSmsLabel }}

Iklan kanal SMS

{{ $campaignWaLabel }}

Iklan kanal WA Business

@php // GET /api/packages: the merchant's pakets (cards) and pending QRIS orders (popups); null when unavailable. $paketCards = collect(data_get($paketData ?? [], 'pakets', []))->filter(fn ($paket) => is_array($paket) && isset($paket['id']))->values(); $paketOrders = collect(data_get($paketData ?? [], 'orders', []))->filter(fn ($order) => is_array($order) && ! empty($order['id']))->values(); $hasPaketOffer = $paketCards->contains(fn ($paket) => ! is_array($paket['active'] ?? null) && ! is_array($paket['order'] ?? null) && empty($paket['blocked'])); $openOrderId = (string) session('paket_order', ''); $orderDeadline = function ($value): string { try { return \Illuminate\Support\Carbon::parse($value, 'UTC')->setTimezone('Asia/Jakarta')->translatedFormat('d M Y, H.i').' WIB'; } catch (\Throwable) { return (string) $value; } }; @endphp @if ($paketCards->isNotEmpty() || session('paket_bought') || $errors->has('package'))

Paket Iklan

@if (session('paket_bought'))

{{ session('paket_bought') }}

@endif @error('package')@enderror
@foreach ($paketCards as $paketCard) @include('partials.paket-card', ['paket' => $paketCard]) @endforeach
@endif @if ($hasPaketOffer) {{-- Paket confirm modal: filled from the clicked card's data-* by the script below. --}}

Beli Paket

Dibayar dengan QRIS

Iklan layanan dalam paket ini memakai kuotanya (setelah kuota membership). Satu penerima memakai satu kuota. Paket aktif setelah pembayaran QRIS selesai; paket dengan layanan yang sama bisa dibeli lagi setelah kuotanya habis atau berakhir.

Total bayar
@csrf
@endif @foreach ($paketOrders as $paketOrder) {{-- QRIS of a pending paket order. DUMMY for now: Complete and Cancelled stand in for the payment provider. --}}

Bayar {{ $paketOrder['name'] }}

Pindai QRIS untuk membayar · Pesanan {{ strtoupper(substr($paketOrder['id'], 0, 8)) }}

QRIS percobaan (dummy): Gunakan tombol Complete atau Cancelled di bawah.

Total bayar
Rp {{ number_format((float) $paketOrder['price'], 0, ',', '.') }}
Kuota
{{ \App\Support\PackageServices::quotas($paketOrder['items'] ?? []) }}
Masa berlaku
{{ \App\Support\PackageServices::duration($paketOrder['duration_days'] ?? null) }}
Bayar sebelum
{{ $orderDeadline($paketOrder['expires_at'] ?? null) }}

Status: Menunggu pembayaran

@csrf
@csrf
@endforeach @endsection @push('styles') @endpush @push('scripts') {{-- Paket scripts only when a paket modal is on the page. --}} @if (($paketOrders ?? collect())->isNotEmpty()) @endif @if (($hasPaketOffer ?? false) || ($paketOrders ?? collect())->isNotEmpty()) @endif @endpush