customer dropdown : ps
This commit is contained in:
parent
55ea30325c
commit
767cef16a8
@ -111,11 +111,11 @@ $routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1');
|
||||
$routes->get('print_address/(:num)', 'Invoice::print_address/$1');
|
||||
|
||||
|
||||
|
||||
# Notifications Routes
|
||||
$routes->get('send_whatsapp_message/', 'Notifications::send_whatsapp_message');
|
||||
$routes->post('whatsapp_custom_notifications/', 'Notifications::whatsapp_custom_notifications');
|
||||
$routes->match(['post', 'get'], 'mail_custom_notifications', 'Notifications::mail_custom_notifications');
|
||||
$routes->get('customer_group_notifications/', 'Notifications::customer_group_notifications');
|
||||
|
||||
# Api integration Routes
|
||||
$routes->post('api/(:any)', 'ApiIntegration::api_integration/$1');
|
||||
|
||||
@ -361,7 +361,7 @@ class ApiIntegration extends ResourceController
|
||||
}
|
||||
$book_image_data[$i]['img_name'] =isset($img->name) && !empty($img->name) ? $img->name : NULL;
|
||||
$book_image_data[$i]['wp_img_url'] = isset($img->src) && !empty($img->src) ? $img->src : NULL;
|
||||
$book_image_data[$i]['is_cover'] = 0;
|
||||
$book_image_data[$i]['is_cover'] = empty($bookImgId) && $i == 0 ? 1 : 0 ;
|
||||
$book_image_data[$i]['type'] = 2;
|
||||
$book_image_data[$i]['book_id'] = $last_insert_book_id;
|
||||
$book_image_data[$i]['isactive'] = 1;
|
||||
@ -796,6 +796,7 @@ class ApiIntegration extends ResourceController
|
||||
$invoice_data['payment_status']=$records['status'];
|
||||
$invoice_data['order_number']=$records['order_key'];
|
||||
$invoice_data['payment_method']=$records['payment_method_title'];
|
||||
$invoice_data['status']='Approved';
|
||||
$invoice_data['event_id']=NULL;
|
||||
$invoice_data['business_id']=$this->global_variable_business_id;
|
||||
$invoice_data['shipping_address']=$shipping_addr;
|
||||
@ -1143,7 +1144,7 @@ class ApiIntegration extends ResourceController
|
||||
$this->logger->info("Api saveInvoiceAddressInCustomerAddress = ".json_encode($request_addr_array));
|
||||
$this->logger->info("Api saveInvoiceAddressInCustomerAddress Flag = ".$flag." Customer Id = ".$customer_id);
|
||||
$api_model = new ApiIntegrationModel();
|
||||
$where = ['customer_id' =>$customer_id,'address_type'=>$flag,
|
||||
$where = ['customer_id' =>$customer_id,'address_type'=>(int)$flag,
|
||||
'first_name'=>$request_addr_array[0]->first_name,'last_name'=>$request_addr_array[0]->last_name,
|
||||
'address_1'=>$request_addr_array[0]->address_1,'address_2'=>$request_addr_array[0]->address_2,
|
||||
'city'=>$request_addr_array[0]->city,'postal_code'=>$request_addr_array[0]->postcode];
|
||||
|
||||
@ -73,6 +73,8 @@ class Customer extends BaseController
|
||||
}
|
||||
|
||||
$data['session_bid'] = $session_bid;
|
||||
$data['country_details'] = $this->get_country_details();
|
||||
$data['state_details'] = $this->get_state_details();
|
||||
$this->render_page('customer_form', $data);
|
||||
}
|
||||
|
||||
@ -80,6 +82,8 @@ class Customer extends BaseController
|
||||
## For inserting/updating details of customer
|
||||
public function insert_customer()
|
||||
{
|
||||
$requestData = $this->request->getPost();
|
||||
print_r($requestData);die;
|
||||
$this->logger->info("Customer: Inserting/Updating Details");
|
||||
try {
|
||||
helper('session');
|
||||
@ -186,7 +190,8 @@ class Customer extends BaseController
|
||||
$baddress2 = $requestData[$letteringflag . 'address2'];
|
||||
$bcountry = $requestData[$letteringflag . 'country'];
|
||||
$bcity = $requestData[$letteringflag . 'city'];
|
||||
$bstate = $requestData[$letteringflag . 'state'];
|
||||
$binputstate = $requestData[$letteringflag . 'istate'];
|
||||
$bdropdownstate = $requestData[$letteringflag . 'dstate'];
|
||||
$bzip = $requestData[$letteringflag . 'zip'];
|
||||
$count = count($CAid);
|
||||
$address_array = [];
|
||||
@ -200,7 +205,7 @@ class Customer extends BaseController
|
||||
$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]['state'] = $bcountry[$x] === 'IN' ? $bdropdownstate[$x] : $binputstate[$x] ;
|
||||
$address_array[$x]['country'] = $bcountry[$x];
|
||||
$address_array[$x]['postal_code'] = $bzip[$x];
|
||||
$address_array[$x]['customer_id'] = $id;
|
||||
@ -269,4 +274,21 @@ class Customer extends BaseController
|
||||
$address_details = $model->where($where)->findAll();
|
||||
return $address_details;
|
||||
}
|
||||
|
||||
public function get_country_details()
|
||||
{
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('countries');
|
||||
$country_details = $model->orderBy('country_id', 'ASC')->findAll();
|
||||
return $country_details;
|
||||
}
|
||||
|
||||
public function get_state_details()
|
||||
{
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('states');
|
||||
$state_details = $model->orderBy('state_id', 'ASC')->findAll();
|
||||
return $state_details;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -134,4 +134,8 @@ class Notifications extends BaseController
|
||||
$this->logger->info("Notification : Duedate notification Whatsapp Response = " . json_encode($whatsapp_result));
|
||||
|
||||
}
|
||||
|
||||
public function customer_group_notifications(){
|
||||
echo "customer_group_notifications";die;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,126 +4,102 @@
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
|
||||
|
||||
<ul class="nav nav-tabs" id="customerTabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="customerDetails-tab" data-toggle="tab" href="#customerDetails"
|
||||
role="tab" aria-controls="customerDetails" aria-selected="true">Customer Details</a>
|
||||
</li>
|
||||
<?php if ($page_name === 'Edit Customer'): ?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="subscriptionDetails-tab" data-toggle="tab"
|
||||
href="#subscriptionDetails" role="tab" aria-controls="subscriptionDetails"
|
||||
aria-selected="false">Subscription Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="invoiceDetails-tab" data-toggle="tab" href="#invoiceDetails"
|
||||
role="tab" aria-controls="invoiceDetails" aria-selected="false">Invoice Details</a>
|
||||
<a class="nav-link" id="customerDetails-tab" data-toggle="tab" href="#customerDetails" role="tab" aria-controls="customerDetails" aria-selected="true">Customer Details</a>
|
||||
</li>
|
||||
<?php if ($page_name === 'Edit Customer') : ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="subscriptionDetails-tab" data-toggle="tab" href="#subscriptionDetails" role="tab" aria-controls="subscriptionDetails" aria-selected="false">Subscription Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="invoiceDetails-tab" data-toggle="tab" href="#invoiceDetails" role="tab" aria-controls="invoiceDetails" aria-selected="false">Invoice Details</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
<!-- <?php print_r($customer); ?> -->
|
||||
<!-- Customer Details Tab -->
|
||||
<div class="tab-pane fade show active" id="customerDetails" role="tabpanel" aria-labelledby="customerDetails-tab">
|
||||
<!-- Customer details form fields -->
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data"
|
||||
action="<?php echo base_url(); ?>insert_customer">
|
||||
<div class="form-group">
|
||||
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<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>
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?php echo base_url(); ?>insert_customer">
|
||||
<div class="form-group">
|
||||
|
||||
</div>
|
||||
<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 class="form-row">
|
||||
<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-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 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" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<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" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<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 class="form-row">
|
||||
<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>
|
||||
<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>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="dob" class="col-form-label">Date Of Birth</label>
|
||||
<input type="date" class="form-control" name="dob" value="<?= isset($customer['date_of_birth']) ? $customer['date_of_birth'] : '' ?>" placeholder="Date Of Birth" />
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="gen" class="col-form-label">Gender<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="gen" required>
|
||||
<option> Select the Gender</option>
|
||||
<option value="male" <?= isset($customer['gender']) && $customer['gender'] == 'male' ? 'selected' : '' ?>>Male</option>
|
||||
<option value="female" <?= isset($customer['gender']) && $customer['gender'] == 'female' ? 'selected' : '' ?>>Female</option>
|
||||
</select>
|
||||
<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</label>
|
||||
<input type="date" class="form-control" name="dob"
|
||||
value="<?= isset($customer['date_of_birth']) ? $customer['date_of_birth'] : '' ?>"
|
||||
placeholder="Date Of Birth" />
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="gen" class="col-form-label">Gender<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="gen" required>
|
||||
<option> Select the Gender</option>
|
||||
<option value="male" <?= isset($customer['gender']) && $customer['gender'] == 'male' ? 'selected' : '' ?>>Male</option>
|
||||
<option value="female" <?= isset($customer['gender']) && $customer['gender'] == 'female' ? 'selected' : '' ?>>Female</option>
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cmode" class="col-form-label">Mode<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="cmode" required>
|
||||
<option value="offline" <?= isset($customer['mode']) && $customer['mode'] == 'offline' ? 'selected' : '' ?>>Offline</option>
|
||||
<option value="online" <?= isset($customer['mode']) && $customer['mode'] == 'online' ? 'selected' : '' ?>>Online</option>
|
||||
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<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 />
|
||||
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 text-left">
|
||||
<h5> Billing Address </h5>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="cmode" class="col-form-label">Mode<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="cmode" required>
|
||||
<option value="offline" <?= isset($customer['mode']) && $customer['mode'] == 'offline' ? 'selected' : '' ?>>Offline</option>
|
||||
<option value="online" <?= isset($customer['mode']) && $customer['mode'] == 'online' ? 'selected' : '' ?>>Online</option>
|
||||
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<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 />
|
||||
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 text-left">
|
||||
<h5> Billing Address </h5>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="after-add-more">
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<!-- <div class="form-row">
|
||||
<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 />
|
||||
@ -135,7 +111,7 @@
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <div class="form-row">
|
||||
<!-- <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 />
|
||||
@ -153,164 +129,173 @@
|
||||
</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 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-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 class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="bcountry" class="col-form-label">Country<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="bcountry" name="bcountry[]" required>
|
||||
<option value="">Choose your Country</option>
|
||||
<?php foreach ($country_details as $value) { ?>
|
||||
<option value="<?php echo $value['country_short_name']; ?>">
|
||||
<?php echo $value['country_name']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<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">
|
||||
<div id="billinput" style="display: block">
|
||||
<label for="bistate" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="bistate" name="bistate[]" placeholder="State"/>
|
||||
</div>
|
||||
<div id="billdropdown" style="display: none">
|
||||
<label for="bdstate" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="bdstate" name="bdstate[]">
|
||||
<option value="">Choose your State</option>
|
||||
<?php foreach ($state_details as $value) { ?>
|
||||
<option value="<?php echo $value['state_short_name']; ?>">
|
||||
<?php echo $value['state_name']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <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>
|
||||
<input type="hidden" id="bcustomer_address_id" name="bcustomer_address_id[]" placeholder="hidden for billing customer address id" />
|
||||
</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>
|
||||
<input type="hidden" id="bcustomer_address_id" name="bcustomer_address_id[]"
|
||||
placeholder="hidden for billing customer address id" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 text-left">
|
||||
<h5> Shipping Address </h5>
|
||||
</div>
|
||||
<div class="col-md-6 text-right checkbox checkbox-purple">
|
||||
<input type="checkbox" id="copyToBillingCheckbox"/>
|
||||
<label for="copyToBillingCheckbox"> Is the above address same as the billing address?</label>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<br />
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 text-left">
|
||||
<h5> Shipping Address </h5>
|
||||
</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 class="col-md-6 text-right checkbox checkbox-purple">
|
||||
<input type="checkbox" id="AddressCopiedAsShipping" />
|
||||
<label for="AddressCopiedAsShipping"> Is the above address same as the shipping address?</label>
|
||||
</div>
|
||||
</div>
|
||||
<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-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 class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="scountry" class="col-form-label">Country<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="scountry0" name="scountry[]" onchange="changeFields(this)" required>
|
||||
<option value="">Choose your Country</option>
|
||||
<?php foreach ($country_details as $value) { ?>
|
||||
<option value="<?php echo $value['country_short_name']; ?>">
|
||||
<?php echo $value['country_name']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<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="" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="sistate0" name="sistate[]" placeholder="State" style="display: block" />
|
||||
<select class="form-control" id="sdstate0" name="sdstate[]" style="display: none">
|
||||
<option value="">Choose your State</option>
|
||||
<?php foreach ($state_details as $value) { ?>
|
||||
<option value="<?php echo $value['state_short_name']; ?>">
|
||||
<?php echo $value['state_name']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
<!-- <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>
|
||||
|
||||
<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">
|
||||
<!-- <a class="btn btn-success waves-effect waves-light mr-1 add-smore">+ Add More Shipping Address </a> -->
|
||||
<a class="btn btn-danger waves-effect waves-light mr-1 sremove">- Remove </a>
|
||||
<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">
|
||||
<!-- <a class="btn btn-success waves-effect waves-light mr-1 add-smore">+ Add More Shipping Address </a> -->
|
||||
<a class="btn btn-danger waves-effect waves-light mr-1 sremove">- Remove </a>
|
||||
</div>
|
||||
</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' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit">
|
||||
Submit
|
||||
</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">
|
||||
Reset
|
||||
</button>
|
||||
<a href="<?= base_url() . "customer_list"; ?>"
|
||||
class="btn btn-secondary waves-effect">Cancel</a>
|
||||
</div>
|
||||
<!-- Display Subscription Details -->
|
||||
<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' : '' ?>>
|
||||
<label for="isactive"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit">
|
||||
Submit
|
||||
</button>
|
||||
<button type="reset" class="btn btn-primary waves-effect mr-1">
|
||||
Reset
|
||||
</button>
|
||||
<a href="<?= base_url() . "customer_list"; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
</div>
|
||||
<!-- Display Subscription Details -->
|
||||
|
||||
|
||||
<!-- Add subscription details content here -->
|
||||
<!-- You can fetch and display subscription details here -->
|
||||
|
||||
|
||||
<!-- Add subscription details content here -->
|
||||
<!-- You can fetch and display subscription details here -->
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
|
||||
<div class="tab-pane fade show " id="subscriptionDetails" role="tabpanel" aria-labelledby="subscriptionDetails-tab">
|
||||
<?php if (!empty($subscriptionData)): ?>
|
||||
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
|
||||
<div class="tab-pane fade show " id="subscriptionDetails" role="tabpanel" aria-labelledby="subscriptionDetails-tab">
|
||||
<?php if (!empty($subscriptionData)) : ?>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -320,7 +305,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($subscriptionData as $subscription): ?>
|
||||
<?php foreach ($subscriptionData as $subscription) : ?>
|
||||
<tr>
|
||||
<td><?= $subscription->title ?></td>
|
||||
<td><?= $subscription->from_subscription ?></td>
|
||||
@ -333,8 +318,8 @@
|
||||
<p>No subscriptions found for this customer.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="invoiceDetails" role="tabpanel" aria-labelledby="invoiceDetails-tab">
|
||||
<?php if (!empty($invoices)): ?>
|
||||
<div class="tab-pane fade" id="invoiceDetails" role="tabpanel" aria-labelledby="invoiceDetails-tab">
|
||||
<?php if (!empty($invoices)) : ?>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -344,12 +329,12 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($invoices as $value): ?>
|
||||
<?php foreach ($invoices as $value) : ?>
|
||||
<tr>
|
||||
<td><?= $value->invoice_number ?></td>
|
||||
<td><?= $value->invoice_date ?></td>
|
||||
<td><?= $value->subtotal ?></td>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
@ -358,66 +343,80 @@
|
||||
<p>No subscriptions found for this customer.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("#copyToBillingCheckbox").on("change", function() {
|
||||
$("#AddressCopiedAsShipping").on("change", function() {
|
||||
if ($(this).is(":checked")) {
|
||||
var customerAddress1 = $("#baddress1").val();
|
||||
var customerAddress2 = $("#baddress2").val();
|
||||
var customerCountry = $("#bcountry").val();
|
||||
var customerState = $("#bstate").val();
|
||||
var customerDropdownState = $("#bdstate").val();
|
||||
var customerInputState = $("#bistate").val();
|
||||
var customerCity = $("#bcity").val();
|
||||
var customerPostalCode = $("#bzip").val();
|
||||
|
||||
$("#saddress1").val(customerAddress1).prop("readonly", false);
|
||||
$("#saddress2").val(customerAddress2).prop("readonly", false);
|
||||
$("#scountry").val(customerCountry).prop("readonly", false);
|
||||
$("#scountry0").val(customerCountry).prop("readonly", false);
|
||||
if(customerCountry == 'IN'){
|
||||
$("#sistate0").val(customerInputState).css("display", "none").prop("readonly", false);
|
||||
$("#sdstate0").val(customerDropdownState).css("display", "block").prop("readonly", false);
|
||||
}else{
|
||||
$("#sistate0").val(customerInputState).css("display", "block").prop("readonly", false);
|
||||
$("#sdstate0").val(customerDropdownState).css("display", "none").prop("readonly", false);
|
||||
}
|
||||
$("#scity").val(customerCity).prop("readonly", false);
|
||||
$("#sstate").val(customerState).prop("readonly", false);
|
||||
$("#szip").val(customerPostalCode).prop("readonly", false);
|
||||
} else {
|
||||
// Clear the billing address fields when the checkbox is unchecked
|
||||
$("#saddress1").val("").prop("readonly", false);
|
||||
$("#saddress2").val("").prop("readonly", false);
|
||||
$("#scountry").val("").prop("readonly", false);
|
||||
$("#scountry0").val("").prop("readonly", false);
|
||||
$("#scity").val("").prop("readonly", false);
|
||||
$("#sstate").val("").prop("readonly", false);
|
||||
$("#sistate0").val("").prop("readonly", false);
|
||||
$("#sdstate0").val("").prop("readonly", false);
|
||||
$("#szip").val("").prop("readonly", false);
|
||||
$("#scustomer_address_id").val("") // Hidden Field ressetted bcoz Adress history
|
||||
}
|
||||
});
|
||||
$("#bcountry").on("change", function() {
|
||||
var country = $("#bcountry").val();
|
||||
var dropdownField = $("#billdropdown");
|
||||
var textField = $("#billinput");
|
||||
if (country === 'IN') {
|
||||
dropdownField.show();
|
||||
textField.hide();
|
||||
} else {
|
||||
dropdownField.hide();
|
||||
textField.show();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var barray = <?php echo json_encode($customer_billing); ?>;
|
||||
var carray = <?php echo json_encode($customer); ?>;
|
||||
if (barray.length > 0) {
|
||||
for (var i = 0; i < barray.length; i++) {
|
||||
if((barray[i]['address_1'] == carray['address']) &&
|
||||
(barray[i]['city'] == carray['city']) &&
|
||||
(barray[i]['state'] == carray['state']) &&
|
||||
(barray[i]['country'] == carray['country']) &&
|
||||
(barray[i]['postal_code']== carray['postal_code'])){
|
||||
$("#copyToBillingCheckbox").prop("checked",true);
|
||||
$("#baddress1").val(barray[i]['address_1']).prop("readonly", true);
|
||||
$("#baddress2").val(barray[i]['address_2']).prop("readonly", true);
|
||||
$("#bcountry").val(barray[i]['country']).prop("readonly", true);
|
||||
$("#bcity").val(barray[i]['city']).prop("readonly", true);
|
||||
$("#bstate").val(barray[i]['state']).prop("readonly", true);
|
||||
$("#bzip").val(barray[i]['postal_code']).prop("readonly", true);
|
||||
}
|
||||
else{
|
||||
$("#baddress1").val(barray[i]['address_1']);
|
||||
$("#baddress2").val(barray[i]['address_2']);
|
||||
$("#bcountry").val(barray[i]['country']);
|
||||
$("#bcity").val(barray[i]['city']);
|
||||
$("#bstate").val(barray[i]['state']);
|
||||
if(barray[i]['country'] == 'IN'){
|
||||
$("#bdstate").val(barray[i]['state']);
|
||||
$("#billdropdown").show();
|
||||
$("#billinput").hide();
|
||||
} else {
|
||||
$("#bistate").val(barray[i]['state']);
|
||||
$("#billdropdown").hide();
|
||||
$("#billinput").show();
|
||||
|
||||
}
|
||||
$("#bzip").val(barray[i]['postal_code']);
|
||||
}
|
||||
$('#bcustomer_address_id').val(barray[i]['customer_address_id']);
|
||||
}
|
||||
}
|
||||
@ -426,6 +425,7 @@
|
||||
|
||||
var sarray = <?php echo json_encode($customer_shipping); ?>;
|
||||
if (sarray.length > 0) {
|
||||
j=0;
|
||||
for (var i = 0; i < sarray.length; i++) {
|
||||
if (i == 0) {
|
||||
var html = $(".after-add-smore").first();
|
||||
@ -436,23 +436,36 @@
|
||||
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('select#scountry0').val(sarray[i]['country']);
|
||||
html.find('select#scountry0').attr('id','scountry'+j);
|
||||
if(sarray[i]['country'] === 'IN'){
|
||||
// html.find('select#sdstate0').attr('id','sdstate'+$j).val(sarray[i]['state']);
|
||||
html.find('select#sdstate0').attr('id','sdstate'+j).css("display", "block").val(sarray[i]['state']);
|
||||
html.find('input#sistate0').attr('id','sistate'+j).css("display", "none").val('');
|
||||
}else{
|
||||
html.find('input#sistate0').attr('id','sistate'+j).css("display", "block").val(sarray[i]['state']);
|
||||
html.find('select#sdstate0').attr('id','sdstate'+j).css("display", "none").val('');
|
||||
}
|
||||
|
||||
html.find('input#szip').val(sarray[i]['postal_code']);
|
||||
if (i !== 0) {
|
||||
// html.find(".schange").html("<a class='btn btn-success waves-effect waves-light mr-1 add-smore'>+ Add More Shipping Address </a><a class='btn btn-danger waves-effect waves-light mr-1 sremove'>- Remove </a>");
|
||||
html.find(".schange").html("<a class='btn btn-danger waves-effect waves-light mr-1 sremove'>- Remove </a>");
|
||||
html.insertAfter(".after-add-smore:last");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
$(".sremove").hide();
|
||||
$(".add-smore").show();
|
||||
}
|
||||
|
||||
$("body").on("click", ".add-smore", function() {
|
||||
var html = $(".after-add-smore").first().clone();
|
||||
var count = $(".after-add-smore").length;
|
||||
html.find('select#scountry0').attr('id','scountry'+count).val('')
|
||||
html.find('select#sdstate0').attr('id','sdstate'+count).css("display", "none").val('');
|
||||
html.find('input#sistate0').attr('id','sistate'+count).css("display", "block").val('');
|
||||
html.find('input').val(''); // Clear input values in the cloned element
|
||||
// html.find(".schange").html("<a class='btn btn-success waves-effect waves-light mr-1 add-smore'>+ Add More Shipping Address </a><a class='btn btn-danger waves-effect waves-light mr-1 sremove'>- Remove </a>");
|
||||
html.find(".schange").html("<a class='btn btn-danger waves-effect waves-light mr-1 sremove'>- Remove </a>");
|
||||
@ -476,6 +489,23 @@
|
||||
|
||||
|
||||
});
|
||||
function changeFields(element) {
|
||||
var selectedValue = $(element).val();
|
||||
var elementId = $(element).attr('id');
|
||||
var match = elementId.match(/\d+/);
|
||||
if (match) {
|
||||
var idnumber = parseInt(match[0], 10);
|
||||
if(selectedValue == 'IN'){
|
||||
$("#sdstate"+idnumber).show();
|
||||
$("#sistate"+idnumber).hide();
|
||||
} else {
|
||||
$("#sdstate"+idnumber).hide();
|
||||
$("#sistate"+idnumber).show();
|
||||
}
|
||||
} else {
|
||||
// alert("No number found in the ID");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
@ -183,7 +183,15 @@
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($loggedin_person_role !== 'manager') : ?>
|
||||
<li>
|
||||
<a href="<?= base_url()."customer_group_notifications"; ?>">
|
||||
<i class="ri-team-fill"></i>
|
||||
<span> Customer Group </span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user