<!-- Core JS files -->
<script src="{{ asset('assetics/admin/global_assets/js/main/jquery.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/main/bootstrap.bundle.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/loaders/blockui.min.js') }}"></script>
<!-- /core JS files -->

<!-- Theme JS files -->
<script src="{{ asset('assetics/admin/global_assets/js/plugins/visualization/d3/d3.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/visualization/d3/d3_tooltip.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/ui/moment/moment.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/pickers/daterangepicker.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/forms/inputs/touchspin.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/tables/datatables/datatables.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/notifications/jgrowl.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/notifications/noty.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/ui/moment/moment.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/pickers/daterangepicker.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/pickers/pickadate/picker.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/pickers/pickadate/picker.date.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/pickers/pickadate/picker.time.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/pickers/pickadate/legacy.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/extensions/jquery_ui/interactions.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/forms/selects/select2.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/notifications/jgrowl.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/notifications/noty.min.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/plugins/notifications/sweet_alert.min.js') }}"></script>

{% if app.user and app.user.appTheme == 1 %}
    <script src="{{ asset('assetics/admin/js/app_dark.js') }}"></script>
{% elseif context.get['app'].appTheme == 1 %}
    <script src="{{ asset('assetics/admin/js/app_dark.js') }}"></script>
{% else %}
    <script src="{{ asset('assetics/admin/js/app.js') }}"></script>
{% endif %}


<script src="{{ asset('assetics/admin/global_assets/js/demo_pages/dashboard.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/demo_pages/datatables_advanced.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/demo_pages/components_modals.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/demo_pages/form_input_groups.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/demo_pages/extra_jgrowl_noty.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/demo_pages/picker_date.js') }}"></script>
<script src="{{ asset('assetics/admin/global_assets/js/demo_pages/form_select2.js') }}"></script>

<script src="{{ asset('bundles/fosjsrouting/js/router.min.js') }}"></script>
<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script>
{{ encore_entry_script_tags('admin') }}

<script>
    $(function () {
        let messages = document.querySelectorAll('#notyf-message')
        messages.forEach((message) => {
            if (message.className === 'success'){
                new Noty({
                    text: message.innerHTML,
                    layout: 'topRight',
                    type: 'success'
                }).show();
            }
            if (message.className === 'danger'){
                new Noty({
                    text: message.innerHTML,
                    layout: 'topRight',
                    type: 'error'
                }).show();
            }
            if (message.className === 'info'){
                new Noty({
                    text: message.innerHTML,
                    layout: 'topRight',
                    type: 'info'
                }).show();
            }
            if (message.className === 'warning'){
                new Noty({
                    text: message.innerHTML,
                    layout: 'topRight',
                    type: 'warning'
                }).show();
            }
        })

        $('[data-toggle="popover"]').popover()
        $('[data-toggle="tooltip"]').tooltip()
        // Select with search
        $('.select-search').select2({});
        $('.tags-select').select2({
            tags: true,
            placeholder: 'Sélectionnez un ou plusieurs elements...',
            /*tokenSeparators: [',', ' ']*/
        })/*.on('change', function (e) {
            let label = $(this).find("[data-select2-tag=true]")
            if (label.length && $.inArray(label.val(), $(this).val() !== -1)) {
                $.ajax({
                    url: '/admin/ajax/add/tag/unites/' + label.val(),
                    type: 'POST',
                    dataType: 'json',
                }).done(function (data) {
                    label.replaceWith(`<option selected value="${data.id}">${label.val()}</option>`)
                })
            }
        })*/;
    })
</script>