98 lines
3.5 KiB
PHP
98 lines
3.5 KiB
PHP
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card-body">
|
|
<form role="form" class="parsley-examples" method="post" id="ticket_note_form"
|
|
enctype="multipart/form-data">
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label for="ticket_note">Add Notes</label>
|
|
<textarea class="form-control" id="ticket_note" name="note" rows="3"
|
|
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
|
</div>
|
|
</div>
|
|
</div><input type="hidden" id="note_id">
|
|
<div class="form-group text-right m-b-0">
|
|
<button type="submit" class="btn btn-primary" id="ticket_note_submit">Submit</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div> <!-- end col-->
|
|
</div>
|
|
<!-- end -->
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
url = '<?= base_url('ticket/note/1')?>';
|
|
data = { id : $('#ticket_master_id').val(), is_auto_query : 0};
|
|
$.ajax({
|
|
url:url,
|
|
data:data,
|
|
type: 'POST',
|
|
success: function(res) {
|
|
if (res.status == true){
|
|
$('#ticket_note').val(res.data.note);
|
|
$('#note_id').val(res.data.id);
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
setTimeout(function() {
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
toastr.warning('Something Went Wrong!', 'warning');
|
|
}, 1000);
|
|
}
|
|
})
|
|
|
|
$("#ticket_note_form").submit(function(event) {
|
|
|
|
event.preventDefault();
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
var url = '<?= base_url("/ticket/note/2"); ?>';
|
|
var formData = $(this).serializeArray();
|
|
var ticket_id = $('#ticket_master_id').val();
|
|
if (ticket_id != null && ticket_id != ''){
|
|
formData.push({ name: 'ticket_id', value: ticket_id});
|
|
}
|
|
var primary_key = $('#note_id').val();
|
|
if (primary_key != null && primary_key != ''){
|
|
formData.push({ name: 'id', value: primary_key});
|
|
}
|
|
console.log(formData);
|
|
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
|
if (response.status == true) {
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
toastr.success('Note Added Successfully','Success');
|
|
// console.log("Respone id is ")
|
|
// console.log(response.id);
|
|
$('#note_id').val(response.id);
|
|
// console.log($('#'))
|
|
|
|
|
|
} else {
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
let message = response.message;
|
|
toastr.error(message, 'ERROR');
|
|
}
|
|
|
|
|
|
}, function(xhr, status, error) {
|
|
console.error('Error fetching data:', error);
|
|
console.error(xhr.responseText);
|
|
toastr.error('An error occurred while fetching the report page.', 'ERROR');
|
|
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|