Commit 936003dc by Tobin

Merge branch 'master' into 'dev_production'

Master See merge request !32
parents b549ba82 6ead949a
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
RewriteEngine On RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L] RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule> </IfModule>
\ No newline at end of file
[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,46 +437,46 @@ class Api extends CI_Controller { ...@@ -436,46 +437,46 @@ 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,
...@@ -483,18 +484,18 @@ class Api extends CI_Controller { ...@@ -483,18 +484,18 @@ class Api extends CI_Controller {
'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;
...@@ -531,5 +532,9 @@ class Api extends CI_Controller { ...@@ -531,5 +532,9 @@ class Api extends CI_Controller {
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
public function verifyMail($unique_id = '') {
$res = $this->Api_model->verifyMail(array('unique_id'=>$unique_id));
}
} }
?> ?>
...@@ -5,7 +5,7 @@ class Booking extends CI_Controller { ...@@ -5,7 +5,7 @@ class Booking extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Booking_model'); $this->load->model('Booking_model');
if(!$this->session->userdata('logged_in')) { if(!$this->session->userdata('logged_in')) {
......
...@@ -5,7 +5,7 @@ class CMS extends CI_Controller { ...@@ -5,7 +5,7 @@ class CMS extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Cms_model'); $this->load->model('Cms_model');
if(!$this->session->userdata('logged_in')) { if(!$this->session->userdata('logged_in')) {
...@@ -102,11 +102,23 @@ class CMS extends CI_Controller { ...@@ -102,11 +102,23 @@ class CMS extends CI_Controller {
if(!isset($_POST['forgot_sms']) || empty($_POST['forgot_sms'])){ if(!isset($_POST['forgot_sms']) || empty($_POST['forgot_sms'])){
unset($_POST['forgot_sms']); unset($_POST['forgot_sms']);
} }
if(!isset($_POST['verify_mail']) || empty($_POST['verify_mail'])){
unset($_POST['verify_mail']);
}
if(!isset($_POST['staff_reg_mail']) || empty($_POST['staff_reg_mail'])){
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']);
} }
if(!isset($_POST['registration_sms']) || empty($_POST['registration_sms'])){ if(!isset($_POST['checker_activation_mail']) || empty($_POST['checker_activation_mail'])){
unset($_POST['registration_sms']); unset($_POST['checker_activation_mail']);
}
if(!isset($_POST['provider_activation_mail']) || empty($_POST['provider_activation_mail'])){
unset($_POST['provider_activation_mail']);
} }
$status = $this->Cms_model->updateNotif($_POST); $status = $this->Cms_model->updateNotif($_POST);
......
...@@ -5,7 +5,7 @@ class Category extends CI_Controller { ...@@ -5,7 +5,7 @@ class Category extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Category_model'); $this->load->model('Category_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
......
...@@ -5,7 +5,7 @@ class Checker extends CI_Controller { ...@@ -5,7 +5,7 @@ class Checker extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Checker_model'); $this->load->model('Checker_model');
$this->load->model('Provider_model'); $this->load->model('Provider_model');
...@@ -75,6 +75,22 @@ class Checker extends CI_Controller { ...@@ -75,6 +75,22 @@ class Checker extends CI_Controller {
$_POST['provider_id'] = $provider_id; $_POST['provider_id'] = $provider_id;
$status = $this->Checker_model->createChecker($_POST); $status = $this->Checker_model->createChecker($_POST);
if($status == 1){ if($status == 1){
$this->load->model('Api_model');
$subject = "Your TimeOut Checker Account is now activated";
$template = getNotifTemplate();
$message = "<html>
<body>
Your Checker Account for the username
<strong>".$_POST['username']."</strong> is now activated.
</body>
</html>";
if(isset($template['checker_activation_mail']) && !empty($template['checker_activation_mail'])){
$message = str_replace(array('{:user_name}'),array($email_id),
$template['checker_activation_mail']);
}
$this->Api_model->send_mail($subject,$_POST['username'],$message);
$flashMsg['class'] = 'success'; $flashMsg['class'] = 'success';
$flashMsg['message'] = 'Checker Created'; $flashMsg['message'] = 'Checker Created';
...@@ -110,15 +126,20 @@ class Checker extends CI_Controller { ...@@ -110,15 +126,20 @@ class Checker extends CI_Controller {
$subject = "Your Checker Account is now activated"; $subject = "Your Checker Account is now activated";
$email_id = $checkerData->username; $email_id = $checkerData->username;
$template = getNotifTemplate(); $message = "<html>
$message .= "<html>
<body> <body>
Your Checker Account for the username Your Checker Account for the username
<strong>".$checkerData->username."</strong> is now activated.<br> <strong>".$email_id."</strong> is now activated.
".$template['checker_activation_mail']."
</body> </body>
</html>"; </html>";
$template = getNotifTemplate();
if(isset($template['checker_activation_mail']) &&
!empty($template['checker_activation_mail'])){
$message = str_replace(array('{:user_name}'),array($email_id),
$template['checker_activation_mail']);
}
$this->Api_model->send_mail($subject,$email_id,$message); $this->Api_model->send_mail($subject,$email_id,$message);
} }
} }
......
...@@ -5,7 +5,7 @@ class Customer extends CI_Controller { ...@@ -5,7 +5,7 @@ class Customer extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Customer_model'); $this->load->model('Customer_model');
if(!$this->session->userdata('logged_in')) { if(!$this->session->userdata('logged_in')) {
...@@ -115,6 +115,7 @@ class Customer extends CI_Controller { ...@@ -115,6 +115,7 @@ class Customer extends CI_Controller {
redirect(base_url('Customer/addCustomer')); redirect(base_url('Customer/addCustomer'));
} }
$temp_password = rand(10000000, 99999999); $temp_password = rand(10000000, 99999999);
$_POST['dob'] = strtotime($_POST['dob'])*1000;
$_POST['password'] = md5($temp_password); $_POST['password'] = md5($temp_password);
$status = $this->Customer_model->addCustomer($_POST); $status = $this->Customer_model->addCustomer($_POST);
if($status == 1){ if($status == 1){
...@@ -123,14 +124,19 @@ class Customer extends CI_Controller { ...@@ -123,14 +124,19 @@ class Customer extends CI_Controller {
$subject = "Your TimeOut Account is now activated"; $subject = "Your TimeOut Account is now activated";
$email_id = $_POST['email']; $email_id = $_POST['email'];
$template = getNotifTemplate(); $template = getNotifTemplate();
$message .= "<html>
$message = "<html>
<body> <body>
Hi,\n\r Welcome to TimeOut. \r\n Please use username: Hi,\n\r Welcome to TimeOut. \r\n Please use username:
".$_POST['email']." and Password: ".$temp_password." ".$_POST['email']." for access your account <br>
for access your account <br>
".$template['registration_mail']."
</body> </body>
</html>"; </html>";
if(isset($template['registration_mail']) && !empty($template['registration_mail'])){
$message = str_replace(array('{:email}'),array($email_id),
$template['registration_mail']);
}
$this->Api_model->send_mail($subject,$email_id,$message); $this->Api_model->send_mail($subject,$email_id,$message);
$flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success'); $flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success');
...@@ -218,6 +224,7 @@ class Customer extends CI_Controller { ...@@ -218,6 +224,7 @@ class Customer extends CI_Controller {
redirect(base_url('Customer/editCustomers/'.$customer_id)); redirect(base_url('Customer/editCustomers/'.$customer_id));
} }
$_POST['dob'] = strtotime($_POST['dob'])*1000;
$status = $this->Customer_model->updateCustomer(decode_param($customer_id),$_POST); $status = $this->Customer_model->updateCustomer(decode_param($customer_id),$_POST);
if($status == 1){ if($status == 1){
$flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success'); $flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success');
......
...@@ -5,7 +5,7 @@ class Dashboard extends CI_Controller { ...@@ -5,7 +5,7 @@ class Dashboard extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
if(!$this->session->userdata('logged_in')) { if(!$this->session->userdata('logged_in')) {
......
...@@ -5,7 +5,7 @@ class Event extends CI_Controller { ...@@ -5,7 +5,7 @@ class Event extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Event_model'); $this->load->model('Event_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
...@@ -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';
......
...@@ -5,7 +5,7 @@ class Host extends CI_Controller { ...@@ -5,7 +5,7 @@ class Host extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Host_model'); $this->load->model('Host_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
......
...@@ -5,7 +5,7 @@ class Login extends CI_Controller { ...@@ -5,7 +5,7 @@ class Login extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->helper(array('form')); $this->load->helper(array('form'));
$this->load->model('login_model'); $this->load->model('login_model');
$this->load->helper('security'); $this->load->helper('security');
......
...@@ -5,7 +5,7 @@ class Logout extends CI_Controller { ...@@ -5,7 +5,7 @@ class Logout extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
if(!$this->session->userdata('logged_in')) { if(!$this->session->userdata('logged_in')) {
redirect(base_url()); redirect(base_url());
......
...@@ -5,7 +5,7 @@ class Provider extends CI_Controller { ...@@ -5,7 +5,7 @@ class Provider extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Provider_model'); $this->load->model('Provider_model');
if(!$this->session->userdata('logged_in')) { if(!$this->session->userdata('logged_in')) {
...@@ -72,15 +72,21 @@ class Provider extends CI_Controller { ...@@ -72,15 +72,21 @@ class Provider extends CI_Controller {
$email_id = $providerData->email; $email_id = $providerData->email;
$template = getNotifTemplate(); $template = getNotifTemplate();
$message .= "<html> $message = "<html>
<body> <body>
Your Organizer Account for the username Your Organizer Account for the username
<strong>".$providerData->username."</strong> is now activated. Please use this link for access your account <strong>".$providerData->username."</strong> is now activated. Please use this link for access your account
<a href='".base_url()."'>".base_url()."</a><br> <a href='".base_url()."'>".base_url()."</a><br>
".$template['provider_activation_mail']."
</body> </body>
</html>"; </html>";
if(isset($template['provider_activation_mail']) &&
!empty($template['provider_activation_mail'])){
$message = str_replace(array('{:user_name}','{:url}'),
array($providerData->username,base_url()),
$template['provider_activation_mail']);
}
$this->Api_model->send_mail($subject,$email_id,$message); $this->Api_model->send_mail($subject,$email_id,$message);
} }
} }
...@@ -138,6 +144,27 @@ class Provider extends CI_Controller { ...@@ -138,6 +144,27 @@ class Provider extends CI_Controller {
$status = $this->Provider_model->addProvider($_POST); $status = $this->Provider_model->addProvider($_POST);
if($status == 1){ if($status == 1){
$this->load->model('Api_model');
$subject = "Your Organizer Account is now activated";
$email_id = $_POST['email'];
$template = getNotifTemplate();
$message = "<html>
<body>
Your Organizer Account for the username
<strong>".$providerData->username."</strong> is now activated. Please use this link for access your account
<a href='".base_url()."'>".base_url()."</a><br>
</body>
</html>";
if(isset($template['provider_activation_mail']) &&
!empty($template['provider_activation_mail'])){
$message = str_replace(array('{:user_name}','{:url}'),
array($email_id,base_url()),
$template['provider_activation_mail']);
}
$this->Api_model->send_mail($subject,$email_id,$message);
$flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success'); $flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg); $this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Provider/viewProviders')); redirect(base_url('Provider/viewProviders'));
......
...@@ -5,7 +5,7 @@ class Region extends CI_Controller { ...@@ -5,7 +5,7 @@ class Region extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Region_model'); $this->load->model('Region_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
......
...@@ -5,7 +5,7 @@ class Settings extends CI_Controller { ...@@ -5,7 +5,7 @@ class Settings extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Settings_model'); $this->load->model('Settings_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
......
<?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
...@@ -5,7 +5,7 @@ class Tag extends CI_Controller { ...@@ -5,7 +5,7 @@ class Tag extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Tag_model'); $this->load->model('Tag_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
......
...@@ -5,7 +5,7 @@ class User extends CI_Controller { ...@@ -5,7 +5,7 @@ class User extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('User_model'); $this->load->model('User_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
......
...@@ -5,7 +5,7 @@ class Venue extends CI_Controller { ...@@ -5,7 +5,7 @@ class Venue extends CI_Controller {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
date_default_timezone_set("Asia/Kolkata"); date_default_timezone_set("Asia/Riyadh");
$this->load->model('Venue_model'); $this->load->model('Venue_model');
$this->load->model('Dashboard_model'); $this->load->model('Dashboard_model');
......
...@@ -8,7 +8,8 @@ class Api_model extends CI_Model { ...@@ -8,7 +8,8 @@ class Api_model extends CI_Model {
public function login($data){ public function login($data){
try{ try{
$this->db->select('customer.name,customer.dob,customer.phone,customer.email,customer.profile_image AS image,customer.gender,users.id AS userId, customer.city,customer.dob'); $this->db->select('customer.name,customer.dob,customer.phone,customer.email,customer.profile_image
AS image,customer.gender,users.id AS userId,customer.city,customer.dob,customer.email_verified');
$this->db->where('users.status',1); $this->db->where('users.status',1);
$this->db->where('users.password',md5($data['password'])); $this->db->where('users.password',md5($data['password']));
$this->db->where('customer.email',$data['email_id']); $this->db->where('customer.email',$data['email_id']);
...@@ -16,12 +17,17 @@ class Api_model extends CI_Model { ...@@ -16,12 +17,17 @@ class Api_model extends CI_Model {
$this->db->join('customer','customer.customer_id = users.id'); $this->db->join('customer','customer.customer_id = users.id');
$result = $this->db->get()->row(); $result = $this->db->get()->row();
if($result){ if($result){
$result->dob = (!empty($result->dob))?date("m/d/Y",$result->dob):''; if(isset($result->email_verified) && $result->email_verified == '1'){
$result->dob = (!empty($result->dob))?date("m/d/Y",$result->dob/1000):'';
$result->auth_token = md5(microtime().rand()); $result->auth_token = md5(microtime().rand());
$this->generateAuth($result->userId,$result->auth_token); $this->generateAuth($result->userId,$result->auth_token);
$res = array('status'=>1,'data'=>$result); $res = array('status'=>1,'data'=>$result);
} else { } else {
$res = array('status'=>0,'message'=>'Invalid username / Password','code'=>'ER05'); $res = array('status'=>0,'message'=>'Verify Your E-Mail','code'=>'ER07');
}
} else {
$res = array('status'=>0,'message'=>'Wrong password. Try again or click Forgot password to reset it','code'=>'ER05');
} }
} catch(Exception $e) { } catch(Exception $e) {
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06'); $res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
...@@ -37,8 +43,12 @@ class Api_model extends CI_Model { ...@@ -37,8 +43,12 @@ class Api_model extends CI_Model {
try{ try{
$email = $data['email_id']; $email = $data['email_id'];
$phone = $data['phone']; $phone = $data['phone'];
$res_count = $this->db->query("SELECT * FROM customer INNER JOIN `users` ON users.id = customer.customer_id AND users.user_type = 3 WHERE users.status = 1 AND (customer.email = '$email' OR customer.phone LIKE '%$phone')")->row(); $res_count =
//$res_count = $this->db->where('email',$data['email_id'])->where()->or_where('phone',$data['phone'])->get('customer')->row(); $this->db->query("SELECT * FROM customer
INNER JOIN `users` ON users.id=customer.customer_id AND users.user_type='3'
WHERE users.status!='2' AND
(customer.email = '$email' OR customer.phone LIKE '%$phone')")->row();
if(count($res_count) > 0) { if(count($res_count) > 0) {
if($res_count->email == $data['email_id'] && $res_count->phone == $data['phone']){ if($res_count->email == $data['email_id'] && $res_count->phone == $data['phone']){
$res = array('status'=>0,'message'=>'Already have an account with email id and phone no. Please login','code'=>'ER12'); $res = array('status'=>0,'message'=>'Already have an account with email id and phone no. Please login','code'=>'ER12');
...@@ -48,16 +58,14 @@ class Api_model extends CI_Model { ...@@ -48,16 +58,14 @@ class Api_model extends CI_Model {
$res = array('status'=>0,'message'=>'Phone no already exists','code'=>'ER10'); $res = array('status'=>0,'message'=>'Phone no already exists','code'=>'ER10');
} }
} else { } else {
$unique_id = uniqid().time();
$temp_password = $data['password']; $temp_password = $data['password'];
$data['password'] = md5($data['password']); $data['password'] = md5($data['password']);
$user_data = array( $user_data = array('password'=>$data['password'],'display_name'=>'Customer','user_type'=>3);
'password'=>$data['password'],
'display_name'=>'Customer',
'user_type'=> 3
);
$this->db->insert('users',$user_data); $this->db->insert('users',$user_data);
$id = $this->db->insert_id(); $id = $this->db->insert_id();
if($id) { if($id) {
if(strpos($data['phone'],'+') === true){ if(strpos($data['phone'],'+') === true){
$data['phone'] = str_replace('+','',$data['phone']); $data['phone'] = str_replace('+','',$data['phone']);
...@@ -66,38 +74,43 @@ class Api_model extends CI_Model { ...@@ -66,38 +74,43 @@ class Api_model extends CI_Model {
$data['phone'] = '966'.$data['phone']; $data['phone'] = '966'.$data['phone'];
} }
$customer_data = array('customer_id'=>$id,'phone'=>$data['phone'], $customer_data = array('customer_id'=>$id,'phone'=>$data['phone'],'email_verified'=>'0',
'email'=>$data['email_id'],'name'=>$data['name']); 'email'=>$data['email_id'],'name'=>$data['name'],
'confirm_link'=>$unique_id);
$this->db->insert('customer', $customer_data); $this->db->insert('customer', $customer_data);
$subject = "New account created successfully"; $subject = "TimeOut, Verify your account";
$email_id = $data['email_id']; $email_id = $data['email_id'];
$reset_link = 'https://projects.nuvento.com/admin/Api/verifyMail/'.$unique_id;
$template = getNotifTemplate();
$message = "<html> $message = "<html>
<body> <body>
Hi,\n\r Welcome to TimeOut. \r\n Please use username: Hi,\n\r Welcome to TimeOut. \r\n Please Verify your E-mail for the username: ".$email_id.". User the following link verify your account ".$reset_link.".
".$email_id." and Password: ".$temp_password."
for access your account <br>
".$template['registration_mail']."
</body> </body>
</html>"; </html>";
$this->send_mail($subject,$email_id,$message); $template = getNotifTemplate();
$this->db->select('customer.name,customer.dob,customer.phone,customer.email,customer.profile_image AS image,customer.gender,users.id AS userId, customer.city'); if(isset($template['verify_mail']) && !empty($template['verify_mail'])){
$this->db->where('users.id',$id); $message = str_replace(array('{:user_name}','{:reset_link}'),
$this->db->from('users'); array($email_id,$reset_link),
$this->db->join('customer','customer.customer_id = users.id'); $template['verify_mail']);
$result = $this->db->get()->row();
if($result){
$result->dob = (!empty($result->dob))?date("m/d/Y",$result->dob):'';
$result->auth_token = md5(microtime().rand());
$this->generateAuth($result->userId,$result->auth_token);
$res = array('status'=>1,'data'=>$result);
} else {
$res = array('status'=>0,'message'=>'No record found','code'=>'ER13');
} }
$this->send_mail($subject,$email_id,$message);
$res = array('status'=>1,'data'=>'');
// $this->db->select('customer.name,customer.dob,customer.phone,customer.email,customer.profile_image AS image,customer.gender,users.id AS userId, customer.city');
// $this->db->where('users.id',$id);
// $this->db->from('users');
// $this->db->join('customer','customer.customer_id = users.id');
// $result = $this->db->get()->row();
// if($result){
// $result->dob = (!empty($result->dob))?date("m/d/Y",$result->dob/1000):'';
// $result->auth_token = md5(microtime().rand());
// $this->generateAuth($result->userId,$result->auth_token);
// $res = array('status'=>1,'data'=>$result,'message'=>'An activation Email has been set to your mail id');
// } else {
// $res = array('status'=>0,'message'=>'No record found','code'=>'ER13');
// }
} else { } else {
$res = array('status'=>0,'message'=>'Registration failed please try again','code'=>'ER11'); $res = array('status'=>0,'message'=>'Registration failed please try again','code'=>'ER11');
} }
...@@ -139,20 +152,22 @@ class Api_model extends CI_Model { ...@@ -139,20 +152,22 @@ class Api_model extends CI_Model {
if($res_count > 0) { if($res_count > 0) {
$unique_id = uniqid().time(); $unique_id = uniqid().time();
$this->db->where('email',$data['email_id'])->update('customer',array('reset_key'=>$unique_id)); $this->db->where('email',$data['email_id'])->update('customer',array('reset_key'=>$unique_id));
$subject = "TimeOut: Forgot Password"; $subject = "TimeOut: Forgot Password";
$url = 'https://projects.nuvento.com/forgot/?reset_key='.$unique_id; $url = 'https://projects.nuvento.com/forgot/?reset_key='.$unique_id;
$template = getNotifTemplate();
$message = "<html> $message = "<html>
<body> <body>
<p>Please use mentioned link for reset your password: ".$url."</p> <p>Please use mentioned link for reset your password: ".$url."</p>
<br>
".$template['forgot_mail']."
</body> </body>
</html>"; </html>";
$email = $data['email_id']; $template = getNotifTemplate();
$result = $this->send_mail($subject,$email,$message); if(isset($template['forgot_mail']) && !empty($template['forgot_mail'])){
$message = str_replace(array('{:url}'),array($url),$template['forgot_mail']);
}
$result = $this->send_mail($subject,$data['email_id'],$message);
if($result){ if($result){
$res = array('status'=>1,'data'=>null); $res = array('status'=>1,'data'=>null);
} else { } else {
...@@ -459,7 +474,7 @@ class Api_model extends CI_Model { ...@@ -459,7 +474,7 @@ class Api_model extends CI_Model {
$post_data = $data; $post_data = $data;
unset($post_data['file']); unset($post_data['file']);
unset($post_data['auth_token']); unset($post_data['auth_token']);
$post_data['dob'] = (!empty($post_data['dob']))?strtotime($post_data['dob']):''; $post_data['dob'] = (!empty($post_data['dob']))?strtotime($post_data['dob'])*1000:'';
if(isset($data['file'])){ if(isset($data['file'])){
$img=$data['file']['name']; $img=$data['file']['name'];
$expbanner = explode('.',$img); $expbanner = explode('.',$img);
...@@ -496,7 +511,7 @@ class Api_model extends CI_Model { ...@@ -496,7 +511,7 @@ class Api_model extends CI_Model {
$this->db->join('customer','customer.customer_id = users.id'); $this->db->join('customer','customer.customer_id = users.id');
$result = $this->db->get()->row(); $result = $this->db->get()->row();
if($result){ if($result){
$result->dob = (!empty($result->dob))?date("m/d/Y", $result->dob):''; $result->dob = (!empty($result->dob))?date("m/d/Y", ($result->dob)/1000):'';
$res = array('status'=>1,'data'=>$result); $res = array('status'=>1,'data'=>$result);
} else { } else {
$res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19'); $res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19');
...@@ -680,11 +695,26 @@ class Api_model extends CI_Model { ...@@ -680,11 +695,26 @@ class Api_model extends CI_Model {
function event($data) { function event($data) {
try { try {
$user_id = (!isset($data['auth_token']) || empty($data['auth_token']))?'':$this->auth_token_get($data['auth_token']);
//if($user_id > 0) {
$event_id = $data['event_id']; $event_id = $data['event_id'];
$authToken = (isset($data['auth_token']) && !empty($data['auth_token']))?$data['auth_token']:'';
$user_id = $this->auth_token_get($authToken);
$bookedCount = 0;
if(!empty($user_id)) {
$sql = "SELECT SUM(no_of_ticket) AS bookCount
FROM booking AS BOK
WHERE event_id='$event_id' AND customer_id='$user_id' AND status IN (1)";
$result = $this->db->query($sql)->row_array();
if(!empty($result)){
$bookedCount = $result['bookCount'];
}
}
$this->db->query("SET SESSION group_concat_max_len = 20000"); $this->db->query("SET SESSION group_concat_max_len = 20000");
$result = $this->db->query("SELECT events.has_payment,events.event_id, AVG(review.rate) AS rate, MAX(booking.id) AS attendees, events.event_name,events.event_discription AS event_description,events.seat_pricing, events.custom_seat_layout, events.seat_pricing, venue.layout, venue.layout_details,venue.venue_name,venue.venue_details,venue.location,venue.location_lat AS lat,venue.location_lng AS lng, GROUP_CONCAT(DISTINCT `event_gallery`.`media_url`) AS media_url,favourite.status AS fav_status, events.max_booking, host_categories.show_layout, GROUP_CONCAT(DISTINCT tags.tag_name) AS tag, GROUP_CONCAT(DISTINCT CONCAT_WS('#',event_date_time.id,event_date_time.date,event_date_time.time)) AS date_time FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`status` != 0 LEFT JOIN booking on booking.event_id = events.event_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = '".$user_id."' AND favourite.status = 1 LEFT JOIN event_tags ON events.event_id = event_tags.event_id LEFT JOIN tags on tags.tag_id = event_tags.tag_id LEFT JOIN review ON events.event_id = review.event_id INNER JOIN host_categories ON venue.host_cat_id = host_categories.host_cat_id WHERE events.event_id = ".$event_id." GROUP BY events.event_id, event_date_time.event_id")->result(); $result = $this->db->query("SELECT events.has_payment,events.event_id, AVG(review.rate) AS rate, MAX(booking.id) AS attendees, events.event_name,events.event_discription AS event_description,events.seat_pricing, events.custom_seat_layout, events.seat_pricing, venue.layout, venue.layout_details,venue.venue_name,venue.venue_details,venue.location,venue.location_lat AS lat,venue.location_lng AS lng, GROUP_CONCAT(DISTINCT `event_gallery`.`media_url`) AS media_url,favourite.status AS fav_status, events.max_booking, host_categories.show_layout, GROUP_CONCAT(DISTINCT tags.tag_name) AS tag, GROUP_CONCAT(DISTINCT CONCAT_WS('#',event_date_time.id,event_date_time.date,event_date_time.time)) AS date_time FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`status` != 0 LEFT JOIN booking on booking.event_id = events.event_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = '".$user_id."' AND favourite.status = 1 LEFT JOIN event_tags ON events.event_id = event_tags.event_id LEFT JOIN tags on tags.tag_id = event_tags.tag_id LEFT JOIN review ON events.event_id = review.event_id INNER JOIN host_categories ON venue.host_cat_id = host_categories.host_cat_id WHERE events.event_id = ".$event_id." GROUP BY events.event_id, event_date_time.event_id")->result();
if(count($result)>0){ if(count($result)>0){
$resultData = array(); $resultData = array();
$event_layout = ''; $event_layout = '';
...@@ -723,27 +753,26 @@ class Api_model extends CI_Model { ...@@ -723,27 +753,26 @@ class Api_model extends CI_Model {
$media_url = explode(',', $rs->media_url); $media_url = explode(',', $rs->media_url);
$resData = array( $resData = array(
'has_payment'=>$rs->has_payment, 'latlng' => $latlng,
'event_id'=>$rs->event_id, 'event_id' => $rs->event_id,
'event_name'=>$rs->event_name, 'event_rate' => $rs->rate,
'event_description'=>$rs->event_description, 'event_name' => $rs->event_name,
'event_rate'=>$rs->rate, 'event_tags' => $tags,
'event_attendees'=>$rs->attendees, 'event_urls' => $media_url,
'event_price'=>$price, 'fav_status' => $rs->fav_status,
'event_urls'=>$media_url, 'venue_name' => $rs->venue_name,
'event_tags'=>$tags, 'event_price' => $price,
'event_layout_url'=>$rs->layout, 'has_payment' => $rs->has_payment,
'event_price_layout'=>$event_layout, 'event_times' => $time_spec,
'seat_pricing'=>$rs->seat_pricing, 'max_booking' => $rs->max_booking-$bookedCount,
'event_times'=>$time_spec, 'show_layout' => $rs->show_layout,
'fav_status'=>$rs->fav_status, 'seat_pricing' => $rs->seat_pricing,
'event_id'=>$rs->event_id, 'venue_details' => $rs->venue_details,
'venue_name'=>$rs->venue_name, 'venue_location' => $rs->location,
'venue_details'=>$rs->venue_details, 'event_attendees' => $rs->attendees,
'venue_location'=>$rs->location, 'event_layout_url' => $rs->layout,
'max_booking'=>$rs->max_booking, 'event_description' => $rs->event_description,
'show_layout'=>$rs->show_layout, 'event_price_layout' => $event_layout
'latlng'=>$latlng
); );
array_push($resultData, $resData); array_push($resultData, $resData);
} }
...@@ -752,11 +781,6 @@ class Api_model extends CI_Model { ...@@ -752,11 +781,6 @@ class Api_model extends CI_Model {
$res = array('status'=>0,'message'=>'No records found','code'=>'ER13'); $res = array('status'=>0,'message'=>'No records found','code'=>'ER13');
} }
/*} else {
$res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19');
}*/
} catch(Exception $e) { } catch(Exception $e) {
$res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06'); $res = array('status'=>0,'message'=>'Ohh No!! Something went South!!','code'=>'ER06');
} }
...@@ -929,7 +953,9 @@ class Api_model extends CI_Model { ...@@ -929,7 +953,9 @@ class Api_model extends CI_Model {
if($user_id > 0) { if($user_id > 0) {
$this->db->insert('transaction',array('customer_id'=>$user_id,'booking_id'=>$data['booking_id'],'datetime'=>date('Y-m-d h:i:s'),'amount'=>$data['amount'])); $this->db->insert('transaction',array('customer_id'=>$user_id,'booking_id'=>$data['booking_id'],'datetime'=>date('Y-m-d h:i:s'),'amount'=>$data['amount']));
$last_id = $this->db->insert_id(); $last_id = $this->db->insert_id();
$res = array('status'=>1,'transaction_id'=>$last_id);
$custData = $this->getUserData($user_id);
$res = array('status'=>1,'transaction_id'=>$last_id,'custData'=>$custData);
}else { }else {
$res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19'); $res = array('status'=>0,'message'=>'Invalid user','code'=>'ER19');
} }
...@@ -939,6 +965,20 @@ class Api_model extends CI_Model { ...@@ -939,6 +965,20 @@ class Api_model extends CI_Model {
return $res; return $res;
} }
function getUserData($cust_id = ''){
if(empty($cust_id)){
return 0;
}
$this->db->select('customer.name,customer.dob,customer.phone,customer.email,customer.gender,
customer.profile_image AS image,users.id AS userId,customer.city,customer.dob,
customer.email_verified');
$this->db->where('users.status',1);
$this->db->where('customer.customer_id',$cust_id);
$this->db->from('users');
$this->db->join('customer','customer.customer_id = users.id');
return $this->db->get()->row();
}
function update_payment($response,$transactionid,$last_id,$status){ function update_payment($response,$transactionid,$last_id,$status){
try{ try{
$this->db->update('transaction',array('transaction_id'=>$transactionid,'transaction_response'=>json_encode($response),'status'=>$status),array('id'=>$last_id)); $this->db->update('transaction',array('transaction_id'=>$transactionid,'transaction_response'=>json_encode($response),'status'=>$status),array('id'=>$last_id));
...@@ -1070,11 +1110,14 @@ class Api_model extends CI_Model { ...@@ -1070,11 +1110,14 @@ class Api_model extends CI_Model {
public function reset_password($data){ public function reset_password($data){
try{ try{
$cust = $this->db->get_where('customer',array('reset_key'=>$data['reset_key']))->row_array(); $cust = $this->db->query("SELECT CUST.customer_id FROM customer AS CUST
INNER JOIN users AS USER ON (USER.id=CUST.customer_id)
WHERE CUST.reset_key='".$data['reset_key']."' AND USER.status!='2'");
if(!empty($cust)){ if(!empty($cust)){
if($this->db->update('users',array('password'=>md5($data['password'])),array('id'=>$cust['customer_id']))){ $cust = $cust->row_array();
$this->db->update('customer', if($this->db->update('users',array('password'=>md5($data['password'])),
array('reset_key'=>''), array('id'=>$cust['customer_id']))){
$this->db->update('customer',array('reset_key'=>''),
array('customer_id'=>$cust['customer_id'])); array('customer_id'=>$cust['customer_id']));
$res= array('status'=>1,'data'=>'Password Updated Successfully'); $res= array('status'=>1,'data'=>'Password Updated Successfully');
}else{ }else{
...@@ -1088,5 +1131,21 @@ class Api_model extends CI_Model { ...@@ -1088,5 +1131,21 @@ class Api_model extends CI_Model {
} }
return $res; return $res;
} }
public function verifyMail($data = ''){
try{
$cust = $this->db->query("SELECT CUST.customer_id FROM customer AS CUST
INNER JOIN users AS USER ON (USER.id=CUST.customer_id)
WHERE CUST.confirm_link='".$data['unique_id']."' AND USER.status!='2'");
if(!empty($cust)){
$cust = $cust->row_array();
if($this->db->update('customer',array('confirm_link'=>'','email_verified'=>'1'),
array('customer_id'=>$cust['customer_id']))){
header('Location:https://projects.nuvento.com/location?login=1');
}
}
}catch(Exception $e){}
header('Location:https://projects.nuvento.com/location');
}
} }
?> ?>
...@@ -12,7 +12,6 @@ class Checker_model extends CI_Model { ...@@ -12,7 +12,6 @@ class Checker_model extends CI_Model {
FROM checker AS CHK FROM checker AS CHK
INNER JOIN provider AS PRV ON (CHK.provider_id=PRV.provider_id) INNER JOIN provider AS PRV ON (CHK.provider_id=PRV.provider_id)
WHERE $cond"); WHERE $cond");
return $checkerData->result(); return $checkerData->result();
} }
......
...@@ -17,7 +17,17 @@ class Customer_model extends CI_Model { ...@@ -17,7 +17,17 @@ class Customer_model extends CI_Model {
$customerData = $this->db->query($sql); $customerData = $this->db->query($sql);
if(!empty($customerData)){ if(!empty($customerData)){
return (empty($customer_id))?$customerData->result():$customerData->row(); if(empty($customer_id)){
$custData = $customerData->result();
foreach ($custData AS $key => $value) {
$custData[$key]->dob = date("m/d/Y",$value->dob/1000);
}
return $custData;
} else {
$custData = $customerData->row();
$custData->dob = date("m/d/Y",$custData->dob/1000);
return $custData;
}
} }
return 0; return 0;
} }
...@@ -27,17 +37,20 @@ class Customer_model extends CI_Model { ...@@ -27,17 +37,20 @@ class Customer_model extends CI_Model {
return 0; return 0;
$userNameChk = $this->db->query("SELECT * FROM users $userNameChk = $this->db->query("SELECT * FROM users
WHERE status!='2' AND username='".$customer_data['email']."'"); WHERE status!='2' AND username='".$customer_data['email']."' AND
user_type='3'");
if(!empty($userNameChk) && $userNameChk->num_rows() > 0) return 4; if(!empty($userNameChk) && $userNameChk->num_rows() > 0) return 4;
$emailChk = $this->db->query("SELECT * FROM customer AS CUST $emailChk = $this->db->query("SELECT * FROM customer AS CUST
INNER JOIN users AS USR ON (USR.id=CUST.customer_id) INNER JOIN users AS USR ON (USR.id=CUST.customer_id)
WHERE USR.status!='2' AND CUST.email='".$customer_data['email']."'"); WHERE USR.status!='2' AND CUST.email='".$customer_data['email']."' AND
USR.user_type='3'");
if(!empty($emailChk) && $emailChk->num_rows() > 0) return 2; if(!empty($emailChk) && $emailChk->num_rows() > 0) return 2;
$phoneChk = $this->db->query("SELECT * FROM customer AS CUST $phoneChk = $this->db->query("SELECT * FROM customer AS CUST
INNER JOIN users AS USR ON (USR.id=CUST.customer_id) INNER JOIN users AS USR ON (USR.id=CUST.customer_id)
WHERE USR.status!='2' AND CUST.phone='".$customer_data['phone']."'"); WHERE USR.status!='2' AND CUST.phone='".$customer_data['phone']."' AND
USR.user_type='3'");
if(!empty($phoneChk) && $phoneChk->num_rows() > 0) return 3; if(!empty($phoneChk) && $phoneChk->num_rows() > 0) return 3;
$status = $this->db->insert('users', $status = $this->db->insert('users',
......
...@@ -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'])){
......
...@@ -226,6 +226,7 @@ class Validation_model extends CI_Model { ...@@ -226,6 +226,7 @@ class Validation_model extends CI_Model {
) , ) ,
) , ) ,
) , ) ,
'verifyMail' => array() ,
'search' => array( 'search' => array(
/*'auth_token' => array( /*'auth_token' => array(
'required' => array( 'required' => array(
...@@ -377,9 +378,6 @@ class Validation_model extends CI_Model { ...@@ -377,9 +378,6 @@ class Validation_model extends CI_Model {
} }
} }
break; break;
default: default:
# code... # code...
break; break;
......
...@@ -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;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label>Registration Mail</label> <label>Registration Mail</label>
<p>Email => {:email}</p>
<textarea id="rich_editor" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Registration Mail" name="registration_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->registration_mail ?></textarea> <textarea id="rich_editor" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Registration Mail" name="registration_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->registration_mail ?></textarea>
</div> </div>
</div> </div>
...@@ -41,10 +42,49 @@ ...@@ -41,10 +42,49 @@
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group">
<label>Forgot Mail</label> <label>Forgot Mail</label>
<p>URL => {:url}</p>
<textarea id="rich_editor_1" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Forgot Mail" name="forgot_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->forgot_mail ?></textarea> <textarea id="rich_editor_1" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Forgot Mail" name="forgot_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->forgot_mail ?></textarea>
</div> </div>
</div> </div>
</div> </div>
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
<label>Checker Activation Mail</label>
<p>Username => {:user_name}</p>
<textarea id="rich_editor_2" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Checker Activation Mail" name="checker_activation_mail" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->checker_activation_mail ?></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label>Provider Activation Mail</label>
<p>Username => {:user_name} , URL => {:url}</p>
<textarea id="rich_editor_6" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Provider Activation Mail" style="height:108px;"
name="provider_activation_mail" data-parsley-trigger="change"><?= $notificationData->provider_activation_mail ?></textarea>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
<label>Registration Verification Mail</label>
<p>Username => {:user_name} , Reset Link => {:reset_link}</p>
<textarea id="rich_editor_8" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Checker Activation Mail" name="verify_mail"
style="height:108px;" data-parsley-trigger="change"><?= $notificationData->verify_mail ?></textarea>
</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 class="box-header with-border"> <div class="box-header with-border">
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<label>Category Name (English)</label> <label>Category Name (English)</label>
<input type="text" class="form-control required" data-parsley-trigger="change" <input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$"
name="category" required="" value="<?= (isset($categoryData->category))?$categoryData->category:'' ?>"placeholder="Category Name"> name="category" required="" value="<?= (isset($categoryData->category))?$categoryData->category:'' ?>" placeholder="Category Name">
<span class="glyphicon form-control-feedback"></span> <span class="glyphicon form-control-feedback"></span>
</div> </div>
</div> </div>
......
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="input-group date" data-provide="datepicker"> <div date="start" class="input-group date" data-provide="datepicker">
<input id="date" type="text" class="form-control required" required <input id="date" type="text" class="form-control required" required
data-parsley-trigger="change" data-parsley-minlength="5" data-parsley-trigger="change" data-parsley-minlength="5"
name="event_start_date" placeholder="Event Start Date" autocomplete="off"> name="event_start_date" placeholder="Event Start Date" autocomplete="off">
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
</div> </div>
</div> </div>
<div class="input-group date padTop10 hide" data-provide="datepicker" <div date="end" class="input-group date padTop10 hide" data-provide="datepicker"
id="eventEndDate"> id="eventEndDate">
<input id="date" type="text" class="form-control" disabled <input id="date" type="text" class="form-control" disabled
data-parsley-trigger="change" data-parsley-minlength="5" data-parsley-trigger="change" data-parsley-minlength="5"
......
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
<thead> <thead>
<tr> <tr>
<th class="hidden">ID</th> <th class="hidden">ID</th>
<th width="120px;">Organizer</th> <th width="100px;">Organizer</th>
<th width="120px;">User Name</th> <th width="100px;">User Name</th>
<th width="130px;">Email_id</th> <th width="110px;">Email_id</th>
<th width="80px;">Phone</th> <th width="70px;">Phone</th>
<th width="60px;">Status</th> <th width="60px;">Status</th>
<th width="520px;">Action</th> <th width="520px;">Action</th>
</tr> </tr>
......
...@@ -33,78 +33,78 @@ ...@@ -33,78 +33,78 @@
</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>
<div class="form-group col-xs-5"> <div class="form-group col-xs-6">
<label>Site Logo</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="site_logo" src="<?= base_url($data['site_logo']) ?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" height="75" width="75">
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="site_logo" type="file" accept="image/*" onchange="setImg(this,'site_logo');" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-xs-4">
<label>Country Code</label> <label>Country Code</label>
<input type="text" name="country_flag" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['country_flag'] ?>"> <input type="text" name="country_flag" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['country_flag'] ?>">
</div> </div>
<div class="form-group col-xs-3"> <div class="form-group col-xs-6">
<label>Currency</label> <label>Currency</label>
<input type="text" name="currency" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['currency'] ?>"> <input type="text" name="currency" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['currency'] ?>">
</div> </div>
<!-- <div class="form-group col-xs-6">
<div class="form-group col-xs-5">
<label>Favicon Icon</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="fav_icon_image" src="<?= base_url($data['fav_icon']) ?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" height="75" width="75">
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="fav_icon" type="file" accept="image/*" onchange="setImg(this,'fav_icon_image');" />
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-xs-4">
<label>SMTP Username</label> <label>SMTP Username</label>
<input type="text" name="smtp_username" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['smtp_username'] ?>"> <input type="text" name="smtp_username" class="form-control required" placeholder="Enter SMTP Username" value="<?= $data['smtp_username'] ?>">
</div> </div>
<div class="form-group col-xs-3"> <div class="form-group col-xs-6">
<label>SMTP Password</label> <label>SMTP Password</label>
<input type="text" name="smtp_password" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['smtp_password'] ?>"> <input type="text" name="smtp_password" class="form-control required" placeholder="Enter SMTP Password" value="<?= $data['smtp_password'] ?>">
</div> </div> -->
<div class="form-group col-xs-4"> <div class="form-group col-xs-6">
<label>Google API Key</label> <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'] ?>"> <input type="text" name="google_api_key" class="form-control required" placeholder="Enter Google API" value="<?= $data['google_api_key'] ?>">
</div> </div>
</div> <div class="form-group col-xs-6">
<div class="row">
<div class="form-group col-xs-4">
<label>Commission Per Booking</label> <label>Commission Per Booking</label>
<input type="text" name="service_charge" class="form-control required" placeholder="Enter Service Charge" value="<?= $data['service_charge'] ?>"> <input type="text" name="service_charge" class="form-control required" placeholder="Enter Service Charge" value="<?= $data['service_charge'] ?>">
</div> </div>
<div class="form-group col-xs-3"> <div class="form-group col-xs-6">
<label>BayanPay Merchant Key</label> <label>BayanPay Merchant Key</label>
<input type="text" name="merchant_key" class="form-control required" placeholder="Enter Merchant Key" value="<?= $data['merchant_key'] ?>"> <input type="text" name="merchant_key" class="form-control required" placeholder="Enter Merchant Key" value="<?= $data['merchant_key'] ?>">
</div> </div>
<div class="form-group col-xs-4"> <div class="form-group col-xs-6">
<label>BayanPay Merchant ID</label> <label>BayanPay Merchant ID</label>
<input type="text" name="merchant_id" class="form-control required" placeholder="Enter Merchant ID" value="<?= $data['merchant_id'] ?>"> <input type="text" name="merchant_id" class="form-control required" placeholder="Enter Merchant ID" value="<?= $data['merchant_id'] ?>">
</div> </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 class="form-group col-xs-5">
<div class="form-group">
<label>Site Logo</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="site_logo" src="<?= base_url($data['site_logo']) ?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" height="75" width="75">
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="site_logo" type="file" accept="image/*" onchange="setImg(this,'site_logo');" />
</div>
</div>
</div>
<div class="form-group">
<label>Favicon Icon</label>
<div class="col-md-12">
<div class="col-md-3">
<img id="fav_icon_image" src="<?= base_url($data['fav_icon']) ?>" onerror="this.src='<?=base_url("assets/images/no_image.png")?>';" height="75" width="75">
</div>
<div class="col-md-9" style="padding-top: 25px;">
<input name="fav_icon" type="file" accept="image/*" onchange="setImg(this,'fav_icon_image');" />
</div>
</div>
</div>
</div> </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
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<script src="<?= base_url('assets/js/dataTables.bootstrap.min.js') ?>"></script> <script src="<?= base_url('assets/js/dataTables.bootstrap.min.js') ?>"></script>
<script src="<?= base_url('assets/js/bootbox.min.js') ?>"></script> <script src="<?= base_url('assets/js/bootbox.min.js') ?>"></script>
<script src="<?= base_url('assets/js/app.min.js') ?>"></script> <script src="<?= base_url('assets/js/app.min.js') ?>"></script>
<script src="<?= base_url('assets/js/locationpicker.js') ?>" type="text/javascript"></script>
<script src="<?= base_url('assets/js/custom-script.js') ?>"></script> <script src="<?= base_url('assets/js/custom-script.js') ?>"></script>
<script src="<?= base_url('assets/js/parsley.min.js') ?>"></script> <script src="<?= base_url('assets/js/parsley.min.js') ?>"></script>
<script src="https://cdn.ckeditor.com/4.5.7/standard/ckeditor.js"></script> <script src="https://cdn.ckeditor.com/4.5.7/standard/ckeditor.js"></script>
...@@ -25,10 +26,12 @@ ...@@ -25,10 +26,12 @@
<script> <script>
jQuery('.clockpicker').clockpicker(); jQuery('.clockpicker').clockpicker();
jQuery( document ).ready(function() { jQuery( document ).ready(function() {
if(jQuery('#rich_editor').length==1){ CKEDITOR.replace('rich_editor'); } if(jQuery('#rich_editor').length==1){CKEDITOR.replace('rich_editor');}
if(jQuery('#rich_editor_1').length==1){CKEDITOR.replace('rich_editor_1'); } if(jQuery('#rich_editor_1').length==1){CKEDITOR.replace('rich_editor_1');}
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_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'});}
...@@ -47,26 +50,31 @@ ...@@ -47,26 +50,31 @@
$actionName = $ci->uri->segment(2); $actionName = $ci->uri->segment(2);
$page = $controllerName . '-' . $actionName; $page = $controllerName . '-' . $actionName;
// switch ($page) { switch ($page) {
//case 'Ride-view_rides': ?> case 'Event-addEvent': ?>
// jQuery(function () { jQuery(function () {
// jQuery('.datatable').DataTable({ jQuery('[date="start"]').datepicker({
// scrollY: "300px", format: 'dd - MM - yyyy',
// scrollX: true, startDate: '-0d',
// scrollCollapse: true, endDate: '+90d'
// paging: false, });
// fixedColumns: { jQuery('[date="end"]').datepicker({
// heightMatch: 'none' format: 'dd - MM - yyyy',
// } startDate: '+1d',
// }); endDate: '+90d'
// }); });
<?php //break; });
//default : ?> jQuery('.datatable').DataTable({
"ordering" : jQuery(this).data("ordering"),
"order": [[ 0, "desc" ]]
});
<?php break;
default : ?>
jQuery(function () { jQuery(function () {
jQuery('.datatable').DataTable({ jQuery('.datatable').DataTable({
"ordering" : jQuery(this).data("ordering"), "ordering" : jQuery(this).data("ordering"),
"order": [[ 0, "asc" ]] "order": [[ 0, "desc" ]]
}); });
}); });
<?php //} ?> <?php } ?>
</script> </script>
\ No newline at end of file
x <aside class="main-sidebar"> <?php
// ROLE MANAGEMENT \\
$menus = array();
$userType = $this->session->userdata['user_type'];
switch($userType){
case 1:
$menus = array('Dashboard','Tag','Host','City','Category','Venue','Event','Organizer','Checker',
'Customer','Booking','Commission','Staff','CMS','Notification','Settings');
break;
case 2:
$menus = array('Dashboard','Tag','Host','City','Category','Venue','Event','Checker',
'Commission');
break;
case 4:
$menus = array('Dashboard');
break;
}
?>
<aside class="main-sidebar">
<section class="sidebar"> <section class="sidebar">
<div class="user-panel"> <div class="user-panel">
<div class="pull-left image"> <div class="pull-left image">
...@@ -10,18 +30,21 @@ x <aside class="main-sidebar"> ...@@ -10,18 +30,21 @@ x <aside class="main-sidebar">
</div> </div>
</div> </div>
<ul class="sidebar-menu"> <ul class="sidebar-menu">
<?php if(in_array('Dashboard',$menus)){ ?>
<li> <li>
<a href="<?= base_url('Dashboard') ?>"> <a href="<?= base_url('Dashboard') ?>">
<img src="<?=base_url("assets/images/m1.png") ?>"> <img src="<?=base_url("assets/images/m1.png") ?>">
<span>Dashboard</span> <span>Dashboard</span>
</a> </a>
</li> </li>
<?php } if(in_array('Tag',$menus)){ ?>
<li> <li>
<a href="<?= base_url('Tag/listTags') ?>"> <a href="<?= base_url('Tag/listTags') ?>">
<img src="<?=base_url("assets/images/m2.png") ?>"> <img src="<?=base_url("assets/images/m2.png") ?>">
<span>Tag Management</span> <span>Tag Management</span>
</a> </a>
</li> </li>
<?php } if(in_array('Host',$menus)){ ?>
<li class="treeview"> <li class="treeview">
<a href="#"> <a href="#">
<img src="<?=base_url("assets/images/m3.png") ?>"> <img src="<?=base_url("assets/images/m3.png") ?>">
...@@ -43,18 +66,21 @@ x <aside class="main-sidebar"> ...@@ -43,18 +66,21 @@ x <aside class="main-sidebar">
</li> </li>
</ul> </ul>
</li> </li>
<?php } if(in_array('City',$menus)){ ?>
<li> <li>
<a href="<?= base_url('Region/listRegion') ?>"> <a href="<?= base_url('Region/listRegion') ?>">
<img src="<?=base_url("assets/images/m4.png") ?>"> <img src="<?=base_url("assets/images/m4.png") ?>">
<span>City Management</span> <span>City Management</span>
</a> </a>
</li> </li>
<?php } if(in_array('Category',$menus)){ ?>
<li> <li>
<a href="<?= base_url('Category/listCategory') ?>"> <a href="<?= base_url('Category/listCategory') ?>">
<img src="<?=base_url("assets/images/m5.png") ?>"> <img src="<?=base_url("assets/images/m5.png") ?>">
<span>Category Management</span> <span>Category Management</span>
</a> </a>
</li> </li>
<?php } if(in_array('Venue',$menus)){ ?>
<li class="treeview"> <li class="treeview">
<a href="#"> <a href="#">
<img src="<?=base_url("assets/images/m6.png") ?>"> <img src="<?=base_url("assets/images/m6.png") ?>">
...@@ -76,6 +102,7 @@ x <aside class="main-sidebar"> ...@@ -76,6 +102,7 @@ x <aside class="main-sidebar">
</li> </li>
</ul> </ul>
</li> </li>
<?php } if(in_array('Event',$menus)){ ?>
<li class="treeview"> <li class="treeview">
<a href="#"> <a href="#">
<img src="<?=base_url("assets/images/m7.png") ?>"> <img src="<?=base_url("assets/images/m7.png") ?>">
...@@ -97,7 +124,7 @@ x <aside class="main-sidebar"> ...@@ -97,7 +124,7 @@ x <aside class="main-sidebar">
</li> </li>
</ul> </ul>
</li> </li>
<?php if($this->session->userdata['user_type'] == 1){ ?> <?php } if(in_array('Organizer',$menus)){ ?>
<li class="treeview"> <li class="treeview">
<a href="#"> <a href="#">
<img src="<?=base_url("assets/images/m3.png") ?>"> <img src="<?=base_url("assets/images/m3.png") ?>">
...@@ -119,14 +146,14 @@ x <aside class="main-sidebar"> ...@@ -119,14 +146,14 @@ x <aside class="main-sidebar">
</li> </li>
</ul> </ul>
</li> </li>
<?php } ?> <?php } if(in_array('Checker',$menus)){ ?>
<li> <li>
<a href="<?= base_url('Checker/viewCheckers') ?>"> <a href="<?= base_url('Checker/viewCheckers') ?>">
<img src="<?=base_url("assets/images/m2.png") ?>"> <img src="<?=base_url("assets/images/m2.png") ?>">
<span>Checker Management</span> <span>Checker Management</span>
</a> </a>
</li> </li>
<?php if($this->session->userdata['user_type'] == 1){ ?> <?php } if(in_array('Customer',$menus)){ ?>
<li class="treeview"> <li class="treeview">
<a href="#"> <a href="#">
<img src="<?=base_url("assets/images/m9.png") ?>"> <img src="<?=base_url("assets/images/m9.png") ?>">
...@@ -148,27 +175,52 @@ x <aside class="main-sidebar"> ...@@ -148,27 +175,52 @@ x <aside class="main-sidebar">
</li> </li>
</ul> </ul>
</li> </li>
<?php } if(in_array('Commission',$menus)){ ?>
<li> <li>
<a href="<?= base_url('Booking/viewBookings') ?>"> <a href="<?= base_url('Booking/viewBookings') ?>">
<img src="<?=base_url("assets/images/m8.png") ?>"> <img src="<?=base_url("assets/images/m8.png") ?>">
<span>Booking Details</span></a> <span>Booking Details</span></a>
</li> </li>
<?php } ?> <?php } if(in_array('',$menus)){ ?>
<li><a href="<?= base_url('Provider/getProviderPayDetails') ?>"> <li><a href="<?= base_url('Provider/getProviderPayDetails') ?>">
<img src="<?=base_url("assets/images/m2.png") ?>"> <img src="<?=base_url("assets/images/m2.png") ?>">
<span>Commission Management</span></a> <span>Commission Management</span></a>
</li> </li>
<?php if($this->session->userdata['user_type'] == 1){ ?> <?php } if(in_array('Staff',$menus)){ ?>
<li class="treeview">
<a href="#">
<img src="<?=base_url("assets/images/m9.png") ?>">
<span>Staff Management</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li>
<a href="<?= base_url('Staff/addStaff') ?>">
<i class="fa fa-circle-o text-aqua"></i>
Add Staff User
</a>
</li>
<li>
<a href="<?= base_url('Staff/viewStaffs') ?>">
<i class="fa fa-circle-o text-aqua"></i>
View Staff Users
</a>
</li>
</ul>
</li>
<?php } if(in_array('CMS',$menus)){ ?>
<li> <li>
<a href="<?= base_url('CMS') ?>"> <a href="<?= base_url('CMS') ?>">
<img src="<?=base_url("assets/images/m5.png") ?>"> <img src="<?=base_url("assets/images/m5.png") ?>">
<span>CMS Management</span> <span>CMS Management</span>
</a> </a>
</li> </li>
<?php } if(in_array('Notification',$menus)){ ?>
<li><a href="<?= base_url('CMS/notification') ?>"> <li><a href="<?= base_url('CMS/notification') ?>">
<img src="<?=base_url("assets/images/m2.png") ?>"> <img src="<?=base_url("assets/images/m2.png") ?>">
<span>Notification Tempaltes</span></a> <span>Notification Tempaltes</span></a>
</li> </li>
<?php } if(in_array('Settings',$menus)){ ?>
<li> <li>
<a href="<?= base_url('Settings') ?>"> <a href="<?= base_url('Settings') ?>">
<i class="fa fa-wrench" aria-hidden="true"> <i class="fa fa-wrench" aria-hidden="true">
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</div> </div>
<?php <?php
$user_type = $this->session->userdata('user_type'); $user_type = $this->session->userdata('user_type');
if($user_type == 2 || $user_type == 3){ ?> if(($user_type == 2 && !empty($provider)) || ($user_type == 3 && !empty($customer))){ ?>
<!-- Mechanic Data --> <!-- Mechanic Data -->
<div class="col-md-12"> <div class="col-md-12">
<div class="box-header with-border padUnset"> <div class="box-header with-border padUnset">
...@@ -140,14 +140,16 @@ ...@@ -140,14 +140,16 @@
<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"
autocomplete="off">
<span class="glyphicon form-control-feedback"></span> <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"
autocomplete="off">
<span class="glyphicon form-control-feedback"></span> <span class="glyphicon form-control-feedback"></span>
</div> </div>
</div> </div>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<option selected disabled>Choose a Region</option> <option selected disabled>Choose a Region</option>
<?php <?php
foreach ($regionData as $region) { foreach ($regionData as $region) {
$select = (isset($venue_data->region_id) && $venue_data->region_id == $region->id)?'selected':''; $select = (isset($venue_data->region_id) && $venue_data->region_id==$region->id)?'selected':'';
echo '<option '.$select.' value="'.$region->id.'">'. echo '<option '.$select.' value="'.$region->id.'">'.
$region->name. $region->name.
'</option>'; '</option>';
...@@ -46,21 +46,8 @@ ...@@ -46,21 +46,8 @@
?> ?>
</select> </select>
</div> </div>
<?php } ?> <?php }
<div class="form-group"> if(!empty($host_data)){ ?>
<label>Venue Title</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="1" name="venue_name" required="" placeholder="Enter Venue Title"
value="<?= (isset($venue_data->venue_name))?$venue_data->venue_name:'' ?>">
</div>
<div class="form-group">
<label>Venue Address</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
id="loc_search_1" name="location" placeholder="Venue Address" value="<?= (isset($venue_data->location))?$venue_data->location:'' ?>" required>
</div>
</div>
<div class="col-md-6">
<?php if(!empty($host_data)){ ?>
<div class="form-group"> <div class="form-group">
<label>Venue</label> <label>Venue</label>
<select name="host_cat_id" class="form-control required" <select name="host_cat_id" class="form-control required"
...@@ -79,12 +66,31 @@ ...@@ -79,12 +66,31 @@
</div> </div>
<?php } ?> <?php } ?>
<div class="form-group"> <div class="form-group">
<label>Venue Title</label>
<input type="text" class="form-control required" data-parsley-trigger="change"
data-parsley-minlength="1" name="venue_name" required="" placeholder="Enter Venue Title"
value="<?= (isset($venue_data->venue_name))?$venue_data->venue_name:'' ?>">
</div>
<div class="form-group">
<label>Venue Details</label> <label>Venue Details</label>
<textarea type="text" class="ip_reg_form_input form-control reset-form-custom required" placeholder="Venue Details" name="venue_details" data-parsley-trigger="change" data-parsley-minlength="1" required="" style="height:106px;"><?= (isset($venue_data->venue_details))?$venue_data->venue_details:'' ?></textarea> <textarea type="text" class="ip_reg_form_input form-control reset-form-custom required" placeholder="Venue Details" name="venue_details" data-parsley-trigger="change" data-parsley-minlength="1" required="" style="height:106px;"><?= (isset($venue_data->venue_details))?$venue_data->venue_details:'' ?></textarea>
<span class="glyphicon form-control-feedback"></span> <span class="glyphicon form-control-feedback"></span>
</div> </div>
<?php if(!isset($venue_id) || empty($venue_id)){ ?> </div>
<div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label>Venue Address</label>
<input type="text" class="form-control required" data-parsley-trigger="change" required
name="location" placeholder="Venue Address" value="<?= (isset($venue_data->location))?$venue_data->location:'' ?>">
</div>
<input type="hidden" id="gooLocLat" value="<?= (isset($venue_data->location_lat) && !empty($venue_data->location_lat))?$venue_data->location_lat:'' ?>" />
<input type="hidden" id="gooLocLng" value="<?= (isset($venue_data->location_lng) && !empty($venue_data->location_lng))?$venue_data->location_lng:'' ?>" />
<input type="hidden" id="gooLocZoom" value="<?= (isset($venue_data->location))?15:0 ?>"/>
<div id="locPointerMap" style="height: 213px;"></div>
<?php if(!isset($venue_id) || empty($venue_id)){ ?>
<div class="form-group" style="padding-top: 5px;">
<label id="localityLabel">Venue Locality</label> <label id="localityLabel">Venue Locality</label>
<div id="showType" class="hide"> <div id="showType" class="hide">
<div class="col-md-5"> <div class="col-md-5">
......
...@@ -313,6 +313,18 @@ ...@@ -313,6 +313,18 @@
opacity: 0.5; opacity: 0.5;
} }
.padTop10 {
padding-top:10px !important;
}
.padTop15 {
padding-top:15px !important;
}
.padTop12 {
padding-top:12px !important;
}
/* .padBottom10 { /* .padBottom10 {
padding-bottom:10px !important; padding-bottom:10px !important;
} }
......
...@@ -78,12 +78,14 @@ function initLocSearch_1() { ...@@ -78,12 +78,14 @@ function initLocSearch_1() {
var options = {componentRestrictions: {country: country_flag}}; var options = {componentRestrictions: {country: country_flag}};
var autocomplete = new google.maps.places.Autocomplete(input, options); var autocomplete = new google.maps.places.Autocomplete(input, options);
} }
google.maps.event.addDomListener(window,'load',initLocSearch_1); google.maps.event.addDomListener(window,'load',initLocSearch_1);
function initLocSearch_2() { function initLocSearch_2() {
var input = document.getElementById('loc_search_2'); var input = document.getElementById('loc_search_2');
var options = {componentRestrictions: {country: country_flag}}; var options = {componentRestrictions: {country: country_flag}};
var autocomplete = new google.maps.places.Autocomplete(input, options); var autocomplete = new google.maps.places.Autocomplete(input, options);
} }
google.maps.event.addDomListener(window,'load',initLocSearch_2); google.maps.event.addDomListener(window,'load',initLocSearch_2);
function initLocSearch_3() { function initLocSearch_3() {
var input = document.getElementById('loc_search_3'); var input = document.getElementById('loc_search_3');
...@@ -501,7 +503,6 @@ jQuery('[id="viewCustomer"]').on('click',function() { ...@@ -501,7 +503,6 @@ jQuery('[id="viewCustomer"]').on('click',function() {
case '2': gender = 'Female';break; case '2': gender = 'Female';break;
case '3': gender = 'Others';break; case '3': gender = 'Others';break;
} }
var html = '<div class="col-xs-12">'+ var html = '<div class="col-xs-12">'+
'<div class="col-md-2">'+ '<div class="col-md-2">'+
'<div class="row">'+ '<div class="row">'+
...@@ -820,3 +821,20 @@ jQuery('[name="region_id"]').on('change',function(){ ...@@ -820,3 +821,20 @@ jQuery('[name="region_id"]').on('change',function(){
} }
}); });
}); });
jQuery('#locPointerMap').locationpicker({
location: {latitude: jQuery('#gooLocLat').val(), longitude: jQuery('#gooLocLng').val()},
radius: 0,
zoom: 10,
inputBinding: {
radiusInput: 0,
zoomInput: parseInt(jQuery('#gooLocZoom').val()),
latitudeInput: jQuery('#gooLocLat'),
longitudeInput: jQuery('#gooLocLng'),
locationNameInput: jQuery('[name="location"]')
},
enableAutocomplete: true,
onchanged: function(currentLocation, radius, isMarkerDropped) {
jQuery('#gooLocZoom').val('15');
}
});
(function ( $ ) {
/**
* Holds google map object and related utility entities.
* @constructor
*/
function GMapContext(domElement, options) {
var _map = new google.maps.Map(domElement, options);
var _marker = new google.maps.Marker({
position: new google.maps.LatLng(54.19335, -3.92695),
map: _map,
title: "Drag Me",
visible: options.markerVisible,
draggable: options.markerDraggable,
icon: (options.markerIcon !== undefined) ? options.markerIcon : undefined
});
return {
map: _map,
marker: _marker,
circle: null,
location: _marker.position,
radius: options.radius,
locationName: options.locationName,
addressComponents: {
formatted_address: null,
addressLine1: null,
addressLine2: null,
streetName: null,
streetNumber: null,
city: null,
district: null,
state: null,
stateOrProvince: null
},
settings: options.settings,
domContainer: domElement,
geodecoder: new google.maps.Geocoder()
}
}
// Utility functions for Google Map Manipulations
var GmUtility = {
/**
* Draw a circle over the the map. Returns circle object.
* Also writes new circle object in gmapContext.
*
* @param center - LatLng of the center of the circle
* @param radius - radius in meters
* @param gmapContext - context
* @param options
*/
drawCircle: function(gmapContext, center, radius, options) {
if (gmapContext.circle != null) {
gmapContext.circle.setMap(null);
}
if (radius > 0) {
radius *= 1;
options = $.extend({
strokeColor: "#0000FF",
strokeOpacity: 0.35,
strokeWeight: 2,
fillColor: "#0000FF",
fillOpacity: 0.20
}, options);
options.map = gmapContext.map;
options.radius = radius;
options.center = center;
gmapContext.circle = new google.maps.Circle(options);
return gmapContext.circle;
}
return null;
},
/**
*
* @param gMapContext
* @param location
* @param callback
*/
setPosition: function(gMapContext, location, callback) {
gMapContext.location = location;
gMapContext.marker.setPosition(location);
gMapContext.map.panTo(location);
this.drawCircle(gMapContext, location, gMapContext.radius, {});
if (gMapContext.settings.enableReverseGeocode) {
this.updateLocationName(gMapContext, callback);
} else {
if (callback) {
callback.call(this, gMapContext);
}
}
},
locationFromLatLng: function(lnlg) {
return {latitude: lnlg.lat(), longitude: lnlg.lng()}
},
addressByFormat: function (addresses, format) {
var result = null;
for(var i = addresses.length - 1; i >= 0; i--){
if(addresses[i].types.indexOf(format) >= 0){
result = addresses[i];
}
}
return result || addresses[0];
},
updateLocationName: function(gmapContext, callback) {
gmapContext.geodecoder.geocode({
latLng: gmapContext.marker.position
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length > 0) {
var address = GmUtility.addressByFormat(results, gmapContext.settings.addressFormat);
gmapContext.locationName = address.formatted_address;
gmapContext.addressComponents = GmUtility.address_component_from_google_geocode(address.address_components);
}else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
return setTimeout(function () {
GmUtility.updateLocationName(gmapContext, callback);
}, 1000);
}
if (callback) {
callback.call(this, gmapContext);
}
});
},
address_component_from_google_geocode: function(address_components) {
var result = {};
for (var i = address_components.length-1; i>=0; i--) {
var component = address_components[i];
// Postal code
if (component.types.indexOf('postal_code') >= 0) {
result.postalCode = component.short_name;
}
// Street number
else if (component.types.indexOf('street_number') >= 0) {
result.streetNumber = component.short_name;
}
// Street name
else if (component.types.indexOf('route') >= 0) {
result.streetName = component.short_name;
}
// City
else if (component.types.indexOf('locality') >= 0) {
result.city = component.short_name;
}
// District
else if (component.types.indexOf('sublocality') >= 0) {
result.district = component.short_name;
}
// State \ Province
else if (component.types.indexOf('administrative_area_level_1') >= 0) {
result.stateOrProvince = component.short_name;
}
// State \ Province
else if (component.types.indexOf('country') >= 0) {
result.country = component.short_name;
}
}
result.addressLine1 = [result.streetNumber, result.streetName].join(' ').trim();
result.addressLine2 = '';
return result;
}
};
function isPluginApplied(domObj) {
return getContextForElement(domObj) != undefined;
}
function getContextForElement(domObj) {
return $(domObj).data("locationpicker");
}
function updateInputValues(inputBinding, gmapContext){
if (!inputBinding) return;
var currentLocation = GmUtility.locationFromLatLng(gmapContext.marker.position);
if (inputBinding.latitudeInput) {
inputBinding.latitudeInput.val(currentLocation.latitude).change();
}
if (inputBinding.longitudeInput) {
inputBinding.longitudeInput.val(currentLocation.longitude).change();
}
if (inputBinding.radiusInput) {
inputBinding.radiusInput.val(gmapContext.radius).change();
}
if (inputBinding.locationNameInput) {
inputBinding.locationNameInput.val(gmapContext.locationName).change();
}
}
function setupInputListenersInput(inputBinding, gmapContext) {
if (inputBinding) {
if (inputBinding.radiusInput){
inputBinding.radiusInput.on("change", function(e) {
var radiusInputValue = $(this).val();
if (!e.originalEvent || isNaN(radiusInputValue)) { return }
gmapContext.radius = radiusInputValue;
GmUtility.setPosition(gmapContext, gmapContext.location, function(context){
context.settings.onchanged.apply(gmapContext.domContainer,
[GmUtility.locationFromLatLng(context.location), context.radius, false]);
});
});
}
if (inputBinding.locationNameInput && gmapContext.settings.enableAutocomplete) {
var blur = false;
var options = {componentRestrictions: {country: country_flag}};
gmapContext.autocomplete = new google.maps.places.Autocomplete(inputBinding.locationNameInput.get(0), options);
google.maps.event.addListener(gmapContext.autocomplete, 'place_changed', function() {
blur = false;
var place = gmapContext.autocomplete.getPlace();
if (!place.geometry) {
gmapContext.settings.onlocationnotfound(place.name);
return;
}
GmUtility.setPosition(gmapContext, place.geometry.location, function(context) {
updateInputValues(inputBinding, context);
context.settings.onchanged.apply(gmapContext.domContainer,
[GmUtility.locationFromLatLng(context.location), context.radius, false]);
});
});
if(gmapContext.settings.enableAutocompleteBlur) {
inputBinding.locationNameInput.on("change", function(e) {
if (!e.originalEvent) { return }
blur = true;
});
inputBinding.locationNameInput.on("blur", function(e) {
if (!e.originalEvent) { return }
setTimeout(function() {
var address = $(inputBinding.locationNameInput).val();
if (address.length > 5 && blur) {
blur = false;
gmapContext.geodecoder.geocode({'address': address}, function(results, status) {
if(status == google.maps.GeocoderStatus.OK && results && results.length) {
GmUtility.setPosition(gmapContext, results[0].geometry.location, function(context) {
updateInputValues(inputBinding, context);
context.settings.onchanged.apply(gmapContext.domContainer,
[GmUtility.locationFromLatLng(context.location), context.radius, false]);
});
}
});
}
}, 1000);
});
}
}
if (inputBinding.latitudeInput) {
inputBinding.latitudeInput.on("change", function(e) {
var latitudeInputValue = $(this).val();
if (!e.originalEvent || isNaN(latitudeInputValue) ) { return }
GmUtility.setPosition(gmapContext, new google.maps.LatLng(latitudeInputValue, gmapContext.location.lng()), function(context){ context.settings.onchanged.apply(gmapContext.domContainer,
[GmUtility.locationFromLatLng(context.location), context.radius, false]);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
});
}
if (inputBinding.longitudeInput) {
inputBinding.longitudeInput.on("change", function(e) {
var longitudeInputValue = $(this).val();
if (!e.originalEvent || isNaN(longitudeInputValue) ) { return }
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), longitudeInputValue), function(context){
context.settings.onchanged.apply(gmapContext.domContainer,
[GmUtility.locationFromLatLng(context.location), context.radius, false]);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
});
}
}
}
function autosize(gmapContext) {
google.maps.event.trigger(gmapContext.map, 'resize');
setTimeout(function() {
gmapContext.map.setCenter(gmapContext.marker.position);
}, 300);
}
function updateMap(gmapContext, $target, options) {
var settings = $.extend({}, $.fn.locationpicker.defaults, options ),
latNew = settings.location.latitude,
lngNew = settings.location.longitude,
radiusNew = settings.radius,
latOld = gmapContext.settings.location.latitude,
lngOld = gmapContext.settings.location.longitude,
radiusOld = gmapContext.settings.radius;
if (latNew == latOld && lngNew == lngOld && radiusNew == radiusOld)
return;
gmapContext.settings.location.latitude = latNew;
gmapContext.settings.location.longitude = lngNew;
gmapContext.radius = radiusNew;
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.settings.location.latitude, gmapContext.settings.location.longitude), function(context){
setupInputListenersInput(gmapContext.settings.inputBinding, gmapContext);
context.settings.oninitialized($target);
});
}
/**
* Initializeialization:
* $("#myMap").locationpicker(options);
* @param options
* @param params
* @returns {*}
*/
$.fn.locationpicker = function( options, params ) {
if (typeof options == 'string') { // Command provided
var _targetDomElement = this.get(0);
// Plug-in is not applied - nothing to do.
if (!isPluginApplied(_targetDomElement)) return;
var gmapContext = getContextForElement(_targetDomElement);
switch (options) {
case "location":
if (params == undefined) { // Getter
var location = GmUtility.locationFromLatLng(gmapContext.location);
location.radius = gmapContext.radius;
location.name = gmapContext.locationName;
return location;
} else { // Setter
if (params.radius) {
gmapContext.radius = params.radius;
}
GmUtility.setPosition(gmapContext, new google.maps.LatLng(params.latitude, params.longitude), function(gmapContext) {
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
}
break;
case "subscribe":
/**
* Provides interface for subscribing for GoogleMap events.
* See Google API documentation for details.
* Parameters:
* - event: string, name of the event
* - callback: function, callback function to be invoked
*/
if (params == undefined) { // Getter is not available
return null;
} else {
var event = params.event;
var callback = params.callback;
if (!event || ! callback) {
console.error("LocationPicker: Invalid arguments for method \"subscribe\"")
return null;
}
google.maps.event.addListener(gmapContext.map, event, callback);
}
break;
case "map":
/**
* Returns object which allows access actual google widget and marker paced on it.
* Structure: {
* map: Instance of the google map widget
* marker: marker placed on map
* }
*/
if (params == undefined) { // Getter
var locationObj = GmUtility.locationFromLatLng(gmapContext.location);
locationObj.formattedAddress = gmapContext.locationName;
locationObj.addressComponents = gmapContext.addressComponents;
return {
map: gmapContext.map,
marker: gmapContext.marker,
location: locationObj
}
} else { // Setter is not available
return null;
}
case "autosize":
autosize(gmapContext);
return this;
}
return null;
}
return this.each(function() {
var $target = $(this);
// If plug-in hasn't been applied before - initialize, otherwise - skip
if (isPluginApplied(this)){
updateMap(getContextForElement(this), $(this), options);
return;
}
// Plug-in initialization is required
// Defaults
var settings = $.extend({}, $.fn.locationpicker.defaults, options );
// Initialize
var gmapContext = new GMapContext(this, $.extend({}, {
zoom: settings.zoom,
center: new google.maps.LatLng(settings.location.latitude, settings.location.longitude),
mapTypeId: settings.mapTypeId,
mapTypeControl: false,
styles: settings.styles,
disableDoubleClickZoom: false,
scrollwheel: settings.scrollwheel,
streetViewControl: false,
radius: settings.radius,
locationName: settings.locationName,
settings: settings,
autocompleteOptions : settings.autocompleteOptions,
addressFormat: settings.addressFormat,
draggable: settings.draggable,
markerIcon: settings.markerIcon,
markerDraggable: settings.markerDraggable,
markerVisible: settings.markerVisible
}, settings.mapOptions));
$target.data("locationpicker", gmapContext);
// Subscribe GMap events
function displayMarkerWithSelectedArea() {
GmUtility.setPosition(gmapContext, gmapContext.marker.position, function (context) {
var currentLocation = GmUtility.locationFromLatLng(gmapContext.location);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
context.settings.onchanged.apply(gmapContext.domContainer, [currentLocation, context.radius, true]);
});
}
if (settings.markerInCenter) {
gmapContext.map.addListener("bounds_changed", function () {
if (!gmapContext.marker.dragging) {
gmapContext.marker.setPosition(gmapContext.map.center);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
}
});
gmapContext.map.addListener("idle", function () {
if (!gmapContext.marker.dragging) {
displayMarkerWithSelectedArea();
}
});
}
google.maps.event.addListener(gmapContext.marker, "drag", function(event) {
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
google.maps.event.addListener(gmapContext.marker, "dragend", function(event) {
displayMarkerWithSelectedArea();
});
GmUtility.setPosition(gmapContext, new google.maps.LatLng(settings.location.latitude, settings.location.longitude), function(context){
updateInputValues(settings.inputBinding, gmapContext);
// Set input bindings if needed
setupInputListenersInput(settings.inputBinding, gmapContext);
context.settings.oninitialized($target);
});
});
};
$.fn.locationpicker.defaults = {
location: {latitude: 40.7324319, longitude: -73.82480777777776},
locationName: "",
radius: 500,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: [],
mapOptions: {},
scrollwheel: true,
inputBinding: {
latitudeInput: null,
longitudeInput: null,
radiusInput: null,
locationNameInput: null
},
enableAutocomplete: false,
enableAutocompleteBlur: false,
autocompleteOptions: null,
addressFormat: 'postal_code',
enableReverseGeocode: true,
draggable: true,
onchanged: function(currentLocation, radius, isMarkerDropped) {},
onlocationnotfound: function(locationName) {},
oninitialized: function (component) {},
// must be undefined to use the default gMaps marker
markerIcon: undefined,
markerDraggable: true,
markerVisible : true
}
}( jQuery ));
\ No newline at end of file
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