import { ConfirmService } from './confirm.service'
-export interface ConfigChangedEvent {
- columns: { [id: string]: { isDisplayed: boolean } }
- config: { resultsPerPage: number }
-}
-
@Component({
selector: 'my-confirm',
templateUrl: './confirm.component.html',
- styles: [ '.button { padding: 0 13px; }' ]
+ styleUrls: [ './confirm.component.scss' ]
})
export class ConfirmComponent implements OnInit {
@ViewChild('confirmModal') confirmModal: ModalDirective
title = ''
message = ''
+ expectedInputValue = ''
+ inputLabel = ''
+
+ inputValue = ''
constructor (private confirmService: ConfirmService) {
// Empty
}
this.confirmService.showConfirm.subscribe(
- ({ title, message }) => {
+ ({ title, message, expectedInputValue, inputLabel }) => {
this.title = title
this.message = message
+ this.inputLabel = inputLabel
+ this.expectedInputValue = expectedInputValue
+
this.showModal()
}
)
this.hideModal()
}
+ isConfirmationDisabled () {
+ // No input validation
+ if (!this.inputLabel || !this.expectedInputValue) return false
+
+ return this.expectedInputValue !== this.inputValue
+ }
+
showModal () {
this.confirmModal.show()
}