@if(!Auth::check() || Auth::user()->status!=1)
    <script>
        window.location.replace('{{route('home')}}');
    </script>
@endif
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    @php
        $br = getBranch();
    @endphp
    <title>{{$br->name??'Net-solution'}}</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" href="{{asset($br->logo??LogoImage())}}">
    <meta charset="utf-8">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    {{--------------------------------FONT AWSOME 4.7.0-------------------------------------}}
    <link rel="stylesheet" href="{{asset('assets/font-awesome-4.7.0/css/font-awesome.css')}}">

    {{--------------------------------CSS ANMATION 3.2.3-------------------------------------}}
    <link rel="stylesheet" href="{{asset('assets/css/animate.min.css')}}">

    {{--------------------------------JQUERY 3.4.1-------------------------------------}}
    <script src="{{asset('assets/js/jquery3.4.1.min.js')}}"></script>

    {{--------------------------------BOOTSTRAP 3.4.0-------------------------------------}}
    <link rel="stylesheet" href="{{asset('assets/css/bootstrap.min.css')}}">

    {{--------------------------------DATATABLE -------------------------------------}}

    <link rel="stylesheet" href="{{asset('assets/css/jquery.dataTables.min.css')}}">

    {{--------------------------------Date Picker -------------------------------------}}
    <link rel="stylesheet" href="{{ asset('assets/plugin/date-picker/bootstrap-datepicker.css') }}">

    {{--------------------------------Jquery Confirm -------------------------------------}}
    <link rel="stylesheet" href="{{asset('assets/css/jquery-confirm.css')}}">

    {{--------------------------------Select 2 -------------------------------------}}
    <link rel="stylesheet" type="text/css" href="{{asset('assets/js/select2/select2.css')}}">

    {{--------------------------------CUSTOMIZE-------------------------------------}}

    {{--    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/dashboard-menu.css')}}">--}}
    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/breadcrumb.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/loading.css')}}">
    {{--    <link rel="stylesheet" href="{{ asset('assets/css/images-upload.css') }}">--}}
    <link rel="stylesheet" href="{{ asset('assets/js/timepicker/bootstrap-timepicker.min.css') }}">
    <link rel="stylesheet" href="{{ asset('assets/css/jquery.toast.min.css') }}">
    {{--    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/admin-menu.css')}}">--}}
    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/styles.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/purchase.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/production.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('assets/css/sale-pos.css')}}">

    <!-- Bootstrap time Picker -->
    <link rel="stylesheet" href="{{asset('assets/js/timepicker/jquery.timepicker.css')}}">
    <link rel="stylesheet" href="{{asset('assets/js/timepicker/bootstrap-timepicker.min.css')}}">
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">


    <link rel="stylesheet" href="{{ asset('assets/plugin/tippy/jbox.css') }}">

    <style>
        @font-face {
            font-family: nso-font;
            src: url('{{asset('assets/font/KhmerOSbattambang.ttf')}}');
        }

        *, h1, h2, h3, h4, h5, h6 {
            font-family: nso-font, serif;
            line-height: 1.1;
        }

        body {
            font-family: nso-font, serif !important;
            height: 100vh;
        }

        /*===============================Loading bar==================================*/
        .pace {
            -webkit-pointer-events: none;
            pointer-events: none;

            -webkit-user-select: none;
            -moz-user-select: none;
            user-select: none;
        }

        .pace-inactive {
            display: none;
        }

        .pace .pace-progress {
            background: red;
            position: fixed;
            z-index: 2000;
            top: 0;
            right: 100%;
            width: 100%;
            height: 2px;
            opacity: 1;
        }

         .select2 {
            width: 100% !important;
        }

        .item-show .item-show-name {
            background-color: #6C86E7;
            width: 100%;
            float: left;
            color: #fff;
            padding: 5px;
            text-align: center;
        }

        .label-right td:first-child {
            border: none;
        }

        .wrapper-table {
            margin-top: 10px;
        }

        .shadow-red {
            box-shadow: 0 0 3px 0.5px rgba(231, 76, 60, 1) !important;
        }

        table img {
            cursor: pointer;
        }

        .table {
            white-space: nowrap;
        }

        table .select2 {
            width: 100% !important;
        }

        .overflow-x-hidden {
            overflow-x: hidden;
        }

        .datepicker-dropdown {
            width: 200px;
        }

        .show_percentage {
            display: none;
        }

        .nav > li > a {
            font-size: 11px;
            padding-left: 8px;
            padding-right: 8px;
            border-right: 1px solid rgba(236, 240, 241, 0.2);
        }

        a {
            text-decoration: none;
        }
        .cursor-pointer{
            cursor: pointer;
        }
        .table thead td{
            border-top: 1px solid rgba(1,1,1,0.9)!important;
        }
        .jBox-Notice{
            z-index: 1111111111111111!important;
        }
    </style>
    <style>
        .po-box{
            padding: 4px
        }
        .po-box .item-show-name li{
            line-height: 18px!important;
            font-size: 12px;
        }
        .po-box .btn-default{
            padding: 5px;
        }
        .po-box img{
            border-radius: 5px;
        }
        .btn-save-excel {
            display: none
        }
    </style>
    @php
        $route = Route::current();
        $name = Route::currentRouteName();
        $action = Route::currentRouteAction();
        $arr_route = $route->originalParameters();
        if($arr_route){
            $url_key = array_keys($arr_route)[0];
            $url_val = $arr_route[$url_key];
        }else{
        $url_key='';
        $url_val='';
        }
    @endphp
</head>

<body class="fadeIn animated" >

<?php Fun::lang()?>
<div class="app_body" style="display: none">
    @yield('main')
</div>

<div class="lds-ring">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>

<script src="{{asset('assets/js/jquery-confirm.js')}}"></script>
<script src="{{asset('assets/js/jquery.form.js')}}"></script>
<script src="{{asset('assets/js/jquery.dataTables.min.js')}}"></script>

<script src="{{asset('assets/js/select2/select2.min.js')}}"></script>
<script src="{{asset('assets/js/sidebar/collapse.min.js')}}"></script>
<script src="{{asset('assets/js/jquery.custom-file-input.js')}}"></script>
<script src="{{asset('assets/js/loading.js')}}"></script>
<script src="{{asset('assets/js/bootstrap.min.js')}}"></script>
<script src="{{ asset('assets/js/jquery.toast.min.js') }}"></script>
<script src="{{ asset('assets/js/toastDemo.js') }}"></script>
<script src="{{ asset('assets/js/images-upload.js') }}"></script>
<script src="{{ asset('assets/js/printThis.js') }}"></script>
<script src="{{ asset('assets/js/jquerysession.js') }}"></script>
<script src="{{asset('assets/js/timepicker/moment.min.js')}}"></script>
<script src="{{asset('assets/js/timepicker/jquery.timepicker.js')}}"></script>
<script src="{{asset('assets/js/timepicker/bootstrap-timepicker.min.js')}}"></script>
<script src="{{asset('assets/js/barcode.js')}}"></script>

{{--jquery ui no datepicker--}}
<script src="{{asset('assets/js/jquery-ui.js')}}"></script>
<script src="{{ asset('assets/plugin/date-picker/bootstrap-datepicker.js') }}"></script>
<script src="{{asset('assets/plugin/tippy/jbox.js')}}"></script>



{{--export button datatable--}}
<script src="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css"></script>
<script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js"></script>


@yield('script')
@include('js-function.js-function', ['data' => ''])

<script type="text/javascript">
    console.log('%c មើលអីអូនសម្លាញ់ !!', 'border:10px solid #2980b9;border-radius:10px;background:#2ecc71;padding:50px 80px 50px 50px; margin:0 auto;font-weight: bold; font-size: 50px;color: red; text-shadow: 3px 3px 0 rgb(217,31,38) , 6px 6px 0 rgb(226,91,14) , 9px 9px 0 rgb(245,221,8) , 12px 12px 0 rgb(5,148,68) , 15px 15px 0 rgb(2,135,206) , 18px 18px 0 rgb(4,77,145) , 21px 21px 0 rgb(42,21,113)');
    $(document).ready(function () {
        setTimeout(function () {
            if($('.search_product').length){
                search_something('product', '.search_product');
            }
            if($('.search_material').length) {
                search_something('material', '.search_material');
            }
            if($('.search_lead').length) {
                search_lead();
            }
        }, 100);





        getNotification('tra')
        getNotification('sa')

        getNotification('sr')
        getNotification('pr')

        getNotification('tr')



    });
    function getNotification(type) {
        $.get('{{route('get-notification-alert')}}',{type},function (res) {
            if(res=='0'){
                $(document).find(`span:contains(:${type}:)`).closest('.badge').remove()
            }else{
                $(document).find(`span:contains(:${type}:)`).text(res)
            }
        })
    }
    function search_lead() {
        $(".search_lead").select2({
            tags: true,
            tokenSeparators: [','],
            minimumInputLength: 0,
            minimumResultsForSearch: 0,
            ajax: {
                url: '{{route('select2-search-lead')}}',
                dataType: "json",
                type: "GET",
                data: function (term) {
                    return {
                        term: term,
                    };
                },
                processResults: function (data) {
                    return {
                        results: data
                    };
                }
            }
        });
    }
    function search_something($type, class_) {
        $(document).find(`${class_}`).select2({
            tags: true,
            tokenSeparators: [','],
            minimumInputLength: 0,
            minimumResultsForSearch: 0,
            ajax: {
                url: '{{route('select2-search-product')}}',
                dataType: "json",
                type: "GET",
                data: function (term) {
                    return {
                        term: term,
                        type: $type
                    };
                },
                processResults: function (data) {
                    return {
                        results: data
                    };
                }
            }
        });
    }
    function toFloat($something) {
        if (typeof $something === "undefined")$something = 0;

        $something = ($something + '').replaceAll(',', '')
        return $something ? parseFloat($something) : 0
    }
</script>
</body>
</html>





