Skip to content

Commit

Permalink
display match and flag buttons in each row. clear search text on clos…
Browse files Browse the repository at this point in the history
…ing window. reset reco level on CSV reupload
  • Loading branch information
ashaban committed Sep 13, 2018
1 parent 7ed381d commit 1e93beb
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 52 deletions.
1 change: 0 additions & 1 deletion facility-recon-backend/lib/dhis.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ async function processMetaData(full, dousers, doservices) {
const hasKey = await checkLoaderDataStore();
let lastUpdate = false;
if (!full && hasKey) {
winston.error('here')
lastUpdate = await getLastUpdate();
// Convert to yyyy-mm-dd format (dropping time as it is ignored by DHIS2)
lastUpdate = new Date(Date.parse(lastUpdate)).toISOString().substr(0, 10);
Expand Down
15 changes: 11 additions & 4 deletions facility-recon-backend/lib/mcsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,11 @@ module.exports = function () {

countLevels(source, topOrgId, callback) {
const database = config.getConf('mCSD:database');
if (source == 'MOH') var url = `${URI(config.getConf('mCSD:url')).segment(topOrgId).segment('fhir').segment('Location')}?partof=Location/${topOrgId.toString()}`;
else if (source == 'DATIM') var url = `${URI(config.getConf('mCSD:url')).segment(database).segment('fhir').segment('Location')}?partof=Location/${topOrgId.toString()}`;
if (source == 'MOH') {
var url = `${URI(config.getConf('mCSD:url')).segment(topOrgId).segment('fhir').segment('Location')}?partof=Location/${topOrgId.toString()}`;
} else if (source == 'DATIM') {
var url = `${URI(config.getConf('mCSD:url')).segment(database).segment('fhir').segment('Location')}?partof=Location/${topOrgId.toString()}`;
}

let totalLevels = 1;

Expand All @@ -481,7 +484,9 @@ module.exports = function () {
return callback(0);
}
body = JSON.parse(body);
if (body.total == 0) return callback(totalLevels);
if (body.total == 0) {
return callback(totalLevels);
}
let counter = 0;
async.eachSeries(body.entry, (entry, nxtEntry) => {
if (entry.resource.name.startsWith('_') || counter > 0) {
Expand All @@ -501,7 +506,9 @@ module.exports = function () {
var url = `${URI(config.getConf('mCSD:url')).segment(database).segment('fhir').segment('Location')}?partof=Location/${reference.toString()}`;
}
cntLvls(url, totalLevels => callback(totalLevels));
} else return callback(totalLevels);
} else {
return callback(totalLevels);
}
}, () => callback(totalLevels));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default {
'appSyncProgress': SyncProgress
},
created () {
console.log('created')
this.syncRunning = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ export default {
}
if (uploadProgress.data.status === 'Done' || uploadProgress.data.status >= 100) {
clearInterval(this.UploadProgressTimer)
// resetting reco level
this.$store.state.recoLevel = 2
this.$root.$emit('recalculateScores')
this.$root.$emit('reloadTree')
this.percentDialog = false
Expand Down
120 changes: 74 additions & 46 deletions facility-recon-gui/src/components/FacilityReconScores.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
<template>
<v-container fluid>
<v-dialog persistent v-model="confirmMatch" max-width="500px">
<v-card>
<v-toolbar color="primary" dark>
<v-toolbar-title>
Warning
</v-toolbar-title>
</v-toolbar>
<v-card-text>
Are you sure you want to {{matchType}} {{selectedMohName}} with {{selectedDatimName}}
</v-card-text>
<v-card-actions>
<v-btn color="error" @click.native="confirmMatch = false">Cancel</v-btn>
<v-btn color="primary" dark @click.native="match()">Proceed</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dynamicProgress" hide-overlay persistent width="300">
<v-card color="primary" dark>
<v-card-text>
Expand Down Expand Up @@ -95,57 +111,62 @@
</tr>
</template>
<template slot="items" slot-scope="props">
<tr @click='changeMappingSelection(props.item.id,props.item.name)'>
<v-radio-group v-model='selectedDatimId' style="height: 5px">
<td>
<v-radio :value="props.item.id" color="red"></v-radio>
</td>
</v-radio-group>
<tr>
<td>{{props.item.name}}</td>
<td>{{props.item.id}}</td>
<td v-if='$store.state.recoLevel == $store.state.totalLevels'>{{props.item.lat}}</td>
<td v-if='$store.state.recoLevel == $store.state.totalLevels'>{{props.item.long}}</td>
<td v-if='$store.state.recoLevel == $store.state.totalLevels'>{{props.item.geoDistance}}</td>
<td>{{props.item.score}}</td>
<td>
<v-tooltip top>
<v-btn color="error" small @click.native="confirm('flag',props.item.id)" slot="activator">
<v-icon dark left>notification_important</v-icon>Flag
</v-btn>
<span>Mark the selected item as a match to be reviewed</span>
</v-tooltip>
<v-tooltip top>
<v-btn color="primary" small dark @click.native="confirm('match',props.item.id)" slot="activator">
<v-icon left>thumb_up</v-icon>Save Match
</v-btn>
<span>Save the selected item as a match</span>
</v-tooltip>
</td>
</tr>
</template>
</v-data-table>
</v-card-text>
<v-card-actions style='float: center'>
<v-tooltip top>
<v-btn color="error" @click.native="match('flag')" slot="activator">
<v-icon dark left>notification_important</v-icon>Flag
</v-btn>
<span>Mark the selected item as a match to be reviewed</span>
</v-tooltip>
<v-tooltip top>
<v-btn color="green" dark @click.native="noMatch" slot="activator">
<v-icon left>thumb_down</v-icon>No Match
</v-btn>
<span>Save this MOH location as having no match</span>
</v-tooltip>
<v-tooltip top>
<v-btn color="primary" dark @click.native="match('match')" slot="activator">
<v-icon left>thumb_up</v-icon>Save Match
</v-btn>
<span>Save the selected item as a match</span>
</v-tooltip>
<v-tooltip top>
<v-btn-toggle v-if='potentialAvailable' v-model="showAllPotential" slot="activator">
<v-btn color="teal darken-2" style="color: white;" value="all">
<template v-if="showAllPotential === 'all'">Show Scored Suggestions</template>
<template v-else>Show All Suggestions</template>
</v-btn>
</v-btn-toggle>
<span v-if="showAllPotential === 'all'">Limit to only scored suggestions</span>
<span v-else>See all possible choices ignoring the score</span>
</v-tooltip>
<v-tooltip top>
<v-btn color="orange darken-2" @click.native="back" style="color: white" slot="activator">
<v-icon dark left>arrow_back</v-icon>Back
</v-btn>
<span>Return without saving</span>
</v-tooltip>
<v-layout row wrap>
<v-flex xs4 text-sm-left>
<v-tooltip top>
<v-btn color="green" small dark @click.native="noMatch" slot="activator">
<v-icon left>thumb_down</v-icon>No Match
</v-btn>
<span>Save this MOH location as having no match</span>
</v-tooltip>
</v-flex>
<v-flex xs4 text-xs-center>
<v-tooltip top>
<v-btn-toggle v-if='potentialAvailable' v-model="showAllPotential" slot="activator">
<v-btn color="teal darken-2" style="color: white;" value="all">
<template v-if="showAllPotential === 'all'">Show Scored Suggestions</template>
<template v-else>Show All Suggestions</template>
</v-btn>
</v-btn-toggle>
<span v-if="showAllPotential === 'all'">Limit to only scored suggestions</span>
<span v-else>See all possible choices ignoring the score</span>
</v-tooltip>
</v-flex>
<v-flex xs4 text-sm-right>
<v-tooltip top>
<v-btn color="orange darken-2" @click.native="back" style="color: white" slot="activator">
<v-icon dark left>arrow_back</v-icon>Back
</v-btn>
<span>Return without saving</span>
</v-tooltip>
</v-flex>
</v-layout>
</v-card-actions>
</v-card>
</v-dialog>
Expand Down Expand Up @@ -538,6 +559,8 @@ export default {
selectedMohParents: [],
selectedDatimId: null,
selectedDatimName: null,
matchType: '',
confirmMatch: false,
dialog: false,
mohUnmatchedHeaders: [{ text: 'Location', value: 'name' }],
matchedHeaders: [
Expand Down Expand Up @@ -647,17 +670,20 @@ export default {
}
this.dialog = true
},
changeMappingSelection (id, name) {
confirm (type, id, name) {
this.confirmMatch = true
this.matchType = type
this.selectedDatimId = id
this.selectedDatimName = name
},
match (type) {
match () {
if (this.selectedDatimId === null) {
this.alert = true
this.alertTitle = 'Information'
this.alertText = 'Select DATIM Location to match against MOH Location'
return
}
this.confirmMatch = false
this.progressTitle = 'Saving match'
this.dynamicProgress = true
let formData = new FormData()
Expand All @@ -667,7 +693,7 @@ export default {
formData.append('totalLevels', this.$store.state.totalLevels)
var orgid = this.$store.state.orgUnit.OrgId
axios
.post(backendServer + '/match/' + type + '/' + orgid, formData, {
.post(backendServer + '/match/' + this.matchType + '/' + orgid, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
Expand All @@ -686,7 +712,7 @@ export default {
// Add from a list of MOH Matched and remove from list of MOH unMatched
for (let k in this.$store.state.mohUnMatched) {
if (this.$store.state.mohUnMatched[k].id === this.selectedMohId) {
if (type === 'match') {
if (this.matchType === 'match') {
++this.$store.state.totalAllMapped
this.$store.state.matchedContent.push({
mohName: this.selectedMohName,
Expand All @@ -696,7 +722,7 @@ export default {
datimId: this.selectedDatimId,
datimParents: datimParents
})
} else if (type === 'flag') {
} else if (this.matchType === 'flag') {
++this.$store.state.totalAllFlagged
this.$store.state.flagged.push({
mohName: this.selectedMohName,
Expand All @@ -713,6 +739,7 @@ export default {
this.selectedMohId = null
this.selectedMohName = null
this.selectedDatimId = null
this.matchType = ''
this.dialog = false
})
.catch(err => {
Expand Down Expand Up @@ -906,6 +933,7 @@ export default {
})
},
back () {
this.searchPotential = ''
this.dialog = false
this.selectedDatimId = null
}
Expand Down Expand Up @@ -1200,4 +1228,4 @@ export default {
</script>

<style>
</style>
</style>

0 comments on commit 1e93beb

Please sign in to comment.