Display cost per square meter;

This commit is contained in:
Benjamin Bouvier 2017-06-13 17:21:02 +02:00
parent 210192d09c
commit 26e2cdefbe
4 changed files with 23 additions and 0 deletions

View File

@ -20,6 +20,10 @@ const postProcessAPIResults = function (flat) {
}) })
flat.flatisfy_time_to = momentifiedTimeTo flat.flatisfy_time_to = momentifiedTimeTo
} }
// Fill cost per square meter.
flat.sqCost = Math.round(flat.cost * 100 / flat.area) / 100 | 0
/* eslint-enable camelcase */ /* eslint-enable camelcase */
return flat return flat
} }

View File

@ -37,6 +37,13 @@
<span class="sr-only">{{ $t("common.sort" + capitalize(sortOrder)) }}</span> <span class="sr-only">{{ $t("common.sort" + capitalize(sortOrder)) }}</span>
</span> </span>
</th> </th>
<th class="pointer" v-on:click="updateSortBy('sqCost')">
{{ $t("flatsDetails.SquareMeterCost") }}
<span v-if="sortBy === 'sqCost'">
<i class="fa" :class="'fa-angle-' + sortOrder" aria-hidden="true"></i>
<span class="sr-only">{{ $t("common.sort" + capitalize(sortOrder)) }}</span>
</span>
</th>
<th>{{ $t("common.Actions") }}</th> <th>{{ $t("common.Actions") }}</th>
</tr> </tr>
</thead> </thead>
@ -79,6 +86,9 @@
{{ $t("flatsDetails.utilities_excluded") }} {{ $t("flatsDetails.utilities_excluded") }}
</template> </template>
</td> </td>
<td>
{{ flat.sqCost }} {{ flat.currency }}
</td>
<td> <td>
<router-link :to="{name: 'details', params: {id: flat.id}}" :aria-label="$t('common.More_about') + ' ' + flat.id" :title="$t('common.More_about') + ' ' + flat.id"> <router-link :to="{name: 'details', params: {id: flat.id}}" :aria-label="$t('common.More_about') + ' ' + flat.id" :title="$t('common.More_about') + ' ' + flat.id">
<i class="fa fa-plus" aria-hidden="true"></i> <i class="fa fa-plus" aria-hidden="true"></i>

View File

@ -34,6 +34,7 @@ export default {
'Area': 'Area', 'Area': 'Area',
'Rooms': 'Rooms', 'Rooms': 'Rooms',
'Cost': 'Cost', 'Cost': 'Cost',
'SquareMeterCost': 'Cost / m²',
'utilities_included': '(utilities included)', 'utilities_included': '(utilities included)',
'utilities_excluded': '(utilities excluded)', 'utilities_excluded': '(utilities excluded)',
'Description': 'Description', 'Description': 'Description',

View File

@ -97,6 +97,14 @@
</template> </template>
</td> </td>
</tr> </tr>
<tr>
<th>
{{ $t("flatsDetails.SquareMeterCost") }}
</th>
<td>
{{ flat.sqCost }} {{ flat.currency }}
</td>
</tr>
</table> </table>
</div> </div>
<div> <div>