standardized warning labels

parent b5c3bfdc
...@@ -154,7 +154,7 @@ function buildMonthOptions(year, claimed) { ...@@ -154,7 +154,7 @@ function buildMonthOptions(year, claimed) {
if (!month) { $('#field-ocm_month').addClass('error'); hasError = true; } if (!month) { $('#field-ocm_month').addClass('error'); hasError = true; }
if (!year) { $('#field-ocm_year').addClass('error'); hasError = true; } if (!year) { $('#field-ocm_year').addClass('error'); hasError = true; }
if (hasError) { if (hasError) {
$('#modal-error-text').text('Choose month and year.'); $('#modal-error-text').text('Please select the month and year.');
$('#modal-error-msg').show(); $('#modal-error-msg').show();
return; return;
} }
...@@ -174,14 +174,14 @@ function buildMonthOptions(year, claimed) { ...@@ -174,14 +174,14 @@ function buildMonthOptions(year, claimed) {
$('#modal-success-msg').show(); $('#modal-success-msg').show();
setTimeout(function () { window.location.href = res.redirect; }, 800); setTimeout(function () { window.location.href = res.redirect; }, 800);
} else { } else {
$('#modal-error-text').text(res.message || 'Unknown error.'); $('#modal-error-text').text(res.message || 'Unable to create the claim form. Please try again.');
$('#modal-error-msg').show(); $('#modal-error-msg').show();
refreshMonthOptions(); refreshMonthOptions();
} }
}, },
error: function (xhr) { error: function (xhr) {
btn.removeClass('loading disabled'); btn.removeClass('loading disabled');
var msg = 'Network error. Please try again'; var msg = 'Network error. Please try again.';
if (xhr.status === 422 && xhr.responseJSON && xhr.responseJSON.errors) { if (xhr.status === 422 && xhr.responseJSON && xhr.responseJSON.errors) {
var errors = xhr.responseJSON.errors; var errors = xhr.responseJSON.errors;
msg = Object.values(errors).flat().join(' '); msg = Object.values(errors).flat().join(' ');
......
...@@ -700,7 +700,7 @@ function cancelEditMode() { ...@@ -700,7 +700,7 @@ function cancelEditMode() {
} }
function removeDay(dateStr) { function removeDay(dateStr) {
if (!confirm('Remove entry ' + dateStr + ' from the table?')) return; if (!confirm('Are you sure you want to remove the entry for ' + dateStr + '?')) return;
var detailId = details[dateStr] && details[dateStr].id; var detailId = details[dateStr] && details[dateStr].id;
if (!detailId) { showError('Entry ID not found.'); return; } if (!detailId) { showError('Entry ID not found.'); return; }
$.ajax({ $.ajax({
...@@ -708,7 +708,7 @@ function removeDay(dateStr) { ...@@ -708,7 +708,7 @@ function removeDay(dateStr) {
method: 'POST', method: 'POST',
data: { _token: csrfToken() }, data: { _token: csrfToken() },
success: function (res) { success: function (res) {
if (!res.success) { showError(res.message || 'Error while removing.'); return; } if (!res.success) { showError(res.message || 'Unable to remove the entry.'); return; }
delete details[dateStr]; delete details[dateStr];
if (editingDate === dateStr) { if (editingDate === dateStr) {
cancelEditMode(); cancelEditMode();
...@@ -758,10 +758,10 @@ function doSave() { ...@@ -758,10 +758,10 @@ function doSave() {
} }
function submitTuntutan() { function submitTuntutan() {
if (Object.keys(details).length === 0) { alert('Please add at least one entry before submitting.'); return; } if (Object.keys(details).length === 0) { alert('Please add at least one entry before submitting the claim form.'); return; }
var respondVal = $('#kueri_respond').val(); var respondVal = $('#kueri_respond').val();
if ($('#kueri_respond').length && (!respondVal || !respondVal.trim())) { showError('Please enter a response before resubmitting.'); return; } if ($('#kueri_respond').length && (!respondVal || !respondVal.trim())) { showError('Please enter a response before resubmitting.'); return; }
if (!confirm('Submit this claim for approval? You will not be able to edit it afterwards.')) return; if (!confirm('Are you sure you want to submit this claim form for approval? You will not be able to edit it afterwards.')) return;
function doSubmit() { function doSubmit() {
$.ajax({ $.ajax({
url: "{{ route('overtime::overtime.submitovertimeclaim', $data->id) }}", url: "{{ route('overtime::overtime.submitovertimeclaim', $data->id) }}",
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<h1 class="ui header"> <h1 class="ui header">
<div class="content"> <div class="content">
List of Overtime Claims - HOD Support List of Overtime Claims - HOD Support
<div class="sub header">Only claims with status <strong>{{ $statuses[5]->description ?? '-' }}</strong> wil be shown.</div> <div class="sub header">Only claim forms with status <strong>{{ $statuses[5]->description ?? '-' }}</strong> are displayed.</div>
</div> </div>
</h1> </h1>
</div> </div>
......
...@@ -199,7 +199,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -199,7 +199,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
$('#btn-hod-action').on('click', function () { $('#btn-hod-action').on('click', function () {
var action = $('input[name="hod_action"]:checked').val(); var action = $('input[name="hod_action"]:checked').val();
if (action === 'support') { if (action === 'support') {
if (!confirm('Support this claim form and forward it to HOD?')) return; if (!confirm('Are you sure you want to support this claim form and forward it to the Project Director?')) return;
var btn = $(this).addClass('loading disabled'); var btn = $(this).addClass('loading disabled');
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.hodsokongclaim', $data->id) }}", url : "{{ route('overtime::overtime.hodsokongclaim', $data->id) }}",
...@@ -211,20 +211,20 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -211,20 +211,20 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while supporting the claim form.'); showError(res.message || 'Unable to support the claim form. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
btn.removeClass('loading disabled'); btn.removeClass('loading disabled');
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
return; return;
} }
var remark = $('#kueri_remark').val().trim(); var remark = $('#kueri_remark').val().trim();
if (!remark) { showError('Please fill in the query notes before sending it back..'); return; } if (!remark) { showError('Please enter query notes before sending the form back.'); return; }
if (!confirm('Send this query back to the applicant?')) return; if (!confirm('Are you sure you want to send this query back to the applicant?')) return;
var btn = $(this).addClass('loading disabled'); var btn = $(this).addClass('loading disabled');
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.hodkuericlaim', $data->id) }}", url : "{{ route('overtime::overtime.hodkuericlaim', $data->id) }}",
...@@ -236,12 +236,12 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -236,12 +236,12 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while sending the query back.'); showError(res.message || 'Unable to send the query back. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
btn.removeClass('loading disabled'); btn.removeClass('loading disabled');
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
}); });
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
}); });
$(document).on('click', '.btn-batal', function () { $(document).on('click', '.btn-batal', function () {
if (!confirm('Cancel this claim form? This action cannot be undone.')) return; if (!confirm('Are you sure you want to cancel this claim form? This action cannot be undone.')) return;
var url = $(this).data('url'); var url = $(this).data('url');
var row = $(this).closest('tr'); var row = $(this).closest('tr');
...@@ -127,11 +127,11 @@ ...@@ -127,11 +127,11 @@
if (res.success) { if (res.success) {
location.reload(); location.reload();
} else { } else {
alert(res.message || 'Error while canceling. Please try again'); alert(res.message || 'Unable to cancel the claim form. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
var msg = 'Network error.'; var msg = 'Network error. Please try again.';
if (xhr.responseJSON && xhr.responseJSON.message) { if (xhr.responseJSON && xhr.responseJSON.message) {
msg = xhr.responseJSON.message; msg = xhr.responseJSON.message;
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<h1 class="ui header"> <h1 class="ui header">
<div class="content"> <div class="content">
List of Overtime Claims - PD Approval List of Overtime Claims - PD Approval
<div class="sub header">Claims with status <strong>{{ $statuses[7]->description ?? '-' }}</strong> and <strong>{{ $statuses[11]->description ?? '-' }}</strong>.</div> <div class="sub header">Only claim forms with status <strong>{{ $statuses[7]->description ?? '-' }}</strong> and <strong>{{ $statuses[11]->description ?? '-' }}</strong> are displayed.</div>
</div> </div>
</h1> </h1>
</div> </div>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
['header' => __('Action'), 'raw' => function ($row) { ['header' => __('Action'), 'raw' => function ($row) {
$view = "<a href='" . route('overtime::overtime.pdviewclaim', $row->id) . "' $view = "<a href='" . route('overtime::overtime.pdviewclaim', $row->id) . "'
class='ui blue button tiny'> class='ui blue button tiny'>
<i class='eye icon'></i> Lihat <i class='eye icon'></i> Review
</a>"; </a>";
return "<div style='text-align:center;'>{$view}</div>"; return "<div style='text-align:center;'>{$view}</div>";
}], }],
......
...@@ -189,7 +189,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -189,7 +189,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
$('#btn-pd-action').on('click', function () { $('#btn-pd-action').on('click', function () {
var action = $('input[name="pd_action"]:checked').val(); var action = $('input[name="pd_action"]:checked').val();
if (action === 'support') { if (action === 'support') {
if (!confirm('Approve this claim? The status will be updated to Application Approved.')) return; if (!confirm('Are you sure you want to approve this claim form? The status will be updated to Application Approved.')) return;
var btn = $(this).addClass('loading disabled'); var btn = $(this).addClass('loading disabled');
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.pdsokongclaim', $data->id) }}", url : "{{ route('overtime::overtime.pdsokongclaim', $data->id) }}",
...@@ -201,20 +201,20 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -201,20 +201,20 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while approving.'); showError(res.message || 'Unable to approve the claim form. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
btn.removeClass('loading disabled'); btn.removeClass('loading disabled');
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
return; return;
} }
var remark = $('#kueri_remark').val().trim(); var remark = $('#kueri_remark').val().trim();
if (!remark) { showError('Provide query notes before query back.'); return; } if (!remark) { showError('Please enter query notes before sending the form back.'); return; }
if (!confirm('Send this query back to the applicant?')) return; if (!confirm('Are you sure you want to send this query back to the applicant?')) return;
var btn = $(this).addClass('loading disabled'); var btn = $(this).addClass('loading disabled');
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.pdkuericlaim', $data->id) }}", url : "{{ route('overtime::overtime.pdkuericlaim', $data->id) }}",
...@@ -226,12 +226,12 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -226,12 +226,12 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while query back.'); showError(res.message || 'Unable to send the query back. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
btn.removeClass('loading disabled'); btn.removeClass('loading disabled');
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
}); });
......
...@@ -387,7 +387,7 @@ function resetSelection() { ...@@ -387,7 +387,7 @@ function resetSelection() {
var formId = $(this).data('form-id') || $('#request_form_id').val(); var formId = $(this).data('form-id') || $('#request_form_id').val();
if (!formId) { if (!formId) {
showError('Please select the request form first.'); showError('Please select a request form first.');
return; return;
} }
...@@ -412,11 +412,11 @@ function resetSelection() { ...@@ -412,11 +412,11 @@ function resetSelection() {
var month = $('#request_form_month').val(); var month = $('#request_form_month').val();
var staff = $('#request_form_staff').val(); var staff = $('#request_form_staff').val();
if (!formId) { showError('Please choose one request form.'); return; } if (!formId) { showError('Please select a request form.'); return; }
if (!month) { showError('Please choose the month/year related to the request form.'); return; } if (!month) { showError('Please select the month and year for the request form.'); return; }
if (!staff) { showError('Please choose the staff name from the request form.'); return; } if (!staff) { showError('Please select the staff name from the request form.'); return; }
if (!confirm('Confirm this review and mark the project rows as reviewed?')) return; if (!confirm('Are you sure you want to confirm this review and mark the project rows as reviewed?')) return;
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.pmmarkreviewed', $main->id) }}", url : "{{ route('overtime::overtime.pmmarkreviewed', $main->id) }}",
...@@ -427,11 +427,11 @@ function resetSelection() { ...@@ -427,11 +427,11 @@ function resetSelection() {
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while marking reviewed.'); showError(res.message || 'Unable to mark the project rows as reviewed. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
var msg = 'Network error.'; var msg = 'Network error. Please try again.';
if (xhr.responseJSON && xhr.responseJSON.message) msg = xhr.responseJSON.message; if (xhr.responseJSON && xhr.responseJSON.message) msg = xhr.responseJSON.message;
showError(msg); showError(msg);
}, },
...@@ -440,9 +440,9 @@ function resetSelection() { ...@@ -440,9 +440,9 @@ function resetSelection() {
$('#btn-kueri').on('click', function () { $('#btn-kueri').on('click', function () {
var remarks = $('#kueri_remarks').val().trim(); var remarks = $('#kueri_remarks').val().trim();
if (!remarks) { showError('Provide query reason.'); return; } if (!remarks) { showError('Please enter query notes before sending the form back.'); return; }
if (!confirm('Verify the query and send it back to the applicant.?')) return; if (!confirm('Are you sure you want to send this query back to the applicant?')) return;
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.pmkuericlaim', $main->id) }}", url : "{{ route('overtime::overtime.pmkuericlaim', $main->id) }}",
...@@ -453,11 +453,11 @@ function resetSelection() { ...@@ -453,11 +453,11 @@ function resetSelection() {
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while query.'); showError(res.message || 'Unable to send the query back. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
var msg = 'Network error.'; var msg = 'Network error. Please try again.';
if (xhr.responseJSON && xhr.responseJSON.message) msg = xhr.responseJSON.message; if (xhr.responseJSON && xhr.responseJSON.message) msg = xhr.responseJSON.message;
showError(msg); showError(msg);
}, },
......
...@@ -85,14 +85,14 @@ function viewTuntutan(id) { ...@@ -85,14 +85,14 @@ function viewTuntutan(id) {
} else { } else {
$('#vm-claim-content').html( $('#vm-claim-content').html(
'<div class="ui negative message"><p>' '<div class="ui negative message"><p>'
+ vcmEsc(res.message || 'An error occurred while loading the data.') + vcmEsc(res.message || 'Unable to load the claim form. Please try again.')
+ '</p></div>' + '</p></div>'
); );
} }
}, },
error: function () { error: function () {
$('#vm-claim-content').html( $('#vm-claim-content').html(
'<div class="ui negative message"><p>Network error. Please try again later.</p></div>' '<div class="ui negative message"><p>Network error. Please try again.</p></div>'
); );
}, },
}); });
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div class="ui stackable two column grid" style="margin-bottom:1rem;"> <div class="ui stackable two column grid" style="margin-bottom:1rem;">
<div class="column"> <div class="column">
<h1 class="ui header"> <h1 class="ui header">
<div class="content">List of Forms Awaiting HOD Review</div> <div class="content">List of Overtime Request Forms for HOD Review</div>
</h1> </h1>
</div> </div>
</div> </div>
......
...@@ -202,7 +202,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -202,7 +202,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
$('#btn-hod-action').on('click', function () { $('#btn-hod-action').on('click', function () {
var action = $('input[name="hod_action"]:checked').val(); var action = $('input[name="hod_action"]:checked').val();
if (action === 'support') { if (action === 'support') {
if (!confirm('Support this form and send it to the Project Director?')) return; if (!confirm('Are you sure you want to support this request form and forward it to the Project Director?')) return;
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.hodapproverequest', $main->id) }}", url : "{{ route('overtime::overtime.hodapproverequest', $main->id) }}",
method: 'POST', method: 'POST',
...@@ -212,19 +212,19 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -212,19 +212,19 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while approving. Please try again.'); showError(res.message || 'Unable to support the request form. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
return; return;
} }
var remark = $('#kueri_remark').val().trim(); var remark = $('#kueri_remark').val().trim();
if (!remark) { showError('Please fill in the query note.'); return; } if (!remark) { showError('Please enter query notes before sending the form back.'); return; }
if (!confirm('Send query back to the Project Manager?')) return; if (!confirm('Are you sure you want to send this query back to the Project Manager?')) return;
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.hodkuerirequest', $main->id) }}", url : "{{ route('overtime::overtime.hodkuerirequest', $main->id) }}",
...@@ -235,11 +235,11 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -235,11 +235,11 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while sending query. Please try again.'); showError(res.message || 'Unable to send the query back. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
}); });
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div class="ui stackable two column grid" style="margin-bottom:1rem;"> <div class="ui stackable two column grid" style="margin-bottom:1rem;">
<div class="column"> <div class="column">
<h1 class="ui header"> <h1 class="ui header">
<div class="content">List of Forms Awaiting Approval</div> <div class="content">List of Overtime Request Forms for PD Approval</div>
</h1> </h1>
</div> </div>
</div> </div>
......
...@@ -201,7 +201,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -201,7 +201,7 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
$('#btn-pd-action').on('click', function () { $('#btn-pd-action').on('click', function () {
var action = $('input[name="pd_action"]:checked').val(); var action = $('input[name="pd_action"]:checked').val();
if (action === 'support') { if (action === 'support') {
if (!confirm('Approve this request form?')) return; if (!confirm('Are you sure you want to approve this request form?')) return;
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.pdapproverequest', $main->id) }}", url : "{{ route('overtime::overtime.pdapproverequest', $main->id) }}",
method: 'POST', method: 'POST',
...@@ -211,19 +211,19 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -211,19 +211,19 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while approving. Please try again.'); showError(res.message || 'Unable to approve the request form. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
return; return;
} }
var remark = $('#kueri_remark').val().trim(); var remark = $('#kueri_remark').val().trim();
if (!remark) { showError('Please enter query notes.'); return; } if (!remark) { showError('Please enter query notes before sending the form back.'); return; }
if (!confirm('Confirm sending this query back to the Project Manager?')) return; if (!confirm('Are you sure you want to send this query back to the Project Manager?')) return;
$.ajax({ $.ajax({
url : "{{ route('overtime::overtime.pdkuerirequest', $main->id) }}", url : "{{ route('overtime::overtime.pdkuerirequest', $main->id) }}",
...@@ -234,11 +234,11 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show() ...@@ -234,11 +234,11 @@ function showError(msg) { $('#error-text').text(msg); $('#error-msg').show()
showSuccess(res.message); showSuccess(res.message);
setTimeout(function () { window.location.href = res.redirect; }, 1200); setTimeout(function () { window.location.href = res.redirect; }, 1200);
} else { } else {
showError(res.message || 'Error while sending the query back. Please try again.'); showError(res.message || 'Unable to send the query back. Please try again.');
} }
}, },
error: function (xhr) { error: function (xhr) {
showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error.'); showError((xhr.responseJSON && xhr.responseJSON.message) || 'Network error. Please try again.');
}, },
}); });
}); });
......
...@@ -184,7 +184,7 @@ function resetRequestModal() { ...@@ -184,7 +184,7 @@ function resetRequestModal() {
$('#rmodal-success-msg').show(); $('#rmodal-success-msg').show();
setTimeout(function () { window.location.href = res.redirect; }, 800); setTimeout(function () { window.location.href = res.redirect; }, 800);
} else { } else {
$('#rmodal-error-text').text(res.message || 'Unknown error.'); $('#rmodal-error-text').text(res.message || 'Unable to create the request form. Please try again.');
$('#rmodal-error-msg').show(); $('#rmodal-error-msg').show();
} }
}, },
......
...@@ -296,13 +296,13 @@ function addRow() { ...@@ -296,13 +296,13 @@ function addRow() {
} }
function removeRow(id) { function removeRow(id) {
if (!confirm('Remove this entry from the table?')) return; if (!confirm('Are you sure you want to remove this entry from the table?')) return;
$.ajax({ $.ajax({
url: "{{ route('overtime::overtime.removeovertimerequestdetail', ':id') }}".replace(':id', id), url: "{{ route('overtime::overtime.removeovertimerequestdetail', ':id') }}".replace(':id', id),
method: 'POST', method: 'POST',
data: { _token: csrfToken() }, data: { _token: csrfToken() },
success: function (res) { success: function (res) {
if (!res.success) { showError(res.message || 'Error while removing.'); return; } if (!res.success) { showError(res.message || 'Unable to remove the entry.'); return; }
delete rows[id]; delete rows[id];
renderTable(); renderTable();
showSuccess(res.message || 'Entry removed.'); showSuccess(res.message || 'Entry removed.');
...@@ -359,16 +359,16 @@ function doSave() { ...@@ -359,16 +359,16 @@ function doSave() {
function submitRequestForm() { function submitRequestForm() {
var respondVal = $('#kueri_respond').val(); var respondVal = $('#kueri_respond').val();
function doSubmit() { function doSubmit() {
if (!confirm('Submit this request for HOD review?')) return; if (!confirm('Are you sure you want to submit this request form for HOD review?')) return;
$.ajax({ $.ajax({
url: "{{ route('overtime::overtime.submitovertimerequest', $data->id) }}", url: "{{ route('overtime::overtime.submitovertimerequest', $data->id) }}",
method: 'POST', method: 'POST',
data: { _token: csrfToken() }, data: { _token: csrfToken() },
success: function (res) { success: function (res) {
if (res.success) { showSuccess(res.message); setTimeout(function () { window.location.href = res.redirect; }, 1200); } if (res.success) { showSuccess(res.message); setTimeout(function () { window.location.href = res.redirect; }, 1200); }
else { showError(res.message || 'Error while submitting.'); } else { showError(res.message || 'Unable to submit the request form. Please try again.'); }
}, },
error: function () { showError('Error while submitting the request.'); }, error: function () { showError('Unable to submit the request form. Please try again.'); },
}); });
} }
if ($('#kueri_respond').length && respondVal && respondVal.trim()) { if ($('#kueri_respond').length && respondVal && respondVal.trim()) {
...@@ -377,7 +377,7 @@ function doSubmit() { ...@@ -377,7 +377,7 @@ function doSubmit() {
method: 'POST', method: 'POST',
data: { _token: csrfToken(), respond: respondVal.trim() }, data: { _token: csrfToken(), respond: respondVal.trim() },
success: function () { doSubmit(); }, success: function () { doSubmit(); },
error: function () { showError('Error while saving response.'); }, error: function () { showError('Unable to save the response. Please try again.'); },
}); });
} else if ($('#kueri_respond').length) { } else if ($('#kueri_respond').length) {
showError('Please enter a response before resubmitting.'); showError('Please enter a response before resubmitting.');
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
}); });
$(document).on('click', '.btn-batal-request', function () { $(document).on('click', '.btn-batal-request', function () {
if (!confirm('Cancel this application form? This action cannot be undone.')) return; if (!confirm('Are you sure you want to cancel this request form? This action cannot be undone.')) return;
var url = $(this).data('url'); var url = $(this).data('url');
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
if (res.success) { if (res.success) {
location.reload(); location.reload();
} else { } else {
alert(res.message || 'Error while canceling the application form. Please try again.'); alert(res.message || 'Unable to cancel the request form. Please try again.');
} }
}, },
error: function () { error: function () {
......
...@@ -83,7 +83,7 @@ function viewRequestForm(id) { ...@@ -83,7 +83,7 @@ function viewRequestForm(id) {
} else { } else {
$('#vrf-content').html( $('#vrf-content').html(
'<div class="ui negative message"><p>' '<div class="ui negative message"><p>'
+ vrfEsc(res.message || 'Error while loading data. Please try again.') + vrfEsc(res.message || 'Unable to load the request form. Please try again.')
+ '</p></div>' + '</p></div>'
); );
} }
...@@ -106,7 +106,7 @@ function vrfBuildHtml(main, details) { ...@@ -106,7 +106,7 @@ function vrfBuildHtml(main, details) {
+ '<div class="meta-line">Project: <strong>' + vrfEsc(main.orm_project_label || '-') + '</strong></div>' + '<div class="meta-line">Project: <strong>' + vrfEsc(main.orm_project_label || '-') + '</strong></div>'
+ '<div class="meta-line">Department: <strong>' + vrfEsc(main.orm_department_label || '-') + '</strong></div>' + '<div class="meta-line">Department: <strong>' + vrfEsc(main.orm_department_label || '-') + '</strong></div>'
+ '<div class="meta-line">Request Date: <strong>' + vrfFmtDate(main.orm_requested_date || main.orm_date) + '</strong></div>' + '<div class="meta-line">Request Date: <strong>' + vrfFmtDate(main.orm_requested_date || main.orm_date) + '</strong></div>'
+ '<div class="meta-line">Approve by: <strong>' + vrfEsc(main.orm_approved_by_name || '-') + '</strong></div>' + '<div class="meta-line">Approved by: <strong>' + vrfEsc(main.orm_approved_by_name || '-') + '</strong></div>'
+ '<div class="meta-line">Approved Date: <strong>' + vrfFmtDate(main.orm_approved_date) + '</strong></div>' + '<div class="meta-line">Approved Date: <strong>' + vrfFmtDate(main.orm_approved_date) + '</strong></div>'
+ '<div class="meta-line">Status: ' + badge + '</div>' + '<div class="meta-line">Status: ' + badge + '</div>'
+ '</div>'; + '</div>';
......
...@@ -55,7 +55,7 @@ public function sokongClaim(Request $request, int $id): JsonResponse ...@@ -55,7 +55,7 @@ public function sokongClaim(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => "Claim {$claim->ocm_apply_no} has been supported and sent to the PD.", 'message' => "Claim {$claim->ocm_apply_no} was supported and forwarded to the Project Director successfully.",
'redirect' => route('overtime::overtime.hodreviewlist'), 'redirect' => route('overtime::overtime.hodreviewlist'),
]); ]);
}); });
...@@ -77,7 +77,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse ...@@ -77,7 +77,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => "Claim {$claim->ocm_apply_no} has been queried and sent back to the applicant.", 'message' => "Claim {$claim->ocm_apply_no} was queried and returned to the applicant successfully.",
'redirect' => route('overtime::overtime.hodreviewlist'), 'redirect' => route('overtime::overtime.hodreviewlist'),
]); ]);
}); });
......
...@@ -54,7 +54,7 @@ public function sokongClaim(Request $request, int $id): JsonResponse ...@@ -54,7 +54,7 @@ public function sokongClaim(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => "Claim {$claim->ocm_apply_no} has been approved.", 'message' => "Claim {$claim->ocm_apply_no} was approved successfully.",
'redirect' => route('overtime::overtime.pdreviewlist'), 'redirect' => route('overtime::overtime.pdreviewlist'),
]); ]);
}); });
...@@ -76,7 +76,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse ...@@ -76,7 +76,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => "Claim {$claim->ocm_apply_no} has been queried and sent back to the applicant.", 'message' => "Claim {$claim->ocm_apply_no} was queried and returned to the applicant successfully.",
'redirect' => route('overtime::overtime.pdreviewlist'), 'redirect' => route('overtime::overtime.pdreviewlist'),
]); ]);
}); });
......
...@@ -69,7 +69,7 @@ public function approveRequestForm(Request $request, int $id): JsonResponse ...@@ -69,7 +69,7 @@ public function approveRequestForm(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form has been supported and sent to the Project Director.', 'message' => 'Request form was supported and forwarded to the Project Director successfully.',
'redirect' => route('overtime::overtime.hodreviewlist'), 'redirect' => route('overtime::overtime.hodreviewlist'),
]); ]);
}); });
...@@ -82,7 +82,7 @@ public function rejectRequestForm(Request $request, int $id): JsonResponse ...@@ -82,7 +82,7 @@ public function rejectRequestForm(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form has been rejected.', 'message' => 'Request form was rejected successfully.',
'redirect' => route('overtime::overtime.hodreviewlist'), 'redirect' => route('overtime::overtime.hodreviewlist'),
]); ]);
}); });
...@@ -113,7 +113,7 @@ public function kueriRequestForm(Request $request, int $id): JsonResponse ...@@ -113,7 +113,7 @@ public function kueriRequestForm(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form has been queried and sent back to the PM.', 'message' => 'Request form was queried and returned to the Project Manager successfully.',
'redirect' => route('overtime::overtime.hodreviewlist'), 'redirect' => route('overtime::overtime.hodreviewlist'),
]); ]);
}); });
......
...@@ -77,7 +77,7 @@ public function approveRequestForm(Request $request, int $id): JsonResponse ...@@ -77,7 +77,7 @@ public function approveRequestForm(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Borang permohonan diluluskan.', 'message' => 'Request form was approved successfully.',
'redirect' => route('overtime::overtime.pdreviewlist'), 'redirect' => route('overtime::overtime.pdreviewlist'),
]); ]);
}); });
...@@ -90,7 +90,7 @@ public function rejectRequestForm(Request $request, int $id): JsonResponse ...@@ -90,7 +90,7 @@ public function rejectRequestForm(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Borang permohonan ditolak.', 'message' => 'Request form was rejected successfully.',
'redirect' => route('overtime::overtime.pdreviewlist'), 'redirect' => route('overtime::overtime.pdreviewlist'),
]); ]);
}); });
...@@ -113,7 +113,7 @@ public function kueriRequestForm(Request $request, int $id): JsonResponse ...@@ -113,7 +113,7 @@ public function kueriRequestForm(Request $request, int $id): JsonResponse
$request->validate([ $request->validate([
'remark' => 'required|string|max:2000', 'remark' => 'required|string|max:2000',
], [ ], [
'remark.required' => 'Sila isi catatan kueri.', 'remark.required' => 'Please enter query notes.',
]); ]);
return $this->withTransaction(function () use ($request, $id) { return $this->withTransaction(function () use ($request, $id) {
...@@ -121,7 +121,7 @@ public function kueriRequestForm(Request $request, int $id): JsonResponse ...@@ -121,7 +121,7 @@ public function kueriRequestForm(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Borang permohonan dikueri dan dihantar balik kepada PM.', 'message' => 'Request form was queried and returned to the Project Manager successfully.',
'redirect' => route('overtime::overtime.pdreviewlist'), 'redirect' => route('overtime::overtime.pdreviewlist'),
]); ]);
}); });
......
...@@ -96,7 +96,7 @@ public function markReviewed(Request $request, int $id): JsonResponse ...@@ -96,7 +96,7 @@ public function markReviewed(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Baris tuntutan projek telah ditandakan sebagai disemak.', 'message' => 'Project rows were marked as reviewed successfully.',
'redirect' => route('overtime::overtime.projectmanager.list'), 'redirect' => route('overtime::overtime.projectmanager.list'),
]); ]);
}); });
...@@ -115,7 +115,7 @@ public function sokongClaim(Request $request, int $id): JsonResponse ...@@ -115,7 +115,7 @@ public function sokongClaim(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Claim has been supported and sent to HOD.', 'message' => 'Claim form was supported and forwarded to HOD successfully.',
'redirect' => route('overtime::overtime.projectmanager.list'), 'redirect' => route('overtime::overtime.projectmanager.list'),
]); ]);
}); });
...@@ -130,7 +130,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse ...@@ -130,7 +130,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse
$request->validate([ $request->validate([
'remarks' => 'required|string|max:2000', 'remarks' => 'required|string|max:2000',
], [ ], [
'remarks.required' => 'Sila isi catatan kueri.', 'remarks.required' => 'Please enter query notes.',
]); ]);
return $this->withTransaction(function () use ($request, $id) { return $this->withTransaction(function () use ($request, $id) {
...@@ -138,7 +138,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse ...@@ -138,7 +138,7 @@ public function kueriClaim(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Claim has been queried and sent back to the applicant.', 'message' => 'Claim form was queried and returned to the applicant successfully.',
'redirect' => route('overtime::overtime.projectmanager.list'), 'redirect' => route('overtime::overtime.projectmanager.list'),
]); ]);
}); });
......
...@@ -73,7 +73,7 @@ public function storeOvertimeRequest(Request $request): JsonResponse ...@@ -73,7 +73,7 @@ public function storeOvertimeRequest(Request $request): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form created successfully.', 'message' => 'Request form was created successfully.',
'redirect' => route('overtime::overtime.editovertimerequest', $record->id), 'redirect' => route('overtime::overtime.editovertimerequest', $record->id),
]); ]);
}); });
...@@ -121,7 +121,7 @@ public function updateOvertimeRequest(Request $request, int $id): JsonResponse ...@@ -121,7 +121,7 @@ public function updateOvertimeRequest(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form updated successfully.', 'message' => 'Request form was updated successfully.',
]); ]);
}); });
} }
...@@ -139,17 +139,17 @@ public function addOvertimeRequestDetail(Request $request, int $id): JsonRespons ...@@ -139,17 +139,17 @@ public function addOvertimeRequestDetail(Request $request, int $id): JsonRespons
'ord_reason' => 'required|string|max:2000', 'ord_reason' => 'required|string|max:2000',
'ord_total_hours' => 'required|numeric|min:0', 'ord_total_hours' => 'required|numeric|min:0',
], [ ], [
'ord_name.required' => 'Nama diperlukan.', 'ord_name.required' => 'Please enter a name.',
'ord_month_of_overtime.required' => 'Bulan overtime diperlukan.', 'ord_month_of_overtime.required' => 'Please select the overtime month.',
'ord_planned_ot_hour.required' => 'Planned OT hour diperlukan.', 'ord_planned_ot_hour.required' => 'Please enter planned overtime hours.',
'ord_reason.required' => 'Sila isi sebab.', 'ord_reason.required' => 'Please enter a reason.',
'ord_total_hours.required' => 'Jumlah jam diperlukan.', 'ord_total_hours.required' => 'Please enter total hours.',
]); ]);
if (!$this->repos->isStaffNameInRequestProject($id, $request->ord_name)) { if (!$this->repos->isStaffNameInRequestProject($id, $request->ord_name)) {
return response()->json([ return response()->json([
'success' => false, 'success' => false,
'message' => 'Nama staf mesti dipilih daripada senarai staf projek ini.', 'message' => 'Staff name must be selected from this project staff list.',
], 422); ], 422);
} }
...@@ -158,7 +158,7 @@ public function addOvertimeRequestDetail(Request $request, int $id): JsonRespons ...@@ -158,7 +158,7 @@ public function addOvertimeRequestDetail(Request $request, int $id): JsonRespons
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Entry added successfully.', 'message' => 'Entry was added successfully.',
'detail' => $detail, 'detail' => $detail,
]); ]);
}); });
...@@ -179,7 +179,7 @@ public function updateOvertimeRequestDetail(Request $request, int $id): JsonResp ...@@ -179,7 +179,7 @@ public function updateOvertimeRequestDetail(Request $request, int $id): JsonResp
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Entry updated successfully.', 'message' => 'Entry was updated successfully.',
'detail' => $detail, 'detail' => $detail,
]); ]);
}); });
...@@ -196,7 +196,7 @@ public function removeOvertimeRequestDetail(Request $request, int $id): JsonResp ...@@ -196,7 +196,7 @@ public function removeOvertimeRequestDetail(Request $request, int $id): JsonResp
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Entry removed successfully.', 'message' => 'Entry was removed successfully.',
]); ]);
}); });
} }
...@@ -212,7 +212,7 @@ public function batalOvertimeRequest(Request $request, int $id): JsonResponse ...@@ -212,7 +212,7 @@ public function batalOvertimeRequest(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form cancelled successfully.', 'message' => 'Request form was cancelled successfully.',
]); ]);
}); });
} }
...@@ -228,7 +228,7 @@ public function deleteOvertimeRequest(Request $request, int $id): JsonResponse ...@@ -228,7 +228,7 @@ public function deleteOvertimeRequest(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form deleted successfully.', 'message' => 'Request form was deleted successfully.',
]); ]);
}); });
} }
...@@ -305,7 +305,7 @@ public function submitOvertimeRequest(Request $request, int $id): JsonResponse ...@@ -305,7 +305,7 @@ public function submitOvertimeRequest(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Request form submitted for HOD review successfully.', 'message' => 'Request form was submitted for HOD review successfully.',
'redirect' => route('overtime::overtime.listovertimerequest'), 'redirect' => route('overtime::overtime.listovertimerequest'),
]); ]);
}); });
...@@ -324,7 +324,7 @@ public function saveKueriRespond(Request $request, int $id): JsonResponse ...@@ -324,7 +324,7 @@ public function saveKueriRespond(Request $request, int $id): JsonResponse
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'message' => 'Response saved successfully.', 'message' => 'Response was saved successfully.',
]); ]);
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment