Skip to content
Snippets Groups Projects
Commit 5b9e8cfc authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #0000 TIME 0:15 add plugin search filter in admin action

parent 6dcdfdee
No related branches found
No related tags found
No related merge requests found
<div class="admin-container" [class.admin-is-mobile]="appService.getViewMode()"> <div class="admin-container" [class.admin-is-mobile]="appService.getViewMode()">
<mat-sidenav-container autosize class="admin-sidenav-container" > <mat-sidenav-container autosize class="admin-sidenav-container">
<mat-sidenav #snav [mode]="appService.getViewMode() ? 'over' : 'side'" [fixedInViewport]="appService.getViewMode()" fixedTopGap="56" <mat-sidenav #snav [mode]="appService.getViewMode() ? 'over' : 'side'"
[fixedInViewport]="appService.getViewMode()" fixedTopGap="56"
[opened]="appService.getViewMode() ? false : true"> [opened]="appService.getViewMode() ? false : true">
<menu-shortcut></menu-shortcut> <menu-shortcut></menu-shortcut>
<menu-nav></menu-nav> <menu-nav></menu-nav>
...@@ -16,42 +17,40 @@ ...@@ -16,42 +17,40 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<mat-form-field> <mat-form-field>
<input matInput [(ngModel)]="action.label_action" required name="action_name" id="action_name" title="{{lang.label}}" <input matInput [(ngModel)]="action.label_action" required name="action_name"
type="text" placeholder="{{lang.label}}" maxlength="255"> id="action_name" title="{{lang.label}}" type="text" placeholder="{{lang.label}}"
maxlength="255">
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<mat-form-field> <plugin-select-search [showLabel]="true" [class]="''" [label]="lang.associatedStatus"
<mat-select id="status" name="status" title="{{lang.associatedStatus}}" placeholder="{{lang.associatedStatus}}" [(ngModel)]="action.id_status" [placeholderLabel]="lang.associatedStatus" [formControlSelect]="selectStatusId"
required> [datas]="statuses" (afterSelected)="action.id_status = selectStatusId.value"
<mat-option *ngFor="let status of statuses" [value]="status.id"> style="width:100%;">
{{status.label_status}} </plugin-select-search>
</mat-option>
</mat-select>
</mat-form-field>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<mat-form-field> <plugin-select-search [showLabel]="true" [class]="''" [label]="lang.actionCarriedOut"
<mat-select id="actionPageId" name="actionPageId" title="{{lang.actionCarriedOut}}" placeholder="{{lang.actionCarriedOut}}" [(ngModel)]="action.actionPageId" (selectionChange)="getCustomFields()"> [placeholderLabel]="lang.actionCarriedOut" [formControlSelect]="selectActionPageId"
<mat-option *ngFor="let action of actionPages" [value]="action.id"> [datas]="actionPages" (afterSelected)="getCustomFields()" style="width:100%;">
{{action.label}} </plugin-select-search>
</mat-option>
</mat-select>
</mat-form-field>
</div> </div>
</div> </div>
<div class="form-group" *ngIf="!this.functions.empty(availableCustomFields) && action.actionPageId=='close_mail'"> <div class="form-group"
*ngIf="!this.functions.empty(availableCustomFields) && action.actionPageId=='close_mail'">
<div class="col-sm-12"> <div class="col-sm-12">
<plugin-select-search [showLabel]="true" [class]="input-form-filled" [label]="lang.checkEmptyFields" [placeholderLabel]="lang.checkEmptyFields" <plugin-select-search [showLabel]="true" [class]="input-form-filled"
[label]="lang.checkEmptyFields" [placeholderLabel]="lang.checkEmptyFields"
[formControlSelect]="customFieldsFormControl" [datas]="availableCustomFields" [formControlSelect]="customFieldsFormControl" [datas]="availableCustomFields"
(afterSelected)="getSelectedFields()" style="width:100%;"> (afterSelected)="getSelectedFields()" style="width:100%;">
</plugin-select-search> </plugin-select-search>
<mat-chip-list class="checkbox-selected-list"> <mat-chip-list class="checkbox-selected-list">
<mat-chip *ngFor="let fieldValue of selectedFieldsValue; let i = index" selected [removable]="true" (removed)="removeSelectedFields(i)"> <mat-chip *ngFor="let fieldValue of selectedFieldsValue; let i = index" selected
[removable]="true" (removed)="removeSelectedFields(i)">
{{fieldValue}} {{fieldValue}}
<mat-icon matChipRemove class="fa fa-times-circle"></mat-icon> <mat-icon matChipRemove class="fa fa-times-circle"></mat-icon>
</mat-chip> </mat-chip>
...@@ -61,7 +60,9 @@ ...@@ -61,7 +60,9 @@
<div class="form-group" *ngIf="action.actionPageId=='create_acknowledgement_receipt'"> <div class="form-group" *ngIf="action.actionPageId=='create_acknowledgement_receipt'">
<div class="col-sm-12"> <div class="col-sm-12">
<mat-form-field> <mat-form-field>
<mat-select [required]="action.actionPageId=='create_acknowledgement_receipt'" id="generateARmode" name="generateARmode" title="{{lang.generateARMode}}" placeholder="{{lang.generateARMode}}" [(ngModel)]="arMode"> <mat-select [required]="action.actionPageId=='create_acknowledgement_receipt'"
id="generateARmode" name="generateARmode" title="{{lang.generateARMode}}"
placeholder="{{lang.generateARMode}}" [(ngModel)]="arMode">
<mat-option value="auto">{{lang.autoAR}}</mat-option> <mat-option value="auto">{{lang.autoAR}}</mat-option>
<mat-option value="manual">{{lang.manualAR}}</mat-option> <mat-option value="manual">{{lang.manualAR}}</mat-option>
<mat-option value="both">{{lang.bothAR}}</mat-option> <mat-option value="both">{{lang.bothAR}}</mat-option>
...@@ -72,7 +73,8 @@ ...@@ -72,7 +73,8 @@
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<mat-form-field> <mat-form-field>
<mat-select id="keyword" name="keyword" title="{{lang.keyword}}" placeholder="{{lang.keyword}}" [(ngModel)]="action.keyword"> <mat-select id="keyword" name="keyword" title="{{lang.keyword}}"
placeholder="{{lang.keyword}}" [(ngModel)]="action.keyword">
<mat-option *ngFor="let keyword of keywordsList" [value]="keyword.value"> <mat-option *ngFor="let keyword of keywordsList" [value]="keyword.value">
{{keyword.label}} {{keyword.label}}
</mat-option> </mat-option>
...@@ -82,14 +84,17 @@ ...@@ -82,14 +84,17 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-12" style="text-align:center;"> <div class="col-sm-12" style="text-align:center;">
<mat-slide-toggle name="history" title="{{lang.actionHistoryDesc}}" id="history" color="primary" [(ngModel)]="action.history" <mat-slide-toggle name="history" title="{{lang.actionHistoryDesc}}" id="history"
[checked]="action.history == 'Y'">{{lang.actionHistory}}</mat-slide-toggle> color="primary" [(ngModel)]="action.history" [checked]="action.history == 'Y'">
{{lang.actionHistory}}</mat-slide-toggle>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<mat-form-field> <mat-form-field>
<mat-select id="categorieslist" name="categorieslist" title="{{lang.chooseCategoryAssociation}}" placeholder="{{lang.chooseCategoryAssociation}}" <mat-select id="categorieslist" name="categorieslist"
title="{{lang.chooseCategoryAssociation}}"
placeholder="{{lang.chooseCategoryAssociation}}"
[(ngModel)]="action.actionCategories" multiple required> [(ngModel)]="action.actionCategories" multiple required>
<mat-option *ngFor="let category of categoriesList" [value]="category.id"> <mat-option *ngFor="let category of categoriesList" [value]="category.id">
{{category.label}} {{category.label}}
...@@ -100,14 +105,16 @@ ...@@ -100,14 +105,16 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-12" style="text-align:center;"> <div class="col-sm-12" style="text-align:center;">
<button mat-raised-button color="primary" type="submit" [disabled]="!actionsFormUp.form.valid">{{lang.save}}</button> <button mat-raised-button color="primary" type="submit"
[disabled]="!actionsFormUp.form.valid">{{lang.save}}</button>
</div> </div>
</div> </div>
</form> </form>
</mat-card> </mat-card>
</mat-sidenav-content> </mat-sidenav-content>
<mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'" [fixedInViewport]="appService.getViewMode()" fixedTopGap="56" <mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'"
position='end' [opened]="appService.getViewMode() ? false : false" style="overflow-x:hidden;"> [fixedInViewport]="appService.getViewMode()" fixedTopGap="56" position='end'
[opened]="appService.getViewMode() ? false : false" style="overflow-x:hidden;">
<mat-list> <mat-list>
<h3 mat-subheader>Action(s)</h3> <h3 mat-subheader>Action(s)</h3>
</mat-list> </mat-list>
......
...@@ -15,7 +15,7 @@ declare function $j(selector: any): any; ...@@ -15,7 +15,7 @@ declare function $j(selector: any): any;
@Component({ @Component({
templateUrl: "action-administration.component.html", templateUrl: "action-administration.component.html",
providers: [NotificationService, AppService] providers: [AppService]
}) })
export class ActionAdministrationComponent implements OnInit { export class ActionAdministrationComponent implements OnInit {
...@@ -39,6 +39,9 @@ export class ActionAdministrationComponent implements OnInit { ...@@ -39,6 +39,9 @@ export class ActionAdministrationComponent implements OnInit {
selectedValue: any; selectedValue: any;
arMode: any; arMode: any;
selectActionPageId = new FormControl();
selectStatusId = new FormControl();
constructor( constructor(
public http: HttpClient, public http: HttpClient,
private route: ActivatedRoute, private route: ActivatedRoute,
...@@ -46,9 +49,7 @@ export class ActionAdministrationComponent implements OnInit { ...@@ -46,9 +49,7 @@ export class ActionAdministrationComponent implements OnInit {
private notify: NotificationService, private notify: NotificationService,
private headerService: HeaderService, private headerService: HeaderService,
public appService: AppService, public appService: AppService,
public functions: FunctionsService) { public functions: FunctionsService) { }
$j("link[href='merged_css.php']").remove();
}
ngOnInit(): void { ngOnInit(): void {
this.loading = true; this.loading = true;
...@@ -63,8 +64,15 @@ export class ActionAdministrationComponent implements OnInit { ...@@ -63,8 +64,15 @@ export class ActionAdministrationComponent implements OnInit {
this.http.get('../../rest/initAction') this.http.get('../../rest/initAction')
.subscribe((data: any) => { .subscribe((data: any) => {
this.action = data.action; this.action = data.action;
this.selectActionPageId.setValue(this.action.actionPageId);
this.selectStatusId.setValue(this.action.id_status);
this.categoriesList = data.categoriesList; this.categoriesList = data.categoriesList;
this.statuses = data.statuses; this.statuses = data.statuses.map((status: any) => {
return {
id : status.id,
label: status.label_status
}
});
this.actionPages = data['actionPages']; this.actionPages = data['actionPages'];
this.keywordsList = data.keywordsList; this.keywordsList = data.keywordsList;
...@@ -81,8 +89,15 @@ export class ActionAdministrationComponent implements OnInit { ...@@ -81,8 +89,15 @@ export class ActionAdministrationComponent implements OnInit {
this.http.get('../../rest/actions/' + params['id']) this.http.get('../../rest/actions/' + params['id'])
.subscribe(async (data: any) => { .subscribe(async (data: any) => {
this.action = data.action; this.action = data.action;
this.selectActionPageId.setValue(this.action.actionPageId);
this.selectStatusId.setValue(this.action.id_status);
this.categoriesList = data.categoriesList; this.categoriesList = data.categoriesList;
this.statuses = data.statuses; this.statuses = data.statuses.map((status: any) => {
return {
id : status.id,
label: status.label_status
}
});
this.actionPages = data['actionPages']; this.actionPages = data['actionPages'];
this.keywordsList = data.keywordsList; this.keywordsList = data.keywordsList;
this.headerService.setHeader(this.lang.actionCreation, data.action.label_action); this.headerService.setHeader(this.lang.actionCreation, data.action.label_action);
...@@ -107,6 +122,7 @@ export class ActionAdministrationComponent implements OnInit { ...@@ -107,6 +122,7 @@ export class ActionAdministrationComponent implements OnInit {
} }
getCustomFields() { getCustomFields() {
this.action.actionPageId = this.selectActionPageId.value;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.action.actionPageId=='close_mail' && this.functions.empty(this.availableCustomFields)) { if (this.action.actionPageId=='close_mail' && this.functions.empty(this.availableCustomFields)) {
this.http.get('../../rest/customFields').pipe( this.http.get('../../rest/customFields').pipe(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment