2026-03-22 06:40:31 +00:00
< style scoped >
. actions - panel {
height : 100 % ;
overflow - y : auto ;
}
< / style >
2026-03-22 06:27:18 +00:00
< template >
2026-03-22 10:14:48 +00:00
< div class = "card shadow-sm h-100" >
< div class = "card-header bg-light pane-header" > Actions < / div >
< div class = "card-body scroll-pane" >
< div v-if = "loading" class="loading" > Loading... < / div >
< div v-else >
< div
v - if = "!selectedCommunication"
class = "h-100 d-flex flex-column align-items-center justify-content-center text-muted p-3"
>
< i class = "bi bi-gear fs-1" > < / i >
< p class = "mt-2 text-center" >
Actions will appear here when a report is selected
< / p >
2026-03-22 06:27:18 +00:00
< / div >
2026-03-22 10:14:48 +00:00
< div
v - if = "selectedCommunication"
class = "actions-panel d-flex flex-column"
>
< div class = "p-3 flex-grow-1" >
<!-- Create Signal -- >
< div class = "d-grid mb-3" >
< button class = "btn btn-success btn-lg" @click ="markSignal()" >
< i class = "bi bi-plus-circle me-2" > < / i > Mark Signal
< / button >
< small class = "text-muted mt-1"
> This report is useful signal < / s m a l l
>
< / div >
2026-03-22 06:27:18 +00:00
2026-03-22 10:14:48 +00:00
<!-- Mark Invalid -- >
< div class = "d-grid mb-3" >
< button class = "btn btn-outline-danger" @click ="markInvalid()" >
< i class = "bi bi-x-circle me-2" > < / i > Mark Invalid
< / button >
< small class = "text-muted mt-1" > This report isn ' t useful < / small >
< / div >
2026-03-22 06:27:18 +00:00
2026-03-22 10:14:48 +00:00
< hr / >
2026-03-22 06:27:18 +00:00
2026-03-22 10:14:48 +00:00
<!-- Message Reporter -- >
< div
v - if = "
! (
2026-03-31 14:52:53 +00:00
selectedCommunication ? . public _report ? . reporter . has _email ||
selectedCommunication ? . public _report ? . reporter . has _phone
2026-03-22 10:14:48 +00:00
)
"
class = "mb-3"
>
< h6 >
< i class = "bi bi-chat-dots" > < / i > No Reporter Communications
Available
< / h6 >
< / div >
< div
v - if = "
2026-03-31 14:52:53 +00:00
selectedCommunication ? . public _report ? . reporter . has _email ||
selectedCommunication ? . public _report ? . reporter . has _phone
2026-03-22 10:14:48 +00:00
"
class = "mb-3"
>
< h6 > < i class = "bi bi-chat-dots" > < / i > Message Reporter < / h6 >
< div class = "mb-2" >
< label class = "form-label small text-muted"
> Quick Templates < / l a b e l
>
< select
class = "form-select form-select-sm"
2026-03-31 14:52:53 +00:00
@ change = "handleTemplateChange"
2026-03-22 10:14:48 +00:00
>
< option value = "" > Select a template ... < / option >
< option value = "received" > Report Received < / option >
< option value = "scheduled" > Service Scheduled < / option >
< option value = "completed" > Service Completed < / option >
< option value = "need_info" > Need More Information < / option >
< / select >
< / div >
< textarea
class = "form-control mb-2"
rows = "5"
v - model = "messageText"
placeholder = "Type your message to the reporter..."
> < / textarea >
< div class = "d-grid" >
< button
class = "btn btn-primary"
@ click = "sendMessage()"
: disabled = "!messageText.trim()"
>
< i class = "bi bi-send me-2" > < / i > Send Message
< / button >
< / div >
2026-03-22 06:27:18 +00:00
< / div >
2026-03-22 10:14:48 +00:00
< hr / >
2026-03-22 06:27:18 +00:00
2026-03-22 10:14:48 +00:00
<!-- Report History -- >
< div >
< h6 > < i class = "bi bi-clock-history" > < / i > Activity Log < / h6 >
< div class = "small" >
< div
2026-03-31 14:52:53 +00:00
v - for = " entry in selectedCommunication ? . public _report ? . log ||
[ ] "
2026-03-22 10:14:48 +00:00
: key = "entry.created"
class = "border-start border-2 ps-2 mb-2"
>
< div v-if = "entry.type === 'created'" >
< div class = "text-muted" > Initial Report < / div >
< small class = "text-muted" > { {
formatDate ( entry . created )
} } < / small >
< / div >
< div v -else -if = " entry.type = = = ' message -text ' " >
< div class = "text-muted" > Text Message < / div >
< div > { { entry . message } } < / div >
< small class = "text-muted" > { {
formatDate ( entry . created )
} } < / small >
< / div >
< div v-else > {{ entry.type }} < / div >
2026-03-22 06:27:18 +00:00
< / div >
2026-03-22 10:14:48 +00:00
< div
v - if = "
2026-03-31 14:52:53 +00:00
! selectedCommunication ? . public _report ? . log ||
selectedCommunication ? . public _report ? . log . length === 0
2026-03-22 10:14:48 +00:00
"
class = "text-muted"
>
No activity yet
2026-03-22 06:27:18 +00:00
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / template >
< script setup lang = "ts" >
import { ref } from "vue" ;
2026-03-31 14:52:53 +00:00
import { Communication , User } from "@/types" ;
2026-03-22 07:16:42 +00:00
interface Emits {
( e : "markSignal" ) : void ;
( e : "markInvalid" ) : void ;
( e : "sendMessage" , message : string ) : void ;
}
2026-03-22 06:27:18 +00:00
interface Props {
loading : boolean ;
selectedCommunication : Communication | null ;
}
2026-03-22 07:16:42 +00:00
const emit = defineEmits < Emits > ( ) ;
2026-03-22 06:27:18 +00:00
const messageText = ref ( "" ) ;
const props = withDefaults ( defineProps < Props > ( ) , { } ) ;
2026-03-31 14:52:53 +00:00
function applyMessageTemplate ( template : string ) {
2026-03-22 06:27:18 +00:00
const templates = {
2026-03-31 14:52:53 +00:00
received : ` Dear ${ props . selectedCommunication ? . public _report ? . reporter . name || "Resident" } , \ n \ nThank you for submitting your report to the Mosquito Control District. We have received your communication and it has been assigned to our team for review. \ n \ nWe will be in touch if we need any additional information. \ n \ nBest regards, \ nMosquito Control District ` ,
scheduled : ` Dear ${ props . selectedCommunication ? . public _report ? . reporter . name || "Resident" } , \ n \ nGood news! Based on your report, we have scheduled a service visit to your area. Our technicians will be conducting mosquito control operations within the next 3-5 business days. \ n \ nNo action is required on your part. \ n \ nBest regards, \ nMosquito Control District ` ,
completed : ` Dear ${ props . selectedCommunication ? . public _report ? . reporter . name || "Resident" } , \ n \ nWe wanted to let you know that our team has completed mosquito control operations in your area based on your recent report. \ n \ nIf you continue to experience issues, please don't hesitate to submit a new report. \ n \ nBest regards, \ nMosquito Control District ` ,
need _info : ` Dear ${ props . selectedCommunication ? . public _report ? . reporter . name || "Resident" } , \ n \ nThank you for your recent report. In order to better assist you, we need some additional information: \ n \ n- [Specify what information is needed] \ n \ nPlease reply to this message with the requested details. \ n \ nBest regards, \ nMosquito Control District ` ,
2026-03-22 06:27:18 +00:00
} ;
2026-03-31 14:52:53 +00:00
if ( template in templates ) {
messageText . value = templates [ template as keyof typeof templates ] ;
2026-03-22 06:27:18 +00:00
}
}
2026-03-31 14:52:53 +00:00
function formatDate ( date : string ) {
2026-03-22 06:27:18 +00:00
return new Date ( date ) . toLocaleString ( ) ;
}
2026-03-31 14:52:53 +00:00
function handleTemplateChange ( event : Event ) {
const target = event . target as HTMLSelectElement ;
applyMessageTemplate ( target . value ) ;
}
2026-03-22 07:16:42 +00:00
function markInvalid ( ) {
emit ( "markInvalid" ) ;
}
function markSignal ( ) {
emit ( "markSignal" ) ;
}
function sendMessage ( ) {
emit ( "sendMessage" , messageText . value ) ;
2026-03-22 06:27:18 +00:00
}
< / script >