Commit 35cb1c8c authored by huriarte's avatar huriarte

avances preguntas frecuentes

parent 0aeae9d9
......@@ -16,6 +16,7 @@ import { AgentDetailComponent } from './view/agent-detail/agent-detail.component
import { EsStepsProcessorsModalComponent } from './view/components/es-steps-processors-modal/es-steps-processors-modal.component';
import { DynamicTranslatePipe } from './pipe/dynamic-translate.pipe';
import { CaGeneralInformationComponent } from './view/components/ca-general-information/ca-general-information.component';
import { CaFrequentQuestionsComponent } from './view/components/ca-frequent-questions/ca-frequent-questions.component';
@NgModule({
......@@ -27,7 +28,8 @@ import { CaGeneralInformationComponent } from './view/components/ca-general-info
AgentDetailComponent,
EsStepsProcessorsModalComponent,
DynamicTranslatePipe,
CaGeneralInformationComponent],
CaGeneralInformationComponent,
CaFrequentQuestionsComponent],
imports: [
FormsModule,
ReactiveFormsModule,
......
......@@ -17,17 +17,17 @@
</ng-template>
<byte-ca-general-information [stepper]="stepper"></byte-ca-general-information>
</mat-step>
<!--
<mat-step state="connections">
<mat-step state="questions">
<ng-template matStepLabel>
<span class="font-bold">{{'label.connections.title' | translate}}</span>
<div class="font-size-description" [title]="'label.connections.description' | translate">
{{'label.connections.description' | translate}}
<span class="font-bold">{{'label.questions.title' | translate}}</span>
<div class="font-size-description" [title]="'label.questions.description' | translate">
{{'label.questions.description' | translate}}
</div>
</ng-template>
<byte-es-connections [stepper]="stepper" (onDeleteConnection)="onDeleteConnection($event)"></byte-es-connections>
<byte-ca-frequent-questions [stepper]="stepper"></byte-ca-frequent-questions>
</mat-step>
<!--
<mat-step state="steps">
<ng-template matStepLabel>
<span class="font-bold">{{'label.steps.title' | translate}}</span>
......@@ -51,11 +51,11 @@
<ng-template matStepperIcon="info">
<mat-icon>info</mat-icon>
</ng-template>
<!--
<ng-template matStepperIcon="connections">
</ng-template>
<ng-template matStepperIcon="questions">
<mat-icon>dns</mat-icon>
</ng-template>
<!--
<ng-template matStepperIcon="steps">
<mat-icon>device_hub</mat-icon>
</ng-template>
......
......@@ -11,6 +11,7 @@ import { NavigationService } from '@xdf/layouts';
import { IDirty } from '@xdf/gallery';
//import { ExternalSystemService } from '../../service/external-system.service';
import { first } from 'rxjs/operators';
import { CaFrequentQuestionsComponent } from '../components/ca-frequent-questions/ca-frequent-questions.component';
@Component({
......@@ -22,11 +23,14 @@ import { first } from 'rxjs/operators';
}]
})
export class AgentComponent implements OnInit {
export class AgentComponent implements OnInit, IDirty {
@ViewChild(CaGeneralInformationComponent, { static: true })
generalInformationComponent: CaGeneralInformationComponent;
@ViewChild(CaFrequentQuestionsComponent, { static: true })
frequentQuestionsComponent: CaFrequentQuestionsComponent;
externalSystemDetail: any;
isLinear = true;
......@@ -51,6 +55,7 @@ export class AgentComponent implements OnInit {
let dirty = false;
dirty = this.generalInformationComponent.isDirty()
|| this.frequentQuestionsComponent.isDirty()
;
/* if (dirty) {
......@@ -90,12 +95,12 @@ export class AgentComponent implements OnInit {
let dataForWizard = this._activatedRoute.snapshot.data.dataForWizard;
//this.connectionsComponent.setDataForWizard(dataForWizard);
this.frequentQuestionsComponent.setDataForWizard(dataForWizard);
//this.stepsComponent.setDataForWizard(dataForWizard);
//this.entitiesComponent.setDataForWizard(dataForWizard);
this.generalInformationComponent.buildForm(this.externalSystemDetail);
//this.connectionsComponent.buildForm(this.externalSystemDetail, this.resourceAuth);
this.frequentQuestionsComponent.buildForm(this.externalSystemDetail);
//this.stepsComponent.buildForm(this.externalSystemDetail, this.resourceAuth);
//this.entitiesComponent.buildForm(this.externalSystemDetail);
//this.summaryComponent.buildForm(this.externalSystemDetail);
......
<div class="panel-viewer-wrapper">
<div class="panel-viewer-title">
<i class="fa fa-info-circle"></i>
{{'label.frequent-questions.title' | translate}}
</div>
<form [formGroup]="formGroup" autocomplete="off">
<div class="panel-viewer-body">
<div class="row pt-3 pb-4">
<div class="col-3"></div>
<div class="col-6 border-all">
<div class="row pt-2">
<div class="col-12">
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" -->
<!-- Position Column -->
<ng-container matColumnDef="position">
<th mat-header-cell *matHeaderCellDef> No. </th>
<td mat-cell *matCellDef="let element"> {{element.position}} </td>
</ng-container>
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> Name </th>
<td mat-cell *matCellDef="let element"> {{element.name}} </td>
</ng-container>
<!-- Weight Column -->
<ng-container matColumnDef="weight">
<th mat-header-cell *matHeaderCellDef> Weight </th>
<td mat-cell *matCellDef="let element"> {{element.weight}} </td>
</ng-container>
<!-- Symbol Column -->
<ng-container matColumnDef="symbol">
<th mat-header-cell *matHeaderCellDef> Symbol </th>
<td mat-cell *matCellDef="let element"> {{element.symbol}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
</div>
</div>
<div class="col-3"></div>
</div>
</div>
</form>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CaFrequentQuestionsComponent } from './ca-frequent-questions.component';
describe('CaFrequentQuestionsComponent', () => {
let component: CaFrequentQuestionsComponent;
let fixture: ComponentFixture<CaFrequentQuestionsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CaFrequentQuestionsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CaFrequentQuestionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, Input, ViewContainerRef } from '@angular/core';
import { Subscription, of } from 'rxjs';
import { FormGroup, FormBuilder, FormControl } from '@angular/forms';
import { MatStepper } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
import { animate, trigger, state, transition, style } from '@angular/animations';
import { DomSanitizer } from '@angular/platform-browser';
export interface PeriodicElement {
name: string;
position: number;
weight: number;
symbol: string;
}
const ELEMENT_DATA: PeriodicElement[] = [
{position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'},
{position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'},
{position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'},
{position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'},
{position: 5, name: 'Boron', weight: 10.811, symbol: 'B'},
{position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'},
{position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'},
{position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'},
{position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F'},
{position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne'},
];
@Component({
selector: 'byte-ca-frequent-questions',
templateUrl: './ca-frequent-questions.component.html',
styleUrls: ['./ca-frequent-questions.component.scss'],
animations: [
trigger('fadeInOut', [
state('in', style({ opacity: 100 })),
transition('* => void', [
animate(300, style({ opacity: 0 }))
])
])
]
})
export class CaFrequentQuestionsComponent implements OnInit {
@Input() stepper: MatStepper;
viewMode: boolean;
formGroup: FormGroup;
questions : any;
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
dataSource = ELEMENT_DATA;
constructor() { }
ngOnInit() {
}
isDirty() {
return this.formGroup.dirty;
}
buildForm(questions: any) {
this.questions = questions;
if (questions) {
/*
this.formGroup.patchValue({
name: agentDetail.name,
description: agentDetail.description
});
*/
}
}
setDataForWizard(result: any) {
console.log(result)
/*
this.protocols = result.connectionProtocolOptions;
this.generalProperties = result.generalProperties;
this.alias = result.alias;
this.maxNumberOfConnectionsByExternalSystem = result.maxNumberOfConnectionsByExternalSystem;
this.columnsForEntity = result.columnsForEntity;
*/
}
}
......@@ -99,4 +99,12 @@ li {
.without-image {
text-align: inherit;
height: calc(100% - 36px);
}
.h-85 {
height: 85%;
}
.h-100 {
height: 85%;
}
\ No newline at end of file
......@@ -30,7 +30,6 @@ export class CaGeneralInformationComponent implements OnInit {
agentDetail: any;
formGroup: FormGroup;
types: any;
viewMode: boolean;
allowDragAndDrop = false;
......@@ -41,6 +40,44 @@ export class CaGeneralInformationComponent implements OnInit {
//urlBase = './service/file/download/';
urlBase = '';
countries = [
{
"name": "Perú",
"timezones": [
"GMT-5"
]
},
{
"name": "Argentina",
"timezones": [
"GMT-3"
]
},
{
"name": "Brazil",
"timezones": [
"GMT-5",
"GMT-4",
"GMT-3",
"GMT-2"
]
}
];
timezones = [];
languages = [
{
"name" : "Español"
}
];
types = [
{
"name" : "Agente de preguntas frecuentes"
}
];
constructor(
private formBuilder: FormBuilder,
private _activatedRoute: ActivatedRoute,
......@@ -53,7 +90,11 @@ export class CaGeneralInformationComponent implements OnInit {
name: new FormControl({ value: "", disabled: this.viewMode }),
description: new FormControl({ value: "", disabled: this.viewMode }),
version: new FormControl({ value: "", disabled: this.viewMode }),
imageAvatar: new FormControl({ value: "", disabled: this.viewMode })
imageAvatar: new FormControl({ value: "", disabled: this.viewMode }),
country: new FormControl({ value: "", disabled: this.viewMode }),
timezone: new FormControl({ value: "", disabled: this.viewMode }),
language: new FormControl({ value: "", disabled: this.viewMode }),
type: new FormControl({ value: "", disabled: this.viewMode })
});
}
......@@ -151,6 +192,48 @@ export class CaGeneralInformationComponent implements OnInit {
}
}
onCountryChange(obj) {
console.log('Country changed...');
let selectedCountry = obj.value;
console.log(selectedCountry);
this.timezones = [];
console.log(this.formGroup.controls['timezone'].value);
this.formGroup.controls['timezone'].setValue(null);
if (selectedCountry) {
this.timezones = selectedCountry.timezones;
}
}
saveConnection(validateForm: boolean): boolean {
if (validateForm && !this.formGroup.valid) {
return false;
}
/*
this.externalSystemDetail.abbreviation = this.formGroup.controls.abbreviation.value;
this.externalSystemDetail.name = this.formGroup.controls.name.value;
this.externalSystemDetail.description = this.formGroup.controls.description.value;
this.externalSystemDetail.status = this.formGroup.controls.status.value ? 'AC' : 'IN';
this.externalSystemDetail.inputType = this.formGroup.controls.inputType.value;
this.externalSystemDetail.type = this.formGroup.controls.type.value;
*/
return true;
}
next() {
if (this.viewMode) {
this.stepper.next();
return;
}
if (this.saveConnection(true)) {
this.stepper.next();
}
}
}
export class FileUploadModel {
......
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