Skip to content

Commit

Permalink
Merge pull request #159 from Disfactory/yukai/128-followup-info
Browse files Browse the repository at this point in the history
feat: add factory followups to ui
  • Loading branch information
Yukaii authored Apr 20, 2022
2 parents 54b4bd1 + 5e712d4 commit 845c881
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/components/FactoryDetailPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
</template>

<hr v-if="full || $vuetify.breakpoint.mdAndUp">

<v-btn text depressed elevation="0" :ripple="false" color="#697F01" class="m-0 mb-0 px-0 v-btn-plain" @click="expandFactoryDetail" v-if="!full && !$vuetify.breakpoint.mdAndUp">
顯示更多資訊
&nbsp;
Expand Down Expand Up @@ -104,6 +105,18 @@
<p class="color-gray-light mb-1">{{ desc.date }}</p>
<p style="line-height: 24px;">{{ desc.others }}</p>
</div>

<template v-if="factoryFollowups.length > 0">
<h3 class="mb-1">政府回應</h3>

<div v-for="(followup, index) in factoryFollowups" class="mt-2" :key="index" style="font-size: 14px">
<p class="color-gray-light mb-1">
{{ new Date(followup.created_at).toLocaleDateString() }}
</p>

<p style="line-height: 24px;">{{ followup.note }}</p>
</div>
</template>
</div>
</div>
</div>
Expand Down Expand Up @@ -174,6 +187,14 @@ export default createComponent({
}
})
const factoryFollowups = computed(() => {
if (appState.factoryData) {
return appState.factoryData.follow_ups_for_user
} else {
return []
}
})
const factoryStatusText = computed(() => {
if (typeof factoryStatus.value !== 'undefined') {
const factoryDisplayStatus = getDisplayStatusText(factoryStatus.value)
Expand Down Expand Up @@ -311,6 +332,7 @@ export default createComponent({
})()
}
})
const pastDescriptions = computed(() => {
return reportRecords.value.map(record => {
const date = new Date(record.created_at)
Expand Down Expand Up @@ -352,6 +374,7 @@ export default createComponent({
factoryType,
factoryName,
factoryAddressAndLandcode,
factoryFollowups,
source,
pastDescriptions,
lastUpdatedAt,
Expand Down
6 changes: 5 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ export type FactoryData = {
data_complete: boolean,
before_release: boolean,
document_display_status: DocumentDisplayStatus | null,
feature?: Feature
feature?: Feature,
follow_ups_for_user: {
note: string,
created_at: string
}[]
}

export type FactoriesResponse = Array<FactoryData>
Expand Down

0 comments on commit 845c881

Please sign in to comment.