mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
79 lines
1.6 KiB
TypeScript
79 lines
1.6 KiB
TypeScript
import { Component, EventEmitter, Input, Output } from '@angular/core'
|
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
|
import { Subject } from 'rxjs'
|
|
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
|
|
|
|
@Component({
|
|
selector: 'pngx-confirm-dialog',
|
|
templateUrl: './confirm-dialog.component.html',
|
|
styleUrls: ['./confirm-dialog.component.scss'],
|
|
standalone: false,
|
|
})
|
|
export class ConfirmDialogComponent extends LoadingComponentWithPermissions {
|
|
constructor(public activeModal: NgbActiveModal) {
|
|
super()
|
|
}
|
|
|
|
@Output()
|
|
public confirmClicked = new EventEmitter()
|
|
|
|
@Output()
|
|
public alternativeClicked = new EventEmitter()
|
|
|
|
@Input()
|
|
title = $localize`Confirmation`
|
|
|
|
@Input()
|
|
messageBold
|
|
|
|
@Input()
|
|
message
|
|
|
|
@Input()
|
|
btnClass = 'btn-primary'
|
|
|
|
@Input()
|
|
btnCaption = $localize`Confirm`
|
|
|
|
@Input()
|
|
alternativeBtnClass = 'btn-secondary'
|
|
|
|
@Input()
|
|
alternativeBtnCaption
|
|
|
|
@Input()
|
|
cancelBtnClass = 'btn-outline-secondary'
|
|
|
|
@Input()
|
|
cancelBtnCaption = $localize`Cancel`
|
|
|
|
@Input()
|
|
buttonsEnabled = true
|
|
|
|
confirmButtonEnabled = true
|
|
alternativeButtonEnabled = true
|
|
seconds = 0
|
|
secondsTotal = 0
|
|
|
|
confirmSubject: Subject<boolean>
|
|
alternativeSubject: Subject<boolean>
|
|
|
|
cancel() {
|
|
this.confirmSubject?.next(false)
|
|
this.confirmSubject?.complete()
|
|
this.activeModal.close()
|
|
}
|
|
|
|
confirm() {
|
|
this.confirmClicked.emit()
|
|
this.confirmSubject?.next(true)
|
|
this.confirmSubject?.complete()
|
|
}
|
|
|
|
alternative() {
|
|
this.alternativeClicked.emit()
|
|
this.alternativeSubject?.next(true)
|
|
this.alternativeSubject?.complete()
|
|
}
|
|
}
|