130 lines
3.5 KiB
JavaScript
Executable File
130 lines
3.5 KiB
JavaScript
Executable File
'use strict';
|
|
/*** controller***/
|
|
app.controller('report_study_material_statusCtrl', ["$scope", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',
|
|
function ($scope,apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window, DTOptionsBuilder, DTColumnBuilder) {
|
|
|
|
// DataTables configurable options
|
|
|
|
|
|
$scope.filters = {
|
|
"branch": "",
|
|
"university": "",
|
|
"batch": "",
|
|
|
|
};
|
|
|
|
$scope.filters = function () {
|
|
var filterlist = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'report_filters/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
}
|
|
|
|
};
|
|
$http(filterlist).then(function (response) {
|
|
if (response.data) {
|
|
$scope.batch = response.data.batch;
|
|
$scope.branch = response.data.branch;
|
|
$scope.university = response.data.university;
|
|
//console.log($scope.branch);
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.onSubmit = function() {
|
|
//alert($scope.batch.name);
|
|
$scope.study_mat_data = '';
|
|
$scope.message = '';
|
|
var response_data = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'report_status/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
branch : $scope.filters.branch,
|
|
university : $scope.filters.university,
|
|
batch : $scope.filters.batch
|
|
}
|
|
|
|
};
|
|
|
|
$http(response_data).then(function (response) {
|
|
if (response.data.statusList == true) {
|
|
$scope.study_mat_data = response.data.statusr;
|
|
|
|
} else {
|
|
$scope.message = response.data.message;
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
var mystyle = {
|
|
sheetid: 'STUDY MATERIAL STATUS REPORT',
|
|
headers: true,
|
|
caption: {
|
|
title:'STUDY MATERIAL STATUS REPORT',
|
|
width: '300px',
|
|
style:'font-size:50px;'
|
|
},
|
|
// style:'background:#00FF00',
|
|
column: {
|
|
style:'font-size:10px;'
|
|
},
|
|
// row: {
|
|
// style:'border:1px solid black; padding-left:5px; padding-right:5px'
|
|
// },
|
|
// columns: [
|
|
// {columnid:'email'},
|
|
// {columnid:'dob', title: 'Birthday', width:300},
|
|
// {columnid:'name'},
|
|
// {
|
|
// columnid:'name',
|
|
// title: 'Number of letters in name',
|
|
// width: '300px',
|
|
// cell: {
|
|
// value: function(value){return value.length}
|
|
// }
|
|
// },
|
|
// ],
|
|
// row: {
|
|
// style: function(sheet,row,rowidx){
|
|
// return 'background:'+(rowidx%2?'red':'yellow');
|
|
// }
|
|
// },
|
|
// rows: {
|
|
// 'border:1px black dotted; padding-left:5px; padding-right:5px'
|
|
// 4:{cell:{style:'background:blue'}}
|
|
// },
|
|
// cells: {
|
|
// 2:{
|
|
// 2:{
|
|
// style: 'font-size:45px;background:pink',
|
|
// value: function(value){return value.substr(1,3);}
|
|
// }
|
|
// }
|
|
// }
|
|
};
|
|
|
|
|
|
|
|
$scope.exportData = function () {
|
|
alasql('SELECT * INTO XLS("Study_material_status.xls",?) FROM ?',[mystyle,$scope.study_mat_data]);
|
|
};
|
|
|
|
|
|
|
|
$scope.exportExcel= function () {
|
|
alasql('SELECT * INTO XLSX("Study_material_status.xlsx",{headers:true}) \
|
|
FROM HTML("#data",{headers:true})');
|
|
}
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|