-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
export type SubmissionSearchParameters = { | ||
activityId?: Array<string>; | ||
submissionId?: Array<string>; | ||
intakeStatus?: Array<string>; | ||
includeUser?: boolean; | ||
submissionId?: Array<string>; | ||
submissionType?: Array<string>; | ||
includeDeleted?: boolean; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import { Spinner } from '@/components/layout'; | ||
import { Button, Column, DataTable, useConfirm, useToast } from '@/lib/primevue'; | ||
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (20.x)
Check warning on line 5 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (20.x)
|
||
import { submissionService } from '@/services'; | ||
Check warning on line 6 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 6 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
import { RouteName } from '@/utils/enums/application'; | ||
import { IntakeStatus } from '@/utils/enums/housing'; | ||
Check warning on line 8 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 8 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
import { formatDate } from '@/utils/formatters'; | ||
Check warning on line 9 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 9 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
import type { Ref } from 'vue'; | ||
import type { Submission } from '@/types'; | ||
// Props | ||
type Props = { | ||
loading: boolean; | ||
submissions: Array<Submission> | undefined; | ||
}; | ||
const props = withDefaults(defineProps<Props>(), {}); | ||
// State | ||
const selection: Ref<Submission | undefined> = ref(undefined); | ||
// Actions | ||
// const confirm = useConfirm(); | ||
// const toast = useToast(); | ||
const sortTest = (e = 'meh') => { | ||
Check warning on line 29 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 29 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
console.log('sorttest', e); | ||
Check warning on line 30 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (16.x)
Check warning on line 30 in frontend/src/components/housing/projects/ProjectsList.vue GitHub Actions / Unit Tests (Frontend) (18.x)
|
||
return -1; | ||
}; | ||
</script> | ||
|
||
<template> | ||
<DataTable | ||
v-model:selection="selection" | ||
:loading="loading" | ||
:value="props.submissions" | ||
data-key="submissionId" | ||
scrollable | ||
responsive-layout="scroll" | ||
:paginator="true" | ||
:rows="10" | ||
> | ||
<template #empty> | ||
<div class="flex justify-content-center"> | ||
<h3>No active projects</h3> | ||
</div> | ||
</template> | ||
<template #loading> | ||
<Spinner /> | ||
</template> | ||
<Column | ||
field="projectName" | ||
header="Project Name" | ||
:sortable="true" | ||
style="min-width: 200px" | ||
> | ||
<template #body="{ data }"> | ||
<div :data-activityId="data.activityId"> | ||
<router-link | ||
:to="{ | ||
name: RouteName.HOUSING_SUBMISSION_INTAKE, | ||
query: { activityId: data.activityId, submissionId: data.submissionId } | ||
}" | ||
> | ||
{{ data.projectName }} | ||
</router-link> | ||
</div> | ||
</template> | ||
</Column> | ||
<Column | ||
field="activityId" | ||
header="Confirmation ID" | ||
/> | ||
<Column | ||
field="applicationStatus" | ||
header="Status" | ||
:sortable="true" | ||
style="min-width: 150px" | ||
/> | ||
<Column | ||
field="user" | ||
header="Navigator" | ||
> | ||
<template #body="{ data }"> | ||
<div>{{ data?.user?.firstName }} {{ data?.user?.lastName }}</div> | ||
</template> | ||
</Column> | ||
<Column | ||
field="submittedAt" | ||
header="date" | ||
:sortable="true" | ||
style="min-width: 150px" | ||
/> | ||
</DataTable> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<script setup lang="ts"> | ||
import { onMounted, ref } from 'vue'; | ||
import { useRouter } from 'vue-router'; | ||
import { Button } from '@/lib/primevue'; | ||
import { RouteName } from '@/utils/enums/application'; | ||
import { ApplicationStatus, IntakeStatus, SubmissionType } from '@/utils/enums/housing'; | ||
import ProjectsList from '@/components/housing/projects/ProjectsList.vue'; | ||
import { submissionService } from '@/services'; | ||
import type { Ref } from 'vue'; | ||
import type { Submission } from '@/types'; | ||
const router = useRouter(); | ||
// Enums | ||
const IntakeSearchParams: String[] = [IntakeStatus.ASSIGNED, IntakeStatus.COMPLETED]; | ||
const SubmissionSearchParams: String[] = [SubmissionType.GUIDANCE]; | ||
// State | ||
const loading: Ref<boolean> = ref(true); | ||
const submissions: Ref<Array<Submission>> = ref([]); | ||
// Actions | ||
// Sort ApplicationStatus "completed" to the bottom of list, then sort by submission date | ||
function customSort(a: Submission, b: Submission): number { | ||
if (a.applicationStatus == ApplicationStatus.COMPLETED) { | ||
if (b.applicationStatus == ApplicationStatus.COMPLETED) { | ||
return a.submittedAt > b.submittedAt ? -1 : 1; | ||
} else { | ||
return 1; | ||
} | ||
} | ||
if (b.applicationStatus == ApplicationStatus.COMPLETED) { | ||
return -1; | ||
} | ||
return a.submittedAt > b.submittedAt ? -1 : 1; | ||
} | ||
onMounted(async () => { | ||
const [unsorted] = ( | ||
await Promise.all([ | ||
submissionService.searchSubmissions({ | ||
includeUser: true, | ||
intakeStatus: IntakeSearchParams, | ||
submissionType: SubmissionSearchParams | ||
}) | ||
]) | ||
).map((r) => r.data); | ||
submissions.value = unsorted.sort(customSort); | ||
loading.value = false; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<Button | ||
class="p-0" | ||
text | ||
> | ||
<router-link :to="{ name: RouteName.HOUSING }"> | ||
<span class="app-primary-color">Housing</span> | ||
</router-link> | ||
</Button> | ||
/ | ||
<span class="font-bold">Applications and Permits</span> | ||
</div> | ||
<h1>Application and Permits</h1> | ||
<div class="mt-1 mb-3 flex justify-content-between"> | ||
<h3 class="mb-0">My Projects</h3> | ||
<Button | ||
class="p-button-sm" | ||
outlined | ||
label="+ New project investigation" | ||
@click="router.push({ name: RouteName.HOUSING_SUBMISSION_INTAKE })" | ||
/> | ||
</div> | ||
<ProjectsList | ||
:loading="loading" | ||
:submissions="submissions" | ||
/> | ||
<div>{{ submissions.map((x) => x.submittedAt) }}</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
a { | ||
text-decoration: none; | ||
} | ||
</style> |