Skip to content

Commit

Permalink
Merge pull request #204 from sunbird-cb/form-fixes-new
Browse files Browse the repository at this point in the history
Form fixes new
  • Loading branch information
christyfernandes authored Jun 21, 2023
2 parents c59d051 + 0e3a2b1 commit 13000c9
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 11,773 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"@types/lodash": "4.14.172",
"@types/mustache": "^0.8.32",
"@types/node": "^10.17.60",
"@types/pdfjs-dist": "^2.1.3",
"@types/pdfjs-dist": "2.1.3",
"@types/quill": "^2.0.2",
"@types/uuid": "^8.3.3",
"@types/video.js": "7.2.12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export class RolesAccessComponent implements OnInit, AfterViewInit, OnDestroy {

/* Click event to navigate to a particular role */
onRoleClick(role: any) {
// debugger
this.router.navigate([`/app/roles/${role.role}/users`])
// this.router.navigate([`/app/home/roles-users`], { queryParams: { role: event.role, orgID: rootOrgId } })
// this.telemetrySvc.impression()
this.events.raiseInteractTelemetry(
{
Expand All @@ -67,6 +69,7 @@ export class RolesAccessComponent implements OnInit, AfterViewInit, OnDestroy {

}
fetchIndidualRoleData(rootOrgId: string, rolename: string) {
// debugger
this.usersService.getAllRoleUsers(rootOrgId, rolename).subscribe(data => {
this.roleCountSpinner = true
const individualCount = data.count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,54 +252,77 @@ export class UsersViewComponent implements OnInit, OnDestroy {
}

async downloadUserList() {
// const tempData: any = []
// if (this.currentFilter === 'active') {
// this.activeUsers.forEach((element: any) => {
// let tempRoles = ''
// element.role.forEach((roleEle: any, index: any) => {
// tempRoles = `${roleEle}${(index === 0) ? '' : ', '}${tempRoles}`
// })
// tempData.push({
// 'Full Name': element.fullname,
// Email: element.email,
// Roles: tempRoles,
// Active: element.active,
// // 'Organisation ID': element.orgId,
// // 'Organisation Name': element.orgName,
// })
// })
// }
// if (this.currentFilter === 'inactive') {
// this.inActiveUsers.forEach((element: any) => {
// let tempRoles = ''
// element.role.forEach((roleEle: any, index: any) => {
// tempRoles = `${roleEle}${(index === 0) ? '' : ', '}${tempRoles}`
// })
// tempData.push({
// 'Full Name': element.fullname,
// Email: element.email,
// Roles: tempRoles,
// Active: element.active,
// // 'Organisation ID': element.orgId,
// // 'Organisation Name': element.orgName,
// })
// })
// }
// const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(tempData)
// const wb: XLSX.WorkBook = XLSX.utils.book_new()
// XLSX.utils.book_append_sheet(wb, ws, 'Sheet1')
// XLSX.writeFile(wb, `${(this.currentFilter === 'active') ?
// 'Active-' : (this.currentFilter === 'inactive') ? 'Inactive-' : ''}UserList.xlsx`)
// const tempDate = new Date() ${tempDate.getFullYear()}-${month}-${tempDate.getDate()}

const popup = this.snackBar

const fileName = `userReport.xlsx`

const downloadUrl = `${environment.domainName}${environment.userBucket}${this.configSvc.userProfile.rootOrgId}/${fileName}`
window.location.href = downloadUrl

const xhr = new XMLHttpRequest()

xhr.onreadystatechange = () => {

if (xhr.readyState !== 4) {

return

}

if (xhr.status === 200) {

window.location.href = downloadUrl

} else {

popup.open('Report is not available')

}

}

xhr.open('GET', downloadUrl)

xhr.send()

}

downloadConsumptionReport() {

const popup = this.snackBar

const fileName = `userEnrolmentReport.xlsx`

const downloadUrl = `${environment.domainName}${environment.userBucket}${this.configSvc.userProfile.rootOrgId}/${fileName}`
window.location.href = downloadUrl

// window.location.href = downloadUrl

const xhr = new XMLHttpRequest()

xhr.onreadystatechange = () => {

if (xhr.readyState !== 4) {

return

}

if (xhr.status === 200) {

window.location.href = downloadUrl

} else {

popup.open('Report is not available')

}

}

xhr.open('GET', downloadUrl)

xhr.send()

}

onUploadClick() {
Expand Down
Loading

0 comments on commit 13000c9

Please sign in to comment.