Skip to content

Commit

Permalink
Merge pull request DickinsonCollege#1 from JingyuMarcelLee/CalendarTask
Browse files Browse the repository at this point in the history
added calendar
  • Loading branch information
JingyuMarcelLee authored Apr 13, 2022
2 parents 5aaae37 + 7b5c378 commit 66ae3b5
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
9 changes: 9 additions & 0 deletions farmdata2_modules/fd2_tabs/fd2_barn_kit/fd2_barn_kit.module
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ function fd2_barn_kit_menu() {
'weight' => -60,
);

$items['farm/fd2-barn-kit/ActivePlantingReport'] = array(
'title' => 'Active Planting Report',
'type' => MENU_LOCAL_TASK,
'page callback' => 'fd2_barn_kit_view',
'page arguments' => array('report.html'),
'access arguments' => array('view fd2 barn kit'),
'weight' => -60,
);

return $items;
};

Expand Down
64 changes: 64 additions & 0 deletions farmdata2_modules/fd2_tabs/fd2_barn_kit/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

<body>
<div id="seedingReport" v-cloak>
<h1 class="text-center">Active Seeding Report</h1>
<fieldset :disabled="rowBeingEdited" class="panel panel-default center-block" style="width: 50%;">
<legend class="panel-heading" style="background-color: #d62a17; color: white;">Set Dates</legend>
<div style="display: flex;width: 100%; padding: 7px">
<date-range-selection data-cy="date-range-selection" class="center-block" @start-date-changed='startDateChange' @end-date-changed='endDateChange'
@click='hide'
:default-start-date=startDate :default-end-date=endDate></date-range-selection>

<button data-cy="generate-rpt-btn" class="btn center-block btn-primary" v-if='!reportVisible' @click='seedingLogRequestWithDates'>Generate Report</button>
</div>
</fieldset>
</div>

<script src="https://unpkg.com/vue@2"></script>
<script>
var seedingReport = new Vue ({
el: '#seedingReport',
components: {

'date-range-selection': DateRangeSelectionComponent,

},
data: {
startDate:'2020-05-01',//dayjs().startOf('year').format('YYYY-MM-DD').toString(),
endDate: dayjs().format('YYYY-MM-DD').toString(),


},
methods: {
hide(){
this.reportVisible = false
this.seedingLogs = []
},
startDateChange(selectedDate){
this.startDate = selectedDate
//this.reportVisible = false
//this.seedingLogs = []
},
endDateChange(selectedDate){
this.endDate = selectedDate
//this.reportVisible = false
//this.seedingLogs = []
},
seedingLogRequestWithDates(){
this.reportVisible = true
let link = '/log.json?type=farm_seeding&timestamp[ge]=' + dayjs(this.startDate).unix() + '&timestamp[le]=' + dayjs(this.endDate).unix()

getAllPages(link, this.seedingLogs).then(() => {
this.stillLoading = false
})
this.stillLoading = true
},

},



});
Vue.config.devtools = true;
</script>
</body>

0 comments on commit 66ae3b5

Please sign in to comment.