добавлено поле Дата фактической заправки

This commit is contained in:
Anna 2026-09-16 09:56:39 +00:00
parent 6cb67d7e5f
commit 8c6a2ee305
4 changed files with 78 additions and 7 deletions

View File

@ -2,3 +2,7 @@
up to date in 422ms
Сервер запущен на порту 3000
--- run Wed Sep 16 09:56:03 AM UTC 2026 :: npm start --silent
up to date in 325ms
Сервер запущен на порту 3000

View File

@ -1 +1 @@
100
934

View File

@ -1,4 +1,60 @@
{
"fuelCards": [],
"log": []
}
"fuelCards": [
{
"date": "2026-09-16",
"driver": "Иванов",
"vehicle": "033GL02",
"liters": "20",
"amount": "208.05",
"gasStation": "PetroRatil",
"mileage": "",
"status": "использован",
"note": "",
"id": 1789552220451,
"createdAt": "2026-09-16T09:50:20.451Z"
},
{
"date": "2026-09-02",
"driver": "Петров",
"vehicle": "025HG02",
"liters": "5",
"amount": "208.05",
"gasStation": "PetroRatil",
"mileage": "-1",
"status": "использован",
"note": "",
"id": 1789552270675,
"createdAt": "2026-09-16T09:51:10.675Z"
},
{
"date": "2026-09-01",
"driver": "Сидоров",
"vehicle": "086AS02",
"liters": "10",
"amount": "208.05",
"gasStation": "PetroRatil",
"mileage": "2",
"status": "в работе",
"note": "",
"id": 1789552433036,
"createdAt": "2026-09-16T09:53:53.036Z"
}
],
"log": [
{
"when": "2026-09-16T09:50:20.451Z",
"what": "Добавлен талон: водитель: Иванов, авто: 033GL02, литраж: 20л",
"who": "user"
},
{
"when": "2026-09-16T09:51:10.675Z",
"what": "Добавлен талон: водитель: Петров, авто: 025HG02, литраж: 5л",
"who": "user"
},
{
"when": "2026-09-16T09:53:53.036Z",
"what": "Добавлен талон: водитель: Сидоров, авто: 086AS02, литраж: 10л",
"who": "user"
}
]
}

View File

@ -60,9 +60,13 @@
<input type="hidden" id="cardId">
<div class="form-grid">
<div class="kt-ai-field">
<label>Дата *</label>
<label>Дата талона *</label>
<input type="date" class="kt-ai-input" id="date" required>
</div>
<div class="kt-ai-field">
<label>Дата фактической заправки *</label>
<input type="date" class="kt-ai-input" id="fuelDate" required>
</div>
<div class="kt-ai-field">
<label>Водитель *</label>
<input type="text" class="kt-ai-input" id="driver" placeholder="ФИО водителя" required>
@ -130,7 +134,8 @@
<table id="fuelTable">
<thead>
<tr>
<th>Дата</th>
<th>Дата талона</th>
<th>Дата заправки</th>
<th>Водитель</th>
<th>Автомобиль</th>
<th>Литры</th>
@ -262,6 +267,7 @@ function showTab(name) {
}
document.getElementById('date').valueAsDate = new Date();
document.getElementById('fuelDate').valueAsDate = new Date();
async function loadFuelCards() {
try {
@ -281,6 +287,7 @@ function renderTable(cards) {
const statusClass = card.status === 'потерян' ? 'data-variant="danger"' : '';
tr.innerHTML =
'<td>' + formatDate(card.date) + '</td>' +
'<td>' + formatDate(card.fuelDate) + '</td>' +
'<td>' + escapeHtml(card.driver) + '</td>' +
'<td>' + escapeHtml(card.vehicle) + '</td>' +
'<td>' + parseFloat(card.liters).toFixed(2) + '</td>' +
@ -329,6 +336,7 @@ async function submitForm(e) {
const id = document.getElementById('cardId').value;
const card = {
date: document.getElementById('date').value,
fuelDate: document.getElementById('fuelDate').value,
driver: document.getElementById('driver').value,
vehicle: document.getElementById('vehicle').value,
liters: document.getElementById('liters').value,
@ -367,6 +375,7 @@ function resetForm() {
document.getElementById('cardId').value = '';
document.getElementById('fuelForm').reset();
document.getElementById('date').valueAsDate = new Date();
document.getElementById('fuelDate').valueAsDate = new Date();
}
async function editCard(id) {
@ -374,6 +383,7 @@ async function editCard(id) {
if (!card) return;
document.getElementById('cardId').value = card.id;
document.getElementById('date').value = card.date;
document.getElementById('fuelDate').value = card.fuelDate;
document.getElementById('driver').value = card.driver;
document.getElementById('vehicle').value = card.vehicle;
document.getElementById('liters').value = card.liters;
@ -452,9 +462,10 @@ async function loadLog() {
}
function exportToExcel() {
const head = ["Дата", "Водитель", "Автомобиль", "Литры", "Сумма", "АЗС", "Пробег", "Статус", "Примечание"];
const head = ["Дата талона", "Дата заправки", "Водитель", "Автомобиль", "Литры", "Сумма", "АЗС", "Пробег", "Статус", "Примечание"];
const body = allCards.map(r => [
r.date,
r.fuelDate,
r.driver,
r.vehicle,
r.liters,