Anons79 Mini Shell

Directory : /home/aplikasiposinfo/public_html/langganan.fixmate.id/resources/views/Affiliate/
Upload File :
Current File : /home/aplikasiposinfo/public_html/langganan.fixmate.id/resources/views/Affiliate/index.blade.php

@extends('app')

@section('content')
    <div class="page-heading">
        @can('userPOV')
            <h3>Kode Affiliate</h3>
        @endcan
        @can('dashboardAdmin')
            <h3>Affiliates</h3>
        @endcan
    </div>
    <div class="page-content">
        <div style="min-height:100vh">
            @can('dashboardAdmin')
                <div class="row">
                    <div class="col-12 ">
                        <div class="card">
                            <div class="card-header">
                                <div class="row justify-content-between">
                                    <div class="col-md-4">
                                        <h4>Affiliates</h4>
                               
                                    </div>
                                    <div class="col-md-4 text-end">
                                         <a href="{{ route('pembayaran-affiliate.index') }}" class="btn btn-success">Permintaan Transfer <span class="badge rounded-pill text-bg-secondary">{{$jumlahPembayaranPending}}</span></a>
                                    </div>
                                </div>
                            </div>
                            <div class="card-body">
                                <div class="table-responsive">
                                    <table class="table table-hover table-lg">
                                        <thead>
                                            <tr>
                                                <th>Nama</th>
                                                <th>Kode</th>
                                                <th>Penggunaan</th>
                                                <th>Nominal</th>
                                                <th>Jumlah</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @foreach ($affiliate as $data)
                                                <tr>
                                                    <td class="col-3">
                                                        {{ @$data->user->name }}
                                                    </td>
                                                    <td class="col-auto">
                                                        <p class=" mb-0">{{ $data->code }}</p>
                                                    </td>
                                                    <td class="col-auto">
                                                        <p class=" mb-0">{{ $data->used_counter }}x</p>
                                                    </td>
                                                    <td class="col-auto">
                                                        <p class=" mb-0">{{number_format($data->persen)}}%</p>
                                                    </td>
                                                    <td class="col-auto">
                                                        <p class=" mb-0">Rp.{{ number_format(\Helper::getTotalPay($data)  * ($data->persen / 100))}}</p>
                                                    </td>
                                                    <td>
                                                        <div>
                                                            <button class="btn btn-info text-white edit-btn btn-sm btn-open-modal"
                                                            data-toggle="#modalDetail" data-persen="{{ $data->persen }}" data-potongan="{{ $data->potongan }}"  data-kode="{{ $data->code }}" data-affiliate="{{ $data->id }}">
                                                            <i class="bi bi-pencil-square"></i>
                                                            </button>
                                                        </div>
                                                    </td>
                                                </tr>
                                            @endforeach

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            @endcan

        
            <div class="modal fade text-left" id="modalDetail" tabindex="-1" role="dialog"
                    aria-labelledby="myModalLabel17" aria-hidden="true">
                    <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable modal-lg" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h1>Edit nominal kode</h1>
                                <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
                                    <i data-feather="x"></i>
                                </button>
                            </div>
                            <div class="modal-body">
                                <form action="{{ route("affiliate.store") }}" method="post" id="nominalForm">
                                @csrf
                                <input type="hidden" name="tipeForm" value="update">
                                <input type="hidden" name="affiliateId" id="affiliateIdField">
                                
                                @if (auth()->user()->hasRole('admin'))
                                    <label for="nominal">Persen kode</label>
                                    <input type="number" name="persen" id="nominal" class="form-control">
                                    <input type="hidden" name="potongan" id="potongan" class="form-control">
                                    <input type="hidden" name="code" id="kode" class="form-control">
                                @else
                                    <label for="nominal">Kode</label>
                                    <input type="text" name="code" id="kode" class="form-control">
                                    <label for="nominal">Persen Potongan (Maksimal 15%)</label>
                                    <input type="number" name="potongan" id="potongan" class="form-control">
                                    <input type="hidden" name="persen" id="nominal" class="form-control">
                                @endif
                                <button type="button" class="btn btn-success my-2" type="submit" form="nominalForm" onClick="formSubmit()">
                                    <span class="d-none d-sm-block">Simpan</span>
                                </button>
                                </form>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-light-secondary" data-bs-dismiss="modal">
                                    <i class="bx bx-x d-block d-sm-none"></i>
                                    <span class="d-none d-sm-block">Tutup</span>
                                </button>
                            </div>
                        </div>
                    </div>
            </div>
            @can('userPOV')
                <div class="row">
                    <div class="col-md-12">
                        @if (isset($affiliate))
                            <div class="card shadow">
                                    <div class="card-header d-flex justify-content-between align-items-start">
                                        <div>

                                            <h3 class="text-uppercase ">Kode Affiliate Anda</h3>
                                        </div>

                                    </div>
                                    <div class="card-body">
                                            <h2><u><i>{{ $affiliate->code }}</i></u></h2>
                                    </div>
                                    <div class="card-footer d-flex flex-column justify-content-end">
                                        <div class="row">
                                            <div class="col-md-6">
                                                 <h3>Sudah dipakai {{ $affiliate->used_counter }}x</h3>
                                                <h3>Persen Keuntungan {{$affiliate->persen}}%</h3>
                                                <h3>Persen Potongan {{$affiliate->potongan}}%</h3>
                                            </div>
                                            <div class="col-md-6">
                                                 <h3>Total Saldo: Rp.{{number_format( floor($total * ($affiliate->persen/100)) )}}</h3>
                                                <h3>Saldo Dibayarkan: Rp.{{number_format( floor($totalPembayaran) )}}</h3>
                                                <h3>Sisa Saldo: Rp.{{number_format( floor($total * ($affiliate->persen/100)-floor($totalPembayaran)) )}}</h3>
                                            </div>
                                        </div>
                                       
                                       
                                        <div class="row">
                                            <div class="col-md-6">
                                                <button class="btn btn-info text-white  btn-open-modal w-100" data-toggle="#modalDetail" data-persen="{{ $affiliate->persen }}" data-affiliate="{{ $affiliate->id }}" data-kode="{{ $affiliate->code }}" data-potongan="{{ $affiliate->potongan }}">
                                            Edit <i class="bi bi-pencil-square"></i>
                                        </button>
                                            </div>
                                        </div>
                                    </div>

                                </div>

                            <div class="card shadow">
                                <div class="card-header">
                                    <a href="{{ route('pembayaran-affiliate.index') }}" class="btn btn-success">
                                        Riwayat Transfer
                                    </a>
                                    <a href="{{ route('pembayaran-affiliate.create') }}" class="btn btn-primary">
                                        Permintaan Transfer
                                    </a>
                                </div>
                                <div class="card-header">
                                    <h3>Riwayat Pemakaian Kode Affiliate</h3>
                                </div>
                                <div class="card-body">
                                    <table class="table table-hover table-lg">
                                        <thead>
                                            <tr>
                                                <th>
                                                    Waktu
                                                </th>
                                                <th>Username</th>
                                                <th>Nama Paket</th>
                                                <th>Harga Paket</th>
                                                <th>Harga yang dibayar (Setelah Potongan)</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @foreach ($affiliate->langganan as $data)
                                                <tr>
                                                    <td >
                                                    {{ $data->created_at->format("Y-m-d H:i:s") }}
                                                    </td>
                                                    <td class="col-3">
                                                    {{ $data->user->name }}
                                                    </td>
                                                    <td class="col-auto">
                                                        <p class=" mb-0">{{ $data->paket->nama_paket }}</p>
                                                    </td>
                                                    <td class="col-auto">
                                                        <p class=" mb-0">Rp. {{ number_format($data->paket->getTotal()) }}</p>
                                                    </td>
                                                    <td class="col-auto">
                                                        <p class=" mb-0">Rp. {{ number_format($data->paket->getTotal() - ($data->paket->getTotal() * ($data->affiliate->potongan / 100)))}}</p>
                                                    </td>
                                                </tr>
                                            @endforeach

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        @else
                            <div class="card">
                                <div class="card-header">
                                    <div class="alert alert-secondary">Belum daftar</div>
                                    <form action="{{ route('affiliate.store') }}" method="POST" id="addForm">
                                        @csrf
                                    <button class="btn icon icon-right btn-sm btn-primary" type="submit">Daftar Affiliate <i class="bi bi-handshake"></i></button>
                                    </form>
                                </div>


                            </div>
                        @endif
                    </div>
                </div>
               
            @endcan
            
        </div>
    </div>
    
@endsection


@push('scripts')
    <script>
        $(document).ready(function() {
            $('.btn-open-modal').on('click', function() {
                var datas = $(this).data('persen');
                var kode = $(this).data('kode');
                var potongan = $(this).data('potongan');
                console.log(kode)
                var affiliateId = $(this).data('affiliate');
                console.log(datas);
                $('#nominal').val(datas);
                $('#kode').val(kode);
                $('#potongan').val(potongan);
                $('#affiliateIdField').val(affiliateId);


                $('#modalDetail').modal('show');
            });
        });
        function formSubmit(){
            $("#nominalForm").submit();
        }
    </script>
@endpush

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]