diff --git a/Apollo/assets/js/controllers/dashboardCtrl.js b/Apollo/assets/js/controllers/dashboardCtrl.js index 7bfd2aa4..4c2a326e 100755 --- a/Apollo/assets/js/controllers/dashboardCtrl.js +++ b/Apollo/assets/js/controllers/dashboardCtrl.js @@ -10,7 +10,7 @@ app.controller('dashboardCtrl', ["$scope","$rootScope", "toaster", "$filter", "n * this method called from view ng-init directive * created by kms * */ - + $scope.initCallTracking = function () { $rootScope.pendingFolloupDetails = []; var getCallTrack = { @@ -211,4 +211,140 @@ app.controller('OnotherCtrl', ["$scope", "toaster", "$filter", "$http", "API_POI }; }]); +app.filter('unique', function() { + return function(collection, primaryKey, secondaryKey) { //optional secondary key + var output = [], + keys = []; + + angular.forEach(collection, function(item) { + var key; + secondaryKey === undefined ? key = item[primaryKey] : key = item[primaryKey][secondaryKey]; + + if(keys.indexOf(key) === -1) { + keys.push(key); + output.push(item); + } + }); + + return output; + }; +}); + +/*modal controller + * */ +app.controller('studentModalDemoCtrl', ["$scope", "$modal", "$log", "API_POINTS", "$http", function ($scope, $modal, $log,apiPoint,$http) { + //Tooltip for print button + $scope.dynamicTooltip = 'Student View'; + + + + // $scope.items = ['item1', 'item2', 'item3']; + + $scope.open = function (studentDetails) { + + + // get student view details + var getcourse = { + method: 'POST', + url: apiPoint.url + 'getStudentBasicInfo/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy :studentDetails.MobileNumber, + requestedFrom: 3 + } + }; + $http(getcourse).then(function (response) { + + if (response.data.status == 200 && response.data.studentStatus== true) { + $scope.courseEditLoading = false; + // $scope.studentDetails = response.data.studentDetails; + $scope.studentDetails = response.data; + // $scope.courseDetails = response.data.courseDetails; + var modalInstance = $modal.open({ + templateUrl: 'assets/views/student/studentDetailsModal.html', + controller: 'ModalInstanceCtrl', + // size: size, + resolve: { + items: function () { + return $scope.studentDetails; + } + } + }); + + modalInstance.result.then(function (selectedItem) { + $scope.selected = selectedItem; + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + + } else { + swal("Failed!", "This student is not registerd", "warning"); + $scope.courseEditLoading = false; + $scope.studentDetails = ""; + $scope.courseDetails = ""; + + } + }); + + + }; + $scope.open1 = function (values) { + + var modalInstance1 = $modal.open({ + templateUrl: 'assets/views/student/studentPaymentModal.html', + controller: 'ModalInstanceCtrl1', + // size: size, + resolve: { + items1: function () { + return values; + } + } + }); + + modalInstance1.result.then(function (selectedItem) { + $scope.selected = selectedItem; + }, function () { + $log.info('Modal dismissed at: ' + new Date()); + }); + }; + + +}]); + +// Please note that $modalInstance represents a modal window (instance) dependency. +// It is not the same as the $modal service used above. + +app.controller('ModalInstanceCtrl', ["$scope", "$modalInstance", "items","WordsService", function ($scope, $modalInstance, items,WordsService) { + + $scope.items = items; + $scope.selected = { + item: $scope.items[0] + }; + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + + +}]); +app.controller('ModalInstanceCtrl1', ["$scope", "$modalInstance", "items1","WordsService", function ($scope, $modalInstance, items1,WordsService) { + + $scope.items1 = items1; + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + + +}]);