Commit 6ead949a by Tobin

dc

parent 5fb74265
[1] Merchant ID : 201901291000002
[2] Merchant Key : +Hu4bL6iVk943JmFAvGtWEYMODFry4fad2I+iM0X2m0=
[3] Collaborator ID : BAYANPAY
[4] Bayan URL : https://staging.bayanpay.sa/direcpay/secure/PaymentTxnServlet
[5] Block Existence Indicator : 1110000
[6] DataBlock1 : TransactionDataBlock1 : 11111111|1552564762|100.00|http://localhost/timeOut/Api/paymentGateway|http://localhost/timeOut/Api/paymentGateway|INTERNET|CC|01|SAR
[7] DataBlock2 : billingDataBlock : 1111111111000|Soloman|Vandy|123,ParkStreet|Park Street|Riyadh|Riyadh|400081|IN|[email protected]|9820998209
[8] DataBlock3 : shippingDataBlock : 111111110001|Soloman|Vandy|123ParkStreet|parkstreet|Riyadh|Riyadh|400081|IN|9820998209
[9] DataBlock4 : paymentDataBlock : NULL
[10] DataBlock5 : merchantDataBlock : NULL
[11] DataBlock6 : otherDataBlock : NULL
[12] DataBlock7 : DCCDataBlock : NULL
[13] beforeEncryptionString : 1110000||11111111|1552564762|100.00|http://localhost/timeOut/Api/paymentGateway|http://localhost/timeOut/Api/paymentGateway|INTERNET|CC|01|SAR||1111111111000|Soloman|Vandy|123,ParkStreet|Park Street|Riyadh|Riyadh|400081|IN|[email protected]|9820998209||111111110001|Soloman|Vandy|123ParkStreet|parkstreet|Riyadh|Riyadh|400081|IN|9820998209
[14] EncryptedString : RKeCiPHQnrq4Ih8pVYOhUNd0KfqxD2Qby/wkUPbEvj23Xft2HvphIethb29a7Myq8E5b0uHFoKs9UpMiz9/j9ntt08QUmxUUx6796JKGexbz3qX7HwMuZaG31+FgM6BL1NqoybToj95/b2VpJ+PiznhjDPKtRHw1ghUTYRUdmM6z8dhuPGjfgKHvD93wH7p3SnktHyQVwa77nPyBT+3xVSARLWSHMzJn128/EaKVn37Hw9ml6NBR//D2fZhopsnvcdOWVLS9EOGffPbaSX3oijDjxaiW1BzrfC9opGdzXY9Vih9sohxhgqHIWvNakCk5Ctqav7hC23iZ5Aj4PCaILTpDUfQsHpF4RaP4HtC+P94DYFWPuScMYy+yeEjWCuDWNj1pcJBUwFqmN4ZHlafClfMm6vLfJOCspMq+8MShA0T/NvYd9fNYPg8C5Kl3HSTEF7cbGU7qNFT/vrlNlHkYNw==
[15] BayanPostData : 201901291000002||BAYANPAY||RKeCiPHQnrq4Ih8pVYOhUNd0KfqxD2Qby/wkUPbEvj23Xft2HvphIethb29a7Myq8E5b0uHFoKs9UpMiz9/j9ntt08QUmxUUx6796JKGexbz3qX7HwMuZaG31+FgM6BL1NqoybToj95/b2VpJ+PiznhjDPKtRHw1ghUTYRUdmM6z8dhuPGjfgKHvD93wH7p3SnktHyQVwa77nPyBT+3xVSARLWSHMzJn128/EaKVn37Hw9ml6NBR//D2fZhopsnvcdOWVLS9EOGffPbaSX3oijDjxaiW1BzrfC9opGdzXY9Vih9sohxhgqHIWvNakCk5Ctqav7hC23iZ5Aj4PCaILTpDUfQsHpF4RaP4HtC+P94DYFWPuScMYy+yeEjWCuDWNj1pcJBUwFqmN4ZHlafClfMm6vLfJOCspMq+8MShA0T/NvYd9fNYPg8C5Kl3HSTEF7cbGU7qNFT/vrlNlHkYNw==
\ No newline at end of file
...@@ -265,7 +265,7 @@ class Api extends CI_Controller { ...@@ -265,7 +265,7 @@ class Api extends CI_Controller {
public function event() { public function event() {
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
//$data['auth_token'] = $this->auth_token; $data['auth_token'] = (isset($this->auth_token))?$this->auth_token:'';
$res = $this->Api_model->event($data); $res = $this->Api_model->event($data);
if($res['status']!=0){ if($res['status']!=0){
$this->response($res['data']); $this->response($res['data']);
...@@ -328,7 +328,7 @@ class Api extends CI_Controller { ...@@ -328,7 +328,7 @@ class Api extends CI_Controller {
$res = $this->Api_model->payNow($payData); $res = $this->Api_model->payNow($payData);
if($res['status']==1){ if($res['status']==1){
$this->paymentGateway($amount,$res['transaction_id'],$event_id,$booking_id); $this->paymentGateway($amount,$res['transaction_id'],$event_id,$booking_id,$res['custData']);
} }
else{ else{
redirect('https://projects.nuvento.com/failure?event_id='.$eventid); redirect('https://projects.nuvento.com/failure?event_id='.$eventid);
...@@ -380,9 +380,9 @@ class Api extends CI_Controller { ...@@ -380,9 +380,9 @@ class Api extends CI_Controller {
} }
} }
public function paymentGateway($amount='0',$lastid='0',$event_id='0',$booking_id='0'){ public function paymentGateway($amount='0',$lastid='0',$event_id='0',$booking_id='0',$custData=array()){
BayanPayPayment(); BayanPayPayment();
$BayanPayArray = $this->bayanPayArray($amount,$lastid,$event_id,$booking_id); $BayanPayArray = $this->bayanPayArray($amount,$lastid,$event_id,$booking_id,$custData);
$BayanPayOnlineObject = new BayanPayBitmapPaymentIntegration($BayanPayArray); $BayanPayOnlineObject = new BayanPayBitmapPaymentIntegration($BayanPayArray);
$requestParameter = $BayanPayOnlineObject->BayanPostData; $requestParameter = $BayanPayOnlineObject->BayanPostData;
...@@ -405,8 +405,9 @@ class Api extends CI_Controller { ...@@ -405,8 +405,9 @@ class Api extends CI_Controller {
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} }
function bayanPayArray($amount = '0',$lastid='',$event_id='',$booking_id=''){ function bayanPayArray($amount='0',$lastid='',$event_id='',$booking_id='',$custData=array()){
$settings = getSettings(); $settings = getSettings();
$BayanPayArray = $BayanPayArray =
array( array(
'BayanPay_Online_setting' => array( 'BayanPay_Online_setting' => array(
...@@ -414,7 +415,7 @@ class Api extends CI_Controller { ...@@ -414,7 +415,7 @@ class Api extends CI_Controller {
'merchantId' => $settings['merchant_id'], 'merchantId' => $settings['merchant_id'],
'collaboratorId' => 'BAYANPAY', 'collaboratorId' => 'BAYANPAY',
'iv' => '0123456789abcdef', 'iv' => '0123456789abcdef',
'url' => false// Set to false if you are using testing environment , set to true if you are using live environment 'url' => false
), ),
'Block_Existence_Indicator'=> array( 'Block_Existence_Indicator'=> array(
'transactionDataBlock' => true, 'transactionDataBlock' => true,
...@@ -436,65 +437,65 @@ class Api extends CI_Controller { ...@@ -436,65 +437,65 @@ class Api extends CI_Controller {
'currency' => 'SAR' 'currency' => 'SAR'
), ),
'Field_Existence_Indicator_Billing' => array( 'Field_Existence_Indicator_Billing' => array(
'billToFirstName' => 'Soloman', 'billToFirstName' => $custData->name,
'billToLastName' => 'Vandy', 'billToLastName' => '',
'billToStreet1' => '123,ParkStreet', 'billToStreet1' => '',
'billToStreet2' => 'Park Street', 'billToStreet2' => '',
'billToCity' => 'Riyadh', 'billToCity' => '',
'billToState' => 'Riyadh', 'billToState' => '',
'billtoPostalCode' => '400081', 'billtoPostalCode' => '',
'billToCountry' => 'IN', 'billToCountry' => '',
'billToEmail' => '[email protected]', 'billToEmail' => $custData->email,
'billToMobileNumber' => '9820998209', 'billToMobileNumber' => $custData->phone,
'billToPhoneNumber1' => '', 'billToPhoneNumber1' => '',
'billToPhoneNumber2' => '', 'billToPhoneNumber2' => '',
'billToPhoneNumber3' => '' 'billToPhoneNumber3' => ''
), ),
'Field_Existence_Indicator_Shipping' => array( 'Field_Existence_Indicator_Shipping' => array(
'shipToFirstName' => 'Soloman', 'shipToFirstName' => $custData->name,
'shipToLastName' => 'Vandy', 'shipToLastName' => '',
'shipToStreet1' => '123ParkStreet', 'shipToStreet1' => '',
'shipToStreet2' => 'parkstreet', 'shipToStreet2' => '',
'shipToCity' => 'Riyadh', 'shipToCity' => '',
'shipToState' => 'Riyadh', 'shipToState' => '',
'shipToPostalCode' => '400081', 'shipToPostalCode' => '',
'shipToCountry' => 'IN', 'shipToCountry' => '',
'shipToPhoneNumber1' => '', 'shipToPhoneNumber1' => '',
'shipToPhoneNumber2' => '', 'shipToPhoneNumber2' => '',
'shipToPhoneNumber3' => '', 'shipToPhoneNumber3' => '',
'shipToMobileNumber' => '9820998209' 'shipToMobileNumber' => $custData->phone
), ),
'Field_Existence_Indicator_Payment' => array( 'Field_Existence_Indicator_Payment' => array(
'cardNumber' => '4111111111111111', // 1. Card Number 'cardNumber' => '4111111111111111',
'expMonth' => '08', // 2. Expiry Month 'expMonth' => '08',
'expYear' => '2020', // 3. Expiry Year 'expYear' => '2020',
'CVV' => '123', // 4. CVV 'CVV' => '123',
'cardHolderName' => 'Soloman', // 5. Card Holder Name 'cardHolderName' => 'Soloman',
'cardType' => 'Visa', // 6. Card Type 'cardType' => 'Visa',
'custMobileNumber' => '9820998209', // 7. Customer Mobile Number 'custMobileNumber' => '9820998209',
'paymentID' => '123456', // 8. Payment ID 'paymentID' => '123456',
'OTP' => '123456', // 9. OTP field 'OTP' => '123456',
'gatewayID' => '1026', // 10.Gateway ID 'gatewayID' => '1026',
'cardToken' => '1202' // 11.Card Token 'cardToken' => '1202'
), ),
'Field_Existence_Indicator_Merchant' => array( 'Field_Existence_Indicator_Merchant' => array(
'UDF1' => $lastid, 'UDF1' => $lastid,
'UDF2' => $event_id, 'UDF2' => $event_id,
'UDF3' => $booking_id 'UDF3' => $booking_id
), ),
'Field_Existence_Indicator_OtherData' => array( 'Field_Existence_Indicator_OtherData' => array(
'custID' => '12345', 'custID' => $custData->userId,
'transactionSource' => 'IVR', 'transactionSource' => 'IVR',
'productInfo' => 'Book', 'productInfo' => '',
'isUserLoggedIn' => 'Y', 'isUserLoggedIn' => '',
'itemTotal' => '500.00, 1000.00', 'itemTotal' => '',
'itemCategory' => 'CD, Book', 'itemCategory' => '',
'ignoreValidationResult'=> 'FALSE' 'ignoreValidationResult'=> 'FALSE'
), ),
'Field_Existence_Indicator_DCC' => array( 'Field_Existence_Indicator_DCC' => array(
'DCCReferenceNumber' => '09898787', // DCC Reference Number 'DCCReferenceNumber' => $lastid.$event_id.$booking_id,
'foreignAmount' => '240.00', // Foreign Amount 'foreignAmount' => $amount,
'ForeignCurrency' => 'USD' // Foreign Currency 'ForeignCurrency' => 'SAR'
) )
); );
return $BayanPayArray; return $BayanPayArray;
...@@ -536,4 +537,4 @@ class Api extends CI_Controller { ...@@ -536,4 +537,4 @@ class Api extends CI_Controller {
$res = $this->Api_model->verifyMail(array('unique_id'=>$unique_id)); $res = $this->Api_model->verifyMail(array('unique_id'=>$unique_id));
} }
} }
?> ?>
\ No newline at end of file
...@@ -105,8 +105,11 @@ class CMS extends CI_Controller { ...@@ -105,8 +105,11 @@ class CMS extends CI_Controller {
if(!isset($_POST['verify_mail']) || empty($_POST['verify_mail'])){ if(!isset($_POST['verify_mail']) || empty($_POST['verify_mail'])){
unset($_POST['verify_mail']); unset($_POST['verify_mail']);
} }
if(!isset($_POST['registration_sms']) || empty($_POST['registration_sms'])){ if(!isset($_POST['staff_reg_mail']) || empty($_POST['staff_reg_mail'])){
unset($_POST['registration_sms']); unset($_POST['staff_reg_mail']);
}
if(!isset($_POST['registration_mail']) || empty($_POST['registration_mail'])){
unset($_POST['registration_mail']);
} }
if(!isset($_POST['registration_mail']) || empty($_POST['registration_mail'])){ if(!isset($_POST['registration_mail']) || empty($_POST['registration_mail'])){
unset($_POST['registration_mail']); unset($_POST['registration_mail']);
......
...@@ -183,6 +183,18 @@ class Event extends CI_Controller { ...@@ -183,6 +183,18 @@ class Event extends CI_Controller {
$status = $this->Event_model->createEventMedia($evtMediaData); $status = $this->Event_model->createEventMedia($evtMediaData);
} }
// START - NEW EVENT NOTIFICATION MAIL \\
$settings = getSettings();
$this->load->model('Api_model');
$subject = "TimeOut, New Event Created";
$emailId = $settings['admin_mail_id'];
$message = "<html><body>
New Event Created, event name: <strong>".$_POST['event_name']."</strong>
</body></html>";
$this->Api_model->send_mail($subject,$emailId,$message);
// END - NEW EVENT NOTIFICATION MAIL \\
$flashMsg['class'] = 'success'; $flashMsg['class'] = 'success';
$flashMsg['message'] = 'Event Created'; $flashMsg['message'] = 'Event Created';
......
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Staff extends CI_Controller {
public function __construct() {
parent::__construct();
date_default_timezone_set("Asia/Riyadh");
$this->load->model('Staff_model');
if(!$this->session->userdata('logged_in')) {
redirect(base_url());
}
}
public function addStaff(){
$template['page'] = 'Staff/staffForm';
$template['menu'] = 'Staff Management';
$template['smenu'] = 'Add Staff';
$template['pTitle'] = "Add Staff";
$template['pDescription'] = "Create New Staff";
$this->load->view('template',$template);
}
public function viewStaffs(){
$template['page'] = 'Staff/viewStaff';
$template['menu'] = 'Staff Management';
$template['smenu'] = 'View Staffs';
$template['pTitle'] = "View Staffs";
$template['pDescription'] = "View and Manage Staffs";
$template['page_head'] = "Staff Management";
$template['staff_data'] = $this->Staff_model->getStaffData('','0,1');
$this->load->view('template',$template);
}
function changeStatus($staff_id = '',$status = '1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($staff_id) || !is_numeric($staff_id = decode_param($staff_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Staff/viewStaffs'));
}
$status = $this->Staff_model->changeStatus($staff_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Staff/viewStaffs'));
}
public function createStaff(){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST) || !isset($_FILES) || empty($_FILES)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Staff/addStaff'));
}
if($err == 0 && (!isset($_POST['display_name']) || empty($_POST['display_name']))){
$err = 1;
$errMsg = 'Provide Staff Name';
}else if($err == 0 && (!isset($_POST['username']) || empty($_POST['username']))){
$err = 1;
$errMsg = 'Provide a Staff Username (Email-ID)';
}else if($err == 0 && (!isset($_POST['password']) || empty($_POST['password']))){
$err = 1;
$errMsg = 'Provide a Proper Password';
}
if($err == 0){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['profile_image']['name'];
$this->upload->initialize($config);
if(!$this->upload->do_upload('profile_image')){
$err = 1;
$errMsg = $this->upload->display_errors();
}else{
$upload_data = $this->upload->data();
$_POST['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Staff/addStaff'));
}
$password = $_POST['password'];
$_POST['password']= md5($_POST['password']);
$status = $this->Staff_model->addStaff($_POST);
if($status == 1){
$this->load->model('Api_model');
$subject = "Your TimeOut Staff Account is now active";
$email_id = $_POST['username'];
$template = getNotifTemplate();
$message = "<html>
<body>
Hi,\n\r Welcome to TimeOut. \r\n Please use username:
".$email_id." and Password: ".$password." for access your account
<br>
</body>
</html>";
if(isset($template['staff_reg_mail']) && !empty($template['staff_reg_mail'])){
$message = str_replace(array('{:user_name}','{:password}'),array($email_id,$password),
$template['staff_reg_mail']);
}
$this->Api_model->send_mail($subject,$email_id,$message);
$flashMsg =array('message'=>'Successfully Created Your Account..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Staff/viewStaffs'));
} else if($status == 2){
$flashMsg = array('message'=>'Username (Email-ID) alrady exist..!','class'=>'error');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Staff/addStaff'));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Staff/addStaff'));
}
}
public function editStaffs($staff_id){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(empty($staff_id) || !is_numeric($staff_id = decode_param($staff_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Staff/viewStaffs'));
}
$template['page'] = 'Staff/staffForm';
$template['menu'] = 'Staff Management';
$template['smenu'] = 'Edit Staff';
$template['pTitle'] = "Edit Staffs";
$template['pDescription'] = "Update Staff Data";
$template['staff_data'] = $this->Staff_model->getStaffData($staff_id,'0,1');
$template['staff_id'] = encode_param($staff_id);
$this->load->view('template',$template);
}
public function updateStaff($staff_id = ''){
$err = 0;
$errMsg = '';
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'error');
if(!isset($_POST) || empty($_POST) || !isset($_FILES) || empty($_FILES)){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Staff/addStaff'));
}
if($err == 0 && (!isset($_POST['display_name']) || empty($_POST['display_name']))){
$err = 1;
$errMsg = 'Provide Staff Name';
}else if($err == 0 && (!isset($_POST['username']) || empty($_POST['username']))){
$err = 1;
$errMsg = 'Provide a Staff Username (Email-ID)';
}
if($err == 0){
$config = set_upload_service("assets/uploads/services");
$this->load->library('upload');
$config['file_name'] = time()."_".$_FILES['profile_image']['name'];
$this->upload->initialize($config);
if($this->upload->do_upload('profile_image')){
$upload_data = $this->upload->data();
$_POST['profile_image'] = $config['upload_path']."/".$upload_data['file_name'];
}
}
if($err == 1){
$flashMsg['message'] = $errMsg;
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Staff/editStaffs/'.$staff_id));
}
$status = $this->Staff_model->updateStaff(decode_param($staff_id),$_POST);
if($status == 1){
$flashMsg =array('message'=>'Successfully Updated Staff Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Staff/viewStaffs'));
} else if($status == 2){
$flashMsg = array('message'=>'Username (Email-ID) alrady exist..!','class'=>'error');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Staff/editStaffs/'.$staff_id));
} else {
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Staff/editStaffs/'.$staff_id));
}
}
}
?>
\ No newline at end of file
...@@ -9,7 +9,7 @@ class Login_model extends CI_Model { ...@@ -9,7 +9,7 @@ class Login_model extends CI_Model {
public function login($username, $password) { public function login($username, $password) {
$query = $this->db->query("SELECT * FROM users $query = $this->db->query("SELECT * FROM users
WHERE username='$username' AND password='$password' AND WHERE username='$username' AND password='$password' AND
user_type IN (1,2) AND status='1'"); user_type IN (1,2,4) AND status='1'");
if($query->num_rows() > 0 && !empty($query)){ if($query->num_rows() > 0 && !empty($query)){
$result = $query->row(); $result = $query->row();
......
<?php
class Staff_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function getStaffData($staff_id='',$view=''){
$cond = (!empty($view))?" AND status IN ($view) ":" status != '2' ";
$cond .= (!empty($staff_id))?" AND id='$staff_id' ":"";
$staffData = $this->db->query("SELECT * FROM users WHERE user_type='4' ".$cond);
if(!empty($staffData)){
return (!empty($staff_id))?$staffData->row():$staffData->result();
}
return 0;
}
public function addStaff($staff_data = array()){
if(empty($staff_data))
return 0;
$userNameChk = $this->db->query("SELECT * FROM users
WHERE status!='2' AND username='".$staff_data['username']."' AND
user_type='4'");
if(!empty($userNameChk) && $userNameChk->num_rows() > 0) return 2;
$status = $this->db->insert('users',
array('username'=>$staff_data['username'],
'password'=>$staff_data['password'],
'display_name'=>$staff_data['display_name'],
'profile_image'=>$staff_data['profile_image'],
'user_type'=>'4','status'=>'1'));
return $status;
}
function updateStaff($staff_id = '', $staff_data = array()){
if(empty($staff_id) || empty($staff_data))
return 0;
$userNameChk = $this->db->query("SELECT * FROM users
WHERE status!='2' AND username='".$staff_data['username']."' AND
user_type='4' AND id!='".$staff_id."'");
if(!empty($userNameChk) && $userNameChk->num_rows() > 0) { return 2; }
if(!isset($staff_data['profile_image']) || empty($staff_data['profile_image'])){
unset($staff_data['profile_image']);
}
$status = $this->db->update('users',$staff_data,array('id'=>$staff_id));
return $status;
}
function changeStatus($staff_id = '', $status = '0'){
if(empty($staff_id)){
return 0;
}
$status = $this->db->update('users',array('status'=>$status),array('id'=>$staff_id));
return $status;
}
}
?>
\ No newline at end of file
...@@ -41,7 +41,7 @@ class User_model extends CI_Model { ...@@ -41,7 +41,7 @@ class User_model extends CI_Model {
} }
$chkUser = $this->db->query("SELECT * FROM users WHERE status!='2' AND id!='".$user_id."' AND $chkUser = $this->db->query("SELECT * FROM users WHERE status!='2' AND id!='".$user_id."' AND
username='".$user_data['username']."'"); username='".$user_data['username']."' AND user_type='".$user_type."'");
if(!empty($chkUser) && $chkUser->num_rows() > 0) { if(!empty($chkUser) && $chkUser->num_rows() > 0) {
return 4; return 4;
...@@ -87,7 +87,7 @@ class User_model extends CI_Model { ...@@ -87,7 +87,7 @@ class User_model extends CI_Model {
array('customer_id'=>$user_id)); array('customer_id'=>$user_id));
} }
if($status || $user_type == 1){ if($user_type == 1 || $user_type == 4){
$userData['username'] = $user_data['username']; $userData['username'] = $user_data['username'];
$userData['display_name'] = $user_data['display_name']; $userData['display_name'] = $user_data['display_name'];
if(isset($user_data['password']) && !empty($user_data['password'])){ if(isset($user_data['password']) && !empty($user_data['password'])){
......
...@@ -519,7 +519,11 @@ function event($data) { ...@@ -519,7 +519,11 @@ function event($data) {
$this->db->insert('customer_auth',array('user_id'=>$userId, 'auth_token'=>$auth_token)); $this->db->insert('customer_auth',array('user_id'=>$userId, 'auth_token'=>$auth_token));
} }
function auth_token_get($token) { function auth_token_get($token = '') {
if(empty($token)){
return 0;
}
$rs = $this->db->select('user_id')->where('auth_token', $token)->get('customer_auth')->row(); $rs = $this->db->select('user_id')->where('auth_token', $token)->get('customer_auth')->row();
if(count($rs) > 0) { if(count($rs) > 0) {
return $rs->user_id; return $rs->user_id;
......
...@@ -76,6 +76,14 @@ ...@@ -76,6 +76,14 @@
style="height:108px;" data-parsley-trigger="change"><?= $notificationData->verify_mail ?></textarea> style="height:108px;" data-parsley-trigger="change"><?= $notificationData->verify_mail ?></textarea>
</div> </div>
</div> </div>
<div class="col-sm-6">
<div class="form-group">
<label>Staff Registration Mail</label>
<p>Username => {:user_name} , Password => {:password}</p>
<textarea id="rich_editor_9" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Staff Registration Mail" name="staff_reg_mail"
style="height:108px;" data-parsley-trigger="change"><?= $notificationData->staff_reg_mail ?></textarea>
</div>
</div>
</div> </div>
</div> </div>
......
...@@ -33,17 +33,55 @@ ...@@ -33,17 +33,55 @@
</div> </div>
<form method="post" class="validate" role="form" action="<?= base_url().'Settings/change_settings'?>" enctype="multipart/form-data" data-parsley-validate=""> <form method="post" class="validate" role="form" action="<?= base_url().'Settings/change_settings'?>" enctype="multipart/form-data" data-parsley-validate="">
<div class="box-body"> <div class="box-body">
<div class="row"> <!-- <div class="form-group col-xs-12"> -->
<div class="form-group col-xs-7">
<div class="form-group col-xs-4"> <div class="form-group col-xs-6">
<label>Site Title</label> <label>Site Title</label>
<input type="text" name="title" class="form-control required" placeholder="Enter Site Title" value="<?= $data['title'] ?>"> <input type="text" name="title" class="form-control required" placeholder="Enter Site Title" value="<?= $data['title'] ?>">
</div> </div>
<div class="form-group col-xs-3"> <div class="form-group col-xs-6">
<label>Title Short</label> <label>Title Short</label>
<input type="text" name="title_short" class="form-control required" placeholder="Enter Site Title" value="<?= $data['title_short'] ?>"> <input type="text" name="title_short" class="form-control required" placeholder="Enter Site Title" value="<?= $data['title_short'] ?>">
</div>
<div class="form-group col-xs-6">
<label>Country Code</label>
<input type="text" name="country_flag" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['country_flag'] ?>">
</div>
<div class="form-group col-xs-6">
<label>Currency</label>
<input type="text" name="currency" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['currency'] ?>">
</div>
<!-- <div class="form-group col-xs-6">
<label>SMTP Username</label>
<input type="text" name="smtp_username" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['smtp_username'] ?>">
</div>
<div class="form-group col-xs-6">
<label>SMTP Password</label>
<input type="text" name="smtp_password" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['smtp_password'] ?>">
</div> -->
<div class="form-group col-xs-6">
<label>Google API Key</label>
<input type="text" name="google_api_key" class="form-control required" placeholder="Enter Google API" value="<?= $data['google_api_key'] ?>">
</div>
<div class="form-group col-xs-6">
<label>Commission Per Booking</label>
<input type="text" name="service_charge" class="form-control required" placeholder="Enter Service Charge" value="<?= $data['service_charge'] ?>">
</div>
<div class="form-group col-xs-6">
<label>BayanPay Merchant Key</label>
<input type="text" name="merchant_key" class="form-control required" placeholder="Enter Merchant Key" value="<?= $data['merchant_key'] ?>">
</div>
<div class="form-group col-xs-6">
<label>BayanPay Merchant ID</label>
<input type="text" name="merchant_id" class="form-control required" placeholder="Enter Merchant ID" value="<?= $data['merchant_id'] ?>">
</div>
<div class="form-group col-xs-6">
<label>Admin Email-ID</label>
<input type="email" name="admin_mail_id" class="form-control required" placeholder="Admin Email-ID" value="<?= $data['admin_mail_id'] ?>">
</div>
</div> </div>
<div class="form-group col-xs-5"> <div class="form-group col-xs-5">
<div class="form-group">
<label>Site Logo</label> <label>Site Logo</label>
<div class="col-md-12"> <div class="col-md-12">
<div class="col-md-3"> <div class="col-md-3">
...@@ -53,19 +91,8 @@ ...@@ -53,19 +91,8 @@
<input name="site_logo" type="file" accept="image/*" onchange="setImg(this,'site_logo');" /> <input name="site_logo" type="file" accept="image/*" onchange="setImg(this,'site_logo');" />
</div> </div>
</div> </div>
</div> </div>
</div> <div class="form-group">
<div class="row">
<div class="form-group col-xs-4">
<label>Country Code</label>
<input type="text" name="country_flag" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['country_flag'] ?>">
</div>
<div class="form-group col-xs-3">
<label>Currency</label>
<input type="text" name="currency" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['currency'] ?>">
</div>
<div class="form-group col-xs-5">
<label>Favicon Icon</label> <label>Favicon Icon</label>
<div class="col-md-12"> <div class="col-md-12">
<div class="col-md-3"> <div class="col-md-3">
...@@ -75,36 +102,9 @@ ...@@ -75,36 +102,9 @@
<input name="fav_icon" type="file" accept="image/*" onchange="setImg(this,'fav_icon_image');" /> <input name="fav_icon" type="file" accept="image/*" onchange="setImg(this,'fav_icon_image');" />
</div> </div>
</div> </div>
</div>
</div> </div>
</div> <!-- </div> -->
<div class="row">
<div class="form-group col-xs-4">
<label>SMTP Username</label>
<input type="text" name="smtp_username" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['smtp_username'] ?>">
</div>
<div class="form-group col-xs-3">
<label>SMTP Password</label>
<input type="text" name="smtp_password" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['smtp_password'] ?>">
</div>
<div class="form-group col-xs-4">
<label>Google API Key</label>
<input type="text" name="google_api_key" class="form-control required" placeholder="Enter Google API" value="<?= $data['google_api_key'] ?>">
</div>
</div>
<div class="row">
<div class="form-group col-xs-4">
<label>Commission Per Booking</label>
<input type="text" name="service_charge" class="form-control required" placeholder="Enter Service Charge" value="<?= $data['service_charge'] ?>">
</div>
<div class="form-group col-xs-3">
<label>BayanPay Merchant Key</label>
<input type="text" name="merchant_key" class="form-control required" placeholder="Enter Merchant Key" value="<?= $data['merchant_key'] ?>">
</div>
<div class="form-group col-xs-4">
<label>BayanPay Merchant ID</label>
<input type="text" name="merchant_id" class="form-control required" placeholder="Enter Merchant ID" value="<?= $data['merchant_id'] ?>">
</div>
</div>
</div> </div>
<div class="box-footer" style="padding-left:46%"> <div class="box-footer" style="padding-left:46%">
<button type="submit" class="btn btn-info">Update</button> <button type="submit" class="btn btn-info">Update</button>
......
<div class="content-wrapper">
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<?php
$url = (!isset($staff_id) || empty($staff_id))?'Staff/createStaff':'Staff/updateStaff/'.$staff_id;
if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-md-12">
<div class="box box-warning">
<div class="box-body">
<form role="form" action="<?= base_url($url) ?>" method="post"
class="validate" data-parsley-validate="" enctype="multipart/form-data">
<!-- Staff Data -->
<div class="col-md-6">
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$"
name="display_name" required="" value="<?= (isset($staff_data->display_name))?$staff_data->display_name:'' ?>"placeholder="Enter Staff Name">
</div>
<div class="form-group">
<label>Username</label>
<input type="email" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="username" placeholder="Enter Email-ID" value="<?= (isset($staff_data->username))?$staff_data->username:'' ?>">
</div>
<?php if(!isset($staff_id) || empty($staff_id)){ ?>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" required="" name="password" placeholder="Enter Password" >
</div>
<?php } ?>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Profile Picture</label>
<div class="col-md-12" style="padding-bottom:10px;">
<div class="col-md-3">
<img id="image_id" src="<?= (isset($staff_data->profile_image))?base_url($staff_data->profile_image):'' ?>" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';" height="75" width="75" />
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="profile_image" type="file" accept="image/*" onchange="setImg(this,'image_id');" />
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="box-footer textCenterAlign">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="<?= base_url('Staff/viewStaffs') ?>" class="btn btn-primary">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
<div class="content-wrapper" >
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?= $pTitle ?>
<small><?= $pDescription ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="<?= base_url() ?>"><i class="fa fa-star-o" aria-hidden="true"></i>Home</a></li>
<li><?= $menu ?></li>
<li class="active"><?= $smenu ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-12">
<?php if($this->session->flashdata('message')) {
$flashdata = $this->session->flashdata('message'); ?>
<div class="alert alert-<?= $flashdata['class'] ?>">
<button class="close" data-dismiss="alert" type="button">×</button>
<?= $flashdata['message'] ?>
</div>
<?php } ?>
</div>
<div class="col-xs-12">
<div class="box box-warning">
<div class="box-header with-border">
<div class="col-md-6"><h3 class="box-title">Staff List</h3></div>
<div class="col-md-6" align="right">
<a class="btn btn-sm btn-primary" href="<?= base_url('Staff/addStaff')?>">
Add New Staff
</a>
<a class="btn btn-sm btn-primary" href="<?= base_url() ?>">Back</a>
</div>
</div>
<div class="box-body">
<table id="mechanicUsers" class="table table-bordered table-striped datatable ">
<thead>
<tr>
<th class="hidden">ID</th>
<th width="50px;">Photo</th>
<th width="150px;">Name</th>
<th width="150px;">Username</th>
<th width="50px;">Status</th>
<th width="200px;">Action</th>
</tr>
</thead>
<tbody>
<?php
if(!empty($staff_data)){
foreach($staff_data as $staff) { ?>
<tr>
<th class="hidden"><?= $staff->staff_id ?></th>
<th class="center textCenterAlign">
<img id="image_id" src="<?= base_url($staff->profile_image) ?>"
onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';"
height="50" width="50" />
</th>
<th class="center"><?= $staff->display_name ?></th>
<th class="center"><?= $staff->username ?></th>
<th class="center"><?= ($staff->status == 1)?'Active':'De-activate' ?></th>
<td class="center">
<a class="btn btn-sm btn-primary"
href="<?= base_url('Staff/editStaffs/'.encode_param($staff->id)) ?>">
<i class="fa fa-fw fa-edit"></i>Edit
</a>
<a class="btn btn-sm btn-danger"
href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/2" ?>"
onClick="return doconfirm()">
<i class="fa fa-fw fa-trash"></i>Delete
</a>
<?php if($staff->status == 1){ ?>
<a class="btn btn-sm btn-success" style="background-color:#ac2925" href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/0" ?>">
<i class="fa fa-cog"></i> De-activate
</a>
<?php } else { ?>
<a class="btn btn-sm btn-success" href="<?= base_url("Staff/changeStatus/".encode_param($staff->id))."/1" ?>">
<i class="fa fa-cog"></i> Activate
</a>
<?php } ?>
</td>
</tr>
<?php } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
\ No newline at end of file
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
if(jQuery('#rich_editor_2').length==1){CKEDITOR.replace('rich_editor_2');} if(jQuery('#rich_editor_2').length==1){CKEDITOR.replace('rich_editor_2');}
if(jQuery('#rich_editor_6').length==1){CKEDITOR.replace('rich_editor_6');} if(jQuery('#rich_editor_6').length==1){CKEDITOR.replace('rich_editor_6');}
if(jQuery('#rich_editor_8').length==1){CKEDITOR.replace('rich_editor_8');} if(jQuery('#rich_editor_8').length==1){CKEDITOR.replace('rich_editor_8');}
if(jQuery('#rich_editor_9').length==1){CKEDITOR.replace('rich_editor_9');}
if(jQuery('#rich_editor_3').length==1){CKEDITOR.replace('rich_editor_3',{language:'ar'});} if(jQuery('#rich_editor_3').length==1){CKEDITOR.replace('rich_editor_3',{language:'ar'});}
if(jQuery('#rich_editor_4').length==1){CKEDITOR.replace('rich_editor_4',{language:'ar'});} if(jQuery('#rich_editor_4').length==1){CKEDITOR.replace('rich_editor_4',{language:'ar'});}
......
...@@ -140,15 +140,17 @@ ...@@ -140,15 +140,17 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label>New Password</label> <label>New Password</label>
<input type="password" class="form-control" name="password" placeholder="New Password"> <input type="password" class="form-control" name="password" placeholder="New Password"
<span class="glyphicon form-control-feedback"></span> autocomplete="off">
<span class="glyphicon form-control-feedback"></span>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label>Confirm Password</label> <label>Confirm Password</label>
<input type="password" class="form-control" name="cPassword" placeholder="Confirm Password"> <input type="password" class="form-control" name="cPassword" placeholder="Confirm Password"
<span class="glyphicon form-control-feedback"></span> autocomplete="off">
<span class="glyphicon form-control-feedback"></span>
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment