Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-08-25 10:37:56 +05:30
commit 27ae5d8bd2
4 changed files with 163 additions and 61 deletions

View File

@ -91,7 +91,7 @@ class ThzController extends BaseController
}
}else{
$data['page_name'] = "Ticket List";
$data['page_name'] = "Tickets";
$data['ticket_data'] = $tickets;
$data['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
@ -196,19 +196,28 @@ class ThzController extends BaseController
if ($returnType === 'api') {
return $this->response->setJSON((['status' => 'success', 'data' => $result]))->setStatusCode(200);
}else{
$toGetCreatedBy = $result['master'][0]['created_by'];
$assign_to = $result['master'][0]['assign_to'];
$mobile = $result['master'][0]['mobile'];
$toGetPolicyId = (!empty($result['master'][0]['policy_id']) && strtolower($result['master'][0]['policy_id']) !== 'null')
? $result['master'][0]['policy_id']
: '';
$result['related_tickets'] = $this->thzMasterModel
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.created_by', $toGetCreatedBy)
->findAll();
->select('thz_master.*, CONCAT(user_profiles.first_name, " ", user_profiles.last_name) as assignee_name')
->join('user_profiles', 'user_profiles.id = thz_master.assign_to', 'left')
->where('thz_master.assign_to', $assign_to)
->where('thz_master.mobile',$mobile)
->where('thz_master.thz_id !=',$thz_id)
->where('thz_master.status !=','Closed')
->where('thz_master.status !=','Resolved')
->findAll();
$result['assignee'] = $this->userModel->where('is_active', 1)->whereIn('role', ['2', '3','4'])->findAll(); // enga 5-"head" and 1-"admin" assign pannvaga so dropdown la varakudhathu
// 2,3,4 remain person varannum.
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
$result['policy_terms'] = $toGetPolicyId ? $this->getPolicyTerms($toGetPolicyId) : '';
return $this->loadLayout('thz_notes', $result);
}

View File

@ -43,7 +43,7 @@ class ThzMasterModel extends Model
public function ticketAutoFetchDetails($client_id ,$mobile){
$result = $this->db->table('employees e')
->select('e.id, e.email_personal, e.client_id, e.client_branch_id as branch_id, e.mobile, e.emp_code, e.name, ep.client_policy_id as policy_id')
->select('e.id, e.email_personal,e.email_corporate, e.client_id, e.client_branch_id as branch_id, e.mobile, e.emp_code, e.name, ep.client_policy_id as policy_id')
->join('employee_polices ep', 'ep.employee_id = e.id AND ep.is_active = 1', 'left')
->whereIn('e.emp_status', ['active', 'draft', 'enrolled'])
->where('e.is_active', 1)

View File

@ -249,7 +249,7 @@
/* Force all text across the entire app to black */
html, body, * {
color: #000 !important;
color: #000 !important;
}
@ -511,33 +511,73 @@
font-weight: 600!important;
}
.btn-ternary {
color: #fff !important;
background-color: #E26728;
border-color: #E26728; }
.btn-ternary:hover {
color: #fff !important;
background-color: #B9501F;
border-color: #A6471C; }
.btn-ternary:focus, .btn-ternary.focus {
color: #fff !important;
background-color: #B9501F;
border-color: #A6471C;
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
.btn-ternary.disabled, .btn-ternary:disabled {
color: #fff !important;
background-color: #E26728;
border-color: #E26728; }
.btn-ternary:not(:disabled):not(.disabled):active, .btn-ternary:not(:disabled):not(.disabled).active,
.show > .btn-ternary.dropdown-toggle {
color: #fff !important;
background-color: #A6471C;
border-color: #933E19; }
.btn-ternary:not(:disabled):not(.disabled):active:focus, .btn-ternary:not(:disabled):not(.disabled).active:focus,
.show > .btn-ternary:dropdown-toggle:focus {
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
/*
#E26728 (base)
#B8521F (darker 1)
#9C461B (darker 2)
#803A16 (darker 3)
rgba(226, 103, 40, 0.5) (transparent)
.btn-border-radius{ border-radius: 10px !important; }
#00999E (base)
#007A7E (darker 1)
#006C70 (darker 2)
#005D61 (darker 3)
rgba(0, 153, 158, 0.5) (transparent)
*/
.btn-app-primary {
color: #fff !important;
background-color: #00999E;
border-color: #00999E; }
.btn-app-primary:hover {
color: #fff !important;
background-color: #007A7E;
border-color: #006C70; }
.btn-app-primary:focus, .btn-app-primary.focus {
color: #fff !important;
background-color: #007A7E;
border-color: #006C70;
box-shadow: 0 0 0 0.15rem rgba(0, 153, 158, 0.5); }
.btn-app-primary.disabled, .btn-app-primary:disabled {
color: #fff !important;
background-color: #00999E;
border-color: #00999E; }
.btn-app-primary:not(:disabled):not(.disabled):active, .btn-app-primary:not(:disabled):not(.disabled).active,
.show > .btn-app-primary.dropdown-toggle {
color: #fff !important;
background-color: #006C70;
border-color: #005D61; }
.btn-app-primary:not(:disabled):not(.disabled):active:focus, .btn-app-primary:not(:disabled):not(.disabled).active:focus,
.show > .btn-app-primary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.15rem rgba(0, 153, 158, 0.5); }
.btn-app-ternary {
color: #fff !important;
background-color: #E26728;
border-color: #E26728; }
.btn-app-ternary:hover {
color: #fff !important;
background-color: #B8521F;
border-color: #9C461B; }
.btn-app-ternary:focus, .btn-app-ternary.focus {
color: #fff !important;
background-color: #B8521F;
border-color: #9C461B;
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
.btn-app-ternary.disabled, .btn-app-ternary:disabled {
color: #fff !important;
background-color: #E26728;
border-color: #E26728; }
.btn-app-ternary:not(:disabled):not(.disabled):active, .btn-app-ternary:not(:disabled):not(.disabled).active,
.show > .btn-app-ternary.dropdown-toggle {
color: #fff !important;
background-color: #9C461B;
border-color: #803A16; }
.btn-app-ternary:not(:disabled):not(.disabled):active:focus, .btn-app-ternary:not(:disabled):not(.disabled).active:focus,
.show > .btn-app-ternary.dropdown-toggle:focus {
box-shadow: 0 0 0 0.15rem rgba(226, 103, 40, 0.5); }
.btn-border-radius{ border-radius: 10px !important; }
@ -728,7 +768,15 @@
</a>
</li>
<?php } ?>
<!-- Tickets -->
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(CLAIMS_TEAM_ID, user_team())) { ?>
<li>
<a id="tickets" href="<?= base_url('/ticketList?return_type=web') ?>" class="waves-effect img-inactive-not-working">
<img src="<?= base_url() . "public"; ?>/assets/images/user_manual_sb.png" alt="Logo" height="20">
<span>Tickets</span>
</a>
</li>
<?php } ?>
<!-- BDS -->
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) || in_array(POS_TEAM_ID, user_team()))) { ?>
<li>

View File

@ -51,7 +51,7 @@
}
.recard-scroll{
overflow-y:auto;
height:295px;
height:350px;
}
.maincard{
@ -62,6 +62,7 @@
.conversation-card,
.conversation-card .card-header,
.conversation-card .card-body {
background: #F5FFFF !important;
}
@ -78,6 +79,13 @@
overflow-y:auto;
box-shadow: 0 2px 4px 0 #00000040;
}
hr{
margin-top: 5px;
margin-bottom: 5px;
}
</style>
@ -192,33 +200,36 @@
<!-- Conversation Card -->
<div class="card mb-3 conversation-card">
<div class="card-header border-0">
<h5 class="mb-0" style="font-size:15px;">Conversation</h5>
<hr/>
<div class="card-header border-0 p-2 ">
<h5 class="mb-2" style="font-size:15px;">Conversation</h5>
<hr>
</div>
<div class="card-body pt-0 recard-scroll">
<div class="card-body pt-0 recard-scroll" style="padding-left: 15px !important;">
<?php if(!empty($notes)): ?>
<?php foreach($notes as $i => $conv): ?>
<!-- Top Row: Message + Badge -->
<div class="d-flex justify-content-between align-items-start">
<p class="mb-1 mr-4"><?= $conv['notes'] ?></p>
<!-- <?php if(!empty($conv['notes_by'])): ?>
<span class="badge bg-warning text-dark"><?= $conv['notes_by'] ?></span>
<?php endif; ?> -->
<?php if (!empty($conv['notes_type']) && $conv['notes_type'] === "Internal"): ?>
<span class="badge bg-warning text-dark"><?= $conv['notes_type'] ?></span>
<?php endif; ?>
</div>
<div class="d-flex justify-content-between align-items-start mb-2">
<div class="flex-grow-1 text-break">
<span class="mb-1 mr-4"><?= $conv['notes'] ?></span>
</div>
<?php if (!empty($conv['notes_type']) && $conv['notes_type'] === "Internal"): ?>
<div>
<span class="badge" style="background-color:#E26828 ;color: white!important;"><?= $conv['notes_type'] ?></span>
</div>
<?php endif; ?>
</div>
<!-- Bottom Row: Name + Date -->
<div class="d-flex justify-content-between small text-muted">
<div class="d-flex justify-content-between small text-muted mb-1">
<span><i class="mdi mdi-account"></i> <?= $conv['name'] ?></span>
<span><?= date("j F Y h:i a", strtotime($conv['created_at'])) ?></span>
</div>
<?php echo $i < count($notes)-1 ? '<hr/>' : ''; ?>
<?php echo $i < count($notes)-1 ? '<hr>' : ''; ?>
<?php endforeach; ?>
<?php else: ?>
@ -237,7 +248,7 @@
<input type="hidden" id="notes_by" name="notes_by" value="Staff">
<input type="hidden" id="created_by" name="created_by" value="<?= get_session_userid(); ?>">
<div class="notes-box">
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..."></textarea>
<textarea class="form-control" id="notes" name="notes" placeholder="Write your notes here..." required></textarea>
<div class="icon-buttons">
<!-- save btn means local - internal -->
<button type="button" class="btn-icon" onclick="submitConverstionTicket('Internal')"><i class="mdi mdi-content-save"></i></button>
@ -310,7 +321,7 @@
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-ternary btn-border-radius" onclick="submitTicket()">Save</button>
<button type="button" class="btn btn-app-ternary btn-border-radius" onclick="submitTicket()">Save</button>
</div>
</form>
</div>
@ -327,9 +338,17 @@
</div>
<div class="modal-body card-scroll" style="padding-top:5px!important;">
<?php if( !isset($related_tickets) || empty($related_tickets) ) { ?>
<div class="d-flex justify-content-center align-items-center">
<div>
<p> No Related Tickets Found </p>
</div>
</div>
<?php } ?>
<?php foreach($related_tickets as $j => $rt): ?>
<div class="card related-ticket-card mb-3">
<div class="card related-ticket-card mb-3" data-related-ticket-id="<?=$rt['thz_id']?>">
<div class="card-body" style="border-radius: 20px; padding:27px !important;">
<div class="d-flex justify-content-between align-items-start">
<h5 class="mb-1"><?php echo '# '.$rt['thz_id']." / ".$rt['ticket_type']; ?></h5>
@ -422,16 +441,16 @@
dataType: 'json',
success: function(response) {
if (response.status === "success") {
toastr.success(response.message, 'success');
toastr.success(response.message, 'Success');
$('#ticketModal').modal('hide');
form.reset();
window.location.href = "<?= base_url('ticketConversationList?return_type=web&thz_id=') ?>" + id;
} else {
toastr.error(response.message, 'error');
toastr.error(response.message, 'Error');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'error');
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
});
@ -444,6 +463,17 @@
document.getElementById("thz_id").value = urlParams.get('thz_id');
var id = urlParams.get('thz_id');
var form = document.getElementById("conversationForm");
// reset any old error styles
form.classList.remove('was-validated');
var notes = document.getElementById('notes').value.trim();
if (notes === "") {
toastr.warning('Please enter notes', 'Warning');
form.classList.add('was-validated');
return;
}
var formData = new FormData(form);
$.ajax({
@ -455,17 +485,32 @@
dataType: 'json',
success: function(response) {
if (response.status === "success") {
toastr.success(response.message, 'success');
toastr.success(response.message, 'Success');
form.reset();
window.location.href = "<?= base_url('ticketConversationList?return_type=web&thz_id=') ?>" + id;
} else {
toastr.error(response.message, 'error');
toastr.error(response.message, 'Error');
}
},
error: function(xhr) {
toastr.error("Something went wrong!", 'error');
toastr.error("Something went wrong!", 'Error');
console.error(xhr.responseText);
}
});
}
</script>
<script>
$(document).ready(function(){
// attach click event to the div
$(document).on('click', '.related-ticket-card', function(){
let relatedId = $(this).data('related-ticket-id');
console.log("Related Ticket ID:", relatedId);
window.open("<?php echo base_url('/ticketConversationList?return_type=web&thz_id=')?>"+relatedId,"_blank");
});
});
</script>