'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": "", "from_date": "", "to_date": "", }; // // change from date(from date) // $scope.changeDate = function () { // if($scope.batch.from_date !== undefined) { // var formate = "dd-MM-yyyy"; // $scope.batch.from_date = $filter('date')(new Date($scope.batch.from_date), formate); // } else { // $scope.searchData.date = ''; // } // } // // change to date(to date) // $scope.changeToDate = function () { // if($scope.batch.to_date !== undefined) { // var formate = "dd-MM-yyyy"; // $scope.batch.to_date = $filter('date')(new Date($scope.batch.to_date), formate); // //$scope.getDayBookList(); // } else { // $scope.batch.to_date = ''; // // $scope.getDayBookList(); // } // } $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.mstatusr = ''; $scope.mmessage = ''; 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.mstatusList == true) { $scope.mstatusr = response.data.mstatusr; } else { $scope.mmessage = response.data.mmessage; } }); } $scope.cert_Submit = function() { //alert($scope.batch.name); $scope.cert_status = ''; $scope.cert_message = ''; var msta = { method: 'POST', url: apiPoint.url + 'reportcert_status/', 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.cert_statusList == true) { $scope.cert_status = response.data.cert_status; } else { $scope.cert_message = response.data.cert_message; } }); } $scope.mark_cert_Submit = function() { //alert($scope.batch.name); console.log($scope.batch); $scope.markcert_status = ''; $scope.markcert_message = ''; var msta = { method: 'POST', url: apiPoint.url + 'reportmark_cert_status/', headers: { 'Content-Type': 'application/json' }, data: { bname : $scope.batch.name, brname : $scope.batch.brname, univ : $scope.batch.univ, from : $scope.batch.from_date, to : $scope.batch.to_date } }; $http(msta).then(function (response) { if (response.data.markcert_statusList == true) { $scope.markcert_status = response.data.markcert_status; } else { $scope.markcert_message = response.data.markcert_message; } }); } $scope.expense_Submit = function() { $scope.expense = ''; $scope.expense_message = ''; var msta = { method: 'POST', url: apiPoint.url + 'reportexpense/', headers: { 'Content-Type': 'application/json' }, data: { from : $scope.batch.from_date, to : $scope.batch.to_date } }; $http(msta).then(function (response) { if (response.data.expense_list == true) { $scope.expense = response.data.expense; } else { $scope.expense_message = response.data.expense_message; } }); } }]);