1403 lines
88 KiB
PHP
1403 lines
88 KiB
PHP
<style>
|
|
.bg-staff { background-color: #FFF5E5; }
|
|
.label-font-size { font-size: 0.875rem; }
|
|
.readonly-color { background-color: #e0e0e0; color: #666; }
|
|
.readonly-select { pointer-events: none; background-color: #f0f0f0; color: #666; }
|
|
.nav-pills, .nav-link { background-color: #F5FFFF !important; color: #00999E !important; border-radius: 10px; }
|
|
.nav-pills { background-color: #F5FFFF !important; color: #00999E !important; box-shadow: 0px 2px 4px 0px #00000040; padding-top: 5px; }
|
|
.nav-link.active-tab { color: white !important; background-color: #00999E !important; font-size: small !important; padding: 8px 16px; border-radius: 10px !important; box-shadow: 0px 2px 4px 0px #00000040; }
|
|
.is-invalid { border-color: #dc3545 !important; }
|
|
.invalid-feedback { display: none; color: #dc3545; font-size: 0.8rem; margin-top: 2px; }
|
|
.is-invalid ~ .invalid-feedback, .is-invalid + .invalid-feedback { display: block; }
|
|
.select2-container .select2-selection--single.is-invalid-select2 { border-color: #dc3545 !important; }
|
|
.jodit-container .jodit-wysiwyg, .jodit-container .jodit-wysiwyg * { color: #000 !important; background-color: #fff !important; }
|
|
</style>
|
|
|
|
<script>
|
|
var base_url = '<?= base_url() ?>';
|
|
var pageHideMainNavTitle = true;
|
|
var pageTitle = 'Non-EB Claims';
|
|
var pageBackButton = '<a href="<?= base_url("non-eb-claim/list") ?>" class="topbar-icon-btn" data-toggle="tooltip" data-placement="top" title="Back" aria-label="Back to list"><i class="ri-arrow-left-s-line"></i></a>';
|
|
</script>
|
|
|
|
<?php
|
|
$td = $ticket_data ?? [];
|
|
$sections = $visible_sections ?? [];
|
|
|
|
// Ensure policy dates display as DD-MM-YYYY regardless of stored format
|
|
foreach (['policy_start_date', 'policy_end_date'] as $_df) {
|
|
if (!empty($td[$_df]) && preg_match('/^\d{4}-\d{2}-\d{2}/', $td[$_df])) {
|
|
$td[$_df] = date('d-m-Y', strtotime($td[$_df]));
|
|
}
|
|
}
|
|
?>
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card" style="margin-right: 23px;">
|
|
<div class="card-body">
|
|
|
|
<!-- Navigation Tabs -->
|
|
<div class="tab-wrapper position-relative">
|
|
<ul class="nav nav-pills navtab-bg" id="myTab">
|
|
<li class="nav-item d-flex justify-content-center align-items-center">
|
|
<button class="scroll-btn left-btn" type="button">◀</button>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#general-tab" data-toggle="tab" class="nav-link px-3 py-2 active label-font-size" id="general_tab" aria-expanded="true">
|
|
<i class="mdi mdi-ticket-account"></i>
|
|
<span class="d-none d-sm-inline-block">General</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#reply-tab" data-toggle="tab" class="nav-link px-3 py-2 label-font-size" id="reply_tab" aria-expanded="false">
|
|
<i class="mdi mdi-message-processing"></i>
|
|
<span class="d-none d-sm-inline-block">Reply</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#note-tab" data-toggle="tab" class="nav-link px-3 py-2 label-font-size" id="note_tab" aria-expanded="false">
|
|
<i class="mdi mdi-note-text"></i>
|
|
<span class="d-none d-sm-inline-block">Notes</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#history-tab" data-toggle="tab" class="nav-link px-3 py-2 label-font-size" id="history_tab" aria-expanded="false">
|
|
<i class="mdi mdi-history"></i>
|
|
<span class="d-none d-sm-inline-block">History</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="#claimfiles-tab" data-toggle="tab" class="nav-link px-3 py-2 label-font-size" id="claimfiles_tab" aria-expanded="false">
|
|
<i class="mdi mdi-file mr-1"></i>
|
|
<span class="d-none d-sm-inline-block">Claim Files</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item d-flex justify-content-center align-items-center">
|
|
<button class="scroll-btn right-btn" type="button">▶</button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Tab Content -->
|
|
<div class="tab-content">
|
|
|
|
<!-- ==================== GENERAL TAB ==================== -->
|
|
<div class="tab-pane fade show active" id="general-tab">
|
|
<form id="nonEbClaimForm" onsubmit="return false;" enctype="multipart/form-data">
|
|
<input type="hidden" name="ticket_master_id" id="ticket_master_id" value="<?= $td['id'] ?? '' ?>">
|
|
<input type="hidden" name="policy_type_id" id="policy_type_id" value="<?= $td['policy_type_id'] ?? '' ?>">
|
|
<input type="hidden" name="client_id" id="client_id" value="<?= $td['client_id'] ?? '' ?>">
|
|
<input type="hidden" name="insurer_id" id="insurer_id" value="<?= $td['insurer_id'] ?? '' ?>">
|
|
<input type="hidden" name="client_policy_id" id="client_policy_id_hidden" value="<?= $td['client_policy_id'] ?? '' ?>">
|
|
<input type="hidden" name="branch_id" value="<?= $td['branch_id'] ?? '' ?>">
|
|
<input type="hidden" name="acm_id" value="<?= $td['acm_id'] ?? '' ?>">
|
|
|
|
<!-- Section 1: Policy & Account Details (read-only) -->
|
|
<div id="accordion1" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Policy & Account Details
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseOne" class="collapse show" data-parent="#accordion1">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Client</label>
|
|
<input type="text" class="form-control readonly-color" value="<?= esc($td['client_name'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Branch</label>
|
|
<input type="text" class="form-control readonly-color" value="<?= esc($td['branch_name'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Policy</label>
|
|
<input type="text" class="form-control readonly-color" value="<?= esc(($td['policy_type_name'] ?? '') . ($td['policy_no'] ? ' - ' . $td['policy_no'] : '')) ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Insurer</label>
|
|
<input type="text" class="form-control readonly-color" value="<?= esc($td['insurer_name'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Policy Type</label>
|
|
<input type="text" class="form-control readonly-color" name="policy_type_name" value="<?= esc($td['policy_type_name'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Policy No</label>
|
|
<input type="text" class="form-control readonly-color" name="policy_no" value="<?= esc($td['policy_no'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Policy Start Date</label>
|
|
<input type="text" class="form-control readonly-color" name="policy_start_date" value="<?= esc($td['policy_start_date'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Policy Expiry Date</label>
|
|
<input type="text" class="form-control readonly-color" name="policy_end_date" value="<?= esc($td['policy_end_date'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Account Manager</label>
|
|
<input type="text" class="form-control readonly-color" value="<?= esc($td['acm'] ?? '') ?>" readonly>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 2: Insured Contact Details (read-only) -->
|
|
<div id="accordion2" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Insured Contact Details
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseTwo" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseTwo" class="collapse show" data-parent="#accordion2">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Contact Name</label>
|
|
<input type="text" class="form-control readonly-color" name="insured_contact_name" value="<?= esc($td['insured_contact_name'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Contact Number</label>
|
|
<input type="text" class="form-control readonly-color" name="insured_contact_number" value="<?= esc($td['insured_contact_number'] ?? '') ?>" readonly>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Contact Email</label>
|
|
<input type="text" class="form-control readonly-color" name="insured_contact_email" value="<?= esc($td['insured_contact_email'] ?? '') ?>" readonly>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 3: Loss / Incident Details -->
|
|
<div id="accordion3" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Loss / Incident Details
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseThree" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseThree" class="collapse show" data-parent="#accordion3">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Nature of Loss <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="nature_of_loss" id="nature_of_loss" minlength="3" required value="<?= $td['nature_of_loss'] ?? '' ?>">
|
|
<div class="invalid-feedback">Required. Min 3 characters.</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Loss Location <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="loss_location" id="loss_location" required value="<?= $td['loss_location'] ?? '' ?>">
|
|
<div class="invalid-feedback">Loss Location is required.</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Loss Date <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control date-picker" name="loss_date" id="loss_date" required placeholder="dd-mm-yyyy" value="<?= $td['loss_date'] ?? '' ?>">
|
|
<div class="invalid-feedback">Loss Date is required.</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Loss Estimate</label>
|
|
<input type="number" class="form-control" name="loss_estimate" id="loss_estimate" step="0.01" min="0" value="<?= $td['loss_estimate'] ?? '' ?>">
|
|
<div class="invalid-feedback">Must be a valid number.</div>
|
|
</div>
|
|
<div class="form-group col-md-8">
|
|
<label class="label-font-size">Loss Description</label>
|
|
<textarea class="form-control" name="loss_description" id="loss_description" rows="2"><?= $td['loss_description'] ?? '' ?></textarea>
|
|
<div class="invalid-feedback">Loss Description is required when uploading an asset file.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 4: Intimation & Claim Reference -->
|
|
<div id="accordion4" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Intimation & Claim Reference
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseFour" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseFour" class="collapse show" data-parent="#accordion4">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Intimation Recd Date</label>
|
|
<input type="text" class="form-control date-picker" name="intimation_recd_date" placeholder="dd-mm-yyyy" value="<?= $td['intimation_recd_date'] ?? '' ?>">
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Intimated to Insurer Date</label>
|
|
<input type="text" class="form-control date-picker" name="intimated_to_insurer_date" placeholder="dd-mm-yyyy" value="<?= $td['intimated_to_insurer_date'] ?? '' ?>">
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Nhance Claim Ref No</label>
|
|
<input type="text" class="form-control" name="nhance_claim_ref_no" id="nhance_claim_ref_no" maxlength="100" value="<?= $td['nhance_claim_ref_no'] ?? '' ?>">
|
|
<div class="invalid-feedback">Max 100 characters.</div>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label class="label-font-size">Claim Number (Insurer)</label>
|
|
<input type="text" class="form-control" name="claim_number" id="claim_number" pattern="^[a-zA-Z0-9\/_-]+$" value="<?= $td['claim_number'] ?? '' ?>">
|
|
<div class="invalid-feedback">Only letters, numbers, /, - allowed.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 5: Status & Tracking -->
|
|
<div id="accordion5" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Status & Tracking
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseFive" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseFive" class="collapse show" data-parent="#accordion5">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Status <span class="text-danger">*</span></label>
|
|
<select class="form-control" name="claim_status_id" id="claim_status_id" required>
|
|
<?php if(isset($claim_status)): foreach($claim_status as $cs): ?>
|
|
<option value="<?= $cs['id'] ?>" <?= ($td['claim_status_id'] ?? '') == $cs['id'] ? 'selected' : '' ?>><?= $cs['claim_status'] ?></option>
|
|
<?php endforeach; endif; ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Surveyor File Ref No</label>
|
|
<input type="text" class="form-control" name="surveyor_file_ref_no" value="<?= $td['surveyor_file_ref_no'] ?? '' ?>">
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label class="label-font-size">Priority</label>
|
|
<select class="form-control" name="priority">
|
|
<option value="">Select Priority</option>
|
|
<?php if(isset($priorityType)): foreach($priorityType as $k => $v): ?>
|
|
<option value="<?= $k ?>" <?= ($td['priority'] ?? '') == $k ? 'selected' : '' ?>><?= $v ?></option>
|
|
<?php endforeach; endif; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<!-- Closure Remark: shown for Claim Closed / Rejected / Withdrawn -->
|
|
<div id="closure_remark_row" class="form-row" style="display:none;">
|
|
<div class="form-group col-md-9">
|
|
<label class="label-font-size">Closure Remark</label>
|
|
<textarea class="form-control" name="closure_remark" id="closure_remark" rows="2" placeholder="Enter closure remark..."><?= esc($td['closure_remark'] ?? '') ?></textarea>
|
|
</div>
|
|
<div class="form-group col-md-3 d-flex align-items-end pb-2">
|
|
<div class="custom-control custom-switch">
|
|
<input type="checkbox" class="custom-control-input" id="remark_mode" name="remark_mode" value="append">
|
|
<label class="custom-control-label label-font-size" for="remark_mode">Append to existing</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 6: Asset Details -->
|
|
<div id="accordion6" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Asset Details
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseSix" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseSix" class="collapse show" data-parent="#accordion6">
|
|
<div class="card-body">
|
|
<div id="asset_container">
|
|
<?php if (!empty($assets_data)): $ai = 0; foreach($assets_data as $asset): $ai++; ?>
|
|
<div class="form-row asset-row" id="asset_row_<?= $ai ?>">
|
|
<div class="form-group col-md-3"><label class="label-font-size">Asset ID/Code</label><input type="text" class="form-control" name="asset_id_code[]" value="<?= $asset['asset_id_code'] ?? '' ?>"></div>
|
|
<div class="form-group col-md-2"><label class="label-font-size">Serial No</label><input type="text" class="form-control" name="serial_no[]" value="<?= $asset['serial_no'] ?? '' ?>"></div>
|
|
<div class="form-group col-md-2"><label class="label-font-size">Vehicle No</label><input type="text" class="form-control" name="vehicle_no[]" value="<?= $asset['vehicle_no'] ?? '' ?>"></div>
|
|
<div class="form-group col-md-4"><label class="label-font-size">Description</label><input type="text" class="form-control" name="asset_description[]" value="<?= $asset['asset_description'] ?? '' ?>"></div>
|
|
<div class="form-group col-md-1 d-flex align-items-end">
|
|
<?php if($ai > 1): ?><button type="button" class="btn btn-danger btn-sm" onclick="removeAssetRow(<?= $ai ?>)"><i class="mdi mdi-delete"></i></button><?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; else: ?>
|
|
<div class="form-row asset-row" id="asset_row_1">
|
|
<div class="form-group col-md-3"><label class="label-font-size">Asset ID/Code</label><input type="text" class="form-control" name="asset_id_code[]"></div>
|
|
<div class="form-group col-md-2"><label class="label-font-size">Serial No</label><input type="text" class="form-control" name="serial_no[]"></div>
|
|
<div class="form-group col-md-2"><label class="label-font-size">Vehicle No</label><input type="text" class="form-control" name="vehicle_no[]"></div>
|
|
<div class="form-group col-md-4"><label class="label-font-size">Description</label><input type="text" class="form-control" name="asset_description[]"></div>
|
|
<div class="form-group col-md-1 d-flex align-items-end"><span></span></div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<button type="button" class="btn btn-sm btn-info mt-2" onclick="addAssetRow()"><i class="mdi mdi-plus"></i> Add More Asset</button>
|
|
|
|
<!-- OR Divider -->
|
|
<div class="d-flex align-items-center my-3">
|
|
<hr class="flex-grow-1" style="border-top: 1px solid #aaa;">
|
|
<span class="mx-3 font-weight-bold text-muted" style="font-size: 0.9rem;">OR</span>
|
|
<hr class="flex-grow-1" style="border-top: 1px solid #aaa;">
|
|
</div>
|
|
|
|
<!-- Asset File Upload -->
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label class="label-font-size">Upload Asset File <small class="text-muted">(Excel or PDF)</small></label>
|
|
<input type="file" class="form-control-file" name="asset_file" id="asset_file" accept=".xlsx,.xls,.csv,.pdf">
|
|
<div class="invalid-feedback">Only Excel (.xlsx, .xls, .csv) or PDF (.pdf) files allowed.</div>
|
|
<?php if (!empty($td['asset_file'])): ?>
|
|
<small class="text-info mt-1 d-block">Current file: <strong><?= esc($td['asset_file']) ?></strong></small>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<div id="asset_section_error" class="text-danger" style="display:none; font-size:0.85rem;">Please fill at least one asset row or upload an asset file.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Section 7: Surveyor Details -->
|
|
<div id="section_surveyor" class="mb-3" style="<?= in_array('surveyor', $sections) ? '' : 'display:none' ?>">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Surveyor Details
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseSeven" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseSeven" class="collapse show" data-parent="#section_surveyor">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3"><label class="label-font-size">Surveyor Name</label><input type="text" class="form-control" name="surveyor_name" maxlength="255" value="<?= $td['surveyor_name'] ?? '' ?>"></div>
|
|
<div class="form-group col-md-3"><label class="label-font-size">Contact Person</label><input type="text" class="form-control" name="surveyor_contact_person" maxlength="255" value="<?= $td['surveyor_contact_person'] ?? '' ?>"></div>
|
|
<div class="form-group col-md-3"><label class="label-font-size">Contact Number</label><input type="text" class="form-control" name="surveyor_contact_number" minlength="10" maxlength="15" pattern="^[0-9]+$" value="<?= $td['surveyor_contact_number'] ?? '' ?>"><div class="invalid-feedback">10-15 digits, numeric only.</div></div>
|
|
<div class="form-group col-md-3"><label class="label-font-size">Email</label><input type="email" class="form-control" name="surveyor_email" value="<?= $td['surveyor_email'] ?? '' ?>"><div class="invalid-feedback">Invalid email format.</div></div>
|
|
<div class="form-group col-md-6"><label class="label-font-size">LOR</label><textarea class="form-control" name="lor" rows="2"><?= $td['lor'] ?? '' ?></textarea></div>
|
|
<div class="form-group col-md-6"><label class="label-font-size">Surveyor Remarks</label><textarea class="form-control" name="surveyor_remarks" rows="2"><?= $td['surveyor_remarks'] ?? '' ?></textarea></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php /* Section 8: Documents & Attachments — commented out, moved to Claim Files tab
|
|
<div id="accordion8" class="mb-3">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Documents & Attachments
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseEight" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseEight" class="collapse show" data-parent="#accordion8">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12"><label class="label-font-size">Google Drive Links</label><textarea class="form-control" name="google_drive_links" rows="2"><?= $td['google_drive_links'] ?? '' ?></textarea></div>
|
|
<div class="form-group col-md-6"><label class="label-font-size">Documents Required</label><textarea class="form-control" name="documents_required" rows="2"><?= $td['documents_required'] ?? '' ?></textarea></div>
|
|
<div class="form-group col-md-6"><label class="label-font-size">Documents Submitted</label><textarea class="form-control" name="documents_submitted" rows="2"><?= $td['documents_submitted'] ?? '' ?></textarea></div>
|
|
<div class="form-group col-md-6"><label class="label-font-size">Pending Documents</label><textarea class="form-control" name="pending_documents" rows="2"><?= $td['pending_documents'] ?? '' ?></textarea></div>
|
|
<div class="form-group col-md-3"><label class="label-font-size">ETA for Documents</label><input type="text" class="form-control date-picker" name="eta_for_documents" placeholder="dd-mm-yyyy" value="<?= $td['eta_for_documents'] ?? '' ?>"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
*/ ?>
|
|
|
|
<!-- Section 9: Settlement Details -->
|
|
<div id="section_settlement" class="mb-3" style="<?= in_array('settlement', $sections) ? '' : 'display:none' ?>">
|
|
<div class="card mb-1">
|
|
<h4 class="m-1">
|
|
Settlement Details
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#collapseNine" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
|
</a>
|
|
</h4>
|
|
<div id="collapseNine" class="collapse show" data-parent="#section_settlement">
|
|
<div class="card-body">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4"><label class="label-font-size">Loss Assessed Value</label><input type="number" class="form-control" name="loss_assessed_value" step="0.01" min="0" value="<?= $td['loss_assessed_value'] ?? '' ?>"><div class="invalid-feedback">Must be a valid number.</div></div>
|
|
<div class="form-group col-md-4"><label class="label-font-size">Settled Amount</label><input type="number" class="form-control" name="settled_amount" step="0.01" min="0" value="<?= $td['settled_amount'] ?? '' ?>"><div class="invalid-feedback">Must be a valid number.</div></div>
|
|
<div class="form-group col-md-4"><label class="label-font-size">Settlement UTR</label><input type="text" class="form-control" name="settlement_utr" maxlength="100" value="<?= $td['settlement_utr'] ?? '' ?>"><div class="invalid-feedback">Max 100 characters.</div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-right mt-3">
|
|
<button type="button" class="btn btn-primary" onclick="submitNonEbClaim()">Update Claim</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- ==================== REPLY TAB ==================== -->
|
|
<div class="tab-pane fade" id="reply-tab">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card-body">
|
|
<form role="form" method="post" id="ticket_reply_form" enctype="multipart/form-data">
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="emp_mail_for_to">To</label>
|
|
<input type="text" value="<?= $td['insured_contact_email'] ?? '' ?>" class="form-control" id="emp_mail_for_to" name="emp_mail" placeholder="Recipient email" readonly>
|
|
</div>
|
|
<div class="form-group col-md-8">
|
|
<label for="mail_subject">Subject</label>
|
|
<input type="text" class="form-control" value="<?= isset($reply_data['subject']) ? $reply_data['subject'] : '' ?>" id="mail_subject" name="mail_subject" placeholder="Mail subject">
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<div class="form-row" id="rac_rate_dropdown">
|
|
<div class="form-group col-md-12">
|
|
<select id="ticket_mail_customButton" class="form-control" style="border:none;right:6px;width:auto;position:absolute;z-index:1;top:17px;height:32px;float:right;">
|
|
<option value="">PlaceHolders</option>
|
|
<?php foreach ($placeHolders as $key => $value): ?>
|
|
<?php $valueChange = ucwords(str_replace('_', ' ', $value)); ?>
|
|
<option value="<?= $key ?>"><?= $valueChange ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" id="claim_status" name="claim_status" value="<?= $td['claim_status_id'] ?? '' ?>">
|
|
</div>
|
|
<div class="form-group text-right">
|
|
<button type="submit" class="btn btn-primary" id="ticket_reply_submit">Send Mail</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ==================== NOTES TAB ==================== -->
|
|
<div class="tab-pane fade" id="note-tab">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card-body">
|
|
<form role="form" 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"></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">Save</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ==================== HISTORY TAB ==================== -->
|
|
<div class="tab-pane fade" id="history-tab">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table data-custom-table-css="table" id="history-datatable" class="table w-100">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th>Label</th>
|
|
<th>Change</th>
|
|
<th>User</th>
|
|
<th>Date/Time</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (isset($ticket_history)): foreach($ticket_history as $row): ?>
|
|
<tr>
|
|
<td><?= $row['display_name'] ?></td>
|
|
<td><?= $row['old_value'] . ' => ' . $row['new_value'] ?></td>
|
|
<td><?= !empty($row['modified_by']) ? $row['modified_by'] : 'Created by employee' ?> <?= ($row['updated_by'] ?? '') == '0' ? '(API)' : '' ?></td>
|
|
<td><?= date("d-m-Y h:i:s A", strtotime($row['created_at'])) ?></td>
|
|
</tr>
|
|
<?php endforeach; endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ==================== CLAIM FILES TAB ==================== -->
|
|
<div class="tab-pane fade" id="claimfiles-tab">
|
|
|
|
<!-- IR Documents Checklist -->
|
|
<div id="required_id_docs_div" class="card">
|
|
<div class="card-body" style="background-color: #F5FFFF !important; border-radius: 10px; box-shadow: 0px 4px 4px 0px #00000040;">
|
|
<div class="form-group">
|
|
<div class="row mb-3 align-items-center">
|
|
<div class="col-md-6"><h5 class="mb-0"><strong>IR Documents</strong></h5></div>
|
|
<div class="col-md-6 text-right">
|
|
<div class="d-inline-block mr-3">
|
|
<div class="custom-control custom-switch d-inline-block">
|
|
<input type="checkbox" class="custom-control-input" id="noneb_action_freeze_switch" onchange="nonebToggleActionFreeze()">
|
|
<label class="custom-control-label" for="noneb_action_freeze_switch"><strong>Freeze User Actions</strong></label>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn btn-success waves-effect waves-light" onclick="nonebSaveIRDocs()">Save</button>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-12">
|
|
<div class="form-row mb-2">
|
|
<div class="col-md-7"><strong>Document Name</strong></div>
|
|
<div class="col-md-3"><strong>Status</strong></div>
|
|
<div class="col-md-2 text-center"><strong>Action</strong></div>
|
|
</div>
|
|
<div id="noneb-document-list-container"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- File Upload -->
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div id="noneb_files_accordion" class="mb-3">
|
|
<div class="card mb-1" style="background-color: #F5FFFF !important; border-radius: 10px; box-shadow: 0px 4px 4px 0px #00000040;">
|
|
<h5 class="m-1">
|
|
<a class="text-dark float-right" data-toggle="collapse" href="#nonebCollapseFiles" aria-expanded="true">
|
|
<i class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;color:black;"></i>
|
|
</a>
|
|
</h5>
|
|
<div id="nonebCollapseFiles" class="collapse show" data-parent="#noneb_files_accordion">
|
|
<div class="card-body">
|
|
<form id="noneb_file_upload_form" method="post" enctype="multipart/form-data">
|
|
<input type="hidden" id="noneb_ticket_id_url" name="ticket_id_url">
|
|
<div class="form-group">
|
|
<div id="noneb-dynamic-form-container">
|
|
<div align="right">
|
|
<a id="noneb-toggle-upload-btn" class="btn btn-info waves-effect waves-light mr-1" onclick="nonebToggleUploadType(this)">File Upload</a>
|
|
<a class="btn btn-primary waves-effect waves-light" id="noneb_add_btn" onclick="nonebAddHTMLInput(this)">+ Add</a>
|
|
</div>
|
|
</div>
|
|
<div class="form-group text-right m-b-0 mt-2">
|
|
<button type="submit" class="btn btn-primary waves-effect waves-light">Save</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- File List -->
|
|
<div id="noneb_file_table" class="card">
|
|
<div class="card-body" style="background-color: #F5FFFF !important; border-radius: 10px; box-shadow: 0px 4px 4px 0px #00000040;">
|
|
<div class="row" style="padding-bottom: 10px;">
|
|
<div class="col-6" style="align-self: center;"><h4>File List</h4></div>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table data-custom-table-css="table" id="noneb-file-list-table" class="table w-100 nowrap">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th class="text-center">S.No</th>
|
|
<th>Docs Name</th>
|
|
<th>File Name</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="noneb_file_table_bd"></tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Edit URL Modal -->
|
|
<div class="modal fade" id="noneb_edit_url_modal" tabindex="-1" role="dialog" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<form id="noneb_edit_url_form">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Edit URL</h5>
|
|
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<input type="hidden" id="noneb_edit_url_id" name="id">
|
|
<div class="form-group">
|
|
<label>Document Name</label>
|
|
<input type="text" class="form-control" id="noneb_edit_doc_name" name="doc_name">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>URL</label>
|
|
<input type="text" class="form-control" id="noneb_edit_url_link" name="url">
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="submit" class="btn btn-primary">Save Changes</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div><!-- end tab-content -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Conversation Section -->
|
|
<div id="ticket_conversation_div">
|
|
<div id="ticket_messages_div">
|
|
<?php $messages = $message_data['messages'] ?? [];
|
|
foreach ($messages as $message): ?>
|
|
<?php if ($message['sender'] == 'user'): ?>
|
|
<div class="card mb-3" style="margin-right: 23px;">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-xl-2 col-lg-3">
|
|
<div class="text-center">
|
|
<div style="padding-left:10px;" class="mb-3">
|
|
<div class="row">
|
|
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/user.jpg" class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width:70px">
|
|
<div style="padding-left:10px;padding-top:15px;" class="col-mb-6"><?= $message_data['insured_name'] ?? '' ?></div>
|
|
</div>
|
|
<span style="text-align:center;position:relative;bottom:28px;left:15px;" class="badge badge-dark">User</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col">
|
|
<div class="mb-3"><div class="text-muted"><i class="mdi mdi-calendar-blank"></i> <?= (new DateTime($message['created_at']))->format('j F Y h:i A') ?></div></div>
|
|
<div class="form-group"><p><?= $message['mail_content'] ?></p></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="card mb-3 bg-staff" style="margin-right: 23px;">
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-xl-2 col-lg-3">
|
|
<div class="text-center">
|
|
<div style="padding-left:10px;" class="mb-3">
|
|
<div class="row">
|
|
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg" class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width:70px">
|
|
<div style="padding-left:10px;padding-top:15px;" class="col-mb-6"><?= $message['user_name'] ?? 'Auto Mail' ?></div>
|
|
</div>
|
|
<span style="text-align:center;position:relative;bottom:28px;left:15px;" class="badge badge-primary">Staff</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col">
|
|
<div class="mb-3"><div class="text-muted"><i class="mdi mdi-calendar-blank"></i> <?= (new DateTime($message['created_at']))->format('j F Y h:i A') ?></div></div>
|
|
<div class="form-group"><p><?= $message['mail_content'] ?></p></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; endforeach; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Asset add/remove
|
|
var assetIndex = <?= !empty($assets_data) ? count($assets_data) : 1 ?>;
|
|
function addAssetRow() {
|
|
assetIndex++;
|
|
var html = '<div class="form-row asset-row" id="asset_row_'+assetIndex+'">' +
|
|
'<div class="form-group col-md-3"><input type="text" class="form-control" name="asset_id_code[]" placeholder="Asset ID/Code"></div>' +
|
|
'<div class="form-group col-md-2"><input type="text" class="form-control" name="serial_no[]" placeholder="Serial No"></div>' +
|
|
'<div class="form-group col-md-2"><input type="text" class="form-control" name="vehicle_no[]" placeholder="Vehicle No"></div>' +
|
|
'<div class="form-group col-md-4"><input type="text" class="form-control" name="asset_description[]" placeholder="Description"></div>' +
|
|
'<div class="form-group col-md-1 d-flex align-items-end"><button type="button" class="btn btn-danger btn-sm" onclick="removeAssetRow('+assetIndex+')"><i class="mdi mdi-delete"></i></button></div>' +
|
|
'</div>';
|
|
$('#asset_container').append(html);
|
|
}
|
|
function removeAssetRow(idx) { $('#asset_row_' + idx).remove(); }
|
|
|
|
// Clear all validation states
|
|
function clearValidation() {
|
|
$('#nonEbClaimForm .is-invalid').removeClass('is-invalid');
|
|
$('#nonEbClaimForm .is-invalid-select2').removeClass('is-invalid-select2');
|
|
}
|
|
|
|
// Mark field invalid
|
|
function setInvalid(field, msg) {
|
|
var $el = $(field);
|
|
$el.addClass('is-invalid');
|
|
if (msg) {
|
|
var $fb = $el.siblings('.invalid-feedback');
|
|
if ($fb.length) $fb.text(msg);
|
|
}
|
|
}
|
|
|
|
// Validate form - returns true if valid
|
|
function validateNonEbForm() {
|
|
clearValidation();
|
|
var errors = [];
|
|
var firstInvalid = null;
|
|
|
|
function markError(selector, msg) {
|
|
var $el = $(selector);
|
|
if ($el.length) {
|
|
$el.addClass('is-invalid');
|
|
var $fb = $el.siblings('.invalid-feedback');
|
|
if ($fb.length) $fb.text(msg);
|
|
}
|
|
errors.push(msg);
|
|
if (!firstInvalid) firstInvalid = $el;
|
|
}
|
|
|
|
function markSelect2Error(selector, msg) {
|
|
var $el = $(selector);
|
|
$el.next('.select2-container').find('.select2-selection').addClass('is-invalid-select2');
|
|
errors.push(msg);
|
|
if (!firstInvalid) firstInvalid = $el;
|
|
}
|
|
|
|
// Status
|
|
if (!$('#claim_status_id').val()) { markError('#claim_status_id', 'Status is required.'); }
|
|
|
|
// Nature of Loss
|
|
var natureOfLoss = $.trim($('input[name="nature_of_loss"]').val());
|
|
if (!natureOfLoss) {
|
|
markError('input[name="nature_of_loss"]', 'Nature of Loss is required.');
|
|
} else if (natureOfLoss.length < 3) {
|
|
markError('input[name="nature_of_loss"]', 'Min 3 characters.');
|
|
}
|
|
|
|
// Loss Location
|
|
if (!$.trim($('input[name="loss_location"]').val())) {
|
|
markError('input[name="loss_location"]', 'Loss Location is required.');
|
|
}
|
|
|
|
// Loss Date
|
|
if (!$.trim($('input[name="loss_date"]').val())) {
|
|
markError('input[name="loss_date"]', 'Loss Date is required.');
|
|
}
|
|
|
|
// Loss Estimate - optional, numeric
|
|
var lossEst = $.trim($('input[name="loss_estimate"]').val());
|
|
if (lossEst && isNaN(lossEst)) { markError('input[name="loss_estimate"]', 'Must be a valid number.'); }
|
|
|
|
// Claim Number - optional, pattern
|
|
var claimNum = $.trim($('input[name="claim_number"]').val());
|
|
if (claimNum && !/^[a-zA-Z0-9\/_-]+$/.test(claimNum)) {
|
|
markError('input[name="claim_number"]', 'Only letters, numbers, /, - allowed.');
|
|
}
|
|
|
|
// Nhance Ref No - optional, max 100
|
|
var nhanceRef = $.trim($('input[name="nhance_claim_ref_no"]').val());
|
|
if (nhanceRef && nhanceRef.length > 100) { markError('input[name="nhance_claim_ref_no"]', 'Max 100 characters.'); }
|
|
|
|
// Surveyor fields (only if section visible)
|
|
if ($('#section_surveyor').is(':visible')) {
|
|
var survContactNum = $.trim($('input[name="surveyor_contact_number"]').val());
|
|
if (survContactNum) {
|
|
if (!/^[0-9]+$/.test(survContactNum)) {
|
|
markError('input[name="surveyor_contact_number"]', 'Must be numeric only.');
|
|
} else if (survContactNum.length < 10 || survContactNum.length > 15) {
|
|
markError('input[name="surveyor_contact_number"]', 'Must be 10-15 digits.');
|
|
}
|
|
}
|
|
var survEmail = $.trim($('input[name="surveyor_email"]').val());
|
|
if (survEmail && !/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(survEmail)) {
|
|
markError('input[name="surveyor_email"]', 'Invalid email format.');
|
|
}
|
|
}
|
|
|
|
// Settlement fields (only if section visible)
|
|
if ($('#section_settlement').is(':visible')) {
|
|
var lossAssessed = $.trim($('input[name="loss_assessed_value"]').val());
|
|
if (lossAssessed && isNaN(lossAssessed)) { markError('input[name="loss_assessed_value"]', 'Must be a valid number.'); }
|
|
var settledAmt = $.trim($('input[name="settled_amount"]').val());
|
|
if (settledAmt && isNaN(settledAmt)) { markError('input[name="settled_amount"]', 'Must be a valid number.'); }
|
|
var settlementUtr = $.trim($('input[name="settlement_utr"]').val());
|
|
if (settlementUtr && settlementUtr.length > 100) { markError('input[name="settlement_utr"]', 'Max 100 characters.'); }
|
|
}
|
|
|
|
// Asset: at least one filled row OR file uploaded
|
|
var hasAssetRow = false;
|
|
$('.asset-row').each(function() {
|
|
$(this).find('input').each(function() {
|
|
if ($.trim($(this).val())) { hasAssetRow = true; return false; }
|
|
});
|
|
if (hasAssetRow) return false;
|
|
});
|
|
var assetFile = $('#asset_file')[0].files.length > 0;
|
|
if (assetFile) {
|
|
var fileName = $('#asset_file')[0].files[0].name.toLowerCase();
|
|
var allowedExts = ['.xlsx', '.xls', '.csv', '.pdf'];
|
|
var validExt = allowedExts.some(function(ext) { return fileName.endsWith(ext); });
|
|
if (!validExt) {
|
|
markError('#asset_file', 'Only Excel (.xlsx, .xls, .csv) or PDF (.pdf) files allowed.');
|
|
assetFile = false;
|
|
} else if (!$.trim($('textarea[name="loss_description"]').val())) {
|
|
markError('textarea[name="loss_description"]', 'Loss Description is required when uploading an asset file.');
|
|
}
|
|
}
|
|
if (!hasAssetRow && !assetFile) {
|
|
$('#asset_section_error').show();
|
|
errors.push('Please fill at least one asset row or upload an asset file.');
|
|
if (!firstInvalid) firstInvalid = $('#asset_container');
|
|
} else {
|
|
$('#asset_section_error').hide();
|
|
}
|
|
|
|
// Show errors & scroll to first invalid
|
|
if (errors.length > 0) {
|
|
errors.forEach(function(e) { toastr.error(e); });
|
|
if (firstInvalid && firstInvalid.length) {
|
|
var $collapse = firstInvalid.closest('.collapse');
|
|
if ($collapse.length && !$collapse.hasClass('show')) { $collapse.collapse('show'); }
|
|
$('html, body').animate({ scrollTop: firstInvalid.offset().top - 100 }, 300);
|
|
firstInvalid.focus();
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
var closureRemarkStatuses = ['Claim Closed', 'Claim Rejected', 'Claim Withdrawn'];
|
|
function toggleClosureRemark() {
|
|
var selectedText = $('#claim_status_id option:selected').text().trim();
|
|
if (closureRemarkStatuses.indexOf(selectedText) !== -1) {
|
|
$('#closure_remark_row').show();
|
|
} else {
|
|
$('#closure_remark_row').hide();
|
|
$('#remark_mode').prop('checked', false);
|
|
}
|
|
}
|
|
|
|
// Status change -> toggle sections + closure remark
|
|
$('#claim_status_id').on('change', function() {
|
|
var status_id = $(this).val();
|
|
var policy_type_id = $('#policy_type_id').val();
|
|
sendAjaxRequestForGlobal(base_url + 'non-eb-claim/getVisibleSections', 'POST', {claim_status_id: status_id, policy_type_id: policy_type_id}, function(response) {
|
|
if (response.status) {
|
|
var s = response.sections;
|
|
['surveyor','settlement'].forEach(function(sec) {
|
|
if (s.includes(sec)) { $('#section_'+sec).show(); } else { $('#section_'+sec).hide(); }
|
|
});
|
|
}
|
|
});
|
|
toggleClosureRemark();
|
|
});
|
|
|
|
// Submit (Update)
|
|
function submitNonEbClaim() {
|
|
if (!validateNonEbForm()) return;
|
|
|
|
var formData = new FormData(document.getElementById('nonEbClaimForm'));
|
|
$('.loader').fadeIn(); $('.loader-mask').fadeIn();
|
|
$.ajax({
|
|
url: base_url + 'non-eb-claim/update',
|
|
type: 'POST',
|
|
data: formData,
|
|
processData: false,
|
|
contentType: false,
|
|
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
|
success: function(response) {
|
|
if (typeof response === 'string') response = JSON.parse(response);
|
|
if (response.status == true) {
|
|
toastr.success(response.message);
|
|
setTimeout(function() { nonebShowRedirectAlert(); }, 800);
|
|
} else {
|
|
if (response.errors) { Object.values(response.errors).forEach(function(e) { toastr.error(e); }); }
|
|
else { toastr.error(response.message); }
|
|
}
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
},
|
|
error: function(xhr) {
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
if (xhr.status == 400) {
|
|
var resp = JSON.parse(xhr.responseText);
|
|
if (resp.errors) { Object.values(resp.errors).forEach(function(e) { toastr.error(e); }); }
|
|
else { toastr.warning(resp.message || 'Validation failed'); }
|
|
} else if (xhr.status === 500) {
|
|
toastr.error('Something went wrong. Please try again later.', 'Server Error');
|
|
} else {
|
|
toastr.error('An unexpected error occurred.', 'Error');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// Init
|
|
$(document).ready(function() {
|
|
if (typeof flatpickr !== 'undefined') {
|
|
$('.date-picker').flatpickr({ dateFormat: 'd-m-Y' });
|
|
}
|
|
// Initialize Select2 for editable selects
|
|
$('.select2-init').select2();
|
|
|
|
// Real-time validation clearing
|
|
$('#nonEbClaimForm').on('input change', '.form-control', function() {
|
|
$(this).removeClass('is-invalid');
|
|
});
|
|
$('#nonEbClaimForm').on('change', 'select', function() {
|
|
$(this).removeClass('is-invalid');
|
|
$(this).next('.select2-container').find('.select2-selection').removeClass('is-invalid-select2');
|
|
});
|
|
$('#asset_file').on('change', function() {
|
|
$(this).removeClass('is-invalid');
|
|
$('#asset_section_error').hide();
|
|
});
|
|
$('#nonEbClaimForm').on('input', '.asset-row input', function() {
|
|
$('#asset_section_error').hide();
|
|
});
|
|
|
|
// Show closure remark on load if current status warrants it
|
|
toggleClosureRemark();
|
|
|
|
// History DataTable
|
|
if ($('#history-datatable').length) {
|
|
$('#history-datatable').DataTable({
|
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'>>" +
|
|
"<'row'<'col-sm-12'tr>>" +
|
|
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
|
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
|
language: {
|
|
search: '<div class="datatable-search-wrapper" style="position:relative;display:inline-block;">_INPUT_<i class="mdi mdi-magnify datatable-search-icon" style="position:absolute;right:10px;top:50%;transform:translateY(-50%);color:#666;"></i></div>',
|
|
searchPlaceholder: "Search",
|
|
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
|
},
|
|
paging: true, pageLength: 10, ordering: false,
|
|
});
|
|
$('.dataTables_length label').css('height', '21px');
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<!-- Reply Tab Scripts -->
|
|
<script>
|
|
$(document).ready(function() {
|
|
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
|
const editorConfig = {
|
|
buttons: toolbar.concat(['fontsize']),
|
|
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24],
|
|
showPlaceholder: false,
|
|
toolbarButtonSize: 'small',
|
|
toolbarAdaptive: false,
|
|
saveHeightInStorage: true,
|
|
minHeight: 400,
|
|
};
|
|
|
|
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
|
var mail_content = `<?= isset($reply_data['mail_content']) ? $reply_data['mail_content'] : '' ?>`;
|
|
if (editor) { editor.value = mail_content; }
|
|
|
|
let lastActiveField = null;
|
|
$("#mail_subject").on("focus", function() { lastActiveField = this; });
|
|
editor.events.on("focus", function() { lastActiveField = editor; });
|
|
|
|
document.addEventListener('change', function(event) {
|
|
var target = event.target;
|
|
if (target.matches('#ticket_mail_customButton')) {
|
|
let placeholderValue = $(target).val();
|
|
if (!placeholderValue) return;
|
|
if (lastActiveField) {
|
|
if (lastActiveField.id === "mail_subject") {
|
|
var input = lastActiveField;
|
|
let startPos = input.selectionStart;
|
|
let endPos = input.selectionEnd;
|
|
input.value = input.value.substring(0, startPos) + placeholderValue + input.value.substring(endPos);
|
|
input.selectionStart = input.selectionEnd = startPos + placeholderValue.length;
|
|
} else {
|
|
editor.selection.insertHTML(placeholderValue);
|
|
}
|
|
}
|
|
$(target).val('');
|
|
}
|
|
});
|
|
|
|
// Reply form submit
|
|
$("#ticket_reply_form").submit(function(event) {
|
|
event.preventDefault();
|
|
var joditEditor = editor;
|
|
if (joditEditor) {
|
|
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
|
var formData = $(this).serializeArray();
|
|
formData.push({ name: 'mail_content', value: mailContent });
|
|
var ticket_id = $('#ticket_master_id').val();
|
|
if (ticket_id) { formData.push({ name: 'ticket_id', value: ticket_id }); }
|
|
$('.loader').fadeIn(); $('.loader-mask').fadeIn();
|
|
var form_action = '<?= base_url("/non-eb-claim/reply") ?>';
|
|
$.ajax({
|
|
url: form_action, type: "POST", data: formData, dataType: 'json',
|
|
success: function(res) {
|
|
if (res.status == true) {
|
|
toastr.success('Message Sent successfully!', 'Success');
|
|
$("#ticket_messages_div").load(location.href + " #ticket_messages_div");
|
|
} else {
|
|
toastr.error('Failed to Send Message', 'Error');
|
|
}
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
},
|
|
error: function(xhr) {
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
if (xhr.status === 400) {
|
|
let response = JSON.parse(xhr.responseText);
|
|
if (response.errors) {
|
|
let msgs = ""; $.each(response.errors, function(f, m) { msgs += '• ' + m + '<br>'; });
|
|
toastr.error(msgs, 'Validation Error', { "allowHtml": true });
|
|
} else { toastr.warning(response.message || 'Validation failed'); }
|
|
} else { toastr.error('Something went wrong.', 'Error'); }
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// Note form - fetch existing
|
|
var noteUrl = '<?= base_url("non-eb-claim/note/1") ?>';
|
|
$.ajax({
|
|
url: noteUrl, data: { id: $('#ticket_master_id').val(), is_auto_query: 0 }, type: 'POST',
|
|
success: function(res) {
|
|
if (res.status == true) {
|
|
$('#ticket_note').val(res.data.note);
|
|
$('#note_id').val(res.data.id);
|
|
}
|
|
}
|
|
});
|
|
|
|
// Note form submit
|
|
$("#ticket_note_form").submit(function(event) {
|
|
event.preventDefault();
|
|
$('.loader').fadeIn(); $('.loader-mask').fadeIn();
|
|
var url = '<?= base_url("/non-eb-claim/note/2") ?>';
|
|
var formData = $(this).serializeArray();
|
|
var ticket_id = $('#ticket_master_id').val();
|
|
if (ticket_id) { formData.push({ name: 'ticket_id', value: ticket_id }); }
|
|
var primary_key = $('#note_id').val();
|
|
if (primary_key) { formData.push({ name: 'id', value: primary_key }); }
|
|
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
|
|
if (response.status == true) {
|
|
toastr.success('Note Added Successfully', 'Success');
|
|
$('#note_id').val(response.id);
|
|
} else {
|
|
toastr.error('Failed to save note', 'Error');
|
|
}
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
}, function(xhr) {
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
if (xhr.status === 400) {
|
|
let response = JSON.parse(xhr.responseText);
|
|
if (response.errors) {
|
|
let msgs = ""; $.each(response.errors, function(f, m) { msgs += '• ' + m + '<br>'; });
|
|
toastr.error(msgs, 'Validation Error', { "allowHtml": true });
|
|
}
|
|
} else { toastr.error('Something went wrong.', 'Error'); }
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<!-- Claim Files Tab Scripts -->
|
|
<script>
|
|
var nonebDocumentConfig = { is_action_freeze: false, docs: [] };
|
|
|
|
$(document).ready(function() {
|
|
var ticket_id = $('#ticket_master_id').val();
|
|
$('#noneb_ticket_id_url').val(ticket_id);
|
|
nonebLoadClaimFiles(ticket_id);
|
|
|
|
var jsonDocumentConfig = <?= isset($td['required_docs']) && !empty($td['required_docs'])
|
|
? $td['required_docs']
|
|
: '{"is_action_freeze": false, "docs": [{"document_name":"","document_received":false}]}' ?>;
|
|
nonebLoadConfiguration(jsonDocumentConfig);
|
|
|
|
// File upload form submit
|
|
$('#noneb_file_upload_form').submit(function(e) {
|
|
e.preventDefault();
|
|
var formData = new FormData(this);
|
|
$('.loader').fadeIn(); $('.loader-mask').fadeIn();
|
|
$.ajax({
|
|
url: base_url + 'non-eb-claim/uploadFile',
|
|
type: 'POST',
|
|
data: formData,
|
|
processData: false,
|
|
contentType: false,
|
|
dataType: 'json',
|
|
success: function(res) {
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
if (res.status) {
|
|
toastr.success(res.message, 'Success');
|
|
nonebLoadClaimFiles($('#ticket_master_id').val());
|
|
} else {
|
|
toastr.error(res.message, 'Error');
|
|
}
|
|
},
|
|
error: function(xhr) {
|
|
$('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow');
|
|
if (xhr.status === 400) {
|
|
var resp = JSON.parse(xhr.responseText);
|
|
var msgs = '';
|
|
if (resp.errors) { $.each(resp.errors, function(f, m) { msgs += '• ' + m + '<br>'; }); toastr.error(msgs, 'Validation Error', { allowHtml: true }); }
|
|
else { toastr.warning(resp.message || 'Validation failed'); }
|
|
} else { toastr.error('Something went wrong.', 'Error'); }
|
|
}
|
|
});
|
|
});
|
|
|
|
// File delete
|
|
$(document).on('click', '.noneb-delete-url', function(e) {
|
|
e.preventDefault();
|
|
var url = $(this).data('href');
|
|
var $row = $(this).closest('tr');
|
|
confirmActionSweertAlert('Do you want to delete?', 'Yes, Proceed!', 'No, Cancel').then(function(confirmed) {
|
|
if (confirmed) {
|
|
$.ajax({
|
|
url: url, type: 'GET', dataType: 'json',
|
|
beforeSend: function() { $('.loader').fadeIn(); $('.loader-mask').fadeIn(); },
|
|
success: function(res) {
|
|
if (res.status) { toastr.success('Removed Successfully'); $row.remove(); }
|
|
else { toastr.error(res.message || 'Deletion failed'); }
|
|
},
|
|
error: function() { toastr.error('AJAX request failed'); },
|
|
complete: function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); }
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
// Init IR docs on tab click
|
|
$('#claimfiles_tab').on('shown.bs.tab', function() {
|
|
nonebLoadClaimFiles($('#ticket_master_id').val());
|
|
});
|
|
});
|
|
|
|
function nonebLoadClaimFiles(ticket_id) {
|
|
$.ajax({
|
|
url: base_url + 'non-eb-claim/getClaimFiles',
|
|
type: 'POST',
|
|
data: { ticket_id: ticket_id },
|
|
dataType: 'json',
|
|
success: function(res) {
|
|
if (res.status) { nonebCreateFileList(res.data); }
|
|
else { $('#noneb_file_table_bd').html('<tr><td colspan="4">No Data Found</td></tr>'); }
|
|
}
|
|
});
|
|
}
|
|
|
|
function nonebCreateFileList(data) {
|
|
$('#noneb_file_table_bd').empty();
|
|
if (data && data.length > 0) {
|
|
var html = '';
|
|
data.forEach(function(item, index) {
|
|
html += '<tr>' +
|
|
'<td>' + (index + 1) + '</td>' +
|
|
'<td>' + item.doc_name + '</td>' +
|
|
'<td><a href="' + item.url + '" target="_blank">' + (item.file_type == 1 ? item.url : item.doc_name) + '</a></td>' +
|
|
'<td><a href="javascript:void(0);" class="noneb-delete-url" data-href="' + base_url + 'non-eb-claim/removeFile?id=' + item.id + '"><i class="mdi mdi-delete mr-1"></i></a></td>' +
|
|
'</tr>';
|
|
});
|
|
$('#noneb_file_table_bd').append(html);
|
|
} else {
|
|
$('#noneb_file_table_bd').html('<tr><td colspan="4">No Data Found</td></tr>');
|
|
}
|
|
}
|
|
|
|
function nonebAddHTMLInput() {
|
|
var container = document.getElementById('noneb-dynamic-form-container');
|
|
var row = document.createElement('div');
|
|
row.className = 'form-row dynamic-form-row';
|
|
row.innerHTML = '<div class="form-group col-md-5"><label>Document Name <span class="text-danger">*</span></label><input type="text" class="form-control" name="docs_name[]" placeholder="Enter file name" required></div>' +
|
|
'<div class="form-group col-md-5"><label>URL <span class="text-danger">*</span></label><input type="text" class="form-control" name="url[]" required></div>' +
|
|
'<div class="form-group col-md-2" style="position:relative;top:28px;"><a class="btn btn-danger btn-sm" onclick="nonebRemoveHTMLInput(this)"><i class="mdi mdi-delete"></i></a></div>';
|
|
container.appendChild(row);
|
|
}
|
|
|
|
function nonebAddFileUploadHtml() {
|
|
var container = document.getElementById('noneb-dynamic-form-container');
|
|
var row = document.createElement('div');
|
|
row.className = 'form-row dynamic-form-row';
|
|
row.innerHTML = '<div class="form-group col-md-5"><label>Document Name <span class="text-danger">*</span></label><input type="text" class="form-control" name="docs_name[]" placeholder="Enter file name" required></div>' +
|
|
'<div class="form-group col-md-5"><label>Choose File <span class="text-danger">*</span></label><input type="file" class="form-control" name="file_upload[]" accept=".pdf,.jpg,.jpeg,.png" required><small class="text-muted"> Allowed: PDF, JPG, JPEG, PNG. </small></div>' +
|
|
'<div class="form-group col-md-2" style="position:relative;top:28px;"><a class="btn btn-danger btn-sm" onclick="nonebRemoveHTMLInput(this)"><i class="mdi mdi-delete"></i></a></div>';
|
|
container.appendChild(row);
|
|
}
|
|
|
|
function nonebRemoveHTMLInput(el) {
|
|
var container = document.getElementById('noneb-dynamic-form-container');
|
|
var rows = container.querySelectorAll('.dynamic-form-row');
|
|
if (rows.length > 1) { el.closest('.dynamic-form-row').remove(); }
|
|
}
|
|
|
|
function nonebToggleUploadType(btn) {
|
|
var $btn = $(btn), $addBtn = $('#noneb_add_btn');
|
|
$('#noneb-dynamic-form-container').find('.dynamic-form-row').remove();
|
|
if ($btn.text().trim() === 'URL Upload') {
|
|
$btn.text('File Upload').removeClass('btn-success').addClass('btn-info');
|
|
$addBtn.attr('onclick', 'nonebAddHTMLInput(this)');
|
|
nonebAddHTMLInput();
|
|
} else {
|
|
$btn.text('URL Upload').removeClass('btn-info').addClass('btn-success');
|
|
$addBtn.attr('onclick', 'nonebAddFileUploadHtml(this)');
|
|
nonebAddFileUploadHtml();
|
|
}
|
|
}
|
|
|
|
// IR Documents
|
|
function nonebLoadConfiguration(jsonString) {
|
|
try {
|
|
var data = typeof jsonString === 'string' ? JSON.parse(jsonString) : jsonString;
|
|
nonebDocumentConfig = data;
|
|
var freezeSwitch = document.getElementById('noneb_action_freeze_switch');
|
|
if (freezeSwitch) { freezeSwitch.checked = nonebDocumentConfig.is_action_freeze; }
|
|
nonebRenderDocumentList();
|
|
} catch(e) { console.error('Invalid JSON:', e); }
|
|
}
|
|
|
|
function nonebRenderDocumentList() {
|
|
var container = document.getElementById('noneb-document-list-container');
|
|
if (!container) return;
|
|
container.innerHTML = '';
|
|
nonebDocumentConfig.docs.forEach(function(doc, index) {
|
|
container.appendChild(nonebCreateDocumentRow(doc, index));
|
|
});
|
|
}
|
|
|
|
function nonebCreateDocumentRow(doc, index) {
|
|
var row = document.createElement('div');
|
|
row.className = 'form-row align-items-center mb-2';
|
|
row.dataset.index = index;
|
|
var isLast = index === nonebDocumentConfig.docs.length - 1;
|
|
var frozen = nonebDocumentConfig.is_action_freeze;
|
|
row.innerHTML =
|
|
'<div class="col-md-7"><input type="text" class="form-control" placeholder="Document Name" value="' + (doc.document_name || '') + '" onchange="nonebUpdateDocName(' + index + ', this.value)" ' + (frozen ? 'disabled' : '') + '></div>' +
|
|
'<div class="col-md-3"><span class="badge ' + (doc.document_received ? 'badge-success' : 'badge-danger') + ' text-center d-block" style="cursor:pointer;font-size:14px;padding:13px 12px;font-weight:600;border-radius:9px;" onclick="' + (frozen ? '' : 'nonebUpdateDocReceived(' + index + ', ' + !doc.document_received + ')') + '">' + (doc.document_received ? 'Received' : 'Not Received') + '</span></div>' +
|
|
'<div class="col-md-2 text-center">' +
|
|
'<button type="button" class="btn btn-sm btn-danger" onclick="nonebRemoveDocument(' + index + ')" ' + (frozen ? 'disabled' : '') + '><i class="mdi mdi-delete"></i></button>' +
|
|
(isLast && !frozen ? '<button type="button" class="btn btn-sm btn-primary ml-1" onclick="nonebAddDocument()"><i class="mdi mdi-plus"></i></button>' : '') +
|
|
'</div>';
|
|
return row;
|
|
}
|
|
|
|
function nonebAddDocument() {
|
|
if (nonebDocumentConfig.is_action_freeze) { toastr.warning('Cannot add documents when action is frozen'); return; }
|
|
nonebDocumentConfig.docs.push({ document_name: '', document_received: false });
|
|
nonebRenderDocumentList();
|
|
}
|
|
|
|
function nonebRemoveDocument(index) {
|
|
if (nonebDocumentConfig.is_action_freeze) { toastr.warning('Cannot remove documents when action is frozen'); return; }
|
|
if (nonebDocumentConfig.docs[index].document_received) { toastr.warning('Cannot remove a received document'); return; }
|
|
if (index === 0) { nonebDocumentConfig.docs[0].document_name = ''; nonebDocumentConfig.docs[0].document_received = false; nonebRenderDocumentList(); return; }
|
|
nonebDocumentConfig.docs.splice(index, 1);
|
|
nonebRenderDocumentList();
|
|
}
|
|
|
|
function nonebUpdateDocName(index, value) { nonebDocumentConfig.docs[index].document_name = value; }
|
|
function nonebUpdateDocReceived(index, value) { nonebDocumentConfig.docs[index].document_received = value === 'true' || value === true; nonebRenderDocumentList(); }
|
|
function nonebToggleActionFreeze() { nonebDocumentConfig.is_action_freeze = document.getElementById('noneb_action_freeze_switch').checked; nonebRenderDocumentList(); }
|
|
|
|
function nonebSaveIRDocs() {
|
|
var hasEmpty = nonebDocumentConfig.docs.some(function(d) { return !d.document_name.trim(); });
|
|
if (hasEmpty) { toastr.warning('Please fill in all document names'); return; }
|
|
var ticket_id = $('#ticket_master_id').val();
|
|
sendAjaxRequestForGlobal(base_url + 'non-eb-claim/saveIRDocs', 'POST',
|
|
{ ticket_id: ticket_id, required_docs: JSON.stringify(nonebDocumentConfig) },
|
|
function(res) {
|
|
if (res.status) { nonebLoadConfiguration(res.data); toastr.success(res.message, 'Success'); }
|
|
else { toastr.warning(res.message, 'Warning'); }
|
|
},
|
|
function(xhr) {
|
|
if (xhr.status === 400) {
|
|
var resp = JSON.parse(xhr.responseText);
|
|
var msgs = '';
|
|
if (resp.errors) { $.each(resp.errors, function(f, m) { msgs += '• ' + m + '<br>'; }); toastr.error(msgs, 'Validation Error', { allowHtml: true }); }
|
|
else { toastr.warning(resp.message || 'Validation failed'); }
|
|
} else { toastr.error('Something went wrong.', 'Error'); }
|
|
}
|
|
);
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
var _nonebRedirectTimer = null;
|
|
var _nonebOverlay = null;
|
|
|
|
function nonebShowRedirectAlert() {
|
|
var seconds = 5;
|
|
|
|
var backdrop = document.createElement('div');
|
|
backdrop.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:999998;';
|
|
|
|
var box = document.createElement('div');
|
|
box.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:999999;background:#fff;border-radius:8px;padding:24px 28px;min-width:320px;max-width:400px;text-align:center;box-shadow:0 8px 32px rgba(0,0,0,0.25);font-family:inherit;';
|
|
|
|
var title = document.createElement('div');
|
|
title.style.cssText = 'font-size:1.1rem;font-weight:600;margin-bottom:10px;color:#333;';
|
|
title.innerHTML = '✓ Claim Updated Successfully';
|
|
|
|
var msg = document.createElement('p');
|
|
msg.style.cssText = 'font-size:0.95rem;color:#555;margin-bottom:20px;';
|
|
var countSpan = document.createElement('strong');
|
|
countSpan.id = 'nonebRedirectCountdown';
|
|
countSpan.textContent = seconds;
|
|
msg.appendChild(document.createTextNode('Redirecting to claim list in '));
|
|
msg.appendChild(countSpan);
|
|
msg.appendChild(document.createTextNode(' seconds...'));
|
|
|
|
var btnRow = document.createElement('div');
|
|
btnRow.style.cssText = 'display:flex;gap:10px;justify-content:center;';
|
|
|
|
var btnNow = document.createElement('button');
|
|
btnNow.textContent = 'Redirect Now';
|
|
btnNow.style.cssText = 'padding:7px 18px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:0.9rem;';
|
|
btnNow.onclick = function() { nonebDoRedirect(); };
|
|
|
|
var btnCancel = document.createElement('button');
|
|
btnCancel.textContent = 'Cancel';
|
|
btnCancel.style.cssText = 'padding:7px 18px;background:#6c757d;color:#fff;border:none;border-radius:4px;cursor:pointer;font-size:0.9rem;';
|
|
btnCancel.onclick = function() {
|
|
clearInterval(_nonebRedirectTimer);
|
|
_nonebRedirectTimer = null;
|
|
document.body.removeChild(_nonebOverlay);
|
|
_nonebOverlay = null;
|
|
};
|
|
|
|
btnRow.appendChild(btnNow);
|
|
btnRow.appendChild(btnCancel);
|
|
box.appendChild(title);
|
|
box.appendChild(msg);
|
|
box.appendChild(btnRow);
|
|
backdrop.appendChild(box);
|
|
document.body.appendChild(backdrop);
|
|
_nonebOverlay = backdrop;
|
|
|
|
_nonebRedirectTimer = setInterval(function() {
|
|
seconds--;
|
|
var el = document.getElementById('nonebRedirectCountdown');
|
|
if (el) el.textContent = seconds;
|
|
if (seconds <= 0) { nonebDoRedirect(); }
|
|
}, 1000);
|
|
}
|
|
|
|
function nonebDoRedirect() {
|
|
clearInterval(_nonebRedirectTimer);
|
|
_nonebRedirectTimer = null;
|
|
if (_nonebOverlay && _nonebOverlay.parentNode) {
|
|
document.body.removeChild(_nonebOverlay);
|
|
}
|
|
window.location.href = base_url + 'non-eb-claim/list';
|
|
}
|
|
</script>
|