116 lines
3.9 KiB
JavaScript
Executable File
116 lines
3.9 KiB
JavaScript
Executable File
'use strict';
|
|
/*** controller for Wizard Form example***/
|
|
app.controller('sendSMSDetailssuperadminCtrl', ["$scope", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', function ($scope, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie) {
|
|
|
|
/**
|
|
* Send SMS Details Functionality
|
|
* by : kdk
|
|
*/
|
|
var localDetail = JSON.parse(localStorage.getItem('localObj'));
|
|
var localDetails = ipCookie('cookiechk');
|
|
$scope.searchLoading = false;
|
|
$scope.searchData = {
|
|
"date": "",
|
|
"dateTo": ""
|
|
}
|
|
$scope.init = function () {
|
|
if (localDetail != null) {
|
|
$scope.currentDate = new Date();
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.searchData.date = $filter('date')(new Date($scope.currentDate), formate);
|
|
$scope.searchData.dateTo = $filter('date')(new Date($scope.currentDate), formate);
|
|
$scope.getSmsReport();
|
|
} else {
|
|
}
|
|
};
|
|
|
|
// change from date, update and call search functionality
|
|
$scope.changeDate = function () {
|
|
if ($scope.searchData.date !== undefined) {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.searchData.date = $filter('date')(new Date($scope.searchData.date), formate);
|
|
$scope.getSmsReport();
|
|
} else {
|
|
$scope.searchData.date = '';
|
|
$scope.getSmsReport();
|
|
}
|
|
}
|
|
|
|
// change to date, update and call search functionality
|
|
$scope.changeToDate = function () {
|
|
if ($scope.searchData.dateTo !== undefined) {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.searchData.dateTo = $filter('date')(new Date($scope.searchData.dateTo), formate);
|
|
$scope.getSmsReport();
|
|
} else {
|
|
$scope.searchData.dateTo = '';
|
|
$scope.getSmsReport();
|
|
}
|
|
}
|
|
|
|
$scope.resData = '';
|
|
// get report for the smssended
|
|
$scope.getSmsReport = function() {
|
|
// console.log($scope.searchData);
|
|
$scope.searchLoading = true;
|
|
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.smsSendDetailsListStatus) {
|
|
$scope.resData = response.data.smsSendDetailsList;
|
|
$scope.searchLoading = false;
|
|
} else {
|
|
$scope.searchLoading = false;
|
|
}
|
|
});
|
|
};
|
|
|
|
$scope.setEditId = function (P) {
|
|
// alert(P);
|
|
$scope.editId = P;
|
|
}
|
|
|
|
$scope.cancel = function () {
|
|
$scope.editId = -1;
|
|
}
|
|
|
|
$scope.resGroupSendData = '';
|
|
$scope.getPartMesgDetailsLoading = false;
|
|
$scope.prevNoRecordFound = false;
|
|
$scope.getPartMesgDetails = function(p) {
|
|
$scope.getPartMesgDetailsLoading = true;
|
|
var getMsgDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getSMSGroupDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: p.MsgGroup,
|
|
requestDetails: localDetails
|
|
}
|
|
};
|
|
$http(getMsgDetails).then(function (response) {
|
|
if (response.data.smsSendGroupDetailsListStatus) {
|
|
$scope.resGroupSendData = response.data.smsSendGroupDetailsList;
|
|
$scope.prevNoRecordFound = true;
|
|
$scope.getPartMesgDetailsLoading = false;
|
|
} else {
|
|
$scope.prevNoRecordFound = false;
|
|
$scope.getPartMesgDetailsLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
}]);
|