3bc9af21
Yarik
Layout
|
1
2
3
4
|
$(document).ready(function(){
footer();
cabinet();
formsHome();
|
f1b535e4
Yarik
Datepicker
|
5
|
initDatePicker();
|
3bc9af21
Yarik
Layout
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
function footer(){
footerBottom();
resizeFooterBottom();
function footerBottom(){
var heightHeader = $('.section-box-header').height()
var heightFooter = $('.section-box-footer').height()
var windowHeight = $(window).height()
$('.section-box-content').css({minHeight:windowHeight-heightHeader-heightFooter})
}
function resizeFooterBottom(){
$(window).resize(function(){
footerBottom();
})
}
}
function cabinet() {
sidebar();
forms();
tabsContentOiv();
function sidebar() {
|
7f0970a7
Yarik
Layout
|
31
32
33
|
$('.second-list a').click(function(e) {
e.stopPropagation();
});
|
3bc9af21
Yarik
Layout
|
34
|
$('.list-cab li').click(function (e) {
|
7f0970a7
Yarik
Layout
|
35
36
37
|
if($(this).hasClass('disabled')) {
e.preventDefault();
return false;
|
3bc9af21
Yarik
Layout
|
38
|
}
|
7f0970a7
Yarik
Layout
|
39
40
41
42
43
44
45
|
var dropDownList = $(this).find('ul').length;
if(dropDownList){
e.preventDefault();
$('.list-cab li').removeClass('active-li');
$(this).addClass('active-li');
}
});
|
3bc9af21
Yarik
Layout
|
46
|
|
3bc9af21
Yarik
Layout
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
}
function forms() {
if($('.phone-input input').length){
$('.phone-input input').mask('+38 (000) 000 00 00');
}
}
function tabsContentOiv() {
$('.oiv-list li').click(function (e) {
e.preventDefault()
if($(this).hasClass('active-list-oiv')){
} else {
$('.table-wrapp-2').after('<div id="preload-cab"><div></div></div>')
$('.oiv-list li').removeClass('active-list-oiv')
$(this).addClass('active-list-oiv')
var thisNum = $(this).index()
var cabContent = $('.hidden-tables-oiv')
setTimeout(function () {
cabContent.removeClass('active-tab-oiv')
$(cabContent[thisNum]).addClass('active-tab-oiv')
$('#preload-cab').remove()
},800)
}
})
}
}
function formsHome() {
$('.btn_login, .btn_login_2').click(function (e) {
e.preventDefault()
var pos = ($(window).scrollTop())+20
$('#overlay').fadeIn(400,
function(){
$('#login_form')
.css('display', 'block')
.animate({opacity: 1, top: pos}, 200);
});
})
$('#modal_close, #overlay').click( function(){
$('.forms_').animate({opacity: 0, top: '0'}, 200,function(){
$(this).css('display', 'none');
$('#overlay').fadeOut(400);
});
});
$('.btn_register').click( function(e){
e.preventDefault()
var pos = ($(window).scrollTop())+20
$('#login_form').animate({opacity: 0, top: '-50px'}, 200,function(){
$('#register_form')
.css('display', 'block')
.animate({opacity: 1, top: pos}, 200);
});
});
$('#login_form form button').click(function (e) {
if($('#input-1').val().length<1){
e.preventDefault()
$('#input-1').addClass('errors')
} else {
$('#input-1').removeClass('errors')
}
if($('#input-2').val().length<1){
e.preventDefault()
$('#input-2').addClass('errors')
} else {
$('#input-2').removeClass('errors')
}
})
$('#register_form form button').click(function (e) {
if($('#input-3').val().length<1){
e.preventDefault()
$('#input-3').addClass('errors')
} else {
$('#input-3').removeClass('errors')
}
if($('#input-4').val().length<1){
e.preventDefault()
$('#input-4').addClass('errors')
} else {
$('#input-4').removeClass('errors')
}
if($('#input-5').val().length<1){
e.preventDefault()
$('#input-5').addClass('errors')
} else {
$('#input-5').removeClass('errors')
}
})
}
|
30e3d244
Yarik
Forms
|
144
145
146
147
148
149
|
$(document).on('beforeSubmit', '#personal-form', function(e) {
postForm(this);
return false;
});
|
3533e4e9
Yarik
Forms
|
150
151
152
153
154
|
$(document).on('beforeSubmit', '#users-add-form', function(e) {
postForm(this, true, 'users-table', true, true);
return false;
});
|
30e3d244
Yarik
Forms
|
155
156
157
158
159
|
$(document).on('beforeSubmit', '#passport-form', function(e) {
postForm(this);
return false;
});
|
43cb22d0
Yarik
Property
|
160
161
162
163
164
|
$(document).on('beforeSubmit', '#property-form', function(e) {
postForm(this);
return false;
});
|
f1b535e4
Yarik
Datepicker
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
$(document).on('pjax:complete', function() {
initDatePicker();
});
function initDatePicker() {
$('._datepicer, ._datepicker')
.datepicker(
{
changeMonth: true,
changeYear: true,
dateFormat: 'dd.mm.yy',
closeText: 'Закрыть',
prevText: 'Пред',
nextText: 'След',
monthNames: [
'Январь',
'Февраль',
'Март',
'Апрель',
'Май',
'Июнь',
'Июль',
'Август',
'Сентябрь',
'Октябрь',
'Ноябрь',
'Декабрь'
],
monthNamesShort: [
'Январь',
'Февраль',
'Март',
'Апрель',
'Май',
'Июнь',
'Июль',
'Август',
'Сентябрь',
'Октябрь',
'Ноябрь',
'Декабрь'
],
dayNames: [
'воскресенье',
'понедельник',
'вторник',
'среда',
'четверг',
'пятница',
'суббота'
],
dayNamesShort: [
'вск',
'пнд',
'втр',
'срд',
'чтв',
'птн',
'сбт'
],
dayNamesMin: [
'Вс',
'Пн',
'Вт',
'Ср',
'Чт',
'Пт',
'Сб'
],
firstDay: 1
}
);
}
|
3533e4e9
Yarik
Forms
|
239
|
function postForm(context, reload_pjax, pjax, close, reset) {
|
30e3d244
Yarik
Forms
|
240
241
242
243
244
245
|
$.post($(context).attr('action'), $(context).serialize(), function(data) {
var type;
if(data.error) {
type = 'danger';
} else {
type = 'success';
|
3533e4e9
Yarik
Forms
|
246
247
248
249
250
251
|
if(close) {
tryClose(context);
}
if(reset) {
context.reset();
}
|
30e3d244
Yarik
Forms
|
252
253
|
}
showStatus(data.message, type);
|
3533e4e9
Yarik
Forms
|
254
255
256
257
258
259
260
|
if(reload_pjax) {
if(pjax) {
reload(pjax);
} else {
reload($(context).parents('.pjax_container').attr('id'));
}
}
|
30e3d244
Yarik
Forms
|
261
262
263
|
}.bind(this));
}
|
3533e4e9
Yarik
Forms
|
264
265
266
267
|
function tryClose(context) {
$(context).parents('.modal').modal('hide');
}
|
30e3d244
Yarik
Forms
|
268
269
270
271
272
273
274
275
276
277
278
279
|
function showStatus(txt, type) {
$.notify({
message: txt
}, {
type: type
});
}
function reload(id) {
$('#'+id).prepend('<div class="preloader"></div>');
$.pjax.reload('#'+id);
}
|
dcfb3d5c
Alexey Boroda
-Form ajax ready
|
280
281
282
283
284
285
286
287
288
289
290
|
$(document).on('beforeSubmit', '#add-int-prop-form', function() {
$.post($(this).attr('action'), $(this).serialize(), function(data) {
var type;
if(data.error) {
type = 'danger';
} else {
type = 'success';
}
$('#add-composition-modal').modal('hide');
showStatus(data.message, type);
|
fb0f9630
Alexey Boroda
-Greed ready
|
291
|
$.pjax.reload('#int-prop-greed');
|
dcfb3d5c
Alexey Boroda
-Form ajax ready
|
292
293
294
295
296
|
document.getElementById('add-int-prop-form').reset();
});
return false;
});
|
0d91ef5d
Alexey Boroda
-Delete action added
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
$(document).on('beforeSubmit', '#add-role-form', function() {
$.post($(this).attr('action'), $(this).serialize(), function(data) {
var type;
if(data.error) {
type = 'danger';
} else {
type = 'success';
}
$('#add-role-modal').modal('hide');
showStatus(data.message, type);
$.pjax.reload('#roles-table');
document.getElementById('add-role-form').reset();
});
return false;
});
$(document).on('click', '.delete-role', function(e) {
e.preventDefault();
|
aebb725c
Alexey Boroda
-List ready
|
317
|
confirm('Удалить роль?');
|
0d91ef5d
Alexey Boroda
-Delete action added
|
318
319
320
|
$.post('delete-role', {
id:$(this).attr('data-id')
}, function(data) {
|
aebb725c
Alexey Boroda
-List ready
|
321
322
323
324
325
326
327
328
329
330
|
var type;
if(data.error) {
type = 'danger';
} else {
type = 'success';
}
showStatus(data.message, type);
$.pjax.reload('#roles-table');
});
});
|
0d91ef5d
Alexey Boroda
-Delete action added
|
331
|
|
aebb725c
Alexey Boroda
-List ready
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
$(document).on('click', '.remove-int-prop', function(e) {
e.preventDefault();
confirm('Удалить элемент?');
$.post('delete-int-property', {
id:$(this).attr('data-id')
}, function(data) {
var type;
if(data.error) {
type = 'danger';
} else {
type = 'success';
}
showStatus(data.message, type);
$.pjax.reload('#int-property-table');
|
0d91ef5d
Alexey Boroda
-Delete action added
|
346
347
|
});
});
|
3bc9af21
Yarik
Layout
|
348
349
350
351
352
|
});
|