<?php $__env->startSection('title', __('Gift Codes')); ?>

<?php $__env->startSection("content"); ?>
<a href=""></a>

<div id="featured-services" class="featured-services main_section">
    <div class="card">
        <div class="card-body">
            <div class="row">
                <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12 gift-code-main">
                    <div class="px-0">
                        <div id="custom_toolbar_user" class="float-right">
                            <div class="dropdown" title="Export data">
                                <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="bi bi-download"></i> <?php echo e(__('Export')); ?></button>
                                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                    <a class="dropdown-item" href="javascript:void(0)" onclick="exportTasks('my_gift_codes',['counter','name','price','gift_code','expiration_date','redeemed_date','redeem_by','transferred_by','transferred_to','status'],'csv')"><?php echo e(__('CSV')); ?></a>
                                    <a class="dropdown-item" href="javascript:void(0)" onclick="exportTasks('my_gift_codes',['counter','name','price','gift_code','expiration_date','redeemed_date','redeem_by','transferred_by','transferred_to','status'],'zip')"><?php echo e(__('ZIP')); ?></a>

                                </div>
                            </div>
                        </div>
                        <table id="bstable" class="table table-striped table-hover" data-icons="icons" data-icons-prefix="bi"
                               data-show-button-text="true" data-ajax="ajaxRequestGiftCodes" table-for="gift_codes"
                               data-side-pagination="server" data-pagination="true" data-total-field="count"
                               data-data-field="items" data-filter-control="true" data-show-columns="true"
                               data-show-columns-toggle-all="false" data-toolbar="#custom_toolbar_user"
                               data-show-search-clear-button="true" data-loading-template="DataTaleLoadingTemplate" data-search-on-enter-key="true">
                            <thead>
                            <tr>
                                <th data-field="counter" data-sortable="false"><?php echo e(__('#')); ?></th>
                                <th data-field="name" data-sortable="false" data-filter-control="input" data-filter-control-placeholder="Package Name"><?php echo e(__('Package Name')); ?></th>
                                <th data-field="price" data-filter-control="input" data-filter-control-placeholder="Price"><?php echo e(__('Price')); ?></th>
                                <th data-field="gift_code" data-filter-control="input" data-filter-control-placeholder="Gift Code"><?php echo e(__('Gift Code')); ?></th>
                                <th data-field="expiration_date" data-filter-control="input" data-filter-control-placeholder="Expiration Date"><?php echo e(__('Expiration Date')); ?></th>
                                <th data-field="redeemed_date" data-filter-control="input" data-filter-control-placeholder="Redemption Date"><?php echo e(__(' Redemption Date')); ?></th>
                                <th data-field="redeem_by" data-sortable="true" data-filter-control="input" data-filter-control-placeholder="Redeemed By"><?php echo e(__('Redeemed By')); ?></th>
                                <th data-field="transferred_by" data-sortable="false" data-filter-control="input" data-filter-control-placeholder="Transferred By"><?php echo e(__('Transferred By')); ?></th>
                                <th data-field="transferred_to" data-sortable="false" data-filter-control="input" data-filter-control-placeholder="Transferred To"><?php echo e(__('Transferred To')); ?></th>
                                <th data-field="status" data-sortable="true" data-filter-control="select" data-filter-data="var:statuses" data-formatter="giftCodeStatusFormat" data-filter-control-placeholder="Status"><?php echo e(__('Status')); ?></th>
                                <th data-field="action"><?php echo e(__('Action')); ?></th>
                            </tr>
                            </thead>
                            <tbody></tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="cancelGiftCodeModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-body pt-0">
                <div class="row">
                    <div class="col-12" id="cancelGiftCode2FaFormDiv">
                        <?php if((!empty(Auth::user()->setting->fa_setting) && in_array('cancel_gift_code', Auth::user()->setting->fa_setting)) || !empty(Auth::user()->setting->fa3_setting) && in_array('cancel_gift_code', Auth::user()->setting->fa3_setting)): ?>
                            <h5 class="modal-title text-center my-3"><?php echo e(__("You're about to cancel gift code ")); ?> <span class="gift-code"></span>?</h5>
                            <form method="POST" action="javascript:void(0)" onsubmit="return false;" id="cancelGiftCode2faForm">
                                <h4><?php echo e(__("Important:")); ?></h4>
                                <p><?php echo e(__('Once cancel, this action cannot be undone.')); ?></p>
                                <h6><?php echo e(__('Please confirm this action by entering your security code below.')); ?></h6>
                                <?php echo $__env->make('frontend.auth.2fa-3fa-validate-form',[
                                    'nextSubmittedFormId' => "cancelGiftCode2faForm",
                                    'cancelBtnHtml' => '<button type="button" name="previous" onclick="closeCancelGiftCodeModal()" class="btn btn-danger mt-0 w-50 cancel-btn">'.renderIconHtml('cancel').'Cancel</button>',
                                    'type' => 'cancel_gift_code'
                                ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

                                <input type="hidden" name="gift_code_id" value="">
                                <button type="submit" class="btn btn-primary" hidden><?php echo e(__('Submit')); ?></button>
                            </form>
                        <?php else: ?>
                            <h4 class="test-left"><?php echo e(__("Cancel gift code is disabled for your account")); ?></h4>
                            <h6 class="test-left"><?php echo e(__("Please ensure the following requirements are met:")); ?></h6>
                            <ul style="list-style: disc !important;">
                                <li><?php echo e(__('Google 2FA for cancel gift code must be enabled.')); ?></li>
                            </ul>
                            <?php echo e(__("Please complete the necessary steps to enable cancel gift code.")); ?>

                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Modal -->
<div class="modal fade" id="transferGiftCodeModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-body pt-0">
                <div class="row">
                    <div class="col-12" id="transferGiftCode2FaFormDiv">
                        <?php if((!empty(Auth::user()->setting->fa_setting) && in_array('send_gift_code', Auth::user()->setting->fa_setting)) || !empty(Auth::user()->setting->fa3_setting) && in_array('send_gift_code', Auth::user()->setting->fa3_setting)): ?>
                            <h5 class="modal-title text-center my-3"><?php echo e(__("You're sending gift code ")); ?> <span class="gift-code"></span> <?php echo e(__("for")); ?> <span class="product-name"></span></h5>
                            <form method="POST" action="javascript:void(0)" onsubmit="return false;" id="transferGiftCode2faForm">
                                <div class="form-group col-12 col-md-12">
                                    <div class="relative z-0 w-full group">
                                        <select name="transferred_user_id" class="rounded-lg p-2.5 w-full text-sm text-gray-900 bg-transparent border-gray-300 appearance-none focus:outline-none border-2 focus:ring-1 peer pl-15 h-11 form-select transferred_user_id select-form" style="height:38px !important" id="member_searchid">
                                        </select>
                                        <label for="user_id" class="ol-form-label ml-2 p-2 py-0 peer-focus:font-medium absolute left-0 text-sm text-gray-600 duration-300 transform -translate-y-6 scale-75 top-3 origin-[0] peer-focus:start-0 rtl:peer-focus:translate-x-1/4 peer-focus:text-indigo-400 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6 bg-white peer-focus:z-10"><?php echo e(__('User')); ?></label>
                                        <span class="transferred_user_id_error error custom-error"></span>
                                        <p class="mt-2"><span class="fw-bold"><?php echo e(__("Note:")); ?></span> <?php echo e(__('Sending gift codes to your downline users within the same country and region as you. Ensure the selected user meets these criteria.')); ?></p>
                                    </div>
                                </div>
                                <div class="user-details" style="display: none;">
                                    <p><span class="fw-bold"><?php echo e(__("Username:")); ?></span> <span class="username"></span></p>
                                    <p><span class="fw-bold"><?php echo e(__("Email:")); ?></span> <span class="email"></span></p>
                                </div>
                                <p class="user_message_text"></p>
                                <div class="2fa_send_gift_code" style="display: none;">
                                    <?php echo $__env->make('frontend.auth.2fa-3fa-validate-form',[
                                        'nextSubmittedFormId' => "transferGiftCode2faForm",
                                        'cancelBtnHtml' => '<button type="button" name="previous" onclick="closeTransferGiftCodeModal()" class="btn btn-danger mt-0 w-50 cancel-btn">'.renderIconHtml('cancel').'Cancel</button>',
                                        'type' => 'send_gift_code'
                                    ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                </div>

                                <input type="hidden" name="gift_code_id" value="">
                                <button type="submit" class="btn btn-primary" hidden><?php echo renderIconHtml('save'); ?><?php echo e(__('Submit')); ?></button>
                            </form>
                        <?php else: ?>
                            <h4 class="test-left"><?php echo e(__("Send gift code is disabled for your account")); ?></h4>
                            <h6 class="test-left"><?php echo e(__("Please ensure the following requirements are met:")); ?></h6>
                            <ul style="list-style: disc !important;">
                                <li><?php echo e(__('Google 2FA for send gift code must be enabled.')); ?></li>
                            </ul>
                            <?php echo e(__("Please complete the necessary steps to enable send gift code.")); ?>

                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>


<?php $__env->startPush('scripts'); ?>
<script>
    $(document).on("click",".gift_code",function () {
        copyToClipboard($(this).attr('data-clipboard-text'));
    });


    let transactionIdFilter;
    <?php if(isset($transactionId) && $transactionId): ?>
    transactionIdFilter = "<?php echo e($transactionId); ?>";
    <?php endif; ?>
</script>
<script src="<?php echo e(asset('frontend/js/page-js/my-gift-code.js')); ?>"></script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/corsairdevelopme/public_html/member/resources/views/frontend/products/my-gift-code.blade.php ENDPATH**/ ?>