source: resources/assets/js/custom.js@ b375b43

develop
Last change on this file since b375b43 was b39afb5, checked in by beratkjufliju <kufliju@…>, 3 years ago

minor bug fixes

  • Property mode set to 100644
File size: 7.0 KB
Line 
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_folder_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
14 if(currentText)
15 archId.val(selectedId + "/" + currentText);
16 else
17 archId.val(selectedId + "/");
18 });
19
20 $(".new_folder_deparment").change(function() {
21 var archId = $("input[name='arch_id']");
22 var selectedId = $(this).find('option:selected').data('dept-code');
23
24 archId.val(selectedId + "/");
25 });
26
27 $(window).on('load', function () {
28 setTimeout(function () {
29 $('.layout-builder').removeClass('show');
30 }, 500);
31 });
32
33 $('.body').append(`
34 <div class="layout-builder show">
35 <div class="layout-builder-toggle shw">
36 <i class="ti-settings"></i>
37 </div>
38 <div class="layout-builder-toggle hdn">
39 <i class="ti-close"></i>
40 </div>
41 <div class="layout-builder-body">
42 <h5>Customizer</h5>
43 <div class="mb-3">
44 <p>Layout</p>
45 <div class="custom-control custom-radio">
46 <input type="radio" class="custom-control-input" name="layout" id="horizontal-side-menu" data-layout="horizontal-side-menu">
47 <label class="custom-control-label" for="horizontal-side-menu">Horizontal Menu</label>
48 </div>
49 <div class="custom-control custom-radio">
50 <input type="radio" class="custom-control-input" name="layout" id="icon-side-menu" data-layout="icon-side-menu">
51 <label class="custom-control-label" for="icon-side-menu">Icon Menu</label>
52 </div>
53 <div class="custom-control custom-radio">
54 <input type="radio" class="custom-control-input" name="layout" id="hidden-side-menu" data-layout="hidden-side-menu">
55 <label class="custom-control-label" for="hidden-side-menu">Hidden Menu</label>
56 </div>
57 <div class="custom-control custom-radio">
58 <input type="radio" class="custom-control-input" name="layout" id="layout-container-1" data-layout="layout-container icon-side-menu">
59 <label class="custom-control-label" for="layout-container-1">Container Layout 1</label>
60 </div>
61 <div class="custom-control custom-radio">
62 <input type="radio" class="custom-control-input" name="layout" id="layout-container-2" data-layout="layout-container horizontal-side-menu">
63 <label class="custom-control-label" for="layout-container-2">Container Layout 2</label>
64 </div>
65 <div class="custom-control custom-radio">
66 <input type="radio" class="custom-control-input" name="layout" id="layout-container-3" data-layout="layout-container hidden-side-menu">
67 <label class="custom-control-label" for="layout-container-3">Container Layout 3</label>
68 </div>
69 <div class="custom-control custom-radio">
70 <input type="radio" class="custom-control-input" name="layout" id="dark-1" data-layout="dark">
71 <label class="custom-control-label" for="dark-1">Dark Layout 1</label>
72 </div>
73 <div class="custom-control custom-radio">
74 <input type="radio" class="custom-control-input" name="layout" id="dark-2" data-layout="layout-container dark icon-side-menu">
75 <label class="custom-control-label" for="dark-2">Dark Layout 2</label>
76 </div>
77 <div class="custom-control custom-radio">
78 <input type="radio" class="custom-control-input" name="layout" id="dark-3" data-layout="layout-container dark horizontal-side-menu">
79 <label class="custom-control-label" for="dark-3">Dark Layout 3</label>
80 </div>
81 <div class="custom-control custom-radio">
82 <input type="radio" class="custom-control-input" name="layout" id="dark-4" data-layout="layout-container dark hidden-side-menu">
83 <label class="custom-control-label" for="dark-4">Dark Layout 4</label>
84 </div>
85 </div>
86 <button id="btn-layout-builder-reset" class="btn btn-danger btn-uppercase">Reset</button>
87 <div class="layout-alert mt-3">
88 <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.
89 </div>
90 </div>
91 </div>`);
92
93 var site_layout = localStorage.getItem('site_layout');
94 $('body').addClass(site_layout);
95
96 $('.layout-builder .layout-builder-body input[type="radio"][data-layout="' + $('body').attr('class') + '"]').prop('checked', true);
97
98 $('.layout-builder .layout-builder-body input[type="radio"]').click(function () {
99 var class_names = '';
100
101 $('.layout-builder .layout-builder-body input[type="radio"]:checked').each(function () {
102 class_names += ' ' + $(this).data('layout');
103 });
104
105 localStorage.setItem('site_layout', class_names);
106
107 window.location.href = (window.location.href).replace('#', '');
108 });
109
110 $(document).on('click', '#btn-layout-builder', function () {
111
112 });
113
114 $(document).on('click', '#btn-layout-builder-reset', function () {
115 localStorage.removeItem('site_layout');
116 localStorage.removeItem('site_layout_dark');
117
118 window.location.href = (window.location.href).replace('#', '');
119 });
120
121 $(window).on('load', function () {
122 if ($('body').hasClass('horizontal-side-menu') && $(window).width() > 768) {
123 if ($('body').hasClass('layout-container')) {
124 $('.side-menu .side-menu-body').wrap('<div class="container"></div>');
125 } else {
126 $('.side-menu .side-menu-body').wrap('<div class="container"></div>');
127 }
128 setTimeout(function () {
129 $('.side-menu .side-menu-body > ul').append('<li><a href="#"><span>Other</span></a><ul></ul></li>');
130 }, 100);
131 $('.side-menu .side-menu-body > ul > li').each(function () {
132 var index = $(this).index(),
133 $this = $(this);
134 if (index > 7) {
135 setTimeout(function () {
136 $('.side-menu .side-menu-body > ul > li:last-child > ul').append($this.clone());
137 $this.addClass('d-none');
138 }, 100);
139 }
140 });
141 }
142 });
143
144 $(document).on('click', '[data-attr="layout-builder-toggle"]', function () {
145 $('.layout-builder').toggleClass('show');
146 return false;
147 });
148
149})(jQuery);
Note: See TracBrowser for help on using the repository browser.