add redux store bindings in main page
This commit is contained in:
parent
4218928a7b
commit
ee972b10c8
5 changed files with 31 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Component } from '@angular/core';
|
||||
import {Component, Input} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-case-result',
|
||||
|
@ -9,7 +9,9 @@ import { Component } from '@angular/core';
|
|||
export class CaseResult {
|
||||
|
||||
|
||||
@Input() case: any = {};
|
||||
public activeTab: string = ''
|
||||
|
||||
selectCaseTab(activeTab: string) {
|
||||
console.log('todo')
|
||||
this.activeTab = activeTab
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<header>
|
||||
<div class="row">
|
||||
<div class="title-box">
|
||||
Work stoppage case for CFM56-7B engine (ESN: 802379)...
|
||||
{{ appState.resumeTitle }}
|
||||
|
||||
</div>
|
||||
<div class="actions">
|
||||
|
@ -52,7 +52,7 @@
|
|||
<input class="search" placeholder="Use keywords for a precise research" type="text">
|
||||
</div>
|
||||
<div class="tabs-results">
|
||||
11 cases found, 3 cases suggested
|
||||
{{ appState.similarCases.length }} cases found, 3 cases suggested
|
||||
</div>
|
||||
|
||||
@if (displayedTab == 'similar-cases') {
|
||||
|
@ -70,10 +70,10 @@
|
|||
<div class="row cases-results">
|
||||
|
||||
<!-- boucle des résultats-->
|
||||
<app-case-result></app-case-result>
|
||||
<app-case-result></app-case-result>
|
||||
<app-case-result></app-case-result>
|
||||
<app-case-result></app-case-result>
|
||||
@for (case of appState.similarCases; track case.id) {
|
||||
|
||||
<app-case-result [case]="case"></app-case-result>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {FiltersGroup} from '../../../../../my-workspace/projects/sae-lib/filters/filters-group/filters-group';
|
||||
import {BotTalks} from '../../../../../my-workspace/projects/sae-lib/chatbot/bot-talks/bot-talks';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {CaseResult} from './case-result/case-result';
|
||||
import {BottomNavigation} from '../../shared/navigation/bottom-navigation/bottom-navigation';
|
||||
import {StateInterface} from '../../redux/reducers';
|
||||
import {Store} from '@ngrx/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-similar-cases',
|
||||
imports: [
|
||||
FiltersGroup,
|
||||
BotTalks,
|
||||
// ReactiveFormsModule,
|
||||
CaseResult,
|
||||
|
@ -22,4 +21,12 @@ export class SimilarCases {
|
|||
public searchInput: string = '';
|
||||
public displayedTab: 'similar-cases' | 'technical-manual' = 'similar-cases';
|
||||
|
||||
public appState: any = {};
|
||||
|
||||
constructor(private store: Store<StateInterface>) {
|
||||
this.store.select(state => state.app).subscribe(app => {
|
||||
this.appState = app;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ export const initialState: StateInterface = {
|
|||
backendAPIRoot: "",
|
||||
demoMode: true,
|
||||
fromText: "",
|
||||
fromFile: "",
|
||||
toText: "",
|
||||
filters: {
|
||||
engineType: {
|
||||
|
@ -34,10 +35,15 @@ export const initialState: StateInterface = {
|
|||
selectedList: {}
|
||||
}
|
||||
},
|
||||
similarCases: {},
|
||||
similarCases: [
|
||||
{
|
||||
id: 1,
|
||||
}
|
||||
],
|
||||
searchInput: "",
|
||||
enableAiSuggestion: false,
|
||||
technicalManuals: [],
|
||||
resumeTitle: "Work stoppage case for CFM56-7B engine (ESN: 802379)...",
|
||||
admin: {
|
||||
pendingUsers: {},
|
||||
users: {},
|
||||
|
|
|
@ -99,6 +99,7 @@ export interface StateInterface {
|
|||
app: {
|
||||
demoMode: boolean;
|
||||
backendAPIRoot: string;
|
||||
fromFile: string,
|
||||
fromText: string,
|
||||
toText: string,
|
||||
filters: {
|
||||
|
@ -109,10 +110,11 @@ export interface StateInterface {
|
|||
technicalManual: SelectFilterType,
|
||||
onOffWing: SelectFilterType,
|
||||
}
|
||||
similarCases: object;
|
||||
similarCases: any;
|
||||
searchInput: string;
|
||||
enableAiSuggestion: boolean;
|
||||
technicalManuals: Array<technicalManualType>;
|
||||
resumeTitle: string;
|
||||
admin: {
|
||||
pendingUsers: object;
|
||||
users: object;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue