Skip to content

Commit

Permalink
Merge pull request #45 from KB-iGOT/mdo-not-my-user-issue
Browse files Browse the repository at this point in the history
Mdo not my user issue
  • Loading branch information
vishnubansaltarento authored Sep 27, 2024
2 parents f6b0b57 + 9e9dfe4 commit 76ad833
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,7 @@
</div>
</div>

<div class="float-right">
<!-- {{appData?.needApprovalList.length}}-->
<div class="float-right" *ngIf="currentFilter === 'profileverification'">
<p class="mat-body-2 margin-top-m margin-right-m"><mat-icon class="orangeicon">error</mat-icon>
<span>approval pending</span>
</p>
Expand All @@ -725,7 +724,7 @@
</p>
</div>
<div class="flex flex-row margin-top-m" *ngIf="appData?.needApprovalList?.length > 0">
<ng-container *ngFor="let field of appData.needApprovalList | slice: 0 : 1">
<ng-container *ngFor="let field of appData.needApprovalList">
<div class="md:w-1/3 margin-bottom-s" *ngIf="field.label === 'Group'">
<label class="view-text-label">Group</label>
<div>
Expand Down Expand Up @@ -910,7 +909,7 @@
class="margin-right-m btn-success btn-responsive successbtn"
[disabled]="appData.needApprovalList.length !== actionList.length">
<span class="text-white" i18n>
Update
{{currentFilter === 'transfers' ? 'Approve': 'Update'}}
</span>
</button>
<button mat-raised-button type="submit" (click)="onApprovalCancel(panel, appData)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,30 +300,29 @@ export class UserCardComponent implements OnInit, OnChanges, AfterViewChecked, A
approvalData.forEach((appdata: any) => {
if (appdata.userWorkflow.wfInfo && appdata.userWorkflow.wfInfo.length > 0) {
appdata.needApprovalList = []
// appdata.userWorkflow.wfInfo.forEach((wf: any) => {
const wf = appdata.userWorkflow.wfInfo[0]
if (typeof wf.updateFieldValues === 'string') {
const fields = JSON.parse(wf.updateFieldValues)
if (fields.length > 0) {
fields.forEach((field: any) => {
const labelKey = Object.keys(field.toValue)[0]
const feildNameObj = labelKey === 'designation' ? 'Designation' : 'Group'
if (labelKey === 'designation' || labelKey === 'group') {
appdata.needApprovalList.push(
Object.assign({
wf,
feildName: labelKey,
label: feildNameObj,
value: field.toValue[labelKey],
fieldKey: field.fieldKey,
wfId: wf.wfId,
})
)
}
})
appdata.userWorkflow.wfInfo.forEach((wf: any) => {
if (typeof wf.updateFieldValues === 'string') {
const fields = JSON.parse(wf.updateFieldValues)
if (fields.length > 0) {
fields.forEach((field: any) => {
const labelKey = Object.keys(field.toValue)[0]
const feildNameObj = labelKey === 'designation' ? 'Designation' : 'Group'
if (labelKey === 'designation' || labelKey === 'group') {
appdata.needApprovalList.push(
Object.assign({
wf,
feildName: labelKey,
label: feildNameObj,
value: field.toValue[labelKey],
fieldKey: field.fieldKey,
wfId: wf.wfId,
})
)
}
})
}
}
}
// })
})
}
})

Expand Down Expand Up @@ -860,33 +859,33 @@ export class UserCardComponent implements OnInit, OnChanges, AfterViewChecked, A
}

onApprovalSubmit(panel: any, appData: any) {
if (this.actionList.length > 0) {
if (this.currentFilter === 'transfers') {
this.onTransferSubmit(panel, appData)
} else {
const datalength = this.actionList.length
this.actionList.forEach((req: any, index: any) => {
if (req.action === 'APPROVE') {
req.comment = ''
}
this.onApproveOrRejectClick(req)
if (index === datalength - 1) {
panel.close()
this.comment = ''
setTimeout(() => {
this.openSnackbar('Request approved successfully')
this.updateList.emit()
// tslint:disable-next-line
}, 100)
}
// tslint:disable-next-line
// this.approvalData = this.approvalData.filter((wf: any) => { wf.userWorkflow.userInfo.wid !== req.userId })
if (this.approvalData.length === 0) {
this.disableButton.emit()
}
})
}
// if (this.actionList.length > 0) {
if (this.currentFilter === 'transfers') {
this.onTransferSubmit(panel, appData)
} else {
const datalength = this.actionList.length
this.actionList.forEach((req: any, index: any) => {
if (req.action === 'APPROVE') {
req.comment = ''
}
this.onApproveOrRejectClick(req)
if (index === datalength - 1) {
panel.close()
this.comment = ''
setTimeout(() => {
this.openSnackbar('Request approved successfully')
this.updateList.emit()
// tslint:disable-next-line
}, 100)
}
// tslint:disable-next-line
// this.approvalData = this.approvalData.filter((wf: any) => { wf.userWorkflow.userInfo.wid !== req.userId })
if (this.approvalData.length === 0) {
this.disableButton.emit()
}
})
}
// }
}

onTransferSubmit(panel: any, appData: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<ws-widget-user-card [currentFilter]="currentFilter" [usersData]="transfersData" [isApprovals]="true"
[totalRecords]="totalTransfersRecords" [tabChangeIndex]="pageIndex"
(searchByEnterKey)="onEnterkySearch($event)" (disableButton)="showButton()"
(paginationData)="onPaginateChange($event)" (updateList)="fetchApprovals()"></ws-widget-user-card>
(paginationData)="onPaginateChange($event)" (updateList)="fetchTransfers()"></ws-widget-user-card>
</ng-container>
<ng-container *ngIf="totalTransfersRecords === 0">
<p class="margin-top-xl margin-bottom-xl">No transfers</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@
(dblclick)="$event.preventDefault()">
<img src="/assets/icons/csv-file.svg" alt="CSV file logo" />
</div>
<div *ngIf="showFileError" class="error-msg">Upload xlsx format file only</div>
<div *ngIf="showFileError" class="error-msg">Upload csv format file only</div>
<div class="flex flex-col items-center">
<div class="text-primary cursor-pointer" (click)="fileInput.click()" (dblclick)="$event.preventDefault()">
Browse files</div>
<input hidden type="file" #fileInput (click)="handleFileClick($event)" (change)="handleOnFileChange($event)"
name="file" placeholder="Choose file" (dblclick)="$event.preventDefault();" accept=".xlsx, .xls" />
name="file" placeholder="Choose file" (dblclick)="$event.preventDefault();"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
<!-- <div class="flex">or</div>
<div class="flex">Drag file to upload</div> -->
</div>
<div class="flex flex-col items-center margin-bottom-m">
<div class="flex">Max file size: 100 MB</div>
<div class="flex">Supported file types: xlsx</div>
<div class="flex">Supported file types: csv</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@
(dblclick)="$event.preventDefault()">
<img src="/assets/icons/csv-file.svg" alt="CSV file logo" />
</div>
<div *ngIf="showFileError" class="error-msg">Upload xlsx format file only</div>
<div *ngIf="showFileError" class="error-msg">Upload csv format file only</div>
<div class="flex flex-col items-center">
<div class="text-primary cursor-pointer" (click)="fileInput.click()" (dblclick)="$event.preventDefault()">
Browse files</div>
<input hidden type="file" #fileInput (click)="handleFileClick($event)" (change)="handleOnFileChange($event)"
name="file" placeholder="Choose file" (dblclick)="$event.preventDefault();" accept=".xlsx, .xls" />
name="file" placeholder="Choose file" (dblclick)="$event.preventDefault();"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
<!-- <div class="flex">or</div>
<div class="flex">Drag file to upload</div> -->
</div>
<div class="flex flex-col items-center margin-bottom-m">
<div class="flex">Max file size: 100 MB</div>
<div class="flex">Supported file types: xlsx</div>
<div class="flex">Supported file types: csv</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class FileService {
}

validateFile(name: String) {
const allowedFormats = ['xlsx', 'csv']
const allowedFormats = ['csv']
const ext = name.substring(name.lastIndexOf('.') + 1).toLowerCase()
if (allowedFormats.indexOf(ext) > -1) {
return true
Expand Down

0 comments on commit 76ad833

Please sign in to comment.