1151 lines
36 KiB
JavaScript
Executable File
1151 lines
36 KiB
JavaScript
Executable File
'use strict';
|
|
/*** controller for Wizard Form example***/
|
|
app.controller('sendSMSsuperadminCtrl', ["$scope","$rootScope", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', 'dateListDescService', function ($scope,$rootScope, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie, dateListDescService) {
|
|
|
|
/**
|
|
* Send SMS Functionality
|
|
* by : kdk
|
|
*/
|
|
var localDetail = JSON.parse(sessionStorage.getItem('localObj'));
|
|
var localDetails = ipCookie('cookiechk');
|
|
|
|
$scope.init = function () {
|
|
$scope.mobilenumbers=$rootScope.selectedStudentMN;
|
|
$scope.certificatemobilenumbers=$rootScope.selectedStudentcertificateMN;
|
|
$scope.balfeesmobilenumbers=$rootScope.selectedStudentbalfeesMN;
|
|
|
|
if($scope.mobilenumbers != undefined)
|
|
{
|
|
//tabtwo: true
|
|
$scope.tabone = false;
|
|
$scope.tabtwo = true;
|
|
$scope.tabthree = false;
|
|
$scope.radio=1;
|
|
$scope.listMobileNums=$scope.mobilenumbers;
|
|
|
|
}
|
|
if($scope.certificatemobilenumbers != undefined)
|
|
{
|
|
//tabtwo: true
|
|
$scope.tabone = false;
|
|
$scope.tabtwo = true;
|
|
$scope.tabthree = false;
|
|
$scope.radio=1;
|
|
$scope.listMobileNums=$scope.certificatemobilenumbers;
|
|
|
|
}
|
|
if($scope.balfeesmobilenumbers != undefined)
|
|
{
|
|
//tabtwo: true
|
|
$scope.tabone = false;
|
|
$scope.tabtwo = true;
|
|
$scope.tabthree = false;
|
|
$scope.radio=1;
|
|
$scope.listMobileNums=$scope.balfeesmobilenumbers;
|
|
|
|
}
|
|
|
|
|
|
var logcheck = JSON.parse(sessionStorage.getItem('localObj'));
|
|
|
|
const LOCALTYPE = logcheck.localType;
|
|
if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE == 'R005')) {
|
|
console.log("if");
|
|
}else {
|
|
if(logcheck != null && LOCALTYPE !='R001') {
|
|
console.log("else if");
|
|
$state.go('app.dashboard');
|
|
} else {
|
|
|
|
console.log("else else");
|
|
//ipCookie.remove('cookiechk');
|
|
window.sessionStorage.clear();
|
|
$state.go('login.signin');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (localDetail != null) {
|
|
// $scope.getBranchList();
|
|
$scope.getUniversityList();
|
|
} else {
|
|
}
|
|
};
|
|
|
|
$scope.searchData = {
|
|
'University': '',
|
|
'Course': '',
|
|
'Batch': ''
|
|
};
|
|
|
|
$scope.branchList_data = '';
|
|
// get Branch List
|
|
$scope.getBranchList = function () {
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getBranchListDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.branDetailstatus) {
|
|
$scope.branchList_data = response.data.branch_details;
|
|
|
|
} else {
|
|
}
|
|
});
|
|
};
|
|
|
|
$scope.universityData = '';
|
|
// get university list while the page is load
|
|
$scope.getUniversityList = function () {
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getUniveCourseBratchBroadCast/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.univList) {
|
|
$scope.universityData = response.data.university_details;
|
|
|
|
|
|
} else {
|
|
}
|
|
});
|
|
};
|
|
|
|
$scope.getUniveId = function (univ) {
|
|
let name = JSON.parse(univ);
|
|
// console.log(name)
|
|
$scope.searchData.University = name.UniversityID;
|
|
$scope.searchData.Course = '';
|
|
$scope.searchData.Batch = '';
|
|
$scope.courseData = name.Course;
|
|
$scope.batchData = name.Batch;
|
|
|
|
|
|
//call service for array list in desc order based on date
|
|
angular.forEach($scope.batchData,function (values,key) {
|
|
var parts = values.BatchDate.split("-");
|
|
values.givenDateObject=new Date(parts[2], parts[1] - 1, parts[0]);
|
|
});
|
|
$scope.batchData=dateListDescService.getOrderByList($scope.batchData);
|
|
// end
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.getSearch();
|
|
};
|
|
|
|
$scope.getValueChange = function() {
|
|
$scope.getSearch();
|
|
};
|
|
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.searchLoading = false;
|
|
$scope.getSearch = function() {
|
|
console.log($scope.searchData);
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.searchLoading = true;
|
|
var getSearchDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStuListForBroadcast/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.searchData,
|
|
requestDetails: localDetails
|
|
}
|
|
};
|
|
$http(getSearchDetails).then(function (response) {
|
|
if (response.data.searchResult) {
|
|
$scope.studentListDetails = response.data.search_result_details;
|
|
let studentListDetails = response.data.search_result_details;
|
|
const filterAddSelect = studentListDetails.filter(val => {
|
|
val['Selected'] = false;
|
|
return val;
|
|
});
|
|
$scope.searchResultDetails = filterAddSelect;
|
|
$scope.searchResultLength = Object.keys($scope.searchResultDetails).length;
|
|
|
|
$scope.searchResultStatus = response.data.searchResult;
|
|
$scope.searchLoading = false;
|
|
} else {
|
|
$scope.searchLoading = false;
|
|
}
|
|
});
|
|
};
|
|
|
|
// select all or individual functionality
|
|
|
|
var getAllSelected = function () {
|
|
var selectedItems = $scope.searchResultDetails.filter(function (item) {
|
|
return item.Selected;
|
|
});
|
|
|
|
return selectedItems.length === $scope.searchResultDetails.length;
|
|
}
|
|
|
|
var setAllSelected = function (value) {
|
|
angular.forEach($scope.searchResultDetails, function (item) {
|
|
item.Selected = value;
|
|
});
|
|
}
|
|
|
|
$scope.allSelected = function (value) {
|
|
if (value !== undefined) {
|
|
return setAllSelected(value);
|
|
} else {
|
|
return getAllSelected();
|
|
}
|
|
}
|
|
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.openScreenSen = function() {
|
|
var ItemsSelected = $scope.searchResultDetails.filter(function (item) {
|
|
if (item.Selected === true) { return true; }
|
|
});
|
|
if(ItemsSelected.length > 0) {
|
|
$scope.OpenWindowStatus = true;
|
|
$scope.openUpdateWind();
|
|
} else {
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.openUpdateWind();
|
|
}
|
|
}
|
|
|
|
$scope.msg_details = {
|
|
"content": ""
|
|
}
|
|
|
|
// Select one row in a table once
|
|
// $scope.setOneSelect = function (value) {
|
|
// angular.forEach($scope.searchResultDetails, function (item) {
|
|
// item.Selected = value;
|
|
// });
|
|
// value.Selected = true;
|
|
// $scope.OpenWindowStatus = true;
|
|
// $scope.openUpdateWind();
|
|
// }
|
|
|
|
// End: select all or individual functionality
|
|
|
|
$scope.openUpdateWind = function() {
|
|
|
|
}
|
|
|
|
$scope.statusUpdate = {
|
|
submit: function (form, msg_details) {
|
|
|
|
//alert()
|
|
var firstError = null;
|
|
if (form.$invalid) {
|
|
var field = null, firstError = null;
|
|
for (field in form) {
|
|
if (field[0] != '$') {
|
|
if (firstError === null && !form[field].$valid) {
|
|
firstError = form[field].$name;
|
|
}
|
|
if (form[field].$pristine) {
|
|
form[field].$dirty = true;
|
|
}
|
|
}
|
|
}
|
|
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
|
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
$scope.disableButton = true;
|
|
var studentForUpdate = [];
|
|
var ItemsSelected = $scope.searchResultDetails.filter(function (item) {
|
|
if (item.Selected === true) {
|
|
let getStudentID = new getStudentForUpdateDetails(item.StudentID);
|
|
studentForUpdate.push(getStudentID);
|
|
return true;
|
|
}
|
|
});
|
|
function getStudentForUpdateDetails(id) {
|
|
this.StudentID = id;
|
|
}
|
|
var sendMSGApi = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'sendSMSStudentApi/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: studentForUpdate,
|
|
msg: msg_details,
|
|
requestDetails: localDetails
|
|
}
|
|
};
|
|
$http(sendMSGApi).then(function (response) {
|
|
if (response.data.msgStatus) {
|
|
swal(" ", "Message sent successfully.", "success");
|
|
$scope.disableButton = false;
|
|
angular.forEach($scope.searchResultDetails, function (item) {
|
|
item.Selected = false;
|
|
});
|
|
$scope.OpenWindowStatus = false;
|
|
} else {
|
|
swal(" ", response.data.message, "error");
|
|
$scope.disableButton = false;
|
|
}
|
|
});
|
|
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
form.$setPristine(false);
|
|
$scope.msg_details = {
|
|
"content": ""
|
|
}
|
|
// $scope.msg_details.content = "";
|
|
}
|
|
}
|
|
|
|
// get report for the smssended
|
|
$scope.getSmsReport = function() {
|
|
// console.log($scope.searchData);
|
|
var getSearchDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getSMSSendReportList/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.searchData,
|
|
requestDetails: localDetails
|
|
}
|
|
};
|
|
$http(getSearchDetails).then(function (response) {
|
|
if (response.data.searchResult) {
|
|
|
|
} else {
|
|
|
|
}
|
|
});
|
|
};
|
|
|
|
|
|
// ===================================== send individual sms
|
|
|
|
$scope.disableSendButton = false;
|
|
$scope.mobileNumList = {
|
|
"mobile" : "",
|
|
"messange": ""
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.myModel = {
|
|
"GroupName" : "",
|
|
|
|
}
|
|
|
|
$scope.listMobileNums = [];
|
|
$scope.addContactsList = function() {
|
|
// alert($scope.mobileNumList.mobile);
|
|
// if($scope.mobileNumList.mobile !=='' && $scope.mobileNumList.mobile !== null && $scope.mobileNumList.mobile !== undefined
|
|
// ) {
|
|
// $scope.listMobileNums.push($scope.mobileNumList.mobile);
|
|
// }else {
|
|
// swal(" ", "Please Should Enter Valid Mobile Number.", "warning");
|
|
// }
|
|
|
|
}
|
|
$scope.deletMobileList = function(num) {
|
|
var index = $scope.listMobileNums.indexOf(num);
|
|
$scope.listMobileNums.splice(index, 1);
|
|
}
|
|
|
|
$scope.composeMsgNumber = function() {
|
|
$scope.disableSendButton = true;
|
|
var phoneno = /^\d{10}$/;
|
|
var mobileNumber = $scope.mobileNumList.mobile;
|
|
if($scope.mobileNumList.mobile !=='' && $scope.mobileNumList.mobile !== null && $scope.mobileNumList.mobile !== undefined
|
|
&& mobileNumber.match(phoneno)) {
|
|
$scope.disableSendButton = false;
|
|
$scope.listMobileNums.push($scope.mobileNumList.mobile);
|
|
$scope.mobileNumList.mobile = '';
|
|
}else {
|
|
$scope.disableSendButton = false;
|
|
swal(" ", "Please Should Enter Valid Mobile Number.", "warning");
|
|
}
|
|
}
|
|
|
|
$scope.composeMsgMultipleNumber = function() {
|
|
$scope.disableSendButton = true;
|
|
var phoneno = /^\d{10}$/;
|
|
var multipleMobileNumber = $scope.mobileNumList.multipleMobile;
|
|
var resultingArr = [] ,errorNumbers = [] ;
|
|
if($scope.mobileNumList.multipleMobile !=='' && $scope.mobileNumList.multipleMobile !== null && $scope.mobileNumList.multipleMobile !== undefined) {
|
|
var myarray = multipleMobileNumber.split(',');
|
|
// for(var i = 0; i < myarray.length; i++)
|
|
// {
|
|
// if(myarray[i].match(phoneno)){
|
|
// resultingArr.push()
|
|
// // $scope.listMobileNums.push(myarray[i]);
|
|
// }else{
|
|
// errorNumbers.push(myarray[i]);
|
|
// // alert(errorNumbers);
|
|
// }
|
|
// }
|
|
resultingArr = myarray.reduce(function(a,b){
|
|
if(a.indexOf(b)<0 && b.match(phoneno)){$scope.listMobileNums.push(b);a.push(b);}
|
|
return a;
|
|
},[]);
|
|
// alert(resultingArr);
|
|
// $scope.listMobileNums.push(resultingArr.split(','));
|
|
$scope.disableSendButton = false;
|
|
// swal({ html:true, title:'<i style="font-size: 14px;">Please Check Mobile Numbers are valid.</i>', text:'<b>'+errorNumbers+'</b>'});
|
|
// swal( " " , "Please check these Numners are valid <b>test</b> "+errorNumbers, "warning");
|
|
$scope.mobileNumList.multipleMobile = '';
|
|
}else {
|
|
swal(" ", "Please Should Enter Valid Mobile Number.", "warning");
|
|
}
|
|
// alert(multipleMobileNumber);
|
|
|
|
}
|
|
|
|
|
|
// add a new daybook entry
|
|
$scope.composeMsg = {
|
|
submit: function (form) {
|
|
|
|
|
|
var firstError = null;
|
|
var msgg = $scope.mobileNumList.message;
|
|
|
|
// console.log(msgg);
|
|
// return false;
|
|
if ((msgg =='')||(msgg ==undefined)) {
|
|
|
|
swal(" ", "No Message Body.", "error");
|
|
// alert('in')
|
|
// var field = null, firstError = null;
|
|
// for (field in form) {
|
|
// if (field[0] != '$') {
|
|
// if (firstError === null && !form[field].$valid) {
|
|
// firstError = form[field].$name;
|
|
// }
|
|
// if (form[field].$pristine) {
|
|
// form[field].$dirty = true;
|
|
// }
|
|
// }
|
|
// }
|
|
// angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
|
} else {
|
|
|
|
|
|
if($scope.listMobileNums.length > 0) {
|
|
|
|
|
|
$scope.disableSendButton = true;
|
|
var msg = $scope.mobileNumList.message;
|
|
// alert(msg);
|
|
var nums = $scope.listMobileNums;
|
|
var datas = {
|
|
"message": msg,
|
|
"numbers": nums
|
|
};
|
|
var sendMsgStatus = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'sendPromotionalMsg/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: datas,
|
|
requestDetails: localDetails
|
|
}
|
|
};
|
|
$http(sendMsgStatus).then(function (response) {
|
|
if (response.data.msgStatus == true) {
|
|
swal(" ", response.data.message, "success");
|
|
$scope.mobileNumList.message = '';
|
|
$scope.disableSendButton = false;
|
|
} else {
|
|
$scope.disableSendButton = false;
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
});
|
|
} else {
|
|
swal(" ", "Please Enter Mobile Number.", "warning");
|
|
}
|
|
// $scope.disableAddButton = true;
|
|
// var sdate= $('#datere').val();
|
|
// var formate = "dd-MM-yyyy";
|
|
// $scope.myModelAdd.date= sdate;
|
|
// $scope.myModelAdd.status = $scope.myModelAdd.name == 'I001' ? 'Pending' : 'Approved';
|
|
|
|
// var addDayBookDetails = {
|
|
// method: 'POST',
|
|
// url: apiPoint.url + 'addDayBook/',
|
|
// headers: {
|
|
// 'Content-Type': 'application/json'
|
|
// },
|
|
// data: {
|
|
// data: myModelAdd,
|
|
// localReqDetails: localDetails
|
|
// }
|
|
// };
|
|
// $http(addDayBookDetails).then(function (response) {
|
|
// if (response.data.addDayBookStatus) {
|
|
// swal(" ", "Income/Expense added successfully.", "success");
|
|
// $state.go($state.current, {}, { reload: true });
|
|
// $scope.disableAddButton = false;
|
|
// } else {
|
|
// swal(" ", response.data.message, "error");
|
|
// $scope.disableAddButton = false;
|
|
// }
|
|
// });
|
|
}
|
|
$rootScope.selectedStudentMN='';
|
|
$rootScope.selectedStudentcertificateMN='';
|
|
$rootScope.selectedStudentbalfeesMN='';
|
|
},
|
|
|
|
reset: function (form) {
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$scope.updatestatus = function (myModel, form, loading)
|
|
{
|
|
|
|
var firstError = null;
|
|
if (form.$invalid) {
|
|
var field = null, firstError = null;
|
|
for (field in form) {
|
|
if (field[0] != '$') {
|
|
if (firstError === null && !form[field].$valid) {
|
|
firstError = form[field].$name;
|
|
}
|
|
if (form[field].$pristine) {
|
|
form[field].$dirty = true;
|
|
}
|
|
}
|
|
}
|
|
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
|
swal("Please Enter Phone Number in Correct Format!", "error");
|
|
}
|
|
|
|
|
|
else
|
|
{
|
|
var phoneno = myModel.ListName;
|
|
var id = myModel.ID;
|
|
//alert(('' + a).length);
|
|
// console.log(('' + phoneno).length);
|
|
// return false;
|
|
|
|
|
|
var addphone ={
|
|
|
|
method: 'POST',
|
|
url: apiPoint.url + 'addphone/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestBranch: localDetail.localBranchID,
|
|
PId:myModel.ID,
|
|
Phone:myModel.ListName,
|
|
requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID
|
|
}
|
|
};
|
|
|
|
|
|
$http(addphone).then(function (response)
|
|
{
|
|
|
|
// console.log(response.data);
|
|
if (response.data.status == 200)
|
|
{
|
|
|
|
//console.log('if');
|
|
swal(" ", response.data.message, "success");
|
|
// swal(" ", "Status added successfully.", "success");
|
|
$scope.initgroup()
|
|
//$state.go($state.current, {}, { reload: true });
|
|
}
|
|
else
|
|
{
|
|
console.log('else')
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
|
|
|
|
});
|
|
}
|
|
|
|
};
|
|
|
|
|
|
$scope.gropu_no='';
|
|
$scope.nnn= '';
|
|
|
|
|
|
|
|
$scope.statusactive=function(Id,active)
|
|
{
|
|
console.log(Id);
|
|
console.log(active)
|
|
var act ='';
|
|
if(active==true)
|
|
{
|
|
act=1;
|
|
}
|
|
else if(active==false)
|
|
{
|
|
act=0;
|
|
}
|
|
|
|
// console.log(act)
|
|
|
|
|
|
var setgroupact = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'setgrpstatus/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
Id: Id,
|
|
IsActive :act,
|
|
|
|
requestDetails: localDetails
|
|
}
|
|
};
|
|
$http(setgroupact).then(function (response) {
|
|
swal('Changes Done to The Group ', response.data.message, "success");
|
|
// swal(" ", "Status added successfully.", "success");
|
|
$scope.initgroup()
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.sendgroup = function(myModelAdd,form)
|
|
{
|
|
var msg = $scope.mobileNumList.message;
|
|
var id =$scope.mobileNumList.grouptype;
|
|
var getnum ={
|
|
|
|
method: 'POST',
|
|
url: apiPoint.url + 'GetNumbers/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestBranch: localDetail.localBranchID,
|
|
PId:id,
|
|
requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID
|
|
}
|
|
};
|
|
|
|
$http(getnum).then(function (response)
|
|
{
|
|
|
|
//console.log(response.data);
|
|
if (response.data.status == 200)
|
|
{
|
|
|
|
if(response.data.details)
|
|
{
|
|
var phoneno = response.data.details;
|
|
// console.log(phoneno)
|
|
angular.forEach((phoneno),function(phoneno,key)
|
|
{
|
|
var phone_number = phoneno.Phone_No;
|
|
|
|
$scope.gropu_no = phone_number;
|
|
|
|
|
|
});
|
|
|
|
var datas = {
|
|
"message": msg,
|
|
"numbers": phoneno
|
|
};
|
|
|
|
// alert(phoneno);
|
|
// return false
|
|
|
|
if(msg == undefined || phoneno =='')
|
|
{
|
|
swal(" ", 'Please Check The Details', "error");
|
|
|
|
//SweetAlert.swal("Here's a message");
|
|
}
|
|
else{
|
|
|
|
// console.log('l')
|
|
// return false
|
|
|
|
var sendMsgStatus = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'sendGroupMsg/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: datas,
|
|
message :msg,
|
|
//number :phone_number,
|
|
requestDetails: localDetails
|
|
}
|
|
};
|
|
$http(sendMsgStatus).then(function (response) {
|
|
if (response.data.msgStatus == true) {
|
|
swal(" ", response.data.message, "success");
|
|
$scope.mobileNumList.message = '';
|
|
$scope.disableSendButton = false;
|
|
} else {
|
|
$scope.disableSendButton = false;
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
console.log('else')
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
|
|
|
|
});
|
|
|
|
// $state.go($state.current, {}, {reload: true});
|
|
|
|
};
|
|
|
|
|
|
$scope.numbers=[];
|
|
$scope.getall_Numbers =function(numid)
|
|
{
|
|
$scope.numbers=[];
|
|
//console.log($scope.numbers);return false;
|
|
var numbers ='';
|
|
|
|
console.log($scope.allnum);
|
|
angular.forEach(($scope.allnum),function(phoneno,key)
|
|
{
|
|
var sId = phoneno.Parent_ID;
|
|
//console.log(sId);
|
|
|
|
if((sId == numid)&&(numid !==''))
|
|
{ console.log(phoneno.Phone_No);
|
|
$scope.numbers.push(phoneno.Phone_No);
|
|
|
|
}
|
|
|
|
// $scope.allnum = phone_number;
|
|
|
|
});
|
|
|
|
console.log($scope.numbers)
|
|
|
|
};
|
|
|
|
|
|
$scope.radio='';
|
|
$scope.string = function(p)
|
|
{
|
|
// alert(p)
|
|
if(p=='false')
|
|
{
|
|
$scope.radio=1;
|
|
}
|
|
|
|
if(p=='true')
|
|
{
|
|
$scope.radio=2;
|
|
}
|
|
|
|
};
|
|
|
|
$scope.editId = -1;
|
|
$scope.setEditId = function (pid) {
|
|
|
|
//alert()
|
|
$scope.editId = pid;
|
|
$scope.viewId = -1;
|
|
};
|
|
|
|
|
|
$scope.setActiveDaactive = function (pid,ParentID)
|
|
{
|
|
var setcondition = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'setValue/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestBranch: localDetail.localBranchID,
|
|
pid :pid,
|
|
ParentID : ParentID,
|
|
requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID
|
|
}
|
|
};
|
|
|
|
$http(setcondition).then(function (response) {
|
|
swal("Number Deleted ", "success");
|
|
$scope.initgroup();
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
$scope.initgroup = function()
|
|
{
|
|
var getStatus = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getGroups/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestBranch: localDetail.localBranchID,
|
|
requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID
|
|
}
|
|
};
|
|
|
|
$http(getStatus).then(function (response) {
|
|
if (response.data.status == 200 && response.data.Status) {
|
|
|
|
console.log(response.data.details);
|
|
$scope.emptyData = true;
|
|
$scope.loader = true;
|
|
|
|
$scope.statusInfo = response.data.details;
|
|
//console.log($scope.statusInfo);
|
|
|
|
} else {
|
|
$scope.emptyData = false;
|
|
$scope.loader = true;
|
|
|
|
$scope.statusInfo = '';
|
|
|
|
}
|
|
});
|
|
|
|
|
|
var getAllnum = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getallnumer/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestBranch: localDetail.localBranchID,
|
|
requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID
|
|
}
|
|
};
|
|
|
|
$http(getAllnum).then(function (response) {
|
|
|
|
// console.log(response.data.status)
|
|
if (response.data.status == 200 && response.data.Status) {
|
|
|
|
|
|
// $scope.emptyData = true;
|
|
// $scope.loader = true;
|
|
|
|
$scope.allnum = response.data.details;
|
|
console.log($scope.allnum);
|
|
|
|
} else {
|
|
$scope.emptyData = false;
|
|
$scope.loader = true;
|
|
|
|
$scope.statusInfo = '';
|
|
|
|
}
|
|
});
|
|
|
|
|
|
};
|
|
|
|
$scope.cancel_save=function()
|
|
{
|
|
|
|
$scope.editId = -1;
|
|
$scope.viewId = 0;
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.AddGroup = {
|
|
submit: function (form,myModel) {
|
|
|
|
var group = myModel.GroupName;
|
|
|
|
if(group == '')
|
|
{
|
|
swal("Group Name Needed ",'', "error");
|
|
}
|
|
else
|
|
{
|
|
|
|
var GroupName = myModel.GroupName;
|
|
|
|
var addgroup = {
|
|
|
|
method: 'POST',
|
|
url: apiPoint.url+'addNewGroup/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
GroupName: myModel.GroupName,
|
|
createdBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID,
|
|
branch : localDetail.localBranchID
|
|
}
|
|
};
|
|
$http(addgroup).then(function (response) {
|
|
//console.log(response);
|
|
if (response.data.status == 200 && response.data.Status) {
|
|
swal(" ", response.data.message, "success");
|
|
// swal(" ", "Status added successfully.", "success");
|
|
$scope.initgroup()
|
|
myModel.GroupName = '';
|
|
// $state.go($state.current, {}, { reload: true });
|
|
} else {
|
|
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}]);
|
|
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", "$rootScope", "$modal", "$log", "API_POINTS", "$http", function ($scope, $rootScope, $modal, $log,apiPoint,$http) {
|
|
//Tooltip for print button
|
|
$scope.dynamicTooltip = 'Student View';
|
|
$scope.userType=JSON.parse(sessionStorage.getItem('localObj')).localType;
|
|
|
|
|
|
// $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,
|
|
branchCode:JSON.parse(sessionStorage.getItem('localObj')).localBranchID
|
|
}
|
|
};
|
|
$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,type,filterby) {
|
|
if(type == '1' || type == '2'){ var result = values;}
|
|
if(type == '3' || type == '5' || type == '7' || type == '8'){
|
|
var result = [];
|
|
for (var i = 0; i < values.length; i++)
|
|
{
|
|
if (values[i].Sem === filterby)
|
|
{
|
|
result.push(values[i]);
|
|
}
|
|
}
|
|
}
|
|
if(type == '4'){
|
|
var result = [];
|
|
for (var i = 0; i < values.length; i++)
|
|
{
|
|
if (values[i].Sem_Year === filterby)
|
|
{
|
|
result.push(values[i]);
|
|
}
|
|
}
|
|
}
|
|
if(type == '6'){
|
|
var result = [];
|
|
for (var i = 0; i < values.length; i++)
|
|
{
|
|
if (values[i].CertificateName === filterby)
|
|
{
|
|
result.push(values[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
var modalInstance1 = $modal.open({
|
|
templateUrl: 'assets/views/student/studentPaymentModal.html',
|
|
controller: 'ModalInstanceCtrl1',
|
|
// size: size,
|
|
resolve: {
|
|
items1: function () {
|
|
var myvalues =
|
|
{
|
|
"values":result,
|
|
"type":type
|
|
};
|
|
return myvalues;
|
|
}
|
|
}
|
|
});
|
|
|
|
modalInstance1.result.then(function (selectedItem) {
|
|
$scope.selected = selectedItem;
|
|
}, function () {
|
|
$log.info('Modal dismissed at: ' + new Date());
|
|
});
|
|
};
|
|
$scope.printStudentDetails = function (details) {
|
|
$rootScope.pdfItems = details;
|
|
|
|
var printInstance = $modal.open({
|
|
templateUrl: 'assets/views/student/studentPdf.html',
|
|
controller: 'studentModalDemoCtrl',
|
|
});
|
|
};
|
|
|
|
// generate pdf for student view
|
|
$scope.export = function(getName) {
|
|
kendo.drawing.drawDOM($("#exportthis")).then(function(group) {
|
|
kendo.drawing.pdf.saveAs(group, getName+".pdf");
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
// 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.values;
|
|
$scope.selectedtype = items1.type;
|
|
|
|
$scope.ok = function () {
|
|
$modalInstance.close($scope.selected.item);
|
|
};
|
|
|
|
$scope.cancel = function () {
|
|
$modalInstance.dismiss('cancel');
|
|
};
|
|
|
|
|
|
}]);
|