diff --git a/api/src/config.ts b/api/src/config.ts
index 42fa755..b921c8e 100644
--- a/api/src/config.ts
+++ b/api/src/config.ts
@@ -36,6 +36,7 @@ export const API_GATEWAY_KEY = process.env.API_GATEWAY_KEY || "";
export const DB_CONFIG = {
client: DB_CLIENT,
connection: { host: DB_HOST, user: DB_USER, password: DB_PASS, database: DB_NAME, port: DB_PORT },
+ pool: { min: 0, reapIntervalMillis: 600000 },
};
export const DB_CONFIG_DEV = {
diff --git a/web/public/serviceWorker.js b/web/public/serviceWorker.js
index b970aa7..f17fd1e 100644
--- a/web/public/serviceWorker.js
+++ b/web/public/serviceWorker.js
@@ -35,7 +35,7 @@ registerRoute(
plugins: [
new ExpirationPlugin({
maxEntries: 64,
- maxAgeSeconds: 60 * 60 * 24 * 30,
+ maxAgeSeconds: 60 * 60 * 24 * 90,
}),
],
})
@@ -50,15 +50,15 @@ registerRoute(
cacheName: "api-location",
plugins: [
new ExpirationPlugin({
- maxEntries: 16,
- maxAgeSeconds: 30 * 24 * 60, // 30 days
+ maxEntries: 1,
+ //maxAgeSeconds: 30 * 24 * 60, // 30 days
}),
],
})
);
const bgSyncPlugin = new BackgroundSyncPlugin("reportQueue", {
- maxRetentionTime: 30 * 24 * 60, // Retry for max of 30 days (specified in minutes)
+ maxRetentionTime: 30 * 24 * 60 , // Retry for max of 30 days (specified in minutes)
});
// Queue report submissions
diff --git a/web/src/components/incident/DetailsPage.vue b/web/src/components/incident/DetailsPage.vue
index 424a144..f471b5d 100644
--- a/web/src/components/incident/DetailsPage.vue
+++ b/web/src/components/incident/DetailsPage.vue
@@ -30,7 +30,7 @@
@@ -49,7 +49,7 @@
@@ -147,10 +147,13 @@
- Investigation
+
Save
+
+ Start Investigation
+
@@ -173,6 +176,11 @@
+
+
@@ -181,6 +189,7 @@ import { computed, ref } from "vue";
import { storeToRefs } from "pinia";
import { DateTime } from "luxon";
import { useRoute } from "vue-router";
+import { isNil } from "lodash";
import { useDisplay } from "vuetify";
const { smAndDown } = useDisplay();
@@ -190,12 +199,13 @@ import ActionList from "@/components/action/ActionList.vue";
import HazardList from "@/components/hazard/HazardList.vue";
import ActionCreate from "@/components/action/ActionCreate.vue";
import ActionEdit from "@/components/action/ActionEdit.vue";
+import InvestigationForm from "./InvestigationForm.vue";
import { useReportStore } from "@/store/ReportStore";
const reportStore = useReportStore();
-const { initialize, loadReport, updateReport, openAttachment } = reportStore;
-const { locations, urgencies, selectedReport } = storeToRefs(reportStore);
+const { initialize, loadReport, updateReport, openAttachment, completeStep } = reportStore;
+const { currentStep, selectedReport } = storeToRefs(reportStore);
const router = useRoute();
const reportId = router.params.id;
@@ -203,10 +213,20 @@ const reportId = router.params.id;
await initialize();
await loadReport(reportId);
+const showInvestigationDialog = ref(false);
+
const showActionAdd = ref(false);
const showActionEdit = ref(false);
const actionToEdit = ref(null);
+const investigationIsActive = computed(() => {
+ if (currentStep.value) {
+ return currentStep.value.step_title.indexOf("Investig") >= 0;
+ }
+
+ return false;
+});
+
const tickLabels = {
0: "Low",
1: "Medium",
@@ -284,6 +304,17 @@ async function saveClick() {
await updateReport();
}
+function investigationClick() {
+ showInvestigationDialog.value = true;
+}
+
+async function completeInvestigation() {
+ if (currentStep.value) {
+ await completeStep(currentStep.value);
+ showInvestigationDialog.value = false;
+ }
+}
+
function openAttachmentClick(attachment) {
openAttachment(attachment);
}
diff --git a/web/src/components/incident/InvestigationForm.vue b/web/src/components/incident/InvestigationForm.vue
new file mode 100644
index 0000000..4599d82
--- /dev/null
+++ b/web/src/components/incident/InvestigationForm.vue
@@ -0,0 +1,220 @@
+
+
+
+
+ Investigation
+
+
+
+
+
+
+ How did the natural conditions affect the event? Only check those that apply, if any.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ How did external energy sources affect the event? Only check those that apply, if any.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ How did the worker's circumstance affect the event? Only check those that apply, if any.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ What processes are missing or not sufficient enough and how did they contribute to the event? Only check
+ those that apply, if any.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Root causes are essential system failures that are responsible for starting the series of unsafe acts or
+ conditions that lead to the event. Examples of a root cause are that a training program or safe work
+ practice doesn't exist to help the worker complete the activity, or there is no preventative maintenance
+ program to keep equipment operating properly. There can be more than one root cause.
+
+
+
+ Root Cause
+ Describe the inadequate process or program that lead to the event
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Prev
+
+ Step {{ step + 1 }}: {{ stepName }}
+
+ Next
+ Save
+
+
+
+
+
+
diff --git a/web/src/components/incident/OperationMenu.vue b/web/src/components/incident/OperationMenu.vue
index 7c79550..88f3086 100644
--- a/web/src/components/incident/OperationMenu.vue
+++ b/web/src/components/incident/OperationMenu.vue
@@ -36,17 +36,7 @@ import { useReportStore } from "@/store/ReportStore";
const reportStore = useReportStore();
const { completeStep, revertStep } = reportStore;
-const { selectedReport } = storeToRefs(reportStore);
-
-const currentStep = computed(() => {
- if (selectedReport.value) {
- for (const step of selectedReport.value.steps) {
- if (step.complete_date) continue;
- return step;
- }
- }
- return {};
-});
+const { currentStep, selectedReport } = storeToRefs(reportStore);
const previousStep = computed(() => {
if (selectedReport.value) {
diff --git a/web/src/components/inspection/CreateInspectionPage.vue b/web/src/components/inspection/CreateInspectionPage.vue
new file mode 100644
index 0000000..3ef45b5
--- /dev/null
+++ b/web/src/components/inspection/CreateInspectionPage.vue
@@ -0,0 +1,177 @@
+
+ Inspection
+
+
+
+
+
+
+ Inspection Details
+
+
+
+
+
+
+ Date and time of inspection
+
+
+
+
+ General location of inspection
+
+
+
+
+ Department responsible
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Previously Identified Hazards for this location show here
+
+
+
+
+
+ Identified Hazard {{ index + 1 }}
+
+
+
+
+ Hazard type
+
+
+
+ Urgency
+
+
+
+
+ Description
+
+
+
+ Specific location
+
+
+
+
+
+
+
+
+ Add Identified Hazard
+
+
+
+
+
+
+ Submit Inspection
+
+
+ Attach supporting images
+
+
+
+ Submit
+
+
+
+
+
+
+
+
diff --git a/web/src/routes.ts b/web/src/routes.ts
index 7e6b949..c9d9a1e 100644
--- a/web/src/routes.ts
+++ b/web/src/routes.ts
@@ -46,6 +46,13 @@ const routes: RouteRecordRaw[] = [
component: () => import("@/components/incident/DetailsPage.vue"),
},
+ {
+ path: "inspection",
+ component: () => import("@/components/inspection/CreateInspectionPage.vue"),
+ },
+
+
+
{
path: "sign-in",
component: () => import("@/modules/authentication/views/SignIn.vue"),
diff --git a/web/src/store/ReportStore.ts b/web/src/store/ReportStore.ts
index b0e391c..5932d94 100644
--- a/web/src/store/ReportStore.ts
+++ b/web/src/store/ReportStore.ts
@@ -11,6 +11,17 @@ export const useReportStore = defineStore("reports", {
selectedReport: undefined as Incident | undefined,
isLoading: false,
}),
+ getters: {
+ currentStep(state) {
+ if (state.selectedReport && state.selectedReport.steps) {
+ for (const step of state.selectedReport.steps) {
+ if (step.complete_date) continue;
+ return step;
+ }
+ }
+ return {};
+ },
+ },
actions: {
async initialize() {
console.log("Initializing Report Store");
@@ -66,7 +77,6 @@ export const useReportStore = defineStore("reports", {
},
async addReport(report: Incident) {
- console.log("ADDREPORT", report);
this.myReports.push(report);
const api = useApiStore();
@@ -89,7 +99,6 @@ export const useReportStore = defineStore("reports", {
},
async addReportOffline(report: Incident) {
- console.log("ADDREPORTOFFLINE", report);
this.isLoading = true;
const api = useApiStore();
diff --git a/web/src/views/Home.vue b/web/src/views/Home.vue
index d758e9f..79fd96e 100644
--- a/web/src/views/Home.vue
+++ b/web/src/views/Home.vue
@@ -16,6 +16,8 @@
+
+ Start Inspection