187 lines
5.9 KiB
PHP
187 lines
5.9 KiB
PHP
<!-- ============================================================== -->
|
|
<!-- Start Page Content here -->
|
|
<!-- ============================================================== -->
|
|
|
|
<div class="content-page">
|
|
<!-- Start Content-->
|
|
<div class="container-fluid">
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-2">
|
|
</div>
|
|
<div class="col-8">
|
|
<div class="page-title-box page-title-box-alt">
|
|
<h4 class="page-title"><?php echo $page_name; ?></h4>
|
|
<div class="page-title-right">
|
|
<a onclick="window.history.back()" class="btn btn-secondary waves-effect waves-light" style="color: #fff;background-color: #6c757d;border-color: #6c757d;"> Back </a>
|
|
|
|
<ol class="breadcrumb m-0">
|
|
<!-- <li class="breadcrumb-item"><a href="javascript: void(0);">Minton</a></li>
|
|
<li class="breadcrumb-item"><a href="javascript: void(0);">Pages</a></li>
|
|
<li class="breadcrumb-item active">Starter</li> -->
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-lg-2"></div>
|
|
<div class="col-lg-8">
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<form >
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label for="inputEmail4" class="col-form-label">Business Name</label>
|
|
<input type="text" class="form-control" id="business_name" placeholder="Name" value="<?= isset($business['business_name']) ? $business['business_name'] : '' ?>" required>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="subject-input">Template Header</label>
|
|
<!-- basic summernote-->
|
|
<div id="summernote-header"></div>
|
|
</div>
|
|
|
|
<div class="form-group col-md-12">
|
|
<label for="subject-input">Template Footer</label>
|
|
<!-- basic summernote-->
|
|
<div id="summernote-footer"></div>
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
|
|
<input type="hidden" id="business_id" name="business_id" value="<?= isset($business['business_id']) ? $business['business_id'] : '' ?>">
|
|
<input type="hidden" id="header_html" value='<?= isset($business['business_id']) ? $business['header_html'] : '' ?>'>
|
|
<input type="hidden" id="footer_html" value='<?= isset($business['business_id']) ? $business['footer_html'] : '' ?>'>
|
|
<button type="submit" id="savedata" class="btn btn-primary">Submit</button>
|
|
|
|
|
|
</div>
|
|
</div> <!-- end card -->
|
|
</div>
|
|
<div class="col-lg-2"></div>
|
|
<!-- end col -->
|
|
|
|
</div>
|
|
|
|
|
|
</div> <!-- container -->
|
|
|
|
</div> <!-- content -->
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
$('#summernote-header').summernote({
|
|
height: 150, // set the height of the editor
|
|
toolbar: [
|
|
|
|
['style', ['style']],
|
|
['font', ['bold', 'italic', 'underline', 'clear' ]],
|
|
['fontname', ['fontname']],
|
|
['fontsize', ['fontsize']],
|
|
['color', ['color']],
|
|
['para', ['ul', 'ol', 'paragraph' , 'height']],
|
|
['table', ['table']],
|
|
['insert', [ 'picture']],
|
|
['view', ['fullscreen', 'codeview', 'help']],
|
|
['mybutton', ['customButton','Years']] // Custom button group
|
|
],
|
|
});
|
|
|
|
$('#summernote-footer').summernote({
|
|
height: 150, // set the height of the editor
|
|
toolbar: [
|
|
|
|
['style', ['style']],
|
|
['font', ['bold', 'italic', 'underline', 'clear' ]],
|
|
['fontname', ['fontname']],
|
|
['fontsize', ['fontsize']],
|
|
['color', ['color']],
|
|
['para', ['ul', 'ol', 'paragraph' , 'height']],
|
|
['table', ['table']],
|
|
['insert', [ 'picture']],
|
|
['view', ['fullscreen', 'codeview', 'help']],
|
|
['mybutton', ['customButton','Years']] // Custom button group
|
|
],
|
|
});
|
|
|
|
|
|
setTimeout(() =>
|
|
{
|
|
$('#summernote-header').summernote('code', $('#header_html').val());
|
|
$('#summernote-footer').summernote('code', $('#footer_html').val());
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#savedata").on("click", function()
|
|
{
|
|
|
|
var headerContent = $('#summernote-header').summernote('code');
|
|
var footerContent = $('#summernote-footer').summernote('code');
|
|
formData ={
|
|
business_id : $('#business_id').val(),
|
|
business_name : $('#business_name').val(),
|
|
header_html : headerContent,
|
|
footer_html : footerContent,
|
|
};
|
|
|
|
console.log(formData);
|
|
|
|
|
|
|
|
$.ajax({
|
|
url: '<?= base_url()."add_business"; ?>',
|
|
type: 'POST',
|
|
data: formData,
|
|
json: true,
|
|
success: function(response) {
|
|
|
|
if(response.success){
|
|
|
|
toastr.success('Data saved successfully ', 'Success');
|
|
window.location.href = '<?= base_url()."business_list"; ?>';
|
|
|
|
}else{
|
|
toastr.warning('Something went wrong', 'Warning');
|
|
}
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
// Handle errors here
|
|
console.error(xhr.responseText);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- ============================================================== -->
|
|
<!-- End Page content -->
|
|
<!-- ============================================================== -->
|