Commit 0b79e396 authored by Trino Parra's avatar Trino Parra

formulario

parent 8487c1a8
{"plugins":["cordova-plugin-whitelist","cordova-plugin-device","call-number","cordova-plugin-statusbar","cordova-plugin-disable-ios11-statusbar","cordova-sqlite-storage","cordova-plugin-fcm","phonegap-plugin-push","cordova-plugin-console","cordova-plugin-actionsheet","cordova-plugin-camera","cordova-plugin-file","cordova-plugin-file-transfer","cordova-plugin-network-information","cordova-plugin-app-preferences","com-badrit-base64","cordova-plugin-filechooser","cordova-plugin-android-permissions","cordova.plugins.diagnostic","cordova-plugin-ionic-keyboard","cordova-plugin-splashscreen","cordova-plugin-headercolor","cordova-plugin-file-opener2","cordova-plugin-screen-orientation"]}
\ No newline at end of file
// Type definitions for Cordova Keyboard plugin
// Project: https://github.com/driftyco/ionic-plugins-keyboard
// Definitions by: Hendrik Maus <https://github.com/hendrikmaus>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Ionic {
interface Keyboard {
/**
* Hide the keyboard accessory bar with the next, previous and done buttons.
*
* @param hide
*/
hideKeyboardAccessoryBar(hide:boolean): void;
/**
* Close the keyboard if it is open.
*/
close(): void;
/**
* Force keyboard to be shown on Android.
* This typically helps if autofocus on a text element does not pop up the keyboard automatically
*
* Supported Platforms: Android, Blackberry 10
*/
show(): void;
/**
* Disable native scrolling, useful if you are using JavaScript to scroll
*
* @param disbale
*/
disableScroll(disbale:boolean): void;
/**
* Whether or not the keyboard is currently visible.
*/
isVisible: boolean;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<ion-header>
<ion-navbar>
</ion-navbar>
</ion-header>
<ion-content padding style="background-color: #F3F4F6">
<img src="assets/imgs/Marqueta/logo.png" class="center headerimg">
<br />
<h6 class="header6">En estos momentos nuestros ejecutivos se encuentran ocupados, por favor indiquenos su requerimiento y nuestro equipo se contactara con usted lo más pronto posible.</h6>
<br />
<form [formGroup]="messageForm" class="list center-form" *ngIf="isSchema()">
<ion-item>
<ion-label stacked>{{shema.formulario[0].nombre}}</ion-label>
<ion-select formControlName="request" *ngIf="isSchema()" placeholder="Seleccione una opcion">
<ion-option *ngFor="let req of shema.formulario[0].opciones" [value]="req">{{req}}</ion-option>
</ion-select>
</ion-item>
<br />
<ion-item>
<ion-label stacked>{{shema.formulario[1].nombre}}</ion-label>
<ion-textarea *ngIf="shema.formulario[1].tipo=='text'" class="mensajebox" formControlName="message" type="text" [maxlength]="shema.formulario[1].largo"></ion-textarea>
<!--<ion-textarea class="mensajebox" formControlName="message" type="text" maxlength="450"></ion-textarea>-->
</ion-item>
<br />
<div class="error-message">
{{error}}
</div>
<br />
<button ion-button type="button" [disabled]="!messageForm.valid" (click)="enviar()" class="center btn">enviar</button>
</form>
<ion-footer class="footer hideElementOnKeyboardShown hide-on-keyboard-open applyFooter">
<a href="http://gearlabs.cl/" onclick="window.open(this.href, '_blank', 'location=no'); return false;"><img
class="footerlogo" src="assets/imgs/Marqueta/paer.png"></a>
</ion-footer>
</ion-content>
\ No newline at end of file
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { FormularyPage } from './formulary';
@NgModule({
declarations: [
FormularyPage,
],
imports: [
IonicPageModule.forChild(FormularyPage),
],
})
export class FormularyPageModule {}
page-formulary {
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%!important;
}
.mensajebox {
height: 100px;
}
.headerimg{
margin-top: 10px;
}
.header6{
text-align: center;
color: #787879;
font-weight: 400;
}
.btn{
border-radius: 20px;
width: 50%;
overflow: hidden;
height: 3.6rem;
font-size: 16px;
font-weight: 400;
font-variant: small-caps;
color: #fff;
background-color: #CB0D12;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.btn:hover{
background-color: transparent !important;
}
.container .btn:hover{
background-color: #008B7D;
}
.itemclr{
background-color: #F2F2F2;
max-width: 96%;
}
.ion-input:hover{
background-color: #CB0D12;
}
.item-input .label-ios, .item-select .label-ios, .item-datetime .label-ios {
color: #424242;
}
.item-input .label-md, .item-select .label-md, .item-datetime .label-md {
color: #424242;
}
.item-input .label-wp, .item-select .label-wp, .item-datetime .label-wp {
color: #424242;
}
.button-md.activated{
background-color: #CB0D12;
}
.button-ios.activated{
background-color: #CB0D12;
}
.button-wp.activated{
background-color: #CB0D12;
}
.btn:hover{
background-color: #CB0D12 !important;
}
.label-md[stacked] {
font-size: 16px !important;
}
.label-ios[stacked] {
font-size: 16px !important;
}
.label-wp[stacked] {
font-size: 16px !important;
}
.footer{
position: fixed;
left: 0;
bottom: 0px;
width: 100%;
padding-left:15%;
padding-right:15%
}
$list-ios-activated-background-color: #CB0D12;
$list-md-activated-background-color: #CB0D12;
$list-wp-activated-background-color: #CB0D12;
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { RestProvider } from '../../providers/rest/rest';
import { Loader } from "../../providers/loader/loader";
import { Storage } from '@ionic/storage';
import { AlertController } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-formulary',
templateUrl: 'formulary.html',
})
export class FormularyPage {
public messageForm: FormGroup;
shema: any;
rut: any;
error: any = '';
constructor(public navCtrl: NavController, public navParams: NavParams,
private formBuilder: FormBuilder, public restProvider: RestProvider,
private alertCtrl: AlertController,
private loader: Loader, public storage: Storage) {
this.messageForm = formBuilder.group({
message: ['', Validators.compose([Validators.required])],
request: ['', Validators.compose([Validators.required])]
});
}
ionViewDidLoad() {
console.log('ionViewDidLoad FormularyPage');
this.storage.get('rut').then((rut) => {
this.rut = rut;
});
this.restProvider.getCofiguration().then(msg => {
console.log(msg['formularioJson']);
this.shema = msg['formularioJson']['formularioJson'];
});
}
isSchema(){
return this.shema && this.shema.formulario && this.shema.formulario.length > 0;
//return this.shema && this.shema.formulario;
}
enviar() {
console.log("Enviando....");
this.error = '';
//this.loader.show('Please Wait');
let message: any = this.messageForm.value.message;
let request: any = this.messageForm.value.request;
if (!message || message == '' || message.length == 0) {
//this.loader.hide();
let alert = this.alertCtrl.create({
subTitle: 'Por favor ingrese un mensaje',
buttons: ['Aceptar']
});
alert.present();
} else if (!request || request == '' || request.length == 0 ){
this.loader.hide();
let alert = this.alertCtrl.create({
subTitle: 'Por favor indique el tipo de requerimiento',
buttons: ['Aceptar']
});
alert.present();
} else {
//console.log('pot data: ' + this.rut + " request: " + request + " message: " + message);
this.restProvider.save_form(this.rut, request, message).then(data => {
console.log('resp: ' + data);
//this.loader.hide();
let alert = this.alertCtrl.create({
subTitle: 'Su solicitud fue recibida, en breve lo atenderemos!',
buttons: ['Aceptar']
});
alert.present();
this.goback();
}).catch(error => {
this.loader.hide();
this.error = error.error['error'];
console.log("error2: " + this.error);
});
}
}
goback() {
this.navCtrl.pop();
}
}
<ion-content style="background-color: #F3F4F6">
<h6 class="header6">Encuesta</h6>
<form novalidate class="list center-form">
<ion-grid>
<ion-row>
<ion-col col-12 col-xl-12>
<ion-label><div class="star-container" align="center" *ngIf="shema[1].tituloPregunta">{{shema[0].tituloPregunta}}</div></ion-label>
</ion-col>
</ion-row>
<ion-row class="borderdrop">
<ion-col col-12 col-xl-12>
<ion-item>
<div class="star star-container" align="center">
<button class="star" *ngFor="let star of stars; index as i" (click)="refreshStars(i);">
<img [src]="getStarType(star)" />
</button>
</div>
</ion-item>
</ion-col>
</ion-row>
<ion-row>
<ion-col col-12 col-xl-12>
<ion-label><div class="star-container" align="center" *ngIf="shema[1].tituloPregunta">{{shema[1].tituloPregunta}}</div></ion-label>
</ion-col>
</ion-row>
<ion-row class="borderdrop" radio-group [(ngModel)]="siNo" name="res2" *ngIf="shema">
<ion-col col-2 col-xl-2></ion-col>
<ion-col col-4 col-xl-4>
<ion-item>
<ion-label *ngIf="shema[1].opcionesPregunta[0].textoOpcion">{{shema[1].opcionesPregunta[0].textoOpcion}}</ion-label>
<ion-radio value="0"></ion-radio>
</ion-item>
</ion-col>
<ion-col col-4 col-xl-4>
<ion-item>
<ion-label *ngIf="shema[1].opcionesPregunta[1].textoOpcion">{{shema[1].opcionesPregunta[1].textoOpcion}}</ion-label>
<ion-radio value="1"></ion-radio>
</ion-item>
</ion-col>
<ion-col col-2 col-xl-2></ion-col>
</ion-row>
</ion-grid>
<img src="assets/imgs/Marqueta/logo.png" class="center headerimg">
<br />
<br />
<h6 class="header6">Encuesta</h6>
<form novalidate class="list center-form">
<ion-grid>
<ion-row>
<ion-col col-12 col-xl-12>
<ion-label><div class="star-container" align="center" *ngIf="shema[0].tituloPregunta">{{shema[0].tituloPregunta}}</div></ion-label>
</ion-col>
</ion-row>
<ion-row class="borderdrop">
<ion-col col-12 col-xl-12>
<div class="star star-container" align="center">
<button class="star" *ngFor="let star of stars; index as i" (click)="refreshStars(i);">
<img [src]="getStarType(star)" width="44px" height="44px"/>
</button>
</div>
</ion-col>
</ion-row>
<ion-row>
<ion-col col-12 col-xl-12>
<ion-label><div class="star-container" align="center" *ngIf="shema[1].tituloPregunta">{{shema[1].tituloPregunta}}</div></ion-label>
</ion-col>
</ion-row>
<ion-row class="borderdrop" radio-group [(ngModel)]="siNo" name="res2" *ngIf="shema">
<ion-col col-2 col-xl-2></ion-col>
<ion-col col-4 col-xl-4 style="margin:15px">
<ion-label style="display: inline" *ngIf="shema[1].opcionesPregunta[0].textoOpcion">{{shema[1].opcionesPregunta[0].textoOpcion}}</ion-label>
<ion-radio style="vertical-align:middle" value="0"></ion-radio>
</ion-col>
<ion-col col-4 col-xl-4 style="margin:15px">
<ion-label style="display: inline" *ngIf="shema[1].opcionesPregunta[1].textoOpcion">{{shema[1].opcionesPregunta[1].textoOpcion}}</ion-label>
<ion-radio style="vertical-align:middle" value="1" ></ion-radio>
</ion-col>
<ion-col col-2 col-xl-2></ion-col>
</ion-row>
</ion-grid>
<br />
<button ion-button (click)="inquiry()" class="center btn">aceptar</button>
</form>
<br />
<button ion-button (click)="inquiry()" class="center btn">aceptar</button>
</form>
<br />
<ion-footer class="footer hideElementOnKeyboardShown hide-on-keyboard-open applyFooter">
<a href="http://gearlabs.cl/" onclick="window.open(this.href, '_blank', 'location=no'); return false;"><img class="footerlogo" src="assets/imgs/Marqueta/paer1.png"></a>
</ion-footer>
</ion-content>
<ion-footer class="footer hideElementOnKeyboardShown hide-on-keyboard-open applyFooter">
<a href="http://gearlabs.cl/" onclick="window.open(this.href, '_blank', 'location=no'); return false;"><img class="footerlogo" src="assets/imgs/Marqueta/paer1.png"></a>
</ion-footer>
</ion-content>
\ No newline at end of file
page-inquiry {
.title1{
color: #F41D15;
}
.maincontent{
height: 95vh;
padding: 30px!important;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%!important;
}
.btn{
border-radius: 20px;
width: 50%;
overflow: hidden;
height: 3.6rem;
font-size: 16px;
font-weight: 400;
font-variant: small-caps;
color: #fff;
background-color: #CB0D12;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.btn:hover{
background-color: #CB0D12 !important;
}
.star {
background-color: white;
}
.star-container {
width: 100%;
}
.header6{
text-align: center;
color: #787879;
font-weight: 400;
}
.borderdrop{
background: white !important;
border-radius: 20px;
//border-bottom: 1px solid #C5C5C5;
}
.footer{
position: fixed;
left: 0;
bottom: 0px;
width: 100%;
padding-left:15%;
padding-right:15%
}
.title1{
color: #F41D15;
}
\ No newline at end of file
.headerimg{
margin-top: 50px;
}
.maincontent{
height: 95vh;
padding: 30px!important;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%!important;
}
.btn{
border-radius: 20px;
width: 50%;
overflow: hidden;
height: 3.6rem;
font-size: 16px;
font-weight: 400;
font-variant: small-caps;
color: #fff;
background-color: #CB0D12;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.btn:hover{
background-color: #CB0D12 !important;
}
.star {
background-color: white;
}
.star-container {
width: 100%;
}
.header6{
text-align: center;
color: #787879;
font-weight: 400;
}
.borderdrop{
background: white !important;
border-radius: 20px;
height: 60px;
//border-bottom: 1px solid #C5C5C5;
}
.noborder {
border-bottom: 0px white !important
}
.footer{
position: fixed;
left: 0;
bottom: 0px;
width: 100%;
padding-left:15%;
padding-right:15%
}
}
\ No newline at end of file
......@@ -4,14 +4,6 @@ import { MenuPage } from '../../pages/menu/menu';
import { RestProvider, UserInfo } from '../../providers/rest/rest';
import { AlertController } from 'ionic-angular';
import { Storage } from '@ionic/storage';
import { single } from 'rxjs/operators';
/**
* Generated class for the InquiryPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@IonicPage()
@Component({
......@@ -56,23 +48,9 @@ export class InquiryPage {
this.getcompanyLogo = getcompanyLogo;
});
/*let parser = new DOMParser();
let parsedHtml = parser.parseFromString(this.inquiryTest, 'text/html');
let questions = parsedHtml.getElementsByTagName("span");
if (questions.length > 1) {
this.question1 = questions[0].innerHTML;
this.question2 = questions[1].innerHTML;
}*/
//this.N = parsedHtml.getElementsByClassName("rating__icon").length;
this.stars = new Array<string>(this.shema[0].opcionesPregunta.length - 1);
for (var i = 0; i < this.shema[0].opcionesPregunta.length - 1; i++) { this.stars[i] = "star"; }
console.log('construct InquiryPage 2');
/*let inputs = parsedHtml.getElementsByClassName("rating__input");
this.options = new Array<string>(inputs.length);
for (var i = 0; i < this.options.length; i++) {
this.options[i] = inputs[i].getAttribute("data-op");
}*/
}
inquiry() {
......@@ -94,8 +72,7 @@ export class InquiryPage {
this.restProvider.save_inquiry(this.userID, this.response,this.conversationID).then(data => {
console.log('resp: ' + data);
let alert = this.alertCtrl.create({
title: 'Mensaje',
message: 'Gracias por brindarnos su valiosa opinion!',
subTitle: 'Gracias por brindarnos su valiosa opinion!',
buttons: ['Aceptar']
});
alert.present();
......
......@@ -100,21 +100,25 @@ export class MenuPage {
this.storage.set('name', data['nombre']);
this.storage.set('reciverJID', this.jid);
this.storage.set('conversationID', data['idConversacion']);
//this.storage.set('aplicarEncuesta', data['aplicarEncuesta']);
this.storage.set('aplicarEncuesta', 1);
this.storage.set('aplicarEncuesta', data['aplicarEncuesta']);
//this.storage.set('aplicarEncuesta', 1);
this.loader.show('Please Wait');
this.xmppService.login(this.senderJID, this.password);
}
}).catch(error => {
if (error && error.error && error.error.error) {
/*if (error && error.error && error.error.error) {
let alert = this.alertCtrl.create({
subTitle: error.error.error,
buttons: ['Dismiss']
});
alert.present();
}
}*/
this.loader.show('Please Wait');
this.loader.hide();
this.navCtrl.push("FormularyPage");
});
}
......
......@@ -377,4 +377,22 @@ export class RestProvider {
});
});
}
save_form(rut, request, message) {
return new Promise((resolve, reject) => {
this.http.post('https://' + SERVERS.get() + '/api/registrar/solicitud/formulario ', {
"rut": rut,
"respuesta": {
"requerimiento": request,
"mensaje": message
}
} ,
httpOptions).subscribe(res => {
console.log('res: ' + res);
resolve(res);
}, (err) => {
console.log('err: ' + err);
reject(err);
});
});
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment