angular.module('kalgudiApp.meetings') .controller('meetingsController', ['$scope', '$rootScope', '$state','$ionicModal', 'meetingsService', function($scope, $rootScope, $state,$ionicModal, meetingsService) { $scope.meeting = { createdBy : { profilePicUrl : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", firstName : "Kalgudi User", }, time : { from : "11:00 AM", to : "01:00 PM", }, title : "Weekly Meeting", date : "15 Jun 2018", desc : "This is the new feature meeting in kalgudi. This is the two line description on the meeting", location : "Hyderabad", participants : "20", } $scope.selectedAttendees = []; $scope.mom = { desc : '', attachments : [] } $scope.createdMOM = [ { "id" :"1", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Kalgudi User", "bizType" : "Farmer", "location" : "Nagpur", "desc" : "This is the new feature meeting in kalgudi. This is the two line description on the meeting", "attachmentsCount" : 0 }, { "id" :"2", "profilePicUrl" : "https://kalgudidata.s3.amazonaws.com/data/profilepics/M00j4aj0PRFREG2017020728044160UNH001.png?1502868056019", "name" : "Kalgudi Engineering", "bizType" : "Businessman", "location" : "Hyderabad", "desc" : "This is the new feature meeting in kalgudi. This is the two line description on the meeting", "attachmentsCount" : 2 }, { "id" :"2", "profilePicUrl" : "https://kalgudi.com/data/profilepics/M00j48o0PRFREG2017020640673778UNH001.png?1519119679507", "name" : "Kalgudi Content Lead", "bizType" : "Businessman", "location" : "Secunderabad", "desc" : "This is the new feature meeting in kalgudi. This is the two line description on the meeting", "attachmentsCount" : 5 } ] $scope.attendeesList = [ {"id":"1", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"2", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"3", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"4", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"5", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"6", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"7", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"8", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, {"id":"9", "profilePicUrl" : "https://s3.amazonaws.com/kalgudicontent/commodities/000000004694_1.jpg", "name" : "Ankit Singh", "bizType" : "Farmer", "location" : "Hyderabad", }, ]; /*------------------------------------------------Attendees Modal Begin----------------------------------------*/ $scope.attendeesModal = $ionicModal.fromTemplateUrl($rootScope.themebasepathvalue + 'meetings/attendees-modal.html', { scope: $scope, animation: 'slide-in-right', }).then(function(modal) { $scope.attendeesModal = modal; }); $scope.openAttendeesModal = function() { $scope.attendeesModal.show(); } $scope.closeAttendeesModal = function() { $scope.attendeesModal.hide(); } //Cleanup the modal when we're done with it! $scope.$on('$destroy', function() { $scope.attendeesModal.remove(); }); /* Modal for Attendees Ends*/ /* Attendannce of Participants */ $scope.openAttendees = function () { $scope.headerTitle = "Attendees"; $scope.openAttendeesModal(); } /*Attendies Picker*/ $scope.selectAttendees = function (index, selectedAttendee) { var isAlreadyAdded = -1; for( var id in $scope.selectedAttendees) { if($scope.selectedAttendees[id].id == selectedAttendee.id){ isAlreadyAdded = id ; break; } } if(isAlreadyAdded > -1){ $scope.selectedAttendees.splice(isAlreadyAdded,1); $scope.attendeesList[index].isSelected = false; } else{ $scope.selectedAttendees.push(selectedAttendee); $scope.attendeesList[index].isSelected = true; } } /*------------------------------------------------Attendees Modal End-------------------------------------------*/ /*------------------------------------------------MOM Modal Begin-----------------------------------------------*/ $scope.MOMModal = $ionicModal.fromTemplateUrl($rootScope.themebasepathvalue + 'meetings/mom-modal.html', { scope: $scope, animation: 'slide-in-right', }).then(function(modal) { $scope.MOMModal = modal; }); $scope.openMOMModal = function() { $scope.MOMModal.show(); } $scope.closeMOMModal = function() { $scope.MOMModal.hide(); $scope.mom = {}; } //Cleanup the modal when we're done with it! $scope.$on('$destroy', function() { $scope.MOMModal.remove(); }); /* MOM of Meeting */ $scope.openMOM = function () { $scope.headerTitle = "Minutes of Meeting"; $scope.openMOMModal(); } $scope.saveMOM = function (mom) { $scope.closeMOMModal(); console.log(mom) } /* Upload MOM Attachments */ $rootScope.$on("uploadedS3URL", function(event, imageFile) { $scope.mom.attachments.push(imageFile); }); $scope.deselectAttachment = function (index) { $scope.mom.attachments.splice(index, 1); } /*------------------------------------------------MOM Modal End-----------------------------------------------*/ /* Response by Participant Going || Not Interested */ $scope.attendingResponse = function (status) { } /*------------------------------------------------MOM Modal Inbox Begin---------------------------------------*/ $scope.MOMInboxModal = $ionicModal.fromTemplateUrl($rootScope.themebasepathvalue+'meetings/mom-inbox-modal.html', { scope: $scope, animation: 'slide-in-right', }).then(function(modal) { $scope.MOMInboxModal = modal; }); $scope.openMOMInboxModal = function() { $scope.MOMInboxModal.show(); $scope.headerTitle = "Minutes of Meeting"; } $scope.closeMOMInboxModal = function() { $scope.MOMInboxModal.hide(); } //Cleanup the modal when we're done with it! $scope.$on('$destroy', function() { $scope.MOMInboxModal.remove(); }); /*------------------------------------------------MOM Modal Inbox End------------------------------------------*/ } ]);