| 31211 |
tejbeer |
1 |
$(function() {
|
|
|
2 |
|
|
|
3 |
$(document).on('click', ".monthly-target", function() {
|
|
|
4 |
loadMonthlyTarget("main-content");
|
|
|
5 |
});
|
|
|
6 |
|
|
|
7 |
$(document).on('click', "#monthlytargetdownload", function() {
|
|
|
8 |
|
|
|
9 |
window.location.href = context + "/downloadMonthlyTargetTemplate";
|
|
|
10 |
})
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
$(document).on('click', '#yearmonthtarget-submit', function() {
|
|
|
14 |
let yearMonth = $("#yearmonthtarget").val();
|
|
|
15 |
loadMonthWiseTarget('#main-content', yearMonth);
|
|
|
16 |
|
|
|
17 |
});
|
|
|
18 |
$(document).on('click', ".monthlyTargetUpload", function() {
|
|
|
19 |
|
|
|
20 |
console.log("hello");
|
|
|
21 |
if (confirm('Confirm upload ?')) {
|
|
|
22 |
var fileSelector = $(this)[0];
|
|
|
23 |
console.log(fileSelector)
|
|
|
24 |
if (fileSelector != undefined) {
|
|
|
25 |
var url = `${context}/monthlyTargetUploader`;
|
|
|
26 |
console.log(url);
|
|
|
27 |
var file = $("#monthlytargetfile")[0].files[0];
|
|
|
28 |
let fileInput = $(this);
|
|
|
29 |
console.log("file" + file);
|
|
|
30 |
console.log("fileInput" + fileInput);
|
|
|
31 |
doAjaxUploadRequestHandler(
|
|
|
32 |
url,
|
|
|
33 |
'POST',
|
|
|
34 |
file, function(response) {
|
|
|
35 |
|
|
|
36 |
console.log(response)
|
|
|
37 |
|
|
|
38 |
if (response == true) {
|
|
|
39 |
alert("successfully uploaded");
|
|
|
40 |
|
|
|
41 |
loadMonthlyTarget("main-content");
|
|
|
42 |
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
});
|
|
|
47 |
|
|
|
48 |
}
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
});
|
|
|
52 |
|
|
|
53 |
});
|
|
|
54 |
|
|
|
55 |
function loadMonthlyTarget(domId) {
|
|
|
56 |
doGetAjaxRequestHandler(context + "/monthlyTarget", function(response) {
|
|
|
57 |
$('#' + domId).html(response);
|
|
|
58 |
|
|
|
59 |
});
|
|
|
60 |
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
function loadMonthWiseTarget(domId, yearMonth) {
|
|
|
64 |
|
|
|
65 |
console.log(yearMonth)
|
|
|
66 |
|
|
|
67 |
doGetAjaxRequestHandler(`${context}/targetHistory?yearMonth=${yearMonth}`, function(response) {
|
|
|
68 |
$('.monthly-target-table-container').html(response);
|
|
|
69 |
});
|
|
|
70 |
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
|