Migrate schedule edit form to Material.

This commit is contained in:
Alexis Lahouze 2017-09-22 00:27:49 +02:00
parent 2287ca8ad3
commit 73a43b6e2a

View File

@ -9,115 +9,73 @@ import { Schedule } from './schedule';
exportAs: 'scheduleForm', exportAs: 'scheduleForm',
template: ` template: `
<form novalidate (keyup.enter)="submit()" [formGroup]="form"> <form novalidate (keyup.enter)="submit()" [formGroup]="form">
<div class="form-group row"> <md-list>
<label class="col-sm-4 control-label" for="start-date">Date de début (AAAA-MM-JJ)</label> <md-list-item>
<md-form-field>
<input mdInput formControlName="startDate"
[textMask]="{mask: dateMask}"
placeholder="Schedule start date">
<div class="col-sm-8" <md-error *ngIf="startDate.errors?.required">The start date is required.</md-error>
[class.has-danger]="startDate.errors"> </md-form-field>
<input class="form-control" </md-list-item>
id="start-date" formControlName="startDate"
[textMask]="{mask: dateMask}"
placeholder="Schedule start date">
<div class="help-block text-danger" *ngIf="startDate.errors"> <md-list-item>
<p *ngIf="startDate.errors.required">The start date is required.</p> <md-form-field>
</div> <input mdInput formControlName="stopDate"
</div> [textMask]="{mask: dateMask}"
</div> placeholder="Schedule stop date">
<div class="form-group row"> <md-error *ngIf="stopDate.errors?.required">The stop date is required.</md-error>
<label class="col-sm-4 control-label" for="stop-date">Date de fin (AAAA-MM-JJ)</label> </md-form-field>
</md-list-item>
<div class="col-sm-8" <md-list-item>
[class.has-danger]="stopDate.errors"> <md-form-field>
<input class="form-control" <input mdInput formControlName="day"
id="stop-date" formControlName="stopDate" type="number" placeholder="Day">
[textMask]="{mask: dateMask}"
placeholder="Schedule stop date">
<div class="help-block text-danger" *ngIf="stopDate.errors"> <md-error *ngIf="day.errors?.required">The day is required.</md-error>
<p *ngIf="stopDate.errors.required">The stop date is required.</p> <md-error *ngIf="day.errors?.min">The day must be greater than 0.</md-error>
</div> <md-error *ngIf="day.errors?.max">The day must be less than or equal to 31.</md-error>
</div> </md-form-field>
</div> </md-list-item>
<div class="form-group row"> <md-list-item>
<label class="col-sm-4 control-label" for="day">Jour</label> <md-form-field>
<input mdInput formControlName="frequency"
type="number" placeholder="Frequency">
<div class="col-sm-8" <md-error *ngIf="frequency.errors?.required">The frequency is required.</md-error>
[class.has-danger]="day.errors"> <md-error *ngIf="frequency.errors?.min">The frequency must be positive.</md-error>
<input class="form-control" </md-form-field>
id="day" formControlName="day" </md-list-item>
type="number" placeholder="Day">
<div class="help-block text-danger" *ngIf="day.errors"> <md-list-item>
<p *ngIf="day.errors.required">The day is required.</p> <md-form-field>
<p *ngIf="day.errors.min">The day must be greater than 0.</p> <input mdInput formControlName="label" placeholder="Label">
<p *ngIf="day.errors.max">The day must be less than or equal to 31.</p>
</div>
</div>
</div>
<div class="form-group row"> <md-error *ngIf="label.errors?.required">The label is required.</md-error>
<label class="col-sm-4 control-label" for="frequency">Fréquence</label> </md-form-field>
</md-list-item>
<div class="col-sm-8" <md-list-item>
[class.has-danger]="frequency.errors"> <md-form-field>
<input class="form-control" <input mdInput formControlName="value" type="number" placeholder="Value">
id="frequency" formControlName="frequency"
type="number" placeholder="Frequency">
<div class="help-block text-danger" *ngIf="frequency.errors"> <md-error *ngIf="value.errors?.required">The value is required.</md-error>
<p *ngIf="frequency.errors.required">The frequency is required.</p> </md-form-field>
<p *ngIf="frequency.errors.min">The frequency must be positive.</p> </md-list-item>
</div>
</div>
</div>
<div class="form-group row"> <md-list-item>
<label class="col-sm-4 control-label" for="label">Label</label> <md-form-field>
<input mdInput formControlName="category"
placeholder="Category">
<div class="col-sm-8" <md-error *ngIf="category.errors?.required">The category is required.</md-error>
[class.has-danger]="label.errors"> </md-form-field>
<input class="form-control" </md-list-item>
id="label" formControlName="label" </md-list>
placeholder="Label">
<div class="help-block text-danger" *ngIf="label.errors">
<p *ngIf="label.errors.required">The label is required.</p>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 control-label" for="value">Montant</label>
<div class="col-sm-8"
[class.has-danger]="value.errors">
<input class="form-control"
id="value" formControlName="value"
type="number" placeholder="Value">
<div class="help-block text-danger" *ngIf="value.errors">
<p *ngIf="value.errors.required">The value is required.</p>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 control-label" for="category">Catégorie</label>
<div class="col-sm-8"
[class.has-danger]="category.errors">
<input class="form-control"
id="category" formControlName="category"
placeholder="Category">
<div class="help-block text-danger" *ngIf="category.errors">
<p *ngIf="category.errors.required">The category is required.</p>
</div>
</div>
</div>
</form> </form>
` `
}) })