1
2
3
4
5
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
|
const constants ={
cabinFieldsValues: "cabin_fields_values"
};
kendo.culture("no");
$(document).ready(function () {
$("#log-out-button").on("click", function () {
$.get("/api/account/logout", null, function () {
location.replace("/");
})
});
$('.ui.checkbox')
.checkbox()
;
$('.ui.dropdown').dropdown();
$('.ui.radio.checkbox').checkbox();
$('.selection.dropdown').dropdown();
$('.ui.calendar').calendar({
type: 'date'
});
$('.accordion')
.accordion({
selector: {
trigger: '.title'
}
});
$("#sidebar-menu-toggler").on("click", function () {
let target = $(this).data("target");
$(target)
.sidebar({
dimPage: true,
scrollLock: true,
exclusive: true,
delaySetup: true,
useLegacy: "auto",
duration: 250,
mobileTransition: "overlay",
transition: "overlay"
})
.sidebar("toggle");
});
$(".image-wrap-link").on("click", function (e) {
if (e.target.currentSrc) window.open(e.target.currentSrc, "_blank");
});
$(document).on("click", ".k-overlay", function () {
let kendoWindow = $(
".k-window-content.k-content",
$(this).next("div.k-widget.k-window")
);
if (kendoWindow == null || kendoWindow.length === 0) return;
let grid = $(".k-grid");
kendoWindow.data("kendoWindow").close();
if (grid.length) {
grid
.getKendoGrid()
.cancelChanges();
}
});
$("#profile-options-button").on("click", function (e) {
let form = $("#edit-profile-form");
let modal = $("#profile-settings-modal");
modal.modal("show", {
onHidden: form.off()
});
form.on("submit", function (e) {
let password=$("#password").val();
let passwordOnceMore = $("#password-again").val();
if(password !== passwordOnceMore) {
$.notificate("Ugyldig", "Passordene er forksjellige", "error");
return;
}
$.ajax({
url: "/api/account/password",
method: "put",
data: JSON.stringify({
passwordOnceMore,
password
}),
processData: false,
contentType: "application/json",
success: function (e) {
modal.modal("hide");
$.notificate("Passord oppdatert", "Passordet ditt er oppdatert", "success");
},
error: function (e) {
$.notificate("En feil oppstod", e.responseJSON.error ? e.responseJSON.error : "Vennligst prøv igjen senere", "erorr");
}
})
})
})
});
|