@totvs-agro/core-mobile
Version:
Core Mobile Totvs Agro (Front-End) para utilização dos estilos do T-Faces
137 lines • 5.75 kB
JavaScript
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 { ToastController, LoadingController, AlertController } from 'ionic-angular';
import { Injectable } from '@angular/core';
import { TotvsTranslateProvider } from '../translate/totvs-translate-provider';
var TotvsNotificationProvider = /** @class */ (function () {
function TotvsNotificationProvider(toastCtrl, loadingCtrl, _alertController, _totvsTranslate) {
this.toastCtrl = toastCtrl;
this.loadingCtrl = loadingCtrl;
this._alertController = _alertController;
this._totvsTranslate = _totvsTranslate;
}
TotvsNotificationProvider.prototype.toast = function (mensagem) {
var toast = this.toastCtrl.create({
message: mensagem,
duration: 3000,
showCloseButton: true,
closeButtonText: this._totvsTranslate.instant("TOAST.DISPENSAR")
});
toast.onDidDismiss(function () {
//console.log('Dismissed toast');
});
toast.present();
};
;
TotvsNotificationProvider.prototype.toastWithButton = function (tipo, mensagem, descriptionButton, funcOnDismiss) {
var toast = this.toastCtrl.create({
message: mensagem,
duration: 15000,
showCloseButton: true,
closeButtonText: descriptionButton,
cssClass: this.typeMessage(tipo)
});
toast.onDidDismiss(funcOnDismiss);
toast.present();
};
TotvsNotificationProvider.prototype.presentLoading = function (_enableBackdropDismiss) {
if (this.loading == undefined || this.loading == null) {
this.loading = this.loadingCtrl.create({
content: this._totvsTranslate.instant("TOAST.AGUARDE"),
enableBackdropDismiss: _enableBackdropDismiss
});
return this.loading.present();
}
return this.loading.present();
};
TotvsNotificationProvider.prototype.dismissLoading = function () {
if (this.loading != undefined || this.loading != null) {
this.loading.dismiss();
this.loading = null;
}
};
TotvsNotificationProvider.prototype.notificacionToast = function (tipo, mensagem) {
var options = {
0: {
message: mensagem,
duration: 5000,
position: 'bottom',
cssClass: 'successToast',
showCloseButton: true,
closeButtonText: this._totvsTranslate.instant('COMMON.CLOSE')
},
1: {
message: mensagem,
duration: 5000,
position: 'bottom',
cssClass: 'errorToast',
showCloseButton: true,
closeButtonText: this._totvsTranslate.instant('COMMON.CLOSE')
},
2: {
message: mensagem,
duration: 5000,
position: 'bottom',
cssClass: 'avisoToast',
showCloseButton: true,
closeButtonText: this._totvsTranslate.instant('COMMON.CLOSE')
}
};
var toast = this.toastCtrl.create(options[tipo]);
toast.present();
};
TotvsNotificationProvider.prototype.typeMessage = function (tipo) {
var options = {
0: {
cssClass: 'successToast'
},
1: {
cssClass: 'errorToast'
},
2: {
cssClass: 'avisoToast'
}
};
return options[tipo].cssClass;
};
//ALERT
TotvsNotificationProvider.prototype.presentAlert = function (_title, _subTitle, _buttons, _enableBackdropDismiss) {
var alert = this._alertController.create({
title: _title,
subTitle: _subTitle,
buttons: _buttons,
enableBackdropDismiss: _enableBackdropDismiss
});
alert.present();
};
TotvsNotificationProvider.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();
};
TotvsNotificationProvider.SUCCESS = 0;
TotvsNotificationProvider.ERROR = 1;
TotvsNotificationProvider.WARNING = 2;
TotvsNotificationProvider = __decorate([
Injectable(),
__metadata("design:paramtypes", [ToastController,
LoadingController,
AlertController,
TotvsTranslateProvider])
], TotvsNotificationProvider);
return TotvsNotificationProvider;
}());
export { TotvsNotificationProvider };
//# sourceMappingURL=totvs-notification-provider.js.map