
<?php

use App\Http\Controllers\PermissionMethodController;
use App\Http\Controllers\GeneralController;
use App\Http\Controllers\MainAcontroller;
?>
<?php $__env->startSection('content'); ?>

<div class="card">
    <div class="card-body" id="photo">

        <h6 class="mb-0 text-uppercase text-center">
            <label id="saleOneClient" class="text-danger"> </label>
        </h6>

        <p class="text-center" id="saleOneAreaLoc"> </p>


        <?php if( $type1 == 'sale' ): ?>
        <div id="saleSearchForm" class="border p-4 rounded">
            <div class="card-title d-flex align-items-center">
                <h5 class="mb-0">Sale Report Search</h5>
            </div>
            <hr />

            <form action="<?php echo e(route('web.viewSaleReport')); ?>" id="frm_saleActivityOne" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <?php if(session('LoggedUser')['userRole'] == 'admin'): ?>
                <div style="display: none;" class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Shop Names </label>
                    <div class="col-sm-9">
                        <select name="shop" type="text" class="single-select" id="bannerSelectShops" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>
                <?php endif; ?>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">From Date</label>
                    <div class="col-sm-9">

                        <input name="from" id="b_from" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">To Date</label>
                    <div class="col-sm-9">
                        <input name="to" id="b_to" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row">
                    <label class="col-sm-3 col-form-label"></label>
                    <div class="col-sm-9">
                        <button type="submit" class="btn btn-primary px-5 searchSale">Search</button>
                    </div>
                </div>


            </form>

        </div>

        <?php elseif( $type1 == 'stock' ): ?>
        <div id="saleSearchForm" class="border p-4 rounded">
            <div class="card-title d-flex align-items-center">
                <h5 class="mb-0">STOCK REPORT</h5>
            </div>
            <hr />

            <form action="<?php echo e(route('web.viewStockReport')); ?>" id="frm_saleActivityOne" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <?php if(session('LoggedUser')['userRole'] == 'admin'): ?>
                <div style="display: none;" class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Shop Names </label>
                    <div class="col-sm-9">
                        <select name="shop" type="text" class="single-select" id="bannerSelectShops" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>
                <?php endif; ?>

                <div class="row">
                    <label class="col-sm-3 col-form-label"></label>
                    <div class="col-sm-9">
                        <button type="submit" class="btn btn-primary px-5 searchSale">Search</button>
                    </div>
                </div>

            </form>

        </div>

        <?php elseif( $type1 == 'purchase' ): ?>
        <div id="saleSearchForm" class="border p-4 rounded">
            <div class="card-title d-flex align-items-center">
                <h5 class="mb-0">PURCHASE REPORT</h5>
            </div>
            <hr />

            <form action="<?php echo e(route('web.viewPurchaseReport')); ?>" id="frm_saleActivityOne" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <?php if(session('LoggedUser')['userRole'] == 'admin'): ?>
                <div style="display: none;" class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Shop Names </label>
                    <div class="col-sm-9">
                        <select name="purShop" id="purchaseReport" type="text" class="single-select" id="bannerSelectSho" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>
                <?php endif; ?>

                <!-- <div id="supplierDIV" class="row mb-3">
                    <label id="supplierLabel" for="inputPhoneNo2" class="col-sm-3 col-form-label"></label>
                    <div id="showSupplier" class="col-sm-9">
                    </div>
                </div> -->


                <div class="row mb-3">
                    <label for="inputEnterYourName"  class="col-sm-3 col-form-label">Select Supplier</label>
                    <div class="col-sm-9">

                        <select id="listedSuppliers" disabled name="supplier" class="form-control">
                            <option value="">Choose one</option>
                        </select>

                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">From Date</label>
                    <div class="col-sm-9">

                        <input name="from" id="b_from" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">To Date</label>
                    <div class="col-sm-9">
                        <input name="to" id="b_to" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row mb-3">

                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">Supplier</label>
                    <div class="col-sm-9">
                        <input id="supplierCheckBox" class="excludeSupplier" type="checkbox" checked>
                        <label for="supplierCheckBox" class="form-label"> Exclude supplier </label>
                    </div>


                </div>



                <div class="row">
                    <label class="col-sm-3 col-form-label"></label>
                    <div class="col-sm-9">
                        <button type="submit" class="btn btn-primary px-5 searchSale">Search</button>
                    </div>
                </div>

            </form>

        </div>

        <?php elseif( $type1 == 'edit' ): ?>
        <div id="saleSearchForm" class="border p-4 rounded">
            <div class="card-title d-flex align-items-center">
                <h5 class="mb-0">EDIT REPORT</h5>
            </div>
            <hr />

            <form action="<?php echo e(route('web.viewEditReport')); ?>" id="frm_saleActivityOne" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <?php if(session('LoggedUser')['userRole'] == 'admin'): ?>
                <div style="display: none;" class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Shop Names </label>
                    <div class="col-sm-9">
                        <select name="editShop" id="purchaseReport" type="text" class="single-select editReportClients" id="bannerSelectShops" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>
                <?php endif; ?>

                <div class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Report Type </label>
                    <div class="col-sm-9">
                        <select required name="rptType" type="text" class="single-select" placeholder="">
                            <option value=""> Choose one </option>
                            <option value="sale"> Sales </option>
                            <option value="purchase"> Purchase </option>
                        </select>
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Users </label>
                    <div class="col-sm-9">
                        <select id="editedUsers" name="editusers" type="text" class="single-select" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">From Date</label>
                    <div class="col-sm-9">

                        <input name="from" id="b_from" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">To Date</label>
                    <div class="col-sm-9">
                        <input name="to" id="b_to" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row">
                    <label class="col-sm-3 col-form-label"></label>
                    <div class="col-sm-9">
                        <button type="submit" class="btn btn-primary px-5 searchSale">Search</button>
                    </div>
                </div>

            </form>

        </div>

        <?php elseif( $type1 == 'login' ): ?>
        <div id="saleSearchForm" class="border p-4 rounded">
            <div class="card-title d-flex align-items-center">
                <h5 class="mb-0">LOGIN REPORT</h5>
            </div>
            <hr />

            <form action="<?php echo e(route('web.loginReport')); ?>" id="frm_saleActivityOne" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <?php if(session('LoggedUser')['userRole'] == 'admin'): ?>
                <div style="display: none;" class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Shop Names </label>
                    <div class="col-sm-9">
                        <select name="loginShop" id="purchaseReport" type="text" class="single-select" id="bannerSelectShops" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>
                <?php endif; ?>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">From Date</label>
                    <div class="col-sm-9">

                        <input name="from" id="b_from" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">To Date</label>
                    <div class="col-sm-9">
                        <input name="to" id="b_to" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row">
                    <label class="col-sm-3 col-form-label"></label>
                    <div class="col-sm-9">
                        <button type="submit" class="btn btn-primary px-5 searchSale">Search</button>
                    </div>
                </div>

            </form>

        </div>

        <?php elseif( $type1 == 'cashclose' ): ?>
        <div id="saleSearchForm" class="border p-4 rounded">
            <div class="card-title d-flex align-items-center">
                <h5 class="mb-0">CASH CLOSING REPORT</h5>
            </div>
            <hr />

            <form action="<?php echo e(route('web.viewCashClosingReport')); ?>" id="frm_saleActivityOne" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <?php if(session('LoggedUser')['userRole'] == 'admin'): ?>
                <div style="display: none;" class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Shop Names </label>
                    <div class="col-sm-9">
                        <select name="denoShop" id="purchaseReport" type="text" class="single-select" id="bannerSelectShops" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>
                <?php endif; ?>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">From Date</label>
                    <div class="col-sm-9">

                        <input name="from" id="b_from" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">To Date</label>
                    <div class="col-sm-9">
                        <input name="to" id="b_to" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row">
                    <label class="col-sm-3 col-form-label"></label>
                    <div class="col-sm-9">
                        <button type="submit" class="btn btn-primary px-5 searchSale">Search</button>
                    </div>
                </div>

            </form>

        </div>

        <?php elseif( $type1 == 'edtstktrnsfrrpt' ): ?>
        <div id="saleSearchForm" class="border p-4 rounded">
            <div class="card-title d-flex align-items-center">
                <h5 class="mb-0">EDIT STOCK TRANSFER REPORT</h5>
            </div>
            <hr />

            <form action="<?php echo e(route('web.editStockTransferReport')); ?>" id="frm_saleActivityOne" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <?php if(session('LoggedUser')['userRole'] == 'admin'): ?>
                <div style="display: none;" class="row mb-3">
                    <label for="inputPhoneNo2" class="col-sm-3 col-form-label">Shop Names </label>
                    <div class="col-sm-9">
                        <select name="denoShop" id="purchaseReport" type="text" class="single-select" id="bannerSelectShops" placeholder="">
                            <option value=""> Choose one </option>
                        </select>
                    </div>
                </div>
                <?php endif; ?>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">From Date</label>
                    <div class="col-sm-9">

                        <input name="from" id="b_from" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row mb-3">
                    <label for="inputEnterYourName" class="col-sm-3 col-form-label">To Date</label>
                    <div class="col-sm-9">
                        <input name="to" id="b_to" type="date" required class="form-control" id="inputEnterYourName">
                    </div>
                </div>

                <div class="row">
                    <label class="col-sm-3 col-form-label"></label>
                    <div class="col-sm-9">
                        <button type="submit" class="btn btn-primary px-5 searchSale">Search</button>
                    </div>
                </div>

            </form>

        </div>



        <?php endif; ?>




    </div>
</div>

<script>
    $(document).ready(function() {


        $(".excludeSupplier").on('click', function(event) {

            if ($(this).prop("checked") == true) {

                // document.getElementById("showSupplier").style.display = "none";
                // document.getElementById('supplierLabel').textContent = "";
                document.getElementById("listedSuppliers").setAttribute("disabled", "disabled");
                document.getElementById("listedSuppliers").selectedIndex = "0";

                // $("#showSupplier").empty();

            } else if ($(this).prop("checked") == false) {

                document.getElementById("listedSuppliers").removeAttribute("disabled");

                // var addHTML = '<select name="supplier" id="supplierListShow" class="form-control" placeholder=""><option value=""> Choose one </option></select>';

                // $("#showSupplier").empty();

                // document.getElementById('supplierLabel').textContent = "Supplier Name";
                // document.getElementById('showSupplier').innerHTML = addHTML;

                // document.getElementById("showSupplier").style.display = "block";



            }

        });

        // new for supplier fetch

        var myClient = 354;

        $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            $.ajax({
                type: 'POST',
                url: "<?php echo e(route('web.getSupplierByClient')); ?>",
                data: {
                    client: myClient
                },
                success: function(data) {

                    $("#listedSuppliers").empty();

                    $('#listedSuppliers')
                        .append($("<option></option>")
                            .attr("value", "")
                            .text("Choose one"));

                    data.forEach(function(number) {

                        $('#listedSuppliers')
                            .append($("<option></option>")
                                .attr("value", number['Supplier_Name'])
                                .text(number['Supplier_Name']));

                    });

                }
            });

        // new for supplier fetch close

        $.ajax({
            type: "GET",
            dataType: "json",
            url: "<?php echo e(route('web.getAllClients')); ?>",

            success: function(data) {

                $("#bannerSelectShops").empty();

                $('#bannerSelectShops')
                    .append($("<option></option>")
                        .attr("value", "")
                        .text("Choose one"));

                $.each(data, function(index, value) {

                    $('#bannerSelectShops')
                        .append($("<option></option>")
                            .attr("value", value.ClientID)
                            .text(value.ClientName + "|" + value.ClientID + "|" + value.Area + "|" + value.Location))

                });

            }
        });


        $('#purchaseReport').on('change', function() {

            var client = this.value;

            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            $.ajax({
                type: 'POST',
                url: "<?php echo e(route('web.getSupplierByClient')); ?>",
                data: {
                    client: client
                },
                success: function(data) {

                    $("#supplierList").empty();

                    $('#supplierList')
                        .append($("<option></option>")
                            .attr("value", "")
                            .text("Choose one"));

                    data.forEach(function(number) {

                        $('#supplierList')
                            .append($("<option></option>")
                                .attr("value", number['Supplier_Name'])
                                .text(number['Supplier_Name']));

                    });

                }
            });


        });

        // for filling supplier - new :


        // for filling supplier - new close:


        // for edit report
        $('#purchaseReport').on('change', function() {

            var client = this.value;

            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            $.ajax({
                type: 'POST',
                url: "<?php echo e(route('web.getUserListByClient')); ?>",
                data: {
                    client: client
                },
                success: function(data) {

                    $("#editedUsers").empty();

                    $('#editedUsers')
                        .append($("<option></option>")
                            .attr("value", "")
                            .text("Choose one"));

                    data.forEach(function(number) {

                        $('#editedUsers')
                            .append($("<option></option>")
                                .attr("value", number['UserName'])
                                .text(number['UserName']));

                    });

                }
            });

        });


    });









    // find users on spinner change of clientid
</script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('Admin.Layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/digitronicsindia/public_html/aswas/resources/views/Admin/searchPage.blade.php ENDPATH**/ ?>