FIX_little changes
This commit is contained in:
parent
f8b507ec3e
commit
cb06e7799b
@ -659,4 +659,5 @@ $routes->post("ticketSave", "ThzController::ticketSave");
|
|||||||
$routes->get("ticketList", "ThzController::ticketList");
|
$routes->get("ticketList", "ThzController::ticketList");
|
||||||
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
|
$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
|
||||||
$routes->get("ticketConversationList", "ThzController::ticketConversationList");
|
$routes->get("ticketConversationList", "ThzController::ticketConversationList");
|
||||||
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
|
$routes->post('ticketAutoFetchDetails',"ThzController::ticketAutoFetchDetails");
|
||||||
|
// $routes->match(['get','post','put'], 'ticketType', 'ThzController::ticketType');
|
||||||
@ -13,6 +13,7 @@ use App\Models\UserModel;
|
|||||||
use App\Models\ClientPolicyModel;
|
use App\Models\ClientPolicyModel;
|
||||||
use App\Models\ClientModel;
|
use App\Models\ClientModel;
|
||||||
use App\Models\TicketMailTemplateModel;
|
use App\Models\TicketMailTemplateModel;
|
||||||
|
// use App\Models\TicketTypesModel;
|
||||||
|
|
||||||
|
|
||||||
class ThzController extends BaseController
|
class ThzController extends BaseController
|
||||||
@ -28,6 +29,7 @@ class ThzController extends BaseController
|
|||||||
protected $clientModel;
|
protected $clientModel;
|
||||||
|
|
||||||
protected $ticketMailTemplateModel;
|
protected $ticketMailTemplateModel;
|
||||||
|
// protected $ticketTypesModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -226,6 +228,43 @@ class ThzController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function ticketType()
|
||||||
|
// {
|
||||||
|
// $method = $this->request->getMethod(); // get, post
|
||||||
|
|
||||||
|
// if ($method === 'get') {
|
||||||
|
|
||||||
|
// $types = $this->ticketTypesModel->where('is_active', 1)->findAll();
|
||||||
|
// if (empty($types)) {
|
||||||
|
// return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404);
|
||||||
|
// }
|
||||||
|
// return $this->response->setJSON(['status' => 'success','data' => $types])->setStatusCode(200);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($method === 'post') {
|
||||||
|
|
||||||
|
// $data = $this->request->getPost();
|
||||||
|
// if (!empty($data['id'])) {
|
||||||
|
// $text = "update";
|
||||||
|
// $result = $this->ticketTypesModel->update($data['id'], $data);
|
||||||
|
// $updateID = $data['id'];
|
||||||
|
// } else {
|
||||||
|
// $text = "create";
|
||||||
|
// $insertID = $this->ticketTypesModel->insert($data);
|
||||||
|
// $result = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $id = isset($insertID) && !empty($insertID) ? $insertID : $updateID ;
|
||||||
|
|
||||||
|
// return $this->response->setJSON([
|
||||||
|
// 'status' => $id ? 'success' : 'error',
|
||||||
|
// 'message' => $id ? "Ticket Type {$text}d successfully " : "Unable to {$text} ticket type. Please try again." ,
|
||||||
|
// 'id' => $id
|
||||||
|
// ])->setStatusCode($id ? 200 : 400);
|
||||||
|
// }
|
||||||
|
// return $this->response->setJSON(['status' => 'error','message' => 'No ticket types found'])->setStatusCode(404);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/************************************************** PRIVATE FUNCTIONS ********************************************************/
|
/************************************************** PRIVATE FUNCTIONS ********************************************************/
|
||||||
|
|||||||
44
app/Models/TicketTypesModel.php
Normal file
44
app/Models/TicketTypesModel.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class TicketTypesModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'ticket_types';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $useAutoIncrement = true;
|
||||||
|
protected $returnType = 'array';
|
||||||
|
protected $useSoftDeletes = false;
|
||||||
|
protected $protectFields = true;
|
||||||
|
protected $allowedFields = ['name','created_at','updated_at','created_by','updated_by' ,'is_active'];
|
||||||
|
|
||||||
|
protected bool $allowEmptyInserts = false;
|
||||||
|
|
||||||
|
// Dates
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
protected $dateFormat = 'datetime';
|
||||||
|
protected $createdField = 'created_at';
|
||||||
|
protected $updatedField = 'updated_at';
|
||||||
|
protected $deletedField = 'deleted_at';
|
||||||
|
|
||||||
|
// Validation
|
||||||
|
protected $validationRules = [];
|
||||||
|
protected $validationMessages = [];
|
||||||
|
protected $skipValidation = false;
|
||||||
|
protected $cleanValidationRules = true;
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -362,7 +362,7 @@ table thead th {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body" style="padding: 15px !important;">
|
<div class="modal-body" style="padding: 12px 15px 0px 15px !important;">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<input type="hidden" id="thz_id" name="thz_id">
|
<input type="hidden" id="thz_id" name="thz_id">
|
||||||
<input type="hidden" id="return_type" name="return_type">
|
<input type="hidden" id="return_type" name="return_type">
|
||||||
@ -396,6 +396,7 @@ table thead th {
|
|||||||
<option value="">Select Ticket Type</option>
|
<option value="">Select Ticket Type</option>
|
||||||
<option value="Sales" selected >Sales</option>
|
<option value="Sales" selected >Sales</option>
|
||||||
<option value="Service">Service</option>
|
<option value="Service">Service</option>
|
||||||
|
<!-- <option value="0">+ Add New</option> -->
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -420,31 +421,43 @@ table thead th {
|
|||||||
|
|
||||||
<!-- // enga 5-"head" and 1-"admin" assign pannvaga dropdown-data la varakudhathu. but dropdown display aganum
|
<!-- // enga 5-"head" and 1-"admin" assign pannvaga dropdown-data la varakudhathu. but dropdown display aganum
|
||||||
// 2,3,4 dropdown data'va varannum but dropdown hide pannanum -->
|
// 2,3,4 dropdown data'va varannum but dropdown hide pannanum -->
|
||||||
<?php if(in_array(get_role_id(), [1,5]) ) { ?>
|
<?php if (in_array(get_role_id(), [1,5])): ?>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="assign_to">Assign To</label>
|
<label for="assign_to">Assign To</label>
|
||||||
<select class="form-control" id="assign_to" name="assign_to">
|
<select class="form-control" id="assign_to" name="assign_to">
|
||||||
<option value="">Select Assign To</option>
|
<option value="">Select Assign To</option>
|
||||||
<?php if(isset($assignee)) { ?>
|
<?php if (!empty($assignee)): ?>
|
||||||
<?php foreach ($assignee as $a) { ?>
|
<?php foreach ($assignee as $a): ?>
|
||||||
<option value="<?= $a['id']?>"><?= $a['emp_code'] ?> - <?= $a['first_name'] ?> <?= $a['last_name'] ?></option>
|
<option value="<?= esc($a['id']) ?>">
|
||||||
<?php } ?>
|
<?= esc($a['emp_code']) ?> - <?= esc($a['first_name']) ?> <?= esc($a['last_name']) ?>
|
||||||
<?php } ?>
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php else: ?>
|
||||||
|
<input type="hidden" id="hide_assign_to" name="assign_to" value="<?= esc(get_session_userid()); ?>">
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="form-group col-md-12 app-font-family">
|
<!-- <div class="form-group col-md-12 app-font-family">
|
||||||
<label for="subject">Subject<span class="text-danger">*</span></label>
|
<label for="subject">Subject<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="subject" name="subject" placeholder="Enter Subject" required maxlength="150">
|
|
||||||
<small id="subjectCounter" class="form-text text-muted app-text-right">0/150</small>
|
<small id="subjectCounter" class="form-text text-muted app-text-right">0/150</small>
|
||||||
|
</div> -->
|
||||||
|
<div class="form-group col-md-12 app-font-family">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<label for="subject" class="mb-1">Subject <span class="text-danger">*</span></label>
|
||||||
|
<small id="subjectCounter" class="form-text text-muted">0/150</small>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" id="subject" name="subject" placeholder="Enter Subject" required maxlength="150">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-12 app-font-family">
|
<div class="form-group col-md-12 app-font-family">
|
||||||
<label for="message">Message<span class="text-danger">*</span></label>
|
<div class="d-flex justify-content-between">
|
||||||
|
<label for="message">Message<span class="text-danger">*</span></label>
|
||||||
|
<small id="messageCounter" class="form-text text-muted text-end app-text-right">0/1500</small>
|
||||||
|
</div>
|
||||||
<!-- <input type="text" class="form-control" id="message" name="message" placeholder="Enter Message"> -->
|
<!-- <input type="text" class="form-control" id="message" name="message" placeholder="Enter Message"> -->
|
||||||
<textarea class="form-control" id="message" name="message" placeholder="Enter Message" rows="4" required maxlength="1500"></textarea>
|
<textarea class="form-control" id="message" name="message" placeholder="Enter Message" rows="3" required maxlength="1500"></textarea>
|
||||||
<small id="messageCounter" class="form-text text-muted text-end app-text-right">0/1500</small>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -495,6 +508,8 @@ table thead th {
|
|||||||
function openTicket(){
|
function openTicket(){
|
||||||
var form = document.getElementById('ticketForm');
|
var form = document.getElementById('ticketForm');
|
||||||
form.reset();
|
form.reset();
|
||||||
|
$("#client_id").select2();
|
||||||
|
$("#ticket_type").select2();
|
||||||
document.getElementById('thz_id').value = '';
|
document.getElementById('thz_id').value = '';
|
||||||
document.getElementById('modalLabel').innerText = "New Ticket";
|
document.getElementById('modalLabel').innerText = "New Ticket";
|
||||||
document.getElementById('return_type').innerText = "Web";
|
document.getElementById('return_type').innerText = "Web";
|
||||||
@ -505,6 +520,8 @@ table thead th {
|
|||||||
function resetTicket(){
|
function resetTicket(){
|
||||||
var form = document.getElementById('ticketForm');
|
var form = document.getElementById('ticketForm');
|
||||||
form.reset();
|
form.reset();
|
||||||
|
$("#client_id").select2();
|
||||||
|
$("#ticket_type").select2();
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitTicket() {
|
function submitTicket() {
|
||||||
@ -678,6 +695,50 @@ table thead th {
|
|||||||
document.getElementById('policy_id').value = "";
|
document.getElementById('policy_id').value = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function hideandshowpolicy() {
|
||||||
|
// var select = document.getElementById('ticket_type');
|
||||||
|
// var value = select.value;
|
||||||
|
// var policyContainer = document.getElementById('policy_container');
|
||||||
|
|
||||||
|
// if (value === "0") {
|
||||||
|
// let newType = prompt("Enter new ticket type:");
|
||||||
|
// if (newType && newType.trim() !== "") {
|
||||||
|
|
||||||
|
// $.ajax({
|
||||||
|
// url: "<?= base_url('ticketType') ?>",
|
||||||
|
// type: "POST",
|
||||||
|
// data: { name: newType },
|
||||||
|
// dataType: 'json',
|
||||||
|
// success: function(response) {
|
||||||
|
// if (response.status === "success") {
|
||||||
|
|
||||||
|
// let option = new Option(newType, newType);
|
||||||
|
// let addNewOption = select.querySelector('option[value="0"]');
|
||||||
|
// select.insertBefore(option, addNewOption);
|
||||||
|
// select.value = newType;
|
||||||
|
// value = newType;
|
||||||
|
// console.log(response.message);
|
||||||
|
|
||||||
|
// } else { console.log(response.message); value = ""; }
|
||||||
|
// },
|
||||||
|
// error: function(xhr) { console.log("Error: " + xhr.statusText); value = ""; }
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// select.value = "";
|
||||||
|
// value = "";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (value === 'Service') {
|
||||||
|
// policyContainer.style.display = "block";
|
||||||
|
// } else {
|
||||||
|
// policyContainer.style.display = "none";
|
||||||
|
// document.getElementById('policy_no').value = "";
|
||||||
|
// document.getElementById('policy_id').value = "";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@ -297,7 +297,7 @@ hr{
|
|||||||
<input type="hidden" id="notes_by" name="notes_by" value="Staff">
|
<input type="hidden" id="notes_by" name="notes_by" value="Staff">
|
||||||
<input type="hidden" id="created_by" name="created_by" value="<?= get_session_userid(); ?>">
|
<input type="hidden" id="created_by" name="created_by" value="<?= get_session_userid(); ?>">
|
||||||
<div class="notes-box">
|
<div class="notes-box">
|
||||||
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..." required></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')"><i class="mdi mdi-content-save"></i></button>
|
||||||
@ -305,6 +305,7 @@ hr{
|
|||||||
<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')"><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>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -455,6 +456,20 @@ hr{
|
|||||||
$("#ticket_type").select2();
|
$("#ticket_type").select2();
|
||||||
$("#status").select2();
|
$("#status").select2();
|
||||||
$("#assign_to").select2();
|
$("#assign_to").select2();
|
||||||
|
const messageInput = document.getElementById("notes");
|
||||||
|
const messageCounter = document.getElementById("messageCounter");
|
||||||
|
|
||||||
|
messageInput.addEventListener("input", function () {
|
||||||
|
const messageLength = messageInput.value.length;
|
||||||
|
messageCounter.textContent = `${messageLength}/1500`;
|
||||||
|
|
||||||
|
if (messageLength > 1500) {
|
||||||
|
toastr.error('Message cannot exceed 1500 characters', 'Warning');
|
||||||
|
messageInput.classList.add('is-invalid');
|
||||||
|
} else {
|
||||||
|
messageInput.classList.remove('is-invalid');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user