-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Application):added option to withdraw modification/extension req…
…uests
- Loading branch information
Showing
6 changed files
with
188 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/app/projectmanagement/modals/withdraw/withdraw-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div> | ||
<div class="modal-header"> | ||
<h4 class="modal-title"> | ||
Withdraw | ||
@if (type === WITHDRAWAL_TYPES.MODIFICATION) { | ||
Modification | ||
} @else if (type === WITHDRAWAL_TYPES.EXTENSION) { | ||
Extension | ||
} | ||
Request | ||
</h4> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
style="cursor: pointer" | ||
(click)="bsModalRef.hide()" | ||
data-dismiss="modal" | ||
aria-label="Close" | ||
></button> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="col-md-auto mx-auto"> | ||
<div class="alert alert-warning" role="alert"> | ||
<p> | ||
Are you sure you want to withdraw this | ||
@if (type === WITHDRAWAL_TYPES.MODIFICATION) { | ||
Modification | ||
} @else if (type === WITHDRAWAL_TYPES.EXTENSION) { | ||
Extension | ||
} | ||
Request? | ||
</p> | ||
<p>You can always create a new request if needed.</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<div class="row" style="margin: auto"> | ||
<div class="col-md-auto mx-auto"> | ||
<button | ||
id="withdraw_btn" | ||
class="btn btn-danger" | ||
type="reset" | ||
data-test-id="withdraw_btn" | ||
(click)="withdrawTarget()" | ||
> | ||
Withdraw | ||
</button> | ||
</div> | ||
<div class="col-md-auto mx-auto"> | ||
<button | ||
id="close_withdrawal_button" | ||
class="btn btn-primary" | ||
type="reset" | ||
data-test-id="close_withdrawal_button" | ||
(click)="bsModalRef.hide()" | ||
> | ||
Cancel | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<!-- /.modal-content --> | ||
</div> |
46 changes: 46 additions & 0 deletions
46
src/app/projectmanagement/modals/withdraw/withdraw-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Component, EventEmitter } from '@angular/core'; | ||
import { BsModalRef } from 'ngx-bootstrap/modal'; | ||
|
||
import { ApplicationsService } from '../../../api-connector/applications.service'; | ||
|
||
export enum WITHDRAWAL_TYPES { | ||
MODIFICATION, | ||
EXTENSION, | ||
} | ||
|
||
@Component({ | ||
selector: 'app-withdrawl-modal', | ||
templateUrl: './withdraw-modal.component.html', | ||
providers: [ApplicationsService], | ||
}) | ||
export class WithdrawModalComponent { | ||
target_id: string | number; | ||
type: WITHDRAWAL_TYPES; | ||
event: EventEmitter<boolean> = new EventEmitter(); | ||
|
||
constructor( | ||
public bsModalRef: BsModalRef, | ||
private projectService: ApplicationsService, | ||
) { | ||
// eslint-disable-next-line no-empty-function | ||
} | ||
|
||
withdrawTarget() { | ||
switch (this.type) { | ||
Check warning on line 29 in src/app/projectmanagement/modals/withdraw/withdraw-modal.component.ts GitHub Actions / tslinting-check
|
||
case WITHDRAWAL_TYPES.EXTENSION: | ||
this.projectService.withdrawExtensionRequest(this.target_id).subscribe(() => { | ||
this.bsModalRef.hide(); | ||
this.event.emit(true); | ||
}); | ||
break; | ||
case WITHDRAWAL_TYPES.MODIFICATION: | ||
this.projectService.withdrawModificationRequest(this.target_id).subscribe(() => { | ||
this.bsModalRef.hide(); | ||
this.event.emit(true); | ||
}); | ||
break; | ||
} | ||
} | ||
|
||
protected readonly WITHDRAWAL_TYPES = WITHDRAWAL_TYPES; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters