Skip to content

Commit

Permalink
OFMCC-364 - update after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
vietle-cgi committed Nov 6, 2023
1 parent f8cd4f2 commit 7778ae6
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 125 deletions.
2 changes: 1 addition & 1 deletion backend/src/components/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function mapMessageObjectForFront(data) {

function mapAssistanceRequestObjectForBack(data) {
let assistanceRequest = new MappableObjectForBack(data, AssistanceRequestMappings).toJSON()
if (assistanceRequest['ofm_contact_method'] == '1') delete assistanceRequest['ofm_telephone']
if (assistanceRequest['ofm_contact_method'] === '1') delete assistanceRequest['ofm_telephone']
assistanceRequest['[email protected]'] = `/ofm_request_categories(${data?.requestCategoryId})`
assistanceRequest['[email protected]'] = `/contacts(${data?.contactId})`
assistanceRequest['ofm_facility_request_request'] = []
Expand Down
165 changes: 148 additions & 17 deletions frontend/src/components/messages/MessagesTab.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,169 @@
<template>
<v-container class="px-10">
<v-btn id="new-message" text @click="openNewRequestDialog()">
<v-icon class="mr-2">mdi-email-plus-outline</v-icon>
New message
</v-btn>
<NewRequestDialog :showNewRequestDialog="showNewRequestDialog" @closeNewRequestDialog="closeNewRequestDialog" />
<v-container class="pa-3">
<v-row>
<v-col cols="6" class="border-right pa-0">
<v-data-table :headers="headers" hover single-select height="500px" density="compact">
<template v-slot:top>
<div class="slot-top">
<div class="flex-container">
<div id="new-message" @click="toggleNewRequestDialog()" class="flex-item message-button">
<v-icon class="icon">mdi-email-plus-outline</v-icon>
<span class="icon-text">New message</span>
</div>
<div @click="false" class="flex-item message-button">
<v-icon class="icon">mdi-email-outline</v-icon>
<span class="icon-text">Mark unread</span>
</div>
<div @click="false" class="flex-item message-button">
<v-icon class="icon">mdi-email-open-outline</v-icon>
<span class="icon-text">Mark read</span>
</div>
</div>
</div>
</template>
<!-- <template #headers="{ columns, isSorted, getSortIcon, toggleSort }">
<tr>
<th v-for="column in columns" :key="column.key" @click="toggleSort(column)"
:style="{ width: column.width }">
<div v-if="column.title === null">
<v-checkbox v-model="checkBoxToggleAllState" @click="toggleAllCheckBoxHandler" hide-details
density="compact"></v-checkbox>
</div>
<div v-else>
{{ column.title }}
<v-icon v-if="isSorted(column)">{{ getSortIcon(column) }}</v-icon>
</div>
</th>
</tr>
</template>
<template #item="{ item, index }">
<tr @click="rowClickHandler(item, index)"
:class="{ 'unread-notification': !item.selectable.isRead, 'highlighted': index === rowClickedIndex }">
<td :class="{ 'highlighted': index === rowClickedIndex }">
<v-checkbox @click="checkBoxClickHandler" v-model="checkBoxListState[index]" hide-details
density="compact"></v-checkbox>
</td>
<td :class="{ 'highlighted': index === rowClickedIndex }">{{ (item.selectable.isRead) ? 'Read' : 'Unread' }}
</td>
<td :class="{ 'highlighted': index === rowClickedIndex }">{{ item.selectable.subject }}</td>
<td :class="{ 'highlighted': index === rowClickedIndex }">{{ item.selectable.dateReceived }}</td>
</tr>
</template> -->
<template v-slot:bottom></template>
</v-data-table>
</v-col>
<v-col cols="6">
<v-card v-if="false" variant="flat">
<v-card-title class="card-title d-flex align-start flex-wrap">
<!-- <div class="d-flex align-center justify-space-between w-100">
<div class="d-flex align-center">
<span class="font-bold">From:</span>&nbsp;Operating Funding Model Program
</div>
<v-icon class="icon ml-3">mdi-email-outline</v-icon>
<span class="icon-text">Mark Unread</span>
</div>
</div> -->
<!-- <div class="mt-2 w-100">
{{ notificationSelected.selectable.subject }}
</div> -->
</v-card-title>
<hr />
<v-card-text></v-card-text>
</v-card>
</v-col>
</v-row>
<NewRequestDialog class="pa-0" :show="showNewRequestDialog" @close="toggleNewRequestDialog" />
</v-container>
</template>

<script>
import { mapState } from 'pinia'
import NewRequestDialog from '@/components/messages/NewRequestDialog.vue'
import { useAuthStore } from '@/stores/auth'
export default {
name: 'MessagesTab',
components: { NewRequestDialog },
data() {
return {
showNewRequestDialog: false,
headers: [
{ title: null, align: 'start', key: 'name', sortable: false, width: '8%' },
{ title: 'Status', align: 'start', key: 'isRead', sortable: true, width: '10%' },
{ title: 'Subject', align: 'start', key: 'subject', sortable: true, width: '30%' },
{ title: 'Topic', align: 'start', key: 'topic', sortable: true, width: '20%' },
{ title: 'Last updated', align: 'start', key: 'dateReceived', sortable: true, width: '30%' },
],
}
},
computed: {
...mapState(useAuthStore, ['userInfo']),
},
computed: {},
methods: {
openNewRequestDialog() {
this.showNewRequestDialog = true
},
closeNewRequestDialog() {
this.showNewRequestDialog = false
toggleNewRequestDialog() {
this.showNewRequestDialog = !this.showNewRequestDialog
},
},
}
</script>

<style scoped></style>
<style scoped>
.flex-container {
display: flex;
justify-content: space-evenly;
}
.flex-item {
display: flex;
align-items: left;
}
.icon {
font-size: 24px;
padding-right: 2px;
color: #6699cc;
cursor: pointer;
}
.icon-text {
color: #6699cc;
cursor: pointer;
transition: color 0.3s ease;
padding: 2px 0px;
}
.message-button:hover {
opacity: 0.8;
}
.font-bold {
font-weight: bold;
}
.slot-top {
padding-top: 8px;
padding-bottom: 8px;
border-bottom: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
}
.unread-notification {
font-size: small;
font-weight: bold;
}
.border-right {
border-right: 2px solid #6699cc;
}
hr {
border: 0;
height: 1px;
background: #6699cc;
background-image: linear-gradient(to right, #6699cc, #6699cc, #6699cc);
}
.card-title {
font-size: medium;
padding-left: 0px !important;
}
.highlighted {
background-color: #d4eaff !important;
}
</style>
32 changes: 12 additions & 20 deletions frontend/src/components/messages/NewRequestConfirmationDialog.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<template>
<AppDialog v-model="isDisplayed" :title="dialogTitle" persistent max-width="40%" @closeDialog="closeDialog">
<AppDialog v-model="isDisplayed" title="Success" persistent max-width="40%" @close="closeDialog">
<template #content>
<v-row>
<v-row class="mb-2">
<v-col align="center">
<p class="pt-4 text-h5">Your message has been submitted.</p>
<p class="pt-4 text-h5">Reference: {{ referenceNumber }}</p>
<p class="pt-4 text-h5">Typical response times are 3-5 business days.</p>
<p class="pt-4 text-h6">Your message has been submitted.</p>
<p class="pt-4 text-h6">Reference: {{ referenceNumber }}</p>
<p class="pt-4 text-h6">Typical response times are 3-5 business days.</p>
</v-col>
</v-row>
</template>
<template #button>
<v-row justify="space-around">
<AppButton id="return-home-button" :isPrimary="false" size="large" width="200px" @click="returnToHome()">Return to home</AppButton>
<AppButton id="view-messages-button" size="large" width="200px" @click="viewMessages()">View messages</AppButton>
<AppButton id="return-home-button" :primary="false" size="large" width="200px" :to="{ name: 'home' }">Return to home</AppButton>
<AppButton id="view-messages-button" size="large" width="200px" @click="closeDialog()">View messages</AppButton>
</v-row>
</template>
</AppDialog>
Expand All @@ -21,13 +21,12 @@
<script>
import AppButton from '../ui/AppButton.vue'
import AppDialog from '../ui/AppDialog.vue'
import { PATHS } from '@/utils/constants'
export default {
name: 'NewRequestConfirmationDialog',
components: { AppButton, AppDialog },
props: {
showNewRequestConfirmationDialog: {
show: {
type: Boolean,
default: false,
},
Expand All @@ -36,30 +35,23 @@ export default {
default: '',
},
},
emits: ['closeNewRequestConfirmationDialog'],
emits: ['close'],
data() {
return {
isDisplayed: false,
dialogTitle: 'Success',
}
},
computed: {},
watch: {
showNewRequestConfirmationDialog: {
show: {
handler(value) {
this.isDisplayed = value
},
},
},
methods: {
returnToHome() {
this.closeDialog()
this.$router.push(PATHS.HOME)
},
viewMessages() {
this.closeDialog()
},
closeDialog() {
this.$emit('closeNewRequestConfirmationDialog')
this.$emit('close')
},
},
}
Expand Down
Loading

0 comments on commit 7778ae6

Please sign in to comment.