2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00

fix: Minor component fixes

- Use meta.getKeywordFields instead of keywordFields
- Make the full "Add Row" Row clickable
- Highlight today's date in DatePicker
- Set default filters on activated in Report
This commit is contained in:
Faris Ansari 2019-12-20 12:24:12 +05:30
parent c0c7a9edbb
commit c9d0219320
4 changed files with 17 additions and 13 deletions

View File

@ -18,7 +18,9 @@ export default {
let results = await frappe.db.getAll({
doctype,
filters,
fields: [...new Set(['name', meta.titleField, ...meta.keywordFields])]
fields: [
...new Set(['name', meta.titleField, ...meta.getKeywordFields()])
]
});
let createNewOption = this.getCreateNewOption();
let suggestions = results
@ -77,8 +79,6 @@ export default {
async openNewDoc() {
let doctype = this.df.target;
let doc = await frappe.getNewDoc(doctype);
let currentPath = this.$route.path;
let currentQuery = this.$route.query;
let filters = await this.getFilters();
openQuickEdit({
doctype,

View File

@ -17,24 +17,25 @@
{{ df.label }}
</div>
</Row>
<TableRow v-for="row in value" :key="row.name" v-bind="{ row, tableFields, size, ratio, isNumeric }" />
<TableRow
v-for="row in value"
:key="row.name"
v-bind="{ row, tableFields, size, ratio, isNumeric }"
/>
<Row
:ratio="ratio"
class="text-gray-500 cursor-pointer border-transparent px-2 w-full"
v-if="!isReadOnly"
@click.native="addRow"
>
<div class="flex items-center pl-1">
<feather-icon
name="plus"
class="w-4 h-4 text-gray-500"
/>
<feather-icon name="plus" class="w-4 h-4 text-gray-500" />
</div>
<div
:class="{
'px-2 py-3': size === 'small',
'px-3 py-4': size !== 'small'
}"
@click="addRow"
>
{{ _('Add Row') }}
</div>
@ -43,8 +44,8 @@
</template>
<script>
import frappe from 'frappejs';
import Row from '@/components/Row';
import Icon from '@/components/Icon';
import Base from './Base';
import TableRow from './TableRow';
@ -58,7 +59,6 @@ export default {
},
components: {
Row,
Icon,
TableRow
},
methods: {
@ -70,7 +70,7 @@ export default {
},
computed: {
ratio() {
return [0.3].concat(this.tableFields.map(_ => 1));
return [0.3].concat(this.tableFields.map(() => 1));
},
tableFields() {
let meta = frappe.getMeta(this.df.childtype);

View File

@ -58,6 +58,7 @@
class="w-6 h-6 mr-1 last:mr-0 flex-center cursor-pointer rounded-md hover:bg-blue-100 hover:text-blue-500"
:class="{
'text-gray-600': date.getMonth() !== currentMonth - 1,
'text-blue-500': toValue(date) === toValue(today),
'bg-blue-100 font-semibold text-blue-500':
toValue(date) === value
}"
@ -95,6 +96,9 @@ export default {
this.selectCurrentMonthYear();
},
computed: {
today() {
return this.getDate();
},
datesAsWeeks() {
let datesAsWeeks = [];
let dates = this.dates.slice();

View File

@ -117,7 +117,7 @@ export default {
}
};
},
async mounted() {
async activated() {
this.reportData.columns = this.report.getColumns();
await this.setDefaultFilters();
await this.fetchReportData();