1 | 'use strict';
|
---|
2 |
|
---|
3 | (function ($) {
|
---|
4 |
|
---|
5 | $(document).on('click', '.layout-builder .layout-builder-toggle', function () {
|
---|
6 | $('.layout-builder').toggleClass('show');
|
---|
7 | });
|
---|
8 |
|
---|
9 | $(".edit_document_deparment").change(function() {
|
---|
10 | var archId = $("input[name='arch_id']");
|
---|
11 | var currentText = archId.val().split("/")[1];
|
---|
12 | var selectedId = $(this).find('option:selected').data('dept-code');
|
---|
13 | if(currentText)
|
---|
14 | archId.val(selectedId + "/" + currentText);
|
---|
15 | else
|
---|
16 | archId.val(selectedId + "/");
|
---|
17 | });
|
---|
18 |
|
---|
19 | $(window).on('load', function () {
|
---|
20 | setTimeout(function () {
|
---|
21 | $('.layout-builder').removeClass('show');
|
---|
22 | }, 500);
|
---|
23 | });
|
---|
24 |
|
---|
25 | $('.body').append(`
|
---|
26 | <div class="layout-builder show">
|
---|
27 | <div class="layout-builder-toggle shw">
|
---|
28 | <i class="ti-settings"></i>
|
---|
29 | </div>
|
---|
30 | <div class="layout-builder-toggle hdn">
|
---|
31 | <i class="ti-close"></i>
|
---|
32 | </div>
|
---|
33 | <div class="layout-builder-body">
|
---|
34 | <h5>Customizer</h5>
|
---|
35 | <div class="mb-3">
|
---|
36 | <p>Layout</p>
|
---|
37 | <div class="custom-control custom-radio">
|
---|
38 | <input type="radio" class="custom-control-input" name="layout" id="horizontal-side-menu" data-layout="horizontal-side-menu">
|
---|
39 | <label class="custom-control-label" for="horizontal-side-menu">Horizontal Menu</label>
|
---|
40 | </div>
|
---|
41 | <div class="custom-control custom-radio">
|
---|
42 | <input type="radio" class="custom-control-input" name="layout" id="icon-side-menu" data-layout="icon-side-menu">
|
---|
43 | <label class="custom-control-label" for="icon-side-menu">Icon Menu</label>
|
---|
44 | </div>
|
---|
45 | <div class="custom-control custom-radio">
|
---|
46 | <input type="radio" class="custom-control-input" name="layout" id="hidden-side-menu" data-layout="hidden-side-menu">
|
---|
47 | <label class="custom-control-label" for="hidden-side-menu">Hidden Menu</label>
|
---|
48 | </div>
|
---|
49 | <div class="custom-control custom-radio">
|
---|
50 | <input type="radio" class="custom-control-input" name="layout" id="layout-container-1" data-layout="layout-container icon-side-menu">
|
---|
51 | <label class="custom-control-label" for="layout-container-1">Container Layout 1</label>
|
---|
52 | </div>
|
---|
53 | <div class="custom-control custom-radio">
|
---|
54 | <input type="radio" class="custom-control-input" name="layout" id="layout-container-2" data-layout="layout-container horizontal-side-menu">
|
---|
55 | <label class="custom-control-label" for="layout-container-2">Container Layout 2</label>
|
---|
56 | </div>
|
---|
57 | <div class="custom-control custom-radio">
|
---|
58 | <input type="radio" class="custom-control-input" name="layout" id="layout-container-3" data-layout="layout-container hidden-side-menu">
|
---|
59 | <label class="custom-control-label" for="layout-container-3">Container Layout 3</label>
|
---|
60 | </div>
|
---|
61 | <div class="custom-control custom-radio">
|
---|
62 | <input type="radio" class="custom-control-input" name="layout" id="dark-1" data-layout="dark">
|
---|
63 | <label class="custom-control-label" for="dark-1">Dark Layout 1</label>
|
---|
64 | </div>
|
---|
65 | <div class="custom-control custom-radio">
|
---|
66 | <input type="radio" class="custom-control-input" name="layout" id="dark-2" data-layout="layout-container dark icon-side-menu">
|
---|
67 | <label class="custom-control-label" for="dark-2">Dark Layout 2</label>
|
---|
68 | </div>
|
---|
69 | <div class="custom-control custom-radio">
|
---|
70 | <input type="radio" class="custom-control-input" name="layout" id="dark-3" data-layout="layout-container dark horizontal-side-menu">
|
---|
71 | <label class="custom-control-label" for="dark-3">Dark Layout 3</label>
|
---|
72 | </div>
|
---|
73 | <div class="custom-control custom-radio">
|
---|
74 | <input type="radio" class="custom-control-input" name="layout" id="dark-4" data-layout="layout-container dark hidden-side-menu">
|
---|
75 | <label class="custom-control-label" for="dark-4">Dark Layout 4</label>
|
---|
76 | </div>
|
---|
77 | </div>
|
---|
78 | <button id="btn-layout-builder-reset" class="btn btn-danger btn-uppercase">Reset</button>
|
---|
79 | <div class="layout-alert mt-3">
|
---|
80 | <i class="fa fa-warning m-r-5 text-warning"></i>Some theme options can not be displayed in case of combined when they are not relevant each other. For that reason, you are adviced to try all theme options seperately.
|
---|
81 | </div>
|
---|
82 | </div>
|
---|
83 | </div>`);
|
---|
84 |
|
---|
85 | var site_layout = localStorage.getItem('site_layout');
|
---|
86 | $('body').addClass(site_layout);
|
---|
87 |
|
---|
88 | $('.layout-builder .layout-builder-body input[type="radio"][data-layout="' + $('body').attr('class') + '"]').prop('checked', true);
|
---|
89 |
|
---|
90 | $('.layout-builder .layout-builder-body input[type="radio"]').click(function () {
|
---|
91 | var class_names = '';
|
---|
92 |
|
---|
93 | $('.layout-builder .layout-builder-body input[type="radio"]:checked').each(function () {
|
---|
94 | class_names += ' ' + $(this).data('layout');
|
---|
95 | });
|
---|
96 |
|
---|
97 | localStorage.setItem('site_layout', class_names);
|
---|
98 |
|
---|
99 | window.location.href = (window.location.href).replace('#', '');
|
---|
100 | });
|
---|
101 |
|
---|
102 | $(document).on('click', '#btn-layout-builder', function () {
|
---|
103 |
|
---|
104 | });
|
---|
105 |
|
---|
106 | $(document).on('click', '#btn-layout-builder-reset', function () {
|
---|
107 | localStorage.removeItem('site_layout');
|
---|
108 | localStorage.removeItem('site_layout_dark');
|
---|
109 |
|
---|
110 | window.location.href = (window.location.href).replace('#', '');
|
---|
111 | });
|
---|
112 |
|
---|
113 | $(window).on('load', function () {
|
---|
114 | if ($('body').hasClass('horizontal-side-menu') && $(window).width() > 768) {
|
---|
115 | if ($('body').hasClass('layout-container')) {
|
---|
116 | $('.side-menu .side-menu-body').wrap('<div class="container"></div>');
|
---|
117 | } else {
|
---|
118 | $('.side-menu .side-menu-body').wrap('<div class="container"></div>');
|
---|
119 | }
|
---|
120 | setTimeout(function () {
|
---|
121 | $('.side-menu .side-menu-body > ul').append('<li><a href="#"><span>Other</span></a><ul></ul></li>');
|
---|
122 | }, 100);
|
---|
123 | $('.side-menu .side-menu-body > ul > li').each(function () {
|
---|
124 | var index = $(this).index(),
|
---|
125 | $this = $(this);
|
---|
126 | if (index > 7) {
|
---|
127 | setTimeout(function () {
|
---|
128 | $('.side-menu .side-menu-body > ul > li:last-child > ul').append($this.clone());
|
---|
129 | $this.addClass('d-none');
|
---|
130 | }, 100);
|
---|
131 | }
|
---|
132 | });
|
---|
133 | }
|
---|
134 | });
|
---|
135 |
|
---|
136 | $(document).on('click', '[data-attr="layout-builder-toggle"]', function () {
|
---|
137 | $('.layout-builder').toggleClass('show');
|
---|
138 | return false;
|
---|
139 | });
|
---|
140 |
|
---|
141 | })(jQuery);
|
---|