Commit 7c7eea0a authored by François Agneray's avatar François Agneray
Browse files

Update search type list

parent 70cfbf50
<div *ngFor="let attribute of getAttributeByFamily(criteriaFamily.id)">
<div [ngSwitch]="attribute.search_type">
<div *ngSwitchCase="'fd'">
<div *ngSwitchCase="'field'">
<app-field class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [placeholder]="attribute.placeholder_min"
[attributeType]="attribute.type" [criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-field>
</div>
<div *ngSwitchCase="'bw'">
<div *ngSwitchCase="'between'">
<app-between class="criteria" [id]="attribute.id" [label]="attribute.form_label"
[placeholderMin]="attribute.placeholder_min" [placeholderMax]="attribute.placeholder_max"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-between>
</div>
<div *ngSwitchCase="'se'">
<div *ngSwitchCase="'select'">
<app-select class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [options]="getOptions(attribute.id)"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-select>
</div>
<div *ngSwitchCase="'ms'">
<div *ngSwitchCase="'select-multiple'">
<app-select-multiple class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [options]="getOptions(attribute.id)"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-select-multiple>
</div>
<div *ngSwitchCase="'dl'">
<div *ngSwitchCase="'datalist'">
<app-datalist class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [placeholder]="attribute.placeholder_min"
[options]="getOptions(attribute.id)" [criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-datalist>
</div>
<div *ngSwitchCase="'rd'">
<div *ngSwitchCase="'radio'">
<app-radio class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [options]="getOptions(attribute.id)"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-radio>
</div>
<div *ngSwitchCase="'cb'">
<div *ngSwitchCase="'checkbox'">
<app-checkbox class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [options]="getOptions(attribute.id)"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-checkbox>
</div>
<div *ngSwitchCase="'dt'">
<div *ngSwitchCase="'date'">
<app-date class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [placeholder]="attribute.placeholder_min"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-date>
</div>
<div *ngSwitchCase="'bd'">
<div *ngSwitchCase="'between-date'">
<app-between-date class="criteria" [id]="attribute.id" [operator]="attribute.operator"
[label]="attribute.form_label" [criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-between-date>
</div>
<div *ngSwitchCase="'tm'">
<div *ngSwitchCase="'time'">
<app-time class="criteria" [id]="attribute.id" [label]="attribute.form_label"
[operator]="attribute.operator" [criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-time>
</div>
<div *ngSwitchCase="'ts'">
<div *ngSwitchCase="'date-time'">
<app-datetime class="criteria" [id]="attribute.id" [label]="attribute.form_label" [operator]="attribute.operator"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-datetime>
</div>
<div *ngSwitchCase="'js'">
<div *ngSwitchCase="'json'">
<app-json class="criteria" [id]="attribute.id" [label]="attribute.form_label"
[criterion]="getCriterion(attribute.id)" (add)="add($event)" (delete)="delete($event)">
</app-json>
......
......@@ -84,24 +84,24 @@ export class SearchEffects {
const params = c.split('::');
const attribute = loadAttributeSearchMetaSuccessAction.payload.find(a => a.id === parseInt(params[0], 10));
switch (attribute.search_type) {
case 'fd':
case 'se':
case 'dl':
case 'rd':
case 'dt':
case 'ts':
case 'tm':
case 'field':
case 'select':
case 'datalist':
case 'radio':
case 'date':
case 'date-time':
case 'time':
return new FieldCriterion(parseInt(params[0], 10), params[1], params[2]);
case 'bw':
case 'bd':
case 'between':
case 'between-date':
const bwValues = params[2].split('|');
return new BetweenCriterion(parseInt(params[0], 10), bwValues[0], bwValues[1]);
case 'ms':
case 'cb':
case 'select-multiple':
case 'checkbox':
const msValues = params[2].split('|');
const options = attribute.options.filter(option => msValues.includes(option.value));
return new SelectMultipleCriterion(parseInt(params[0], 10), params[1], options);
case 'js':
case 'json':
const [path, operator, value] = params[2].split('|');
return new JsonCriterion(parseInt(params[0], 10), path, operator, value);
......
Supports Markdown
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