'use strict'; /** * controllers for ng-table * Simple table with sorting and filtering on AngularJS */ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$sessionStorage", "$http", "$state", function ($scope, $rootScope, toaster, $filter, ngTableParams, apiPoint, $sessionStorage, $http, $state) { /* * used to get dash board call track details * this method called from view ng-init directive * created by kms * */ $scope.getLoginType = JSON.parse(sessionStorage.getItem('localObj')).localType; $scope.loginType = JSON.parse(sessionStorage.getItem('localsessionObj')).localType; console.log($scope.getLoginType) console.log($scope.loginType) $scope.initCallTracking = function () { $rootScope.pendingFolloupDetails = []; var getCallTrack = { method: 'POST', url: apiPoint.url + 'getDashboardCallTrack/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(getCallTrack).then(function (response) { /* if(response.data.status == 200 && response.data.followupStatus){ $scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2); $scope.getFollowupDetails = response.data.details; angular.forEach($scope.getFollowupDetails, function (value, key) { if (($scope.currentDate) < (value[0].FollowupOn)) { $rootScope.pendingFolloupDetails.push(value[0]); console.log($rootScope.pendingFolloupDetails); } }); } else{ }*/ if (response.data.status == 200) { if (response.data.todayStatus) { $scope.todayFolloupDetails = response.data.todayFolloupDetails.trackingDetails; $scope.emptyDataToday = false; } else { $scope.todayFolloupDetails = ""; $scope.emptyDataToday = true; } if (response.data.todayPendingStatus) { // $scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2); // $scope.currentDate = new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2); $scope.currentDate = $filter('date')(new Date(), 'yyyy-MM-dd'); $scope.fetchFolloupDetails = response.data.PendingFolloupDetails.trackingDetails; angular.forEach($scope.fetchFolloupDetails, function (value, key) { var getDay = value.FollowupOn.substring(0, 2); var getMonth = value.FollowupOn.substring(3, 5); var getYear = value.FollowupOn.substring(6, 10); // var dbFollowDate = getYear+'-'+getMonth+'-'+getDay; $scope.dbFollowDate = getYear + '-' + getMonth + '-' + getDay; if (($scope.currentDate) > ($scope.dbFollowDate) && (value.statusName != 'CLOSE')) { $rootScope.pendingFolloupDetails.push(value); } }); if ($rootScope.pendingFolloupDetails.length == 0) { $scope.emptyDataPending = true; } else { $scope.emptyDataPending = false; } } else { $scope.pendingFolloupDetails = ""; $scope.emptyDataPending = true; } if (response.data.todayLeadStatus) { $scope.leadDetails = response.data.todayLeadDetails.trackingDetails; $scope.emptyDataLead = false; } else { $scope.leadDetails = ""; $scope.emptyDataLead = true; } } else { $scope.emptyDataToday = true; $scope.emptyDataPending = true; } }); }; //this function used to filter the university var univb ; $scope.get_uni = function() { //console.log($scope.filters.univ); univb = $scope.filters.univ; console.log(univb) } /*For dashboard tab*/ //To filters $scope.filters = { "year": "", "month": "", "batch": "", "univ": "", "fout_univ": "", "fout_year": "", //"univb": "" , } //to store filter data $scope.year = ''; $scope.branch = ''; $scope.univ = ''; $scope.fyr = ''; $scope.batch =''; // $scope.univb='', var fYear = { method: 'POST', url: apiPoint.url + 'filterYear/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType, batch: JSON.parse(sessionStorage.getItem('localObj')).localBatch, } }; $http(fYear).then(function (response) { if (response.data.yearList == true) { $scope.year = response.data.year; $scope.branch = response.data.branch; $scope.univ = response.data.univ; $scope.fyr = response.data.fyr; $scope.batch =response.data.batch; // console.log($scope.branch); } else { $scope.message = response.data.message; } }); //End of filters $scope.l_dataToday = ''; $scope.sl_dataToday = ''; $scope.l_dataMonth = ''; $scope.sl_dataMonth = ''; $scope.l_dataDayClosed = ''; $scope.sl_dataDayClosed = ''; $scope.l_dataMonthClosed = ''; $scope.sl_dataMonthClosed = ''; $scope.adMonth = ''; $scope.adYear = ''; $scope.fout = ''; $scope.ftoday = ''; $scope.sftoday = ''; $scope.fpending = ''; $scope.sfpending = ''; $scope.adBatch = ''; $scope.adBatchfilter = ''; $scope.Dt_leadtoday = ''; $scope.Dt_leadmonth = ''; $scope.Dt_dataDayClosed = ''; $scope.Dt_dataMonthClosed = ''; $scope.Dt_ftoday = ''; $scope.Dt_fpending = ''; $scope.grid; $scope.initDashboardDetails = function () { //lead today var leadToday = { method: 'POST', url: apiPoint.url + 'leadToday/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(leadToday).then(function (response) { if (response.data.lList == true) { $scope.l_dataToday = response.data.l_data; for (var i = 0; i < $scope.l_dataToday.length; i++) $scope.l_dataToday[i].Sl_No = i + 1; $scope.lt = false; //To staff $scope.sl_dataToday = response.data.sl_data; for (var i = 0; i < $scope.sl_dataToday.length; i++) $scope.sl_dataToday[i].Sl_No = i + 1; $scope.ltl = false; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005') { $scope.Dt_leadtoday = $scope.sl_dataToday; // console.log($scope.Dt_leadtoday); // console.log('if'); } else { $scope.Dt_leadtoday = $scope.l_dataToday; // console.log($scope.Dt_leadtoday); // console.log('else'); } } else { $scope.ltl = true; $scope.lt = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.todayLead = { showBorders: true, "export": { enabled: true, fileName: "TodayLeads", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'Dt_leadtoday' }, columns: ['TrackingId','date', 'name', 'mobileNo', 'course', 'university', 'activity', 'AssignTo', 'followUpDate', 'status'] }; //lead month var leadMonth = { method: 'POST', url: apiPoint.url + 'leadMonth/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(leadMonth).then(function (response) { if (response.data.lList == true) { $scope.l_dataMonth = response.data.l_data; for (var i = 0; i < $scope.l_dataMonth.length; i++) $scope.l_dataMonth[i].Sl_No = i + 1; $scope.lm = false; //to staff $scope.sl_dataMonth = response.data.sl_data; for (var i = 0; i < $scope.sl_dataMonth.length; i++) $scope.sl_dataMonth[i].Sl_No = i + 1; $scope.lml = false; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005') { $scope.Dt_leadmonth = $scope.sl_dataMonth; // console.log($scope.Dt_leadmonth); // console.log('if'); } else { $scope.Dt_leadmonth = $scope.l_dataMonth; // console.log($scope.Dt_leadmonth); // console.log('else'); } } else { $scope.lm = true; $scope.lml = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.monthLead = { showBorders: true, "export": { enabled: true, fileName: "MonthLeads", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'Dt_leadmonth' }, columns: ['TrackingId','date','name', 'mobileNo', 'course', 'university', 'activity', 'AssignTo', 'followUpDate','status',] }; //lead closed today var leadTodayClosed = { method: 'POST', url: apiPoint.url + 'leadTodayClosed/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(leadTodayClosed).then(function (response) { if (response.data.lList == true) { $scope.l_dataDayClosed = response.data.l_data; for (var i = 0; i < $scope.l_dataDayClosed.length; i++) $scope.l_dataDayClosed[i].Sl_No = i + 1; $scope.cd = false; //to staff $scope.sl_dataDayClosed = response.data.sl_data; for (var i = 0; i < $scope.sl_dataDayClosed.length; i++) $scope.sl_dataDayClosed[i].Sl_No = i + 1; $scope.cdl = false; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005') { $scope.Dt_dataDayClosed = $scope.sl_dataDayClosed; // console.log($scope.Dt_dataDayClosed); // console.log('if'); } else { $scope.Dt_dataDayClosed = $scope.l_dataDayClosed; // console.log($scope.Dt_dataDayClosed); // console.log('else'); } // console.log($scope.l_dataDayClosed); } else { $scope.cd = true; $scope.cd1 = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.todayLeadClosed = { showBorders: true, "export": { enabled: true, fileName: "TodayLeadsClosed", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'Dt_dataDayClosed' }, columns: ['TrackingId', 'name', 'mobileNo', 'course', 'university', 'activity', 'AssignTo', 'followUpDate', 'status'] }; //lead closed this month var leadMonthClosed = { method: 'POST', url: apiPoint.url + 'leadMonthClosed/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(leadMonthClosed).then(function (response) { if (response.data.lList == true) { $scope.l_dataMonthClosed = response.data.l_data; for (var i = 0; i < $scope.l_dataMonthClosed.length; i++) $scope.l_dataMonthClosed[i].Sl_No = i + 1; $scope.cm = false; //to Staff $scope.sl_dataMonthClosed = response.data.sl_data; for (var i = 0; i < $scope.sl_dataMonthClosed.length; i++) $scope.sl_dataMonthClosed[i].Sl_No = i + 1; $scope.cml = false; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.Dt_dataMonthClosed = $scope.sl_dataMonthClosed; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.Dt_dataMonthClosed = $scope.l_dataMonthClosed; // console.log($scope.Dt_dataMonthClosed); // console.log('else'); } // console.log($scope.l_dataMonthClosed); } else { $scope.cm = true; $scope.cml = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.monthLeadClosed = { showBorders: true, "export": { enabled: true, fileName: "LeadClosedMonth", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'Dt_dataMonthClosed' }, columns: ['TrackingId', 'name', 'mobileNo', 'course', 'university', 'activity', 'AssignTo', 'followUpDate', 'status'] }; //Admissions week-wise var admissionMonth = { method: 'POST', url: apiPoint.url + 'admissionMonth/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType, year: $scope.filters.year, month: $scope.filters.month } }; $http(admissionMonth).then(function (response) { if (response.data.lList == true) { $scope.adMonth = response.data.l_data; for (var i = 0; i < $scope.adMonth.length; i++) $scope.adMonth[i].Sl_No = i + 1; $scope.ad = false; // console.log($scope.adMonth); } else { $scope.ad = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.admgrid = { columnAutoWidth: true, showBorders: true, "export": { enabled: true, fileName: "AdmissionsMonth", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'adMonth' }, columns: ['Sl_No', 'university', { dataField: "week1", dataType: "number" }, { dataField: "week2", dataType: "number" }, { dataField: "week3", dataType: "number" }, { dataField: "week4", dataType: "number" }, { dataField: "week5", dataType: "number" }, { dataField: "Total", dataType: "number" }, 'AdmissionTakenBy'], summary: { totalItems: [ { summaryType: "sum", displayFormat: "{0}", column: "Total" }] }, }; //Admissions Year-wise var admissionYear = { method: 'POST', url: apiPoint.url + 'admissionYear/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(admissionYear).then(function (response) { if (response.data.lList == true) { $scope.adYear = response.data.l_data; for (var i = 0; i < $scope.adYear.length; i++) $scope.adYear[i].Sl_No = i + 1; $scope.ady = false; //console.log($scope.adYear); } else { $scope.ady = true; $scope.message = response.data.message; } }); //Data grid $scope.filterRow = { visible: true, applyFilter: "auto" }; $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.adYeargrid = { showBorders: true, columnAutoWidth: true, //columnWidth: 100, "export": { enabled: true, fileName: "AdmissionsYear", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { //filterRow: "filterRow", showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'adYear' }, columns: [{ dataField: 'Sl_No', width: 50 }, { dataField: 'university', width: 200 }, { dataField: "June", dataType: "number", width: 60 }, { dataField: "July", dataType: "number", width: 60 }, { dataField: "August", dataType: "number", width: 60 }, { dataField: "September", dataType: "number", width: 60 }, { dataField: "October", dataType: "number", width: 60 }, { dataField: "November", dataType: "number", width: 60 }, { dataField: "December", dataType: "number", width: 60 }, { dataField: "January", dataType: "number", width: 60 }, { dataField: "February", dataType: "number", width: 60 }, { dataField: "March", dataType: "number", width: 60 }, { dataField: "April", dataType: "number", width: 60 }, { dataField: "May", dataType: "number", width: 60 }, { dataField: "total", dataType: "number", width: 60 }, { dataField: 'gad', cssClass: 'WrappedColumnClass', width: 300 }], }; //Fees outstanding var fOut = { method: 'POST', url: apiPoint.url + 'feeOutstanding/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(fOut).then(function (response) { if (response.data.lList == true) { $scope.fout = response.data.l_data; for (var i = 0; i < $scope.fout.length; i++) $scope.fout[i].Sl_No = i + 1; $scope.fo = false; //console.log($scope.fo); } else { $scope.fo = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.FeeOut = { columnAutoWidth: true, showBorders: true, "export": { enabled: true, fileName: "FeesOutstanding", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'fout' }, columns: [{ dataField: "Sl_No", dataType: "number", width:50 }, { dataField: "Batches", dataType: "number", // width:100 }, { dataField: "TotalPayableFee", dataType: "number", // width:80 }, { dataField: "TotalPaidFee", dataType: "number", // width:80 }, { dataField: "TotalBalance", dataType: "number", // width:80 }, { dataField: "BalancePercentage", cssClass: "cls", // dataType: "number", // width:80 }, { dataField: "BalancePercentageByStaff", cssClass: 'WrappedColumnClass', width: 300 }], summary: { totalItems: [ { summaryType: "sum", displayFormat: "{0}", column: "TotalPayableFee" },{ summaryType: "sum", displayFormat: "{0}", column: "TotalPaidFee" }, { summaryType: "sum", displayFormat: "{0}", column: "TotalBalance" }] }, }; //Follow ups today var ftoday = { method: 'POST', url: apiPoint.url + 'followupsToday/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(ftoday).then(function (response) { if (response.data.lList == true) { $scope.ftoday = response.data.l_data; for (var i = 0; i < $scope.ftoday.length; i++) $scope.ftoday[i].Sl_No = i + 1; $scope.fut = false; //to staff $scope.sftoday = response.data.sl_data; for (var i = 0; i < $scope.sftoday.length; i++) $scope.sftoday[i].Sl_No = i + 1; $scope.futl = false; // console.log($scope.ftoday); if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.Dt_ftoday = $scope.sftoday; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.Dt_ftoday = $scope.ftoday; // console.log($scope.Dt_dataMonthClosed); // console.log('else'); } } else { $scope.fut = true; $scope.futl = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.FollowToday = { columnAutoWidth: true, showBorders: true, "export": { enabled: true, fileName: "FollowUpToday", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'Dt_ftoday' }, columns: ['TrackingId', 'name', 'mobileNo', 'course', 'university', 'activity', 'AssignTo', 'FollowUpDate', 'status'] }; //Follow ups pending var fpending = { method: 'POST', url: apiPoint.url + 'followupsPending/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; // console.log(JSON.parse(sessionStorage.getItem('localObj')).localType); $http(fpending).then(function (response) { if (response.data.lList == true) { $scope.fpending = response.data.l_data; for (var i = 0; i < $scope.fpending.length; i++) $scope.fpending[i].Sl_No = i + 1; $scope.fp = false; //to staff $scope.fpl = false; $scope.sfpending = response.data.sl_data; for (var i = 0; i < $scope.sfpending.length; i++) $scope.sfpending[i].Sl_No = i + 1; // console.log($scope.fpending); // console.log($scope.sfpending); if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.Dt_fpending = $scope.sfpending; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.Dt_fpending = $scope.fpending; // console.log($scope.Dt_fpending); // console.log('else'); } } else { $scope.fp = true; $scope.fp1 = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.FollowPending = { columnAutoWidth: true, showBorders: true, "export": { enabled: true, fileName: "PendingFollowup", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'Dt_fpending' }, columns: ['TrackingId', 'name', 'mobileNo', 'course', 'university', 'activity', 'AssignTo', 'FollowUpDate', 'status'] }; //Admissions batch var AdmissionsBatch = { method: 'POST', url: apiPoint.url + 'admissionBatch/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, batch:$scope.filters.batch, univ: $scope.filters.univ } }; var gridData = 0; $http(AdmissionsBatch).then(function (response) { console.log(response); if (response.data.lList == true) { $scope.fbselect = false; $scope.adBatch = response.data.l_data; for (var i = 0; i < $scope.adBatch.length; i++) $scope.adBatch[i].Sl_No = i + 1; var gridData = $scope.adBatch; $scope.adb = false; //console.log($scope.adBatch); $scope.adBatchgrid = { allowSortingBySummary: true, allowSorting: true, allowFiltering: true, height: 440, showBorders: true, fieldChooser: { enabled: false }, // scrolling: { // mode: "virtual" // }, fieldPanel: { showColumnFields: true, showDataFields: true, showFilterFields: true, showRowFields: true, allowFieldDragging: true, visible: true }, "export": { enabled: true, fileName: "AdmissionsBatch" }, dataSource: { fields: [{ caption: "BatchName", width: 100, dataField: "BatchName", area: "row" }, { caption: "AdmittedBy", dataField: "AdmittedBy", area: "column" }, { caption: "count", dataField: "count", dataType: "number", //summaryType: "sum", width: 100, area: "data" }], store: $scope.adBatch } }; } else { $scope.adb = true; $scope.message = response.data.message; } }); }; //function for batch filter $scope.batchFilter = function () { //console.log('hi'); $scope.adBatchgrid1 = ''; //Admissions batch var AdmissionsBatch = { method: 'POST', url: apiPoint.url + 'admissionBatch/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, univ: $scope.filters.univ } }; //var gridData = 0; $http(AdmissionsBatch).then(function (response) { if (response.data.lList == true) { $scope.adBatch = ''; $scope.adBatchfilter = ''; $scope.fbselect = true; $scope.adb = false; $scope.adBatchfilter = response.data.l_data; for (var i = 0; i < $scope.adBatchfilter.length; i++) $scope.adBatchfilter[i].Sl_No = i + 1; var gridData = $scope.adBatch; $scope.adb = false; $scope.adBatchgrid1 = { onInitialized: function (e) { $scope.grid = e.component; }, allowSortingBySummary: true, allowSorting: true, allowFiltering: true, allowExpandAll: true, height: 440, showBorders: true, fieldChooser: { enabled: false }, fieldPanel: { showColumnFields: true, showDataFields: true, showFilterFields: true, showRowFields: true, allowFieldDragging: true, visible: true }, "export": { enabled: true, fileName: "AdmissionsBatch" }, dataSource: { fields: [{ caption: "BatchName", width: 100, dataField: "BatchName", area: "row" }, { caption: "AdmittedBy", dataField: "AdmittedBy", area: "column" }, { caption: "count", dataField: "count", dataType: "number", //summaryType: "sum", area: "data" }], store: $scope.adBatchfilter } }; $scope.batchFilterClick(); } else { $scope.fbselect = false; $scope.message = response.data.message; } }); } $scope.batchFilterClick = function () { $scope.grid.option('dataSource', { fields: [{ caption: "BatchName", width: 100, dataField: "BatchName", area: "row" }, { caption: "AdmittedBy", dataField: "AdmittedBy", dataType: "string", area: "column" }, { caption: "AdmittedBy", dataField: "AdmittedBy", dataType: "number", //summaryType: "sum", // width: 100, area: "data" }], store: $scope.adBatchfilter }); } //// $scope.foutFilter = function(){ $scope.fout = ''; var fOut = { method: 'POST', url: apiPoint.url + 'feeOutstanding/', headers: { 'Content-Type': 'application/json' }, data: { univ: $scope.filters.fout_univ, requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; // console.log($scope.filters.fout_univ); // console.log(JSON.parse(sessionStorage.getItem('localObj')).localBranchID); $http(fOut).then(function (response) { if (response.data.lList == true) { $scope.fout = response.data.l_data; for (var i = 0; i < $scope.fout.length; i++) // $scope.fout[i].Sl_No = i + 1; $scope.fo = false; //console.log($scope.fout); } else { $scope.fo = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.FeeOut = { columnAutoWidth: true, showBorders: true, "export": { enabled: true, fileName: "FeesOutstanding", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'fout' }, columns: [ //{ // dataField: "Sl_No", // dataType: "number", // //width:50 // }, { dataField: "Batches", dataType: "number", // width:100 }, { dataField: "TotalPayableFee", dataType: "number", // width:80 }, { dataField: "TotalPaidFee", dataType: "number", // width:80 }, { dataField: "TotalBalance", dataType: "number", // width:80 }, { dataField: "BalancePercentage", dataType: "number", // width:80 }, { dataField: "BalancePercentageByStaff", cssClass: 'WrappedColumnClass', width: 300 }], summary: { totalItems: [ { summaryType: "sum", displayFormat: "{0}", column: "TotalPayableFee" },{ summaryType: "sum", displayFormat: "{0}", column: "TotalPaidFee" }, { summaryType: "sum", displayFormat: "{0}", column: "TotalBalance" }] }, }; } $scope.fyearFilter = function(){ var admissionYear = { method: 'POST', url: apiPoint.url + 'admissionYear/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType, fyear: $scope.filters.fout_year } }; // console.log($scope.filters.fout_year); //console.log(JSON.parse(sessionStorage.getItem('localObj')).localBranchID); $http(admissionYear).then(function (response) { if (response.data.lList == true) { $scope.adYear = response.data.l_data; for (var i = 0; i < $scope.adYear.length; i++) $scope.adYear[i].Sl_No = i + 1; $scope.ady = false; //console.log($scope.adYear); } else { $scope.ady = true; $scope.message = response.data.message; } }); //Data grid $scope.filterRow = { visible: true, applyFilter: "auto" }; $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.adYeargrid = { showBorders: true, columnAutoWidth: true, //columnWidth: 100, "export": { enabled: true, fileName: "AdmissionsYear", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { //filterRow: "filterRow", showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'adYear' }, columns: [{ dataField: 'Sl_No', width: 50 }, { dataField: 'university', width: 200 }, { dataField: "June", dataType: "number", width: 60 }, { dataField: "July", dataType: "number", width: 60 }, { dataField: "August", dataType: "number", width: 60 }, { dataField: "September", dataType: "number", width: 60 }, { dataField: "October", dataType: "number", width: 60 }, { dataField: "November", dataType: "number", width: 60 }, { dataField: "December", dataType: "number", width: 60 }, { dataField: "January", dataType: "number", width: 60 }, { dataField: "February", dataType: "number", width: 60 }, { dataField: "March", dataType: "number", width: 60 }, { dataField: "April", dataType: "number", width: 60 }, { dataField: "May", dataType: "number", width: 60 }, { dataField: "Total", dataType: "number", width: 60 }, { dataField: 'AdmittedBy', cssClass: 'WrappedColumnClass', width: 300 }], summary: { totalItems: [ { summaryType: "sum", displayFormat: "{0}", column: "Total" }] } }; } $scope.fbwFilter = function(){ var admissionMonth = { method: 'POST', url: apiPoint.url + 'admissionMonth/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType, year: $scope.filters.year, month: $scope.filters.month } }; // console.log($scope.filters.year); // console.log($scope.filters.month); $http(admissionMonth).then(function (response) { if (response.data.lList == true) { $scope.adMonth = response.data.l_data; for (var i = 0; i < $scope.adMonth.length; i++) $scope.adMonth[i].Sl_No = i + 1; $scope.ad = false; // console.log($scope.adMonth); } else { $scope.ad = true; $scope.message = response.data.message; } }); //Data grid $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.admgrid = { columnAutoWidth: true, showBorders: true, "export": { enabled: true, fileName: "AdmissionsMonth", allowExportSelectedData: false }, paging: { pageSize: 10 }, pager: { showPageSizeSelector: true, allowedPageSizes: [5, 10, 20], showInfo: true }, bindingOptions: { showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'adMonth' }, columns: ['Sl_No', 'university', { dataField: "week1", dataType: "number" }, { dataField: "week2", dataType: "number" }, { dataField: "week3", dataType: "number" }, { dataField: "week4", dataType: "number" }, { dataField: "week5", dataType: "number" }, { dataField: "Total", dataType: "number" }, 'AdmissionTakenBy'], summary: { totalItems: [ { summaryType: "sum", displayFormat: "{0}", column: "Total" }] }, }; } /*end dashboard tab*/ /*For dashboard tiles*/ $scope.lead_dataToday = ''; $scope.lead_dataMonth = ''; $scope.leadCountDayClosed = ''; $scope.leadCountMonthClosed = ''; $scope.ad_data = ''; $scope.ad_dataYear = ''; $scope.fup_today = ''; $scope.fup_month = ''; $scope.ft_balance =''; //to staff $scope.slead_dataToday = ''; $scope.slead_dataMonth = ''; $scope.sleadCountDayClosed = ''; $scope.sleadCountMonthClosed = ''; $scope.sfup_today = ''; $scope.sfup_month = ''; $scope.sft_balance =''; //common variable $scope.cslead_dataToday = ''; $scope.cslead_dataMonth = ''; $scope.csleadCountDayClosed = ''; $scope.csleadCountMonthClosed = ''; $scope.csfup_today = ''; $scope.csfup_month = ''; $scope.csft_balance =''; //1st tile for lead created today var todayCount = { method: 'POST', url: apiPoint.url + 'getleadCountToday/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(todayCount).then(function (response) { if (response.data.leadList == true) { $scope.lead_dataToday = response.data.lead_data[0].count; $scope.slead_dataToday = response.data.slead_data[0].count; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.cslead_dataToday = $scope.slead_dataToday; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.cslead_dataToday = $scope.lead_dataToday; //console.log($scope.Dt_fpending); // console.log('else'); } // console.log($scope.lead_dataToday); } else { $scope.message = response.data.message; } }); //1st tile for lead created this month var monthCount = { method: 'POST', url: apiPoint.url + 'getleadCountMonth/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(monthCount).then(function (response) { if (response.data.leadList == true) { $scope.lead_dataMonth = response.data.lead_data[0].count; $scope.slead_dataMonth = response.data.slead_data[0].count; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.cslead_dataMonth = $scope.slead_dataMonth; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.cslead_dataMonth = $scope.lead_dataMonth; //console.log($scope.Dt_fpending); // console.log('else'); } //console.log($scope.lead_dataMonth); } else { $scope.message = response.data.message; } }); //2nd tile for lead created today var dayCountClosed = { method: 'POST', url: apiPoint.url + 'getleadCountDayClosed/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(dayCountClosed).then(function (response) { if (response.data.leadList == true) { $scope.leadCountDayClosed = response.data.lead_data[0].count; $scope.sleadCountDayClosed = response.data.slead_data[0].count; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.csleadCountDayClosed = $scope.sleadCountDayClosed; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.csleadCountDayClosed = $scope.leadCountDayClosed; //console.log($scope.Dt_fpending); // console.log('else'); } // console.log($scope.leadCountDayClosed); } else { $scope.message = response.data.message; } }); //2nd tile for lead closed this month var monthCountClosed = { method: 'POST', url: apiPoint.url + 'getleadCountMonthClosed/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(monthCountClosed).then(function (response) { if (response.data.leadList == true) { $scope.leadCountMonthClosed = response.data.lead_data[0].count; $scope.sleadCountMonthClosed = response.data.slead_data[0].count; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.csleadCountMonthClosed = $scope.sleadCountMonthClosed; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.csleadCountMonthClosed = $scope.leadCountMonthClosed; //console.log($scope.Dt_fpending); // console.log('else'); } //console.log($scope.leadCountMonthClosed); } else { $scope.message = response.data.message; } }); //3rd tile for Admissions for this month var monthAdmission = { method: 'POST', url: apiPoint.url + 'getadmimssionMonth/', headers: { 'Content-Type': 'application/json' }, data: { branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, year: $scope.filters.year, month: $scope.filters.month } }; $http(monthAdmission).then(function (response) { if (response.data.ad_List == true) { $scope.ad_data = response.data.ad_data[0].total; console.log($scope.ad_data); } else { $scope.message = response.data.message; } }); //3rd tile for Admissions for this year var yearAdmission = { method: 'POST', url: apiPoint.url + 'getadmimssionYear/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(yearAdmission).then(function (response) { if (response.data.ad_List == true) { $scope.ad_dataYear = response.data.ad_data[0].total; // console.log($scope.ad_dataYear); } else { $scope.message = response.data.message; } }); //4th tile for follow ups today var fupToday = { method: 'POST', url: apiPoint.url + 'getfupToday/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(fupToday).then(function (response) { if (response.data.fUpList == true) { $scope.fup_today = response.data.fUp_data[0].count; $scope.sfup_today = response.data.sfUp_data[0].count; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.csfup_today = $scope.sfup_today; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.csfup_today = $scope.fup_today; //console.log($scope.Dt_fpending); // console.log('else'); } // console.log($scope.fup_today); } else { $scope.message = response.data.message; } }); //4th tile for pending follow ups this month var fupMonth = { method: 'POST', url: apiPoint.url + 'getfupMonth/', headers: { 'Content-Type': 'application/json' }, data: { requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(fupMonth).then(function (response) { if (response.data.fUpList == true) { $scope.fup_month = response.data.fUp_data[0].count; $scope.sfup_month = response.data.sfUp_data[0].count; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.csfup_month = $scope.sfup_month; // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.csfup_month = $scope.fup_month; //console.log($scope.Dt_fpending); // console.log('else'); } // console.log($scope.fup_month); } else { $scope.message = response.data.message; } }); //get the totalbalance var ftbala = { method: 'POST', url: apiPoint.url + 'feeOutstandingtotal/', headers: { 'Content-Type': 'application/json' }, data: { // requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID, branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID, //requestedDept: JSON.parse(sessionStorage.getItem('localObj')).localType } }; $http(ftbala).then(function (response) { // console.log('res',response); if (response.data.lList == true) { // console.log('ifres'); $scope.ft_balance = response.data.l_data[0].total; $scope.sft_balance = response.data.l_data[0].total; if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { $scope.csft_balance = $scope.sft_balance; // // console.log($scope.Dt_dataMonthClosed); // console.log('if'); } else { $scope.csft_balance = $scope.ft_balance; // //console.log($scope.Dt_fpending); // console.log('else'); } console.log($scope.ft_balance); } else { $scope.message = response.data.message; } }); }]); /*Header Fixed */ app.directive('fixedHeader', function ($timeout) { return { restrict: 'A', link: link }; function link($scope, $elem, $attrs, $ctrl) { var elem = $elem[0]; // wait for data to load and then transform the table $scope.$watch(tableDataLoaded, function (isTableDataLoaded) { if (isTableDataLoaded) { transformTable(); } }); function tableDataLoaded() { // first cell in the tbody exists when data is loaded but doesn't have a width // until after the table is transformed var firstCell = elem.querySelector('tbody tr:first-child td:first-child'); return firstCell && !firstCell.style.width; } function transformTable() { // reset display styles so column widths are correct when measured below angular.element(elem.querySelectorAll('thead, tbody')).css('display', ''); // wrap in $timeout to give table a chance to finish rendering $timeout(function () { // set widths of columns angular.forEach(elem.querySelectorAll('tr:first-child th'), function (thElem, i) { var tdElems = elem.querySelector('tbody tr:first-child td:nth-child(' + (i + 1) + ')'); var tfElems = elem.querySelector('tfoot tr:first-child td:nth-child(' + (i + 1) + ')'); var columnWidth = tdElems ? tdElems.offsetWidth : thElem.offsetWidth; if (tdElems) { tdElems.style.width = columnWidth + '150px'; } if (thElem) { thElem.style.width = columnWidth + '150px'; } }); // set css styles on thead and tbody angular.element(elem.querySelectorAll('thead, tfoot')).css('display', 'block'); angular.element(elem.querySelectorAll('tbody')).css({ 'display': 'block', 'height': $attrs.tableHeight || 'inherit', 'overflow': 'auto' }); // reduce width of last column by width of scrollbar var tbody = elem.querySelector('tbody'); var scrollBarWidth = tbody.offsetWidth - tbody.clientWidth; if (scrollBarWidth > 0) { // for some reason trimming the width by 2px lines everything up better scrollBarWidth -= 2; var lastColumn = elem.querySelector('tbody tr:first-child td:last-child'); lastColumn.style.width = (lastColumn.offsetWidth - scrollBarWidth) + 'px'; } }); } } }); app.controller('OnotherCtrl', ["$scope", "toaster", "$filter", "$http", "API_POINTS", "$state", '$cookies', 'ipCookie', function ($scope, toaster, $filter, $http, apiPoint, $state, $cookies, ipCookie) { // get local cliend details var localDetail = JSON.parse(sessionStorage.getItem('localObj')); var localDetails = ipCookie('cookiechk'); $scope.init = function () { // $scope.this_Student = 0; // $scope.this_Staff = 0; // $scope.this_TotalUser = 0; // $scope.getTotalUsers(); $scope.getUniversityRegisteredDetails(); } // get Total Number of users in this application $scope.getTotalUsers = function () { var req = { method: 'POST', url: apiPoint.url + 'getTotalUsers/', headers: { 'Content-Type': 'application/json' }, data: { data: localDetails } }; $http(req).then(function (response) { if (response.data) { // $scope.editBranchId = id; $scope.this_Student = response.data.total_student; $scope.this_Staff = response.data.total_staff; $scope.this_TotalUser = $scope.this_Staff + $scope.this_Student; // alert($scope.this_TotalUser); $scope.data = [ { value: $scope.this_Student, color: '#46BFBD', highlight: '#5AD3D1', label: 'Student' }, { value: $scope.this_Staff, color: '#FDB45C', highlight: '#FFC870', label: 'Staff' } ]; $scope.total = $scope.this_TotalUser; } else { // $scope.this_Student = response.total_student; // $scope.this_Staff = response.total_staff; $scope.data = [ { value: $scope.this_Student, color: '#F7464A', highlight: '#5AD3D1', label: 'Student' }, { value: $scope.this_Staff, color: '#FDB45C', highlight: '#FFC870', label: 'Staff' } ]; $scope.this_TotalUser = 0; $scope.total = $scope.this_TotalUser; } }); } // Chart.js Data // Chart.js Options $scope.options = { // Sets the chart to be responsive responsive: false, //Boolean - Whether we should show a stroke on each segment segmentShowStroke: true, //String - The colour of each segment stroke segmentStrokeColor: '#fff', //Number - The width of each segment stroke segmentStrokeWidth: 2, //Number - The percentage of the chart that we cut out of the middle percentageInnerCutout: 50, // This is 0 for Pie charts //Number - Amount of animation steps animationSteps: 100, //String - Animation easing effect animationEasing: 'easeOutBounce', //Boolean - Whether we animate the rotation of the Doughnut animateRotate: true, //Boolean - Whether we animate scaling the Doughnut from the centre animateScale: false, //String - A legend template legendTemplate: '