Skip to content

Commit 42c1c83

Browse files
authored
Merge pull request #105 from DiyorMarket/Mechanic-fix-create-page
fix-create-page
2 parents 84230ae + 50c59c1 commit 42c1c83

File tree

2 files changed

+42
-17
lines changed

2 files changed

+42
-17
lines changed

CheckDrive.Web/CheckDrive.Web/Controllers/DispatcherReviewsController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public async Task<IActionResult> Index(int? pagenumber, string? searchString, Da
7171
return View();
7272
}
7373

74-
public async Task<IActionResult> PersonalIndex(int? pagenumber)
74+
public async Task<IActionResult> PersonalIndex(int? pagenumber, string? searchString)
7575
{
76-
var reviewsResponse = await _dispatcherReviewDataStore.GetDispatcherReviews(pagenumber, null, null, 5);
76+
var reviewsResponse = await _dispatcherReviewDataStore.GetDispatcherReviews(pagenumber, searchString, null, 5);
7777

7878
ViewBag.PageSize = reviewsResponse.PageSize;
7979
ViewBag.PageCount = reviewsResponse.TotalPages;

CheckDrive.Web/CheckDrive.Web/Views/MechanicHandovers/Create.cshtml

+40-15
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111

1212
<form id="mechanicHandoverForm" asp-action="Create" method="post">
1313
<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">
1915
<label asp-for="DriverId" class="control-label mt-2">Haydovchi</label>
2016
@if (ViewBag.SelectedDriverId != null && ViewBag.SelectedDriverId != 0)
2117
{
@@ -38,10 +34,10 @@
3834
}
3935
}
4036
</div>
41-
<div class="form-group w-50">
37+
<div class="form-group w-50 mt-3">
4238
<input type="text" asp-for="MechanicId" class="form-control border border-dark d-none" />
4339
</div>
44-
<div class="form-group w-50">
40+
<div class="form-group w-50 mt-3">
4541
<label asp-for="CarId" class="control-label mt-2">Mashina</label>
4642
@if (ViewBag.Cars == null || !((IEnumerable<SelectListItem>)ViewBag.Cars.Items).Any())
4743
{
@@ -54,18 +50,22 @@
5450
<select asp-for="CarId" class="form-control border border-dark" asp-items="@ViewBag.Cars"></select>
5551
}
5652
</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">
5858
<label asp-for="Distance" class="control-label mt-2">Qabul qilish masofasi</label>
5959
<input asp-for="Distance" class="form-control" type="number" min="0" step="1" />
6060
<span asp-validation-for="Distance" class="text-danger"></span>
6161
</div>
6262

63-
<div class="form-group w-50">
63+
<div class="form-group w-50 mt-3">
6464
<label asp-for="Comments" class="control-label mt-2">Izoh</label>
6565
<textarea asp-for="Comments" class="form-control" rows="4"></textarea>
6666
</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">
6969
<i class="fa-solid fa-arrow-left-long"></i> Orqaga
7070
</a>
7171
@{
@@ -90,11 +90,25 @@
9090
<script>
9191
document.addEventListener('DOMContentLoaded', function () {
9292
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+
93109
form.addEventListener('submit', function (event) {
94110
var distance = document.getElementById('Distance').value;
95-
var isGivenInput = document.getElementById('flexSwitchCheckDefault');
96-
var isGiven = isGivenInput.checked;
97-
111+
var isGiven = checkbox.checked;
98112
var distanceValue = Number(distance);
99113
100114
if (distanceValue === 0 && isGiven) {
@@ -107,4 +121,15 @@
107121
});
108122
});
109123
</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

Comments
 (0)