<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>@yield('pageTitle')</title>
      <meta name="csrf-token" content="{{ csrf_token() }}">
  <link rel="stylesheet" href="{{ asset('admin/simple-line-icons/css/simple-line-icons.css') }}">
    <link rel="stylesheet" href="{{ asset('admin/flag-icon-css/css/flag-icon.min.css') }}">
    <link rel="stylesheet" href="{{ asset('admin/css/vendor.bundle.base.css') }}">
   

    <link rel="stylesheet" href="{{ asset('admin/admintheme/css/style.css') }}">
    <link rel="stylesheet" href="{{ asset('css/vega_css.css') }}">
    <link rel="shortcut icon" href="{ asset('admin/admintheme/images/favicon.png') }}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('date_picker/jquery.datetimepicker.css') }}"/>
    
    <link rel="stylesheet" href="{{ asset('admin/admintheme/css/tree.css') }}">
    <link rel="stylesheet" href="{{ asset('css/jqury_min.css') }}">
    <link rel="stylesheet" href="{{ asset('css/MonthPicker.min.css') }}">
      <link href="{{ asset('css/datepicker.min.css') }}" rel="stylesheet">

    <script src="{{ asset('js/jquery-3.6.3.min.js') }}" ></script>
    <script src="{{ asset('js/jquery.slimscroll.min.js') }}" ></script>



<!-- jQuery and jQuery UI -->




    <script src="{{ asset('js/tree.js') }}" ></script>

       <script src="{{ asset('js/vega_scripts.js') }}" ></script>

       <link rel="stylesheet" href="{{ asset('css/select2.min.css') }}">
<!-- <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> -->


<style>


.table-autocomplete thead{

 background: aquamarine;


}
.table-autocomplete {
  width: 100%;
  font-size: 15px;
}
.ui-menu-item:hover{
color:white;
background:black;
}
.ui-menu .ui-menu-item-wrapper:hover {
        color: #303030;
        background-color: red;
        border: #fff 1px solid;
    }   


    .ui-state-focus{
      color: #303030;
        background-color: red;
        border: #fff 1px solid;
    }

    .navbar{
      background:none !important;
    }
    .sidebar{
      background: #1a1a17 !important;
    }


    body,html{
      overflow: hidden;
    }
    #form-div,#table-div{
      overflow: scroll;
      scrollbar-width: thin;
    }
</style>


  </head>
  <body>


    <div class="container-scroller">
      <!-- partial:../../partials/_navbar.html -->
      <nav class="navbar default-layout-navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">

      <div class="col-lg-12 col-sm-12 col-12" >


<div class="row">

<!-- <div class="col-lg-4 col-sm-4 col-4">
   <a class="" href="/home">
<img src="{{ URL('images/rahul_bannerN.png') }}" alt="logo" class="logo-dark" style="height:80%;"/></a>


</div> -->


<div  class="col-lg-12 col-sm-12 col-ms-12 col-12" style="background-image:url({{ asset('images/Logo_Long.png') }});height:73px;background-size: 3000px 100px;
background-repeat: no-repeat;">

  <div class="navbar-menu-wrapper d-flex align-items-right flex-grow-1" style="height:80%;padding: 0px;width: 100%;">
    

          <ul class="navbar-nav navbar-nav-right ml-auto" >
      
            <li class="nav-item dropdown d-none d-xl-inline-flex user-dropdown" style="align-items: end;">
              <a class="nav-link dropdown-toggle" id="UserDropdown" href="/" data-toggle="dropdown" aria-expanded="false">
                <img class="img-xs rounded-circle ml-2" src="{{ asset('admin/admintheme/images/user-icon.png') }}" alt="Profile image"> <span class="font-weight-normal"> 
                {{ Session::get('uname') }}
                </span></a>
              <div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="UserDropdown">
                
              
                <a class="dropdown-item" onclick="open_mdl_pass();" ><i class="dropdown-item-icon icon-energy text-primary"></i> Change Password</a>
                
                <a class="dropdown-item" href="{{ route('logout') }}"
                                       onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();"><i class="dropdown-item-icon icon-power text-primary"></i>Sign Out
                                                     <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none"  enctype="multipart/form-data">
                                        @csrf
                                    </form>
                                                   </a>
              </div>
            </li>
          </ul>
          <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
            <span class="icon-menu"></span>
          </button>
        </div>
</div>


</div>

</div>
        



       
      </nav>



      <!-- partial -->
      <div class="container-fluid page-body-wrapper" style="padding-top: 74px !important;">
        <!-- partial:../../partials/_sidebar.html -->
        <nav class="sidebar sidebar-offcanvas" data-bs-scroll="true" id="sidebar">
          <ul class="nav">
          <a class="" href="/home">
            <li class="nav-item nav-category">
              <span class="nav-link" style="margin-top: 8px;">Dashboard</span>
            </li>
  </a>

            
           @foreach ($contents as $ind =>$content)
               @if($content['to_admin']==Session::get('is_admin'))
               @if($content['menu_type']==3)
               <li class="nav-item">
            
              <a class="nav-link" href="<?php echo "/".$content['root']."/".$content['menu_id']; ?> ">

                <span class="menu-title"><?php echo $content['menu_name']; ?></span>
                <i class="<?php echo $content['menu_icon']; ?> menu-icon"></i>
              </a>
            </li>
            @endif
             @if($content['menu_type']==0)
             <li class="nav-item">
              <a class="nav-link" data-toggle="collapse" href="#ui-basic" aria-expanded="false" aria-controls="ui-basic">
                <span class="menu-title"><?php echo $content['menu_name']; ?></span>
                <i class="<?php echo $content['menu_icon']; ?> menu-icon"></i>
              </a>
              <div class="collapse" id="ui-basic">
                <ul class="nav flex-column sub-menu">
                     @foreach ($content['sub'] as $id=> $subm)
                  <li class="nav-item"> <a class="nav-link" href="<?php echo "/".$subm['root']."/".$subm['menu_id']; ?>"><?php echo $subm['menu_name']; ?></a></li>
                 
                     @endforeach
                </ul>
              </div>
            </li>
            @endif
            @endif
                 @endforeach
            
            
          </ul>
        </nav>
        <!-- partial -->
        <div class="main-panel">
          <div class="content-wrapper">
               @yield('page-content')
          </div>
          

          <div   tabindex="-1" id="myModaltable" class="modal fade" role="dialog">
    <div class="modal-dialog modal-lg" >
    
      <!-- Modal content-->
      <div class="modal-content" style="height:auto !important;">
        <div class="modal-header">         
          <h4 class="modal-title">Table Settings <?php //echo $formid; ?></h4>
         <button aria-hidden="true" data-dismiss="modal" class="btn-close" type="button"></button>
        </div>
        <div class="modal-body">
        
   
        <form  method="post" autocomplete="off" action="/save_table_settings" class="modal_form" enctype="multipart/form-data"  role="form"  autocomplete="off" >
        
    

</form>
       
        </div>
        <div class="modal-footer" style="border-top:none !important;">
      
        </div>
      </div>
      
    </div>
  </div>




  <div class="modal" tabindex="-1" role="dialog" id="change_pass_mdl">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Change Password</h5>
        <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close" onclick='$("#change_pass_mdl").hide();'>
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <div class="col-lg-12 row">
<label class="col-sm-4 col-md-4 col-lg-4" style="font-size:14px;">New Password </label>

<div class="col-lg-8 col-sm-8 col-md-8">
<input type="text"  class="form-control" id="pass1" >

</div>

        </div>
        <br>
        <div class="col-lg-12 row">
        <label class="col-sm-4 col-md-4 col-lg-4" style="font-size:14px;">Confirm Password </label>
        <div class="col-lg-8 col-sm-8 col-md-8">
        <input type="text"  class="form-control" id="pass2" >

        </div>



        </div>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" onclick="update_pass();">Update</button>
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal" onclick='$("#change_pass_mdl").hide();'>Close</button>
      </div>
    </div>
  </div>
</div>
          <!-- content-wrapper ends -->
          <!-- partial:../../partials/_footer.html -->
          <footer class="footer">
            <div class="d-sm-flex justify-content-center justify-content-sm-between">
              <span class="text-muted d-block text-center text-sm-left d-sm-inline-block">Copyright © vega bussiness softwere 2022</span>
             
            </div>
          </footer>
          <!-- partial -->
        </div>
        <!-- main-panel ends -->
      </div>








      
      <!-- page-body-wrapper ends -->
    </div>
    <!-- container-scroller -->
    <!-- plugins:js -->
    <script src="{{ asset('admin/js/vendor.bundle.base.js') }}"></script>
    <!-- endinject -->
    <!-- Plugin js for this page -->
    <!-- End plugin js for this page -->
    <!-- inject:js -->
   <script src="{{ asset('js/moment.min.js') }}"></script>
    <script src="{{ asset('js/bootstrap-datetimepicker.min.js') }}"></script> 
    <script src="{{ asset('admin/admintheme/js/off-canvas.js') }}"></script>
    <script src="{{ asset('admin/admintheme/js/misc.js') }}"></script>
    <script src="{{ asset('project-js/vega-scripts.js') }}"></script>
    <script src="{{ asset('date_picker/jquery.js') }}" ></script>
    <script src="{{ asset('date_picker/jquery.datetimepicker.full.js') }}" ></script>

    <script src="{{ asset('datatables/jquery.dataTables.min.js')}}"></script>
<script src="{{ asset('datatables/dataTables.bootstrap4.min.js')}}"></script>
<!-- Buttons examples -->
<script src="{{ asset('datatables/dataTables.buttons.min.js')}}"></script>
<script src="{{ asset('datatables/buttons.bootstrap4.min.js')}}"></script>
<script src="{{ asset('datatables/jszip.min.js')}}"></script>
<script src="{{ asset('datatables/pdfmake.min.js')}}"></script>
<script src="{{ asset('datatables/vfs_fonts.js')}}"></script>
<script src="{{ asset('datatables/buttons.html5.min.js')}}"></script>
<script src="{{ asset('datatables/buttons.print.min.js')}}"></script>
<script src="{{ asset('datatables/buttons.colVis.min.js')}}"></script>
<!-- Responsive examples -->
<script src="{{ asset('datatables/dataTables.responsive.min.js')}}"></script>
<script src="{{ asset('datatables/responsive.bootstrap4.min.js')}}"></script>

<script src="{{ asset('js/select2.min.js') }}" ></script>
<script src="{{ asset('js/jquery.ui.min.js') }}" ></script>

<script src="{{ asset('js/MonthPicker.min.js') }}" ></script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
<script src="{{ asset('js/bootstrap-datepicker.min.js') }}"></script>
  <script src="{{ asset('js/jquery.inputmask.bundle.min.js')}}"></script>
  <script src="{{ asset('js/jquery.maskMoney.min.js')}}"></script>
<script src="{{ asset('js/mask.js')}}"></script>




<!-- <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
 -->

    
<!--   <script src="//cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
 --> 
  
    <!-- endinject -->
    <!-- Custom js for this page -->
    <!-- End custom js for this page -->






<script>
function open_mdl_pass(){
  $("#change_pass_mdl").show();
}



function update_pass(){

  status=0;


  if($("#pass1").val()==''){


alert("Enter New Password");
status=1;
return;
}




if($("#pass1").val()!=$("#pass2").val()){


alert("Password Mismatch");
$("#pass2").val('');
$("#pass2").focus().click();
status=1;

return;
}
 



if(status==0){
  $.ajax({
              type: 'POST',
               async: false,
                url: '/edit_pass',
                data: {
                     '_token': "{{ csrf_token() }}",
                    'cid':"{{ Session::get('cid')}}",
                    pass2: $.trim($("#pass2").val())
         
                },
                error: function (request, error) {
                    alert("Please Wait, Loading...");
                },
                success: function (response) {
 datas=response;

        alert(datas.msg);
        $("#change_pass_mdl").hide();

        $("#pass2,#pass1").val('');
        }
          
     }); 
}


 


}











$.widget('custom.tableAutocomplete', $.ui.autocomplete, {
    options: {
        open: function (event, ui) {
            // Hack to prevent a 'menufocus' error when doing sequential searches using only the keyboard
            $('.ui-autocomplete .ui-menu-item:first').trigger('mouseover');
            
        },
        focus: function (event, ui) {
            event.preventDefault();
        }
    },
    _create: function () {
        this._super();
        // Using a table makes the autocomplete forget how to menu.
        // With this we can skip the header row and navigate again via keyboard.
        
        this.widget().menu("option", "items", ".ui-menu-item");
      
    },
    _renderMenu: function (ul, items) {
        var self = this;
        var $table = $('<table class="table-autocomplete">'),
            $thead = $('<thead>'),
            $headerRow = $('<tr>'),
            $tbody = $('<tbody>');

        $.each(self.options.columns, function (index, columnMapping) {
           // $('<th>').css("");
            $('<th style="width:'+columnMapping.width+' !important;">').text(columnMapping.title).appendTo($headerRow);
        });

        $thead.append($headerRow);
        $table.append($thead);
        $table.append($tbody);

        ul.html($table);

        $.each(items, function (index, item) {
            self._renderItemData(ul, ul.find("table tbody"), item);
        });
    },
    _renderItemData: function (ul, table, item) {
        return this._renderItem(table, item).data("ui-autocomplete-item", item);
    },
    _renderItem: function (table, item) {
        var self = this;
        var $tr = $('<tr class="ui-menu-item" role="presentation">');

        $.each(self.options.columns, function (index, columnMapping) {
            var cellContent = !item[columnMapping.field] ? '' : item[columnMapping.field];
            $('<td>').text(cellContent).appendTo($tr);
        });

        return $tr.appendTo(table);
    }
});




$(document).ready(function(){
  $(".custom1").inputmask({ 'alias' : 'decimal', 'mask' : "[.**]", rightAlign: true});
         $(".mdate").inputmask("99-99-9999", {
        placeholder: "__-__-____", // Customize the placeholder
        showMaskOnHover: false    // Do not show mask on hover
      });

      // Handle blur event
      $(".mdate").on("blur", function() {
        const inputValue = $(this).val();
        const isValidDate = isValidDateInput(inputValue);
        
        if (!isValidDate) {
          // Clear the value if the date is invalid
          $(this).val("");
        }
      });

      // Helper function to check if a date input is valid
      function isValidDateInput(inputValue) {
        // Use a regular expression to validate the date format (DD-MM-YYYY)
        const dateRegex = /^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\d{4}$/;
        return dateRegex.test(inputValue);
      }
});

$(".custom2").inputmask('Regex', {regex: "^[0-9]{1,6}(\\.\\d{1,2})?$", rightAlign: true});

$(".custom3").inputmask({'alias': 'numeric', allowMinus: false, digits: 2, max: 999.99});

$(function() {
    $('.custom4').maskMoney();
  });


</script>
     @yield('page-script')
  </body>
</html>

