Commits

Sondissimo authored 1c9fbd46297
CST-11048 FInished the angular implementation for the ldn inbox, needs cleanup
No tags

src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.html

Modified
1 1 <form (ngSubmit)="submitForm()" [formGroup]="formModel">
2 2
3 - <div class="form-group">
4 -
5 - <!-- In the name section -->
6 - <label for="name">Name</label>
7 - <input formControlName="name" id="name" name="name" placeholder="Please provide service name" required
3 + <!-- In the name section -->
4 + <div class="mb-2">
5 + <label for="name">{{ 'ldn-new-service.form.label.name' | translate }}</label>
6 + <input [placeholder]="'ldn-new-service.form.placeholder.name' | translate"
7 + formControlName="name" id="name" name="name"
8 + [class.invalid-field]="formModel.get('name').invalid && formModel.get('name').touched"
8 9 type="text">
9 10 </div>
10 11
11 12 <!-- In the description section -->
12 - <div class="form-group">
13 - <label for="description">Description</label>
14 - <input formControlName="description" id="description" name="description" placeholder="Please provide a description regarding your service"
15 - required type="text">
13 + <div class="mb-2 d-flex flex-column">
14 + <label for="description">{{ 'ldn-new-service.form.label.description' | translate }}</label>
15 + <textarea [placeholder]="'ldn-new-service.form.placeholder.description' | translate"
16 + formControlName="description" id="description" name="description"></textarea>
16 17 </div>
17 18
18 19 <!-- In the url section -->
19 - <div class="form-group">
20 - <label for="url">Service URL</label>
21 - <input formControlName="url" id="url" name="url" placeholder="Please input the URL for users to check out more information about the service"
22 - required type="text">
20 + <div class="mb-2">
21 + <label for="url">{{ 'ldn-new-service.form.label.url' | translate }}</label>
22 + <input [placeholder]="'ldn-new-service.form.placeholder.url' | translate"
23 + formControlName="url" id="url" name="url"
24 + [class.invalid-field]="formModel.get('url').invalid && formModel.get('url').touched"
25 + type="text">
23 26 </div>
24 27
25 28 <!-- In the ldnUrl section -->
26 - <div class="form-group">
27 - <label for="ldnUrl">LDN Inbox URL</label>
28 - <input formControlName="ldnUrl" id="ldnUrl" name="ldnUrl" placeholder="Please specify the URL of the LDN Inbox"
29 - required type="text">
29 + <div class="mb-2">
30 + <label for="ldnUrl">{{ 'ldn-new-service.form.label.ldnUrl' | translate }}</label>
31 + <input [placeholder]="'ldn-new-service.form.placeholder.ldnUrl' | translate"
32 + formControlName="ldnUrl" id="ldnUrl" name="ldnUrl"
33 + [class.invalid-field]="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched"
34 + type="text">
30 35 </div>
31 36
32 37 <!-- In the Inbound Patterns section -->
33 - <div *ngFor="let patternGroup of formModel.get('notifyServiceInboundPatterns')['controls']; let i = index" class="form-group"
34 - formGroupName="notifyServiceInboundPatterns">
38 + <div *ngFor="let patternGroup of formModel.get('notifyServiceInboundPatterns')['controls']; let i = index"
39 + class="mb-2 d-flex align-content-center" formGroupName="notifyServiceInboundPatterns">
35 40
36 41 <ng-container [formGroupName]="i">
37 42
38 - <label for="additionalInboundPattern{{i}}">Inbound Pattern {{i + 1}}</label>
43 + <div class="flex-grow-1">
44 + <label for="additionalInboundPattern{{i}}">{{ 'ldn-new-service.form.label.inboundPattern' | translate }} {{ i + 1 }}</label>
39 45
40 - <select #inboundPattern formControlName="pattern" id="additionalInboundPattern{{i}}"
41 - name="additionalInboundPattern{{i}}" required>
46 + <select #inboundPattern formControlName="pattern" id="additionalInboundPattern{{i}}"
47 + name="additionalInboundPattern{{i}}" required>
42 48
43 - <option disabled value="">Select an Additional Inbound Pattern</option>
44 - <option *ngFor="let pattern of inboundPatterns" [ngValue]="pattern.name">{{ pattern.name }}</option>
49 + <option value="">{{ 'ldn-new-service.form.label.placeholder.inboundPattern' | translate }}</option>
50 + <option *ngFor="let pattern of inboundPatterns" [ngValue]="pattern.name">{{ pattern.name }}</option>
45 51
46 - </select>
52 + </select>
53 + </div>
47 54
48 - <div *ngIf="inboundPattern.value" class="form-group">
55 + <ng-container *ngIf="inboundPattern.value">
49 56
50 - <label for="constraint{{i}}">Selected Item Filter</label>
57 + <div class="ml-2 flex-grow-1">
58 + <label for="constraint{{i}}">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
51 59
52 - <select formControlName="constraint" id="constraint{{i}}" name="constraint{{i}}">
60 + <select formControlName="constraint" id="constraint{{i}}" name="constraint{{i}}">
61 + <option value="">{{ 'ldn-new-service.form.label.placeholder.selectedItemFilter' | translate }}</option>
62 + <option *ngFor="let itemFilter of itemFilterList"
63 + [value]="itemFilter.name">{{ itemFilter.name }}</option>
64 + </select>
65 + </div>
53 66
54 - <option disabled value="">Select an Item Filter</option>
55 - <option *ngFor="let itemFilter of itemFilterList"
56 - [value]="itemFilter.name">{{ itemFilter.name }}</option>
67 + <div class="ml-2 d-flex flex-column align-content-center">
68 + <label for="automatic{{i}}">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
69 + <div class="d-flex flex-grow-1 align-content-center justify-content-center">
70 + <input formControlName="automatic" id="automatic{{i}}" name="automatic{{i}}" type="checkbox">
71 + </div>
72 + </div>
57 73
58 - </select>
74 + </ng-container>
59 75
76 + <div class="d-flex align-items-end justify-content-center">
77 + <button (click)="removeInboundPattern(patternGroup)" *ngIf="i > 0" class="btn btn-outline-dark trash-button ml-2">
78 + <i class="fas fa-trash"></i>
79 + </button>
60 80 </div>
61 81
62 - <span *ngIf="i > 0" (click)="removeInboundPattern(patternGroup)" class="remove-pattern-link">- Remove</span>
63 -
64 82 </ng-container>
65 83
66 84 </div>
67 85
68 - <span (click)="addInboundPattern()" class="add-pattern-link">+ Add more</span>
86 + <span (click)="addInboundPattern()"
87 + class="add-pattern-link mb-2">{{ 'ldn-new-service.form.label.addPattern' | translate }}</span>
69 88
70 89 <!-- In the Outbound Patterns section -->
71 - <div *ngFor="let patternGroup of formModel.get('notifyServiceOutboundPatterns')['controls']; let i = index" class="form-group"
72 - formGroupName="notifyServiceOutboundPatterns">
90 + <div *ngFor="let patternGroup of formModel.get('notifyServiceOutboundPatterns')['controls']; let i = index"
91 + class="mb-2 d-flex align-content-center" formGroupName="notifyServiceOutboundPatterns">
73 92
74 93 <ng-container [formGroupName]="i">
75 94
76 - <label for="additionalOutboundPattern{{i}}">Outbound Pattern {{i + 1}}</label>
95 + <div class="flex-grow-1">
96 + <label for="additionalOutboundPattern{{i}}">{{ 'ldn-new-service.form.label.outboundPattern' | translate }} {{ i + 1 }}</label>
77 97
78 - <select formControlName="pattern" id="additionalOutboundPattern{{i}}" name="additionalOutboundPattern{{i}}"
79 - required>
98 + <select #outboundPattern formControlName="pattern" id="additionalOutboundPattern{{i}}"
99 + name="additionalOutboundPattern{{i}}"
100 + required>
80 101
81 - <option disabled value="">Select an Additional Outbound Pattern</option>
82 - <option *ngFor="let pattern of outboundPatterns" [ngValue]="pattern.name">{{ pattern.name }}</option>
102 + <option value="">{{ 'ldn-new-service.form.label.placeholder.outboundPattern' | translate }}</option>
103 + <option *ngFor="let pattern of outboundPatterns"
104 + [ngValue]="pattern.name">{{ pattern.name }}</option>
83 105
84 - </select>
106 + </select>
107 + </div>
85 108
86 - <span *ngIf="i > 0" (click)="removeOutboundPattern(patternGroup)" class="remove-pattern-link">- Remove</span>
109 + <div *ngIf="outboundPattern.value" class="ml-2 flex-grow-1">
110 +
111 + <label for="constraint{{i}}">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
112 +
113 + <select formControlName="constraint" id="constraint{{i}}" name="constraint{{i}}">
114 + <option value="">{{ 'ldn-new-service.form.label.placeholder.selectedItemFilter' | translate }}</option>
115 + <option *ngFor="let itemFilter of itemFilterList"
116 + [value]="itemFilter.name">{{ itemFilter.name }}</option>
117 + </select>
118 +
119 + </div>
120 +
121 + <div class="d-flex align-items-end justify-content-center">
122 + <button (click)="removeOutboundPattern(patternGroup)" *ngIf="i > 0" class="btn btn-outline-dark trash-button ml-2">
123 + <i class="fas fa-trash"></i>
124 + </button>
125 + </div>
87 126
88 127 </ng-container>
89 128
90 129 </div>
91 130
92 - <span (click)="addOutboundPattern()" class="add-pattern-link">+ Add more</span>
131 + <span (click)="addOutboundPattern()"
132 + class="add-pattern-link mb-2">{{ 'ldn-new-service.form.label.addPattern' | translate }}
133 + </span>
93 134
94 135 <button class="btn btn-primary" type="submit">Submit</button>
95 -
96 136 </form>

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut