nim_style 10
parent
e56e37a36a
commit
1355e4c971
|
|
@ -31,7 +31,7 @@
|
||||||
@csrf
|
@csrf
|
||||||
<div class="col-12 col-md-9 col-xl-9 mt-3">
|
<div class="col-12 col-md-9 col-xl-9 mt-3">
|
||||||
<div class="d-flex justify-content-center align-items-center flex-column">
|
<div class="d-flex justify-content-center align-items-center flex-column">
|
||||||
<label class="labels"><span style="width: 20px; height: 20px; background-color: #01b0e8; color: white; border-radius: 50%; padding: 5px 7px"><i class="bi bi-pen"></i></span>{{__(" Редактировать профиль")}}</label>
|
<label class="labels"><span style="width: 20px; height: 20px; background-color: #01b0e8; color: white; border-radius: 50%; padding: 5px 8px"><i class="bi bi-pen"></i></span>{{__(" Редактировать профиль")}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
<div class="col-lg-6 mb-3">
|
<div class="col-lg-6 mb-3">
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-center align-items-center flex-column mt-3">
|
<div class="d-flex justify-content-center align-items-center flex-column mt-3">
|
||||||
<label class="labels"><span style="width: 20px; height: 20px; background-color: #01b0e8; color: white; border-radius: 50%; padding: 7px 5px 3px 5px"><i class="bi bi-key"></i></span>{{__(" Сменить пароль")}}</label>
|
<label class="labels"><span style="width: 20px; height: 20px; background-color: #01b0e8; color: white; border-radius: 50%; padding: 7px 6px 3px 6px"><i class="bi bi-key"></i></span>{{__(" Сменить пароль")}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col-lg-6 mb-3">
|
<div class="col-lg-6 mb-3">
|
||||||
|
|
|
||||||
|
|
@ -26,26 +26,28 @@ class Main extends Component
|
||||||
$ended_at = Request::input('ended_at') ?? null;
|
$ended_at = Request::input('ended_at') ?? null;
|
||||||
$bodywork_filters = Request::input('bodywork_filters') ?? null;
|
$bodywork_filters = Request::input('bodywork_filters') ?? null;
|
||||||
|
|
||||||
$request = new \Illuminate\Http\Request([
|
// $request = new \Illuminate\Http\Request([
|
||||||
'started_at' => Carbon::now()->toDateString(),
|
|
||||||
'ended_at' => Carbon::now()->addDays(3)->toDateString(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$response = (new \App\Http\Controllers\MobileApiController)->getAvailableMarksList($request);
|
|
||||||
|
|
||||||
$this->params['cars'] = collect($response->getData(true))->filter(function ($item) {
|
|
||||||
return !empty($item['tariffs']);
|
|
||||||
})->values();
|
|
||||||
|
|
||||||
// $response = Http::get('https://cvm10.a7.kz/api/mobile/getAvailableMarksList', [
|
|
||||||
// 'started_at' => $started_at ?? Carbon::now()->toDateString(),
|
// 'started_at' => $started_at ?? Carbon::now()->toDateString(),
|
||||||
// 'ended_at' => $ended_at ?? Carbon::now()->addDays(3)->toDateString(),
|
// 'ended_at' => $ended_at ?? Carbon::now()->addDays(3)->toDateString(),
|
||||||
// 'class' => $class_filters ?? null,
|
// 'class' => $class_filters ?? null,
|
||||||
// 'bodywork' => $bodywork_filters ?? null,
|
// 'bodywork' => $bodywork_filters ?? null,
|
||||||
// ]);
|
// ]);
|
||||||
//
|
//
|
||||||
// $this->params['cars'] = collect($response->json())->filter(function ($item) {
|
// $response = (new \App\Http\Controllers\MobileApiController)->getAvailableMarksList($request);
|
||||||
|
//
|
||||||
|
// $this->params['cars'] = collect($response->getData(true))->filter(function ($item) {
|
||||||
// return !empty($item['tariffs']);
|
// return !empty($item['tariffs']);
|
||||||
// })->values();
|
// })->values();
|
||||||
|
|
||||||
|
$response = Http::get('https://cvm10.a7.kz/api/mobile/getAvailableMarksList', [
|
||||||
|
'started_at' => $started_at ?? Carbon::now()->toDateString(),
|
||||||
|
'ended_at' => $ended_at ?? Carbon::now()->addDays(3)->toDateString(),
|
||||||
|
'class' => $class_filters ?? null,
|
||||||
|
'bodywork' => $bodywork_filters ?? null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->params['cars'] = collect($response->json())->filter(function ($item) {
|
||||||
|
return !empty($item['tariffs']);
|
||||||
|
})->values();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@
|
||||||
<div class="row justify-content-center align-items-end">
|
<div class="row justify-content-center align-items-end">
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<label for="days" class="form-label">Срок аренды, дней <b>*</b></label>
|
<label for="days" class="form-label">Срок аренды, дней <b>*</b></label>
|
||||||
<input type="number" name="days" class="form-control" id="days" value="7" required="">
|
<input type="number" name="days" class="form-control" id="days" value="7" required="" min="1" step="1">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<div class="form-text">
|
<div class="form-text">
|
||||||
|
|
@ -347,106 +347,95 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const modal = document.getElementById('rentModal');
|
||||||
|
const pickUpDateInput = document.getElementById('pick-up-date');
|
||||||
|
const returnDateInput = document.getElementById('return-date');
|
||||||
|
const daysInput = document.getElementById('days');
|
||||||
|
|
||||||
|
const today = new Date();
|
||||||
|
const yyyy = today.getFullYear();
|
||||||
|
const mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||||
|
const dd = String(today.getDate()).padStart(2, '0');
|
||||||
|
const todayStr = `${yyyy}-${mm}-${dd}`;
|
||||||
|
pickUpDateInput.value = todayStr;
|
||||||
|
pickUpDateInput.setAttribute('min', todayStr);
|
||||||
|
|
||||||
|
daysInput.addEventListener('input', updateReturnDate);
|
||||||
|
pickUpDateInput.addEventListener('change', updateReturnDate);
|
||||||
|
|
||||||
document.querySelectorAll('.open-rent-modal').forEach(button => {
|
document.querySelectorAll('.open-rent-modal').forEach(button => {
|
||||||
button.addEventListener('click', function () {
|
button.addEventListener('click', function () {
|
||||||
const car = JSON.parse(this.getAttribute('data-car'));
|
const car = JSON.parse(this.getAttribute('data-car'));
|
||||||
modal.setAttribute('data-car', JSON.stringify(car));
|
modal.setAttribute('data-car', JSON.stringify(car));
|
||||||
|
|
||||||
document.getElementById('modalCarImage').src = this.getAttribute('data-photo');
|
document.getElementById('modalCarImage').src = this.getAttribute('data-photo');
|
||||||
document.getElementById('modalCarTitle').innerText = `${car.brand} ${car.mark} - ${car.year}`;
|
document.getElementById('modalCarTitle').innerText = `${car.brand} ${car.mark} - ${car.year}`;
|
||||||
document.getElementById('modalFuel').innerHTML = ` ${car.fuel_type}`;
|
document.getElementById('modalFuel').innerHTML = ` ${car.fuel_type}`;
|
||||||
document.getElementById('modalPeople').innerHTML = ` ${car.people} мест`;
|
document.getElementById('modalPeople').innerHTML = ` ${car.people} мест`;
|
||||||
document.getElementById('mark_id').value = car.id;
|
document.getElementById('mark_id').value = car.id;
|
||||||
|
|
||||||
const tariff1 = car.tariffs.find(t => t.min === 1)?.price ?? 0;
|
const getTariffPrice = (min) => car.tariffs.find(t => t.min === min)?.price ?? 0;
|
||||||
const tariff3 = car.tariffs.find(t => t.min === 3)?.price ?? 0;
|
|
||||||
const tariff6 = car.tariffs.find(t => t.min === 6)?.price ?? 0;
|
|
||||||
const tariff16 = car.tariffs.find(t => t.min === 16)?.price ?? 0;
|
|
||||||
|
|
||||||
document.getElementById('tariffWithMin1').innerHTML = ` ${tariff1} ₸`;
|
document.getElementById('tariffWithMin1').innerHTML = ` ${getTariffPrice(1)} ₸`;
|
||||||
document.getElementById('tariffWithMin3').innerHTML = ` ${tariff3} ₸`;
|
document.getElementById('tariffWithMin3').innerHTML = ` ${getTariffPrice(3)} ₸`;
|
||||||
document.getElementById('tariffWithMin6').innerHTML = ` ${tariff6} ₸`;
|
document.getElementById('tariffWithMin6').innerHTML = ` ${getTariffPrice(6)} ₸`;
|
||||||
document.getElementById('tariffWithMin16').innerHTML = ` ${tariff16} ₸`;
|
document.getElementById('tariffWithMin16').innerHTML = ` ${getTariffPrice(16)} ₸`;
|
||||||
document.getElementById('tariffWithMin30').innerHTML = ` ${(tariff1 * 0.6).toFixed(0)} ₸`;
|
document.getElementById('tariffWithMin30').innerHTML = ` ${(getTariffPrice(1) * 0.6).toFixed(0)} ₸`;
|
||||||
|
|
||||||
updateReturnDate();
|
updateReturnDate();
|
||||||
});
|
});
|
||||||
|
|
||||||
const modal = document.getElementById('rentModal');
|
|
||||||
const pickUpDateInput = document.getElementById('pick-up-date');
|
|
||||||
const returnDateInput = document.getElementById('return-date');
|
|
||||||
const daysInput = document.getElementById('days');
|
|
||||||
|
|
||||||
const today = new Date();
|
|
||||||
const yyyy = today.getFullYear();
|
|
||||||
const mm = String(today.getMonth() + 1).padStart(2, '0');
|
|
||||||
const dd = String(today.getDate()).padStart(2, '0');
|
|
||||||
const todayStr = `${yyyy}-${mm}-${dd}`;
|
|
||||||
|
|
||||||
pickUpDateInput.value = todayStr;
|
|
||||||
pickUpDateInput.setAttribute('min', todayStr);
|
|
||||||
|
|
||||||
function updateReturnDate() {
|
|
||||||
const pickUpDate = new Date(pickUpDateInput.value);
|
|
||||||
const rentalDays = parseInt(daysInput.value, 10);
|
|
||||||
|
|
||||||
if (!isNaN(rentalDays)) {
|
|
||||||
pickUpDate.setDate(pickUpDate.getDate() + rentalDays);
|
|
||||||
const returnYyyy = pickUpDate.getFullYear();
|
|
||||||
const returnMm = String(pickUpDate.getMonth() + 1).padStart(2, '0');
|
|
||||||
const returnDd = String(pickUpDate.getDate()).padStart(2, '0');
|
|
||||||
returnDateInput.value = `${returnYyyy}-${returnMm}-${returnDd}`;
|
|
||||||
}
|
|
||||||
calculateOther(parseInt(daysInput.value));
|
|
||||||
}
|
|
||||||
|
|
||||||
daysInput.addEventListener('input', updateReturnDate);
|
|
||||||
pickUpDateInput.addEventListener('change', updateReturnDate);
|
|
||||||
|
|
||||||
function calculateOther(days) {
|
|
||||||
let discountRate = null;
|
|
||||||
if (!days || isNaN(days)) {
|
|
||||||
days = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const car = JSON.parse(modal.getAttribute('data-car'));
|
|
||||||
|
|
||||||
const tariffs = car['tariffs'];
|
|
||||||
const baseRate = car.tariffs.find(t => t.min === 1)?.price ?? 0;
|
|
||||||
const matchedRange = tariffs.find(range => days >= range.min && days <= range.max);
|
|
||||||
|
|
||||||
const baseWith = document.getElementById('base-with');
|
|
||||||
const baseWithout = document.getElementById('base-without');
|
|
||||||
const summWithout = document.getElementById('summ-without');
|
|
||||||
const summWith = document.getElementById('sunn-with');
|
|
||||||
const total = document.getElementById('total');
|
|
||||||
|
|
||||||
|
|
||||||
if (matchedRange) {
|
|
||||||
discountRate = matchedRange.price;
|
|
||||||
} else if (days > 30) {
|
|
||||||
discountRate = baseWithout * 0.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
const totalWithoutDiscount = baseRate * days;
|
|
||||||
const totalWithDiscount = discountRate * days;
|
|
||||||
|
|
||||||
baseWith.textContent = formatNumberWithSpaces(discountRate) + ' ₸';
|
|
||||||
baseWithout.textContent = formatNumberWithSpaces(baseRate) + ' ₸';
|
|
||||||
summWithout.textContent = formatNumberWithSpaces(totalWithoutDiscount) + ' ₸';
|
|
||||||
summWith.textContent = formatNumberWithSpaces(totalWithDiscount) + ' ₸';
|
|
||||||
total.textContent = formatNumberWithSpaces(totalWithDiscount) + ' ₸';
|
|
||||||
if (isNaN(days) || days < 1) {
|
|
||||||
summWithout.textContent = 0 + ' ₸';
|
|
||||||
summWith.textContent = 0 + ' ₸';
|
|
||||||
total.textContent = 0 + ' ₸';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatNumberWithSpaces(number) {
|
|
||||||
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function updateReturnDate() {
|
||||||
|
const pickUpDate = new Date(pickUpDateInput.value);
|
||||||
|
const rentalDays = parseInt(daysInput.value, 10);
|
||||||
|
|
||||||
|
if (!isNaN(rentalDays)) {
|
||||||
|
pickUpDate.setDate(pickUpDate.getDate() + rentalDays);
|
||||||
|
const returnYyyy = pickUpDate.getFullYear();
|
||||||
|
const returnMm = String(pickUpDate.getMonth() + 1).padStart(2, '0');
|
||||||
|
const returnDd = String(pickUpDate.getDate()).padStart(2, '0');
|
||||||
|
returnDateInput.value = `${returnYyyy}-${returnMm}-${returnDd}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateOther(rentalDays);
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateOther(days) {
|
||||||
|
if (!days || isNaN(days) || days < 1) {
|
||||||
|
updatePrices(0, 0, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const car = JSON.parse(modal.getAttribute('data-car'));
|
||||||
|
const tariffs = car.tariffs;
|
||||||
|
|
||||||
|
const baseRate = tariffs.find(t => t.min === 1)?.price ?? 0;
|
||||||
|
const matchedRange = tariffs.find(t => days >= t.min && days <= t.max);
|
||||||
|
const discountRate = matchedRange?.price ?? (days > 30 ? baseRate * 0.6 : baseRate);
|
||||||
|
|
||||||
|
const totalWithoutDiscount = baseRate * days;
|
||||||
|
const totalWithDiscount = discountRate * days;
|
||||||
|
|
||||||
|
updatePrices(baseRate, discountRate, totalWithoutDiscount, totalWithDiscount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePrices(baseRate, discountRate, totalWithout, totalWith) {
|
||||||
|
const format = (num) => formatNumberWithSpaces(Math.round(num)) + ' ₸';
|
||||||
|
|
||||||
|
document.getElementById('base-with').textContent = format(discountRate);
|
||||||
|
document.getElementById('base-without').textContent = format(baseRate);
|
||||||
|
document.getElementById('summ-without').textContent = format(totalWithout);
|
||||||
|
document.getElementById('sunn-with').textContent = format(totalWith);
|
||||||
|
document.getElementById('total').textContent = format(totalWith);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatNumberWithSpaces(number) {
|
||||||
|
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelectorAll('input[name="class_filters[]"]').forEach(checkbox => {
|
document.querySelectorAll('input[name="class_filters[]"]').forEach(checkbox => {
|
||||||
checkbox.addEventListener('click', function () {
|
checkbox.addEventListener('click', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -302,5 +302,5 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.bi::before {
|
.bi::before {
|
||||||
line-height: 1.4;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,3 +51,13 @@ textarea.form-control, textarea{
|
||||||
--bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='white'/%3e%3c/svg%3e");
|
--bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='white'/%3e%3c/svg%3e");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.list-group-item {
|
||||||
|
border-top-width: 0;
|
||||||
|
padding: 0.4rem;
|
||||||
|
border-bottom: 1px $border-color solid;
|
||||||
|
transition: .3s all ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(var(--bs-emphasis-color-rgb), 0.075);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,3 +21,4 @@ $secondary-bg-color: rgba(66, 75, 75, 0.2);
|
||||||
$outline-text-color: #00465C;
|
$outline-text-color: #00465C;
|
||||||
$white: white;
|
$white: white;
|
||||||
$outine-border: #007BA2;
|
$outine-border: #007BA2;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue