UNPKG

@totvs-agro/core-mobile

Version:

Core Mobile Totvs Agro (Front-End) para utilização dos estilos do T-Faces

115 lines 5.08 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { TranslateService } from '@ngx-translate/core'; import { ToastController, LoadingController, AlertController } from 'ionic-angular'; import { Injectable } from '@angular/core'; var NotificationServiceProvider = /** @class */ (function () { function NotificationServiceProvider(toastCtrl, loadingCtrl, _alertController, _translate) { this.toastCtrl = toastCtrl; this.loadingCtrl = loadingCtrl; this._alertController = _alertController; this._translate = _translate; } NotificationServiceProvider.prototype.toast = function (mensagem) { var toast = this.toastCtrl.create({ message: mensagem, duration: 3000, showCloseButton: true, closeButtonText: this._translate.instant("TOAST.DISPENSAR") }); toast.onDidDismiss(function () { //console.log('Dismissed toast'); }); toast.present(); }; NotificationServiceProvider.prototype.toastWithButton = function (mensagem, descriptionButton, funcOnDismiss) { var toast = this.toastCtrl.create({ message: mensagem, duration: 15000, showCloseButton: true, closeButtonText: descriptionButton }); toast.onDidDismiss(funcOnDismiss); toast.present(); }; NotificationServiceProvider.prototype.presentLoading = function (_enableBackdropDismiss) { this.loading = this.loadingCtrl.create({ content: this._translate.instant("TOAST.AGUARDE"), enableBackdropDismiss: _enableBackdropDismiss }); return this.loading.present(); }; NotificationServiceProvider.prototype.dismissLoading = function () { this.loading.dismiss(); }; NotificationServiceProvider.prototype.notificacionToast = function (tipo, mensagem) { var options = { 0: { message: this._translate.instant(mensagem), duration: 5000, position: 'bottom', cssClass: 'successToast', showCloseButton: true, closeButtonText: this._translate.instant('COMMON.CLOSE') }, 1: { message: this._translate.instant(mensagem), duration: 5000, position: 'bottom', cssClass: 'errorToast', showCloseButton: true, closeButtonText: this._translate.instant('COMMON.CLOSE') }, 2: { message: this._translate.instant(mensagem), duration: 5000, position: 'bottom', cssClass: 'avisoToast', showCloseButton: true, closeButtonText: this._translate.instant('COMMON.CLOSE') } }; var toast = this.toastCtrl.create(options[tipo]); toast.present(); }; //ALERT NotificationServiceProvider.prototype.presentAlert = function (_title, _subTitle, _buttons, _enableBackdropDismiss) { var alert = this._alertController.create({ title: _title, subTitle: _subTitle, buttons: _buttons, enableBackdropDismiss: _enableBackdropDismiss }); alert.present(); }; NotificationServiceProvider.prototype.presentPrompt = function (_title, inputs, _buttons, _subTitle, _enableBackdropDismiss) { var alert = this._alertController.create({ title: _title, subTitle: _subTitle, inputs: inputs, buttons: _buttons, enableBackdropDismiss: _enableBackdropDismiss }); alert.present(); }; NotificationServiceProvider.SUCCESS = 0; NotificationServiceProvider.ERROR = 1; NotificationServiceProvider.WARNING = 2; NotificationServiceProvider = __decorate([ Injectable(), __metadata("design:paramtypes", [ToastController, LoadingController, AlertController, TranslateService]) ], NotificationServiceProvider); return NotificationServiceProvider; }()); export { NotificationServiceProvider }; //# sourceMappingURL=notification-service.js.map