Event And Invoice default Event : ps
This commit is contained in:
parent
732a76631c
commit
8ac851b81a
@ -105,6 +105,7 @@ $routes->post('address/generatePdf', 'Address::generatePdf');
|
||||
$routes->get("event_list/", "Event::index");
|
||||
$routes->get("new_event/(:any)", "Event::new_event/$1");
|
||||
$routes->post("insert_event/", "Event::insert_event");
|
||||
$routes->post("change_default_event/", "Event::change_default_event");
|
||||
|
||||
$routes->get('invoice_number_format/(:any)', 'Event::invoice_number_format/$1');
|
||||
$routes->post("insert_invoice_number_format", "Event::insert_invoice_number_format");
|
||||
|
||||
@ -105,13 +105,15 @@ class Event extends BaseController
|
||||
public function invoice_number_format($id)
|
||||
{
|
||||
helper('session');
|
||||
helper('financial_year_helper');
|
||||
$session_bid = get_business_id();
|
||||
$data['page_name'] = 'Edit invoice number formatting';
|
||||
$model = new EventModel();
|
||||
$edit_event_details = $model->setTable('invoice_number_formatting')->where(['id' => (int)$id,'business_id'=>$session_bid])->first();
|
||||
$data['event'] = $edit_event_details;
|
||||
$data['session_bid'] = $session_bid;
|
||||
|
||||
$data['financial_year'] = get_financial_year();
|
||||
|
||||
$this->render_page('invoice_number_formatting', $data);
|
||||
}
|
||||
public function insert_invoice_number_format()
|
||||
@ -162,4 +164,38 @@ class Event extends BaseController
|
||||
}
|
||||
return redirect()->to(base_url("invoice_number_format/1"));
|
||||
}
|
||||
|
||||
public function change_default_event() {
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
$response = "";
|
||||
|
||||
$EventModel = new EventModel();
|
||||
$where = ['events.business_id' => (int)$session_bid, 'events.isactive' => 1, 'events.is_the_default' => 1];
|
||||
$events = $EventModel->where($where)->orderBy('event_id', 'DESC')->findAll(); // Retrieve the events
|
||||
|
||||
if (count($events) > 0) {
|
||||
$dataToUpdate = ['is_the_default' => 0];
|
||||
$eventIds = array_column($events, 'event_id');
|
||||
// $EventModel->whereIn('event_id', $eventIds)->set($dataToUpdate)->update();
|
||||
$affectedRows = $EventModel->whereIn('event_id', $eventIds)->set($dataToUpdate)->update();
|
||||
$this->logger->info("Changed To Default as 0 - Event ID are " . implode(", ", $eventIds) . ". Affected Rows: " . $affectedRows);
|
||||
}
|
||||
|
||||
$data['is_the_default'] = $this->request->getPost('is_the_default');
|
||||
$data['updated_by'] = $session_uid;
|
||||
$where = ['events.business_id' => (int)$session_bid, 'events.isactive' => 1, 'events.event_id' => $this->request->getPost('event_id')];
|
||||
$update_result = $EventModel->updateData('events', $data, $where);
|
||||
|
||||
if ($update_result['info']) {
|
||||
$response = "Event set as Default";
|
||||
$this->logger->info($update_result['info']);
|
||||
} else {
|
||||
$response = $update_result['err'];
|
||||
$this->logger->error($update_result['err']);
|
||||
}
|
||||
|
||||
return $this->response->setJSON(['response' => $response]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,15 +41,18 @@ class Invoice extends BaseController
|
||||
public function new_book_invoice($id = '0')
|
||||
{
|
||||
helper('session');
|
||||
helper('financial_year_helper');
|
||||
|
||||
$model = new InvoiceModel();
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
|
||||
// Get customer names for the dropdown, events details, and books details
|
||||
$data['customers'] = $model->getData('customers', $where);
|
||||
$data['events'] = $model->getData('events', $where);
|
||||
$data['financial_year'] = get_financial_year();
|
||||
$data['invoice_number_formatting'] = $model->getData('invoice_number_formatting', $where);
|
||||
$data['books'] = $model->getCategoryBooks(1); // Invocie type = 2 (invoice)
|
||||
|
||||
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Book Invoice: In Add Details");
|
||||
$data['page_name'] = 'Add Book Invoice Details';
|
||||
@ -158,6 +161,8 @@ class Invoice extends BaseController
|
||||
|
||||
## Declarions
|
||||
helper('session');
|
||||
helper('financial_year_helper');
|
||||
|
||||
$model = new InvoiceModel();
|
||||
$duedate = $this->request->getVar('due_date');
|
||||
$invdate = $this->request->getVar('invoice_date');
|
||||
@ -225,6 +230,7 @@ class Invoice extends BaseController
|
||||
## Array Formation For Invoice Numbering Format Details..
|
||||
$update_invoice_numbering = [
|
||||
'id' => 1,
|
||||
'id_formating' => get_financial_year(),
|
||||
'next_id' => (int)$this->request->getPost('next_id'),
|
||||
'business_id' => (int)get_business_id(),
|
||||
'updated_by' => get_logged_user_id()
|
||||
|
||||
24
app/Helpers/financial_year_helper.php
Normal file
24
app/Helpers/financial_year_helper.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('get_financial_year')) {
|
||||
function get_financial_year($date = null)
|
||||
{
|
||||
// If no date is provided, use the current date
|
||||
$date = $date ?: date('Y-m-d');
|
||||
|
||||
// Extract the year from the date
|
||||
$year = date('Y', strtotime($date));
|
||||
|
||||
// Determine the financial year based on your business logic
|
||||
// Adjust this logic according to your organization's financial year cycle
|
||||
if (date('n', strtotime($date)) < 4) {
|
||||
// If the month is before April, use the previous year
|
||||
$financialYear = ($year - 1) . '-' . $year;
|
||||
} else {
|
||||
// If the month is April or later, use the current year
|
||||
$financialYear = $year . '-' . ($year + 1);
|
||||
}
|
||||
|
||||
return $financialYear;
|
||||
}
|
||||
}
|
||||
@ -9,7 +9,7 @@ class EventModel extends Model
|
||||
{
|
||||
protected $table = 'events';
|
||||
protected $primaryKey = 'event_id';
|
||||
protected $allowedFields = ['event_id','event_name','created_by','created_on','updated_on' ,'updated_by','business_id'];
|
||||
protected $allowedFields = ['event_id','event_name','created_by','created_on','updated_on' ,'updated_by','business_id','is_the_default'];
|
||||
|
||||
public function getEventnamesByBusiness($business_id)
|
||||
{
|
||||
@ -49,6 +49,7 @@ class EventModel extends Model
|
||||
return ["info"=>"","err"=>'Database operation failed: ' . $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@ -26,7 +26,7 @@ class HomeModel extends Model
|
||||
}
|
||||
|
||||
public function invoice_dtls() {
|
||||
if (date('m') <= 3) {
|
||||
if ((int)date('m') <= 3) {
|
||||
$invoice['financial_year'] = (date('Y')-1) . '-' . date('Y');
|
||||
$start_date = (date('Y')-1).'-04-01';
|
||||
$end_date = date('Y').'-03-31';
|
||||
@ -94,7 +94,7 @@ class HomeModel extends Model
|
||||
|
||||
public function book_published_dtls(){
|
||||
|
||||
if (date('m') <= 3) {
|
||||
if ((int)date('m') <= 3) {
|
||||
$start_date = (date('Y')-1).'-04-01';
|
||||
$end_date = date('Y').'-03-31';
|
||||
} else {
|
||||
|
||||
@ -5,7 +5,7 @@ class SettingsModel extends Model
|
||||
{
|
||||
protected $table = 'settings';
|
||||
protected $primaryKey = 'setting_id';
|
||||
protected $allowedFields = ['setting_id','site_name','site_title','favicon','logo','terms_service','footer_about','admin_email','mobile','copyright','pagination_limit','site_info','about_info','mail_protocol','mail_title','mail_host','mail_port','mail_encryption','mail_username','mail_password','currency','country','isactive','business_id'];
|
||||
protected $allowedFields = ['business_id','setting_id','site_name','site_color','site_short_name','site_email','mobile','country','favicon','site_info','logo','terms_service','footer_about','about_info','copyright','pagination_limit','mail_protocol','mail_title','mail_host','mail_port','mail_encryption','mail_username','mail_password','currency','created_on','created_by','updated_on','updated_by','isactive'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
{
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
<style>
|
||||
/* CSS for the preview image */
|
||||
.preview-image {
|
||||
display: block;
|
||||
/* Ensure the image is displayed as a block element */
|
||||
width: 120px;
|
||||
/* Set the desired width for passport size */
|
||||
height: 160px;
|
||||
/* Set the desired height for passport size */
|
||||
object-fit: cover;
|
||||
/* Maintain the aspect ratio and fill the container */
|
||||
margin-top: 10px;
|
||||
/* Add a top margin for spacing */
|
||||
}
|
||||
/* CSS for the preview image */
|
||||
.preview-image {
|
||||
display: block;
|
||||
/* Ensure the image is displayed as a block element */
|
||||
width: 120px;
|
||||
/* Set the desired width for passport size */
|
||||
height: 160px;
|
||||
/* Set the desired height for passport size */
|
||||
object-fit: cover;
|
||||
/* Maintain the aspect ratio and fill the container */
|
||||
margin-top: 10px;
|
||||
/* Add a top margin for spacing */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -29,90 +29,86 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title" class="col-form-label">Book Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="<?= isset($details['title']) ? $details['title'] : '' ?>" placeholder="Name of the book" required />
|
||||
<label for="title" class="col-form-label">Book Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="<?= isset($details['title']) ? $details['title'] : '' ?>" placeholder="Book Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="author" class="col-form-label">Book Author<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="author" name="author" value="<?= isset($details['author']) ? $details['author'] : '' ?>" placeholder="Name of the book author" required />
|
||||
<label for="author" class="col-form-label">Author<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="author" name="author" value="<?= isset($details['author']) ? $details['author'] : '' ?>" placeholder="Author" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publisher" class="col-form-label">Book Publisher Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="publisher" name="publisher" placeholder="Book Publisher" value="<?= isset($details['publisher']) ? $details['publisher'] : '' ?>" required />
|
||||
<label for="publisher" class="col-form-label">Publisher Name<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="publisher" name="publisher" placeholder="Publisher Name" value="<?= isset($details['publisher']) ? $details['publisher'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publishers_code" class="col-form-label">Book Publishers Code</label>
|
||||
<input type="text" class="form-control" id="publishers_code" name="publishers_code" placeholder="Book Publishers code" value="<?= isset($details['publishers_code']) ? $details['publishers_code'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="publication_date" class="col-form-label">Publication Date<span class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control" id="publication_date" name="publication_date" value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>" max="<?= date('Y-m-d'); ?>" required placeholder="Publication Date">
|
||||
<label for="publication_date" class="col-form-label">Publication Date<span class="text-danger"> *</span></label>
|
||||
<input type="date" class="form-control" id="publication_date" name="publication_date" value="<?= isset($details['publication_date']) ? $details['publication_date'] : '' ?>" max="<?= date('Y-m-d'); ?>" required placeholder="Publication Date">
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="price" class="col-form-label">Book Price<span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="price" name="price" placeholder="Book Price" required value="<?= isset($details['price']) ? $details['price'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="isbn_code" class="col-form-label">ISBN Code<span class="text-danger">*</span></label>
|
||||
<label for="publishers_code" class="col-form-label">Publisher Code</label>
|
||||
<input type="text" class="form-control" id="publishers_code" name="publishers_code" placeholder="Publisher Code" value="<?= isset($details['publishers_code']) ? $details['publishers_code'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="isbn_code" class="col-form-label">ISBN Code<span class="text-danger"> *</span></label>
|
||||
<input type="text" class="form-control" id="isbn_code" name="isbn_code" value="<?= isset($details['isbn_code']) ? $details['isbn_code'] : '' ?>" placeholder="ISBN Code" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="page_count" class="col-form-label">Page Count<span class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="page_count" name="page_count" placeholder="Page Count" value="<?= isset($details['page_count']) ? $details['page_count'] : '' ?>" />
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
|
||||
<label for="category_id" class="col-form-label">Category</label>
|
||||
<select class="form-control" id="category_id" name="category_id">
|
||||
<option>Select the Category of the Book</option>
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
|
||||
<option value="<?= $category['id'] ?>">
|
||||
<?= $category['name'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="language" class="col-form-label">Language<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="language" name="language" placeholder="Language" value="<?= isset($details['language']) ? $details['language'] : '' ?>" />
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="page_count" class="col-form-label">Page Count<span class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="page_count" name="page_count" placeholder="Page Count" value="<?= isset($details['page_count']) ? $details['page_count'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="price" class="col-form-label">Price<span class="text-danger"> *</span></label>
|
||||
<input type="number" class="form-control" id="price" name="price" placeholder="Price" required value="<?= isset($details['price']) ? $details['price'] : '' ?>" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="tax" class="col-form-label">TAX<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="tax" name="tax" placeholder="Tax" value="<?= isset($details['tax']) ? $details['tax'] : '' ?>" />
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="description" class="col-form-label">Description<span class="text-danger"></span></label>
|
||||
<textarea class="form-control" id="description" name="description" placeholder="Description" rows="6"><?= isset($details['description']) ? $details['description'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="tax" class="col-form-label">TAX<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="tax" name="tax" placeholder="TAX" value="<?= isset($details['tax']) ? $details['tax'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="category_id" class="col-form-label">Category</label>
|
||||
<select class="form-control" id="category_id" name="category_id">
|
||||
<option>Select the Category of the Book</option>
|
||||
<?php foreach ($categories as $category) : ?>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="description" class="col-form-label">Description<span class="text-danger"></span></label>
|
||||
<textarea class="form-control" id="description" name="description" placeholder="Description" rows="5"><?= isset($details['description']) ? $details['description'] : '' ?></textarea>
|
||||
<option value="<?= $category['id'] ?>">
|
||||
<?= $category['name'] ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="img_name" class="col-form-label">Picture</label>
|
||||
<input type="file" name="img_name" accept="image/*" />
|
||||
@ -207,4 +203,4 @@
|
||||
|
||||
// Set the min and max date attributes
|
||||
DateInput.setAttribute("max", maxDate);
|
||||
</script>
|
||||
</script>
|
||||
@ -34,7 +34,7 @@
|
||||
<tr>
|
||||
<th hidden ></th>
|
||||
<th>Event Name</th>
|
||||
<th>Action</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php foreach ($event as $value) :?>
|
||||
@ -42,7 +42,11 @@
|
||||
<td hidden><?= $value['event_id']; ?></td>
|
||||
<td><?= $value['event_name']; ?></td>
|
||||
<td>
|
||||
<a href="<?= "new_event/" . $value['event_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="radio" class="custom-control-input" name="is_the_default" value="<?= $value['event_id'] ?>" id="<?= $value['event_id'] ?>" <?= $value['is_the_default'] ? "checked" : ""; ?> >
|
||||
<label class="custom-control-label" for="<?= $value['event_id']; ?>"></label>
|
||||
<a href="<?= "new_event/" . $value['event_id']; ?>" class="edit-button"><i class="ri-pencil-line"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@ -60,6 +64,40 @@
|
||||
});
|
||||
});
|
||||
|
||||
$("input[type=radio][name=is_the_default]").change(function(event) {
|
||||
var id = $(this).val();
|
||||
var confirmed = window.confirm("Are you sure, you want to set the event as the default event?");
|
||||
|
||||
if (confirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'change_default_event' ?>",
|
||||
data: {
|
||||
event_id: id,
|
||||
is_the_default: 1
|
||||
},
|
||||
success: function(response) {
|
||||
alert(response.response);
|
||||
$(this).prop('checked', true);
|
||||
console.error(response);
|
||||
},
|
||||
error: function(error) {
|
||||
alert(error.response);
|
||||
console.error(error);
|
||||
// $(this).prop('checked', false);
|
||||
refreshPage();
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("Action canceled");
|
||||
console.log("Action canceled");
|
||||
refreshPage();
|
||||
// console.log(event);
|
||||
// console.log(id);$event->event_id
|
||||
// $(this).prop('checked', false);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
<option value="">Select an Events</option>
|
||||
<?php foreach ($events as $event) : ?>
|
||||
<!-- <option value="<?= $event->event_id ?>"><?= $event->event_name ?></option> -->
|
||||
<option value="<?= $event->event_id ?>" <?php if (isset($invoice_details['event_id']) && ($invoice_details['event_id'] === $event->event_id)) echo "selected"; ?>>
|
||||
<option value="<?= $event->event_id ?>" <?php if ((int)$event->is_the_default === 1 || isset($invoice_details['event_id']) && (($invoice_details['event_id'] === $event->event_id))) echo "selected"; ?>>
|
||||
<?= $event->event_name ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@ -582,8 +582,8 @@
|
||||
|
||||
var next_id_string = filtered_data[0].next_id;
|
||||
var left_pad_string = filtered_data[0].left_pad;
|
||||
var prefix_string = String(filtered_data[0].id_formating);
|
||||
|
||||
// var prefix_string = String(filtered_data[0].id_formating); // don't remove
|
||||
var prefix_string = <?= json_encode($financial_year); ?>;
|
||||
var left_pad_numberic = parseInt(left_pad_string);
|
||||
var next_id_numberic = parseInt(next_id_string);
|
||||
|
||||
|
||||
@ -26,9 +26,10 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="formating" class="col-form-label">Identifier formatting<span class="text-danger">*</span></label>
|
||||
<!-- <label for="formating" class="col-form-label">Identifier formatting<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="formating" value="<?= isset($event['id_formating']) ? $event['id_formating'] : '' ?>" placeholder="INV{{-0-}}" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
<div class="invalid-feedback"> Please provide. </div> -->
|
||||
<input type="text" class="form-control" name="formating" value="<?= $financial_year; ?>" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
@ -29,19 +29,29 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="business_id" class="col-form-label">Business<span
|
||||
class="text-danger">*</span></label>
|
||||
<select id="business_id" name="business_id" class="form-control" data-toggle="select2" onchange="fetch_details(this.value);">
|
||||
<?php if (isset($details['business_id']) && $details['business_id'] != "" ) {
|
||||
$displayvalue = "";
|
||||
foreach ($business_details as $value) {
|
||||
if ($details['business_id'] === $value['business_id']) {
|
||||
$displayvalue = $value['title'];
|
||||
}
|
||||
} ?>
|
||||
<label for="business_id" class="col-form-label">Business</label>
|
||||
<input type="hidden" name="business_id" value="<?= $details['business_id']; ?>" />
|
||||
<input type="text" class="form-control" value="<?= $displayvalue ?>" readonly/>
|
||||
<?php } else { ?>
|
||||
<label for="business_id" class="col-form-label">Business<span class="text-danger">*</span></label>
|
||||
<select id="business_id" name="business_id" class="form-control" data-toggle="select2" onchange="fetch_details(this.value);">
|
||||
<option value=null>Choose your Business</option>
|
||||
<?php foreach ($business_details as $value) {
|
||||
$disabled = ($value['setting_id'] != "") ? 'disabled' : '' ;
|
||||
?>
|
||||
<option value="<?php echo $value['business_id']; ?>"
|
||||
<?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?> <?= $disabled ?> >
|
||||
<?php echo $value['title'].($value['setting_id'] != "" ? " (Disabled) " : ""); ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php foreach ($business_details as $value) {
|
||||
if($value['setting_id'] == ""){ ?>
|
||||
<option value="<?php echo $value['business_id']; ?>" >
|
||||
<?php echo $value['title']; ?>
|
||||
</option>
|
||||
<?php } } ?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user