2
0
mirror of https://github.com/frappe/books.git synced 2025-01-25 16:18:33 +00:00
books/src/pages/ListView/ListCell.vue
Faris Ansari 227133c1ab feat: InvoiceForm
- SalesInvoice List with badges in Status column
- QuickEdit view in InvoiceForm and ListView
- Native Date control for now
- Wrap Quick Edit and Invoice Form in keep-alive
2019-10-11 15:25:50 +05:30

34 lines
882 B
Vue

<template>
<div
class="py-4 flex items-center"
:class="['Float', 'Currency'].includes(column.fieldtype) ? 'justify-end':''"
>
<span v-if="!customRenderer">{{ columnValue }}</span>
<component v-else :is="customRenderer" />
</div>
</template>
<script>
import frappe from 'frappejs';
export default {
name: 'ListCell',
props: ['doc', 'column'],
computed: {
columnValue() {
let { column, doc } = this;
// Since currency is formatted in customer currency
// frappe.format parses it back into company currency
if (['Float', 'Currency'].includes(column.fieldtype)) {
return column.getValue(doc);
} else {
return frappe.format(column.getValue(doc), column.fieldtype);
}
},
customRenderer() {
if (!this.column.render) return;
return this.column.render(this.doc);
}
}
};
</script>