Skip to content

Commit

Permalink
Merge pull request #217 from marzmehr/SS-773
Browse files Browse the repository at this point in the history
SS-774, SS-775: updates to the training reports
  • Loading branch information
marzmehr committed Feb 16, 2024
2 parents e518254 + 007fc42 commit 98e5aff
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions api/models/dto/TrainingReportDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class TrainingReportDto
public bool excluded { get; set; }
public Guid sheriffId { get; set; }
public string status { get; set; }
public string location { get; set; }
public string _rowVariant { get; set; }
}
}
2 changes: 2 additions & 0 deletions api/services/usermanagement/TrainingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public async Task<List<TrainingReportDto>> GetSheriffsTrainingReports(TrainingRe
sheriffTrainings.Add(new TrainingReportDto()
{
name = sheriff.FirstName + ' ' + sheriff.LastName,
location = sheriff.HomeLocation.Name,
trainingType = training.Description,
end = null,
expiryDate = null,
Expand All @@ -118,6 +119,7 @@ public async Task<List<TrainingReportDto>> GetSheriffsTrainingReports(TrainingRe
sheriffTrainings.Add(new TrainingReportDto()
{
name = sheriff.FirstName + ' ' + sheriff.LastName,
location = sheriff.HomeLocation.Name,
trainingType = training.Description,
end = takenTraining.EndDate.ConvertToTimezone(timezone),
expiryDate = takenTraining.TrainingCertificationExpiry != null ? ((DateTimeOffset)takenTraining.TrainingCertificationExpiry).ConvertToTimezone(timezone): null,
Expand Down
34 changes: 21 additions & 13 deletions web/src/components/MyTeam/ViewReports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
<v-list-item
ripple
@mousedown.prevent
@click="toggle"
@click="toggleAllSubtypes"
>
<v-list-item-action>
<v-icon :color="reportParameters.reportSubtype.length > 0 ? 'indigo darken-4' : ''">
{{ icon }}
{{ subtypeSelectionIcon }}
</v-icon>
</v-list-item-action>
<v-list-item-content>
Expand Down Expand Up @@ -165,6 +165,7 @@
:currentPage="currentPage"
:perPage="itemsPerPage"
responsive="sm">
<template v-slot:cell(name) ="data"><div v-b-tooltip.hover.right.noninteractive.v-primary :title="data.item.location" >{{data.value}}</div></template>
<template v-slot:cell(end) ="data"> {{data.value | beautify-date}} </template>
<template v-slot:cell(status) ="data">
<b-badge :variant="data.item['_rowVariant']" style="width:6rem;" >{{data.value}}</b-badge>
Expand Down Expand Up @@ -330,7 +331,7 @@
regionId: this.reportParameters.region == 'All'? null : this.reportParameters.region,
locationId: this.reportParameters.location == 'All'? null : this.reportParameters.location,
// reportType: this.reportParameters.reportType,
reportSubtypeIds: this.likesAllSubtypes? [] : this.reportParameters.reportSubtype,
reportSubtypeIds: this.isAllSubtypesSelected? [] : this.reportParameters.reportSubtype,
startDate: this.reportDateRange.valid? this.reportDateRange.startDate : null,
endDate: this.reportDateRange.valid? this.reportDateRange.endDate : null
}
Expand Down Expand Up @@ -379,19 +380,20 @@
useTextFile: false,
useBom: true,
useKeysAsHeaders: false,
headers: ['Name', 'Training Type', 'End Date', 'Expiry Date', 'Status']
headers: ['Location', 'Name', 'Training Type', 'End Date', 'Expiry Date', 'Status']
};
const reportData: trainingReportInfoType[] = [];
for (const trainingData of this.filteredTrainingReportData){
if(trainingData.excluded) continue
const trainingInfo = {} as trainingReportInfoType;
trainingInfo.location = trainingData.location;
trainingInfo.name = trainingData.name;
trainingInfo.trainingType = trainingData.trainingType;
trainingInfo.end = trainingData.end?.length>0?Vue.filter('beautify-date')(trainingData.end):'';
trainingInfo.expiryDate = trainingData.expiryDate?.length>0?Vue.filter('beautify-date')(trainingData.expiryDate):'';
trainingInfo.status = trainingData.status;
trainingInfo.status = this.beautifyTrainingStatusForExcel(trainingData.status);
reportData.push(trainingInfo)
}
Expand All @@ -400,6 +402,12 @@
this.generatingReport = false;
}
public beautifyTrainingStatusForExcel(status){
if(!status || status?.trim()?.length==0) return "Qualified"
else if(status == 'Requalification') return status+' Required'
else return status
}
public getTrainingTypes() {
const url = 'api/managetypes?codeType=TrainingType&showExpired=false';
Expand Down Expand Up @@ -468,27 +476,27 @@
this.paginationExcludedKey++;
}
public toggle () {
public toggleAllSubtypes() {
Vue.nextTick(() => {
if (this.likesAllSubtypes) {
if (this.isAllSubtypesSelected) {
this.reportParameters.reportSubtype = []
} else {
this.reportParameters.reportSubtype = this.trainingTypeOptions.map(t => t.id)
}
})
}
get likesAllSubtypes(){
get isAllSubtypesSelected(){
return this.trainingTypeOptions.length==this.reportParameters.reportSubtype.length
}
get likesSomeSubtypes() {
return this.trainingTypeOptions.length > 0 && !this.likesAllSubtypes
get isSomeSubtypesSelected() {
return this.reportParameters.reportSubtype.length > 0 && !this.isAllSubtypesSelected
}
get icon () {
if (this.likesAllSubtypes) return 'mdi-close-box'
if (this.likesSomeSubtypes) return 'mdi-minus-box'
get subtypeSelectionIcon() {
if (this.isAllSubtypesSelected) return 'mdi-close-box'
if (this.isSomeSubtypesSelected) return 'mdi-minus-box'
return 'mdi-checkbox-blank-outline'
}
Expand Down
1 change: 1 addition & 0 deletions web/src/types/MyTeam/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export interface trainingReportInfoType {
expiryDate: string;
excluded?: boolean;
sheriffId?: string;
location?: string;
status?: string;
}

Expand Down

0 comments on commit 98e5aff

Please sign in to comment.