mirror of
https://github.com/frappe/books.git
synced 2024-11-10 15:50:56 +00:00
Date Component with default flatpickr config
This commit is contained in:
parent
e1266c4f69
commit
fd6eeac8cd
@ -1,12 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="{'form-group': !onlyInput}">
|
<div :class="{'form-group': !onlyInput}">
|
||||||
<label v-if="!onlyInput">{{ docfield.label }}</label>
|
<label v-if="!onlyInput">{{ docfield.label }}</label>
|
||||||
<flat-pickr
|
<flat-pickr class="form-control" :value="value" :config="config" @on-change="emitChange"></flat-pickr>
|
||||||
class="form-control"
|
|
||||||
:value="value"
|
|
||||||
:config="config"
|
|
||||||
@on-change="emitChange">
|
|
||||||
</flat-pickr>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -27,5 +22,5 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "~flatpickr/dist/flatpickr.css";
|
@import '~flatpickr/dist/flatpickr.css';
|
||||||
</style>
|
</style>
|
||||||
|
@ -6,7 +6,21 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
config: {
|
config: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => {
|
||||||
|
let dateFormat = {
|
||||||
|
'dd/MM/yyyy': 'd/m/Y',
|
||||||
|
'MM/dd/yyyy': 'm/d/Y',
|
||||||
|
'dd-MM-yyyy': 'd-m-Y',
|
||||||
|
'MM-dd-yyyy': 'm-d-Y',
|
||||||
|
'yyyy-MM-dd': 'Y-m-d'
|
||||||
|
};
|
||||||
|
let altFormat = dateFormat[frappe.SystemSettings.dateFormat];
|
||||||
|
return {
|
||||||
|
altInput: true,
|
||||||
|
dateFormat: 'Y-m-d',
|
||||||
|
altFormat: altFormat
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
:autofocus="autofocus"
|
:autofocus="autofocus"
|
||||||
:doc="doc"
|
:doc="doc"
|
||||||
:config="dateConfig"
|
|
||||||
@change="$emit('change', $event)"
|
@change="$emit('change', $event)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 text-right" v-for="link of links" :key="link.label">
|
<div class="text-right ml-2" v-for="link of links" :key="link.label">
|
||||||
<f-button primary @click="link.handler">{{ link.label }}</f-button>
|
<f-button secondary @click="link.handler">{{ link.label }}</f-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<h4 class="pb-2">{{ reportConfig.title }}</h4>
|
<div class="row pb-4">
|
||||||
|
<h4 class="col-6 d-flex">{{ reportConfig.title }}</h4>
|
||||||
|
<report-links class="col-6 d-flex pr-0 flex-row-reverse" v-if="linksExists" :links="links"></report-links>
|
||||||
|
</div>
|
||||||
<div class="row pb-4">
|
<div class="row pb-4">
|
||||||
<report-filters
|
<report-filters
|
||||||
:class="linksExists ? 'col-10' : 'col-12'"
|
class="col-12 pr-0"
|
||||||
v-if="filtersExists"
|
v-if="filtersExists"
|
||||||
:filters="reportConfig.filterFields"
|
:filters="reportConfig.filterFields"
|
||||||
:filterDefaults="filters"
|
:filterDefaults="filters"
|
||||||
@change="getReportData"
|
@change="getReportData"
|
||||||
></report-filters>
|
></report-filters>
|
||||||
<report-links class="col-2" v-if="linksExists" :links="links"></report-links>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-2" ref="datatable" v-once></div>
|
<div class="pt-2 pr-3" ref="datatable" v-once></div>
|
||||||
</div>
|
</div>
|
||||||
<not-found v-if="!reportConfig" />
|
<not-found v-if="!reportConfig" />
|
||||||
</div>
|
</div>
|
||||||
@ -20,8 +22,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import DataTable from 'frappe-datatable';
|
import DataTable from 'frappe-datatable';
|
||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import ReportFilters from './ReportFilters';
|
import ReportFilters from 'frappejs/ui/pages/Report/ReportFilters';
|
||||||
import ReportLinks from './ReportLinks';
|
import ReportLinks from 'frappejs/ui/pages/Report/ReportLinks';
|
||||||
import utils from 'frappejs/client/ui/utils';
|
import utils from 'frappejs/client/ui/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -35,6 +37,12 @@ export default {
|
|||||||
return (this.reportConfig.linkFields || []).length;
|
return (this.reportConfig.linkFields || []).length;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
reportName() {
|
||||||
|
//FIX: Report's data forwards to next consecutively changed report
|
||||||
|
this.getReportData(this.filters);
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
links: []
|
links: []
|
||||||
@ -42,7 +50,6 @@ export default {
|
|||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
this.setLinks();
|
this.setLinks();
|
||||||
// this.doc.on('change', this.setLinks);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getReportData(filters) {
|
async getReportData(filters) {
|
||||||
@ -79,7 +86,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.datatable = new DataTable(this.$refs.datatable, {
|
this.datatable = new DataTable(this.$refs.datatable, {
|
||||||
columns: columns,
|
columns: columns,
|
||||||
data: rows
|
data: rows,
|
||||||
|
treeView: this.reportConfig.treeView || false,
|
||||||
|
cellHeight: 35
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return [rows, columns];
|
return [rows, columns];
|
||||||
@ -110,4 +119,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
.datatable {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user