@extends('frontend.layouts.app')
@section('content')
@php
    $breadCrump2 = 'Subscription Detail';
    use Carbon\Carbon; // Import Carbon once
    $transaction = $transactionDetail->plan_detail? json_decode($transactionDetail->plan_detail):"";
@endphp


<!--Job alerts start -->
<div class="wrapper-inner">
    <div class="container">
      <div class="profile-dash">
        @include('frontend.jobSeeker.sidebar')
        <div class="profile-dash-rt">
          <div class="my-profile-inner">
            <div class="headingBlock d-flex align-items-center justify-content-between">
                <h4>My Subscription Detail</h4>

            </div>

            <div class="row">
              <div class="col-md-4">
                <div class="form-group">
                  <label>Name</label>
                  <div class="form-group-input">
                    <strong>{{$transaction->name}}</strong>
                  </div>
                </div>
              </div>

              <div class="col-md-4">
                <div class="form-group">
                  <label>Credit</label>
                  <div class="form-group-input">
                    <strong>{{$transaction->credit}}</strong>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label>Expiry</label>
                  <div class="form-group-input">
                    <strong>{{ucfirst($transaction->expiry)}}</strong>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label>Description</label>
                  <div class="form-group-input">
                    <strong> {{$transaction->description}}</strong>
                  </div>
                </div>
              </div>

              <div class="col-md-4">
                <div class="form-group">
                  <label>Start Date</label>
                  <div class="form-group-input">
                    <strong> {{ \Carbon\Carbon::parse($transactionDetail->start_date)->format(config('GET.front_date_format')) }}</strong>
                  </div>
                </div>
              </div>

              <div class="col-md-4">
                <div class="form-group">
                  <label>End Date</label>
                  <div class="form-group-input">
                    <strong> {{ \Carbon\Carbon::parse($transactionDetail->end_date)->format(config('GET.front_date_format')) }}</strong>
                  </div>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label>Amount</label>
                  <div class="form-group-input">
                    <strong> ${{$transactionDetail->amount}}</strong>
                  </div>
                </div>
              </div>

              @php
              $createdAt = $transactionDetail->created_at;
              // Format the created_at date using Carbon
              $formattedDate = $createdAt
                  ? \Carbon\Carbon::parse($createdAt)->format(config('GET.front_date_format', 'd-m-Y'))
                  : 'N/A';

             @endphp

              <div class="col-md-4">
                <div class="form-group">
                  <label>Purchased At</label>
                  <div class="form-group-input">
                    <strong> {{$formattedDate}}</strong>
                  </div>
                </div>
              </div>

          </div>
          </div>
        </div>
      </div>
    </div>
  </div>
<!-- Job alerts start -->
<!-- Job alerts start -->
  <!-- Job alerts start -->
@endsection
