@php $userType = $isSeller ? 'buyer' : 'seller'; $pageType = $isSeller ? 'Sales' : 'Purchases'; $userState = $isSeller ? 'seller_state' : 'buyer_state'; $other_u_state = $userState == 'seller_state' ? 'buyer_state' : 'seller_state'; @endphp @section('title', '- Your ' . $pageType) @extends('layouts.user-profile') @section('breadcumb') @include('layouts.partials.breadcumb', ['page' => $pageType]) @endsection @section('section-body') @if (empty($purchases->items()))

@lang('products.not_found')

@endif {{-- Init orders purchase foreach --}} @foreach ($purchases->items() as $purchase) {{-- Init order purchase --}}
{{-- Order info --}}

Order # {{ $purchase->id }}

@lang("profile.".$userType): {{ $purchase->$userType->first_name . ' ' . $purchase->$userType->last_name }}

@lang("profile.date"): {{ dateFormat($purchase->created_at) }}

{{ $purchase->ebits }} eBits

@if ($purchase->$userState == 'approved' && $purchase->$other_u_state == 'approved') Purchase Complete @elseif($purchase->$userState == 'rejected' || $purchase->$other_u_state == 'rejected') Purchase Canceled @else Pending approve @endif

@lang("profile.status"): {{ ucfirst($purchase->status) }}

@if ($isSeller)

@lang("profile.cal_pur_c"): @if ($purchase->buyer_state != null) {{ ucfirst($purchase->buyer_state) }} @else @lang("profile.msg_cal_b") @endif

@else

@lang("profile.cal_seller"): @if ($purchase->seller_state != null) {{ ucfirst($purchase->seller_state) }} @else Unrated @endif

@endif
{{-- End order info --}} {{-- Products container --}}
{{-- Products foreach --}} @foreach ($purchase->detail as $detail)
{{-- Photo item --}}
{{-- Product info --}}

{{ $detail->product->name }}

@lang('product.description'): {{ $detail->product->description }}

@lang('product.qty'): {{ $detail->qty }}

@lang('product.price'): {{ $detail->product->price }} eBits

@lang('product.fee'): {{ $detail->fee }} eBits

@if ($isSeller)

@lang('product.stock'): {{ $detail->product->stock }}

@endif
{{-- End more product info --}}
@endforeach {{-- End product foreach --}}
{{-- End products container --}} {{-- Approve container --}}
{{-- Approve section --}} @if ($purchase->$userState == null && $purchase->status == 'pending') {{-- Options approved --}}

Do you approve the {{ $isSeller ? 'purchase' : 'sale' }}? (to {{ $isSeller ? 'receive the funds' : 'continue the purchase' }} you must approve.)

{{-- End options approve --}} @else @if ($purchase->$userState != $purchase->$other_u_state && ($purchase->$userState = !null && $purchase->status == 'pending')) @endif {{-- Options approved --}} {{-- End options approve --}} @endif

{{-- End approve container --}}

@endforeach {{-- End orders purchase foreach --}} {{-- Pagination --}}
{{ $purchases->render() }}
{{-- End pagination --}} @endsection @section('aditional-aside')
@lang('profile.definitions')
(Approve) By approving a {{ $isSeller ? 'sale' : 'purchase' }} you confirm that the {{ $isSeller ? 'buyer' : 'seller' }} has performed all the processes correctly.
(Cancel) By cancels a {{ $isSeller ? 'sale' : 'purchase' }}, the inventory and previous state of the product is reversed inlcuded the ebits.
@endsection @push('js') @endpush