Use ToastrService for displaying success messages
This commit is contained in:
parent
3de1246c50
commit
1e20e256a6
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { ApiClientService } from 'src/app/_services/api-client.service';
|
import { ApiClientService } from 'src/app/_services/api-client.service';
|
||||||
|
import { ToastrService } from 'ngx-toastr';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -28,7 +29,8 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private api: ApiClientService
|
private api: ApiClientService,
|
||||||
|
private toastr: ToastrService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
sizeToHuman(size: number) {
|
sizeToHuman(size: number) {
|
||||||
|
@ -97,11 +99,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
|
|
||||||
runMigrations() {
|
runMigrations() {
|
||||||
this.api.post('admin/runMigrations').then((res: any) => {
|
this.api.post('admin/runMigrations').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.run_migrations_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.run_migrations_success')
|
|
||||||
});
|
|
||||||
this.getDB();
|
this.getDB();
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
@ -124,11 +122,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
this.api.post('admin/runSeeding').then((res: any) => {
|
this.api.post('admin/runSeeding').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.run_seeding_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.run_seeding_success')
|
|
||||||
});
|
|
||||||
this.getDB();
|
this.getDB();
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
@ -153,11 +147,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
this.api.post('admin/runJob', { job }).then((res: any) => {
|
this.api.post('admin/runJob', { job }).then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.run_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.run_success')
|
|
||||||
});
|
|
||||||
this.getJobs();
|
this.getJobs();
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
@ -181,11 +171,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.maintenance_mode_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.maintenance_mode_success')
|
|
||||||
});
|
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
|
@ -197,11 +183,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
|
|
||||||
runOptimization() {
|
runOptimization() {
|
||||||
this.api.post('admin/runOptimization').then((res: any) => {
|
this.api.post('admin/runOptimization').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.run_optimization_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.run_optimization_success')
|
|
||||||
});
|
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
|
@ -213,11 +195,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
|
|
||||||
clearOptimization() {
|
clearOptimization() {
|
||||||
this.api.post('admin/clearOptimization').then((res: any) => {
|
this.api.post('admin/clearOptimization').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.clear_optimization_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.clear_optimization_success')
|
|
||||||
});
|
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
|
@ -229,11 +207,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
|
|
||||||
clearCache() {
|
clearCache() {
|
||||||
this.api.post('admin/clearCache').then((res: any) => {
|
this.api.post('admin/clearCache').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.clear_cache_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.clear_cache_success')
|
|
||||||
});
|
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
|
@ -267,11 +241,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
allowOutsideClick: () => !Swal.isLoading()
|
allowOutsideClick: () => !Swal.isLoading()
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.env_encrypt_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.env_encrypt_success')
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -300,11 +270,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
allowOutsideClick: () => !Swal.isLoading()
|
allowOutsideClick: () => !Swal.isLoading()
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.env_decrypt_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.env_decrypt_success')
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -321,11 +287,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
this.api.post('admin/envDelete').then((res: any) => {
|
this.api.post('admin/envDelete').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.env_delete_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.env_delete_success')
|
|
||||||
});
|
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
|
@ -339,11 +301,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
|
|
||||||
setTelegramBotWebhook() {
|
setTelegramBotWebhook() {
|
||||||
this.api.post('admin/telegramBot/setWebhook').then((res: any) => {
|
this.api.post('admin/telegramBot/setWebhook').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.telegram_webhook_set_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.telegram_webhook_set_success')
|
|
||||||
});
|
|
||||||
this.getTelegramBotDebugInfo();
|
this.getTelegramBotDebugInfo();
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
@ -356,11 +314,7 @@ export class AdminMaintenanceComponent implements OnInit {
|
||||||
|
|
||||||
unsetTelegramBotWebhook() {
|
unsetTelegramBotWebhook() {
|
||||||
this.api.post('admin/telegramBot/unsetWebhook').then((res: any) => {
|
this.api.post('admin/telegramBot/unsetWebhook').then((res: any) => {
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('admin.telegram_webhook_unset_success'));
|
||||||
icon: 'success',
|
|
||||||
title: this.translateService.instant('success_title'),
|
|
||||||
text: this.translateService.instant('admin.telegram_webhook_unset_success')
|
|
||||||
});
|
|
||||||
this.getTelegramBotDebugInfo();
|
this.getTelegramBotDebugInfo();
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { ApiClientService } from 'src/app/_services/api-client.service';
|
import { ApiClientService } from 'src/app/_services/api-client.service';
|
||||||
import { AuthService } from 'src/app/_services/auth.service';
|
import { AuthService } from 'src/app/_services/auth.service';
|
||||||
|
import { ToastrService } from 'ngx-toastr';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -17,7 +17,7 @@ export class AdminOptionsComponent implements OnInit {
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private api: ApiClientService,
|
private api: ApiClientService,
|
||||||
public auth: AuthService,
|
public auth: AuthService,
|
||||||
private router: Router
|
private toastr: ToastrService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
getOptions() {
|
getOptions() {
|
||||||
|
@ -64,12 +64,7 @@ export class AdminOptionsComponent implements OnInit {
|
||||||
}).then((res: any) => {
|
}).then((res: any) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
option._origValue = option.value;
|
option._origValue = option.value;
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant("admin.option_update_success"));
|
||||||
title: this.translateService.instant("success_title"),
|
|
||||||
text: this.translateService.instant("admin.option_update_success"),
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'Ok'
|
|
||||||
});
|
|
||||||
}).catch((err: any) => {
|
}).catch((err: any) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||||
import { ModalAddTrainingCourseComponent } from 'src/app/_components/modal-add-traning-course/modal-add-training-course.component';
|
import { ModalAddTrainingCourseComponent } from 'src/app/_components/modal-add-traning-course/modal-add-training-course.component';
|
||||||
import { ModalAddMedicalExaminationComponent } from 'src/app/_components/modal-add-medical-examination/modal-add-medical-examination.component';
|
import { ModalAddMedicalExaminationComponent } from 'src/app/_components/modal-add-medical-examination/modal-add-medical-examination.component';
|
||||||
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
|
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
|
||||||
|
import { ToastrService } from 'ngx-toastr';
|
||||||
import Swal from 'sweetalert2';
|
import Swal from 'sweetalert2';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -71,7 +72,8 @@ export class EditUserComponent implements OnInit {
|
||||||
private api: ApiClientService,
|
private api: ApiClientService,
|
||||||
private auth: AuthService,
|
private auth: AuthService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private modalService: BsModalService
|
private modalService: BsModalService,
|
||||||
|
private toastr: ToastrService
|
||||||
) {
|
) {
|
||||||
this.route.paramMap.subscribe(params => {
|
this.route.paramMap.subscribe(params => {
|
||||||
this.id = typeof params.get('id') === 'string' ? parseInt(params.get('id') || '') : undefined;
|
this.id = typeof params.get('id') === 'string' ? parseInt(params.get('id') || '') : undefined;
|
||||||
|
@ -227,12 +229,7 @@ export class EditUserComponent implements OnInit {
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
this.api.put(`users/${this.id}`, data).then((response) => {
|
this.api.put(`users/${this.id}`, data).then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('edit_user.success_text'));
|
||||||
title: this.translateService.instant("success_title"),
|
|
||||||
text: this.translateService.instant("edit_user.success_text"),
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'Ok'
|
|
||||||
});
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
|
@ -315,12 +312,7 @@ export class EditUserComponent implements OnInit {
|
||||||
password: this.newPwd
|
password: this.newPwd
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
Swal.fire({
|
this.toastr.success(this.translateService.instant('password_changed_successfully'));
|
||||||
title: this.translateService.instant("success_title"),
|
|
||||||
text: this.translateService.instant("password_changed_successfully"),
|
|
||||||
icon: 'success',
|
|
||||||
confirmButtonText: 'Ok'
|
|
||||||
});
|
|
||||||
this.resetPwdModalRef?.hide();
|
this.resetPwdModalRef?.hide();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|
Loading…
Reference in New Issue