<?php $__env->startSection('content'); ?>
<div class="master-main mainContent mobile maincontent-design2 middlebackground background-design5">
    <div class="container">
        <div class="row multi">
            <div class="hidden"></div>
            
            <div class="col-xs-12 col-single tabbed main-content">
                <div id="MainContent_Panel1">
                    <div class="deposit-container">
                        
                        
                        <div class="nav-container">
                            <button type="button" id="Account_Deposit" class="btn btn-tab" style="order: 10" onclick="gotoView('/mobile/account/deposit')">
                                <span class="icon icon-deposit"></span><span>Deposit</span>
                            </button>
                            <button type="button" id="Account_Withdraw" class="btn btn-tab" style="order: 10" onclick="gotoView('/mobile/account/withdraw')">
                                <span class="icon icon-withdraw"></span><span>Withdraw</span>
                            </button>
                            <button type="button" id="Account_WDHistory" class="btn btn-tab" style="order: 10" onclick="gotoView('/mobile/account/walletsummary')">
                                <span class="icon icon-history"></span><span>History</span>
                            </button>
                            <button type="button" id="Account_MyPromo" class="btn btn-tab" style="order: 10" onclick="gotoView('/mobile/account/mypromo')">
                                <span class="icon icon-promo"></span><span>Promo saya</span>
                            </button>
                            <button type="button" id="Account_Wallet" class="btn btn-tab" style="order: 10" onclick="gotoView('/mobile/account/wallet')">
                                <span class="icon icon-saldo"></span><span>Saldo</span>
                            </button>
                        </div>
                        
                        <div class="deposit-container-inner">
                            <div class="deposit-channel">
                                <div class="deposit-channel-title">Deposit Channel</div>
                                <div class="deposit-channel-nav">
                                    <button type="button" id="Channel_1" class="btn btn-deposit-channel" data-channel="1" onclick="selectDepositChannel(1)">
                                        <span class="icon icon-deposit-channel-1"></span><div class="button-text">QRIS (Auto)</div>
                                    </button>
                                    <button type="button" id="Channel_0" class="btn btn-deposit-channel" data-channel="0" onclick="selectDepositChannel(0)">
                                        <span class="icon icon-deposit-channel-0"></span><div class="button-text">Transfer Bank, E-Wallet & Pulsa</div>
                                    </button>
                                </div>
                            </div>
                            
                            <div class="well deposit-content">
                                <form action="<?php echo e(route('transaksi.deposit')); ?>" method="POST" enctype="multipart/form-data" id="formDeposit">
                                    <?php echo csrf_field(); ?>
                                    <input type="hidden" name="ctl00$MainContent$InputCurrentDepositChannel" id="MainContent_InputCurrentDepositChannel" value="1" />
                                    <input type="hidden" name="ctl00$MainContent$InputSelectedBonus" id="MainContent_InputSelectedBonus" value="-1" />
                                    <input type="hidden" name="ctl00$MainContent$InputSelectedBankAccount" id="MainContent_InputSelectedBankAccount" />
                            
                                    <div class="input-container username">
                                        <div class="input-label-container"><label>Username</label></div>
                                        <div class="info" translate="no"><?php echo e(auth()->user()->username); ?></div>
                                    </div>
                            
                                    
                                    <div class="input-container deposit-bonus" translate="no">
                                        <div class="input-label-container"><span class="input-label">Bonus</span></div>
                                        <div class="input-value-container">
                                            <div class="specific-container channel-0">
                                                <select name="ctl00$MainContent$Channel0InputDepositBonus" class="form-control" onchange="$('#MainContent_InputSelectedBonus').val($(this).val())">
                                                    <option value="-1">- Silahkan pilih -</option>
                                                    <?php $__currentLoopData = $bonus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($b->id); ?>"><?php echo e($b->judul); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            </div>
                                            <div class="specific-container channel-1">
                                                <select name="ctl00$MainContent$Channel1InputDepositBonus" class="form-control" onchange="$('#MainContent_InputSelectedBonus').val($(this).val())">
                                                    <option value="-1">- Silahkan pilih -</option>
                                                    <?php $__currentLoopData = $bonus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($b->id); ?>"><?php echo e($b->judul); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    
                                    
                                    
                                    <div class="specific-container channel-1">
                                        <div class="input-container deposit-accounts">
                                            <div class="input-label-container"><span class="input-label required">Provider</span></div>
                                            <div class="input-value-container required">
                                                <select name="qris_provider" id="qris_provider" class="form-control" onchange="updateQrisSelection(this.value)">
                                                    <option value="">- Silahkan pilih -</option>
                                                    
                                                    <?php $__currentLoopData = $bank->where('type', 'otomatis'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $q): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($q->id); ?>">
                                                            <?php echo e(strtoupper($q->nama_bank)); ?> (<?php echo e($q->nama_pemilik); ?>)
                                                        </option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                            
                                    
                                    
                                    
                                    <div class="specific-container channel-0 channel-3">
                                        <div class="input-container deposit-accounts">
                                            <div class="input-label-container"><span id="MainContent_LabelDepositAccounts" class="input-label required">Tujuan Bank</span></div>
                                            <div class="input-value-container required">
                                                <button type="button" id="btnPilihBank" class="btn btn-deposit-accounts btn-default" data-toggle="modal" data-target="#bankModal">- Pilih Nama Bank -</button>
                                            </div>
                                        </div>
                                        
                                        
                                        <div class="input-container deposit-bank-account-info">
                                            <div class="info" style="display: none">
                                                <div class="deposit-account-bankinfo">
                                                    <div>
                                                        <div class="deposit-account-bankname"><span class="deposit-account-bankname-text" style="font-weight:bold;"></span></div>
                                                        <div class="deposit-account-banknumber"><span class="deposit-account-banknumber-text" style="font-weight:bold;"></span></div>
                                                    </div>
                                                    <div class="copybutton" onclick="copyBankAccountNumber()"><a class="btn btn-default btn-copy"><div class="glyphicon glyphicon-duplicate"></div><span>Copy</span></a></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                            
                                    
                                    <div class="input-container deposit-amount">
                                        <div class="input-label-container"><label class="input-label required">Uang Sejumlah</label></div>
                                        <div class="input-value-container required">
                                            <input name="ctl00$MainContent$InputDepositAmount" maxlength="11" id="MainContent_InputDepositAmount" class="form-control" type="tel" placeholder="Contoh: 50.000" autocomplete="off" />
                                        </div>
                                    </div>
                            
                                    
                                    <div class="specific-container channel-0">
                                        <div class="input-container deposit-upload">
                                            <div class="input-label-container"><span class="input-label">Bukti Transfer (Opsional)</span></div>
                                            <div class="input-value-container">
                                                <input type="file" name="ctl00$MainContent$InputDepositUpload" accept="image/*" class="form-control" />
                                            </div>
                                        </div>
                                        <div class="input-container deposit-remark">
                                            <div class="input-label-container"><label>Keterangan</label></div>
                                            <div class="input-value-container">
                                                <textarea name="ctl00$MainContent$InputDepositRemark" rows="2" class="form-control" placeholder="Isi berita transfer"></textarea>
                                            </div>
                                        </div>
                                    </div>
                            
                                    <div class="form-action">
                                        <button type="submit" id="MainContent_DepositSubmit" class="btn btn-submit btn-theme">Kirim</button>
                                    </div>
                                </form>
                            </div>
                        </div>

                        
                        <div id="bankModal" class="modal fade popup-modal" tabindex="-1" style="z-index: 2147483642">
                            <div class="modal-dialog modal-lg">
                                <div class="modal-content" style="background:#1a1a1a; border:1px solid #333;">
                                    <div class="modal-header" style="border-bottom:1px solid #333;">
                                        <h4 class="modal-title" style="color:#fff; font-size:16px;">Pilih Tujuan Bank</h4>
                                        <button type="button" class="close" data-dismiss="modal" style="color:#fff;">&times;</button>
                                    </div>
                                    <div class="modal-body">
                                        <div class="row">
                                            
                                            <?php $__currentLoopData = $bank->where('type', '!=', 'otomatis'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div class="col-xs-6 col-md-4 col-lg-3" style="margin-bottom:15px;">
                                                    <div onclick="pilihBankManual('<?php echo e($b->id); ?>', '<?php echo e(strtoupper($b->nama_bank)); ?>', '<?php echo e($b->nama_pemilik); ?>', '<?php echo e($b->nomor_rekening); ?>')" 
                                                         style="cursor:pointer; background:#2a2a2a; padding:15px 10px; border-radius:8px; border:1px solid #444; text-align:center; transition:0.3s;"
                                                         onmouseover="this.style.borderColor='#f3c300'" onmouseout="this.style.borderColor='#444'">
                                                        <img src="<?php echo e($b->icon); ?>" style="height:35px; max-width:100%; object-fit:contain; margin-bottom:8px; background:#fff; padding:3px; border-radius:4px;">
                                                        <div style="font-size:12px; font-weight:bold; color:#f3c300;"><?php echo e(strtoupper($b->nama_bank)); ?></div>
                                                    </div>
                                                </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>
<script>
    // Konfigurasi Navigasi Mobile Slider
    $(function () {
        var navContainerEl = $('.tabbed .nav-container');
        setNavButtonActiveClass();
        showSlideIndicator(true, navContainerEl);
        $('.tabbed .nav-container').on('scroll', function (e) {
            if ($(this).find('.slide-indicator').hasClass('start')) showSlideIndicator(false, navContainerEl);
        });
        var settingSeq = "Account_Deposit,Account_Withdraw,Account_WDHistory,Account_MyPromo,Account_Wallet";
        var arrSeq = (settingSeq !== "") ? settingSeq.split(",") : [];
        if (arrSeq.length > 0) {
            arrSeq.forEach(function (element, index) {
                if (element !== "" && element !== null && typeof element !== "undefined") navContainerEl.find('#' + element).css("order", index);
            });
        }
        showOOBEl(navContainerEl.find("button.active"), navContainerEl);
        updateIndicatorWidth();
        $(window).on("resize", updateIndicatorWidth);
    });

    var isClickTab = false;
    function gotoView(page) {
        if (isClickTab) return;
        isClickTab = true;
        location.href = page;
        setTimeout(function() { isClickTab = false; }, 2000);
    }
    function setNavButtonActiveClass() {
        var btnNavEl = $("#Account_Deposit");
        if (btnNavEl && btnNavEl.length > 0) {
            btnNavEl.addClass("active").attr('onclick', "");
        }
    }
    function showSlideIndicator(isShow, element) { /* Logika slide bawaan */ }
    function showOOBEl(el, elContainer) { /* Logika bawaan */ }
    function updateIndicatorWidth() { /* Logika bawaan */ }
</script>

<script>
    // --- VARIABEL WAJIB DEPOSIT.MIN.JS ---
    var depoErrorMsg = ""; var reloadPage = ""; var currDepositChannel = "1"; var deviceTypeID = 3;
    var isShowPGQRCode = "True"; var paymentGatewayRoute = "<?php echo e(route('transaksi.deposit')); ?>";
    var gamePageRoute = "<?php echo e(route('account.home')); ?>"; var currency = "IDR"; var numGroupSeperator = ".";
    var unlimitedMsg = "Tanpa batas", perClaimsMsg = "/ KLAIM", perDayMsg = "dalam sehari", dayMsg = "Hari";
    var bonusMaxBonusMsg = "Max", bonusConditionTurnoverMsg = "TO", bonusPeriodMsg = "Periode";
    var bonusDirectMethod = "Direct", bonusExtraMethodMsg = "Extra", bonusEventMethodMsg = "Event";
    var bonusTicketConditionMsg = "Kondisi", bonusTicketMsg = "Ticket", bonusTicketMaxMsg = "Max";
    var qrExpiredMsg = "QR Expired", errorAmountEmptyMsg = "*Nominal kosong.", errorBankSelectMsg = "*Pilih bank.";
    var requiredFieldMsg = "*Wajib", referenceCodeSNMsg = "Ref", refNoMsg = "Ref", qrCodeExpMsg = "Expired";
    var pg = { amount: "", qrString: "", url: "", oid: "", timeout: "", timeoutOffset: "", timeoutSeconds: "", active: false };

    var getBonusListData = "[]";
    var getDepChannelListData = '[{"DepoChannel":1,"ChannelDesc":"QRIS","Providers":[{"PGID":1,"PGDesc":"QRIS","BankTypeID":4,"BankAccounts":[{"AgentBankID":8,"BankName":"QRIS","BankCode":"QRIS"}],"DefaultSelect":true}]},{"DepoChannel":0,"ChannelDesc":"Transfer Bank","Banks":[{"BankTypeID":2,"BankTypeDesc":"Bank","BankAccounts":[]}]}]';

    var refCodeLabelEl = $("#MainContent_LabelDepositRefCode"), refCodeInputEl = $("#MainContent_InputDepositRefCode");
    var selectedBankAccountEl = $("#MainContent_InputSelectedBankAccount"), depoChannelInputEl = $("#MainContent_InputCurrentDepositChannel");
    var depoUploadFileInputEl = $("#MainContent_InputDepositUpload"), selectedBonusInputEl = $('#MainContent_InputSelectedBonus');
    var depoAmountInputEl = $('#MainContent_InputDepositAmount');
</script>

<script type="text/javascript" src="<?php echo e(asset('assets/js/account/deposit.min.js')); ?>?v=<?php echo e(time()); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('assets/js/jquery.qrcode.min.js')); ?>"></script>

<script>
    // =========================================================
    // FUNGSI BYPASS JS & QRIS DINAMIS MOBILE
    // =========================================================

    // Fungsi menangkap dropdown QRIS
    function updateQrisSelection(id) {
        if(id !== "") {
            $('#MainContent_InputSelectedBankAccount').val('1,4,' + id + ',4');
        } else {
            $('#MainContent_InputSelectedBankAccount').val('');
        }
    }

    function pilihBankManual(id, bankName, accountName, accountNumber) {
        $('#MainContent_InputSelectedBankAccount').val('0,2,' + id + ',2');
        $('.btn-deposit-accounts').text(bankName + ' [ 100% ]');
        $('.deposit-account-bankname-text').text('Nama : ( ' + bankName + ' ) ' + accountName);
        $('.deposit-account-banknumber-text').text('Nomor : ' + accountNumber);
        $('.deposit-bank-account-info .info').hide().fadeIn(300);
        $('#bankModal').modal('hide');
    }

    $(document).ready(function() {
        // Format Angka Ribuan
        $('#MainContent_InputDepositAmount').on('input', function() {
            var val = $(this).val().replace(/\D/g, "");
            if (val === "") { $(this).val(""); return; }
            $(this).val(parseInt(val, 10).toLocaleString('id-ID'));
        });

        // Tab Handling QRIS
        $('#Channel_1').on('click', function() {
            $('.deposit-bank-account-info .info').hide();
            $('#qris_provider').trigger('change');
        });

        // Tab Handling Bank Manual
        $('#Channel_0').on('click', function() {
            $('#MainContent_InputSelectedBankAccount').val('');
            $('.btn-deposit-accounts').text('- Pilih Nama Bank -').attr('data-toggle', 'modal').attr('data-target', '#bankModal');
            $('.deposit-bank-account-info .info').hide();
        });

        // Validasi Submit
        $('#MainContent_DepositSubmit').off('click').on('click', function(e) {
            if ($('#MainContent_InputSelectedBankAccount').val() === '') {
                e.preventDefault();
                alert('Silahkan pilih tujuan bank / provider QRIS terlebih dahulu!');
                return false;
            }
            if ($('#MainContent_InputDepositAmount').val() === '') {
                e.preventDefault();
                alert('Jumlah deposit tidak boleh kosong!');
                return false;
            }
            return true;
        });

        // Inisialisasi awal ke Tab QRIS & Pilih opsi pertama
        setTimeout(function(){
            $('#Channel_1').trigger('click');
            if($('#qris_provider option').length > 1) {
                $('#qris_provider').prop('selectedIndex', 1).trigger('change');
            }
        }, 150);
    });

    function copyBankAccountNumber() {
        var dummy = document.createElement("textarea");
        dummy.value = $('.deposit-account-banknumber-text').text().replace('Nomor : ', '');
        document.body.appendChild(dummy);
        dummy.select();
        document.execCommand("copy");
        document.body.removeChild(dummy);
        alert("Nomor rekening berhasil disalin: " + dummy.value);
    }
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('frontend.mobile.pages.account.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /www/wwwroot/website/sewa/dragon158/resources/views/frontend/mobile/pages/account/pages/deposit.blade.php ENDPATH**/ ?>