Merge branch 'uat' of bitbucket.org:venbainformationtechnology/vb_book into uat

This commit is contained in:
heama 2023-09-05 17:23:17 +05:30
commit 1fbef1b7ed
21 changed files with 819 additions and 184 deletions

View File

@ -96,4 +96,8 @@ define('EVENT_PRIORITY_HIGH', 10);
/**
* Constants For Api Integration.
*/
define('VPB_BOOK', 'https://vbp.venbait.in/wp-json/wc/v3/products');
define('VB_APIURL', 'https://vbp.venbait.in/wp-json/wc/v3/');
define('VB_BOOKS', VB_APIURL.'products');
define('VB_CUSTOMERS', VB_APIURL.'customers');

View File

@ -38,6 +38,11 @@ $routes->get('logout/', 'Authentication::logout');
$routes->get('auth_confirm_mail/', 'Authentication::auth_confirm_mail');//Routes For Confirmation Mail alert page.
$routes->get('auth_reset_password/', 'Authentication::auth_reset_password');//Routes For Load Reset password Page.
$routes->post('auth_reset_password_save/', 'Authentication::auth_reset_password_save');//Routes For update the Resetted password.
$routes->get('lockscreen/', 'Authentication::lockscreen');
$routes->get('lock/', 'Authentication::lock');
$routes->post('unlock/', 'Authentication::unlock');
# Dashboard Routes
$routes->get('dashboard/', 'Home::index');
@ -98,7 +103,9 @@ $routes->get("new_invoice/", "Invoice::new_invoice/");
# Api integration Routes
$routes->get("apiintegration", "Home::apiintegration");
$routes->get("book_api_integration", "Books::apiintegration");
$routes->get("customer_api_integration", "Customer::apiintegration");
/*
* --------------------------------------------------------------------
* Additional Routing

View File

@ -181,24 +181,26 @@ class Authentication extends BaseController
## Save Resetted password. and Redirect to login
public function auth_reset_password_save()
{
$auth_model = new AuthenticationModel();
$rules = [
'password1' => 'required',
'password2' => 'required',
];
if ($this->validate($rules)) {
// echo "try";die;
$email = $this->request->getVar('email');
$password = $this->request->getVar('password1');
$confirmation = $this->request->getVar('password2');
$hash_password = password_hash($password, PASSWORD_DEFAULT);
try {
// try {
// code for password confirmation
if ($password === $confirmation) {
$auth_model = new AuthenticationModel();
$user_details = $auth_model->where(['email' => $email, 'isactive' => 1])->first();
if ($user_details) {
$update_user_details = ['email' => $email, 'password' => $hash_password];
$auth_model->update($update_user_details['user_id'], $update_user_details);
$auth_model->update($user_details['user_id'], $update_user_details);
}
// Retrieve flashed session data
$successMessage = session()->getFlashdata('success');
@ -214,12 +216,12 @@ class Authentication extends BaseController
$this->logger->error('Password confirmation failed');
return redirect()->back()->withInput()->with('error', 'Password confirmation failed');
}
} catch (\Exception $e) {
$error = "Exception Errno returned" . $e->getCode() . " <br/>";
$error_msg = $e->getMessage();
$this->logger->error($error . '(' . $error_msg . ')');
return redirect()->back()->withInput()->with('error', $error . '(' . $error_msg . ')');
}
// } catch (\Exception $e) {
// $error = "Exception Errno returned" . $e->getCode() . " <br/>";
// $error_msg = $e->getMessage();
// $this->logger->error($error . '(' . $error_msg . ')');
// return redirect()->back()->withInput()->with('error', $error . '(' . $error_msg . ')');
// }
} else {
// Validation failed, display errors
$this->logger->error('Password And Confirmation Password are Required.');
@ -248,35 +250,51 @@ class Authentication extends BaseController
$this->response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
$this->response->setHeader('Pragma', 'no-cache');
$this->response->setHeader('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');
return redirect()->to('/login'); //
$data = [];
return view('auth_logout', $data);
}
## Lock Screen - holded
public function lockscreen()
{
// Load the session library
$session = \Config\Services::session();
helper('session');
$session_uid = get_logged_user_id();
$session_uname = get_logged_name();
$auth_model = new AuthenticationModel();
$details = $auth_model->getheringDetailsForHeader($session_uid);
$data['loggedin_person'] = $session_uname;
$data['loggedin_person_role'] = $details[0]['role'];
$data['favicon'] = $details[0]['favicon'];
$data['profile_picture'] = $details[0]['profile_picture'];
$successMessage = session()->getFlashdata('success');
$validationErrors = session()->getFlashdata('error');
// Load and display the form view with the above data
// Here, we'll use the default View class for demonstration purposes
// Check if the session is locked
if ($session->get('session_locked')) {
if (get_session_locked()) {
$data['successMessage'] = $successMessage;
$data['validationErrors'] = $validationErrors;
// Load the lock screen view
return view('lock_screen');
return view('auth_lock_screen', $data);
} else {
// Redirect the user to their previous page or dashboard
return redirect()->to('dashboard'); // Replace with appropriate URL
}
}
## Lock Screen - holded
## Lock Screen
public function lock()
{
// Load the session library
$session = \Config\Services::session();
helper('session');
// Set the session_locked flag
$session->set('session_locked', true);
set_session_locked(true);
// Redirect the user to the lock screen
return redirect()->to('lockscreen'); // Replace with your lock screen URL
}
@ -285,26 +303,31 @@ class Authentication extends BaseController
public function unlock()
{
// Load the session library
$session = \Config\Services::session();
helper('session');
// Check password logic
$password = $this->request->getPost('password');
$password = $this->request->getVar('password');
if ($this->checkPassword($password)) {
// Unlock the session
$session->remove('session_locked');
remove_session_locked();
return redirect()->to('dashboard'); // Redirect to dashboard
} else {
// Incorrect password, show error
return redirect()->back()->with('error', 'Incorrect password.');
return redirect()->back()->withInput()->with('error', 'Incorrect password.');
}
}
## Unlock Screen - Replace with your password checking logic - holded
## Unlock Screen
private function checkPassword($password)
{
// Implement your password validation logic here
// For example, compare against a stored hash
return $password === 'correct_password';
// return $password === 'correct_password';
helper('session');
$session_uid = get_logged_user_id();
$auth_model = new AuthenticationModel();
$user = $auth_model->where('user_id', $session_uid)->first();
$pwd_verify = password_verify((string)$password, $user['password']);
return $pwd_verify ;
}
}

View File

@ -72,6 +72,7 @@ abstract class BaseController extends Controller
$data['company_name'] = $details[0]['site_name'];
$data['company_short_name'] = $details[0]['site_title'];
$data['loggedin_person'] = $session_uname;
$data['loggedin_person_id'] = $session_uid;
$data['loggedin_person_role'] = $details[0]['role'];
$data['favicon'] = $details[0]['favicon'];
$data['profile_picture'] = $details[0]['profile_picture'];

View File

@ -148,4 +148,78 @@ class Books extends BaseController
$BooksModel->update($id, $data);
return redirect()->route('book_list');
}
## ApiIntegration For Book.
public function apiintegration() {
helper('apiIntegration');
helper('session');
$session_role = get_user_role();
$session_uid = get_logged_user_id();
$response = perform_http_request('GET', VB_BOOKS);
$message = "";
if(count($response['response'])>0){
//$message = "Reponse Count : ".count($response['response'])." <br/>";
echo "Note : This For CrossCheck Purpose 1ly <br/>";
echo "Total Book API Reponse Count : " . count($response['response']) . " <br/>";
$BooksModel = new BooksModel();
foreach($response['response'] as $row){
if($row->status == "publish"){
$publisher = '';
$language = '';
$attributes = $row->attributes;
if(count($attributes)>0){
foreach ($attributes as $att){
if($att->name == "Publisher"){ $publisher = implode(", ",$att->options); }
if($att->name == "Book Author"){ $publisher .= implode(", ",$att->options)."(Book Author)"; }
if($att->name == "Book Language"){ $language = implode(", ",$att->options); }
}
}
// echo $row->permalink ;
$insertion_data['title'] = $row->name ;
$insertion_data['publication_date'] = $row->date_created;
$insertion_data['publisher'] = $publisher;
$insertion_data['genre'] = $row->description;
$insertion_data['language'] = $language;
$insertion_data['description'] = $row->short_description;
$insertion_data['page_count']='';
$insertion_data['price'] = $row->sale_price != '' ? $row->sale_price : $row->regular_price;
$insertion_data['created_by'] = $session_uid;
$insertion_data['isactive'] = 1;
$insertion_data['business_id'] = 1;
$images = $row->images;
$i = 0;
$BooksModel->insert($insertion_data);
$lastInsertId = $BooksModel->insertID();
$insertion_img_data = [];
// $message .= "book ID : ".$lastInsertId." have Imgs".count($images)." <br/>";
echo "book ID : ".$lastInsertId." have Imgs".count($images)." <br/>";
if(count($images)>0){
foreach ($images as $img){
$insertion_img_data[$i]['img_name'] = $img->src;
$insertion_img_data[$i]['is_cover'] = 0;
$insertion_img_data[$i]['type'] = 2;
$insertion_img_data[$i]['book_id'] = $lastInsertId;
$insertion_img_data[$i]['created_by'] = $session_uid;
$insertion_img_data[$i]['isactive'] = 1;
$i++;
} // image loop closed
$BooksModel->insertImagesBatch($insertion_img_data);
//$message .= "book ID : ".$lastInsertId." Img. Batch Inserted Done <br/>";
echo "&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; Img Batch Inserted Done. ".$i. " <br/>";
}//image count closed
}//if cond. closed
}//reponse foreach closed
}//reponse count if closed
if(!empty($response['error'])){
echo $response['error'];
echo $response['error_msg'];
$message .= $response['error'].$response['error_msg'];
echo $response['error'].$response['error_msg'];
echo "Error :".$response['error'] . $response['error_msg'];
}else{
echo "Done";
}
$go_to_list_page = base_url()."book_list";
echo "<center><a href=".$go_to_list_page.">go to list page</a></center>";
}
}

View File

@ -11,12 +11,14 @@ class Customer extends BaseController
public function index()
{
helper('session');
if (is_session_active()) {
if (is_session_active()) {
$session_role = get_user_role();
$session_bid = get_business_id();
if (!empty($session_role) && $session_role !== "sadmin") {
$where = ['isactive'=>1,'business_id'=>(int)$session_bid];
}else{ $where = ['isactive != '=>NULL];}
$where = ['isactive' => 1, 'business_id' => (int)$session_bid];
} else {
$where = ['isactive != ' => NULL];
}
$CustomerModel = new CustomerModel();
$data['page_name'] = 'Customer Listing';
@ -25,10 +27,9 @@ class Customer extends BaseController
// print_r($data); die();
$this->render_page('customer_list', $data);
}else{
} else {
return redirect()->to('login');
}
}
## To Load Customer Form (Add/Update)
@ -39,15 +40,17 @@ class Customer extends BaseController
if ($id === '0') {
$data['page_name'] = 'Add Customer';
$data['customer'] = [];
$data['customer_billing'] = [];
$data['customer_shipping'] = [];
} else if ($id !== '0') {
$data['page_name'] = 'Edit Customer';
$model = new CustomerModel();
$model->setTable('customers');
$edit_user_details = $model->where(['customer_id' => $id])->first();
$data['customer'] = $edit_user_details;
$data['customer_billing'] = $this->get_customer_address($id,1);
$data['customer_shipping'] = $this->get_customer_address($id,2);
}
$data['session_bid'] = $session_bid;
$this->render_page('customer_form', $data);
}
@ -58,7 +61,7 @@ class Customer extends BaseController
helper('session');
$session_bid = get_business_id();
$session_uid = get_logged_user_id();
$model = new CustomerModel();
$model = new CustomerModel();
$data = [
'first_name' => $this->request->getPost('cfname'),
'last_name' => $this->request->getPost('csname'),
@ -75,27 +78,88 @@ class Customer extends BaseController
'profile_picture' => $this->request->getPost('cfile'),
'mode' => $this->request->getPost('cmode'),
'business_id' => $this->request->getPost('business_id')
];
$customer_id = $this->request->getPost('customer_id'); // Get the business ID for update
if (empty($customer_id)) {
// It's an insert operation
$data['isactive'] = 1;
$data['created_by'] = $session_uid;
//print_r($data);die;
$model->insert($data);
$FK_CID = $model->insertID(); // for Customer ADDRESS Table
} else {
// It's an update operation
$isactive = $this->request->getPost('isactivce');
$isactive = $this->request->getPost('isactive');
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
$data['updated_by'] = $session_uid;
$model->update($customer_id, $data);
// $model->update($customer_id, $data);
$FK_CID = $customer_id; // for Customer ADDRESS Table
}
$requestData = $this->request->getPost();
$this->save_customer_addresses($FK_CID,$requestData,'b');
$this->save_customer_addresses($FK_CID,$requestData,'s');
return redirect()->route('customer_list');
}
public function save_customer_addresses($id,$requestData,$letteringflag){
$addressType = ($letteringflag == 'b') ? 1 : 2;
$getAddressdetails = $this->get_customer_address($id,$addressType);
$CAid = $requestData[$letteringflag.'customer_address_id']; // Available Address IDS in Form Fields.
$model = new CustomerModel();
// Compare Address Input Field PKIDS With Existing PKIDS
// IF Any Missing value Means that values are Inactive here....
if(!empty($CAid)){
$filteringAddressIds = [];
for ($y = 0; $y < count($getAddressdetails); $y++) {
$filteringAddressIds[$y] = $getAddressdetails[$y]['customer_address_id'];
}
if(!empty($filteringAddressIds)){
$A = $filteringAddressIds;
$B = $CAid;
$missingValues = array_diff($A,$B);
if(!empty($missingValues)){
$where = ['isactive'=>1,'customer_id'=>(int)$id,'address_type'=>$addressType];
$model->inactiveMissingAddressDetails($where,$missingValues);
}
}
}
$session_uid = get_logged_user_id();
$baddress1 = $requestData[$letteringflag.'address1'];
$baddress2 = $requestData[$letteringflag.'address2'];
$bcountry = $requestData[$letteringflag.'country'];
$bcity = $requestData[$letteringflag.'city'];
$bstate = $requestData[$letteringflag.'state'];
$bzip = $requestData[$letteringflag.'zip'];
$count = count($CAid);
$address_array = [];
if($count > 0){
for ($x = 0; $x < $count; $x++) {
$address_array[$x]['first_name'] = $requestData['cfname'];
$address_array[$x]['last_name'] = $requestData['csname'];
// $address_array[$x]['company'] = "";
$address_array[$x]['email'] = $requestData['cmail'];
$address_array[$x]['mobile_no'] = $requestData['cmobile'];
$address_array[$x]['address_1'] = $baddress1[$x];
$address_array[$x]['address_2'] = $baddress2[$x];
$address_array[$x]['city'] = $bcity[$x];
$address_array[$x]['state'] = $bstate[$x];
$address_array[$x]['country'] = $bcountry[$x];
$address_array[$x]['postal_code'] = $bzip[$x];
$address_array[$x]['customer_id'] = $id;
$address_array[$x]['address_type'] = $addressType;
$address_array[$x]['created_by'] = $session_uid;
$address_array[$x]['updated_by'] = $CAid[$x] ? $session_uid : null;
$address_array[$x]['customer_address_id'] = $CAid[$x];
}
$statement = $model->saveAddressDetails($address_array);
}
return $statement;
}
## For delete the customer details (Which means inactive the details)
public function delete_customer($id)
{
@ -119,4 +183,111 @@ class Customer extends BaseController
// return redirect()->to(base_url('Business/index'))->with('success', 'Business deleted successfully.');
return redirect()->route('customer_list');
}
}
public function get_customer_address($id,$type){
$model = new CustomerModel();
$model->setTable('customer_addresses');
$where = ['isactive' => 1, 'customer_id' => (int)$id,'address_type'=>(int)$type];
$address_details = $model->where($where)->findAll();
return $address_details;
}
## ApiIntegration For Customer.
public function apiintegration()
{
helper('apiIntegration');
helper('session');
$session_bid = get_business_id();
$session_uid = get_logged_user_id();
$response = perform_http_request('GET', VB_CUSTOMERS);
$message = "";
if (count($response['response']) > 0) {
//$message = "Reponse Count : ".count($response['response'])." <br/>";
echo "Note : This For CrossCheck Purpose 1ly <br/>";
echo "Total Customer API Reponse Count : " . count($response['response']) . " <br/>";
$CustomerModel = new CustomerModel();
$x=0;
foreach ($response['response'] as $row) {
$insertion_data['first_name'] = $row->first_name;
$insertion_data['last_name'] = $row->last_name;
$insertion_data['type'] = $row->role;
$insertion_data['email'] = $row->email;
// $insertion_data['profile_picture'] = $row->avatar_url;
$insertion_data['mode'] = 'online';
$insertion_data['created_by'] = $session_uid;
$insertion_data['business_id'] = $session_bid;
$billing = $row->billing;
$shipping = $row->shipping;
$CustomerModel->insert($insertion_data);
$lastInsertId = $CustomerModel->insertID();
$insertion_baddress_data = [];$insertion_saddress_data = [];
$i = 0; $j = 0;
if(isset($billing) && gettype($billing) === 'object') {$billing = [$billing];}
if(isset($shipping) && gettype($shipping) === 'object') {$shipping = [$shipping];}
echo "Customer ID : ".$lastInsertId." have Billing address = ".count($billing)." and Shipping address = ".count($shipping)." <br/>";
if (count($billing) > 0) {
foreach ($billing as $bill) {
if ($bill->first_name !== '') {
$insertion_baddress_data[$i]['first_name'] = $bill->first_name;
$insertion_baddress_data[$i]['last_name'] = $bill->last_name;
$insertion_baddress_data[$i]['company'] = $bill->company;
$insertion_baddress_data[$i]['address_1'] = $bill->address_1;
$insertion_baddress_data[$i]['address_2'] = $bill->address_2;
$insertion_baddress_data[$i]['city'] = $bill->city;
$insertion_baddress_data[$i]['state'] = $bill->state;
$insertion_baddress_data[$i]['country'] = $bill->country;
$insertion_baddress_data[$i]['postal_code'] = $bill->postcode;
$insertion_baddress_data[$i]['customer_id'] = $lastInsertId;
$insertion_baddress_data[$i]['address_type'] = 1;
$insertion_baddress_data[$i]['created_by'] = $session_uid;
$insertion_baddress_data[$i]['email'] = isset($bill->email) ? $bill->email : '';
$insertion_baddress_data[$i]['mobile_no'] = isset($bill->phone) ? $bill->phone : '';
$i++;
echo "&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; Billing address has a value and Inserted ".$i." <br/>";
}else{
echo "&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; Keys are available but Billing address has no value; <br/>";
}
}
(!empty($insertion_baddress_data) ? $CustomerModel->insertAddressBatch($insertion_baddress_data) : "");
}
if (count($shipping) > 0) {
foreach ($shipping as $ship) {
if ($ship->first_name !== '') {
$insertion_saddress_data[$j]['first_name'] = $ship->first_name;
$insertion_saddress_data[$j]['last_name'] = $ship->last_name;
$insertion_saddress_data[$j]['company'] = $ship->company;
$insertion_saddress_data[$j]['address_1'] = $ship->address_1;
$insertion_saddress_data[$j]['address_2'] = $ship->address_2;
$insertion_saddress_data[$j]['city'] = $ship->city;
$insertion_saddress_data[$j]['state'] = $ship->state;
$insertion_saddress_data[$j]['country'] = $ship->country;
$insertion_saddress_data[$j]['postal_code'] = $ship->postcode;
$insertion_saddress_data[$j]['email'] = isset($ship->email)?$ship->email:"";
$insertion_saddress_data[$j]['mobile_no'] = isset($ship->phone)?$ship->phone:"";
$insertion_saddress_data[$j]['customer_id'] = $lastInsertId;
$insertion_saddress_data[$j]['address_type'] = 2;
$insertion_saddress_data[$j]['created_by'] = $session_uid;
$j++;
echo "&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; Shipping address has a value and Inserted ".$j." <br/>";
}
else{
echo "&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; Keys are available but Shipping address has no value <br/>";
}
}
(!empty($insertion_saddress_data) ? $CustomerModel->insertAddressBatch($insertion_saddress_data) : "");
}
} //reponse foreach closed
} //reponse count if closed
if (!empty($response['error'])) {
echo $response['error'];
echo $response['error_msg'];
$message .= $response['error'] . $response['error_msg'];
echo "Error :".$response['error'] . $response['error_msg'];
}else{
echo "Done";
}
$go_to_list_page = base_url()."customer_list";
echo "<center><a href=".$go_to_list_page.">go to list page</a></center>";
// return $message;
}
}

View File

@ -1,86 +1,28 @@
<?php
namespace App\Controllers;
use App\Models\BooksModel;
use App\Models\HomeModel;
## Home Controllers only for Dashboards,Report Modules
class Home extends BaseController
{
public function index()
{
$data['page_name'] = 'Dashboard';
helper('session');
$session_role = get_user_role();
$session_bid = get_business_id();
$data['page_name'] = 'Dashboard';
if (!empty($session_role) && $session_role !== "sadmin") {
$where = ['isactive' => 1, 'business_id' => (int)$session_bid];
} else if (!empty($session_role) && $session_role !== "admin") {
$where = ['isactive != ' => NULL];
} else {
$where = [];
}
$model = new HomeModel();
$data['customer'] = $model->customers($where);
$data['customer']['label'] = "Customer";
$this->render_page('dashboard', $data);
}
## ApiIntegration.
public function apiintegration() {
helper('apiIntegration');
helper('session');
$session_role = get_user_role();
$session_uid = get_logged_user_id();
$response = perform_http_request('GET', VPB_BOOK);
$message = "";
if(count($response['response'])>0){
//$message = "Reponse Count : ".count($response['response'])." <br/>";
echo "Reponse Count : ".count($response['response'])." <br/>";
$BooksModel = new BooksModel();
foreach($response['response'] as $row){
if($row->status == "publish"){
$publisher = '';
$language = '';
$attributes = $row->attributes;
if(count($attributes)>0){
foreach ($attributes as $att){
if($att->name == "Publisher"){ $publisher = implode(", ",$att->options); }
if($att->name == "Book Author"){ $publisher .= implode(", ",$att->options)."(Book Author)"; }
if($att->name == "Book Language"){ $language = implode(", ",$att->options); }
}
}
// echo $row->permalink ;
$insertion_data['title'] = $row->name ;
$insertion_data['publication_date'] = $row->date_created;
$insertion_data['publisher'] = $publisher;
$insertion_data['genre'] = $row->description;
$insertion_data['language'] = $language;
$insertion_data['description'] = $row->short_description;
$insertion_data['page_count']='';
$insertion_data['price'] = $row->sale_price != '' ? $row->sale_price : $row->regular_price;
$insertion_data['created_by'] = $session_uid;
$insertion_data['isactive'] = 1;
$insertion_data['business_id'] = 1;
$images = $row->images;
$i = 0;
$BooksModel->insert($insertion_data);
$lastInsertId = $BooksModel->insertID();
$insertion_img_data = [];
// $message .= "book ID : ".$lastInsertId." have Imgs".count($images)." <br/>";
echo "book ID : ".$lastInsertId." have Imgs".count($images)." <br/>";
if(count($images)>0){
foreach ($images as $img){
$insertion_img_data[$i]['img_name'] = $img->src;
$insertion_img_data[$i]['is_cover'] = 0;
$insertion_img_data[$i]['type'] = 2;
$insertion_img_data[$i]['book_id'] = $lastInsertId;
$insertion_img_data[$i]['created_by'] = $session_uid;
$insertion_img_data[$i]['isactive'] = 1;
$i++;
} // image loop closed
$BooksModel->insertImagesBatch($insertion_img_data);
//$message .= "book ID : ".$lastInsertId." Img. Batch Inserted Done <br/>";
echo "book ID : ".$lastInsertId." Img. Batch Inserted Done <br/>";
}//image count closed
}//if cond. closed
}//reponse foreach closed
}//reponse count if closed
if(!empty($response['error'])){
echo $response['error'];
echo $response['error_msg'];
$message .= $response['error'].$response['error_msg'];
echo $response['error'].$response['error_msg'];
}
//return $message;
echo "Done";
}
}

View File

@ -91,4 +91,28 @@ if (!function_exists('is_session_destroy')) {
}
}
if (!function_exists('set_session_locked')) {
function set_session_locked()
{
$session = \Config\Services::session();
$session->set('session_locked', true);
}
}
if (!function_exists('get_session_locked')) {
function get_session_locked()
{
$session = \Config\Services::session();
return $session->get('session_locked');
}
}
if (!function_exists('remove_session_locked')) {
function remove_session_locked()
{
$session = \Config\Services::session();
$session->remove('session_locked');
}
}
?>

View File

@ -9,7 +9,7 @@ class CustomerModel extends Model
{
protected $table = 'customers';
protected $primaryKey = 'customer_id ';
protected $allowedFields = ['customer_id ','first_name','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','type','isactive','business_id'];
protected $allowedFields = ['customer_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','type','isactive','business_id'];
public function insertCustomer($data)
{
@ -21,6 +21,7 @@ class CustomerModel extends Model
$this->builder()->where('business_id ', $business_id); // Filter by business_id
$query = $this->builder()->get(); // Use findAll() instead of get()
return ($query->getResult());
}
// $customerNames = [];
@ -30,7 +31,7 @@ class CustomerModel extends Model
// print_r($customerNames);
// die();
}
// public function getCustomerIdByName($customerName, $businessId)
// {
@ -49,4 +50,45 @@ class CustomerModel extends Model
// }
}
public function insertAddress($addressData) {
$this->db->table('customer_addresses')->insert($addressData);
return $this->db->insertID(); // Return the last inserted ID
}
public function insertAddressBatch($addressesDataArray) {
$this->db->table('customer_addresses')->insertBatch($addressesDataArray);
return $this->db->insertID(); // Note: insertID() might not be applicable for batch inserts
}
public function saveAddressDetails($data){
$i = 0;
$statement = [];
foreach ($data as $row) {
$id = $row['customer_address_id'];
if($id != ''){
unset($row['customer_address_id']); // Remove the id from the data to avoid updating it
unset($row['created_by']); // bcoz here data Updating here.
$this->db->table('customer_addresses')->where('customer_address_id', $id)->update($row);// Update the row with the specified id
$affectedRows = $this->db->affectedRows();
$statement[$i] = "address - ".$id." ".$affectedRows ? " Updated":" Not Updated";
}else{
$this->db->table('customer_addresses')->insert($row);
$insertID = $this->db->insertID();
$statement[$i] = "address - ".$insertID." Inserted";
}
}
return $statement;
}
public function inactiveMissingAddressDetails($where,$missingValues){
$dataToUpdate = ['isactive' => 0];
$this->db->table('customer_addresses')->where($where)->whereIn('customer_address_id',$missingValues)->update($dataToUpdate);
}
}
?>

27
app/Models/HomeModel.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class HomeModel extends Model
{
public function customers($where) {
$query = $this->db->table('customers');
$totalCustomers = $query->where($where)->countAll();
$activeCustomers = $query->where($where)->countAllResults();
$where['DATE(created_on)'] = date('Y-m-d');
$todayCustomers = $query->where($where)->countAllResults();
if ($totalCustomers > 0) {
$customer['percentage'] = ($activeCustomers / $totalCustomers) * 100;
} else {
$customer['percentage'] = 0;
}
$customer['total'] = $totalCustomers;
$customer['active'] = $activeCustomers;
$customer['today'] = $todayCustomers;
return $customer;
}
}

View File

@ -33,21 +33,23 @@
<div class="card-body p-4">
<!-- <div class="text-center w-75 m-auto">
<div class="text-center w-75 m-auto">
<div class="auth-logo">
<a href="index.html" class="logo logo-dark text-center">
<a href="javascript:void(0);" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="22">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="55">
</span>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
<a href="index.html" class="logo logo-light text-center">
<a href="javascript:void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="22">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="55">
</span>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
</div>
</div> -->
</div>
<div class="mt-3 text-center">
<svg version="1.1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 98 98" style="height: 120px;" xml:space="preserve">

View File

@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Lock Screen </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
<meta content="Coderthemes" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="<?= base_url() . "public/assets/images/company/default.ico" ?>">
<!-- App css -->
<link href="<?= base_url() . "public/assets/css/bootstrap.min.css" ?>" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="<?= base_url() . "public/assets/css/app.min.css" ?>" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<link href="<?= base_url() . "public/assets/css/bootstrap-dark.min.css" ?>" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="<?= base_url() . "public/assets/css/app-dark.min.css" ?>" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<!-- icons -->
<link href="<?= base_url() . "public/assets/css/icons.min.css" ?>" rel="stylesheet" type="text/css" />
</head>
<body class="loading">
<div class="account-pages mt-5 mb-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5">
<div class="card">
<div class="card-body p-4">
<div class="text-center mb-4">
<div class="auth-logo">
<a href="javascript:void(0);" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="55">
</span>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
<a href="javascript:void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="55">
</span>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
</div>
</div>
<div class="text-center w-75 m-auto">
<img src="<?= base_url()."public/assets/images/users/".$profile_picture; ?>" alt="user-image" class="rounded-circle avatar-lg img-thumbnail">
<h4 class="text-dark-50 text-center mt-3"><?= 'Hi ! '.$loggedin_person; ?></h4>
<p class="text-muted mb-4">Enter your password to access the <?= $loggedin_person_role; ?></p>
</div>
<form action="<?= base_url() . "unlock" ?>" method="post">
<div class="form-group mb-3">
<label for="password">Password</label>
<input class="form-control" type="password" required="" id="password" name="password" placeholder="Enter your password">
</div>
<?php if (isset($validationErrors)) : ?>
<span class="widget-simple text-center">
<div class="media-body align-self-center font-24 avatar-title">
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
</div>
</span>
<?php endif; ?>
<div class="form-group mb-0 text-center">
<button class="btn btn-primary btn-block" type="submit"> Log In </button>
</div>
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<div class="row mt-3">
<div class="col-12 text-center">
<p class="text-muted">Not you? return <a href="<?= base_url(); ?>" class="text-primary font-weight-medium ml-1">Sign In</a></p>
</div> <!-- end col -->
</div>
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<footer class="footer footer-alt">
<p> <?= date('Y') ?> &copy; <?= "bigbamboobookpublish"; ?>.</p>
</footer>
<!-- Vendor js -->
<script src="<?= base_url() . "public/assets/js/vendor.min.js" ?>" ></script>
<!-- App js -->
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>" ></script>
</body>
</html>

View File

@ -38,15 +38,17 @@
<span class="logo-lg">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="80">
</span>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
<a href="javascript: void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="80">
</span>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
</div>
<p class="text-muted mb-4 mt-3"><span>BigBambooBookPublish</br></br></span>Enter your email address and password to access admin panel.</p>
<p class="text-muted mb-4 mt-3">Enter your email address and password to access admin panel.</p>
</div>
<!-- <form action=""> -->
<form action="<?= base_url() . "authenticate" ?>" method="post">

View File

@ -2,23 +2,23 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Logout | Minton - Responsive Admin Dashboard Template</title>
<title>Logout </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
<meta content="Coderthemes" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link rel="shortcut icon" href="<?= base_url() . "public/assets/images/company/default.ico" ?>">
<!-- App css -->
<link href="../assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="../assets/css/app.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<link href="<?= base_url() . "public/assets/css/bootstrap.min.css"?>" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="<?= base_url() . "public/assets/css/app.min.css"?>" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<link href="../assets/css/bootstrap-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="../assets/css/app-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<link href="<?= base_url() . "public/assets/css/bootstrap-dark.min.css"?>" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="<?= base_url() . "public/assets/css/app-dark.min.css"?>" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<!-- icons -->
<link href="../assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<link href="<?= base_url() . "public/assets/css/icons.min.css"?>" rel="stylesheet" type="text/css" />
</head>
@ -34,16 +34,18 @@
<div class="text-center w-75 m-auto">
<div class="auth-logo">
<a href="index.html" class="logo logo-dark text-center">
<a href="javascript:void(0);" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="../assets/images/logo-dark.png" alt="" height="22">
</span>
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="55">
</span><br/>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
<a href="index.html" class="logo logo-light text-center">
<a href="javascript:void(0);" class="logo logo-light text-center">
<span class="logo-lg">
<img src="../assets/images/logo-light.png" alt="" height="22">
</span>
<img src="<?= base_url() . "public/assets/images/company/default.png" ?>" alt="" height="55">
</span><br/>
<p class="text-muted"><span>BigBambooBookPublish</p>
</a>
</div>
</div>
@ -78,7 +80,7 @@
<div class="row mt-3">
<div class="col-12 text-center">
<p class="text-muted">Back to <a href="authenticate" class="text-primary font-weight-medium ml-1">Sign In</a></p>
<p class="text-muted">Back to <a href="<?= base_url(); ?>" class="text-primary font-weight-medium ml-1">Sign In</a></p>
</div> <!-- end col -->
</div>
<!-- end row -->
@ -92,14 +94,14 @@
<!-- end page -->
<footer class="footer footer-alt">
<script>document.write(new Date().getFullYear())</script> &copy; Minton theme by <a href="" class="text-dark">Coderthemes</a>
<p> <?= date('Y') ?> &copy; <?= "bigbamboobookpublish"; ?>.</p>
</footer>
<!-- Vendor js -->
<script src="../assets/js/vendor.min.js"></script>
<script src="<?= base_url() . "public/assets/js/vendor.min.js" ?>"></script>
<!-- App js -->
<script src="../assets/js/app.min.js"></script>
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>"></script>
</body>
</html>

View File

@ -37,7 +37,7 @@
<p class="text-muted mb-4 mt-3">Enter your email address and we'll send you an email with instructions to reset your password.</p>
</div>
<form action="<?= base_url() . "auth_reset_password_save" ?>" method="post" role="form" class="parsley-examples">
<form action="<?= base_url()."auth_reset_password_save"?>" method="post" role="form" class="parsley-examples">
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="emailaddress">Email : </label>
<div class="col-sm-10">

View File

@ -4,7 +4,7 @@
<div class="card-body">
<div class="float-right">
<a href="<?= base_url() . "book_page/0"; ?>" class="btn btn-primary waves-effect"> <span> <i class="mdi mdi-book-plus"></i></span> Add New </a>
<a href="<?= base_url()."apiintegration"; ?>" class="btn btn-success waves-effect"> <span> <i class="mdi mdi-gesture-swipe-down"></i></span> Api integration </a>
<a href="<?= base_url()."book_api_integration"; ?>" class="btn btn-success waves-effect"> <span> <i class="mdi mdi-gesture-swipe-down"></i></span> Api integration </a>
</div>
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>

View File

@ -7,85 +7,74 @@
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?php echo base_url(); ?>insert_customer">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="cfname" class="col-form-label">First Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="cfname" name="cfname" value="<?= isset($customer['first_name']) ? $customer['first_name'] : '' ?>" placeholder="First Name" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="csname" class="col-form-label">Last Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="csname" value="<?= isset($customer['last_name']) ? $customer['last_name'] : '' ?>" placeholder="Last Name" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="cmail" class="col-form-label">Email<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="cmail" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="cmobile" class="col-form-label">Mobile<span class="text-danger">*</span></label>
<input type="number" class="form-control" name="cmobile" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="cmobile" class="col-form-label">Mobile<span class="text-danger">*</span></label>
<div class="input-group mb-2">
<div class="input-group-prepend">
<div class="input-group-text">+91</div>
</div>
<input type="text" class="form-control" name="cmobile" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required pattern="\d*" maxlength="10" />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-group col-md-4">
<label for="dob" class="col-form-label">Date Of Birth<span class="text-danger">*</span></label>
<input type="date" class="form-control" name="dob" value="<?= isset($customer['date_of_birth']) ? $customer['date_of_birth'] : '' ?>" placeholder="Date Of Birth" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="gen" class="col-form-label">Gender<span class="text-danger">*</span></label>
<input type="rad" class="form-control" name="gen" value="<?= isset($customer['gender']) ? $customer['gender'] : '' ?>" placeholder="Gender" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<div class="form-group col-md-12">
<label for="caddress" class="col-form-label">Address<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="address" value="<?= isset($customer['address']) ? $customer['address'] : '' ?>" placeholder="Address (eg : 1234 Main St)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="ccountry" class="col-form-label">Country<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="ccountry" value="<?= isset($customer['country']) ? $customer['country'] : '' ?>" placeholder="Country" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<div class="form-group col-md-3">
<label for="ccity" class="col-form-label">City<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="ccity" value="<?= isset($customer['city']) ? $customer['city'] : '' ?>" placeholder="City" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-3">
<label for="cstate" class="col-form-label">State<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="cstate" value="<?= isset($customer['state']) ? $customer['state'] : '' ?>" placeholder="State" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<div class="form-group col-md-3">
<label for="czip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="czip" value="<?= isset($customer['postal_code']) ? $customer['postal_code'] : '' ?>" placeholder="Postal Code (PIN)" required />
<input type="text" class="form-control" name="czip" value="<?= isset($customer['postal_code']) ? $customer['postal_code'] : '' ?>" placeholder="Postal Code (PIN)" required pattern="\d*" maxlength="10" />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="ctype" class="col-form-label">Type<span class="text-danger">*</span></label>
<input type="text" class="form-control" name="ctype" value="<?= isset($customer['type']) ? $customer['type'] : '' ?>" placeholder="Customer/Subscriebr" required />
@ -97,8 +86,141 @@
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<input type="hidden" id="customer_id" name="customer_id" placeholder="hidden for book id" value="<?= isset($customer['customer_id']) ? $customer['customer_id'] : '' ?>" />
<input type="hidden" id="customer_id" name="customer_id" placeholder="hidden for customer id" value="<?= isset($customer['customer_id']) ? $customer['customer_id'] : '' ?>" />
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<br />
<h5> Billing Address </h5>
<div class="after-add-more">
<hr />
<div class="form-group">
<!-- <div class="form-row">
<div class="form-group col-md-6">
<label for="bfname" class="col-form-label">First Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="bfname" name="bfname[]" value="<?= isset($customer['first_name']) ? $customer['first_name'] : '' ?>" placeholder="First Name" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="blname" class="col-form-label">Last Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="blname" name="blname[]" value="<?= isset($customer['last_name']) ? $customer['last_name'] : '' ?>" placeholder="Last Name" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div> -->
<!-- <div class="form-row">
<div class="form-group col-md-4">
<label for="bcname" class="col-form-label">Company<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="bcname" name="bcname[]" value="<?= isset($customer['Company']) ? $customer['Company'] : '' ?>" placeholder="Company" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<label for="bemail" class="col-form-label">Email<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="bemail" name="bemail[]" value="<?= isset($customer['email']) ? $customer['email'] : '' ?>" placeholder="Email" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-4">
<label for="bmobile" class="col-form-label">Mobile<span class="text-danger">*</span></label>
<input type="number" class="form-control" id="bmobile" name="bmobile[]" value="<?= isset($customer['mobile_no']) ? $customer['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div> -->
<div class="form-row">
<div class="form-group col-md-6">
<label for="baddress1" class="col-form-label">Address 1<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="baddress1" name="baddress1[]" placeholder="Address (eg : 1234 Main St)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="baddress2" class="col-form-label">Address 2<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="baddress2" name="baddress2[]" placeholder="Address (eg : 1234 Main St)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="bcountry" class="col-form-label">Country<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="bcountry" name="bcountry[]" placeholder="Country" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-3">
<label for="bcity" class="col-form-label">City<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="bcity" name="bcity[]" placeholder="City" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-3">
<label for="cstate" class="col-form-label">State<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="bstate" name="bstate[]" placeholder="State" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-3">
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="bzip" name="bzip[]" placeholder="Postal Code" required pattern="\d*" maxlength="10" />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<input type="hidden" id="bcustomer_address_id" name="bcustomer_address_id[]" placeholder="hidden for billing customer address id" />
</div>
<div class="form-group col-md-9 change text-right m-b-0"></div>
</div>
</div>
</div>
<div class="form-group text-right m-b-0">
<a class="btn btn-success add-more">+ Add More Billing Address </a>
</div>
<br />
<h5> Shipping Address </h5>
<div class="after-add-smore">
<hr />
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<label for="saddress1" class="col-form-label">Address 1<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="saddress1" name="saddress1[]" placeholder="Address (eg : 1234 Main St)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-6">
<label for="saddress2" class="col-form-label">Address 2<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="saddress2" name="saddress2[]" placeholder="Address (eg : 1234 Main St)" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="scountry" class="col-form-label">Country<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="scountry" name="scountry[]" placeholder="Country" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-3">
<label for="scity" class="col-form-label">City<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="scity" name="scity[]" placeholder="City" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-3">
<label for="sstate" class="col-form-label">State<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="sstate" name="sstate[]" placeholder="State" required />
<div class="invalid-feedback"> Please provide. </div>
</div>
<div class="form-group col-md-3">
<label for="szip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="szip" name="szip[]" placeholder="Postal Code" required pattern="\d*" maxlength="10" />
<div class="invalid-feedback"> Please provide. </div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<input type="hidden" id="scustomer_address_id" name="scustomer_address_id[]" placeholder="hidden for shipping customer address id" />
</div>
<div class="form-group col-md-9 schange text-right m-b-0"></div>
</div>
</div>
</div>
<div class="form-group text-right m-b-0">
<a class="btn btn-success add-smore">+ Add More Shipping Address </a>
</div>
<?php if (!empty($customer)) { ?>
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
<input type="checkbox" id="isactive" name="isactive" class="form-control" <?= isset($customer) && $customer['isactive'] == 1 ? 'checked' : '' ?>>
@ -115,9 +237,80 @@
</button>
<a href="<?= base_url() . "customer_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
</div>
</div>
</form>
</div> <!-- end card-body-->
</div> <!-- end card-->
</div> <!-- end col-->
</div>
</div>
<script>
$(document).ready(function() {
var barray = <?php echo json_encode($customer_billing); ?>;
if (barray.length > 0) {
for (var i = 0; i < barray.length; i++) {
if (i == 0) {
var html = $(".after-add-more").first();
} else {
var html = $(".after-add-more").first().clone();
}
html.find('input#bcustomer_address_id').val(barray[i]['customer_address_id']);
html.find('input#baddress1').val(barray[i]['address_1']);
html.find('input#baddress2').val(barray[i]['address_2']);
html.find('input#bcity').val(barray[i]['city']);
html.find('input#bstate').val(barray[i]['state']);
html.find('input#bcountry').val(barray[i]['country']);
html.find('input#bzip').val(barray[i]['postal_code']);
if (i !== 0) {
html.find(".change").html("<label for=''>&nbsp;</label><br/><a class='btn btn-danger remove'>- Remove</a>");
html.insertAfter(".after-add-more:last");
}
}
}
$("body").on("click", ".add-more", function() {
var html = $(".after-add-more").first().clone();
html.find('input').val(''); // Clear input values in the cloned element
html.find(".change").html("<label for=''>&nbsp;</label><br/><a class='btn btn-danger remove'>- Remove</a>");
html.insertAfter(".after-add-more:last");
});
$("body").on("click", ".remove", function() {
$(this).parents(".after-add-more").remove();
});
/*****************************************************************************************/
var sarray = <?php echo json_encode($customer_shipping); ?>;
if (sarray.length > 0) {
for (var i = 0; i < sarray.length; i++) {
if (i == 0) {
var html = $(".after-add-smore").first();
} else {
var html = $(".after-add-smore").first().clone();
}
html.find('input#scustomer_address_id').val(sarray[i]['customer_address_id']);
html.find('input#saddress1').val(sarray[i]['address_1']);
html.find('input#saddress2').val(sarray[i]['address_2']);
html.find('input#scity').val(sarray[i]['city']);
html.find('input#sstate').val(sarray[i]['state']);
html.find('input#scountry').val(sarray[i]['country']);
html.find('input#szip').val(sarray[i]['postal_code']);
if (i !== 0) {
html.find(".schange").html("<label for=''>&nbsp;</label><br/><a class='btn btn-danger sremove'>- Remove</a>");
html.insertAfter(".after-add-smore:last");
}
}
}
$("body").on("click", ".add-smore", function() {
var html = $(".after-add-smore").first().clone();
html.find('input').val(''); // Clear input values in the cloned element
html.find(".schange").html("<label for=''>&nbsp;</label><br/><a class='btn btn-danger sremove'>- Remove</a>");
html.insertAfter(".after-add-smore:last");
});
$("body").on("click", ".sremove", function() {
$(this).parents(".after-add-smore").remove();
});
});
</script>

View File

@ -4,6 +4,7 @@
<div class="card-body">
<div class="float-right">
<a href="new_customer/0" class="btn btn-primary"><i class="ri-map-pin-user-fill"></i> Add New </a>
<a href="<?= base_url()."customer_api_integration"; ?>" class="btn btn-success waves-effect"> <span> <i class="mdi mdi-gesture-swipe-down"></i></span> Api integration </a>
</div><!-- end col-->
<br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4>

View File

@ -5,13 +5,25 @@
<div class="d-flex justify-content-between align-items-center">
<div class="knob-chart" dir="ltr">
<input data-plugin="knob" data-width="70" data-height="70" data-fgColor="#1abc9c"
data-bgColor="#d1f2eb" value="58"
data-bgColor="#d1f2eb" value="<?= $customer['percentage']; ?>"
data-skin="tron" data-angleOffset="0" data-readOnly=true
data-thickness=".15"/>
</div>
<!-- <div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['active']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'Available '.$customer['label']; ?></p>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['total']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'Total '.$customer['label']; ?></p>
</div>
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup">268</span> </h3>
<p class="text-muted mb-0">New Customers</p>
</div> -->
<div class="text-right">
<h3 class="mb-1 mt-0"> <span data-plugin="counterup"><?= $customer['today']; ?></span> </h3>
<p class="text-muted mb-0"><?= 'New '.$customer['label']; ?></p>
</div>
</div>
</div>

View File

@ -112,7 +112,7 @@
<ul id="side-menu">
<li>
<a href="dashboard">
<a href="<?= base_url()."dashboard"; ?>">
<i class="ri-dashboard-line"></i>
<!-- <span class="badge badge-success badge-pill float-right">3</span> -->
<span> Dashboard </span>

View File

@ -232,7 +232,7 @@
</div>
<!-- item-->
<a href="user_list" class="dropdown-item notify-item">
<a href="<?= base_url()."user_page/".$loggedin_person_id; ?>" class="dropdown-item notify-item">
<i class="ri-account-circle-line"></i>
<span>My Account</span>
</a>
@ -244,7 +244,7 @@
</a> -->
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item notify-item">
<a href="<?= base_url()."lock"; ?>" class="dropdown-item notify-item">
<i class="ri-lock-line"></i>
<span>Lock Screen</span>
</a>