diff options
Diffstat (limited to 'admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts')
-rw-r--r-- | admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts b/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts index ad63ee1c..ce502a63 100644 --- a/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts +++ b/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts @@ -1,51 +1,53 @@ -import {Injectable} from '@angular/core';
-import Swal from 'sweetalert2';
-import {TranslateService} from '@ngx-translate/core';
-
-@Injectable({
- providedIn: 'root'
-})
-export class OgSweetAlertService {
- constructor(private translate: TranslateService) {}
-
- swal(options): Promise<any> {
- return Swal.fire(options);
- }
-
-
- success(title, message) {
- Swal.fire( title, message, 'success' );
- }
-
- error(title, message) {
- Swal.fire( title, message, 'error' );
- }
-
- warning(title, message) {
- Swal.fire( title, message, 'warning' );
- }
-
- info(title, message) {
- Swal.fire( title, message, 'info' );
- }
-
- question(title, message, okcallback?, cancelcallback?) {
- Swal.fire({
- title: title,
- text: message,
- type: 'info',
- showCancelButton: true,
- cancelButtonText: this.translate.instant('no'),
- cancelButtonClass: 'default',
- confirmButtonClass: 'primary',
- confirmButtonText: this.translate.instant('yes')
-
- }).then((response) => {
- if (response.dismiss) {
- cancelcallback(response);
- } else {
- okcallback(response);
- }
- });
- }
-}
+import {Injectable} from '@angular/core'; +import Swal from 'sweetalert2'; +import {TranslateService} from '@ngx-translate/core'; + +@Injectable({ + providedIn: 'root' +}) +export class OgSweetAlertService { + constructor(private translate: TranslateService) {} + + swal(options): Promise<any> { + return Swal.fire(options); + } + + + success(title, message) { + Swal.fire( title, message, 'success' ); + } + + error(title, message) { + Swal.fire( title, message, 'error' ); + } + + warning(title, message) { + Swal.fire( title, message, 'warning' ); + } + + info(title, message) { + Swal.fire( title, message, 'info' ); + } + + question(title, message, okcallback?, cancelcallback?) { + Swal.fire({ + title: title, + text: message, + type: 'info', + showCancelButton: true, + cancelButtonText: this.translate.instant('no'), + cancelButtonClass: 'default', + confirmButtonClass: 'primary', + confirmButtonText: this.translate.instant('yes') + + }).then((response) => { + if (response.dismiss) { + if (typeof cancelcallback === 'function') { + cancelcallback(response); + } + } else { + okcallback(response); + } + }); + } +} |