Skip to content

Commit 77a13f0

Browse files
authored
Merge pull request #107 from DiyorMarket/Add-margin-to-Create-pages
Add-margin-to-create-pages
2 parents f23b244 + 6ac36ab commit 77a13f0

File tree

5 files changed

+197
-114
lines changed

5 files changed

+197
-114
lines changed

CheckDrive.Web/CheckDrive.Web/Controllers/MechanicAcceptancesController.cs

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public async Task<IActionResult> Create([Bind("IsAccepted,Comments,MechanicId,Di
175175
}
176176

177177
mechanicAcceptanceForCreateDto.Date = DateTime.Now;
178+
mechanicAcceptanceForCreateDto.Status = mechanicAcceptanceForCreateDto.IsAccepted ? StatusForDto.Pending : StatusForDto.Rejected;
178179
await _mechanicAcceptanceDataStore.CreateMechanicAcceptanceAsync(mechanicAcceptanceForCreateDto);
179180
return RedirectToAction(nameof(PersonalIndex));
180181
}

CheckDrive.Web/CheckDrive.Web/Views/DispatcherReviews/Create.cshtml

+10-20
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,41 @@
1212
<form asp-action="Create" method="post" id="createForm">
1313
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
1414
<div class="form-group w-50">
15-
<label asp-for="DistanceCovered" class="control-label"></label>
15+
<label asp-for="DistanceCovered" class="control-label">Bosib o`tilgan masofa</label>
1616
<input asp-for="DistanceCovered" class="form-control" />
1717
<span asp-validation-for="DistanceCovered" class="text-danger"></span>
1818
</div>
1919
<div class="form-group w-50">
20-
<label asp-for="FuelSpended" class="control-label"></label>
20+
<label asp-for="FuelSpended" class="control-label">Sariflangan yoqilg`i</label>
2121
<input asp-for="FuelSpended" class="form-control" id="FuelSpended" />
2222
<span asp-validation-for="FuelSpended" class="text-danger" id="fuelSpendedError"></span>
2323
</div>
2424
<div class="form-group w-50">
25-
<label asp-for="Date" class="control-label"></label>
26-
<input asp-for="Date" class="form-control" readonly />
2725
<input asp-for="Date" type="hidden" id="hiddenDate" />
2826
</div>
2927
<div class="form-group w-50">
30-
<label asp-for="DispatcherId" class="control-label"></label>
31-
<input asp-for="DispatcherId" class="form-control" readonly />
28+
<input asp-for="DispatcherId" type="hidden" />
3229
</div>
3330
<div class="form-group w-50">
34-
<label asp-for="OperatorId" class="control-label"></label>
35-
<input asp-for="OperatorId" class="form-control" readonly />
31+
<input asp-for="OperatorId" type="hidden" />
3632
</div>
3733
<div class="form-group w-50">
38-
<label asp-for="MechanicId" class="control-label"></label>
39-
<input asp-for="MechanicId" class="form-control" readonly />
34+
<input asp-for="MechanicId" type="hidden" />
4035
</div>
4136
<div class="form-group w-50">
42-
<label asp-for="DriverId" class="control-label"></label>
43-
<input asp-for="DriverId" class="form-control" readonly />
37+
<input asp-for="DriverId" type="hidden" />
4438
</div>
4539
<div class="form-group w-50">
46-
<label asp-for="CarId" class="control-label"></label>
47-
<input asp-for="CarId" class="form-control" readonly />
40+
<input asp-for="CarId" type="hidden" />
4841
</div>
4942
<div class="form-group w-50">
50-
<label asp-for="MechanicHandoverId" class="control-label"></label>
51-
<input asp-for="MechanicHandoverId" class="form-control" readonly />
43+
<input asp-for="MechanicHandoverId" type="hidden" />
5244
</div>
5345
<div class="form-group w-50">
54-
<label asp-for="MechanicAcceptanceId" class="control-label"></label>
55-
<input asp-for="MechanicAcceptanceId" class="form-control" readonly />
46+
<input asp-for="MechanicAcceptanceId" type="hidden" />
5647
</div>
5748
<div class="form-group w-50">
58-
<label asp-for="OperatorReviewId" class="control-label"></label>
59-
<input asp-for="OperatorReviewId" class="form-control" readonly />
49+
<input asp-for="OperatorReviewId" type="hidden" />
6050
</div>
6151
<div class="form-group mt-3 w-50">
6252
<a asp-action="PersonalIndex" class="btn btn-outline-info">

CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/Create.cshtml

+48-17
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212

1313
<form asp-action="Create" method="post">
1414
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
15-
<div class="form-check form-switch">
16-
<input asp-for="IsAccepted" class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
17-
<label asp-for="IsAccepted" class="form-check-label" for="flexSwitchCheckDefault">Qabul qilish</label>
18-
</div>
19-
<div class="form-group w-50">
15+
<div class="form-group w-50 mt-2">
2016
<label asp-for="DriverId" class="control-label mt-2">Haydovchi</label>
2117
@if (ViewBag.SelectedDriverId != null && ViewBag.SelectedDriverId != 0)
2218
{
@@ -40,27 +36,31 @@
4036
<div class="form-group w-50">
4137
<input type="text" asp-for="MechanicId" class="form-control border border-dark d-none" />
4238
</div>
43-
<div class="form-group w-50">
39+
<div class="form-group w-50 mt-2">
4440
<label asp-for="CarId" class="control-label mt-2">Mashina</label>
4541
@if (ViewBag.Cars is SelectList)
4642
{
47-
<select asp-for="CarId" class="form-control border border-dark" asp-items="@(ViewBag.Cars as SelectList)" value="@ViewBag.SelectedCarId" ></select>
43+
<select asp-for="CarId" class="form-control border border-dark" asp-items="@(ViewBag.Cars as SelectList)" value="@ViewBag.SelectedCarId"></select>
4844
}
4945
else
5046
{
51-
<input type="text" class="form-control" value="@ViewBag.Cars" />
52-
<input type="hidden" asp-for="CarId" value="@ViewBag.SelectedCarId" />
47+
<input type="text" class="form-control" value="@ViewBag.Cars" />
48+
<input type="hidden" asp-for="CarId" value="@ViewBag.SelectedCarId" />
5349
}
5450
</div>
55-
<div class="form-group w-50">
51+
<div class="form-check form-switch mt-3">
52+
<input asp-for="IsAccepted" class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
53+
<label asp-for="IsAccepted" class="form-check-label" for="flexSwitchCheckDefault">Qabul qilish</label>
54+
</div>
55+
<div class="form-group w-50 mt-2">
5656
<label asp-for="Distance" class="control-label mt-2">Qabul qilish masofasi</label>
5757
<input asp-for="Distance" class="form-control" type="number" min="0" step="1" />
5858
</div>
59-
<div class="form-group w-50">
59+
<div class="form-group w-50 mt-2">
6060
<label asp-for="Comments" class="control-label mt-2">Izoh</label>
6161
<textarea asp-for="Comments" class="form-control" rows="4"></textarea>
6262
</div>
63-
<div class="form-group mt-3 w-50">
63+
<div class="form-group mt-3 w-50 mt-2">
6464
<a asp-action="PersonalIndex" class="btn btn-outline-info">
6565
<i class="fa-solid fa-arrow-left-long"></i> Orqaga
6666
</a>
@@ -74,10 +74,41 @@
7474

7575
@section Scripts {
7676
<script type="text/javascript">
77-
var shouldDisable = @ViewBag.SelectedDriverId != null ? "true" : "false";
78-
if (shouldDisable === "true") {
79-
document.getElementById("driverIdDropdown").setAttribute("disabled", "disabled");
80-
document.getElementById("carIdDropdown").setAttribute("disabled", "disabled");
81-
}
77+
document.addEventListener('DOMContentLoaded', function () {
78+
var checkbox = document.getElementById('flexSwitchCheckDefault');
79+
var checkboxLabel = document.querySelector('label[for="flexSwitchCheckDefault"]');
80+
81+
function toggleCheckboxHighlight() {
82+
if (!checkbox.checked) {
83+
checkbox.classList.add('border-danger');
84+
checkboxLabel.classList.add('text-danger');
85+
} else {
86+
checkbox.classList.remove('border-danger');
87+
checkboxLabel.classList.remove('text-danger');
88+
}
89+
}
90+
91+
// Initialize the highlight on page load
92+
toggleCheckboxHighlight();
93+
94+
// Add change event listener to toggle the highlight
95+
checkbox.addEventListener('change', toggleCheckboxHighlight);
96+
97+
var shouldDisable = '@ViewBag.SelectedDriverId' != '' ? "true" : "false";
98+
if (shouldDisable === "true") {
99+
document.getElementById("driverIdDropdown").setAttribute("disabled", "disabled");
100+
document.getElementById("carIdDropdown").setAttribute("disabled", "disabled");
101+
}
102+
});
82103
</script>
83104
}
105+
106+
<style>
107+
.border-danger {
108+
border: 2px solid red !important;
109+
}
110+
111+
.text-danger {
112+
color: red !important;
113+
}
114+
</style>

CheckDrive.Web/CheckDrive.Web/Views/MechanicAcceptances/PersonalIndex.cshtml

+35
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<th scope="col" style="width: 10%">Qabul qilish masofasi</th>
5353
<th scope="col" style="width: 15%">Izoh</th>
5454
<th scope="col" style="width: 10%">Sana</th>
55+
<th scope="col" style="width: 10%">Holati</th>
5556

5657
</tr>
5758
</thead>
@@ -89,6 +90,32 @@
8990
<td>@item.Distance</td>
9091
<td>@item.Comments</td>
9192
<td>@item.Date?.ToString("dd/MM/yyyy")</td>
93+
<td class="text-center">
94+
@if (item.Status == CheckDrive.ApiContracts.StatusForDto.Pending)
95+
{
96+
<span class="badge bg-pending shadow">Kutilmoqda</span>
97+
}
98+
else if (item.Status == CheckDrive.ApiContracts.StatusForDto.Unassigned)
99+
{
100+
<span class="badge bg-unassigned shadow">Yaratilmagan</span>
101+
}
102+
else if (item.Status == CheckDrive.ApiContracts.StatusForDto.Completed)
103+
{
104+
<span class="badge bg-success shadow">Yakunlangan</span>
105+
}
106+
else if (item.Status == CheckDrive.ApiContracts.StatusForDto.RejectedByDriver)
107+
{
108+
<span class="badge bg-danger shadow">Haydovchi tomonidan rad etilgan</span>
109+
}
110+
else if (item.Status == CheckDrive.ApiContracts.StatusForDto.Rejected)
111+
{
112+
<span class="badge bg-danger shadow">Rad etilgan</span>
113+
}
114+
else
115+
{
116+
<span class="badge bg-empty shadow">No`malum holat</span>
117+
}
118+
</td>
92119
</tr>
93120
}
94121
}
@@ -147,6 +174,14 @@
147174
border-radius: 5px;
148175
}
149176
177+
.bg-pending {
178+
background-color: orange;
179+
}
180+
181+
.bg-unassigned {
182+
background-color: slategray;
183+
}
184+
150185
.bg-success {
151186
background-color: #28a745;
152187
}

0 commit comments

Comments
 (0)