Compare commits
3 Commits
45d11a8a0e
...
898c0ba2c6
Author | SHA1 | Date |
---|---|---|
|
898c0ba2c6 | 1 year ago |
|
098734c5cf | 1 year ago |
|
7b1bdfda5a | 1 year ago |
@ -1,25 +1,44 @@
|
|||||||
<form [formGroup]="createForm" (ngSubmit)="onSubmit()">
|
<form [formGroup]="createForm" (ngSubmit)="onSubmit()">
|
||||||
<div>
|
<div>
|
||||||
<label for="name">Nom</label>
|
<mat-form-field>
|
||||||
<input id="name" type="text" formControlName="name" required>
|
<label for="name">Nom</label>
|
||||||
|
<input matInput id="name" type="text" formControlName="name" required>
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="description">Description</label>
|
<mat-form-field>
|
||||||
<textarea id="description" type="text" formControlName="description" required></textarea>
|
<label for="description">Description</label>
|
||||||
|
<textarea matInput id="description" type="text" formControlName="description" required></textarea>
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="description">Ingrédients</label>
|
<label for="description">Ingrédients</label>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Ingrédients</mat-label>
|
||||||
|
<mat-select matInput id="selectedIngredient" formControlName="selectedIngredient">
|
||||||
|
@for (ingredient of ingredients; track ingredient.id) {
|
||||||
|
<mat-option value="{{ingredient.id}}">{{ ingredient.name }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<button type="button" (click)="onAddIngredient()">Add</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
@for (ingredient of ingredientEntries; track ingredient.idIngredient) {
|
@for (ingredient of ingredientEntries; track ingredient.idIngredient) {
|
||||||
<li>#{{ ingredient.idIngredient }} <input [(ngModel)]="ingredient.quantity" type="number" [ngModelOptions]="{standalone: true}"></li>
|
<li>
|
||||||
|
{{ getIngredient(ingredient.idIngredient).name }}
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput [(ngModel)]="ingredient.quantity" type="number" [ngModelOptions]="{standalone: true}">
|
||||||
|
</mat-form-field>
|
||||||
|
</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
<select id="selectedIngredient" formControlName="selectedIngredient">
|
|
||||||
@for (ingredient of ingredients; track ingredient.id) {
|
|
||||||
<option [ngValue]="ingredient.id">{{ ingredient.name }}</option>
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
<button type="button" (click)="onAddIngredient()">Add</button>
|
|
||||||
</div>
|
</div>
|
||||||
<button class="button" type="submit">Ajouter</button>
|
|
||||||
|
<button mat-stroked-button type="submit">SUBMIT</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,4 +1,39 @@
|
|||||||
<p>{{recipe.id}}</p>
|
<style>
|
||||||
<p>{{recipe.name}}</p>
|
.container {
|
||||||
<p>{{recipe.description}}</p>
|
background-color: #fff;
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 300px 600px;
|
||||||
|
}
|
||||||
|
.container img {
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container_text {
|
||||||
|
padding: 40px 40px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<img ng-if="recipe.image" src="https://placehold.co/200x200" alt={{recipe.name}}/>
|
||||||
|
|
||||||
|
<div class="container_text">
|
||||||
|
|
||||||
|
<h1>{{recipe.name}}</h1>
|
||||||
|
<p>
|
||||||
|
{{recipe.description}}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Ingredients</h3>
|
||||||
|
<p>
|
||||||
|
<li *ngFor="let ingredient of recipe.ingredients">
|
||||||
|
{{ this.recipes.getIngredientById(ingredient.idIngredient)?.name }}: {{ ingredient.quantity }}g
|
||||||
|
</li>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in new issue