mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
Improve pin
This commit is contained in:
@@ -61,7 +61,8 @@ export class ProfileComponent implements OnInit {
|
|||||||
componentProps: {
|
componentProps: {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return await modal.present();
|
|
||||||
|
modal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,25 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div (click)="clearCode()" class="d-flex align-center justify-center pt-25 clear">
|
<div (click)="clearCode()" class="d-flex align-center justify-center pt-25 clear">
|
||||||
Cancelar
|
Limpar
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
|
|
||||||
|
<ion-footer class=" footer-container ion-no-border">
|
||||||
|
<div class="d-flex justify-space-between">
|
||||||
|
<ion-buttons slot="start" >
|
||||||
|
<ion-button (click)="close()" class="btn-cancel" fill="clear" color="#061b52" >
|
||||||
|
<ion-label>Cancelar</ion-label>
|
||||||
|
</ion-button>
|
||||||
|
</ion-buttons>
|
||||||
|
<ion-buttons slot="end" >
|
||||||
|
<ion-button (click)="save()" class="btn-ok" fill="clear" color="#fff" >
|
||||||
|
<ion-label>Gravar</ion-label>
|
||||||
|
</ion-button>
|
||||||
|
</ion-buttons>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ion-footer>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ModalController } from '@ionic/angular';
|
||||||
|
import { BadRequestComponent } from '../popover/bad-request/bad-request.component';
|
||||||
|
import { SuccessMessageComponent } from '../popover/success-message/success-message.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-pin',
|
selector: 'app-pin',
|
||||||
@@ -8,7 +11,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
export class PinPage implements OnInit {
|
export class PinPage implements OnInit {
|
||||||
|
|
||||||
code = []
|
code = []
|
||||||
constructor() { }
|
constructor( private modalController: ModalController,) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
@@ -16,6 +19,8 @@ export class PinPage implements OnInit {
|
|||||||
setCode(code: string) {
|
setCode(code: string) {
|
||||||
if(this.code.length < 4) {
|
if(this.code.length < 4) {
|
||||||
this.code.push(code)
|
this.code.push(code)
|
||||||
|
} else {
|
||||||
|
this.clearCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,4 +29,58 @@ export class PinPage implements OnInit {
|
|||||||
this.code =[]
|
this.code =[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
/* console.log(this.isEventEdited); */
|
||||||
|
alert('close modal')
|
||||||
|
this.modalController.dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
async save() {
|
||||||
|
if(this.code.length == 4) {
|
||||||
|
|
||||||
|
this.successMessage()
|
||||||
|
localStorage.setItem('PIN', this.code.join(''))
|
||||||
|
} else {
|
||||||
|
this.badRequest()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async successMessage(message?: string) {
|
||||||
|
|
||||||
|
const modal = await this.modalController.create({
|
||||||
|
component: SuccessMessageComponent,
|
||||||
|
componentProps: {
|
||||||
|
message: message || 'Processo efetuado' ,
|
||||||
|
},
|
||||||
|
cssClass: 'modal modal-desktop'
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.present()
|
||||||
|
|
||||||
|
setTimeout(()=>{
|
||||||
|
|
||||||
|
this.close()
|
||||||
|
modal.dismiss()
|
||||||
|
},3000)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async badRequest(message?: string) {
|
||||||
|
const modal = await this.modalController.create({
|
||||||
|
component: BadRequestComponent,
|
||||||
|
componentProps: {
|
||||||
|
message: message || 'Processo não efetuado' ,
|
||||||
|
},
|
||||||
|
cssClass: 'modal modal-desktop'
|
||||||
|
});
|
||||||
|
|
||||||
|
modal.present()
|
||||||
|
|
||||||
|
setTimeout(()=>{
|
||||||
|
modal.dismiss()
|
||||||
|
},3000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user