-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIncidentTracker.html
187 lines (174 loc) · 8.72 KB
/
IncidentTracker.html
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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script type="text/javascript" src="http://czchowsint1385/sites/clarity/knowledge/IncidentManagementPortal/SiteAssets/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/dataTables.jqueryui.min.css">
<!--script src="https://cdn.datatables.net/1.10.16/js/dataTables.jqueryui.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.jqueryui.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/dataTables.jqueryui.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.jqueryui.min.css"><!--//jQuery UI Reference-->
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
<script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.print.min.js"></script>
<script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.bootstrap.min.css">
<style>
#table_id_filter{
float: left;
position: fixed !important;
top: 185px !important;
right: 30px;
padding: 15px;
border-radius: 10px !important;
}
</style>
</head>
<body>
<table id="table_id" class="table table-striped table-bordered" cellspacing="0" width="100%" height="100%">
<thead>
<tr>
<th>Report No:</th>
<th>Incident Title</th>
<th>Date of Incident</th>
<th>Actual date of Closure</th>
<th>Business Impact/Severity</th>
<th>Region</th>
<th>Country</th>
<th>City</th>
<th>Site/Location</th>
<th>Case Status</th>
<th>Client Name / WLT Office Name</th>
<th>Corrective Actions with Deadlines and action Owner</th>
<th>Employee Comments</th>
<th>ERM Contact</th>
<th>Logged By</th>
<th>Target date of closure</th>
<th>View</th>
<th>Edit</th>
</tr>
</thead>
</table>
<script>
$(document).ready(function() {
loadItems();
$(window).scroll(function () {
if ($(this).scrollTop() != 0) {
$('#table_id_filter').fadeOut();
}
else {
$('#table_id_filter').fadeIn();
}
});
});
function loadItems() {
var siteUrl = _spPageContextInfo.webAbsoluteUrl;
var oDataUrl = siteUrl + "/_api/web/lists/getbytitle('IncidentTool')/items";
$.ajax({
url: oDataUrl,
type: "GET",
dataType: "json",
headers: {
"accept": "application/json;odata=verbose"
},
success: mySuccHandler,
error: myErrHandler
});
}
function mySuccHandler(data) {
try {
var dataTableExample = $('#table_id').DataTable();
if (dataTableExample != 'undefined') {
dataTableExample.destroy();
}
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
dataTableExample= $('#table_id').DataTable({
lengthChange: false,
buttons: [ 'copy', 'excel', 'pdf', 'colvis' ],
"aaData": data.d.results,
"aoColumns": [{
"mData": "Report_x0020_No_x002e_"
}, {
"mData": "Title"
}, {
"mData": "Date_x0020_of_x0020_Incident",
"render": function(mData) {
var date = new Date(mData);
var month = date.getMonth();
return date.getDate() + "-" +months[month] + "-" + date.getFullYear();
}
},{
"mData": "Actual_x0020_Date_x0020_of_x0020",
"render": function(mData) {
var date = new Date(mData);
var month = date.getMonth();
return date.getDate() + "-" +months[month] + "-" + date.getFullYear();
}
},{
"mData": "Business_x0020_Impact_x002F_Seve"
},{
"mData": "WLTRegion"
},{
"mData": "Country"
},{
"mData": "City"
},{
"mData": "Site_x002F_Location"
},{
"mData": "Case_x0020_Status"
},{
"mData": "Client_x0020_Name_x0020__x002F__"
},{
"mData": "Corrective_x0020_Actions_x0020_w"
},{
"mData": "Employee_x0020_Comments"
},{
"mData": "Contact"
},{
"mData": "Logged_x0020_By"
},{
"mData": "Target_x0020_Date_x0020_of_x0020",
"render": function(mData) {
var date = new Date(mData);
var month = date.getMonth();
return date.getDate() + "-" +months[month] + "-" + date.getFullYear();
}
},{
"mData":"ID",
"render": function(mData,type,row, meta) {
var value = new Object(mData);
return '<a href="http://czchowsint1385/sites/clarity/knowledge/IncidentManagementPortal/SitePages/ViewIncident.aspx?reportno=' + value +'" class="btn btn-info" role="button"><span class="glyphicon glyphicon-file"></span></a>';
}
},{
"mData": "ID" ,
"render": function(mData,type,row, meta) {
var value = new Object(mData);
return '<a href="http://czchowsint1385/sites/clarity/knowledge/IncidentManagementPortal/SitePages/NewIncidentForm.aspx?reportno=' + value +'" class="btn btn-info" role="button"><span class="glyphicon glyphicon-pencil"></span></a>';
}
}]
});
//dataTableExample.buttons().container().insertBefore( '#table_id_filter' ); ----jQuery code----
dataTableExample.buttons().container().appendTo( '#table_id_wrapper .col-sm-6:eq(0)' );
} catch (e) {
alert(e.message);
}
}
function myErrHandler(data, errCode, errMessage) {
alert("Error: " + errMessage);
}
</script>
</body>
</html>