-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffdc6f2
commit d3d5e7a
Showing
9 changed files
with
190 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 40 additions & 54 deletions
94
blackrock/src/app/components/fourthquestion/fourthquestion.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,45 @@ | ||
<div class="formulario"> | ||
<h1> | ||
{{user}}, arrastra cada enunciado a la columna que consideres correcta | ||
</h1> | ||
<section class="names"> | ||
<section class="background" id='pig'> | ||
<img src="../../../assets/Piggy bank_Outline.png" alt="Ahorrar" /> | ||
</section> | ||
<section class="background" ><img src="../../../assets/Coins_Two Color.png" alt="Invertir" /></section> | ||
</section> | ||
<div cdkDropListGroup> | ||
<div class="example-container"> | ||
<div | ||
cdkDropList | ||
#questionList="cdkDropList" | ||
[cdkDropListConnectedTo]="[ahorrarList, invertirList]" | ||
[cdkDropListData]="questions" | ||
class="example-list" | ||
[cdkDropListEnterPredicate]="noReturnPredicate" | ||
(cdkDropListDropped)="drop($event)" | ||
> | ||
<div class="example-box" *ngFor="let item of questions"> | ||
<app-chip [content]="item" cdkDrag> </app-chip> | ||
</div> | ||
</div> | ||
</div> | ||
<h1> | ||
{{user}}, arrastra cada enunciado a la columna que consideres correcta | ||
</h1> | ||
<section class="names"> | ||
<section class="background" id='pig'> | ||
<p>ahorrar</p> | ||
<img src="../../../assets/Piggy bank_Outline.png" alt="Ahorrar" /> | ||
</section> | ||
<section class="background"> | ||
<p>Invertir</p> | ||
<img src="../../../assets/Coins_Two Color.png" alt="Invertir" /> | ||
</section> | ||
</section> | ||
<div cdkDropListGroup> | ||
<div class="example-container"> | ||
<div cdkDropList #questionList="cdkDropList" [cdkDropListConnectedTo]="[ahorrarList, invertirList]" | ||
[cdkDropListData]="questions" class="example-list" [cdkDropListEnterPredicate]="noReturnPredicate" | ||
(cdkDropListDropped)="drop($event)"> | ||
<div class="example-box" *ngFor="let item of questions"> | ||
<app-chip [content]="item" cdkDrag> </app-chip> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="example-container"> | ||
<div | ||
cdkDropList | ||
#ahorrarList="cdkDropList" | ||
[cdkDropListConnectedTo]="[invertirList]" | ||
[cdkDropListData]="ahorrar" | ||
class="example-list" | ||
(cdkDropListDropped)="drop($event)" | ||
> | ||
<div class="example-box" *ngFor="let item of ahorrar"> | ||
<app-chip [content]="item" cdkDrag> </app-chip> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="example-container"> | ||
<div cdkDropList #ahorrarList="cdkDropList" [cdkDropListConnectedTo]="[invertirList]" [cdkDropListData]="ahorrar" | ||
class="example-list" (cdkDropListDropped)="drop($event)"> | ||
<div class="example-box" *ngFor="let item of ahorrar"> | ||
<app-chip [content]="item" cdkDrag> </app-chip> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<div class="example-container"> | ||
|
||
<div | ||
cdkDropList | ||
#invertirList="cdkDropList" | ||
[cdkDropListConnectedTo]="[ahorrarList]" | ||
[cdkDropListData]="invertir" | ||
class="example-list" | ||
(cdkDropListDropped)="drop($event)"> | ||
<div class="example-box" *ngFor="let item of invertir"> | ||
<app-chip [content]="item" cdkDrag> | ||
|
||
</app-chip> | ||
</div> | ||
</div> | ||
<div class="example-container"> | ||
|
||
<div cdkDropList #invertirList="cdkDropList" [cdkDropListConnectedTo]="[ahorrarList]" [cdkDropListData]="invertir" | ||
class="example-list" (cdkDropListDropped)="drop($event)"> | ||
<div class="example-box" *ngFor="let item of invertir"> | ||
<app-chip [content]="item" cdkDrag> | ||
|
||
</app-chip> | ||
</div> | ||
</div> |
98 changes: 74 additions & 24 deletions
98
blackrock/src/app/components/fourthquestion/fourthquestion.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,98 @@ | ||
import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop'; | ||
import { | ||
CdkDragDrop, | ||
moveItemInArray, | ||
transferArrayItem, | ||
} from '@angular/cdk/drag-drop'; | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-fourthquestion', | ||
templateUrl: './fourthquestion.component.html', | ||
styleUrls: ['./fourthquestion.component.scss'] | ||
styleUrls: ['./fourthquestion.component.scss'], | ||
}) | ||
export class FourthquestionComponent implements OnInit { | ||
@Input() userName: string=''; | ||
playAudio(){ | ||
const audio = new Audio(); | ||
audio.src = "../../../assets/draganddrop_sound.mp3"; | ||
audio.load(); | ||
export class FourthquestionComponent implements OnInit { | ||
@Input() userName: string = ''; | ||
playAudio() { | ||
const audio = new Audio(); | ||
audio.src = '../../../assets/draganddrop_sound.mp3'; | ||
audio.load(); | ||
audio.play(); | ||
} | ||
user: any | ||
ahorrar = ["Te ayuda a tener más confianza"]; | ||
} | ||
user: any; | ||
|
||
ahorrar = ['Te ayuda a tener más confianza']; | ||
|
||
invertir = ["Te puedes diversificar"]; | ||
questions=["Me da rendimientos","Es la opción más liquida", | ||
"Existen múltiples instrumentos financieros para esta estrategia","Me producirá mas dinero en el futuro", "Me protege contra la inflación"]; | ||
invertir = ['Te puedes diversificar']; | ||
questions = [ | ||
'Me da rendimientos', | ||
'Es la opción más liquida', | ||
'Existen múltiples instrumentos financieros para esta estrategia', | ||
'Me producirá mas dinero en el futuro', | ||
'Me protege contra la inflación', | ||
]; | ||
|
||
ngOnInit(){ | ||
this.user= sessionStorage.getItem('Nombre') | ||
answersAhorrar = [ | ||
'Es la opción más liquida', | ||
'Te ayuda a tener más confianza', | ||
]; | ||
answersInvertir = [ | ||
'Existen múltiples instrumentos financieros para esta estrategia', | ||
'Me da rendimientos', | ||
'Me producirá mas dinero en el futuro', | ||
'Me protege contra la inflación', | ||
'Te puedes diversificar', | ||
]; | ||
|
||
ngOnInit() { | ||
this.user = sessionStorage.getItem('Nombre'); | ||
} | ||
|
||
drop(event: CdkDragDrop <string[]>) { | ||
this.playAudio(); | ||
drop(event: CdkDragDrop<string[]>) { | ||
this.playAudio(); | ||
if (event.previousContainer === event.container) { | ||
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); | ||
moveItemInArray( | ||
event.container.data, | ||
event.previousIndex, | ||
event.currentIndex | ||
); | ||
console.log; | ||
} else { | ||
transferArrayItem( | ||
event.previousContainer.data, | ||
event.container.data, | ||
event.previousIndex, | ||
event.currentIndex, | ||
event.currentIndex | ||
); | ||
} | ||
console.log(this.ahorrar.sort(), this.invertir.sort()); | ||
const selectAhorrar = this.ahorrar.sort(); | ||
const selectInvertir = this.invertir.sort(); | ||
let points = 0; | ||
if (selectAhorrar.includes('Es la opción más liquida')) { | ||
points++; | ||
} | ||
if ( | ||
selectInvertir.includes( | ||
'Existen múltiples instrumentos financieros para esta estrategia' | ||
) | ||
) { | ||
points++; | ||
} | ||
if (selectInvertir.includes('Me da rendimientos')) { | ||
points++; | ||
} | ||
if (selectInvertir.includes('Me producirá mas dinero en el futuro')) { | ||
points++; | ||
} | ||
if (selectInvertir.includes('Me protege contra la inflación')) { | ||
points++; | ||
} | ||
console.log(points); | ||
sessionStorage.setItem('Score4', points.toString()); | ||
console.log(sessionStorage.getItem('Score4')); | ||
} | ||
|
||
noReturnPredicate() { | ||
return false; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.