sms group
This commit is contained in:
parent
6747e8f65f
commit
a20b48ef48
@ -185,6 +185,17 @@ $route['IncomeExpenseDetails'] = 'DayBook_Controller/getIncomeExpenseDetails';
|
||||
$route['ViewFullIncomeDetails'] = 'DayBook_Controller/ViewFullIncomeDetails';
|
||||
$route['GetSubTypes'] = 'DayBook_Controller/GetSubTypes';
|
||||
|
||||
/* Add New Contact Group */
|
||||
$route['addNewGroup'] = 'Broadcast_Controller/addNewGroup';
|
||||
$route['getGroups'] = 'Broadcast_Controller/getGroups';
|
||||
$route['addphone'] = 'Broadcast_Controller/addphone';
|
||||
$route['GetNumbers'] = 'Broadcast_Controller/GetNumbers';
|
||||
$route['sendGroupMsg'] ='Broadcast_Controller/sendGroupMsg';
|
||||
$route['getallnumer'] = 'Broadcast_Controller/getallnumer';
|
||||
$route['setValue'] = 'Broadcast_Controller/setValue';
|
||||
$route['setgrpstatus'] = 'Broadcast_Controller/setgrpstatus';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -26,8 +26,12 @@ class Broadcast_Controller extends REST_Controller {
|
||||
parent::__construct();
|
||||
$this->methods['getUniversity_post']['limit'] = 100;
|
||||
$this->methods['chkUnivIdExistDetail_post']['limit'] = 100;
|
||||
|
||||
$this->methods['addNewGroup_post']['limit'] = 500;
|
||||
|
||||
// load the broadcast model
|
||||
$this->load->model('Broadcast_model', 'broadcast_model');
|
||||
$this->load->model('Status_model','status_model');
|
||||
}
|
||||
|
||||
// get University, Course, Branch Detailss
|
||||
@ -163,4 +167,200 @@ class Broadcast_Controller extends REST_Controller {
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function addNewGroup_post()
|
||||
{
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$det = $this->post('branch');
|
||||
|
||||
$details['GroupName'] = $this->post('GroupName');
|
||||
$details['CreatedBy'] = $this->post('createdBy');
|
||||
$details['IsActive'] = '1';
|
||||
$details['BranchCode'] = $this->post('branch');
|
||||
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
||||
|
||||
$GroupDetails = $this->broadcast_model->addGroup($details);
|
||||
if ($GroupDetails)
|
||||
{
|
||||
$GroupDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($GroupDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'Something went wrong.please try again!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getGroups_post()
|
||||
{
|
||||
$reqBranch = $this->post('requestBranch');
|
||||
|
||||
$getGroupsDetails = $this->broadcast_model->GetAllGroups($reqBranch);
|
||||
|
||||
if ($getGroupsDetails)
|
||||
{
|
||||
$getGroupsDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getGroupsDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'Something went wrong.please try again!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function addphone_post()
|
||||
{
|
||||
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$det = $this->post('branch');
|
||||
|
||||
// $reqBranch = $this->post('requestBranch');
|
||||
// $PID = $this->post('PId');
|
||||
// $Phone = $this->post('Phone');
|
||||
// $CreatedBy = $this->post('requestedBy');
|
||||
// echo $Phone;
|
||||
|
||||
$details['Phone_No'] = $this->post('Phone');
|
||||
$details['Parent_ID'] = $this->post('PId');
|
||||
$details['CreatedBy'] = $this->post('requestedBy');
|
||||
$details['IsActive'] = '1';
|
||||
$details['BranchCode'] = $this->post('requestBranch');
|
||||
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
||||
|
||||
$PhoneDetails = $this->broadcast_model->addPhone($details);
|
||||
|
||||
if ($PhoneDetails)
|
||||
{
|
||||
$PhoneDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($PhoneDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'Something went wrong.please try again!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function GetNumbers_post()
|
||||
{
|
||||
$reqID = $this->post('PId');
|
||||
$getphonenum = $this->broadcast_model->GetPhone($reqID);
|
||||
|
||||
// print_r($getphonenum);
|
||||
// die();
|
||||
|
||||
if($getphonenum)
|
||||
{
|
||||
$getphonenum['status'] = REST_Controller::HTTP_OK;
|
||||
$this->response($getphonenum, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response([
|
||||
'message' => 'No record found!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function sendGroupMsg_post()
|
||||
{
|
||||
|
||||
$reqDataBy = $this->post('requestDetails');
|
||||
|
||||
$reqData = $this->post('data');
|
||||
|
||||
$message = $reqData["message"];
|
||||
// $numsArr = $reqData["numbers"];
|
||||
|
||||
foreach($reqData['numbers'] as $number){
|
||||
//echo $number['Phone_No'].'<br/>'.$message;
|
||||
$number = $number['Phone_No'];
|
||||
|
||||
$message_st= $this->broadcast_model->multi_sms($number,$message);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($message_st) {
|
||||
$message_st['status'] = REST_Controller::HTTP_OK;
|
||||
$message_st['nu'] = $number;
|
||||
// Set the response and exit
|
||||
$this->response($message_st, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getallnumer_post()
|
||||
{
|
||||
$All_num= $this->broadcast_model->GetAllPhone();
|
||||
|
||||
if($All_num)
|
||||
{
|
||||
$All_num['status'] = REST_Controller::HTTP_OK;
|
||||
$this->response($All_num, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response([
|
||||
'message' => 'No record found!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function setValue_post()
|
||||
{
|
||||
$id= $this->post('pid');
|
||||
$Parent_ID = $this->post('ParentID');
|
||||
$setarray = $this->broadcast_model->SetPhone($id,$Parent_ID);
|
||||
|
||||
//print_r($setarray);
|
||||
}
|
||||
|
||||
public function setgrpstatus_post()
|
||||
{
|
||||
$Id= $this->post('Id');
|
||||
$IsActive = $this->post('IsActive');
|
||||
$arrayact = array('IsActive'=>$IsActive);
|
||||
|
||||
//print_r($arrayact);die();
|
||||
$setgroup =$this->broadcast_model->SetGroupActive($Id,$arrayact);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,4 +400,170 @@ class Broadcast_model extends CI_Model {
|
||||
}
|
||||
return 'records updated!!';
|
||||
}
|
||||
|
||||
|
||||
|
||||
function multi_sms($number,$msg)
|
||||
{
|
||||
|
||||
$message = urlencode($msg);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $number . "&SenderID=APOLLO&Message=" . $message . "&ServiceName=PROMOTIONAL_HIGH");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$arrss = explode('<br>', $output);
|
||||
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$dateTime = $time;
|
||||
$msgGroup = date('YmdHis');
|
||||
//echo count($arrss);die;
|
||||
for ($i = 0, $c = count($arrss);$i < $c;$i++) {
|
||||
// echo $arrss[$i];exit();
|
||||
if ($arrss[$i] === '') {
|
||||
break;
|
||||
} else {
|
||||
$a = explode(':', $arrss[$i]);
|
||||
$msgIdState = $a[0];
|
||||
$msgId = $a[1];
|
||||
$msgNumb = $a[2];
|
||||
$msgStatus = $a[4];
|
||||
$data[] = array('MsgId' => $msgId, 'MobileNumber' => $msgNumb, 'MsgBody' => $message, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($data);die();
|
||||
$this->db->insert_batch('T_BroadcastStatus', $data);
|
||||
if ($this->db->affected_rows() >= 1) {
|
||||
$result['msgStatus'] = true;
|
||||
$result['message'] = "Messages Send Successfully!!";
|
||||
} else {
|
||||
$result['msgStatus'] = false;
|
||||
$result['message'] = "error!!";
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function addGroup($details=null)
|
||||
{
|
||||
$this->db->select('ID');
|
||||
$this->db->from('T_Groups');
|
||||
$this->db->where('GroupName', $details['GroupName']);
|
||||
$query = $this->db->get();
|
||||
$result['details'] = $query->result();
|
||||
if(count($result['details'])>0)
|
||||
{
|
||||
$result['Status'] = false;
|
||||
$result['message'] = "Group name is already exist!";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$this->db->select('count(LAST_INSERT_ID(ID)) as LID');
|
||||
$this->db->from('T_Groups');
|
||||
$qquery = $this->db->get();
|
||||
$res =$qquery->result();
|
||||
$inID = $res[0]->LID+1;
|
||||
$this->db->insert('T_Groups',$details);
|
||||
$result['Status'] = true;
|
||||
$result['message'] = "Group Created!";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function GetAllGroups($reqBranch)
|
||||
{
|
||||
|
||||
|
||||
$this->db->select('*');
|
||||
$this->db->from('T_Groups');
|
||||
$this->db->where('BranchCode',$reqBranch);
|
||||
$qquery = $this->db->get();
|
||||
|
||||
if($qquery->result()){
|
||||
|
||||
$result['Status'] = true;
|
||||
$result['details'] = $qquery->result();
|
||||
}
|
||||
else {
|
||||
$result['Status'] = false;
|
||||
$result['message'] = "No records found!";
|
||||
}
|
||||
|
||||
//print_r($result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function GetPhone($reqID)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('T_Groups_Numbers ');
|
||||
$this->db->where('Parent_ID',$reqID);
|
||||
$query=$this->db->get();
|
||||
if($query->result())
|
||||
{
|
||||
$result['Status'] = true;
|
||||
$result['details'] = $query->result();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['Status'] = false;
|
||||
$result['message'] = "No Numbers Found!";
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function GetAllPhone()
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('T_Groups_Numbers ');
|
||||
|
||||
$query=$this->db->get();
|
||||
if($query->result())
|
||||
{
|
||||
$result['Status'] = true;
|
||||
$result['details'] = $query->result();
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['Status'] = false;
|
||||
$result['message'] = "No records found!";
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function SetPhone($id,$Parent_ID)
|
||||
{
|
||||
$this->db->where('ID', $id);
|
||||
$this->db->where('Parent_ID', $Parent_ID);
|
||||
$this->db->delete('T_Groups_Numbers');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function SetGroupActive($Id,$arrayact)
|
||||
{
|
||||
$this->db->where('ID', $Id);
|
||||
$this->db->update('T_Groups', $arrayact);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,6 +184,8 @@ app.controller('sendSMSsuperadminCtrl', ["$scope", "$filter", "ngTableParams", "
|
||||
|
||||
$scope.statusUpdate = {
|
||||
submit: function (form, msg_details) {
|
||||
|
||||
// alert()
|
||||
var firstError = null;
|
||||
if (form.$invalid) {
|
||||
var field = null, firstError = null;
|
||||
@ -280,6 +282,15 @@ app.controller('sendSMSsuperadminCtrl', ["$scope", "$filter", "ngTableParams", "
|
||||
"mobile" : "",
|
||||
"messange": ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.myModel = {
|
||||
"GroupName" : "",
|
||||
|
||||
}
|
||||
|
||||
$scope.listMobileNums = [];
|
||||
$scope.addContactsList = function() {
|
||||
// alert($scope.mobileNumList.mobile);
|
||||
@ -349,8 +360,13 @@ app.controller('sendSMSsuperadminCtrl', ["$scope", "$filter", "ngTableParams", "
|
||||
// add a new daybook entry
|
||||
$scope.composeMsg = {
|
||||
submit: function (form) {
|
||||
|
||||
|
||||
var firstError = null;
|
||||
// console.log(form.$invalid);
|
||||
if (form.$invalid) {
|
||||
|
||||
// alert('in')
|
||||
var field = null, firstError = null;
|
||||
for (field in form) {
|
||||
if (field[0] != '$') {
|
||||
@ -364,7 +380,11 @@ app.controller('sendSMSsuperadminCtrl', ["$scope", "$filter", "ngTableParams", "
|
||||
}
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
} else {
|
||||
|
||||
|
||||
if($scope.listMobileNums.length > 0) {
|
||||
|
||||
|
||||
$scope.disableSendButton = true;
|
||||
var msg = $scope.mobileNumList.message;
|
||||
// alert(msg);
|
||||
@ -431,6 +451,424 @@ $scope.disableSendButton = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$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(localStorage.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(localStorage.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(localStorage.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(localStorage.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(localStorage.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) {
|
||||
//alert()
|
||||
var GroupName = myModel.GroupName;
|
||||
|
||||
var addgroup = {
|
||||
|
||||
method: 'POST',
|
||||
url: apiPoint.url+'addNewGroup/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
GroupName: myModel.GroupName,
|
||||
createdBy: JSON.parse(localStorage.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()
|
||||
$state.go($state.current, {}, { reload: true });
|
||||
} else {
|
||||
|
||||
swal(" ", response.data.message, "error");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}]);
|
||||
app.filter('unique', function() {
|
||||
return function(collection, primaryKey, secondaryKey) { //optional secondary key
|
||||
@ -552,6 +990,10 @@ app.controller('studentModalDemoCtrl', ["$scope", "$rootScope", "$modal", "$log"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}]);
|
||||
|
||||
// Please note that $modalInstance represents a modal window (instance) dependency.
|
||||
|
||||
106
Apollo/assets/views/addcontact.html
Normal file
106
Apollo/assets/views/addcontact.html
Normal file
@ -0,0 +1,106 @@
|
||||
<form name="Form" id="form" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<fieldset>
|
||||
<legend>
|
||||
Add Phone Number
|
||||
</legend>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3 form-group" ng-class="{'has-error':Form.ListCode.$dirty && Form.ListCode.$invalid, 'has-success':Form.ListCode.$valid}">
|
||||
<!-- <label>
|
||||
Status ID<span class="symbol required"></span>
|
||||
</label> -->
|
||||
|
||||
<input type="hidden" placeholder="Enter Status ID" tabindex="1" class="form-control" name="StatusID" ng-model="p.ID"
|
||||
readonly required/>
|
||||
<!-- <span class="error text-small block" ng-if="Form.ListCode.$dirty && Form.ListCode.$error.required">status ID is required</span> -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3 form-group" ng-class="{'has-error':Form.ListName.$dirty && Form.ListName.$invalid, 'has-success':Form.ListName.$valid}">
|
||||
<label>
|
||||
Phone Number<span class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="Enter Phone Number" tabindex="1" class="form-control" name="Phone" id="Phone" ng-model="p.ListName" ng-pattern="/^[0-9-+]*$/" minlength="6" maxlength="13"/>
|
||||
<!-- <span class="error text-small block" ng-if="Form.ListName.$dirty && Form.ListName.$error.required">Phone number required</span> -->
|
||||
|
||||
<span class="error text-small block" ng-if="Form.ListName.$dirty && Form.ListName.$error.pattern && Form.ListName.$error.minlength && Form.ListName.$error.maxlength">Phone number required </span>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- <div class="col-md-3">
|
||||
<label>
|
||||
Active/De-Active
|
||||
</label>
|
||||
<div ng-if="p.IsActive==true">
|
||||
|
||||
<switch ng-model="p.IsActive" ng-init="p.IsActive = true" class="green"></switch>
|
||||
|
||||
</div>
|
||||
<div ng-if="p.IsActive==false">
|
||||
<switch ng-model="p.IsActive" ng-init="p.IsActive = false" class="green"></switch>
|
||||
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<button type="submit" ladda="ldloading.zoom_in" tabindex="9" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="updatestatus(p,Form,'zoom-in')">
|
||||
Save
|
||||
</button>
|
||||
|
||||
<input type="button" class="btn btn-warning btn-wide" tabindex="10" value="Cancel" ng-click="cancel_save()">
|
||||
|
||||
</input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- {{p.ID}} -->
|
||||
<table id="datatable" class="table table-hover">
|
||||
<thead>
|
||||
<tr >
|
||||
<th style="font-size: 12px;">Number</th>
|
||||
<th style="font-size: 12px;">Status</th>
|
||||
<th style="font-size: 12px;">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody ng-repeat="pi in allnum">
|
||||
<tr ng-if="p.ID == pi.Parent_ID">
|
||||
|
||||
<td style="font-size: 15px;">{{pi.Phone_No}}</td>
|
||||
<td style="font-size: 15px;" ng-if="pi.IsActive==true">Active</td>
|
||||
<td><!-- <input type="button" name="Active/De-Active" tooltip="Click here to activate/De-Active The Number"> -->
|
||||
<a class="text-azure" id="editAction{{pi.ID}}" ng-click="setActiveDaactive(pi.ID,p.ID);"><b class="fa fa-hover fa-trash" tooltip="Click here to Delete The Number" aria-hidden="true"></b>
|
||||
</a>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- class="editRowTd" -->
|
||||
@ -481,6 +481,8 @@
|
||||
|
||||
<!-- end: Super Admin -->
|
||||
|
||||
|
||||
|
||||
<!-- start: Admin -->
|
||||
|
||||
<ul class="main-navigation-menu" ng-if="getLoginDash == 'Admin'">
|
||||
@ -757,7 +759,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li ng-class="{'active open':$state.includes('app.hallTicket')}" ng-if="is_active_DayBookAprlAccess == '1'">
|
||||
<li ng-class="{'active open':$state.includes('app.hallTicket')}">
|
||||
<a href="javascript:void(0)">
|
||||
<div class="item-content">
|
||||
<div class="item-media">
|
||||
@ -845,7 +847,7 @@
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
<li ng-class="{'active open':$state.includes('app.reports')}" ng-if="is_active_DayBookAprlAccess == '1'">
|
||||
<li ng-class="{'active open':$state.includes('app.reports')}">
|
||||
<a href="javascript:void(0)">
|
||||
<div class="item-content">
|
||||
<div class="item-media">
|
||||
|
||||
@ -327,7 +327,21 @@
|
||||
<label>
|
||||
</label>
|
||||
</div>-->
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<label>
|
||||
<input type="radio" ng-model="message" value="false" ng-click="string(message)">
|
||||
Number
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="radio" ng-model="message" value="true" ng-click="string(message)">
|
||||
Group
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" ng-if="radio==1">
|
||||
|
||||
<label>Multiple Mobile Numbers : <span class="symbol required"></span>
|
||||
</label>
|
||||
@ -346,14 +360,14 @@
|
||||
<!--ng-click="addContactsList(mobileNumList)"-->
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6" ng-if="radio==1">
|
||||
<div class="mobileNumberList">
|
||||
<ul>
|
||||
<li ng-repeat="num in listMobileNums track by $index"><span class="lableValue">{{num}}</span><span class="deletBtn" ng-click="deletMobileList(num)">X</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--<div>
|
||||
<label>Mobile Numbers : </label> <textarea class="inputCls" ng-model="mobileNumList.mobile"></textarea>
|
||||
@ -362,7 +376,7 @@
|
||||
<label>Mobile Numbers : </label> <input type="text" class="inputCls" ng-model="mobileNumList.mobile"><button class="addBtn" ng-click="addContactsList(mobileNumList)">add</button>
|
||||
</div>-->
|
||||
|
||||
<div class="row">
|
||||
<div class="row" ng-if="radio==1">
|
||||
<div class="pull-left">
|
||||
<button type="submit" ng-disabled="disableSendButton" tabindex="4" ladda="ldloading1.zoom_in" class="btn btn-sm btn-success"
|
||||
data-style="zoom-in">
|
||||
@ -373,8 +387,138 @@
|
||||
</button>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" ng-if="radio==2">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<select class="form-control" tabindex="1" class="cs-select cs-skin-elastic" name="addType" ng-model="mobileNumList.grouptype" ng-Change="getall_Numbers(mobileNumList.grouptype);" required>
|
||||
<option value="-1"> SELECT </option>
|
||||
<option ng-repeat="p in statusInfo" value="{{p.ID}}"">{{p.GroupName}}</option>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<textarea rows="4" col="3" class="form-control" name="content" ng-model="numbers"></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</br>
|
||||
<!-- <div class="col-md-6">
|
||||
|
||||
<textarea rows="4" col="3" class="form-control" name="content" ng-model="numbers"></textarea>
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="col-offset" ng-repeat="i in allnum">
|
||||
<div >
|
||||
{{i.Phone_No}}
|
||||
</div>
|
||||
</div> -->
|
||||
<br/>
|
||||
|
||||
<div class="col-md-12">
|
||||
<br/>
|
||||
<div class="pull-left">
|
||||
<input type="button" class="btn btn-sm btn-success" tabindex="10" value="Send" ng-click="sendgroup(Form);">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</tab>
|
||||
|
||||
|
||||
<tab heading="Manage Groups">
|
||||
|
||||
|
||||
<form name="Form" id="Form" novalidate ng-submit="AddGroup.submit(Form,myModel)" method="post">
|
||||
<fieldset>
|
||||
<legend>Add New</legend>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group" ng-class="">
|
||||
<label>
|
||||
Group Name <span class="symbol required"></span>
|
||||
</label>
|
||||
<input type="text" placeholder="Enter Group Name" tabindex="1" class="form-control" name="GroupName" ng-model="myModel.GroupName"
|
||||
ng-pattern="/^[a-zA-Z0-9.\s]*$/" capitalize required/>
|
||||
<span class="error text-small block" ng-if="Form.GroupName.$dirty && Form.GroupName.$error.required">Group Name is required</span>
|
||||
<span class="error text-small block" ng-if="Form.GroupName.$dirty && Form.GroupName.$error.pattern">Invalid Group Name </span>
|
||||
</div>
|
||||
<div class="col-md-2" style="padding-top: 2.3%;">
|
||||
<div class="pull-right">
|
||||
<button type="submit" ladda="ldloading1.zoom_in" tabindex="2" class="btn btn-wide btn-success" data-style="zoom-in">
|
||||
Add
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<table class="table table-hover" ng-init="initgroup();">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th ng-click="sort('ListName')">Group Name
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='ListName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"> </span>
|
||||
</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- {{statusInfo}} -->
|
||||
<tbody dir-paginate="p in statusInfo|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10">
|
||||
<tr>
|
||||
|
||||
<td>{{p.GroupName}}</td>
|
||||
<td><span ng-if="p.IsActive == 1"> Active </span><span ng-if="p.IsActive == 0">In-Active</span></td>
|
||||
<td>
|
||||
<a class="text-azure" id="editRowBtn{{p.ID}}" ng-click="setEditId(p.ID);"><b class="fa fa-hover fa-plus" tooltip="Add Contact" aria-hidden="true"></b>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label>
|
||||
Active/De-Active
|
||||
</label>
|
||||
<div ng-if="p.IsActive==true">
|
||||
|
||||
<switch ng-change="statusactive(p.ID,p.IsActive)" ng-model="p.IsActive" ng-init="p.IsActive = true" class="green"></switch>
|
||||
|
||||
</div>
|
||||
<div ng-if="p.IsActive==false">
|
||||
<switch ng-change="statusactive(p.ID,p.IsActive)" ng-model="p.IsActive" ng-init="p.IsActive = false" class="green"></switch>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr ng-show="editId === p.ID" ng-if="editId === p.ID">
|
||||
<td colspan="12" ng-include src="'assets/views/addcontact.html'"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<dir-pagination-controls max-size="10" direction-links="true" boundary-links="true">
|
||||
</dir-pagination-controls>
|
||||
|
||||
|
||||
</tab>
|
||||
</tabset>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user