Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
762f78665a
@ -56,15 +56,16 @@ class ThzController extends BaseController
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
$references = "";
|
||||||
if (!empty($data['thz_id'])) {
|
if (!empty($data['thz_id'])) {
|
||||||
|
|
||||||
$text = "update";
|
$text = "update";
|
||||||
$result = $this->updateTicket($data);
|
|
||||||
// here insert history Status.
|
// here insert history Status.
|
||||||
$old = $this->thzMasterModel->where('thz_id', $data['thz_id'])->get()->getRowArray();
|
$old = $this->thzMasterModel->where('thz_id', $data['thz_id'])->get()->getRowArray();
|
||||||
|
$result = $this->updateTicket($data);
|
||||||
|
|
||||||
if ($old && isset($data['status'])) {
|
if ($old && isset($data['status'])) {
|
||||||
|
|
||||||
if ($old['status'] != $data['status']) {
|
if ($old['status'] != $data['status']) {
|
||||||
$history = [
|
$history = [
|
||||||
'thz_id' => $data['thz_id'],
|
'thz_id' => $data['thz_id'],
|
||||||
@ -79,8 +80,13 @@ class ThzController extends BaseController
|
|||||||
$history['created_by'] = get_session_userid();
|
$history['created_by'] = get_session_userid();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->thzHistoryModel->insert($history);
|
$hist_id = $this->thzHistoryModel->insert($history);
|
||||||
|
$references = $old['status']." - ".$data['status']." - ".$hist_id;
|
||||||
|
}else{
|
||||||
|
$references = $old['status']." - ".$data['status'];
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$references = "No Details";
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateID = $data['thz_id'];
|
$updateID = $data['thz_id'];
|
||||||
@ -90,6 +96,7 @@ class ThzController extends BaseController
|
|||||||
$text = "create";
|
$text = "create";
|
||||||
$insertID = $this->insertTicket($data);
|
$insertID = $this->insertTicket($data);
|
||||||
$result = true;
|
$result = true;
|
||||||
|
$references = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +107,8 @@ class ThzController extends BaseController
|
|||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => $result ? 'success' : 'error',
|
'status' => $result ? 'success' : 'error',
|
||||||
'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again." ,
|
'message' => $result ? "Ticket {$text}d successfully " : "Unable to {$text} ticket. Please try again." ,
|
||||||
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!'
|
'notification' => $emailNotificationResult ? 'Email Notification Success..!!' : 'Email Notification Failed..!!',
|
||||||
|
'ref' => $references
|
||||||
])->setStatusCode($result ? 200 : 400);
|
])->setStatusCode($result ? 200 : 400);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
|
$code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500;
|
||||||
@ -114,7 +122,7 @@ class ThzController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
||||||
|
|
||||||
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
||||||
'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine()
|
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
|
||||||
])->setStatusCode($code);
|
])->setStatusCode($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +177,7 @@ class ThzController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
||||||
|
|
||||||
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
||||||
'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine()
|
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
|
||||||
])->setStatusCode($code);
|
])->setStatusCode($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +222,7 @@ class ThzController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
||||||
|
|
||||||
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
||||||
'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine()
|
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
|
||||||
])->setStatusCode($code);
|
])->setStatusCode($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +268,7 @@ class ThzController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
||||||
|
|
||||||
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
||||||
'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine()
|
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
|
||||||
])->setStatusCode($code);
|
])->setStatusCode($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,7 +317,7 @@ class ThzController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
||||||
|
|
||||||
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
||||||
'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine()
|
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
|
||||||
])->setStatusCode($code);
|
])->setStatusCode($code);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -389,7 +397,7 @@ class ThzController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
||||||
|
|
||||||
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
||||||
'ref' => $isDbError ? 'database' : 'application' . $code . ' / ' . $e->getLine()
|
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
|
||||||
])->setStatusCode($code);
|
])->setStatusCode($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,7 +436,7 @@ class ThzController extends BaseController
|
|||||||
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
$this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0);
|
||||||
|
|
||||||
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
return $this->response->setJSON([ 'status' => 'error', 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(),
|
||||||
'ref' => $isDbError ? 'database / ' : 'application / ' . $code . ' / ' . $e->getLine()
|
'ref' => $isDbError ? 'database - ' : 'application - ' . $code . ' - ' . $e->getLine()
|
||||||
])->setStatusCode($code);
|
])->setStatusCode($code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -400,6 +400,10 @@ table.dataTable td.wrap {
|
|||||||
var form = document.getElementById("ticketForm"); // your form ID
|
var form = document.getElementById("ticketForm"); // your form ID
|
||||||
var formData = new FormData(form);
|
var formData = new FormData(form);
|
||||||
|
|
||||||
|
var btn = document.querySelector("button[onclick='submitTicket()']");
|
||||||
|
btn.disabled = true;
|
||||||
|
btn.innerText = "Saving...";
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "<?= base_url('ticketSave') ?>",
|
url: "<?= base_url('ticketSave') ?>",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -420,6 +424,10 @@ table.dataTable td.wrap {
|
|||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
toastr.error("Something went wrong!", 'Error');
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
btn.disabled = false;
|
||||||
|
btn.innerText = "Save";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -313,9 +313,9 @@ hr{
|
|||||||
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..." required maxlength="1500"></textarea>
|
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..." required maxlength="1500"></textarea>
|
||||||
<div class="icon-buttons">
|
<div class="icon-buttons">
|
||||||
<!-- save btn means local - internal -->
|
<!-- save btn means local - internal -->
|
||||||
<button type="button" class="btn-icon" onclick="submitConverstionTicket('Internal')"><i class="mdi mdi-content-save"></i></button>
|
<button type="button" class="btn-icon" onclick="submitConverstionTicket('Internal', this)"><i class="mdi mdi-content-save"></i></button>
|
||||||
<!-- mail btn means notify - external -->
|
<!-- mail btn means notify - external -->
|
||||||
<button type="button" class="btn-icon" onclick="submitConverstionTicket('External')"><i class="mdi mdi-email"></i></button>
|
<button type="button" class="btn-icon" onclick="submitConverstionTicket('External', this)"><i class="mdi mdi-email"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<small id="messageCounter" class="form-text text-muted text-end app-text-right">0/1500</small>
|
<small id="messageCounter" class="form-text text-muted text-end app-text-right">0/1500</small>
|
||||||
@ -571,7 +571,8 @@ hr{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitConverstionTicket(notetype) {
|
function submitConverstionTicket(notetype,btn) {
|
||||||
|
btn.disabled = true;
|
||||||
|
|
||||||
document.getElementById("notes_type").value = notetype;
|
document.getElementById("notes_type").value = notetype;
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
@ -610,7 +611,8 @@ hr{
|
|||||||
error: function(xhr) {
|
error: function(xhr) {
|
||||||
toastr.error("Something went wrong!", 'Error');
|
toastr.error("Something went wrong!", 'Error');
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
}
|
},
|
||||||
|
complete: function() { btn.disabled = false;}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user