apollodec/Apollo/assets/js/controllers/reportCtrl.js
2018-04-03 17:19:48 +05:30

101 lines
2.6 KiB
JavaScript

'use strict';
/*** controller for Wizard Form example***/
app.controller('reportCtrl', ["$scope", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',
function ($scope, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window) {
$scope.batch = {
"name": "",
"brname": "",
"univ": "",
};
$scope.batch = function () {
var bat = {
method: 'POST',
url: apiPoint.url + 'reportbatchlist/',
headers: {
'Content-Type': 'application/json'
}
};
$http(bat).then(function (response) {
if (response.data) {
$scope.batch = response.data.batch;
$scope.branch = response.data.branch;
$scope.univ = response.data.univ;
console.log($scope.branch);
} else {
}
});
}
$scope.onSubmit = function() {
//alert($scope.batch.name);
$scope.statusr = '';
$scope.message = '';
var sta = {
method: 'POST',
url: apiPoint.url + 'reportstatus/',
headers: {
'Content-Type': 'application/json'
},
data: {
bname : $scope.batch.name,
brname : $scope.batch.brname,
univ : $scope.batch.univ
}
};
$http(sta).then(function (response) {
if (response.data.statusList == true) {
$scope.statusr = response.data.statusr;
} else {
$scope.message = response.data.message;
}
});
}
$scope.mSubmit = function() {
//alert($scope.batch.name);
$scope.statusr = '';
$scope.message = '';
var msta = {
method: 'POST',
url: apiPoint.url + 'reportmstatus/',
headers: {
'Content-Type': 'application/json'
},
data: {
bname : $scope.batch.name,
brname : $scope.batch.brname,
univ : $scope.batch.univ
}
};
$http(msta).then(function (response) {
if (response.data.statusList == true) {
$scope.mstatusr = response.data.mstatusr;
} else {
$scope.mmessage = response.data.message;
}
});
}
}]);