2026-04-20 23:16:57 +00:00
|
|
|
<template>
|
2026-04-21 14:35:13 +00:00
|
|
|
<div class="container">
|
|
|
|
|
<div class="row min-vh-100 align-items-center justify-content-center">
|
|
|
|
|
<div class="col-auto text-center">
|
|
|
|
|
<div class="spinner-border text-primary" role="status">
|
|
|
|
|
<span class="visually-hidden">Loading...</span>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="mt-3 text-muted">Loading report details...</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-04-20 23:16:57 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { computed, onMounted, ref } from "vue";
|
2026-04-21 14:35:13 +00:00
|
|
|
import { useRouter } from "vue-router";
|
2026-04-20 23:16:57 +00:00
|
|
|
import { computedAsync } from "@vueuse/core";
|
|
|
|
|
|
|
|
|
|
import type { Image } from "@/components/ImageUpload.vue";
|
|
|
|
|
import { useStoreDistrict } from "@/rmo/store/district";
|
|
|
|
|
import { useStoreLocal } from "@/store/local";
|
|
|
|
|
import { useStoreLocation } from "@/store/location";
|
2026-04-21 14:41:06 +00:00
|
|
|
import { useStorePublicReport } from "@/store/publicreport";
|
2026-04-20 23:16:57 +00:00
|
|
|
import Intro from "@/rmo/content/compliance/Intro.vue";
|
|
|
|
|
import LoadingOverlay from "@/components/LoadingOverlay.vue";
|
|
|
|
|
import {
|
|
|
|
|
type ComplianceUpdate,
|
|
|
|
|
type District,
|
|
|
|
|
PublicReport,
|
|
|
|
|
PublicReportCompliance,
|
|
|
|
|
PublicReportComplianceOptions,
|
|
|
|
|
} from "@/type/api";
|
|
|
|
|
import { Contact, Address, Location, PermissionType } from "@/type/api";
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
public_id: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const districtStore = useStoreDistrict();
|
|
|
|
|
|
|
|
|
|
const props = defineProps<Props>();
|
2026-04-21 14:35:13 +00:00
|
|
|
const router = useRouter();
|
2026-04-20 23:16:57 +00:00
|
|
|
const storeLocal = useStoreLocal();
|
2026-04-21 14:41:06 +00:00
|
|
|
const storePublicReport = useStorePublicReport();
|
2026-04-21 14:35:13 +00:00
|
|
|
async function doMounted() {
|
|
|
|
|
const client_id = storeLocal.getClientID();
|
|
|
|
|
const report_uri = storeLocal.getExistingComplianceReportURI();
|
|
|
|
|
if (report_uri && report_uri.endsWith(props.public_id)) {
|
|
|
|
|
console.log("Loading previous report", report_uri);
|
|
|
|
|
} else {
|
2026-04-21 14:41:06 +00:00
|
|
|
const report = await storePublicReport.createCompliance({
|
|
|
|
|
client_id: client_id,
|
|
|
|
|
mailer_id: props.public_id,
|
|
|
|
|
});
|
2026-04-21 14:35:13 +00:00
|
|
|
storeLocal.setExistingComplianceReportURI(report.uri);
|
|
|
|
|
console.log("Created new compliance report", report);
|
2026-04-20 23:16:57 +00:00
|
|
|
}
|
2026-04-21 14:35:13 +00:00
|
|
|
router.replace(`/compliance/${props.public_id}`);
|
2026-04-20 23:16:57 +00:00
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
2026-04-21 14:35:13 +00:00
|
|
|
doMounted();
|
2026-04-20 23:16:57 +00:00
|
|
|
});
|
|
|
|
|
</script>
|