11
11
12
12
<form id =" mechanicHandoverForm" asp-action =" Create" method =" post" >
13
13
<div asp-validation-summary =" ModelOnly" class =" text-danger" ></div >
14
- <div class =" form-check form-switch" >
15
- <input asp-for =" IsHanded" class =" form-check-input" type =" checkbox" role =" switch" id =" flexSwitchCheckDefault" >
16
- <label asp-for =" IsHanded" class =" form-check-label" for =" flexSwitchCheckDefault" >Topshirish</label >
17
- </div >
18
- <div class =" form-group w-50" >
14
+ <div class =" form-group w-50 mt-3" >
19
15
<label asp-for =" DriverId" class =" control-label mt-2" >Haydovchi</label >
20
16
@if (ViewBag .SelectedDriverId != null && ViewBag .SelectedDriverId != 0 )
21
17
{
38
34
}
39
35
}
40
36
</div >
41
- <div class =" form-group w-50" >
37
+ <div class =" form-group w-50 mt-3 " >
42
38
<input type =" text" asp-for =" MechanicId" class =" form-control border border-dark d-none" />
43
39
</div >
44
- <div class =" form-group w-50" >
40
+ <div class =" form-group w-50 mt-3 " >
45
41
<label asp-for =" CarId" class =" control-label mt-2" >Mashina</label >
46
42
@if (ViewBag .Cars == null || ! ((IEnumerable <SelectListItem >)ViewBag .Cars .Items ).Any ())
47
43
{
54
50
<select asp-for =" CarId" class =" form-control border border-dark" asp-items =" @ViewBag.Cars" ></select >
55
51
}
56
52
</div >
57
- <div class =" form-group w-50" >
53
+ <div class =" form-check form-switch mt-3" >
54
+ <input asp-for =" IsHanded" class =" form-check-input" type =" checkbox" role =" switch" id =" flexSwitchCheckDefault" >
55
+ <label asp-for =" IsHanded" class =" form-check-label" for =" flexSwitchCheckDefault" >Topshirish</label >
56
+ </div >
57
+ <div class =" form-group w-50 mt-3" >
58
58
<label asp-for =" Distance" class =" control-label mt-2" >Qabul qilish masofasi</label >
59
59
<input asp-for =" Distance" class =" form-control" type =" number" min =" 0" step =" 1" />
60
60
<span asp-validation-for =" Distance" class =" text-danger" ></span >
61
61
</div >
62
62
63
- <div class =" form-group w-50" >
63
+ <div class =" form-group w-50 mt-3 " >
64
64
<label asp-for =" Comments" class =" control-label mt-2" >Izoh</label >
65
65
<textarea asp-for =" Comments" class =" form-control" rows =" 4" ></textarea >
66
66
</div >
67
- <div class =" form-group mt-3 w-50" >
68
- <a asp-action =" PersonalIndex" class =" btn btn-info" >
67
+ <div class =" form-group mt-3 w-50 mt-3 " >
68
+ <a asp-action =" PersonalIndex" class =" btn btn-outline- info" >
69
69
<i class =" fa-solid fa-arrow-left-long" ></i > Orqaga
70
70
</a >
71
71
@{
90
90
<script >
91
91
document .addEventListener (' DOMContentLoaded' , function () {
92
92
var form = document .getElementById (' mechanicHandoverForm' );
93
+ var checkbox = document .getElementById (' flexSwitchCheckDefault' );
94
+ var checkboxLabel = document .querySelector (' label[for="flexSwitchCheckDefault"]' );
95
+
96
+ function toggleCheckboxHighlight () {
97
+ if (! checkbox .checked ) {
98
+ checkbox .classList .add (' border-danger' );
99
+ checkboxLabel .classList .add (' text-danger' );
100
+ } else {
101
+ checkbox .classList .remove (' border-danger' );
102
+ checkboxLabel .classList .remove (' text-danger' );
103
+ }
104
+ }
105
+
106
+ toggleCheckboxHighlight (); // Initial check
107
+ checkbox .addEventListener (' change' , toggleCheckboxHighlight);
108
+
93
109
form .addEventListener (' submit' , function (event ) {
94
110
var distance = document .getElementById (' Distance' ).value ;
95
- var isGivenInput = document .getElementById (' flexSwitchCheckDefault' );
96
- var isGiven = isGivenInput .checked ;
97
-
111
+ var isGiven = checkbox .checked ;
98
112
var distanceValue = Number (distance);
99
113
100
114
if (distanceValue === 0 && isGiven) {
107
121
});
108
122
});
109
123
</script >
110
- }
124
+ }
125
+
126
+ <style >
127
+ .border-danger {
128
+ border-color : red !important ;
129
+ background-color : #f8d7da !important ;
130
+ }
131
+
132
+ .text-danger {
133
+ color : red !important ;
134
+ }
135
+ </style >
0 commit comments