1
1
@if (Auth:: check () )
2
2
@if (Auth:: user ()-> id == $recipe -> user -> id )
3
3
<br />
4
- {{ Form:: open ([' route' => ' ingredients.store' , ' files' => true ]) } }
4
+ {{ Form:: open (array (
5
+ ' route' => ' ingredients.store' ,
6
+ ' id' => ' form-add-ingredient' ,
7
+ ' class' => ' no-print'
8
+ ))
9
+ } }
5
10
<div class =" row" >
6
11
<div class =" col-sm-4" >
7
12
<!-- Name -->
8
13
@if ( $errors -> first (' name' ) )
9
14
<div class = " form-group has-error" >
10
15
{{ Form:: text (' name' , ' ' ,array (
11
- ' class' => " form-control input-sm" ,
12
- ' placeholder' => " Name" )) } }
16
+ ' id' => ' name' ,
17
+ ' class' => " form-control input-sm" ,
18
+ ' placeholder' => " Name" ))
19
+ } }
13
20
<p class =" text-danger" role =" alert" >{{ $errors -> first (' name' )} } </p >
14
21
</div >
15
22
@else
16
23
<div class = " form-group" >
17
24
{{ Form:: text (' name' , ' ' ,array (
18
- ' class' => " form-control input-sm" ,
19
- ' placeholder' => " Name" )) } }
25
+ ' id' => ' name' ,
26
+ ' class' => " form-control input-sm" ,
27
+ ' placeholder' => " Name" ))
28
+ } }
20
29
</div >
21
30
@endif
22
31
</div >
25
34
@if ( $errors -> first (' quantity' ) )
26
35
<div class = " form-group has-error" >
27
36
{{ Form:: number (' quantity' , ' ' ,array (
28
- ' class' => " form-control input-sm" ,
29
- ' placeholder' => " Quantity" )) } }
37
+ ' id' => ' quantity' ,
38
+ ' class' => " form-control input-sm" ,
39
+ ' placeholder' => " Quantity" ))
40
+ } }
30
41
<p class =" text-danger" role =" alert" >{{ $errors -> first (' quantity' )} } </p >
31
42
</div >
32
43
@else
33
44
<div class = " form-group" >
34
45
{{ Form:: number (' quantity' , ' ' ,array (
35
- ' class' => " form-control input-sm" ,
36
- ' placeholder' => " Quantity" )) } }
46
+ ' id' => ' quantity' ,
47
+ ' class' => " form-control input-sm" ,
48
+ ' placeholder' => " Quantity" ))
49
+ } }
37
50
</div >
38
51
@endif
39
52
</div >
42
55
@if ( $errors -> first (' unit' ) )
43
56
<div class = " form-group has-error" >
44
57
{{ Form:: text (' unit' , ' ' ,array (
45
- ' class' => " form-control input-sm" ,
46
- ' placeholder' => " Unit" )) } }
58
+ ' id' => ' unit' ,
59
+ ' class' => " form-control input-sm" ,
60
+ ' placeholder' => " Unit" ))
61
+ } }
47
62
<p class =" text-danger" role =" alert" >{{ $errors -> first (' unit' )} } </p >
48
63
</div >
49
64
@else
50
65
<div class = " form-group" >
51
66
{{ Form:: text (' unit' , ' ' ,array (
52
- ' class' => " form-control input-sm" ,
53
- ' placeholder' => " Unit" )) } }
67
+ ' id' => ' unit' ,
68
+ ' class' => " form-control input-sm" ,
69
+ ' placeholder' => " Unit" ))
70
+ } }
54
71
</div >
55
72
@endif
56
73
</div >
57
74
</div >
58
75
{{ Form:: hidden (' id' , $recipe -> id ) } }
59
- {{ Form:: submit (' Add ingredient' , array (' class' => " btn btn-primary btn-sm btn-block" )) } }
76
+ @if (isset ($error ) )
77
+ {{ Form:: submit (' Add ingredient' , array (
78
+ ' id' => " btn-add-ingredient" ,
79
+ ' class' => " btn btn-danger btn-sm btn-block"
80
+ )) } }
81
+ @else
82
+ {{ Form:: submit (' Add ingredient' , array (
83
+ ' id' => " btn-add-ingredient" ,
84
+ ' class' => " btn btn-info btn-sm btn-block" ))
85
+ } }
86
+ @endif
60
87
{{ Form:: close () } }
88
+ <script src =" /js/recipes/ingredient.js" ></script >
61
89
@endif
62
90
@endif
0 commit comments