Skip to content

Commit

Permalink
[VAS] Bug audit selector
Browse files Browse the repository at this point in the history
  • Loading branch information
laedanrex committed Apr 20, 2023
1 parent f567a9c commit dad43e5
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
<h4>{{ 'COLLECT.MODAL.TITLE' | translate }}</h4>
<h2>{{ 'COLLECT.MODAL.WORKFLOW_CHOICE' | translate }}</h2>
<div class="main-content">
<vitamui-radio-group formControlName="selectedWorkflow" primary="true">
<vitamui-radio value="{{ Workflow.MANUAL }}" label="{{ 'COLLECT.MODAL.MANUAL_WORKFLOW' | translate }}"
(click)="setWorkflow(Workflow.MANUAL)" primary="true" checked>
</vitamui-radio>
<vitamui-radio value="{{ Workflow.FLOW }}" label="{{ 'COLLECT.MODAL.FLOW_WORKFLOW' | translate }}"
(click)="setWorkflow(Workflow.FLOW)" primary="true">
</vitamui-radio>
</vitamui-radio-group>
<mat-button-toggle-group formControlName="selectedWorkflow" #group="matButtonToggleGroup"
class="vitamui-button-toggle-group">
<mat-button-toggle value="{{ Workflow.MANUAL }}" (click)="setWorkflow(Workflow.MANUAL)" [checked]="true">
{{'COLLECT.MODAL.MANUAL_WORKFLOW' | translate}}
</mat-button-toggle>
<mat-button-toggle value="{{ Workflow.FLOW }}" (click)="setWorkflow(Workflow.FLOW)">
{{'COLLECT.MODAL.FLOW_WORKFLOW' | translate}}
</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div class="actions">
<div class="line">
Expand Down Expand Up @@ -293,14 +294,15 @@ <h2>{{ 'COLLECT.MODAL.UPLOAD_SUB_TITLE' | translate }}</h2>
<h4>{{ 'COLLECT.MODAL.TITLE' | translate }}</h4>
<h2>{{ 'COLLECT.MODAL.FLOW_WORKFLOW_TYPE_CHOICE' | translate }}</h2>
<div class="main-content">
<vitamui-radio-group formControlName="selectedFlowType" primary="true">
<vitamui-radio value="{{ FlowType.FIX }}" label="{{ 'COLLECT.MODAL.FIX_FLOW_WORKFLOW' | translate }}"
(click)="setFlowType(FlowType.FIX)" primary="true" checked>
</vitamui-radio>
<vitamui-radio value="{{ FlowType.RULES }}" label="{{ 'COLLECT.MODAL.RULES_FLOW_WORKFLOW' | translate }}"
(click)="setFlowType(FlowType.RULES)" primary="true">
</vitamui-radio>
</vitamui-radio-group>
<mat-button-toggle-group formControlName="selectedFlowType" #group="matButtonToggleGroup"
class="vitamui-button-toggle-group">
<mat-button-toggle value="{{ FlowType.FIX }}" (click)="setFlowType(FlowType.FIX)" [checked]="true">
{{'COLLECT.MODAL.FIX_FLOW_WORKFLOW' | translate}}
</mat-button-toggle>
<mat-button-toggle value="{{ FlowType.RULES }}" (click)="setFlowType(FlowType.RULES)">
{{'COLLECT.MODAL.RULES_FLOW_WORKFLOW' | translate}}
</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div class="actions">
<div class="line">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
display: flex;
flex-direction: column;
justify-content: start;
align-items: start;
}

.actions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ <h4 class="mx-2 mt-1">@</h4>
<div class="mt-2">
<mat-button-toggle-group formControlName="type" #group="matButtonToggleGroup" class="vitamui-button-toggle-group">
<mat-button-toggle value="NOMINATIVE">
{{'USER.INFORMATIONS.MODAL.INFORMATIONS_STEP.GROUP_TYPE_NOMINATIVE' | translate}}</mat-button-toggle>
<mat-button-toggle value="GENERIC">{{'USER.INFORMATIONS.MODAL.INFORMATIONS_STEP.GROUP_TYPE_GENERIC' | translate}}
{{'USER.INFORMATIONS.MODAL.INFORMATIONS_STEP.GROUP_TYPE_NOMINATIVE' | translate}}
</mat-button-toggle>
<mat-button-toggle value="GENERIC">
{{'USER.INFORMATIONS.MODAL.INFORMATIONS_STEP.GROUP_TYPE_GENERIC' | translate}}
</mat-button-toggle>
</mat-button-toggle-group>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class="row">
<div class="col-12 mb-3" *ngIf="label">
<label>{{label}} <span *ngIf="required" class="required-marker">*</span></label>
</div>
<div class="col-12" [class.primary]="primary">
<div class="radio-group">
<ng-content select="vitamui-radio">
</ng-content>
<div class="col-12 mb-3">
<label>{{label}} <span *ngIf="required" class="required-marker">*</span></label>
</div>
<div class="col-12">
<div class="radio-group">
<ng-content select="vitamui-radio">
</ng-content>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
display: inline-block;
border-radius: 5px;
overflow: hidden;

}

.primary {
display: flex;

.radio-group {
border: solid 1px var(--vitamui-primary);
border-radius: 8px;
display: flex;
}
}

label {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
/* tslint:disable:no-use-before-declare component-selector */
import {
AfterContentInit,
Component,
ContentChildren,
forwardRef,
HostBinding,
Input,
OnDestroy,
OnInit,
QueryList,
Self
} from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';

import { VitamUIRadioComponent } from '../vitamui-radio/vitamui-radio.component';
import { VitamUIRadioGroupService } from './vitamui-radio-group.service';
import {AfterContentInit, Component, ContentChildren, forwardRef, Input, OnInit, QueryList, Self} from '@angular/core';
import {NG_VALUE_ACCESSOR} from '@angular/forms';

import {VitamUIRadioComponent} from '../vitamui-radio/vitamui-radio.component';
import {VitamUIRadioGroupService} from './vitamui-radio-group.service';

export const RADIO_GROUP_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
Expand All @@ -31,18 +20,18 @@ export const RADIO_GROUP_VALUE_ACCESSOR: any = {
VitamUIRadioGroupService
]
})
export class VitamUIRadioGroupComponent implements OnInit, AfterContentInit, OnDestroy {
export class VitamUIRadioGroupComponent implements OnInit, AfterContentInit {

constructor(@Self() private radioGroupService: VitamUIRadioGroupService) {
}

@ContentChildren(VitamUIRadioComponent) private radios: QueryList<VitamUIRadioComponent>;

@Input() label: string;

@Input() required: boolean;
@Input()
label: string;

@HostBinding('class.primary') @Input() primary = false;
@Input()
required: boolean;

value: any;

Expand All @@ -54,7 +43,7 @@ export class VitamUIRadioGroupComponent implements OnInit, AfterContentInit, OnD
}

ngOnInit(): void {
this.required = (this.required !== undefined);
this.required = (this.required === undefined) ? false : true;
const subscription = this.radioGroupService.resetAll.subscribe((elem: VitamUIRadioComponent) => {
this.radios.forEach((radioButton: VitamUIRadioComponent) => {
radioButton.checked = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<label class="radio-label" [ngClass]="{'checked' : checked, 'primary' : primary}">
<input #input type="radio" [value]="value" (click)="changed()">
<span> {{label}} </span>
<label class="radio-label" [ngClass]="{'checked' : checked}">
<input #input type="radio" [value]="value" (click)="changed()">
<span> {{label}} </span>
</label>
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
@import "~ui-frontend-common/sass/variables/colors";

:host(.primary) {
display: flex;
}

input[type="radio"] {
position: absolute;
visibility: hidden;
Expand All @@ -15,7 +11,7 @@ input[type="radio"] {
display: inline-block;
cursor: pointer;
font-weight: bold;
padding: 10px 30px;
padding: 5px 20px;

span {
-webkit-user-select: none;
Expand All @@ -25,18 +21,7 @@ input[type="radio"] {
}
}

.radio-label.primary {
color: black;
font-weight: normal;
align-items: center;
justify-content: center;
}

.radio-label.checked {
color: $white;
background: var(--vitamui-primary);
}

.radio-label.checked.primary {
color: white;
background: var(--vitamui-secondary);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* tslint:disable:component-selector */
import { Component, HostBinding, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';

import { VitamUIRadioGroupService } from '../vitamui-radio-group/vitamui-radio-group.service';

Expand All @@ -10,19 +10,20 @@ import { VitamUIRadioGroupService } from '../vitamui-radio-group/vitamui-radio-g
})
export class VitamUIRadioComponent implements OnInit {

@Input() value: string;
@Input()
value: string;

@Input() label: string;
@Input()
label: string;

@Input() checked: boolean;

@HostBinding('class.primary') @Input() primary = false;
@Input()
checked: boolean;

constructor(private radioGroupService: VitamUIRadioGroupService) {
}

ngOnInit() {
this.checked = (this.checked !== undefined);
this.checked = this.checked !== undefined;
}

changed() {
Expand Down

0 comments on commit dad43e5

Please sign in to comment.