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" >
2026-05-04 19:07:29 +00:00
< div v-if = "isLoading" class="loading" > Loading... < / div >
2026-03-22 10:14:48 +00:00
< 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" >
2026-05-04 19:07:29 +00:00
< p class = "text-muted mt-1" > Send to planning < / p >
2026-03-22 10:14:48 +00:00
< div class = "d-grid mb-3" >
2026-05-04 19:07:29 +00:00
< ButtonLoading
@ click = "markPossibleIssue()"
: disabled = "!selectedReport"
icon = "bi-plus-circle"
: loading = "isLoading"
text = "Possible Issue"
variant = "warning"
/ >
2026-03-22 10:14:48 +00:00
< / div >
2026-03-22 06:27:18 +00:00
2026-03-22 10:14:48 +00:00
< div class = "d-grid mb-3" >
2026-05-04 19:07:29 +00:00
< ButtonLoading
@ click = "markPossibleResolved()"
: disabled = "!selectedReport"
icon = "bi-x-circle"
: loading = "isLoading"
text = "May Be Resolved"
variant = "outline-success"
/ >
< / div >
< hr / >
< div class = "d-grid mb-3" >
< p class = "text-muted mt-1" > Resolve immediately < / p >
< ButtonLoading
@ click = "markInvalid()"
: disabled = "!selectedReport"
icon = "bi-x-circle"
: loading = "isLoading"
text = "Invalid"
variant = "outline-danger"
/ >
< / div >
< div class = "d-grid mb-3" >
< ButtonLoading
@ click = "markPendingResponse()"
: disabled = "!selectedReport"
icon = "bi-clock"
: loading = "isLoading"
text = "Pending Response"
variant = "secondary"
/ >
2026-03-22 10:14:48 +00:00
< / 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-04-28 14:49:02 +00:00
selectedReport ? . reporter . has _email ||
selectedReport ? . 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-04-28 14:49:02 +00:00
selectedReport ? . reporter . has _email ||
selectedReport ? . 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 >
2026-04-30 13:58:31 +00:00
< option value = "completed" > Completed < / option >
< option value = "need_info" > Need More Information < / option >
2026-03-22 10:14:48 +00:00
< option value = "received" > Report Received < / option >
< option value = "scheduled" > Service Scheduled < / option >
2026-04-30 13:58:31 +00:00
< option value = "thanks" > Thanks < / option >
2026-03-22 10:14:48 +00:00
< / 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-04-28 14:49:02 +00:00
v - for = "(entry, index) in selectedReport?.log || []"
2026-04-09 00:25:21 +00:00
: key = "index"
2026-03-22 10:14:48 +00:00
class = "border-start border-2 ps-2 mb-2"
>
2026-04-28 05:15:01 +00:00
< ListCardActivityLog :entry = "entry" / >
2026-03-22 06:27:18 +00:00
< / div >
2026-03-22 10:14:48 +00:00
< div
v - if = "
2026-04-28 14:49:02 +00:00
! selectedReport ? . log || selectedReport ? . 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-04-28 14:49:02 +00:00
import { Communication , PublicReport , User } from "@/type/api" ;
2026-05-04 19:07:29 +00:00
import ButtonLoading from "@/components/common/ButtonLoading.vue" ;
2026-04-28 05:15:01 +00:00
import ListCardActivityLog from "@/components/ListCardActivityLog.vue" ;
2026-03-22 07:16:42 +00:00
interface Emits {
( e : "markInvalid" ) : void ;
2026-05-04 19:07:29 +00:00
( e : "markPendingResponse" ) : void ;
( e : "markPossibleIssue" ) : void ;
( e : "markPossibleResolved" ) : void ;
2026-03-22 07:16:42 +00:00
( e : "sendMessage" , message : string ) : void ;
}
2026-03-22 06:27:18 +00:00
interface Props {
2026-05-04 19:07:29 +00:00
isLoading : boolean ;
2026-03-22 06:27:18 +00:00
selectedCommunication : Communication | null ;
2026-04-28 14:49:02 +00:00
selectedReport : PublicReport | undefined ;
2026-03-22 06:27:18 +00:00
}
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-04-28 14:49:02 +00:00
completed : ` Dear ${ props . selectedReport ? . 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 . selectedReport ? . 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-04-30 13:58:31 +00:00
received : ` Dear ${ props . selectedReport ? . 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 . selectedReport ? . 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 ` ,
thanks : ` Thank you for submitting your pool report, we will be in touch if needed. ` ,
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 handleTemplateChange ( event : Event ) {
const target = event . target as HTMLSelectElement ;
applyMessageTemplate ( target . value ) ;
}
2026-03-22 07:16:42 +00:00
function markInvalid ( ) {
emit ( "markInvalid" ) ;
}
2026-05-04 19:07:29 +00:00
function markPendingResponse ( ) {
emit ( "markPendingResponse" ) ;
}
function markPossibleResolved ( ) {
emit ( "markPossibleResolved" ) ;
}
function markPossibleIssue ( ) {
emit ( "markPossibleIssue" ) ;
2026-03-22 07:16:42 +00:00
}
function sendMessage ( ) {
emit ( "sendMessage" , messageText . value ) ;
2026-03-22 06:27:18 +00:00
}
< / script >