Skip to content
This repository was archived by the owner on Jan 10, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h1 class="text-center">Seeding Report</h1>
</div>
</fieldset>

<custom-table data-cy="report-table" :columns="tableColumns" :rows='tableRows' csv-name="seedingReport_" @row-deleted="deleteRowLog" @row-edited='updateRow' @edit-clicked='disableFilters' @edit-canceled='enableFilters' :can-edit='!isMobile' :can-delete='!isMobile'></custom-table>
<custom-table data-cy="report-table" :columns="tableColumns" :rows='tableRows' csv-name="seedingReport_" @row-deleted="deleteRowLog" @row-edited='updateRow' @edit-clicked='(editID) => { updateEditableArea(editID); disableFilters() }' @edit-canceled='enableFilters' :can-edit='!isMobile' :can-delete='!isMobile'></custom-table>

<br>
</div>
Expand Down Expand Up @@ -96,6 +96,9 @@ <h1 class="text-center">Seeding Report</h1>
reportVisible: false,
seedingLogs: [],
updateLog: [],
greenHouseAreas: [],
fieldAreas: [],
editableAreas: [],

sessionToken: null,
selectedCrop: 'All',
Expand Down Expand Up @@ -150,6 +153,18 @@ <h1 class="text-center">Seeding Report</h1>
areaChange(selectedArea){
this.selectedArea = selectedArea
},
updateEditableArea(rowID) {
for(var i=0; i < this.seedingLogs.length; i++){
if(this.seedingLogs[i].id === rowID){
if(this.seedingLogs[i].log_category[0].name == "Direct Seedings"){
this.editableAreas = this.fieldAreas
}
else{
this.editableAreas = this.greenHouseAreas
}
}
}
},
seedingChange(selectedSeeding){
this.selectedSeeding = selectedSeeding
if(selectedSeeding == 'All'){
Expand Down Expand Up @@ -358,10 +373,10 @@ <h1 class="text-center">Seeding Report</h1>
deleteRecord(url, this.sessionToken)
.then(() => {
for(let j = 0; j < this.seedingLogs.length; j++){
if(this.seedingLogs[j].id == logID[i]){
this.seedingLogs.splice(j, 1)
}
}
if(this.seedingLogs[j].id == logID[i]){
this.seedingLogs.splice(j, 1)
}
}
})
.catch((err => {
this.errBannerVisibility = true
Expand Down Expand Up @@ -781,15 +796,6 @@ <h1 class="text-center">Seeding Report</h1>
return userNameArray
},

areaNameArray(){
let areaNameArray = []
const areaKeyIterator = this.areaToIDMap.keys()
for(i = 0; i < this.areaToIDMap.size; i++){
areaNameArray.push(areaKeyIterator.next().value)
}
return areaNameArray
},

cropNameArray(){
let cropNameArray = []
for(let [key, info] of this.cropToIDMap){
Expand All @@ -805,7 +811,7 @@ <h1 class="text-center">Seeding Report</h1>
return [
{"header": 'Date', "visible": true, "inputType" : {'type': 'date'}},
{"header": 'Crop', "visible": true, "inputType" : {'type': 'dropdown', 'value': this.cropNameArray}},
{"header": 'Area', "visible": true, "inputType" : {'type': 'dropdown', 'value': this.areaNameArray}},
{"header": 'Area', "visible": true, "inputType" : {'type': 'dropdown', 'value': this.editableAreas}},
{"header": 'Seeding', "visible": true, "inputType" : {'type': 'no input'}},
{"header": 'Row Feet', "visible": false, "inputType" : {'type': 'regex', 'regex': '^[1-9]+[0-9]*$'}},
{"header": 'Bed Feet', "visible": false, "inputType" : {'type': 'regex', 'regex': '^[1-9]+[0-9]*$'}},
Expand All @@ -822,10 +828,46 @@ <h1 class="text-center">Seeding Report</h1>
},
pageLoaded() {
// Check here that the correct number of API calls have completed.
return this.createdCount == 8
return this.createdCount == 9
},
},
created() {
let areaResponse = []
if(localStorage.getItem('areas') == null){
getAllPages('/taxonomy_term.json?bundle=farm_areas', this.areaResponse)
.then(() => {
localStorage.setItem('areas', JSON.stringify(this.areaResponse))

this.fieldAreas = this.areaResponse.filter((x) => x.area_type === 'field' || x.area_type === 'bed')
this.fieldAreas = (this.fieldAreas).map((h) => h.name)

this.greenHouseAreas = this.areaResponse.filter((x) => x.area_type === 'greenhouse')
this.greenHouseAreas = (this.greenHouseAreas).map((h) => h.name)

this.createdCount++
})
.catch((err) => {
this.errBannerVisibility = true
})
}
else{
this.areaResponse = JSON.parse(localStorage.getItem('areas'))
getAllPages('/taxonomy_term.json?bundle=farm_areas')
.then((resp) => {
this.areaResponse = resp
localStorage.setItem('areas', JSON.stringify(resp))

this.fieldAreas = this.areaResponse.filter((x) => x.area_type === 'field' || x.area_type === 'bed')
this.fieldAreas = (this.fieldAreas).map((h) => h.name)

this.greenHouseAreas = this.areaResponse.filter((x) => x.area_type === 'greenhouse')
this.greenHouseAreas = (this.greenHouseAreas).map((h) => h.name)
this.createdCount++
})
.catch((err) => {
this.errBannerVisibility = true
})
}
getSessionToken()
.then((response) => {
this.sessionToken = response
Expand Down