-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
114 lines (88 loc) · 3.05 KB
/
main.js
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
function clearMenu(){
$("#li_mmnu_home").removeClass('active');
$("#li_mmnu_myProfile").removeClass('active');
$("#li_mmnu_manage_users").removeClass('active');
$("#li_mmnu_manage_collections").removeClass('active');
$("#li_mmnu_manage_items").removeClass('active');
$("#li_mmnu_deposit").removeClass('active');
$("#li_mmnu_import").removeClass('active');
$("#li_mmnu_export").removeClass('active');
}
function createItem(){
$.ajax({
// The URL for the request
url: "Controller/item-create.php",
type: "GET",
success: function( data ) {
console.log(data);
$("#main").load("View/deposit-item.php?itemid="+data)
//$("#main").load("View/items.php")
},
// Code to run if the request fails; the raw request and
// status codes are passed to the function
error: function( xhr, status, errorThrown ) {
console.log(errorThrown);
alert( "Sorry, there was a problem!" );
},
complete: function( xhr, status){
}
}); //$.ajax({
}
function changeCurrentSchema(){
const schema = $("#schema").val();
$.get( "Controller/change-current-schema.php?schema="+schema, function( data ) {
console.log(data);
location.reload();
});
}
$(document).ready(function(){
//$("#main").load("dashboard.php")
// MENU ACTIONS
$("#mmnu_home" ).click(function() {
$("#main").load("View/dashboard.php");
clearMenu();
$("#li_mmnu_home").addClass('active');
});
$("#mmnu_myProfile" ).click(function() {
$("#main").load("View/my-profile.php");
clearMenu();
$("#li_mmnu_myProfile").addClass('active');
});
$("#mmnu_manage_users" ).click(function() {
$("#main").load("View/cataloguers.php");
clearMenu();
$("#li_mmnu_manage_users").addClass('active');
});
$("#mmnu_manage_collections" ).click(function() {
$("#main").load("View/classes.php",function(response,status,xhr){
//console.log(response);
});
clearMenu();
$("#li_mmnu_manage_collections").addClass('active');
});
$("#mmnu_manage_items" ).click(function() {
$("#main").load("View/items.php",function(response,status,xhr){
// console.log(response);
});
clearMenu();
$("#li_mmnu_manage_items").addClass('active');
});
$("#mmnu_deposit" ).click(function() {
createItem();
clearMenu();
$("#li_mmnu_deposit").addClass('active');
});
$("#mmnu_import" ).click(function() {
$("#main").load("View/import.php");
clearMenu();
$("#li_mmnu_import").addClass('active');
});
$("#mmnu_export" ).click(function() {
$("#main").load("View/export.php");
clearMenu();
$("#li_mmnu_export").addClass('active');
});
$("#main").load("View/items.php");
clearMenu();
$("#li_mmnu_manage_items").addClass('active');
});