@php
$pendingUpiMemb = null;
try {
$lsUid = Auth::guard('web')->id() ?? Auth::id() ?? session('user_id');
if ($lsUid && class_exists('\App\Models\Membership')) {
$hasActiveApproved = \App\Models\Membership::where('user_id', $lsUid)
->where('status', 1)
->where('expire_date', '>=', \Carbon\Carbon::now()->toDateString())
->exists();
$pendingUpiMemb = \App\Models\Membership::where('user_id', $lsUid)
->where(function($q) {
$q->where('status', 0)->orWhere('status', '0')->orWhere('status', 'pending');
})
->whereNotNull('transaction_id')
->where('transaction_id', '!=', '')
->latest('id')
->first();
if ($pendingUpiMemb && $hasActiveApproved) {
$latestActiveMemb = \App\Models\Membership::where('user_id', $lsUid)
->where('status', 1)
->latest('id')
->first();
if ($latestActiveMemb && $latestActiveMemb->id >= $pendingUpiMemb->id) {
$pendingUpiMemb = null; // Approved package is active, hide pending notice!
}
}
}
} catch (\Throwable $e) {}
$lsDaysLeft = null;
$lsIsExpiringSoon = false;
$lsIsExpired = false;
$lsIsLocked = false;
$lsExpiryNotice = "";
try {
$lsLatestMemb = null;
if ($lsUid && class_exists('\App\Models\Membership')) {
$hasActive = \App\Models\Membership::where('user_id', $lsUid)
->where('status', 1)
->where('start_date', '<=', \Carbon\Carbon::now()->format('Y-m-d'))
->where('expire_date', '>=', \Carbon\Carbon::now()->toDateTimeString())
->exists();
if (!$hasActive) {
$lsLatestMemb = \App\Models\Membership::where('user_id', $lsUid)
->where('status', '<>', 2)
->orderBy('expire_date', 'desc')
->first();
} else {
$lsLatestMemb = \App\Models\Membership::where('user_id', $lsUid)
->where('status', 1)
->orderBy('expire_date', 'desc')
->first();
}
}
if (!empty($lsLatestMemb) && !empty($lsLatestMemb->expire_date) && strpos($lsLatestMemb->expire_date, '9999') === false) {
$expDate = \Carbon\Carbon::parse($lsLatestMemb->expire_date);
$now = \Carbon\Carbon::now();
$diffSeconds = $now->diffInSeconds($expDate, false);
$warnDays = 7;
try {
$bs = \App\Models\BasicSetting::first();
if ($bs && !empty($bs->recurring_warning_first_days)) {
$warnDays = (int)$bs->recurring_warning_first_days;
}
} catch (\Throwable $te) {}
if ($diffSeconds <= 0) {
$lsIsExpired = true;
if ($diffSeconds < -120) {
$lsIsLocked = true;
}
$lsExpiryNotice = "Your store package has expired on " . $expDate->format('M d, Y h:i A');
} elseif ($diffSeconds <= ($warnDays * 86400)) {
$lsIsExpiringSoon = true;
if ($diffSeconds < 3600) {
$mins = max(1, (int)ceil($diffSeconds / 60));
$lsExpiryNotice = "Your store package will expire in {$mins} minute(s) on " . $expDate->format('M d, Y h:i A');
} elseif ($diffSeconds < 86400) {
$hrs = (int)ceil($diffSeconds / 3600);
$lsExpiryNotice = "Your store package will expire in {$hrs} hour(s) on " . $expDate->format('M d, Y h:i A');
} else {
$days = (int)ceil($diffSeconds / 86400);
$lsExpiryNotice = "Your store package will expire in {$days} day(s) on " . $expDate->format('M d, Y');
}
}
}
} catch (\Throwable $e) {}
@endphp
@php
$isDemoTheme = false;
try {
$currAuthUser = \Illuminate\Support\Facades\Auth::guard('web')->user();
if ($currAuthUser && !empty($currAuthUser->preview_template)) {
$isDemoTheme = true;
}
} catch (\Throwable $e) {}
@endphp
@if($isDemoTheme)
{{ __('Demo Theme') }}
@endif
@if($pendingUpiMemb && !empty($pendingUpiMemb->transaction_id))
Pending Verification
@endif
@if($lsIsExpired || $lsIsExpiringSoon)
@if($lsIsLocked)
@endif
@endif
@yield('content')
{{ __('This is a Demo Theme') }}
{{ __('You are exploring the demo store in preview mode. Modifications (create, update, delete) are restricted.') }}
Notice: Your UPI payment (UTR:
{{ $pendingUpiMemb->transaction_id }}) is pending for admin verification.Your store features remain active while our admin team reviews your payment reference.