Skip to content

Commit

Permalink
do yet more renaming of "incident reports" to "field reports"
Browse files Browse the repository at this point in the history
this should be just about it on the client side
  • Loading branch information
srabraham committed Dec 20, 2024
1 parent f7fc969 commit afb5583
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
12 changes: 6 additions & 6 deletions src/ims/element/incident/incident_template/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,20 @@
<div class="col-sm-12">
<div class="card">
<label class="control-label card-header">Attached Field Reports</label>
<ul id="attached_incident_reports" class="list-group list-group-small card-body list-group-flush">
<ul id="attached_field_reports" class="list-group list-group-small card-body list-group-flush">
<li class="list-group-item ps-3">
<button class="badge btn btn-danger remove-badge float-end"
onclick="detachIncidentReport(this)">
onclick="detachFieldReport(this)">
X
</button>
</li>
</ul>
<div id="attached_incident_report_add_container" class="flex-input-container card-footer no-print">
<div id="attached_field_report_add_container" class="flex-input-container card-footer no-print">
<label class="control-label">Add:</label>
<select
id="attached_incident_report_add"
id="attached_field_report_add"
class="form-control form-control-sm"
onchange="attachIncidentReport()"
onchange="attachFieldReport()"
>
<option value=""/>
</select>
Expand All @@ -217,7 +217,7 @@
<div class="col-sm-12">
<div class="card">
<label class="control-label card-header">Incident Details</label>
<div id="incident_report_well" class="card-body">
<div id="report_entry_well" class="card-body">
<label class="control-label">
<input id="history_checkbox" type="checkbox" onchange="toggleShowHistory()"/>
Show history
Expand Down
2 changes: 1 addition & 1 deletion src/ims/element/incident/report_template/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<div class="col-sm-12">
<div class="card">
<label class="control-label card-header">Details</label>
<div id="incident_report_well" class="card-body">
<div id="report_entry_well" class="card-body">
<div id="report_entries"/>
<div class="card-footer">
<textarea
Expand Down
12 changes: 6 additions & 6 deletions src/ims/element/static/field_report.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ let fieldReport = null;

function initFieldReportPage() {
function loadedFieldReport() {
// for a new incident report
// for a new field report
if (fieldReport.number == null) {
$("#field_report_summary").focus();
} else {
// Scroll to incident_report_add field
// Scroll to report_entry_add field
$("html, body").animate({scrollTop: $("#report_entry_add").offset().top}, 500);
$("#report_entry_add").focus();
}
Expand Down Expand Up @@ -90,7 +90,7 @@ function clearErrorMessage() {


//
// Load incident report
// Load field report
//

function loadFieldReport(success) {
Expand Down Expand Up @@ -188,7 +188,7 @@ function drawNumber() {

function drawIncident() {
$("#incident_number").text("Please include in Summary");
// New Incident Report. There can be no Incident
// New Field Report. There can be no Incident
if (fieldReport.number == null) {
return;
}
Expand Down Expand Up @@ -310,7 +310,7 @@ function editSummary() {
}

//
// Make a new incident and attach this incident report to it
// Make a new incident and attach this Field Report to it
//

function makeIncident() {
Expand All @@ -332,7 +332,7 @@ function makeIncident() {

function attachFail(error, status, xhr) {
disableEditing();
const message = "Failed to attach incident report";
const message = "Failed to attach field report";
console.error(message + ": " + error);
setErrorMessage(message);
}
Expand Down
12 changes: 6 additions & 6 deletions src/ims/element/static/field_reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,29 @@ function initDataTables() {
},
"columns": [
{ // 0
"name": "incident_report_number",
"className": "incident_report_number text-right",
"name": "field_report_number",
"className": "field_report_number text-right",
"data": "number",
"defaultContent": null,
"cellType": "th",
},
{ // 1
"name": "incident_report_created",
"className": "incident_report_created text-center",
"className": "field_report_created text-center",
"data": "created",
"defaultContent": null,
"render": renderDate,
},
{ // 2
"name": "incident_report_incident",
"className": "incident_report_incident text-center",
"className": "field_report_incident text-center",
"data": "incident",
"defaultContent": "-",
"render": renderIncidentNumber,
},
{ // 3
"name": "incident_report_summary",
"className": "incident_report_summary",
"className": "field_report_summary",
"data": "summary",
"defaultContent": "",
"render": renderSummary,
Expand All @@ -190,7 +190,7 @@ function initDataTables() {
// Open new context with link
window.open(url, "Field_Report:" + fieldReport.number);
});
$(row).find(".incident_report_created")
$(row).find(".field_report_created")
.attr("title", fullDateTime.format(Date.parse(fieldReport.created)));
},
});
Expand Down
34 changes: 17 additions & 17 deletions src/ims/element/static/incident.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ function initIncidentPage() {
drawRangersToAdd();
});
loadIncidentTypesAndCache(drawIncidentTypesToAdd);
loadAndDisplayIncidentReports();
loadAndDisplayFieldReports();

// for a new incident
if (incident.number == null) {
$("#incident_summary").focus();
} else {
// Scroll to incident_report_add field
// Scroll to report_entry_add field
$("html, body").animate({scrollTop: $("#report_entry_add").offset().top}, 500);
$("#report_entry_add").focus();
}
Expand All @@ -58,7 +58,7 @@ function initIncidentPage() {
if (number === incidentNumber) {
console.log("Got incident update: " + number);
loadAndDisplayIncident();
loadAndDisplayIncidentReports();
loadAndDisplayFieldReports();
}
}

Expand Down Expand Up @@ -181,7 +181,7 @@ function loadAndDisplayIncident(success) {
}


function loadAndDisplayIncidentReports() {
function loadAndDisplayFieldReports() {
loadUnattachedFieldReports(function () {
drawMergedReportEntries();
drawIncidentReportsToAttach();
Expand Down Expand Up @@ -698,7 +698,7 @@ function drawLocationDescription() {


//
// Incident report display
// Incident generated history display
//

function toggleShowHistory() {
Expand Down Expand Up @@ -742,7 +742,7 @@ let _reportsItem = null;

function drawAttachedFieldReports() {
if (_reportsItem == null) {
_reportsItem = $("#attached_incident_reports")
_reportsItem = $("#attached_field_reports")
.children(".list-group-item:first")
;
}
Expand All @@ -762,15 +762,15 @@ function drawAttachedFieldReports() {
items.push(item);
}

const container = $("#attached_incident_reports");
const container = $("#attached_field_reports");
container.empty();
container.append(items);
}


function drawIncidentReportsToAttach() {
const container = $("#attached_incident_report_add_container");
const select = $("#attached_incident_report_add");
const container = $("#attached_field_report_add_container");
const select = $("#attached_field_report_add");

select.empty();
select.append($("<option />"));
Expand Down Expand Up @@ -1090,15 +1090,15 @@ function addIncidentType() {
}


function detachIncidentReport(sender) {
function detachFieldReport(sender) {
sender = $(sender);

const incidentReport = sender.parent().data();

function ok(data, status, xhr) {
// FIXME
// controlHasSuccess(sender);
loadAndDisplayIncidentReports();
loadAndDisplayFieldReports();
}

function fail(requestError, status, xhr) {
Expand All @@ -1107,7 +1107,7 @@ function detachIncidentReport(sender) {

const message = "Failed to detach field report";
console.log(message + ": " + requestError);
loadAndDisplayIncidentReports();
loadAndDisplayFieldReports();
setErrorMessage(message);
}

Expand All @@ -1120,25 +1120,25 @@ function detachIncidentReport(sender) {
}


function attachIncidentReport() {
function attachFieldReport() {
if (incidentNumber == null) {
// Incident doesn't exist yet. Create it and then retry.
sendEdits({}, attachIncidentReport);
sendEdits({}, attachFieldReport);
return;
}

const select = $("#attached_incident_report_add");
const select = $("#attached_field_report_add");
const incidentReportNumber = $(select).val();

function ok(data, status, xhr) {
loadAndDisplayIncidentReports();
loadAndDisplayFieldReports();
controlHasSuccess(select, 1000);
}

function fail(requestError, status, xhr) {
const message = "Failed to attach field report";
console.log(message + ": " + requestError);
loadAndDisplayIncidentReports();
loadAndDisplayFieldReports();
setErrorMessage(message);
controlHasError(select);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ims/element/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ h1 {
display: none;
}

#incident_report_well > .panel {
#report_entry_well > .panel {
margin-bottom: 0.5rem;
}

Expand Down

0 comments on commit afb5583

Please sign in to comment.