rsanchez
2017-03-14 ce9bc0c6ad58e4117d26a204ffc56bbcdb7fe916
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<form #packForm="ngForm" class="inset" (keyup.enter)="save()">
   <md-card>
       <md-card-title>
           {{form_title}}
       </md-card-title>
       <md-card-subtitle>
           {{form_subtitle}}
       </md-card-subtitle>
<md-divider></md-divider>
       <md-card-content>
   <div layout="column" layout-align="start center" layout-fill>
       <div layout="row" layout-fill layout-padding>
           <div layout="column" layout-fill  flex="50">
           <md-input-container>
               <input mdInput maxLength="50" type="text" [(ngModel)]="data.code" name="code" required />
               <md-placeholder>
                      <span i18n>Code</span>
                </md-placeholder>
           </md-input-container>
           {{log(packForm.controls)}}
           <div *ngIf="packForm.controls.code?.touched && packForm.controls.code.invalid" layout="column">
               <span *ngIf="packForm.controls.code.errors.required" align="end">Code is required</span>
               <span align="end">Code is ok</span>
           </div>
           </div>
   <!-- TODO: <div class="alert inline-alert alert-warning" ng-show="packForm.code.$invalid">
       <span class="glyphicon glyphicon-warning-sign"></span> 
       <span ng-show="packForm.code.$error.maxlength" ng-bind="maxLengthErrorMsg('Code', maxlength.code)" 
       class="ng-binding ng-hide">Code length is too long (max: 50).</span> 
       <span ng-show="packForm.code.$error.required" ng-bind="mandatoryFieldErrorMsg('Code')" class="ng-binding">'Code' is required.</span>
   </div> -->
           <md-input-container flex="50">
               <input mdInput type="number" type="text" [(ngModel)]="data.num_licenses" name="num_licenses" required />
               <md-placeholder>
                      <span i18n>Num. licenses</span>
                </md-placeholder>
           </md-input-container>
       </div>
       <div layout="row" layout-align="start center" layout-fill layout-padding>
           <md-input-container flex>
               <input mdInput type="date" type="text" [(ngModel)]="data.init_valid_date" name="init_valid_date" required />
               <md-placeholder>
                      <span i18n>Initial date</span>
                </md-placeholder>
               <md-hint align="end">YYYY-MM-DD</md-hint>
           </md-input-container>
           <md-input-container flex>
               <input mdInput type="date" type="text" [(ngModel)]="data.end_valid_date" name="end_valid_date" required />
               <md-placeholder>
                      <span i18n>End date</span>
                </md-placeholder>
               <md-hint align="end">YYYY-MM-DD</md-hint>
           </md-input-container>
       </div>
       <div layout="row" layout-fill layout-padding>
           <md-select flex placeholder="Organization" [(ngModel)]="data.organization_id" name="organization_id">
               <md-option *ngFor="let org of organizations" [value]="org.id">
                   {{org.label}}
               </md-option>
           </md-select>
           <md-select flex placeholder="License type" [(ngModel)]="data.license_type_id" name="license_type_id">
               <md-option *ngFor="let lt of licensetypes" [value]="lt.id">
                   {{lt.label}}
               </md-option>
           </md-select>
       </div>
   </div>
</md-card-content>
<md-divider></md-divider>
<md-card-actions>
   <button [disabled]="!packForm.form.valid" md-raised-button color="primary" (click)="save()">Save</button>
   <button md-button md-dialog-close>Cancel</button>
</md-card-actions>
</md-card>
</form>