Compare commits
225 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27126638be | ||
|
|
8c3a001930 | ||
|
|
2b2f181888 | ||
|
|
66557fa126 | ||
|
|
7c00951d74 | ||
|
|
1087ed56ce | ||
|
|
dd2cfd90b1 | ||
|
|
cc43d45c9c | ||
|
|
dba51f171d | ||
|
|
0bbf9f783f | ||
|
|
a52ac6a41b | ||
|
|
a542c91dc3 | ||
|
|
6bcbb0cc86 | ||
|
|
7a78d51c79 | ||
|
|
3c2715840e | ||
|
|
dfbd90aaf4 | ||
|
|
2b3a4ce8ce | ||
|
|
135292f2b4 | ||
|
|
499c697b0b | ||
|
|
fb74f01609 | ||
|
|
6ab2216742 | ||
|
|
7c97aa70a0 | ||
|
|
ff255e8293 | ||
|
|
57dc976a9f | ||
|
|
13361241e8 | ||
|
|
332af9a04a | ||
|
|
961c60f936 | ||
|
|
34483886be | ||
|
|
548989f9ae | ||
|
|
83a59aff37 | ||
|
|
60f28b16e7 | ||
|
|
9cb8bbd5b7 | ||
|
|
f7c95e9b36 | ||
|
|
cd37eedd15 | ||
|
|
7d11c4003f | ||
|
|
7d9b67a04d | ||
|
|
aba178a324 | ||
|
|
4ecdaf5225 | ||
|
|
c0bc9f7a14 | ||
|
|
094d96d880 | ||
|
|
a8fad6f160 | ||
|
|
6befd5ca76 | ||
|
|
046812ff27 | ||
|
|
db1778a749 | ||
|
|
f27fa1625c | ||
|
|
39a9d5f95b | ||
|
|
234d7163fc | ||
|
|
6f64cc9996 | ||
|
|
58e3b49bdf | ||
|
|
ca2dc1e1e0 | ||
|
|
c65dca4c58 | ||
|
|
82c2351b00 | ||
|
|
f31ca163e5 | ||
|
|
351db5de95 | ||
|
|
41164516f7 | ||
|
|
29a3c815fc | ||
|
|
1768063e57 | ||
|
|
35ce5603e5 | ||
|
|
19e38f9885 | ||
|
|
c55528b8a0 | ||
|
|
1c00f31312 | ||
|
|
8e66530544 | ||
|
|
7bdd3d902b | ||
|
|
abb44608fe | ||
|
|
0b1e3f4be8 | ||
|
|
156eb8ec27 | ||
|
|
472dcac590 | ||
|
|
b4d86f415c | ||
|
|
812e768f93 | ||
|
|
a08d4798e1 | ||
|
|
7bc08c9950 | ||
|
|
20107e3f05 | ||
|
|
ed678c36a5 | ||
|
|
f7574a9a60 | ||
|
|
e506b543e6 | ||
|
|
019a549b64 | ||
|
|
8dbc883a8c | ||
|
|
5fd918115c | ||
|
|
a11f8377fe | ||
|
|
7be19f8603 | ||
|
|
5407ebecb1 | ||
|
|
b75a1b4e6c | ||
|
|
1c28039aaf | ||
|
|
3a1836ef84 | ||
|
|
c747889f85 | ||
|
|
338a8426b2 | ||
|
|
4b1701d158 | ||
|
|
5d64a9a422 | ||
|
|
c2315db127 | ||
|
|
e40129f701 | ||
|
|
d198ad9a6b | ||
|
|
abffc5ab60 | ||
|
|
24ff9db32d | ||
|
|
07fa560344 | ||
|
|
28615d9038 | ||
|
|
d8f53e4b65 | ||
|
|
1f0cef4161 | ||
|
|
af5d72e0d0 | ||
|
|
1397e92709 | ||
|
|
a49121b1d9 | ||
|
|
ca65a6fb71 | ||
|
|
a54857c6bf | ||
|
|
2eadd05289 | ||
|
|
6eafa5e036 | ||
|
|
40f01ad100 | ||
|
|
161b36325e | ||
|
|
f9a6ddd513 | ||
|
|
e85110f8b6 | ||
|
|
76d3dba574 | ||
|
|
178b50a033 | ||
|
|
fb45aefde3 | ||
|
|
05bbc8a95b | ||
|
|
f123299dd6 | ||
|
|
7174413e2a | ||
|
|
d816f73598 | ||
|
|
b249ccdd6c | ||
|
|
4a007530a6 | ||
|
|
04ce448b23 | ||
|
|
ccd446f299 | ||
|
|
c49c8a5301 | ||
|
|
55cc2819d0 | ||
|
|
f8de7de0d6 | ||
|
|
2ea1bc2c20 | ||
|
|
90d095ea51 | ||
|
|
e1d12d0918 | ||
|
|
d9d0957040 | ||
|
|
9d73db3c51 | ||
|
|
c0f0786fd4 | ||
|
|
357eff116f | ||
|
|
32a047c522 | ||
|
|
8a237bb7ec | ||
|
|
f5b9072cc6 | ||
|
|
4e3eaa53ff | ||
|
|
4779d3f161 | ||
|
|
b0173fae94 | ||
|
|
c6ee8830a3 | ||
|
|
c2eeab5025 | ||
|
|
43fd40347f | ||
|
|
53139f9bb2 | ||
|
|
0b6033cc00 | ||
|
|
6f0115e5c5 | ||
|
|
2403adf537 | ||
|
|
f00ab897b5 | ||
|
|
093631bf6f | ||
|
|
5c2835ab76 | ||
|
|
03029981fd | ||
|
|
69b1838038 | ||
|
|
1c2f83026c | ||
|
|
d36f2c59e3 | ||
|
|
53ebec3f03 | ||
|
|
f2cbbaeb12 | ||
|
|
31c1202649 | ||
|
|
331499461a | ||
|
|
8c6dd5e343 | ||
|
|
01b1e8228d | ||
|
|
43979d6115 | ||
|
|
6a9860e202 | ||
|
|
39338e8028 | ||
|
|
d1d5351a01 | ||
|
|
c9385c7fdd | ||
|
|
afaae89af6 | ||
|
|
b9d799cd49 | ||
|
|
e47c541e08 | ||
|
|
51ff01d2cd | ||
|
|
618399cb09 | ||
|
|
b837a2e528 | ||
|
|
a1e8b8f9cc | ||
|
|
787c5da72a | ||
|
|
260703be8e | ||
|
|
053801b046 | ||
|
|
db9b1970c5 | ||
|
|
b153ef5ea5 | ||
|
|
b54809f399 | ||
|
|
f7f47c54ff | ||
|
|
92564ae527 | ||
|
|
52ada8574d | ||
|
|
013fb67943 | ||
|
|
d86298f502 | ||
|
|
5891b78be0 | ||
|
|
a9e3e44f2c | ||
|
|
0d1c7234e8 | ||
|
|
e3abe5f209 | ||
|
|
b453bfce5b | ||
|
|
147a1b03a7 | ||
|
|
3017db5f86 | ||
|
|
399d0d8058 | ||
|
|
b8c0d4ef67 | ||
|
|
918d086705 | ||
|
|
ac05acf96b | ||
|
|
e7449806c0 | ||
|
|
baab3213b5 | ||
|
|
d68e9e9589 | ||
|
|
be81f9727a | ||
|
|
04b7e7fd38 | ||
|
|
e6b50fafd2 | ||
|
|
d4896a7607 | ||
|
|
0b203709fa | ||
|
|
df5faba146 | ||
|
|
d8f8b63488 | ||
|
|
c100fc76ed | ||
|
|
c553d87600 | ||
|
|
b542bd54fb | ||
|
|
4ec11a47a1 | ||
|
|
175ce2be48 | ||
|
|
aad1655f2e | ||
|
|
85eb0b70e6 | ||
|
|
f54e12886a | ||
|
|
80ebe4c292 | ||
|
|
92b3bc3aea | ||
|
|
2cfb82c235 | ||
|
|
dd693323d7 | ||
|
|
5c8f03003e | ||
|
|
023fac2ea9 | ||
|
|
9086c26b5e | ||
|
|
0af8e99e61 | ||
|
|
4ca45dd32b | ||
|
|
127753ee86 | ||
|
|
30a9411cdd | ||
|
|
e801a4a77c | ||
|
|
d8c49995ce | ||
|
|
0c93663e51 | ||
|
|
605ac07594 | ||
|
|
9a7f2233a0 | ||
|
|
1339c427c4 | ||
|
|
dbb139dfad |
3
.env
3
.env
@@ -5,4 +5,5 @@ MailConfig__EmailFrom=""
|
|||||||
MailConfig__UseSSL="false"
|
MailConfig__UseSSL="false"
|
||||||
MailConfig__Port=587
|
MailConfig__Port=587
|
||||||
MailConfig__Username=""
|
MailConfig__Username=""
|
||||||
MailConfig__Password=""
|
MailConfig__Password=""
|
||||||
|
LOGGING__LOGLEVEL__DEFAULT=Error
|
||||||
51
.github/workflows/build-and-push-image.yml
vendored
Normal file
51
.github/workflows/build-and-push-image.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
name: Build and Push Image to Dockerhub and GHCR
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
release:
|
||||||
|
types: ["published"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: "${{ secrets.DH_USER }}"
|
||||||
|
password: "${{ secrets.DH_PASS }}"
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: "hargata"
|
||||||
|
password: "${{ secrets.GHCR_PAT }}"
|
||||||
|
|
||||||
|
- name: Docker Metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
context: workflow
|
||||||
|
images: |
|
||||||
|
hargata/lubelogger
|
||||||
|
ghcr.io/hargata/lubelogger
|
||||||
|
tags: |
|
||||||
|
type=edge,branch=main
|
||||||
|
type=ref,event=tag
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
30
.github/workflows/dockerhub-docker-image.yml
vendored
30
.github/workflows/dockerhub-docker-image.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
name: Docker Image To Docker Hub
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: "${{ secrets.DH_USER }}"
|
|
||||||
password: "${{ secrets.DH_PASS }}"
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
hargata/lubelogger:latest
|
|
||||||
31
.github/workflows/ghcr-docker-image.yml
vendored
31
.github/workflows/ghcr-docker-image.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
name: Docker Image To GHCR
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: "hargata"
|
|
||||||
password: "${{ secrets.GHCR_PAT }}"
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
ghcr.io/hargata/lubelogger:latest
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ data/cartracker.db
|
|||||||
wwwroot/documents/
|
wwwroot/documents/
|
||||||
wwwroot/temp/
|
wwwroot/temp/
|
||||||
wwwroot/imports/
|
wwwroot/imports/
|
||||||
|
wwwroot/translations/
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ namespace CarCareTracker.Controllers
|
|||||||
private readonly IReminderRecordDataAccess _reminderRecordDataAccess;
|
private readonly IReminderRecordDataAccess _reminderRecordDataAccess;
|
||||||
private readonly IUpgradeRecordDataAccess _upgradeRecordDataAccess;
|
private readonly IUpgradeRecordDataAccess _upgradeRecordDataAccess;
|
||||||
private readonly IOdometerRecordDataAccess _odometerRecordDataAccess;
|
private readonly IOdometerRecordDataAccess _odometerRecordDataAccess;
|
||||||
|
private readonly IUserAccessDataAccess _userAccessDataAccess;
|
||||||
|
private readonly IUserRecordDataAccess _userRecordDataAccess;
|
||||||
private readonly IReminderHelper _reminderHelper;
|
private readonly IReminderHelper _reminderHelper;
|
||||||
private readonly IGasHelper _gasHelper;
|
private readonly IGasHelper _gasHelper;
|
||||||
private readonly IUserLogic _userLogic;
|
private readonly IUserLogic _userLogic;
|
||||||
private readonly IFileHelper _fileHelper;
|
private readonly IFileHelper _fileHelper;
|
||||||
|
private readonly IMailHelper _mailHelper;
|
||||||
|
private readonly IConfigHelper _config;
|
||||||
public APIController(IVehicleDataAccess dataAccess,
|
public APIController(IVehicleDataAccess dataAccess,
|
||||||
IGasHelper gasHelper,
|
IGasHelper gasHelper,
|
||||||
IReminderHelper reminderHelper,
|
IReminderHelper reminderHelper,
|
||||||
@@ -37,7 +41,11 @@ namespace CarCareTracker.Controllers
|
|||||||
IReminderRecordDataAccess reminderRecordDataAccess,
|
IReminderRecordDataAccess reminderRecordDataAccess,
|
||||||
IUpgradeRecordDataAccess upgradeRecordDataAccess,
|
IUpgradeRecordDataAccess upgradeRecordDataAccess,
|
||||||
IOdometerRecordDataAccess odometerRecordDataAccess,
|
IOdometerRecordDataAccess odometerRecordDataAccess,
|
||||||
|
IUserAccessDataAccess userAccessDataAccess,
|
||||||
|
IUserRecordDataAccess userRecordDataAccess,
|
||||||
|
IMailHelper mailHelper,
|
||||||
IFileHelper fileHelper,
|
IFileHelper fileHelper,
|
||||||
|
IConfigHelper config,
|
||||||
IUserLogic userLogic)
|
IUserLogic userLogic)
|
||||||
{
|
{
|
||||||
_dataAccess = dataAccess;
|
_dataAccess = dataAccess;
|
||||||
@@ -49,10 +57,14 @@ namespace CarCareTracker.Controllers
|
|||||||
_reminderRecordDataAccess = reminderRecordDataAccess;
|
_reminderRecordDataAccess = reminderRecordDataAccess;
|
||||||
_upgradeRecordDataAccess = upgradeRecordDataAccess;
|
_upgradeRecordDataAccess = upgradeRecordDataAccess;
|
||||||
_odometerRecordDataAccess = odometerRecordDataAccess;
|
_odometerRecordDataAccess = odometerRecordDataAccess;
|
||||||
|
_userAccessDataAccess = userAccessDataAccess;
|
||||||
|
_userRecordDataAccess = userRecordDataAccess;
|
||||||
|
_mailHelper = mailHelper;
|
||||||
_gasHelper = gasHelper;
|
_gasHelper = gasHelper;
|
||||||
_reminderHelper = reminderHelper;
|
_reminderHelper = reminderHelper;
|
||||||
_userLogic = userLogic;
|
_userLogic = userLogic;
|
||||||
_fileHelper = fileHelper;
|
_fileHelper = fileHelper;
|
||||||
|
_config = config;
|
||||||
}
|
}
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
@@ -83,6 +95,64 @@ namespace CarCareTracker.Controllers
|
|||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/vehicle/servicerecords/add")]
|
||||||
|
public IActionResult AddServiceRecord(int vehicleId, ServiceRecordExportModel input)
|
||||||
|
{
|
||||||
|
var response = new OperationResponse();
|
||||||
|
if (vehicleId == default)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Must provide a valid vehicle id";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(input.Date) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Description) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Odometer) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Cost))
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Input object invalid, Date, Description, Odometer, and Cost cannot be empty.";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var serviceRecord = new ServiceRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Mileage = int.Parse(input.Odometer),
|
||||||
|
Description = input.Description,
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Cost = decimal.Parse(input.Cost)
|
||||||
|
};
|
||||||
|
_serviceRecordDataAccess.SaveServiceRecordToVehicle(serviceRecord);
|
||||||
|
if (_config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
var odometerRecord = new OdometerRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Mileage = int.Parse(input.Odometer)
|
||||||
|
};
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(odometerRecord);
|
||||||
|
}
|
||||||
|
response.Success = true;
|
||||||
|
response.Message = "Service Record Added";
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = ex.Message;
|
||||||
|
Response.StatusCode = 500;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/api/vehicle/repairrecords")]
|
[Route("/api/vehicle/repairrecords")]
|
||||||
public IActionResult RepairRecords(int vehicleId)
|
public IActionResult RepairRecords(int vehicleId)
|
||||||
@@ -92,6 +162,64 @@ namespace CarCareTracker.Controllers
|
|||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/vehicle/repairrecords/add")]
|
||||||
|
public IActionResult AddRepairRecord(int vehicleId, ServiceRecordExportModel input)
|
||||||
|
{
|
||||||
|
var response = new OperationResponse();
|
||||||
|
if (vehicleId == default)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Must provide a valid vehicle id";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(input.Date) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Description) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Odometer) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Cost))
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Input object invalid, Date, Description, Odometer, and Cost cannot be empty.";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var repairRecord = new CollisionRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Mileage = int.Parse(input.Odometer),
|
||||||
|
Description = input.Description,
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Cost = decimal.Parse(input.Cost)
|
||||||
|
};
|
||||||
|
_collisionRecordDataAccess.SaveCollisionRecordToVehicle(repairRecord);
|
||||||
|
if (_config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
var odometerRecord = new OdometerRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Mileage = int.Parse(input.Odometer)
|
||||||
|
};
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(odometerRecord);
|
||||||
|
}
|
||||||
|
response.Success = true;
|
||||||
|
response.Message = "Repair Record Added";
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = ex.Message;
|
||||||
|
Response.StatusCode = 500;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/api/vehicle/upgraderecords")]
|
[Route("/api/vehicle/upgraderecords")]
|
||||||
public IActionResult UpgradeRecords(int vehicleId)
|
public IActionResult UpgradeRecords(int vehicleId)
|
||||||
@@ -101,6 +229,64 @@ namespace CarCareTracker.Controllers
|
|||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/vehicle/upgraderecords/add")]
|
||||||
|
public IActionResult AddUpgradeRecord(int vehicleId, ServiceRecordExportModel input)
|
||||||
|
{
|
||||||
|
var response = new OperationResponse();
|
||||||
|
if (vehicleId == default)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Must provide a valid vehicle id";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(input.Date) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Description) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Odometer) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Cost))
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Input object invalid, Date, Description, Odometer, and Cost cannot be empty.";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var upgradeRecord = new UpgradeRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Mileage = int.Parse(input.Odometer),
|
||||||
|
Description = input.Description,
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Cost = decimal.Parse(input.Cost)
|
||||||
|
};
|
||||||
|
_upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(upgradeRecord);
|
||||||
|
if (_config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
var odometerRecord = new OdometerRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Mileage = int.Parse(input.Odometer)
|
||||||
|
};
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(odometerRecord);
|
||||||
|
}
|
||||||
|
response.Success = true;
|
||||||
|
response.Message = "Upgrade Record Added";
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = ex.Message;
|
||||||
|
Response.StatusCode = 500;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/api/vehicle/taxrecords")]
|
[Route("/api/vehicle/taxrecords")]
|
||||||
public IActionResult TaxRecords(int vehicleId)
|
public IActionResult TaxRecords(int vehicleId)
|
||||||
@@ -109,6 +295,51 @@ namespace CarCareTracker.Controllers
|
|||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/vehicle/taxrecords/add")]
|
||||||
|
public IActionResult AddTaxRecord(int vehicleId, TaxRecordExportModel input)
|
||||||
|
{
|
||||||
|
var response = new OperationResponse();
|
||||||
|
if (vehicleId == default)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Must provide a valid vehicle id";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(input.Date) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Description) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Cost))
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Input object invalid, Date, Description, and Cost cannot be empty.";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var taxRecord = new TaxRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Description = input.Description,
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Cost = decimal.Parse(input.Cost)
|
||||||
|
};
|
||||||
|
_taxRecordDataAccess.SaveTaxRecordToVehicle(taxRecord);
|
||||||
|
response.Success = true;
|
||||||
|
response.Message = "Tax Record Added";
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = ex.Message;
|
||||||
|
Response.StatusCode = 500;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/api/vehicle/odometerrecords")]
|
[Route("/api/vehicle/odometerrecords")]
|
||||||
public IActionResult OdometerRecords(int vehicleId)
|
public IActionResult OdometerRecords(int vehicleId)
|
||||||
@@ -127,6 +358,15 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
response.Success = false;
|
response.Success = false;
|
||||||
response.Message = "Must provide a valid vehicle id";
|
response.Message = "Must provide a valid vehicle id";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(input.Date) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Odometer))
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Input object invalid, Date and Odometer cannot be empty.";
|
||||||
|
Response.StatusCode = 400;
|
||||||
return Json(response);
|
return Json(response);
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@@ -145,7 +385,8 @@ namespace CarCareTracker.Controllers
|
|||||||
} catch (Exception ex)
|
} catch (Exception ex)
|
||||||
{
|
{
|
||||||
response.Success = false;
|
response.Success = false;
|
||||||
response.Message = StaticHelper.GenericErrorMessage;
|
response.Message = ex.Message;
|
||||||
|
Response.StatusCode = 500;
|
||||||
return Json(response);
|
return Json(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,6 +410,69 @@ namespace CarCareTracker.Controllers
|
|||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpPost]
|
||||||
|
[Route("/api/vehicle/gasrecords/add")]
|
||||||
|
public IActionResult AddGasRecord(int vehicleId, GasRecordExportModel input)
|
||||||
|
{
|
||||||
|
var response = new OperationResponse();
|
||||||
|
if (vehicleId == default)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Must provide a valid vehicle id";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(input.Date) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Odometer) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.FuelConsumed) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.Cost) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.IsFillToFull) ||
|
||||||
|
string.IsNullOrWhiteSpace(input.MissedFuelUp)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = "Input object invalid, Date, Odometer, FuelConsumed, IsFillToFull, MissedFuelUp, and Cost cannot be empty.";
|
||||||
|
Response.StatusCode = 400;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var gasRecord = new GasRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Mileage = int.Parse(input.Odometer),
|
||||||
|
Gallons = decimal.Parse(input.FuelConsumed),
|
||||||
|
IsFillToFull = bool.Parse(input.IsFillToFull),
|
||||||
|
MissedFuelUp = bool.Parse(input.MissedFuelUp),
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Cost = decimal.Parse(input.Cost)
|
||||||
|
};
|
||||||
|
_gasRecordDataAccess.SaveGasRecordToVehicle(gasRecord);
|
||||||
|
if (_config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
var odometerRecord = new OdometerRecord()
|
||||||
|
{
|
||||||
|
VehicleId = vehicleId,
|
||||||
|
Date = DateTime.Parse(input.Date),
|
||||||
|
Notes = string.IsNullOrWhiteSpace(input.Notes) ? "" : input.Notes,
|
||||||
|
Mileage = int.Parse(input.Odometer)
|
||||||
|
};
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(odometerRecord);
|
||||||
|
}
|
||||||
|
response.Success = true;
|
||||||
|
response.Message = "Gas Record Added";
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Success = false;
|
||||||
|
response.Message = ex.Message;
|
||||||
|
Response.StatusCode = 500;
|
||||||
|
return Json(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/api/vehicle/reminders")]
|
[Route("/api/vehicle/reminders")]
|
||||||
public IActionResult Reminders(int vehicleId)
|
public IActionResult Reminders(int vehicleId)
|
||||||
@@ -180,12 +484,65 @@ namespace CarCareTracker.Controllers
|
|||||||
}
|
}
|
||||||
[Authorize(Roles = nameof(UserData.IsRootUser))]
|
[Authorize(Roles = nameof(UserData.IsRootUser))]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[Route("/api/vehicle/reminders/send")]
|
||||||
|
public IActionResult SendReminders(List<ReminderUrgency> urgencies)
|
||||||
|
{
|
||||||
|
var vehicles = _dataAccess.GetVehicles();
|
||||||
|
List<OperationResponse> operationResponses = new List<OperationResponse>();
|
||||||
|
foreach(Vehicle vehicle in vehicles)
|
||||||
|
{
|
||||||
|
var vehicleId = vehicle.Id;
|
||||||
|
//get reminders
|
||||||
|
var currentMileage = GetMaxMileage(vehicleId);
|
||||||
|
var reminders = _reminderRecordDataAccess.GetReminderRecordsByVehicleId(vehicleId);
|
||||||
|
var results = _reminderHelper.GetReminderRecordViewModels(reminders, currentMileage, DateTime.Now).OrderByDescending(x => x.Urgency).ToList();
|
||||||
|
results.RemoveAll(x => !urgencies.Contains(x.Urgency));
|
||||||
|
if (!results.Any())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//get list of recipients.
|
||||||
|
var userIds = _userAccessDataAccess.GetUserAccessByVehicleId(vehicleId).Select(x => x.Id.UserId);
|
||||||
|
List<string> emailRecipients = new List<string>();
|
||||||
|
foreach (int userId in userIds)
|
||||||
|
{
|
||||||
|
var userData = _userRecordDataAccess.GetUserRecordById(userId);
|
||||||
|
emailRecipients.Add(userData.EmailAddress);
|
||||||
|
};
|
||||||
|
if (!emailRecipients.Any())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var result = _mailHelper.NotifyUserForReminders(vehicle, emailRecipients, results);
|
||||||
|
operationResponses.Add(result);
|
||||||
|
}
|
||||||
|
if (operationResponses.All(x => x.Success))
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = true, Message = "Emails sent" });
|
||||||
|
} else if (operationResponses.All(x => !x.Success))
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = false, Message = "All emails failed, check SMTP settings" });
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = true, Message = "Some emails sent, some failed, check recipient settings" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[Authorize(Roles = nameof(UserData.IsRootUser))]
|
||||||
|
[HttpGet]
|
||||||
[Route("/api/makebackup")]
|
[Route("/api/makebackup")]
|
||||||
public IActionResult MakeBackup()
|
public IActionResult MakeBackup()
|
||||||
{
|
{
|
||||||
var result = _fileHelper.MakeBackup();
|
var result = _fileHelper.MakeBackup();
|
||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
|
[Authorize(Roles = nameof(UserData.IsRootUser))]
|
||||||
|
[HttpGet]
|
||||||
|
[Route("/api/demo/restore")]
|
||||||
|
public IActionResult RestoreDemo()
|
||||||
|
{
|
||||||
|
var result = _fileHelper.RestoreBackup("/defaults/demo_default.zip", true);
|
||||||
|
return Json(result);
|
||||||
|
}
|
||||||
private int GetMaxMileage(int vehicleId)
|
private int GetMaxMileage(int vehicleId)
|
||||||
{
|
{
|
||||||
var numbersArray = new List<int>();
|
var numbersArray = new List<int>();
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
public IActionResult Unauthorized()
|
public IActionResult Unauthorized()
|
||||||
{
|
{
|
||||||
|
if (!User.IsInRole("CookieAuth"))
|
||||||
|
{
|
||||||
|
Response.StatusCode = 403;
|
||||||
|
return new EmptyResult();
|
||||||
|
}
|
||||||
return View("401");
|
return View("401");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,26 @@ namespace CarCareTracker.Controllers
|
|||||||
return Json(fileName);
|
return Json(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult HandleTranslationFileUpload(IFormFile file)
|
||||||
|
{
|
||||||
|
var originalFileName = Path.GetFileNameWithoutExtension(file.FileName);
|
||||||
|
if (originalFileName == "en_US")
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = false, Message = "The translation file name en_US is reserved." });
|
||||||
|
}
|
||||||
|
var fileName = UploadFile(file);
|
||||||
|
//move file from temp to translation folder.
|
||||||
|
var uploadedFilePath = _fileHelper.MoveFileFromTemp(fileName, "translations/");
|
||||||
|
//rename uploaded file so that it preserves original name.
|
||||||
|
if (!string.IsNullOrWhiteSpace(uploadedFilePath))
|
||||||
|
{
|
||||||
|
var result = _fileHelper.RenameFile(uploadedFilePath, originalFileName);
|
||||||
|
return Json(new OperationResponse { Success = result, Message = string.Empty });
|
||||||
|
}
|
||||||
|
return Json(new OperationResponse { Success = false, Message = StaticHelper.GenericErrorMessage });
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult HandleMultipleFileUpload(List<IFormFile> file)
|
public IActionResult HandleMultipleFileUpload(List<IFormFile> file)
|
||||||
{
|
{
|
||||||
@@ -44,7 +64,7 @@ namespace CarCareTracker.Controllers
|
|||||||
}
|
}
|
||||||
return Json(uploadedFiles);
|
return Json(uploadedFiles);
|
||||||
}
|
}
|
||||||
|
[Authorize(Roles = nameof(UserData.IsRootUser))]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult DeleteFiles(string fileLocation)
|
public IActionResult DeleteFiles(string fileLocation)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,17 +15,20 @@ namespace CarCareTracker.Controllers
|
|||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private readonly IVehicleDataAccess _dataAccess;
|
private readonly IVehicleDataAccess _dataAccess;
|
||||||
private readonly IUserLogic _userLogic;
|
private readonly IUserLogic _userLogic;
|
||||||
|
private readonly IFileHelper _fileHelper;
|
||||||
private readonly IConfigHelper _config;
|
private readonly IConfigHelper _config;
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger,
|
public HomeController(ILogger<HomeController> logger,
|
||||||
IVehicleDataAccess dataAccess,
|
IVehicleDataAccess dataAccess,
|
||||||
IUserLogic userLogic,
|
IUserLogic userLogic,
|
||||||
IConfigHelper configuration)
|
IConfigHelper configuration,
|
||||||
|
IFileHelper fileHelper)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_dataAccess = dataAccess;
|
_dataAccess = dataAccess;
|
||||||
_config = configuration;
|
_config = configuration;
|
||||||
_userLogic = userLogic;
|
_userLogic = userLogic;
|
||||||
|
_fileHelper = fileHelper;
|
||||||
}
|
}
|
||||||
private int GetUserID()
|
private int GetUserID()
|
||||||
{
|
{
|
||||||
@@ -47,7 +50,13 @@ namespace CarCareTracker.Controllers
|
|||||||
public IActionResult Settings()
|
public IActionResult Settings()
|
||||||
{
|
{
|
||||||
var userConfig = _config.GetUserConfig(User);
|
var userConfig = _config.GetUserConfig(User);
|
||||||
return PartialView("_Settings", userConfig);
|
var languages = _fileHelper.GetLanguages();
|
||||||
|
var viewModel = new SettingsViewModel
|
||||||
|
{
|
||||||
|
UserConfig = userConfig,
|
||||||
|
UILanguages = languages
|
||||||
|
};
|
||||||
|
return PartialView("_Settings", viewModel);
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult WriteToSettings(UserConfig userConfig)
|
public IActionResult WriteToSettings(UserConfig userConfig)
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ namespace CarCareTracker.Controllers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_loginLogic = loginLogic;
|
_loginLogic = loginLogic;
|
||||||
}
|
}
|
||||||
public IActionResult Index()
|
public IActionResult Index(string redirectURL = "")
|
||||||
{
|
{
|
||||||
return View();
|
return View(model: redirectURL);
|
||||||
}
|
}
|
||||||
public IActionResult Registration()
|
public IActionResult Registration()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace CarCareTracker.Controllers
|
|||||||
private readonly IUpgradeRecordDataAccess _upgradeRecordDataAccess;
|
private readonly IUpgradeRecordDataAccess _upgradeRecordDataAccess;
|
||||||
private readonly ISupplyRecordDataAccess _supplyRecordDataAccess;
|
private readonly ISupplyRecordDataAccess _supplyRecordDataAccess;
|
||||||
private readonly IPlanRecordDataAccess _planRecordDataAccess;
|
private readonly IPlanRecordDataAccess _planRecordDataAccess;
|
||||||
|
private readonly IPlanRecordTemplateDataAccess _planRecordTemplateDataAccess;
|
||||||
private readonly IOdometerRecordDataAccess _odometerRecordDataAccess;
|
private readonly IOdometerRecordDataAccess _odometerRecordDataAccess;
|
||||||
private readonly IWebHostEnvironment _webEnv;
|
private readonly IWebHostEnvironment _webEnv;
|
||||||
private readonly IConfigHelper _config;
|
private readonly IConfigHelper _config;
|
||||||
@@ -51,6 +52,7 @@ namespace CarCareTracker.Controllers
|
|||||||
IUpgradeRecordDataAccess upgradeRecordDataAccess,
|
IUpgradeRecordDataAccess upgradeRecordDataAccess,
|
||||||
ISupplyRecordDataAccess supplyRecordDataAccess,
|
ISupplyRecordDataAccess supplyRecordDataAccess,
|
||||||
IPlanRecordDataAccess planRecordDataAccess,
|
IPlanRecordDataAccess planRecordDataAccess,
|
||||||
|
IPlanRecordTemplateDataAccess planRecordTemplateDataAccess,
|
||||||
IOdometerRecordDataAccess odometerRecordDataAccess,
|
IOdometerRecordDataAccess odometerRecordDataAccess,
|
||||||
IUserLogic userLogic,
|
IUserLogic userLogic,
|
||||||
IWebHostEnvironment webEnv,
|
IWebHostEnvironment webEnv,
|
||||||
@@ -71,6 +73,7 @@ namespace CarCareTracker.Controllers
|
|||||||
_upgradeRecordDataAccess = upgradeRecordDataAccess;
|
_upgradeRecordDataAccess = upgradeRecordDataAccess;
|
||||||
_supplyRecordDataAccess = supplyRecordDataAccess;
|
_supplyRecordDataAccess = supplyRecordDataAccess;
|
||||||
_planRecordDataAccess = planRecordDataAccess;
|
_planRecordDataAccess = planRecordDataAccess;
|
||||||
|
_planRecordTemplateDataAccess = planRecordTemplateDataAccess;
|
||||||
_odometerRecordDataAccess = odometerRecordDataAccess;
|
_odometerRecordDataAccess = odometerRecordDataAccess;
|
||||||
_userLogic = userLogic;
|
_userLogic = userLogic;
|
||||||
_webEnv = webEnv;
|
_webEnv = webEnv;
|
||||||
@@ -85,6 +88,7 @@ namespace CarCareTracker.Controllers
|
|||||||
public IActionResult Index(int vehicleId)
|
public IActionResult Index(int vehicleId)
|
||||||
{
|
{
|
||||||
var data = _dataAccess.GetVehicleById(vehicleId);
|
var data = _dataAccess.GetVehicleById(vehicleId);
|
||||||
|
UpdateRecurringTaxes(vehicleId);
|
||||||
return View(data);
|
return View(data);
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -141,6 +145,7 @@ namespace CarCareTracker.Controllers
|
|||||||
_reminderRecordDataAccess.DeleteAllReminderRecordsByVehicleId(vehicleId) &&
|
_reminderRecordDataAccess.DeleteAllReminderRecordsByVehicleId(vehicleId) &&
|
||||||
_upgradeRecordDataAccess.DeleteAllUpgradeRecordsByVehicleId(vehicleId) &&
|
_upgradeRecordDataAccess.DeleteAllUpgradeRecordsByVehicleId(vehicleId) &&
|
||||||
_planRecordDataAccess.DeleteAllPlanRecordsByVehicleId(vehicleId) &&
|
_planRecordDataAccess.DeleteAllPlanRecordsByVehicleId(vehicleId) &&
|
||||||
|
_planRecordTemplateDataAccess.DeleteAllPlanRecordTemplatesByVehicleId(vehicleId) &&
|
||||||
_supplyRecordDataAccess.DeleteAllSupplyRecordsByVehicleId(vehicleId) &&
|
_supplyRecordDataAccess.DeleteAllSupplyRecordsByVehicleId(vehicleId) &&
|
||||||
_userLogic.DeleteAllAccessToVehicle(vehicleId) &&
|
_userLogic.DeleteAllAccessToVehicle(vehicleId) &&
|
||||||
_dataAccess.DeleteVehicle(vehicleId);
|
_dataAccess.DeleteVehicle(vehicleId);
|
||||||
@@ -171,7 +176,7 @@ namespace CarCareTracker.Controllers
|
|||||||
var vehicleRecords = _serviceRecordDataAccess.GetServiceRecordsByVehicleId(vehicleId);
|
var vehicleRecords = _serviceRecordDataAccess.GetServiceRecordsByVehicleId(vehicleId);
|
||||||
if (vehicleRecords.Any())
|
if (vehicleRecords.Any())
|
||||||
{
|
{
|
||||||
var exportData = vehicleRecords.Select(x => new ServiceRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes, Odometer = x.Mileage.ToString() });
|
var exportData = vehicleRecords.Select(x => new ServiceRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes, Odometer = x.Mileage.ToString(), Tags = string.Join(" ", x.Tags) });
|
||||||
using (var writer = new StreamWriter(fullExportFilePath))
|
using (var writer = new StreamWriter(fullExportFilePath))
|
||||||
{
|
{
|
||||||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
||||||
@@ -189,7 +194,7 @@ namespace CarCareTracker.Controllers
|
|||||||
var vehicleRecords = _collisionRecordDataAccess.GetCollisionRecordsByVehicleId(vehicleId);
|
var vehicleRecords = _collisionRecordDataAccess.GetCollisionRecordsByVehicleId(vehicleId);
|
||||||
if (vehicleRecords.Any())
|
if (vehicleRecords.Any())
|
||||||
{
|
{
|
||||||
var exportData = vehicleRecords.Select(x => new ServiceRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes, Odometer = x.Mileage.ToString() });
|
var exportData = vehicleRecords.Select(x => new ServiceRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes, Odometer = x.Mileage.ToString(), Tags = string.Join(" ", x.Tags) });
|
||||||
using (var writer = new StreamWriter(fullExportFilePath))
|
using (var writer = new StreamWriter(fullExportFilePath))
|
||||||
{
|
{
|
||||||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
||||||
@@ -207,7 +212,7 @@ namespace CarCareTracker.Controllers
|
|||||||
var vehicleRecords = _upgradeRecordDataAccess.GetUpgradeRecordsByVehicleId(vehicleId);
|
var vehicleRecords = _upgradeRecordDataAccess.GetUpgradeRecordsByVehicleId(vehicleId);
|
||||||
if (vehicleRecords.Any())
|
if (vehicleRecords.Any())
|
||||||
{
|
{
|
||||||
var exportData = vehicleRecords.Select(x => new ServiceRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes, Odometer = x.Mileage.ToString() });
|
var exportData = vehicleRecords.Select(x => new ServiceRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes, Odometer = x.Mileage.ToString(), Tags = string.Join(" ", x.Tags) });
|
||||||
using (var writer = new StreamWriter(fullExportFilePath))
|
using (var writer = new StreamWriter(fullExportFilePath))
|
||||||
{
|
{
|
||||||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
||||||
@@ -225,7 +230,7 @@ namespace CarCareTracker.Controllers
|
|||||||
var vehicleRecords = _odometerRecordDataAccess.GetOdometerRecordsByVehicleId(vehicleId);
|
var vehicleRecords = _odometerRecordDataAccess.GetOdometerRecordsByVehicleId(vehicleId);
|
||||||
if (vehicleRecords.Any())
|
if (vehicleRecords.Any())
|
||||||
{
|
{
|
||||||
var exportData = vehicleRecords.Select(x => new OdometerRecordExportModel { Date = x.Date.ToShortDateString(), Notes = x.Notes, Odometer = x.Mileage.ToString() });
|
var exportData = vehicleRecords.Select(x => new OdometerRecordExportModel { Date = x.Date.ToShortDateString(), Notes = x.Notes, Odometer = x.Mileage.ToString(), Tags = string.Join(" ", x.Tags) });
|
||||||
using (var writer = new StreamWriter(fullExportFilePath))
|
using (var writer = new StreamWriter(fullExportFilePath))
|
||||||
{
|
{
|
||||||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
||||||
@@ -270,7 +275,7 @@ namespace CarCareTracker.Controllers
|
|||||||
var vehicleRecords = _taxRecordDataAccess.GetTaxRecordsByVehicleId(vehicleId);
|
var vehicleRecords = _taxRecordDataAccess.GetTaxRecordsByVehicleId(vehicleId);
|
||||||
if (vehicleRecords.Any())
|
if (vehicleRecords.Any())
|
||||||
{
|
{
|
||||||
var exportData = vehicleRecords.Select(x => new TaxRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes });
|
var exportData = vehicleRecords.Select(x => new TaxRecordExportModel { Date = x.Date.ToShortDateString(), Description = x.Description, Cost = x.Cost.ToString("C"), Notes = x.Notes, Tags = string.Join(" ", x.Tags) });
|
||||||
using (var writer = new StreamWriter(fullExportFilePath))
|
using (var writer = new StreamWriter(fullExportFilePath))
|
||||||
{
|
{
|
||||||
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
|
||||||
@@ -316,7 +321,6 @@ namespace CarCareTracker.Controllers
|
|||||||
var vehicleRecords = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId);
|
var vehicleRecords = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId);
|
||||||
bool useMPG = _config.GetUserConfig(User).UseMPG;
|
bool useMPG = _config.GetUserConfig(User).UseMPG;
|
||||||
bool useUKMPG = _config.GetUserConfig(User).UseUKMPG;
|
bool useUKMPG = _config.GetUserConfig(User).UseUKMPG;
|
||||||
vehicleRecords = vehicleRecords.OrderBy(x => x.Date).ThenBy(x => x.Mileage).ToList();
|
|
||||||
var convertedRecords = _gasHelper.GetGasRecordViewModels(vehicleRecords, useMPG, useUKMPG);
|
var convertedRecords = _gasHelper.GetGasRecordViewModels(vehicleRecords, useMPG, useUKMPG);
|
||||||
var exportData = convertedRecords.Select(x => new GasRecordExportModel
|
var exportData = convertedRecords.Select(x => new GasRecordExportModel
|
||||||
{
|
{
|
||||||
@@ -327,7 +331,8 @@ namespace CarCareTracker.Controllers
|
|||||||
Odometer = x.Mileage.ToString(),
|
Odometer = x.Mileage.ToString(),
|
||||||
IsFillToFull = x.IsFillToFull.ToString(),
|
IsFillToFull = x.IsFillToFull.ToString(),
|
||||||
MissedFuelUp = x.MissedFuelUp.ToString(),
|
MissedFuelUp = x.MissedFuelUp.ToString(),
|
||||||
Notes = x.Notes
|
Notes = x.Notes,
|
||||||
|
Tags = string.Join(" ", x.Tags)
|
||||||
});
|
});
|
||||||
using (var writer = new StreamWriter(fullExportFilePath))
|
using (var writer = new StreamWriter(fullExportFilePath))
|
||||||
{
|
{
|
||||||
@@ -376,9 +381,10 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
VehicleId = vehicleId,
|
VehicleId = vehicleId,
|
||||||
Date = DateTime.Parse(importModel.Date),
|
Date = DateTime.Parse(importModel.Date),
|
||||||
Mileage = int.Parse(importModel.Odometer, NumberStyles.Any),
|
Mileage = decimal.ToInt32(decimal.Parse(importModel.Odometer, NumberStyles.Any)),
|
||||||
Gallons = decimal.Parse(importModel.FuelConsumed, NumberStyles.Any),
|
Gallons = decimal.Parse(importModel.FuelConsumed, NumberStyles.Any),
|
||||||
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes
|
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
||||||
|
Tags = string.IsNullOrWhiteSpace(importModel.Tags) ? [] : importModel.Tags.Split(" ").ToList()
|
||||||
};
|
};
|
||||||
if (string.IsNullOrWhiteSpace(importModel.Cost) && !string.IsNullOrWhiteSpace(importModel.Price))
|
if (string.IsNullOrWhiteSpace(importModel.Cost) && !string.IsNullOrWhiteSpace(importModel.Price))
|
||||||
{
|
{
|
||||||
@@ -420,10 +426,11 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
VehicleId = vehicleId,
|
VehicleId = vehicleId,
|
||||||
Date = DateTime.Parse(importModel.Date),
|
Date = DateTime.Parse(importModel.Date),
|
||||||
Mileage = int.Parse(importModel.Odometer, NumberStyles.Any),
|
Mileage = decimal.ToInt32(decimal.Parse(importModel.Odometer, NumberStyles.Any)),
|
||||||
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Service Record on {importModel.Date}" : importModel.Description,
|
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Service Record on {importModel.Date}" : importModel.Description,
|
||||||
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
||||||
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any)
|
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any),
|
||||||
|
Tags = string.IsNullOrWhiteSpace(importModel.Tags) ? [] : importModel.Tags.Split(" ").ToList()
|
||||||
};
|
};
|
||||||
_serviceRecordDataAccess.SaveServiceRecordToVehicle(convertedRecord);
|
_serviceRecordDataAccess.SaveServiceRecordToVehicle(convertedRecord);
|
||||||
}
|
}
|
||||||
@@ -433,8 +440,9 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
VehicleId = vehicleId,
|
VehicleId = vehicleId,
|
||||||
Date = DateTime.Parse(importModel.Date),
|
Date = DateTime.Parse(importModel.Date),
|
||||||
Mileage = int.Parse(importModel.Odometer, NumberStyles.Any),
|
Mileage = decimal.ToInt32(decimal.Parse(importModel.Odometer, NumberStyles.Any)),
|
||||||
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes
|
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
||||||
|
Tags = string.IsNullOrWhiteSpace(importModel.Tags) ? [] : importModel.Tags.Split(" ").ToList()
|
||||||
};
|
};
|
||||||
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(convertedRecord);
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(convertedRecord);
|
||||||
}
|
}
|
||||||
@@ -463,10 +471,11 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
VehicleId = vehicleId,
|
VehicleId = vehicleId,
|
||||||
Date = DateTime.Parse(importModel.Date),
|
Date = DateTime.Parse(importModel.Date),
|
||||||
Mileage = int.Parse(importModel.Odometer, NumberStyles.Any),
|
Mileage = decimal.ToInt32(decimal.Parse(importModel.Odometer, NumberStyles.Any)),
|
||||||
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Repair Record on {importModel.Date}" : importModel.Description,
|
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Repair Record on {importModel.Date}" : importModel.Description,
|
||||||
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
||||||
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any)
|
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any),
|
||||||
|
Tags = string.IsNullOrWhiteSpace(importModel.Tags) ? [] : importModel.Tags.Split(" ").ToList()
|
||||||
};
|
};
|
||||||
_collisionRecordDataAccess.SaveCollisionRecordToVehicle(convertedRecord);
|
_collisionRecordDataAccess.SaveCollisionRecordToVehicle(convertedRecord);
|
||||||
}
|
}
|
||||||
@@ -476,10 +485,11 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
VehicleId = vehicleId,
|
VehicleId = vehicleId,
|
||||||
Date = DateTime.Parse(importModel.Date),
|
Date = DateTime.Parse(importModel.Date),
|
||||||
Mileage = int.Parse(importModel.Odometer, NumberStyles.Any),
|
Mileage = decimal.ToInt32(decimal.Parse(importModel.Odometer, NumberStyles.Any)),
|
||||||
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Upgrade Record on {importModel.Date}" : importModel.Description,
|
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Upgrade Record on {importModel.Date}" : importModel.Description,
|
||||||
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
||||||
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any)
|
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any),
|
||||||
|
Tags = string.IsNullOrWhiteSpace(importModel.Tags) ? [] : importModel.Tags.Split(" ").ToList()
|
||||||
};
|
};
|
||||||
_upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(convertedRecord);
|
_upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(convertedRecord);
|
||||||
}
|
}
|
||||||
@@ -506,7 +516,8 @@ namespace CarCareTracker.Controllers
|
|||||||
Date = DateTime.Parse(importModel.Date),
|
Date = DateTime.Parse(importModel.Date),
|
||||||
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Tax Record on {importModel.Date}" : importModel.Description,
|
Description = string.IsNullOrWhiteSpace(importModel.Description) ? $"Tax Record on {importModel.Date}" : importModel.Description,
|
||||||
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
Notes = string.IsNullOrWhiteSpace(importModel.Notes) ? "" : importModel.Notes,
|
||||||
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any)
|
Cost = decimal.Parse(importModel.Cost, NumberStyles.Any),
|
||||||
|
Tags = string.IsNullOrWhiteSpace(importModel.Tags) ? [] : importModel.Tags.Split(" ").ToList()
|
||||||
};
|
};
|
||||||
_taxRecordDataAccess.SaveTaxRecordToVehicle(convertedRecord);
|
_taxRecordDataAccess.SaveTaxRecordToVehicle(convertedRecord);
|
||||||
}
|
}
|
||||||
@@ -529,8 +540,6 @@ namespace CarCareTracker.Controllers
|
|||||||
public IActionResult GetGasRecordsByVehicleId(int vehicleId)
|
public IActionResult GetGasRecordsByVehicleId(int vehicleId)
|
||||||
{
|
{
|
||||||
var result = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId);
|
var result = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId);
|
||||||
//need it in ascending order to perform computation.
|
|
||||||
result = result.OrderBy(x => x.Date).ThenBy(x => x.Mileage).ToList();
|
|
||||||
//check if the user uses MPG or Liters per 100km.
|
//check if the user uses MPG or Liters per 100km.
|
||||||
var userConfig = _config.GetUserConfig(User);
|
var userConfig = _config.GetUserConfig(User);
|
||||||
bool useMPG = userConfig.UseMPG;
|
bool useMPG = userConfig.UseMPG;
|
||||||
@@ -540,10 +549,13 @@ namespace CarCareTracker.Controllers
|
|||||||
{
|
{
|
||||||
computedResults = computedResults.OrderByDescending(x => DateTime.Parse(x.Date)).ThenByDescending(x => x.Mileage).ToList();
|
computedResults = computedResults.OrderByDescending(x => DateTime.Parse(x.Date)).ThenByDescending(x => x.Mileage).ToList();
|
||||||
}
|
}
|
||||||
var vehicleIsElectric = _dataAccess.GetVehicleById(vehicleId).IsElectric;
|
var vehicleData = _dataAccess.GetVehicleById(vehicleId);
|
||||||
|
var vehicleIsElectric = vehicleData.IsElectric;
|
||||||
|
var vehicleUseHours = vehicleData.UseHours;
|
||||||
var viewModel = new GasRecordViewModelContainer()
|
var viewModel = new GasRecordViewModelContainer()
|
||||||
{
|
{
|
||||||
UseKwh = vehicleIsElectric,
|
UseKwh = vehicleIsElectric,
|
||||||
|
UseHours = vehicleUseHours,
|
||||||
GasRecords = computedResults
|
GasRecords = computedResults
|
||||||
};
|
};
|
||||||
return PartialView("_Gas", viewModel);
|
return PartialView("_Gas", viewModel);
|
||||||
@@ -551,14 +563,27 @@ namespace CarCareTracker.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult SaveGasRecordToVehicleId(GasRecordInput gasRecord)
|
public IActionResult SaveGasRecordToVehicleId(GasRecordInput gasRecord)
|
||||||
{
|
{
|
||||||
|
if (gasRecord.Id == default && _config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(new OdometerRecord
|
||||||
|
{
|
||||||
|
Date = DateTime.Parse(gasRecord.Date),
|
||||||
|
VehicleId = gasRecord.VehicleId,
|
||||||
|
Mileage = gasRecord.Mileage,
|
||||||
|
Notes = $"Auto Insert From Gas Record. {gasRecord.Notes}"
|
||||||
|
});
|
||||||
|
}
|
||||||
gasRecord.Files = gasRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
gasRecord.Files = gasRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
||||||
var result = _gasRecordDataAccess.SaveGasRecordToVehicle(gasRecord.ToGasRecord());
|
var result = _gasRecordDataAccess.SaveGasRecordToVehicle(gasRecord.ToGasRecord());
|
||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetAddGasRecordPartialView()
|
public IActionResult GetAddGasRecordPartialView(int vehicleId)
|
||||||
{
|
{
|
||||||
return PartialView("_GasModal", new GasRecordInputContainer() { GasRecord = new GasRecordInput() });
|
var vehicleData = _dataAccess.GetVehicleById(vehicleId);
|
||||||
|
var vehicleIsElectric = vehicleData.IsElectric;
|
||||||
|
var vehicleUseHours = vehicleData.UseHours;
|
||||||
|
return PartialView("_GasModal", new GasRecordInputContainer() { UseKwh = vehicleIsElectric, UseHours = vehicleUseHours, GasRecord = new GasRecordInput() });
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetGasRecordForEditById(int gasRecordId)
|
public IActionResult GetGasRecordForEditById(int gasRecordId)
|
||||||
@@ -575,12 +600,16 @@ namespace CarCareTracker.Controllers
|
|||||||
Gallons = result.Gallons,
|
Gallons = result.Gallons,
|
||||||
IsFillToFull = result.IsFillToFull,
|
IsFillToFull = result.IsFillToFull,
|
||||||
MissedFuelUp = result.MissedFuelUp,
|
MissedFuelUp = result.MissedFuelUp,
|
||||||
Notes = result.Notes
|
Notes = result.Notes,
|
||||||
|
Tags = result.Tags
|
||||||
};
|
};
|
||||||
var vehicleIsElectric = _dataAccess.GetVehicleById(convertedResult.VehicleId).IsElectric;
|
var vehicleData = _dataAccess.GetVehicleById(convertedResult.VehicleId);
|
||||||
|
var vehicleIsElectric = vehicleData.IsElectric;
|
||||||
|
var vehicleUseHours = vehicleData.UseHours;
|
||||||
var viewModel = new GasRecordInputContainer()
|
var viewModel = new GasRecordInputContainer()
|
||||||
{
|
{
|
||||||
UseKwh = vehicleIsElectric,
|
UseKwh = vehicleIsElectric,
|
||||||
|
UseHours = vehicleUseHours,
|
||||||
GasRecord = convertedResult
|
GasRecord = convertedResult
|
||||||
};
|
};
|
||||||
return PartialView("_GasModal", viewModel);
|
return PartialView("_GasModal", viewModel);
|
||||||
@@ -591,6 +620,15 @@ namespace CarCareTracker.Controllers
|
|||||||
var result = _gasRecordDataAccess.DeleteGasRecordById(gasRecordId);
|
var result = _gasRecordDataAccess.DeleteGasRecordById(gasRecordId);
|
||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult SaveUserGasTabPreferences(string gasUnit, string fuelMileageUnit)
|
||||||
|
{
|
||||||
|
var currentConfig = _config.GetUserConfig(User);
|
||||||
|
currentConfig.PreferredGasUnit = gasUnit;
|
||||||
|
currentConfig.PreferredGasMileageUnit = fuelMileageUnit;
|
||||||
|
var result = _config.SaveUserConfig(User, currentConfig);
|
||||||
|
return Json(result);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region "Service Records"
|
#region "Service Records"
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
@@ -612,9 +650,23 @@ namespace CarCareTracker.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult SaveServiceRecordToVehicleId(ServiceRecordInput serviceRecord)
|
public IActionResult SaveServiceRecordToVehicleId(ServiceRecordInput serviceRecord)
|
||||||
{
|
{
|
||||||
|
if (serviceRecord.Id == default && _config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(new OdometerRecord
|
||||||
|
{
|
||||||
|
Date = DateTime.Parse(serviceRecord.Date),
|
||||||
|
VehicleId = serviceRecord.VehicleId,
|
||||||
|
Mileage = serviceRecord.Mileage,
|
||||||
|
Notes = $"Auto Insert From Service Record: {serviceRecord.Description}"
|
||||||
|
});
|
||||||
|
}
|
||||||
//move files from temp.
|
//move files from temp.
|
||||||
serviceRecord.Files = serviceRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
serviceRecord.Files = serviceRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
||||||
var result = _serviceRecordDataAccess.SaveServiceRecordToVehicle(serviceRecord.ToServiceRecord());
|
var result = _serviceRecordDataAccess.SaveServiceRecordToVehicle(serviceRecord.ToServiceRecord());
|
||||||
|
if (result && serviceRecord.Supplies.Any())
|
||||||
|
{
|
||||||
|
RequisitionSupplyRecordsByUsage(serviceRecord.Supplies);
|
||||||
|
}
|
||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -636,7 +688,8 @@ namespace CarCareTracker.Controllers
|
|||||||
Mileage = result.Mileage,
|
Mileage = result.Mileage,
|
||||||
Notes = result.Notes,
|
Notes = result.Notes,
|
||||||
VehicleId = result.VehicleId,
|
VehicleId = result.VehicleId,
|
||||||
Files = result.Files
|
Files = result.Files,
|
||||||
|
Tags = result.Tags
|
||||||
};
|
};
|
||||||
return PartialView("_ServiceRecordModal", convertedResult);
|
return PartialView("_ServiceRecordModal", convertedResult);
|
||||||
}
|
}
|
||||||
@@ -667,9 +720,23 @@ namespace CarCareTracker.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult SaveCollisionRecordToVehicleId(CollisionRecordInput collisionRecord)
|
public IActionResult SaveCollisionRecordToVehicleId(CollisionRecordInput collisionRecord)
|
||||||
{
|
{
|
||||||
|
if (collisionRecord.Id == default && _config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(new OdometerRecord
|
||||||
|
{
|
||||||
|
Date = DateTime.Parse(collisionRecord.Date),
|
||||||
|
VehicleId = collisionRecord.VehicleId,
|
||||||
|
Mileage = collisionRecord.Mileage,
|
||||||
|
Notes = $"Auto Insert From Repair Record: {collisionRecord.Description}"
|
||||||
|
});
|
||||||
|
}
|
||||||
//move files from temp.
|
//move files from temp.
|
||||||
collisionRecord.Files = collisionRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
collisionRecord.Files = collisionRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
||||||
var result = _collisionRecordDataAccess.SaveCollisionRecordToVehicle(collisionRecord.ToCollisionRecord());
|
var result = _collisionRecordDataAccess.SaveCollisionRecordToVehicle(collisionRecord.ToCollisionRecord());
|
||||||
|
if (result && collisionRecord.Supplies.Any())
|
||||||
|
{
|
||||||
|
RequisitionSupplyRecordsByUsage(collisionRecord.Supplies);
|
||||||
|
}
|
||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -691,7 +758,8 @@ namespace CarCareTracker.Controllers
|
|||||||
Mileage = result.Mileage,
|
Mileage = result.Mileage,
|
||||||
Notes = result.Notes,
|
Notes = result.Notes,
|
||||||
VehicleId = result.VehicleId,
|
VehicleId = result.VehicleId,
|
||||||
Files = result.Files
|
Files = result.Files,
|
||||||
|
Tags = result.Tags
|
||||||
};
|
};
|
||||||
return PartialView("_CollisionRecordModal", convertedResult);
|
return PartialView("_CollisionRecordModal", convertedResult);
|
||||||
}
|
}
|
||||||
@@ -719,6 +787,35 @@ namespace CarCareTracker.Controllers
|
|||||||
}
|
}
|
||||||
return PartialView("_TaxRecords", result);
|
return PartialView("_TaxRecords", result);
|
||||||
}
|
}
|
||||||
|
private void UpdateRecurringTaxes(int vehicleId)
|
||||||
|
{
|
||||||
|
var result = _taxRecordDataAccess.GetTaxRecordsByVehicleId(vehicleId);
|
||||||
|
var recurringFees = result.Where(x => x.IsRecurring);
|
||||||
|
if (recurringFees.Any())
|
||||||
|
{
|
||||||
|
foreach(TaxRecord recurringFee in recurringFees)
|
||||||
|
{
|
||||||
|
var newDate = recurringFee.Date.AddMonths((int)recurringFee.RecurringInterval);
|
||||||
|
if (DateTime.Now > newDate){
|
||||||
|
recurringFee.IsRecurring = false;
|
||||||
|
var newRecurringFee = new TaxRecord()
|
||||||
|
{
|
||||||
|
VehicleId = recurringFee.VehicleId,
|
||||||
|
Date = newDate,
|
||||||
|
Description = recurringFee.Description,
|
||||||
|
Cost = recurringFee.Cost,
|
||||||
|
IsRecurring = true,
|
||||||
|
Notes = recurringFee.Notes,
|
||||||
|
RecurringInterval = recurringFee.RecurringInterval,
|
||||||
|
Files = recurringFee.Files,
|
||||||
|
Tags = recurringFee.Tags
|
||||||
|
};
|
||||||
|
_taxRecordDataAccess.SaveTaxRecordToVehicle(recurringFee);
|
||||||
|
_taxRecordDataAccess.SaveTaxRecordToVehicle(newRecurringFee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult SaveTaxRecordToVehicleId(TaxRecordInput taxRecord)
|
public IActionResult SaveTaxRecordToVehicleId(TaxRecordInput taxRecord)
|
||||||
{
|
{
|
||||||
@@ -745,7 +842,10 @@ namespace CarCareTracker.Controllers
|
|||||||
Description = result.Description,
|
Description = result.Description,
|
||||||
Notes = result.Notes,
|
Notes = result.Notes,
|
||||||
VehicleId = result.VehicleId,
|
VehicleId = result.VehicleId,
|
||||||
Files = result.Files
|
IsRecurring = result.IsRecurring,
|
||||||
|
RecurringInterval = result.RecurringInterval,
|
||||||
|
Files = result.Files,
|
||||||
|
Tags = result.Tags
|
||||||
};
|
};
|
||||||
return PartialView("_TaxRecordModal", convertedResult);
|
return PartialView("_TaxRecordModal", convertedResult);
|
||||||
}
|
}
|
||||||
@@ -778,7 +878,7 @@ namespace CarCareTracker.Controllers
|
|||||||
UpgradeRecordSum = upgradeRecords.Sum(x => x.Cost)
|
UpgradeRecordSum = upgradeRecords.Sum(x => x.Cost)
|
||||||
};
|
};
|
||||||
//get costbymonth
|
//get costbymonth
|
||||||
List<CostForVehicleByMonth> allCosts = new List<CostForVehicleByMonth>();
|
List<CostForVehicleByMonth> allCosts = StaticHelper.GetBaseLineCosts();
|
||||||
allCosts.AddRange(_reportHelper.GetServiceRecordSum(serviceRecords, 0));
|
allCosts.AddRange(_reportHelper.GetServiceRecordSum(serviceRecords, 0));
|
||||||
allCosts.AddRange(_reportHelper.GetRepairRecordSum(collisionRecords, 0));
|
allCosts.AddRange(_reportHelper.GetRepairRecordSum(collisionRecords, 0));
|
||||||
allCosts.AddRange(_reportHelper.GetUpgradeRecordSum(upgradeRecords, 0));
|
allCosts.AddRange(_reportHelper.GetUpgradeRecordSum(upgradeRecords, 0));
|
||||||
@@ -829,10 +929,17 @@ namespace CarCareTracker.Controllers
|
|||||||
var userConfig = _config.GetUserConfig(User);
|
var userConfig = _config.GetUserConfig(User);
|
||||||
var mileageData = _gasHelper.GetGasRecordViewModels(gasRecords, userConfig.UseMPG, userConfig.UseUKMPG);
|
var mileageData = _gasHelper.GetGasRecordViewModels(gasRecords, userConfig.UseMPG, userConfig.UseUKMPG);
|
||||||
mileageData.RemoveAll(x => x.MilesPerGallon == default);
|
mileageData.RemoveAll(x => x.MilesPerGallon == default);
|
||||||
var monthlyMileageData = mileageData.GroupBy(x => x.MonthId).OrderBy(x => x.Key).Select(x => new CostForVehicleByMonth
|
var monthlyMileageData = StaticHelper.GetBaseLineCostsNoMonthName();
|
||||||
|
monthlyMileageData.AddRange(mileageData.GroupBy(x => x.MonthId).Select(x => new CostForVehicleByMonth
|
||||||
{
|
{
|
||||||
MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(x.Key),
|
MonthId = x.Key,
|
||||||
Cost = x.Average(y => y.MilesPerGallon)
|
Cost = x.Average(y => y.MilesPerGallon)
|
||||||
|
}));
|
||||||
|
monthlyMileageData = monthlyMileageData.GroupBy(x => x.MonthId).OrderBy(x => x.Key).Select(x => new CostForVehicleByMonth
|
||||||
|
{
|
||||||
|
MonthId = x.Key,
|
||||||
|
MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(x.Key),
|
||||||
|
Cost = x.Sum(y=>y.Cost)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
viewModel.FuelMileageForVehicleByMonth = monthlyMileageData;
|
viewModel.FuelMileageForVehicleByMonth = monthlyMileageData;
|
||||||
return PartialView("_Report", viewModel);
|
return PartialView("_Report", viewModel);
|
||||||
@@ -899,6 +1006,84 @@ namespace CarCareTracker.Controllers
|
|||||||
return PartialView("_ReminderMakeUpReport", viewModel);
|
return PartialView("_ReminderMakeUpReport", viewModel);
|
||||||
}
|
}
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult GetVehicleAttachments(int vehicleId, List<ImportMode> exportTabs)
|
||||||
|
{
|
||||||
|
List<GenericReportModel> attachmentData = new List<GenericReportModel>();
|
||||||
|
if (exportTabs.Contains(ImportMode.ServiceRecord)){
|
||||||
|
var records = _serviceRecordDataAccess.GetServiceRecordsByVehicleId(vehicleId).Where(x=>x.Files.Any());
|
||||||
|
attachmentData.AddRange(records.Select(x => new GenericReportModel
|
||||||
|
{
|
||||||
|
Date = x.Date,
|
||||||
|
Odometer = x.Mileage,
|
||||||
|
Files = x.Files
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (exportTabs.Contains(ImportMode.RepairRecord))
|
||||||
|
{
|
||||||
|
var records = _collisionRecordDataAccess.GetCollisionRecordsByVehicleId(vehicleId).Where(x => x.Files.Any());
|
||||||
|
attachmentData.AddRange(records.Select(x => new GenericReportModel
|
||||||
|
{
|
||||||
|
Date = x.Date,
|
||||||
|
Odometer = x.Mileage,
|
||||||
|
Files = x.Files
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (exportTabs.Contains(ImportMode.UpgradeRecord))
|
||||||
|
{
|
||||||
|
var records = _upgradeRecordDataAccess.GetUpgradeRecordsByVehicleId(vehicleId).Where(x => x.Files.Any());
|
||||||
|
attachmentData.AddRange(records.Select(x => new GenericReportModel
|
||||||
|
{
|
||||||
|
Date = x.Date,
|
||||||
|
Odometer = x.Mileage,
|
||||||
|
Files = x.Files
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (exportTabs.Contains(ImportMode.GasRecord))
|
||||||
|
{
|
||||||
|
var records = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId).Where(x => x.Files.Any());
|
||||||
|
attachmentData.AddRange(records.Select(x => new GenericReportModel
|
||||||
|
{
|
||||||
|
Date = x.Date,
|
||||||
|
Odometer = x.Mileage,
|
||||||
|
Files = x.Files
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (exportTabs.Contains(ImportMode.TaxRecord))
|
||||||
|
{
|
||||||
|
var records = _taxRecordDataAccess.GetTaxRecordsByVehicleId(vehicleId).Where(x => x.Files.Any());
|
||||||
|
attachmentData.AddRange(records.Select(x => new GenericReportModel
|
||||||
|
{
|
||||||
|
Date = x.Date,
|
||||||
|
Odometer = 0,
|
||||||
|
Files = x.Files
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (exportTabs.Contains(ImportMode.OdometerRecord))
|
||||||
|
{
|
||||||
|
var records = _odometerRecordDataAccess.GetOdometerRecordsByVehicleId(vehicleId).Where(x => x.Files.Any());
|
||||||
|
attachmentData.AddRange(records.Select(x => new GenericReportModel
|
||||||
|
{
|
||||||
|
Date = x.Date,
|
||||||
|
Odometer = x.Mileage,
|
||||||
|
Files = x.Files
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
if (attachmentData.Any())
|
||||||
|
{
|
||||||
|
attachmentData = attachmentData.OrderBy(x => x.Date).ThenBy(x => x.Odometer).ToList();
|
||||||
|
var result = _fileHelper.MakeAttachmentsExport(attachmentData);
|
||||||
|
if (string.IsNullOrWhiteSpace(result))
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = false, Message = StaticHelper.GenericErrorMessage });
|
||||||
|
}
|
||||||
|
return Json(new OperationResponse { Success = true, Message = result });
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = false, Message = "No Attachments Found" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
public IActionResult GetVehicleHistory(int vehicleId)
|
public IActionResult GetVehicleHistory(int vehicleId)
|
||||||
{
|
{
|
||||||
var vehicleHistory = new VehicleHistoryViewModel();
|
var vehicleHistory = new VehicleHistoryViewModel();
|
||||||
@@ -912,15 +1097,28 @@ namespace CarCareTracker.Controllers
|
|||||||
var gasRecords = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId);
|
var gasRecords = _gasRecordDataAccess.GetGasRecordsByVehicleId(vehicleId);
|
||||||
bool useMPG = _config.GetUserConfig(User).UseMPG;
|
bool useMPG = _config.GetUserConfig(User).UseMPG;
|
||||||
bool useUKMPG = _config.GetUserConfig(User).UseUKMPG;
|
bool useUKMPG = _config.GetUserConfig(User).UseUKMPG;
|
||||||
|
string preferredFuelMileageUnit = _config.GetUserConfig(User).PreferredGasMileageUnit;
|
||||||
vehicleHistory.TotalGasCost = gasRecords.Sum(x => x.Cost);
|
vehicleHistory.TotalGasCost = gasRecords.Sum(x => x.Cost);
|
||||||
vehicleHistory.TotalCost = serviceRecords.Sum(x => x.Cost) + repairRecords.Sum(x => x.Cost) + upgradeRecords.Sum(x => x.Cost) + taxRecords.Sum(x => x.Cost);
|
vehicleHistory.TotalCost = serviceRecords.Sum(x => x.Cost) + repairRecords.Sum(x => x.Cost) + upgradeRecords.Sum(x => x.Cost) + taxRecords.Sum(x => x.Cost);
|
||||||
var averageMPG = 0.00M;
|
var averageMPG = "0";
|
||||||
var gasViewModels = _gasHelper.GetGasRecordViewModels(gasRecords, useMPG, useUKMPG);
|
var gasViewModels = _gasHelper.GetGasRecordViewModels(gasRecords, useMPG, useUKMPG);
|
||||||
if (gasViewModels.Any())
|
if (gasViewModels.Any())
|
||||||
{
|
{
|
||||||
averageMPG = gasViewModels.Average(x => x.MilesPerGallon);
|
averageMPG = _gasHelper.GetAverageGasMileage(gasViewModels, useMPG);
|
||||||
}
|
}
|
||||||
vehicleHistory.MPG = averageMPG;
|
var fuelEconomyMileageUnit = StaticHelper.GetFuelEconomyUnit(vehicleHistory.VehicleData.IsElectric, vehicleHistory.VehicleData.UseHours, useMPG, useUKMPG);
|
||||||
|
if (fuelEconomyMileageUnit == "l/100km" && preferredFuelMileageUnit == "km/l")
|
||||||
|
{
|
||||||
|
//conversion needed.
|
||||||
|
var newAverageMPG = decimal.Parse(averageMPG, NumberStyles.Any);
|
||||||
|
if (newAverageMPG != 0)
|
||||||
|
{
|
||||||
|
newAverageMPG = 100 / newAverageMPG;
|
||||||
|
}
|
||||||
|
averageMPG = newAverageMPG.ToString("F");
|
||||||
|
fuelEconomyMileageUnit = preferredFuelMileageUnit;
|
||||||
|
}
|
||||||
|
vehicleHistory.MPG = $"{averageMPG} {fuelEconomyMileageUnit}";
|
||||||
//insert servicerecords
|
//insert servicerecords
|
||||||
reportData.AddRange(serviceRecords.Select(x => new GenericReportModel
|
reportData.AddRange(serviceRecords.Select(x => new GenericReportModel
|
||||||
{
|
{
|
||||||
@@ -974,10 +1172,17 @@ namespace CarCareTracker.Controllers
|
|||||||
mileageData.RemoveAll(x => DateTime.Parse(x.Date).Year != year);
|
mileageData.RemoveAll(x => DateTime.Parse(x.Date).Year != year);
|
||||||
}
|
}
|
||||||
mileageData.RemoveAll(x => x.MilesPerGallon == default);
|
mileageData.RemoveAll(x => x.MilesPerGallon == default);
|
||||||
var monthlyMileageData = mileageData.GroupBy(x => x.MonthId).OrderBy(x => x.Key).Select(x => new CostForVehicleByMonth
|
var monthlyMileageData = StaticHelper.GetBaseLineCostsNoMonthName();
|
||||||
|
monthlyMileageData.AddRange(mileageData.GroupBy(x => x.MonthId).Select(x => new CostForVehicleByMonth
|
||||||
{
|
{
|
||||||
MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(x.Key),
|
MonthId = x.Key,
|
||||||
Cost = x.Average(y => y.MilesPerGallon)
|
Cost = x.Average(y => y.MilesPerGallon)
|
||||||
|
}));
|
||||||
|
monthlyMileageData = monthlyMileageData.GroupBy(x => x.MonthId).OrderBy(x => x.Key).Select(x => new CostForVehicleByMonth
|
||||||
|
{
|
||||||
|
MonthId = x.Key,
|
||||||
|
MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(x.Key),
|
||||||
|
Cost = x.Sum(y => y.Cost)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
return PartialView("_MPGByMonthReport", monthlyMileageData);
|
return PartialView("_MPGByMonthReport", monthlyMileageData);
|
||||||
}
|
}
|
||||||
@@ -985,7 +1190,7 @@ namespace CarCareTracker.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult GetCostByMonthByVehicle(int vehicleId, List<ImportMode> selectedMetrics, int year = 0)
|
public IActionResult GetCostByMonthByVehicle(int vehicleId, List<ImportMode> selectedMetrics, int year = 0)
|
||||||
{
|
{
|
||||||
List<CostForVehicleByMonth> allCosts = new List<CostForVehicleByMonth>();
|
List<CostForVehicleByMonth> allCosts = StaticHelper.GetBaseLineCosts();
|
||||||
if (selectedMetrics.Contains(ImportMode.ServiceRecord))
|
if (selectedMetrics.Contains(ImportMode.ServiceRecord))
|
||||||
{
|
{
|
||||||
var serviceRecords = _serviceRecordDataAccess.GetServiceRecordsByVehicleId(vehicleId);
|
var serviceRecords = _serviceRecordDataAccess.GetServiceRecordsByVehicleId(vehicleId);
|
||||||
@@ -1063,32 +1268,24 @@ namespace CarCareTracker.Controllers
|
|||||||
public IActionResult GetVehicleHaveUrgentOrPastDueReminders(int vehicleId)
|
public IActionResult GetVehicleHaveUrgentOrPastDueReminders(int vehicleId)
|
||||||
{
|
{
|
||||||
var result = GetRemindersAndUrgency(vehicleId, DateTime.Now);
|
var result = GetRemindersAndUrgency(vehicleId, DateTime.Now);
|
||||||
//check for past due reminders that are eligible for recurring.
|
//check if user wants auto-refresh past-due reminders
|
||||||
var pastDueAndRecurring = result.Where(x => x.Urgency == ReminderUrgency.PastDue && x.IsRecurring);
|
if (_config.GetUserConfig(User).EnableAutoReminderRefresh)
|
||||||
if (pastDueAndRecurring.Any())
|
|
||||||
{
|
{
|
||||||
foreach (ReminderRecordViewModel reminderRecord in pastDueAndRecurring)
|
//check for past due reminders that are eligible for recurring.
|
||||||
|
var pastDueAndRecurring = result.Where(x => x.Urgency == ReminderUrgency.PastDue && x.IsRecurring);
|
||||||
|
if (pastDueAndRecurring.Any())
|
||||||
{
|
{
|
||||||
//update based on recurring intervals.
|
foreach (ReminderRecordViewModel reminderRecord in pastDueAndRecurring)
|
||||||
//pull reminderRecord based on ID
|
|
||||||
var existingReminder = _reminderRecordDataAccess.GetReminderRecordById(reminderRecord.Id);
|
|
||||||
if (existingReminder.Metric == ReminderMetric.Both)
|
|
||||||
{
|
{
|
||||||
existingReminder.Date = existingReminder.Date.AddMonths((int)existingReminder.ReminderMonthInterval);
|
//update based on recurring intervals.
|
||||||
existingReminder.Mileage += (int)existingReminder.ReminderMileageInterval;
|
//pull reminderRecord based on ID
|
||||||
|
var existingReminder = _reminderRecordDataAccess.GetReminderRecordById(reminderRecord.Id);
|
||||||
|
existingReminder = _reminderHelper.GetUpdatedRecurringReminderRecord(existingReminder);
|
||||||
|
//save to db.
|
||||||
|
_reminderRecordDataAccess.SaveReminderRecordToVehicle(existingReminder);
|
||||||
|
//set urgency to not urgent so it gets excluded in count.
|
||||||
|
reminderRecord.Urgency = ReminderUrgency.NotUrgent;
|
||||||
}
|
}
|
||||||
else if (existingReminder.Metric == ReminderMetric.Odometer)
|
|
||||||
{
|
|
||||||
existingReminder.Mileage += (int)existingReminder.ReminderMileageInterval;
|
|
||||||
}
|
|
||||||
else if (existingReminder.Metric == ReminderMetric.Date)
|
|
||||||
{
|
|
||||||
existingReminder.Date = existingReminder.Date.AddMonths((int)existingReminder.ReminderMonthInterval);
|
|
||||||
}
|
|
||||||
//save to db.
|
|
||||||
_reminderRecordDataAccess.SaveReminderRecordToVehicle(existingReminder);
|
|
||||||
//set urgency to not urgent so it gets excluded in count.
|
|
||||||
reminderRecord.Urgency = ReminderUrgency.NotUrgent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//check for very urgent or past due reminders that were not eligible for recurring.
|
//check for very urgent or past due reminders that were not eligible for recurring.
|
||||||
@@ -1108,6 +1305,15 @@ namespace CarCareTracker.Controllers
|
|||||||
return PartialView("_ReminderRecords", result);
|
return PartialView("_ReminderRecords", result);
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
public IActionResult PushbackRecurringReminderRecord(int reminderRecordId)
|
||||||
|
{
|
||||||
|
var existingReminder = _reminderRecordDataAccess.GetReminderRecordById(reminderRecordId);
|
||||||
|
existingReminder = _reminderHelper.GetUpdatedRecurringReminderRecord(existingReminder);
|
||||||
|
//save to db.
|
||||||
|
var result = _reminderRecordDataAccess.SaveReminderRecordToVehicle(existingReminder);
|
||||||
|
return Json(result);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
public IActionResult SaveReminderRecordToVehicleId(ReminderRecordInput reminderRecord)
|
public IActionResult SaveReminderRecordToVehicleId(ReminderRecordInput reminderRecord)
|
||||||
{
|
{
|
||||||
var result = _reminderRecordDataAccess.SaveReminderRecordToVehicle(reminderRecord.ToReminderRecord());
|
var result = _reminderRecordDataAccess.SaveReminderRecordToVehicle(reminderRecord.ToReminderRecord());
|
||||||
@@ -1141,7 +1347,8 @@ namespace CarCareTracker.Controllers
|
|||||||
Metric = result.Metric,
|
Metric = result.Metric,
|
||||||
IsRecurring = result.IsRecurring,
|
IsRecurring = result.IsRecurring,
|
||||||
ReminderMileageInterval = result.ReminderMileageInterval,
|
ReminderMileageInterval = result.ReminderMileageInterval,
|
||||||
ReminderMonthInterval = result.ReminderMonthInterval
|
ReminderMonthInterval = result.ReminderMonthInterval,
|
||||||
|
CustomMileageInterval = result.CustomMileageInterval
|
||||||
};
|
};
|
||||||
return PartialView("_ReminderRecordModal", convertedResult);
|
return PartialView("_ReminderRecordModal", convertedResult);
|
||||||
}
|
}
|
||||||
@@ -1172,9 +1379,23 @@ namespace CarCareTracker.Controllers
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult SaveUpgradeRecordToVehicleId(UpgradeRecordInput upgradeRecord)
|
public IActionResult SaveUpgradeRecordToVehicleId(UpgradeRecordInput upgradeRecord)
|
||||||
{
|
{
|
||||||
|
if (upgradeRecord.Id == default && _config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(new OdometerRecord
|
||||||
|
{
|
||||||
|
Date = DateTime.Parse(upgradeRecord.Date),
|
||||||
|
VehicleId = upgradeRecord.VehicleId,
|
||||||
|
Mileage = upgradeRecord.Mileage,
|
||||||
|
Notes = $"Auto Insert From Upgrade Record: {upgradeRecord.Description}"
|
||||||
|
});
|
||||||
|
}
|
||||||
//move files from temp.
|
//move files from temp.
|
||||||
upgradeRecord.Files = upgradeRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
upgradeRecord.Files = upgradeRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
||||||
var result = _upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(upgradeRecord.ToUpgradeRecord());
|
var result = _upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(upgradeRecord.ToUpgradeRecord());
|
||||||
|
if (result && upgradeRecord.Supplies.Any())
|
||||||
|
{
|
||||||
|
RequisitionSupplyRecordsByUsage(upgradeRecord.Supplies);
|
||||||
|
}
|
||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -1196,7 +1417,8 @@ namespace CarCareTracker.Controllers
|
|||||||
Mileage = result.Mileage,
|
Mileage = result.Mileage,
|
||||||
Notes = result.Notes,
|
Notes = result.Notes,
|
||||||
VehicleId = result.VehicleId,
|
VehicleId = result.VehicleId,
|
||||||
Files = result.Files
|
Files = result.Files,
|
||||||
|
Tags = result.Tags
|
||||||
};
|
};
|
||||||
return PartialView("_UpgradeRecordModal", convertedResult);
|
return PartialView("_UpgradeRecordModal", convertedResult);
|
||||||
}
|
}
|
||||||
@@ -1213,8 +1435,17 @@ namespace CarCareTracker.Controllers
|
|||||||
public IActionResult GetNotesByVehicleId(int vehicleId)
|
public IActionResult GetNotesByVehicleId(int vehicleId)
|
||||||
{
|
{
|
||||||
var result = _noteDataAccess.GetNotesByVehicleId(vehicleId);
|
var result = _noteDataAccess.GetNotesByVehicleId(vehicleId);
|
||||||
|
result = result.OrderByDescending(x => x.Pinned).ToList();
|
||||||
return PartialView("_Notes", result);
|
return PartialView("_Notes", result);
|
||||||
}
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetPinnedNotesByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
var result = _noteDataAccess.GetNotesByVehicleId(vehicleId);
|
||||||
|
result = result.Where(x=>x.Pinned).ToList();
|
||||||
|
return Json(result);
|
||||||
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult SaveNoteToVehicleId(Note note)
|
public IActionResult SaveNoteToVehicleId(Note note)
|
||||||
{
|
{
|
||||||
@@ -1240,6 +1471,36 @@ namespace CarCareTracker.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region "Supply Records"
|
#region "Supply Records"
|
||||||
|
private List<string> CheckSupplyRecordsAvailability(List<SupplyUsage> supplyUsage)
|
||||||
|
{
|
||||||
|
//returns empty string if all supplies are available
|
||||||
|
var result = new List<string>();
|
||||||
|
foreach (SupplyUsage supply in supplyUsage)
|
||||||
|
{
|
||||||
|
//get supply record.
|
||||||
|
var supplyData = _supplyRecordDataAccess.GetSupplyRecordById(supply.SupplyId);
|
||||||
|
if (supply.Quantity > supplyData.Quantity)
|
||||||
|
{
|
||||||
|
result.Add($"Insufficient Quantity for {supplyData.Description}, need: {supply.Quantity}, available: {supplyData.Quantity}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private void RequisitionSupplyRecordsByUsage(List<SupplyUsage> supplyUsage)
|
||||||
|
{
|
||||||
|
foreach(SupplyUsage supply in supplyUsage)
|
||||||
|
{
|
||||||
|
//get supply record.
|
||||||
|
var result = _supplyRecordDataAccess.GetSupplyRecordById(supply.SupplyId);
|
||||||
|
var unitCost = (result.Quantity != 0 ) ? result.Cost / result.Quantity : 0;
|
||||||
|
//deduct quantity used.
|
||||||
|
result.Quantity -= supply.Quantity;
|
||||||
|
//deduct cost.
|
||||||
|
result.Cost -= (supply.Quantity * unitCost);
|
||||||
|
//save
|
||||||
|
_supplyRecordDataAccess.SaveSupplyRecordToVehicle(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
[TypeFilter(typeof(CollaboratorFilter))]
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetSupplyRecordsByVehicleId(int vehicleId)
|
public IActionResult GetSupplyRecordsByVehicleId(int vehicleId)
|
||||||
@@ -1256,6 +1517,23 @@ namespace CarCareTracker.Controllers
|
|||||||
}
|
}
|
||||||
return PartialView("_SupplyRecords", result);
|
return PartialView("_SupplyRecords", result);
|
||||||
}
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetSupplyRecordsForRecordsByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
var result = _supplyRecordDataAccess.GetSupplyRecordsByVehicleId(vehicleId);
|
||||||
|
result.RemoveAll(x => x.Quantity <= 0);
|
||||||
|
bool _useDescending = _config.GetUserConfig(User).UseDescending;
|
||||||
|
if (_useDescending)
|
||||||
|
{
|
||||||
|
result = result.OrderByDescending(x => x.Date).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = result.OrderBy(x => x.Date).ToList();
|
||||||
|
}
|
||||||
|
return PartialView("_SupplyUsage", result);
|
||||||
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult SaveSupplyRecordToVehicleId(SupplyRecordInput supplyRecord)
|
public IActionResult SaveSupplyRecordToVehicleId(SupplyRecordInput supplyRecord)
|
||||||
{
|
{
|
||||||
@@ -1316,8 +1594,66 @@ namespace CarCareTracker.Controllers
|
|||||||
//move files from temp.
|
//move files from temp.
|
||||||
planRecord.Files = planRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
planRecord.Files = planRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
||||||
var result = _planRecordDataAccess.SavePlanRecordToVehicle(planRecord.ToPlanRecord());
|
var result = _planRecordDataAccess.SavePlanRecordToVehicle(planRecord.ToPlanRecord());
|
||||||
|
if (result && planRecord.Supplies.Any())
|
||||||
|
{
|
||||||
|
RequisitionSupplyRecordsByUsage(planRecord.Supplies);
|
||||||
|
}
|
||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult SavePlanRecordTemplateToVehicleId(PlanRecordInput planRecord)
|
||||||
|
{
|
||||||
|
//check if template name already taken.
|
||||||
|
var existingRecord = _planRecordTemplateDataAccess.GetPlanRecordTemplatesByVehicleId(planRecord.VehicleId).Where(x=>x.Description == planRecord.Description).Any();
|
||||||
|
if (existingRecord)
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = false, Message = "A template with that description already exists for this vehicle"});
|
||||||
|
}
|
||||||
|
planRecord.Files = planRecord.Files.Select(x => { return new UploadedFiles { Name = x.Name, Location = _fileHelper.MoveFileFromTemp(x.Location, "documents/") }; }).ToList();
|
||||||
|
var result = _planRecordTemplateDataAccess.SavePlanRecordTemplateToVehicle(planRecord);
|
||||||
|
return Json(new OperationResponse { Success = result, Message = result ? "Template Added" : StaticHelper.GenericErrorMessage });
|
||||||
|
}
|
||||||
|
[TypeFilter(typeof(CollaboratorFilter))]
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult GetPlanRecordTemplatesForVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
var result = _planRecordTemplateDataAccess.GetPlanRecordTemplatesByVehicleId(vehicleId);
|
||||||
|
return PartialView("_PlanRecordTemplateModal", result);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult DeletePlanRecordTemplateById(int planRecordTemplateId)
|
||||||
|
{
|
||||||
|
var result = _planRecordTemplateDataAccess.DeletePlanRecordTemplateById(planRecordTemplateId);
|
||||||
|
return Json(result);
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult ConvertPlanRecordTemplateToPlanRecord(int planRecordTemplateId)
|
||||||
|
{
|
||||||
|
var existingRecord = _planRecordTemplateDataAccess.GetPlanRecordTemplateById(planRecordTemplateId);
|
||||||
|
if (existingRecord.Id == default)
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = false, Message = "Unable to find template" });
|
||||||
|
}
|
||||||
|
if (existingRecord.Supplies.Any())
|
||||||
|
{
|
||||||
|
//check if all supplies are available
|
||||||
|
var supplyAvailability = CheckSupplyRecordsAvailability(existingRecord.Supplies);
|
||||||
|
if (supplyAvailability.Any())
|
||||||
|
{
|
||||||
|
return Json(new OperationResponse { Success = false, Message = string.Join("<br>", supplyAvailability) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//populate createdDate
|
||||||
|
existingRecord.DateCreated = DateTime.Now.ToString("G");
|
||||||
|
existingRecord.DateModified = DateTime.Now.ToString("G");
|
||||||
|
existingRecord.Id = default;
|
||||||
|
var result = _planRecordDataAccess.SavePlanRecordToVehicle(existingRecord.ToPlanRecord());
|
||||||
|
if (result && existingRecord.Supplies.Any())
|
||||||
|
{
|
||||||
|
RequisitionSupplyRecordsByUsage(existingRecord.Supplies);
|
||||||
|
}
|
||||||
|
return Json(new OperationResponse { Success = result, Message = result ? "Plan Record Added" : StaticHelper.GenericErrorMessage });
|
||||||
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetAddPlanRecordPartialView()
|
public IActionResult GetAddPlanRecordPartialView()
|
||||||
{
|
{
|
||||||
@@ -1332,6 +1668,16 @@ namespace CarCareTracker.Controllers
|
|||||||
var result = _planRecordDataAccess.SavePlanRecordToVehicle(existingRecord);
|
var result = _planRecordDataAccess.SavePlanRecordToVehicle(existingRecord);
|
||||||
if (planProgress == PlanProgress.Done)
|
if (planProgress == PlanProgress.Done)
|
||||||
{
|
{
|
||||||
|
if (_config.GetUserConfig(User).EnableAutoOdometerInsert)
|
||||||
|
{
|
||||||
|
_odometerRecordDataAccess.SaveOdometerRecordToVehicle(new OdometerRecord
|
||||||
|
{
|
||||||
|
Date = DateTime.Now,
|
||||||
|
VehicleId = existingRecord.VehicleId,
|
||||||
|
Mileage = odometer,
|
||||||
|
Notes = $"Auto Insert From Plan Record: {existingRecord.Description}"
|
||||||
|
});
|
||||||
|
}
|
||||||
//convert plan record to service/upgrade/repair record.
|
//convert plan record to service/upgrade/repair record.
|
||||||
if (existingRecord.ImportMode == ImportMode.ServiceRecord)
|
if (existingRecord.ImportMode == ImportMode.ServiceRecord)
|
||||||
{
|
{
|
||||||
@@ -1448,7 +1794,8 @@ namespace CarCareTracker.Controllers
|
|||||||
Mileage = result.Mileage,
|
Mileage = result.Mileage,
|
||||||
Notes = result.Notes,
|
Notes = result.Notes,
|
||||||
VehicleId = result.VehicleId,
|
VehicleId = result.VehicleId,
|
||||||
Files = result.Files
|
Files = result.Files,
|
||||||
|
Tags = result.Tags
|
||||||
};
|
};
|
||||||
return PartialView("_OdometerRecordModal", convertedResult);
|
return PartialView("_OdometerRecordModal", convertedResult);
|
||||||
}
|
}
|
||||||
@@ -1459,5 +1806,55 @@ namespace CarCareTracker.Controllers
|
|||||||
return Json(result);
|
return Json(result);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
#region "Shared Methods"
|
||||||
|
public IActionResult MoveRecord(int recordId, ImportMode source, ImportMode destination)
|
||||||
|
{
|
||||||
|
var genericRecord = new GenericRecord();
|
||||||
|
bool result = false;
|
||||||
|
//get
|
||||||
|
switch (source)
|
||||||
|
{
|
||||||
|
case ImportMode.ServiceRecord:
|
||||||
|
genericRecord = _serviceRecordDataAccess.GetServiceRecordById(recordId);
|
||||||
|
break;
|
||||||
|
case ImportMode.RepairRecord:
|
||||||
|
genericRecord = _collisionRecordDataAccess.GetCollisionRecordById(recordId);
|
||||||
|
break;
|
||||||
|
case ImportMode.UpgradeRecord:
|
||||||
|
genericRecord = _upgradeRecordDataAccess.GetUpgradeRecordById(recordId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//save
|
||||||
|
switch (destination)
|
||||||
|
{
|
||||||
|
case ImportMode.ServiceRecord:
|
||||||
|
result = _serviceRecordDataAccess.SaveServiceRecordToVehicle(StaticHelper.GenericToServiceRecord(genericRecord));
|
||||||
|
break;
|
||||||
|
case ImportMode.RepairRecord:
|
||||||
|
result = _collisionRecordDataAccess.SaveCollisionRecordToVehicle(StaticHelper.GenericToRepairRecord(genericRecord));
|
||||||
|
break;
|
||||||
|
case ImportMode.UpgradeRecord:
|
||||||
|
result = _upgradeRecordDataAccess.SaveUpgradeRecordToVehicle(StaticHelper.GenericToUpgradeRecord(genericRecord));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//delete
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
switch (source)
|
||||||
|
{
|
||||||
|
case ImportMode.ServiceRecord:
|
||||||
|
_serviceRecordDataAccess.DeleteServiceRecordById(recordId);
|
||||||
|
break;
|
||||||
|
case ImportMode.RepairRecord:
|
||||||
|
_collisionRecordDataAccess.DeleteCollisionRecordById(recordId);
|
||||||
|
break;
|
||||||
|
case ImportMode.UpgradeRecord:
|
||||||
|
_upgradeRecordDataAccess.DeleteUpgradeRecordById(recordId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Json(result);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,23 @@
|
|||||||
{
|
{
|
||||||
public enum ReminderMileageInterval
|
public enum ReminderMileageInterval
|
||||||
{
|
{
|
||||||
|
Other = 0,
|
||||||
|
FiftyMiles = 50,
|
||||||
|
OneHundredMiles = 100,
|
||||||
FiveHundredMiles = 500,
|
FiveHundredMiles = 500,
|
||||||
OneThousandMiles = 1000,
|
OneThousandMiles = 1000,
|
||||||
ThreeThousandMiles = 3000,
|
ThreeThousandMiles = 3000,
|
||||||
|
FourThousandMiles = 4000,
|
||||||
FiveThousandMiles = 5000,
|
FiveThousandMiles = 5000,
|
||||||
SevenThousandFiveHundredMiles = 7500,
|
SevenThousandFiveHundredMiles = 7500,
|
||||||
TenThousandMiles = 10000,
|
TenThousandMiles = 10000,
|
||||||
FiftyThousandMiles = 50000
|
FifteenThousandMiles = 15000,
|
||||||
|
TwentyThousandMiles = 20000,
|
||||||
|
ThirtyThousandMiles = 30000,
|
||||||
|
FortyThousandMiles = 40000,
|
||||||
|
FiftyThousandMiles = 50000,
|
||||||
|
SixtyThousandMiles = 60000,
|
||||||
|
OneHundredThousandMiles = 100000,
|
||||||
|
OneHundredFiftyThousandMiles = 150000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
{
|
{
|
||||||
public enum ReminderMonthInterval
|
public enum ReminderMonthInterval
|
||||||
{
|
{
|
||||||
|
OneMonth = 1,
|
||||||
ThreeMonths = 3,
|
ThreeMonths = 3,
|
||||||
SixMonths = 6,
|
SixMonths = 6,
|
||||||
OneYear = 12,
|
OneYear = 12,
|
||||||
|
TwoYears = 24,
|
||||||
|
ThreeYears = 36,
|
||||||
FiveYears = 60
|
FiveYears = 60
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
57
External/Implementations/PlanRecordTemplateDataAccess.cs
vendored
Normal file
57
External/Implementations/PlanRecordTemplateDataAccess.cs
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
using CarCareTracker.External.Interfaces;
|
||||||
|
using CarCareTracker.Helper;
|
||||||
|
using CarCareTracker.Models;
|
||||||
|
using LiteDB;
|
||||||
|
|
||||||
|
namespace CarCareTracker.External.Implementations
|
||||||
|
{
|
||||||
|
public class PlanRecordTemplateDataAccess : IPlanRecordTemplateDataAccess
|
||||||
|
{
|
||||||
|
private static string dbName = StaticHelper.DbName;
|
||||||
|
private static string tableName = "planrecordtemplates";
|
||||||
|
public List<PlanRecordInput> GetPlanRecordTemplatesByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
using (var db = new LiteDatabase(dbName))
|
||||||
|
{
|
||||||
|
var table = db.GetCollection<PlanRecordInput>(tableName);
|
||||||
|
var planRecords = table.Find(Query.EQ(nameof(PlanRecordInput.VehicleId), vehicleId));
|
||||||
|
return planRecords.ToList() ?? new List<PlanRecordInput>();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public PlanRecordInput GetPlanRecordTemplateById(int planRecordId)
|
||||||
|
{
|
||||||
|
using (var db = new LiteDatabase(dbName))
|
||||||
|
{
|
||||||
|
var table = db.GetCollection<PlanRecordInput>(tableName);
|
||||||
|
return table.FindById(planRecordId);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public bool DeletePlanRecordTemplateById(int planRecordId)
|
||||||
|
{
|
||||||
|
using (var db = new LiteDatabase(dbName))
|
||||||
|
{
|
||||||
|
var table = db.GetCollection<PlanRecordInput>(tableName);
|
||||||
|
table.Delete(planRecordId);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public bool SavePlanRecordTemplateToVehicle(PlanRecordInput planRecord)
|
||||||
|
{
|
||||||
|
using (var db = new LiteDatabase(dbName))
|
||||||
|
{
|
||||||
|
var table = db.GetCollection<PlanRecordInput>(tableName);
|
||||||
|
table.Upsert(planRecord);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public bool DeleteAllPlanRecordTemplatesByVehicleId(int vehicleId)
|
||||||
|
{
|
||||||
|
using (var db = new LiteDatabase(dbName))
|
||||||
|
{
|
||||||
|
var table = db.GetCollection<PlanRecord>(tableName);
|
||||||
|
var planRecords = table.DeleteMany(Query.EQ(nameof(PlanRecordInput.VehicleId), vehicleId));
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
External/Interfaces/IPlanRecordTemplateDataAccess.cs
vendored
Normal file
13
External/Interfaces/IPlanRecordTemplateDataAccess.cs
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using CarCareTracker.Models;
|
||||||
|
|
||||||
|
namespace CarCareTracker.External.Interfaces
|
||||||
|
{
|
||||||
|
public interface IPlanRecordTemplateDataAccess
|
||||||
|
{
|
||||||
|
public List<PlanRecordInput> GetPlanRecordTemplatesByVehicleId(int vehicleId);
|
||||||
|
public PlanRecordInput GetPlanRecordTemplateById(int planRecordId);
|
||||||
|
public bool DeletePlanRecordTemplateById(int planRecordId);
|
||||||
|
public bool SavePlanRecordTemplateToVehicle(PlanRecordInput planRecord);
|
||||||
|
public bool DeleteAllPlanRecordTemplatesByVehicleId(int vehicleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ namespace CarCareTracker.Helper
|
|||||||
{
|
{
|
||||||
UserConfig GetUserConfig(ClaimsPrincipal user);
|
UserConfig GetUserConfig(ClaimsPrincipal user);
|
||||||
bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData);
|
bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData);
|
||||||
|
string GetLogoUrl();
|
||||||
|
string GetServerLanguage();
|
||||||
public bool DeleteUserConfig(int userId);
|
public bool DeleteUserConfig(int userId);
|
||||||
}
|
}
|
||||||
public class ConfigHelper : IConfigHelper
|
public class ConfigHelper : IConfigHelper
|
||||||
@@ -24,6 +26,20 @@ namespace CarCareTracker.Helper
|
|||||||
_userConfig = userConfig;
|
_userConfig = userConfig;
|
||||||
_cache = memoryCache;
|
_cache = memoryCache;
|
||||||
}
|
}
|
||||||
|
public string GetLogoUrl()
|
||||||
|
{
|
||||||
|
var logoUrl = _config["LUBELOGGER_LOGO_URL"];
|
||||||
|
if (string.IsNullOrWhiteSpace(logoUrl))
|
||||||
|
{
|
||||||
|
logoUrl = "/defaults/lubelogger_logo.png";
|
||||||
|
}
|
||||||
|
return logoUrl;
|
||||||
|
}
|
||||||
|
public string GetServerLanguage()
|
||||||
|
{
|
||||||
|
var serverLanguage = _config[nameof(UserConfig.UserLanguage)] ?? "en_US";
|
||||||
|
return serverLanguage;
|
||||||
|
}
|
||||||
public bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData)
|
public bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData)
|
||||||
{
|
{
|
||||||
var storedUserId = user.FindFirstValue(ClaimTypes.NameIdentifier);
|
var storedUserId = user.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||||
@@ -94,7 +110,13 @@ namespace CarCareTracker.Helper
|
|||||||
EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]),
|
EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]),
|
||||||
HideZero = bool.Parse(_config[nameof(UserConfig.HideZero)]),
|
HideZero = bool.Parse(_config[nameof(UserConfig.HideZero)]),
|
||||||
UseUKMPG = bool.Parse(_config[nameof(UserConfig.UseUKMPG)]),
|
UseUKMPG = bool.Parse(_config[nameof(UserConfig.UseUKMPG)]),
|
||||||
|
UseMarkDownOnSavedNotes = bool.Parse(_config[nameof(UserConfig.UseMarkDownOnSavedNotes)]),
|
||||||
UseThreeDecimalGasCost = bool.Parse(_config[nameof(UserConfig.UseThreeDecimalGasCost)]),
|
UseThreeDecimalGasCost = bool.Parse(_config[nameof(UserConfig.UseThreeDecimalGasCost)]),
|
||||||
|
EnableAutoReminderRefresh = bool.Parse(_config[nameof(UserConfig.EnableAutoReminderRefresh)]),
|
||||||
|
EnableAutoOdometerInsert = bool.Parse(_config[nameof(UserConfig.EnableAutoOdometerInsert)]),
|
||||||
|
PreferredGasMileageUnit = _config[nameof(UserConfig.PreferredGasMileageUnit)],
|
||||||
|
PreferredGasUnit = _config[nameof(UserConfig.PreferredGasUnit)],
|
||||||
|
UserLanguage = _config[nameof(UserConfig.UserLanguage)],
|
||||||
VisibleTabs = _config.GetSection("VisibleTabs").Get<List<ImportMode>>(),
|
VisibleTabs = _config.GetSection("VisibleTabs").Get<List<ImportMode>>(),
|
||||||
DefaultTab = (ImportMode)int.Parse(_config[nameof(UserConfig.DefaultTab)])
|
DefaultTab = (ImportMode)int.Parse(_config[nameof(UserConfig.DefaultTab)])
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.IO.Compression;
|
using CarCareTracker.Models;
|
||||||
|
using System.IO.Compression;
|
||||||
|
|
||||||
namespace CarCareTracker.Helper
|
namespace CarCareTracker.Helper
|
||||||
{
|
{
|
||||||
@@ -6,9 +7,12 @@ namespace CarCareTracker.Helper
|
|||||||
{
|
{
|
||||||
string GetFullFilePath(string currentFilePath, bool mustExist = true);
|
string GetFullFilePath(string currentFilePath, bool mustExist = true);
|
||||||
string MoveFileFromTemp(string currentFilePath, string newFolder);
|
string MoveFileFromTemp(string currentFilePath, string newFolder);
|
||||||
|
bool RenameFile(string currentFilePath, string newName);
|
||||||
bool DeleteFile(string currentFilePath);
|
bool DeleteFile(string currentFilePath);
|
||||||
string MakeBackup();
|
string MakeBackup();
|
||||||
bool RestoreBackup(string fileName);
|
bool RestoreBackup(string fileName, bool clearExisting = false);
|
||||||
|
string MakeAttachmentsExport(List<GenericReportModel> exportData);
|
||||||
|
List<string> GetLanguages();
|
||||||
}
|
}
|
||||||
public class FileHelper : IFileHelper
|
public class FileHelper : IFileHelper
|
||||||
{
|
{
|
||||||
@@ -19,6 +23,40 @@ namespace CarCareTracker.Helper
|
|||||||
_webEnv = webEnv;
|
_webEnv = webEnv;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
public List<string> GetLanguages()
|
||||||
|
{
|
||||||
|
var languagePath = Path.Combine(_webEnv.WebRootPath, "translations");
|
||||||
|
var defaultList = new List<string>() { "en_US" };
|
||||||
|
if (Directory.Exists(languagePath))
|
||||||
|
{
|
||||||
|
var listOfLanguages = Directory.GetFiles(languagePath);
|
||||||
|
if (listOfLanguages.Any())
|
||||||
|
{
|
||||||
|
defaultList.AddRange(listOfLanguages.Select(x => Path.GetFileNameWithoutExtension(x)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultList;
|
||||||
|
}
|
||||||
|
public bool RenameFile(string currentFilePath, string newName)
|
||||||
|
{
|
||||||
|
var fullFilePath = GetFullFilePath(currentFilePath);
|
||||||
|
if (!string.IsNullOrWhiteSpace(fullFilePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var originalFileName = Path.GetFileNameWithoutExtension(fullFilePath);
|
||||||
|
var newFilePath = fullFilePath.Replace(originalFileName, newName);
|
||||||
|
File.Move(fullFilePath, newFilePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public string GetFullFilePath(string currentFilePath, bool mustExist = true)
|
public string GetFullFilePath(string currentFilePath, bool mustExist = true)
|
||||||
{
|
{
|
||||||
if (currentFilePath.StartsWith("/"))
|
if (currentFilePath.StartsWith("/"))
|
||||||
@@ -38,7 +76,7 @@ namespace CarCareTracker.Helper
|
|||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool RestoreBackup(string fileName)
|
public bool RestoreBackup(string fileName, bool clearExisting = false)
|
||||||
{
|
{
|
||||||
var fullFilePath = GetFullFilePath(fileName);
|
var fullFilePath = GetFullFilePath(fileName);
|
||||||
if (string.IsNullOrWhiteSpace(fullFilePath))
|
if (string.IsNullOrWhiteSpace(fullFilePath))
|
||||||
@@ -64,9 +102,17 @@ namespace CarCareTracker.Helper
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(existingPath);
|
Directory.CreateDirectory(existingPath);
|
||||||
}
|
}
|
||||||
|
else if (clearExisting)
|
||||||
|
{
|
||||||
|
var filesToDelete = Directory.GetFiles(existingPath);
|
||||||
|
foreach (string file in filesToDelete)
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
//copy each files from temp folder to newPath
|
//copy each files from temp folder to newPath
|
||||||
var filesToUpload = Directory.GetFiles(imagePath);
|
var filesToUpload = Directory.GetFiles(imagePath);
|
||||||
foreach(string file in filesToUpload)
|
foreach (string file in filesToUpload)
|
||||||
{
|
{
|
||||||
File.Copy(file, $"{existingPath}/{Path.GetFileName(file)}", true);
|
File.Copy(file, $"{existingPath}/{Path.GetFileName(file)}", true);
|
||||||
}
|
}
|
||||||
@@ -78,6 +124,14 @@ namespace CarCareTracker.Helper
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(existingPath);
|
Directory.CreateDirectory(existingPath);
|
||||||
}
|
}
|
||||||
|
else if (clearExisting)
|
||||||
|
{
|
||||||
|
var filesToDelete = Directory.GetFiles(existingPath);
|
||||||
|
foreach (string file in filesToDelete)
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
//copy each files from temp folder to newPath
|
//copy each files from temp folder to newPath
|
||||||
var filesToUpload = Directory.GetFiles(documentPath);
|
var filesToUpload = Directory.GetFiles(documentPath);
|
||||||
foreach (string file in filesToUpload)
|
foreach (string file in filesToUpload)
|
||||||
@@ -100,12 +154,37 @@ namespace CarCareTracker.Helper
|
|||||||
File.Move(configPath, StaticHelper.UserConfigPath, true);
|
File.Move(configPath, StaticHelper.UserConfigPath, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception ex)
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, $"Error Restoring Database Backup: {ex.Message}");
|
_logger.LogError(ex, $"Error Restoring Database Backup: {ex.Message}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string MakeAttachmentsExport(List<GenericReportModel> exportData)
|
||||||
|
{
|
||||||
|
var folderName = Guid.NewGuid();
|
||||||
|
var tempPath = Path.Combine(_webEnv.WebRootPath, $"temp/{folderName}");
|
||||||
|
if (!Directory.Exists(tempPath))
|
||||||
|
Directory.CreateDirectory(tempPath);
|
||||||
|
int fileIndex = 0;
|
||||||
|
foreach (GenericReportModel reportModel in exportData)
|
||||||
|
{
|
||||||
|
foreach (UploadedFiles file in reportModel.Files)
|
||||||
|
{
|
||||||
|
var fileToCopy = GetFullFilePath(file.Location);
|
||||||
|
var destFileName = $"{tempPath}/{fileIndex}{Path.GetExtension(file.Location)}";
|
||||||
|
File.Copy(fileToCopy, destFileName);
|
||||||
|
fileIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var destFilePath = $"{tempPath}.zip";
|
||||||
|
ZipFile.CreateFromDirectory(tempPath, destFilePath);
|
||||||
|
//delete temp directory
|
||||||
|
Directory.Delete(tempPath, true);
|
||||||
|
var zipFileName = $"/temp/{folderName}.zip";
|
||||||
|
return zipFileName;
|
||||||
|
}
|
||||||
public string MakeBackup()
|
public string MakeBackup()
|
||||||
{
|
{
|
||||||
var folderName = $"db_backup_{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")}";
|
var folderName = $"db_backup_{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")}";
|
||||||
|
|||||||
@@ -5,11 +5,36 @@ namespace CarCareTracker.Helper
|
|||||||
public interface IGasHelper
|
public interface IGasHelper
|
||||||
{
|
{
|
||||||
List<GasRecordViewModel> GetGasRecordViewModels(List<GasRecord> result, bool useMPG, bool useUKMPG);
|
List<GasRecordViewModel> GetGasRecordViewModels(List<GasRecord> result, bool useMPG, bool useUKMPG);
|
||||||
|
string GetAverageGasMileage(List<GasRecordViewModel> results, bool useMPG);
|
||||||
}
|
}
|
||||||
public class GasHelper : IGasHelper
|
public class GasHelper : IGasHelper
|
||||||
{
|
{
|
||||||
|
public string GetAverageGasMileage(List<GasRecordViewModel> results, bool useMPG)
|
||||||
|
{
|
||||||
|
var recordsToCalculate = results.Where(x => x.IncludeInAverage);
|
||||||
|
if (recordsToCalculate.Any())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var totalMileage = recordsToCalculate.Sum(x => x.DeltaMileage);
|
||||||
|
var totalGallons = recordsToCalculate.Sum(x => x.Gallons);
|
||||||
|
var averageGasMileage = totalMileage / totalGallons;
|
||||||
|
if (!useMPG && averageGasMileage > 0)
|
||||||
|
{
|
||||||
|
averageGasMileage = 100 / averageGasMileage;
|
||||||
|
}
|
||||||
|
return averageGasMileage.ToString("F");
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
public List<GasRecordViewModel> GetGasRecordViewModels(List<GasRecord> result, bool useMPG, bool useUKMPG)
|
public List<GasRecordViewModel> GetGasRecordViewModels(List<GasRecord> result, bool useMPG, bool useUKMPG)
|
||||||
{
|
{
|
||||||
|
//need to order by to get correct results
|
||||||
|
result = result.OrderBy(x => x.Date).ThenBy(x => x.Mileage).ToList();
|
||||||
var computedResults = new List<GasRecordViewModel>();
|
var computedResults = new List<GasRecordViewModel>();
|
||||||
int previousMileage = 0;
|
int previousMileage = 0;
|
||||||
decimal unFactoredConsumption = 0.00M;
|
decimal unFactoredConsumption = 0.00M;
|
||||||
@@ -45,7 +70,8 @@ namespace CarCareTracker.Helper
|
|||||||
CostPerGallon = convertedConsumption > 0.00M ? currentObject.Cost / convertedConsumption : 0,
|
CostPerGallon = convertedConsumption > 0.00M ? currentObject.Cost / convertedConsumption : 0,
|
||||||
IsFillToFull = currentObject.IsFillToFull,
|
IsFillToFull = currentObject.IsFillToFull,
|
||||||
MissedFuelUp = currentObject.MissedFuelUp,
|
MissedFuelUp = currentObject.MissedFuelUp,
|
||||||
Notes = currentObject.Notes
|
Notes = currentObject.Notes,
|
||||||
|
Tags = currentObject.Tags
|
||||||
};
|
};
|
||||||
if (currentObject.MissedFuelUp)
|
if (currentObject.MissedFuelUp)
|
||||||
{
|
{
|
||||||
@@ -58,9 +84,16 @@ namespace CarCareTracker.Helper
|
|||||||
else if (currentObject.IsFillToFull)
|
else if (currentObject.IsFillToFull)
|
||||||
{
|
{
|
||||||
//if user filled to full.
|
//if user filled to full.
|
||||||
if (convertedConsumption > 0.00M)
|
if (convertedConsumption > 0.00M && deltaMileage > 0)
|
||||||
{
|
{
|
||||||
gasRecordViewModel.MilesPerGallon = useMPG ? (unFactoredMileage + deltaMileage) / (unFactoredConsumption + convertedConsumption) : 100 / ((unFactoredMileage + deltaMileage) / (unFactoredConsumption + convertedConsumption));
|
try
|
||||||
|
{
|
||||||
|
gasRecordViewModel.MilesPerGallon = useMPG ? (unFactoredMileage + deltaMileage) / (unFactoredConsumption + convertedConsumption) : 100 / ((unFactoredMileage + deltaMileage) / (unFactoredConsumption + convertedConsumption));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
gasRecordViewModel.MilesPerGallon = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//reset unFactored vars
|
//reset unFactored vars
|
||||||
unFactoredConsumption = 0;
|
unFactoredConsumption = 0;
|
||||||
@@ -90,7 +123,8 @@ namespace CarCareTracker.Helper
|
|||||||
CostPerGallon = convertedConsumption > 0.00M ? currentObject.Cost / convertedConsumption : 0,
|
CostPerGallon = convertedConsumption > 0.00M ? currentObject.Cost / convertedConsumption : 0,
|
||||||
IsFillToFull = currentObject.IsFillToFull,
|
IsFillToFull = currentObject.IsFillToFull,
|
||||||
MissedFuelUp = currentObject.MissedFuelUp,
|
MissedFuelUp = currentObject.MissedFuelUp,
|
||||||
Notes = currentObject.Notes
|
Notes = currentObject.Notes,
|
||||||
|
Tags = currentObject.Tags
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
previousMileage = currentObject.Mileage;
|
previousMileage = currentObject.Mileage;
|
||||||
|
|||||||
@@ -8,15 +8,19 @@ namespace CarCareTracker.Helper
|
|||||||
{
|
{
|
||||||
OperationResponse NotifyUserForRegistration(string emailAddress, string token);
|
OperationResponse NotifyUserForRegistration(string emailAddress, string token);
|
||||||
OperationResponse NotifyUserForPasswordReset(string emailAddress, string token);
|
OperationResponse NotifyUserForPasswordReset(string emailAddress, string token);
|
||||||
|
OperationResponse NotifyUserForReminders(Vehicle vehicle, List<string> emailAddresses, List<ReminderRecordViewModel> reminders);
|
||||||
}
|
}
|
||||||
public class MailHelper : IMailHelper
|
public class MailHelper : IMailHelper
|
||||||
{
|
{
|
||||||
private readonly MailConfig mailConfig;
|
private readonly MailConfig mailConfig;
|
||||||
|
private readonly IFileHelper _fileHelper;
|
||||||
public MailHelper(
|
public MailHelper(
|
||||||
IConfiguration config
|
IConfiguration config,
|
||||||
|
IFileHelper fileHelper
|
||||||
) {
|
) {
|
||||||
//load mailConfig from Configuration
|
//load mailConfig from Configuration
|
||||||
mailConfig = config.GetSection("MailConfig").Get<MailConfig>();
|
mailConfig = config.GetSection("MailConfig").Get<MailConfig>();
|
||||||
|
_fileHelper = fileHelper;
|
||||||
}
|
}
|
||||||
public OperationResponse NotifyUserForRegistration(string emailAddress, string token)
|
public OperationResponse NotifyUserForRegistration(string emailAddress, string token)
|
||||||
{
|
{
|
||||||
@@ -60,20 +64,67 @@ namespace CarCareTracker.Helper
|
|||||||
return new OperationResponse { Success = false, Message = StaticHelper.GenericErrorMessage };
|
return new OperationResponse { Success = false, Message = StaticHelper.GenericErrorMessage };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool SendEmail(string emailTo, string emailSubject, string emailBody) {
|
public OperationResponse NotifyUserForReminders(Vehicle vehicle, List<string> emailAddresses, List<ReminderRecordViewModel> reminders)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(mailConfig.EmailServer))
|
||||||
|
{
|
||||||
|
return new OperationResponse { Success = false, Message = "SMTP Server Not Setup" };
|
||||||
|
}
|
||||||
|
if (!emailAddresses.Any())
|
||||||
|
{
|
||||||
|
return new OperationResponse { Success = false, Message = "No recipients could be found" };
|
||||||
|
}
|
||||||
|
if (!reminders.Any())
|
||||||
|
{
|
||||||
|
return new OperationResponse { Success = false, Message = "No reminders could be found" };
|
||||||
|
}
|
||||||
|
//get email template, this file has to exist since it's a static file.
|
||||||
|
var emailTemplatePath = _fileHelper.GetFullFilePath(StaticHelper.ReminderEmailTemplate);
|
||||||
|
string emailSubject = $"Vehicle Reminders From LubeLogger - {DateTime.Now.ToShortDateString()}";
|
||||||
|
//construct html table.
|
||||||
|
string emailBody = File.ReadAllText(emailTemplatePath);
|
||||||
|
emailBody = emailBody.Replace("{VehicleInformation}", $"{vehicle.Year} {vehicle.Make} {vehicle.Model} #{vehicle.LicensePlate}");
|
||||||
|
string tableBody = "";
|
||||||
|
foreach(ReminderRecordViewModel reminder in reminders)
|
||||||
|
{
|
||||||
|
var dueOn = reminder.Metric == ReminderMetric.Both ? $"{reminder.Date} or {reminder.Mileage}" : reminder.Metric == ReminderMetric.Date ? $"{reminder.Date.ToShortDateString()}" : $"{reminder.Mileage}";
|
||||||
|
tableBody += $"<tr class='{reminder.Urgency}'><td>{StaticHelper.GetTitleCaseReminderUrgency(reminder.Urgency)}</td><td>{reminder.Description}</td><td>{dueOn}</td></tr>";
|
||||||
|
}
|
||||||
|
emailBody = emailBody.Replace("{TableBody}", tableBody);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (string emailAddress in emailAddresses)
|
||||||
|
{
|
||||||
|
SendEmail(emailAddress, emailSubject, emailBody, true, true);
|
||||||
|
}
|
||||||
|
return new OperationResponse { Success = true, Message = "Email Sent!" };
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new OperationResponse { Success = false, Message = ex.Message };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private bool SendEmail(string emailTo, string emailSubject, string emailBody, bool isBodyHtml = false, bool useAsync = false) {
|
||||||
string to = emailTo;
|
string to = emailTo;
|
||||||
string from = mailConfig.EmailFrom;
|
string from = mailConfig.EmailFrom;
|
||||||
var server = mailConfig.EmailServer;
|
var server = mailConfig.EmailServer;
|
||||||
MailMessage message = new MailMessage(from, to);
|
MailMessage message = new MailMessage(from, to);
|
||||||
message.Subject = emailSubject;
|
message.Subject = emailSubject;
|
||||||
message.Body = emailBody;
|
message.Body = emailBody;
|
||||||
|
message.IsBodyHtml = isBodyHtml;
|
||||||
SmtpClient client = new SmtpClient(server);
|
SmtpClient client = new SmtpClient(server);
|
||||||
client.EnableSsl = mailConfig.UseSSL;
|
client.EnableSsl = mailConfig.UseSSL;
|
||||||
client.Port = mailConfig.Port;
|
client.Port = mailConfig.Port;
|
||||||
client.Credentials = new NetworkCredential(mailConfig.Username, mailConfig.Password);
|
client.Credentials = new NetworkCredential(mailConfig.Username, mailConfig.Password);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
client.Send(message);
|
if (useAsync)
|
||||||
|
{
|
||||||
|
client.SendMailAsync(message, new CancellationToken());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client.Send(message);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -4,10 +4,41 @@ namespace CarCareTracker.Helper
|
|||||||
{
|
{
|
||||||
public interface IReminderHelper
|
public interface IReminderHelper
|
||||||
{
|
{
|
||||||
|
ReminderRecord GetUpdatedRecurringReminderRecord(ReminderRecord existingReminder);
|
||||||
List<ReminderRecordViewModel> GetReminderRecordViewModels(List<ReminderRecord> reminders, int currentMileage, DateTime dateCompare);
|
List<ReminderRecordViewModel> GetReminderRecordViewModels(List<ReminderRecord> reminders, int currentMileage, DateTime dateCompare);
|
||||||
}
|
}
|
||||||
public class ReminderHelper: IReminderHelper
|
public class ReminderHelper: IReminderHelper
|
||||||
{
|
{
|
||||||
|
public ReminderRecord GetUpdatedRecurringReminderRecord(ReminderRecord existingReminder)
|
||||||
|
{
|
||||||
|
if (existingReminder.Metric == ReminderMetric.Both)
|
||||||
|
{
|
||||||
|
existingReminder.Date = existingReminder.Date.AddMonths((int)existingReminder.ReminderMonthInterval);
|
||||||
|
if (existingReminder.ReminderMileageInterval != ReminderMileageInterval.Other)
|
||||||
|
{
|
||||||
|
existingReminder.Mileage += (int)existingReminder.ReminderMileageInterval;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
existingReminder.Mileage += existingReminder.CustomMileageInterval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (existingReminder.Metric == ReminderMetric.Odometer)
|
||||||
|
{
|
||||||
|
if (existingReminder.ReminderMileageInterval != ReminderMileageInterval.Other)
|
||||||
|
{
|
||||||
|
existingReminder.Mileage += (int)existingReminder.ReminderMileageInterval;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
existingReminder.Mileage += existingReminder.CustomMileageInterval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (existingReminder.Metric == ReminderMetric.Date)
|
||||||
|
{
|
||||||
|
existingReminder.Date = existingReminder.Date.AddMonths((int)existingReminder.ReminderMonthInterval);
|
||||||
|
}
|
||||||
|
return existingReminder;
|
||||||
|
}
|
||||||
public List<ReminderRecordViewModel> GetReminderRecordViewModels(List<ReminderRecord> reminders, int currentMileage, DateTime dateCompare)
|
public List<ReminderRecordViewModel> GetReminderRecordViewModels(List<ReminderRecord> reminders, int currentMileage, DateTime dateCompare)
|
||||||
{
|
{
|
||||||
List<ReminderRecordViewModel> reminderViewModels = new List<ReminderRecordViewModel>();
|
List<ReminderRecordViewModel> reminderViewModels = new List<ReminderRecordViewModel>();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using CarCareTracker.Models;
|
using CarCareTracker.Models;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace CarCareTracker.Helper
|
namespace CarCareTracker.Helper
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,22 @@ namespace CarCareTracker.Helper
|
|||||||
public static string DbName = "data/cartracker.db";
|
public static string DbName = "data/cartracker.db";
|
||||||
public static string UserConfigPath = "config/userConfig.json";
|
public static string UserConfigPath = "config/userConfig.json";
|
||||||
public static string GenericErrorMessage = "An error occurred, please try again later";
|
public static string GenericErrorMessage = "An error occurred, please try again later";
|
||||||
|
public static string ReminderEmailTemplate = "defaults/reminderemailtemplate.txt";
|
||||||
|
|
||||||
|
public static string GetTitleCaseReminderUrgency(ReminderUrgency input)
|
||||||
|
{
|
||||||
|
switch (input)
|
||||||
|
{
|
||||||
|
case ReminderUrgency.NotUrgent:
|
||||||
|
return "Not Urgent";
|
||||||
|
case ReminderUrgency.VeryUrgent:
|
||||||
|
return "Very Urgent";
|
||||||
|
case ReminderUrgency.PastDue:
|
||||||
|
return "Past Due";
|
||||||
|
default:
|
||||||
|
return input.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string TruncateStrings(string input, int maxLength = 25)
|
public static string TruncateStrings(string input, int maxLength = 25)
|
||||||
{
|
{
|
||||||
@@ -63,5 +80,107 @@ namespace CarCareTracker.Helper
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
public static List<CostForVehicleByMonth> GetBaseLineCosts()
|
||||||
|
{
|
||||||
|
return new List<CostForVehicleByMonth>()
|
||||||
|
{
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1), MonthId = 1, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(2), MonthId = 2, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(3), MonthId = 3, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(4), MonthId = 4, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(5), MonthId = 5, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(6), MonthId = 6, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(7), MonthId = 7, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(8), MonthId = 8, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(9), MonthId = 9, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(10), MonthId = 10, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(11), MonthId = 11, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(12), MonthId = 12, Cost = 0M}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static List<CostForVehicleByMonth> GetBaseLineCostsNoMonthName()
|
||||||
|
{
|
||||||
|
return new List<CostForVehicleByMonth>()
|
||||||
|
{
|
||||||
|
new CostForVehicleByMonth { MonthId = 1, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 2, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 3, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 4, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 5, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 6, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 7, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 8, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth {MonthId = 9, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth { MonthId = 10, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth { MonthId = 11, Cost = 0M},
|
||||||
|
new CostForVehicleByMonth { MonthId = 12, Cost = 0M}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ServiceRecord GenericToServiceRecord(GenericRecord input)
|
||||||
|
{
|
||||||
|
return new ServiceRecord
|
||||||
|
{
|
||||||
|
VehicleId = input.VehicleId,
|
||||||
|
Date = input.Date,
|
||||||
|
Description = input.Description,
|
||||||
|
Cost = input.Cost,
|
||||||
|
Mileage = input.Mileage,
|
||||||
|
Files = input.Files,
|
||||||
|
Notes = input.Notes,
|
||||||
|
Tags = input.Tags
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static CollisionRecord GenericToRepairRecord(GenericRecord input)
|
||||||
|
{
|
||||||
|
return new CollisionRecord
|
||||||
|
{
|
||||||
|
VehicleId = input.VehicleId,
|
||||||
|
Date = input.Date,
|
||||||
|
Description = input.Description,
|
||||||
|
Cost = input.Cost,
|
||||||
|
Mileage = input.Mileage,
|
||||||
|
Files = input.Files,
|
||||||
|
Notes = input.Notes,
|
||||||
|
Tags = input.Tags
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static UpgradeRecord GenericToUpgradeRecord(GenericRecord input)
|
||||||
|
{
|
||||||
|
return new UpgradeRecord
|
||||||
|
{
|
||||||
|
VehicleId = input.VehicleId,
|
||||||
|
Date = input.Date,
|
||||||
|
Description = input.Description,
|
||||||
|
Cost = input.Cost,
|
||||||
|
Mileage = input.Mileage,
|
||||||
|
Files = input.Files,
|
||||||
|
Notes = input.Notes,
|
||||||
|
Tags = input.Tags
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetFuelEconomyUnit(bool useKwh, bool useHours, bool useMPG, bool useUKMPG)
|
||||||
|
{
|
||||||
|
string fuelEconomyUnit;
|
||||||
|
if (useKwh)
|
||||||
|
{
|
||||||
|
var distanceUnit = useHours ? "h" : (useMPG ? "mi." : "km");
|
||||||
|
fuelEconomyUnit = useMPG ? $"{distanceUnit}/kWh" : $"kWh/100{distanceUnit}";
|
||||||
|
}
|
||||||
|
else if (useMPG && useUKMPG)
|
||||||
|
{
|
||||||
|
fuelEconomyUnit = useHours ? "h/g" : "mpg";
|
||||||
|
}
|
||||||
|
else if (useUKMPG)
|
||||||
|
{
|
||||||
|
fuelEconomyUnit = useHours ? "l/100h" : "l/100mi.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fuelEconomyUnit = useHours ? (useMPG ? "h/g" : "l/100h") : (useMPG ? "mpg" : "l/100km");
|
||||||
|
}
|
||||||
|
return fuelEconomyUnit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
62
Helper/TranslationHelper.cs
Normal file
62
Helper/TranslationHelper.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using CarCareTracker.Models;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace CarCareTracker.Helper
|
||||||
|
{
|
||||||
|
public interface ITranslationHelper
|
||||||
|
{
|
||||||
|
string Translate(string userLanguage, string text);
|
||||||
|
}
|
||||||
|
public class TranslationHelper : ITranslationHelper
|
||||||
|
{
|
||||||
|
private readonly IFileHelper _fileHelper;
|
||||||
|
private readonly IConfiguration _config;
|
||||||
|
private IMemoryCache _cache;
|
||||||
|
public TranslationHelper(IFileHelper fileHelper, IConfiguration config, IMemoryCache memoryCache)
|
||||||
|
{
|
||||||
|
_fileHelper = fileHelper;
|
||||||
|
_config = config;
|
||||||
|
_cache = memoryCache;
|
||||||
|
}
|
||||||
|
public string Translate(string userLanguage, string text)
|
||||||
|
{
|
||||||
|
bool create = bool.Parse(_config["LUBELOGGER_TRANSLATOR"] ?? "false");
|
||||||
|
//transform input text into key.
|
||||||
|
string translationKey = text.Replace(" ", "_");
|
||||||
|
var translationFilePath = userLanguage == "en_US" ? _fileHelper.GetFullFilePath($"/defaults/en_US.json") : _fileHelper.GetFullFilePath($"/translations/{userLanguage}.json", false);
|
||||||
|
var dictionary = _cache.GetOrCreate<Dictionary<string, string>>($"lang_{userLanguage}", entry =>
|
||||||
|
{
|
||||||
|
entry.SlidingExpiration = TimeSpan.FromHours(1);
|
||||||
|
if (File.Exists(translationFilePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var translationFile = File.ReadAllText(translationFilePath);
|
||||||
|
var translationDictionary = JsonSerializer.Deserialize<Dictionary<string, string>>(translationFile);
|
||||||
|
return translationDictionary ?? new Dictionary<string, string>();
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
return new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Dictionary<string, string>();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (dictionary != null && dictionary.ContainsKey(translationKey))
|
||||||
|
{
|
||||||
|
return dictionary[translationKey];
|
||||||
|
}
|
||||||
|
else if (create && File.Exists(translationFilePath))
|
||||||
|
{
|
||||||
|
//create entry
|
||||||
|
dictionary.Add(translationKey, text);
|
||||||
|
File.WriteAllText(translationFilePath, JsonSerializer.Serialize(dictionary));
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ namespace CarCareTracker.MapProfile
|
|||||||
Map(m => m.Progress).Name(["progress"]);
|
Map(m => m.Progress).Name(["progress"]);
|
||||||
Map(m => m.Type).Name(["type"]);
|
Map(m => m.Type).Name(["type"]);
|
||||||
Map(m => m.Priority).Name(["priority"]);
|
Map(m => m.Priority).Name(["priority"]);
|
||||||
|
Map(m => m.Tags).Name(["tags"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,13 @@ namespace CarCareTracker.Middleware
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Response.Redirect("/Login/Index");
|
if (Request.Path.Value == "/Vehicle/Index" && Request.QueryString.HasValue)
|
||||||
|
{
|
||||||
|
Response.Redirect($"/Login/Index?redirectURL={Request.Path.Value}{Request.QueryString.Value}");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
Response.Redirect("/Login/Index");
|
||||||
|
}
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
protected override Task HandleForbiddenAsync(AuthenticationProperties properties)
|
protected override Task HandleForbiddenAsync(AuthenticationProperties properties)
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
namespace CarCareTracker.Models
|
namespace CarCareTracker.Models
|
||||||
{
|
{
|
||||||
public class CollisionRecord
|
public class CollisionRecord: GenericRecord
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
|
||||||
public int VehicleId { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public int Mileage { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
public decimal Cost { get; set; }
|
|
||||||
public string Notes { get; set; }
|
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
public CollisionRecord ToCollisionRecord() { return new CollisionRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Mileage = Mileage, Description = Description, Notes = Notes, Files = Files }; }
|
public List<SupplyUsage> Supplies { get; set; } = new List<SupplyUsage>();
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public CollisionRecord ToCollisionRecord() { return new CollisionRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Mileage = Mileage, Description = Description, Notes = Notes, Files = Files, Tags = Tags }; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,5 +18,6 @@
|
|||||||
public bool MissedFuelUp { get; set; } = false;
|
public bool MissedFuelUp { get; set; } = false;
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
public bool MissedFuelUp { get; set; } = false;
|
public bool MissedFuelUp { get; set; } = false;
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
public GasRecord ToGasRecord() { return new GasRecord {
|
public GasRecord ToGasRecord() { return new GasRecord {
|
||||||
Id = Id,
|
Id = Id,
|
||||||
Cost = Cost,
|
Cost = Cost,
|
||||||
@@ -28,7 +29,8 @@
|
|||||||
Files = Files,
|
Files = Files,
|
||||||
IsFillToFull = IsFillToFull,
|
IsFillToFull = IsFillToFull,
|
||||||
MissedFuelUp = MissedFuelUp,
|
MissedFuelUp = MissedFuelUp,
|
||||||
Notes = Notes
|
Notes = Notes,
|
||||||
|
Tags = Tags
|
||||||
}; }
|
}; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
{
|
{
|
||||||
public class GasRecordInputContainer
|
public class GasRecordInputContainer
|
||||||
{
|
{
|
||||||
public bool UseKwh { get; set; }
|
public bool UseKwh { get; set; }
|
||||||
public GasRecordInput GasRecord { get; set; }
|
public bool UseHours { get; set; }
|
||||||
|
public GasRecordInput GasRecord { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,7 @@
|
|||||||
public bool IsFillToFull { get; set; }
|
public bool IsFillToFull { get; set; }
|
||||||
public bool MissedFuelUp { get; set; }
|
public bool MissedFuelUp { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public bool IncludeInAverage { get { return MilesPerGallon > 0 || (!IsFillToFull && !MissedFuelUp); } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
{
|
{
|
||||||
public class GasRecordViewModelContainer
|
public class GasRecordViewModelContainer
|
||||||
{
|
{
|
||||||
public bool UseKwh { get; set; }
|
public bool UseKwh { get; set; }
|
||||||
public List<GasRecordViewModel> GasRecords { get; set; } = new List<GasRecordViewModel>();
|
public bool UseHours { get; set; }
|
||||||
|
public List<GasRecordViewModel> GasRecords { get; set; } = new List<GasRecordViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
Models/GenericRecord.cs
Normal file
15
Models/GenericRecord.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace CarCareTracker.Models
|
||||||
|
{
|
||||||
|
public class GenericRecord
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int VehicleId { get; set; }
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public int Mileage { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public decimal Cost { get; set; }
|
||||||
|
public string Notes { get; set; }
|
||||||
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<string> Tags { get; set;} = new List<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
public string PartNumber { get; set; }
|
public string PartNumber { get; set; }
|
||||||
public string PartSupplier { get; set; }
|
public string PartSupplier { get; set; }
|
||||||
public string PartQuantity { get; set; }
|
public string PartQuantity { get; set; }
|
||||||
|
public string Tags { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SupplyRecordExportModel
|
public class SupplyRecordExportModel
|
||||||
@@ -43,20 +44,22 @@
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public string Cost { get; set; }
|
public string Cost { get; set; }
|
||||||
|
public string Tags { get; set; }
|
||||||
}
|
}
|
||||||
public class OdometerRecordExportModel
|
public class OdometerRecordExportModel
|
||||||
{
|
{
|
||||||
public string Date { get; set; }
|
public string Date { get; set; }
|
||||||
public string Odometer { get; set; }
|
public string Odometer { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
public string Tags { get; set; }
|
||||||
}
|
}
|
||||||
public class TaxRecordExportModel
|
public class TaxRecordExportModel
|
||||||
{
|
{
|
||||||
public string Date { get; set; }
|
public string Date { get; set; }
|
||||||
public string Odometer { get; set; }
|
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public string Cost { get; set; }
|
public string Cost { get; set; }
|
||||||
|
public string Tags { get; set; }
|
||||||
}
|
}
|
||||||
public class GasRecordExportModel
|
public class GasRecordExportModel
|
||||||
{
|
{
|
||||||
@@ -68,6 +71,7 @@
|
|||||||
public string IsFillToFull { get; set; }
|
public string IsFillToFull { get; set; }
|
||||||
public string MissedFuelUp { get; set; }
|
public string MissedFuelUp { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
public string Tags { get; set; }
|
||||||
}
|
}
|
||||||
public class ReminderExportModel
|
public class ReminderExportModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,5 +6,8 @@
|
|||||||
public int VehicleId { get; set; }
|
public int VehicleId { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string NoteText { get; set; }
|
public string NoteText { get; set; }
|
||||||
|
public bool Pinned { get; set; }
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public int Mileage { get; set; }
|
public int Mileage { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
public int Mileage { get; set; }
|
public int Mileage { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
public OdometerRecord ToOdometerRecord() { return new OdometerRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Mileage = Mileage, Notes = Notes, Files = Files }; }
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public OdometerRecord ToOdometerRecord() { return new OdometerRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Mileage = Mileage, Notes = Notes, Files = Files, Tags = Tags }; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<SupplyUsage> Supplies { get; set; } = new List<SupplyUsage>();
|
||||||
public ImportMode ImportMode { get; set; }
|
public ImportMode ImportMode { get; set; }
|
||||||
public PlanPriority Priority { get; set; }
|
public PlanPriority Priority { get; set; }
|
||||||
public PlanProgress Progress { get; set; }
|
public PlanProgress Progress { get; set; }
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public bool IsRecurring { get; set; } = false;
|
public bool IsRecurring { get; set; } = false;
|
||||||
|
public int CustomMileageInterval { get; set; } = 0;
|
||||||
public ReminderMileageInterval ReminderMileageInterval { get; set; } = ReminderMileageInterval.FiveThousandMiles;
|
public ReminderMileageInterval ReminderMileageInterval { get; set; } = ReminderMileageInterval.FiveThousandMiles;
|
||||||
public ReminderMonthInterval ReminderMonthInterval { get; set; } = ReminderMonthInterval.OneYear;
|
public ReminderMonthInterval ReminderMonthInterval { get; set; } = ReminderMonthInterval.OneYear;
|
||||||
public ReminderMetric Metric { get; set; } = ReminderMetric.Date;
|
public ReminderMetric Metric { get; set; } = ReminderMetric.Date;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public bool IsRecurring { get; set; } = false;
|
public bool IsRecurring { get; set; } = false;
|
||||||
|
public int CustomMileageInterval { get; set; } = 0;
|
||||||
public ReminderMileageInterval ReminderMileageInterval { get; set; } = ReminderMileageInterval.FiveThousandMiles;
|
public ReminderMileageInterval ReminderMileageInterval { get; set; } = ReminderMileageInterval.FiveThousandMiles;
|
||||||
public ReminderMonthInterval ReminderMonthInterval { get; set; } = ReminderMonthInterval.OneYear;
|
public ReminderMonthInterval ReminderMonthInterval { get; set; } = ReminderMonthInterval.OneYear;
|
||||||
public ReminderMetric Metric { get; set; } = ReminderMetric.Date;
|
public ReminderMetric Metric { get; set; } = ReminderMetric.Date;
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
IsRecurring = IsRecurring,
|
IsRecurring = IsRecurring,
|
||||||
ReminderMileageInterval = ReminderMileageInterval,
|
ReminderMileageInterval = ReminderMileageInterval,
|
||||||
ReminderMonthInterval = ReminderMonthInterval,
|
ReminderMonthInterval = ReminderMonthInterval,
|
||||||
|
CustomMileageInterval = CustomMileageInterval,
|
||||||
Notes = Notes }; }
|
Notes = Notes }; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,6 @@
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
public Vehicle VehicleData { get; set; }
|
public Vehicle VehicleData { get; set; }
|
||||||
public List<GenericReportModel> VehicleHistory { get; set; }
|
public List<GenericReportModel> VehicleHistory { get; set; }
|
||||||
public string Odometer { get; set; }
|
public string Odometer { get; set; }
|
||||||
public decimal MPG { get; set; }
|
public string MPG { get; set; }
|
||||||
public decimal TotalCost { get; set; }
|
public decimal TotalCost { get; set; }
|
||||||
public decimal TotalGasCost { get; set; }
|
public decimal TotalGasCost { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
namespace CarCareTracker.Models
|
namespace CarCareTracker.Models
|
||||||
{
|
{
|
||||||
public class ServiceRecord
|
public class ServiceRecord: GenericRecord
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
|
||||||
public int VehicleId { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public int Mileage { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
public decimal Cost { get; set; }
|
|
||||||
public string Notes { get; set; }
|
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
public ServiceRecord ToServiceRecord() { return new ServiceRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Mileage = Mileage, Description = Description, Notes = Notes, Files = Files }; }
|
public List<SupplyUsage> Supplies { get; set; } = new List<SupplyUsage>();
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public ServiceRecord ToServiceRecord() { return new ServiceRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Mileage = Mileage, Description = Description, Notes = Notes, Files = Files, Tags = Tags }; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
Models/Settings/SettingsViewModel.cs
Normal file
8
Models/Settings/SettingsViewModel.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace CarCareTracker.Models
|
||||||
|
{
|
||||||
|
public class SettingsViewModel
|
||||||
|
{
|
||||||
|
public UserConfig UserConfig { get; set; }
|
||||||
|
public List<string> UILanguages { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Models/Supply/SupplyUsage.cs
Normal file
7
Models/Supply/SupplyUsage.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace CarCareTracker.Models
|
||||||
|
{
|
||||||
|
public class SupplyUsage {
|
||||||
|
public int SupplyId { get; set; }
|
||||||
|
public decimal Quantity { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,9 @@
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
public bool IsRecurring { get; set; } = false;
|
||||||
|
public ReminderMonthInterval RecurringInterval { get; set; } = ReminderMonthInterval.OneYear;
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,21 @@
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
public bool IsRecurring { get; set; } = false;
|
||||||
|
public ReminderMonthInterval RecurringInterval { get; set; } = ReminderMonthInterval.ThreeMonths;
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
public TaxRecord ToTaxRecord() { return new TaxRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Description = Description, Notes = Notes, Files = Files }; }
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public TaxRecord ToTaxRecord() { return new TaxRecord {
|
||||||
|
Id = Id,
|
||||||
|
VehicleId = VehicleId,
|
||||||
|
Date = DateTime.Parse(Date),
|
||||||
|
Cost = Cost,
|
||||||
|
Description = Description,
|
||||||
|
Notes = Notes,
|
||||||
|
IsRecurring = IsRecurring,
|
||||||
|
RecurringInterval = RecurringInterval,
|
||||||
|
Files = Files,
|
||||||
|
Tags = Tags
|
||||||
|
}; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
namespace CarCareTracker.Models
|
namespace CarCareTracker.Models
|
||||||
{
|
{
|
||||||
public class UpgradeRecord
|
public class UpgradeRecord: GenericRecord
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
|
||||||
public int VehicleId { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public int Mileage { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
public decimal Cost { get; set; }
|
|
||||||
public string Notes { get; set; }
|
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
public List<UploadedFiles> Files { get; set; } = new List<UploadedFiles>();
|
||||||
public UpgradeRecord ToUpgradeRecord() { return new UpgradeRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Mileage = Mileage, Description = Description, Notes = Notes, Files = Files }; }
|
public List<SupplyUsage> Supplies { get; set; } = new List<SupplyUsage>();
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
|
public UpgradeRecord ToUpgradeRecord() { return new UpgradeRecord { Id = Id, VehicleId = VehicleId, Date = DateTime.Parse(Date), Cost = Cost, Mileage = Mileage, Description = Description, Notes = Notes, Files = Files, Tags = Tags }; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,14 @@
|
|||||||
public bool HideZero { get; set; }
|
public bool HideZero { get; set; }
|
||||||
public bool UseUKMPG {get;set;}
|
public bool UseUKMPG {get;set;}
|
||||||
public bool UseThreeDecimalGasCost { get; set; }
|
public bool UseThreeDecimalGasCost { get; set; }
|
||||||
|
public bool UseMarkDownOnSavedNotes { get; set; }
|
||||||
|
public bool EnableAutoReminderRefresh { get; set; }
|
||||||
|
public bool EnableAutoOdometerInsert { get; set; }
|
||||||
|
public string PreferredGasUnit { get; set; } = string.Empty;
|
||||||
|
public string PreferredGasMileageUnit { get; set; } = string.Empty;
|
||||||
public string UserNameHash { get; set; }
|
public string UserNameHash { get; set; }
|
||||||
public string UserPasswordHash { get; set;}
|
public string UserPasswordHash { get; set;}
|
||||||
|
public string UserLanguage { get; set; } = "en_US";
|
||||||
public List<ImportMode> VisibleTabs { get; set; } = new List<ImportMode>() {
|
public List<ImportMode> VisibleTabs { get; set; } = new List<ImportMode>() {
|
||||||
ImportMode.Dashboard,
|
ImportMode.Dashboard,
|
||||||
ImportMode.ServiceRecord,
|
ImportMode.ServiceRecord,
|
||||||
|
|||||||
@@ -9,5 +9,7 @@
|
|||||||
public string Model { get; set; }
|
public string Model { get; set; }
|
||||||
public string LicensePlate { get; set; }
|
public string LicensePlate { get; set; }
|
||||||
public bool IsElectric { get; set; } = false;
|
public bool IsElectric { get; set; } = false;
|
||||||
|
public bool UseHours { get; set; } = false;
|
||||||
|
public List<string> Tags { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
Program.cs
15
Program.cs
@@ -5,6 +5,8 @@ using CarCareTracker.Logic;
|
|||||||
using CarCareTracker.Middleware;
|
using CarCareTracker.Middleware;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@ builder.Services.AddSingleton<IUserAccessDataAccess, UserAccessDataAccess>();
|
|||||||
builder.Services.AddSingleton<IUserConfigDataAccess, UserConfigDataAccess>();
|
builder.Services.AddSingleton<IUserConfigDataAccess, UserConfigDataAccess>();
|
||||||
builder.Services.AddSingleton<ISupplyRecordDataAccess, SupplyRecordDataAccess>();
|
builder.Services.AddSingleton<ISupplyRecordDataAccess, SupplyRecordDataAccess>();
|
||||||
builder.Services.AddSingleton<IPlanRecordDataAccess, PlanRecordDataAccess>();
|
builder.Services.AddSingleton<IPlanRecordDataAccess, PlanRecordDataAccess>();
|
||||||
|
builder.Services.AddSingleton<IPlanRecordTemplateDataAccess, PlanRecordTemplateDataAccess>();
|
||||||
builder.Services.AddSingleton<IOdometerRecordDataAccess, OdometerRecordDataAccess>();
|
builder.Services.AddSingleton<IOdometerRecordDataAccess, OdometerRecordDataAccess>();
|
||||||
|
|
||||||
//configure helpers
|
//configure helpers
|
||||||
@@ -33,6 +36,7 @@ builder.Services.AddSingleton<IReminderHelper, ReminderHelper>();
|
|||||||
builder.Services.AddSingleton<IReportHelper, ReportHelper>();
|
builder.Services.AddSingleton<IReportHelper, ReportHelper>();
|
||||||
builder.Services.AddSingleton<IMailHelper, MailHelper>();
|
builder.Services.AddSingleton<IMailHelper, MailHelper>();
|
||||||
builder.Services.AddSingleton<IConfigHelper, ConfigHelper>();
|
builder.Services.AddSingleton<IConfigHelper, ConfigHelper>();
|
||||||
|
builder.Services.AddSingleton<ITranslationHelper, TranslationHelper>();
|
||||||
|
|
||||||
//configure logic
|
//configure logic
|
||||||
builder.Services.AddSingleton<ILoginLogic, LoginLogic>();
|
builder.Services.AddSingleton<ILoginLogic, LoginLogic>();
|
||||||
@@ -54,6 +58,17 @@ builder.Services.AddAuthorization(options =>
|
|||||||
{
|
{
|
||||||
options.DefaultPolicy = new AuthorizationPolicyBuilder().AddAuthenticationSchemes("AuthN").RequireAuthenticatedUser().Build();
|
options.DefaultPolicy = new AuthorizationPolicyBuilder().AddAuthenticationSchemes("AuthN").RequireAuthenticatedUser().Build();
|
||||||
});
|
});
|
||||||
|
//Configure max file upload size
|
||||||
|
builder.Services.Configure<KestrelServerOptions>(options =>
|
||||||
|
{
|
||||||
|
options.Limits.MaxRequestBodySize = int.MaxValue; // if don't set default value is: 30 MB
|
||||||
|
});
|
||||||
|
builder.Services.Configure<FormOptions>(options =>
|
||||||
|
{
|
||||||
|
options.ValueLengthLimit = int.MaxValue;
|
||||||
|
options.MultipartBodyLengthLimit = int.MaxValue; // if don't set default value is: 128 MB
|
||||||
|
options.MultipartHeadersLengthLimit = int.MaxValue;
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
A self-hosted, open-source vehicle service records and maintainence tracker.
|
A self-hosted, open-source vehicle service records and maintainence tracker.
|
||||||
|
|
||||||
Support this project on Patreon: https://patreon.com/LubeLogger
|
Visit our website: https://lubelogger.com
|
||||||
|
|
||||||
|
Support this project by [Subscribing on Patreon](https://patreon.com/LubeLogger) or [Making a Donation](https://buy.stripe.com/aEU9Egc8DdMc9bO144)
|
||||||
|
|
||||||
## Why
|
## Why
|
||||||
Because nobody should have to deal with a homemade spreadsheet or a shoebox full of receipts when it comes to vehicle maintainence.
|
Because nobody should have to deal with a homemade spreadsheet or a shoebox full of receipts when it comes to vehicle maintainence.
|
||||||
@@ -10,6 +12,11 @@ Because nobody should have to deal with a homemade spreadsheet or a shoebox full
|
|||||||
## Screenshots
|
## Screenshots
|
||||||
<a href="/docs/screenshots.md">Screenshots</a>
|
<a href="/docs/screenshots.md">Screenshots</a>
|
||||||
|
|
||||||
|
## Demo
|
||||||
|
Try it out before you download it! The live demo resets every 20 minutes.
|
||||||
|
|
||||||
|
[Live Demo](https://demo.lubelogger.com) Login using username "test" and password "1234"
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
- Bootstrap
|
- Bootstrap
|
||||||
- LiteDB
|
- LiteDB
|
||||||
@@ -17,12 +24,13 @@ Because nobody should have to deal with a homemade spreadsheet or a shoebox full
|
|||||||
- SweetAlert2
|
- SweetAlert2
|
||||||
- CsvHelper
|
- CsvHelper
|
||||||
- Chart.js
|
- Chart.js
|
||||||
|
- Drawdown
|
||||||
|
|
||||||
## Docker Setup (GHCR)
|
## Docker Setup (GHCR)
|
||||||
1. Install Docker
|
1. Install Docker
|
||||||
2. Run `docker pull ghcr.io/hargata/lubelogger:latest`
|
2. Run `docker pull ghcr.io/hargata/lubelogger:latest`
|
||||||
3. CHECK culture in .env file, default is en_US, this will change the currency and date formats. You can also setup SMTP Config here.
|
3. CHECK culture in .env file, default is en_US, this will change the currency and date formats. You can also setup SMTP Config here.
|
||||||
4. If not using traefik, use docker-compose-notraefik.yml
|
4. If using traefik, use docker-compose.traefik.yml
|
||||||
5. Run `docker-compose up`
|
5. Run `docker-compose up`
|
||||||
|
|
||||||
## Docker Setup (Manual Build)
|
## Docker Setup (Manual Build)
|
||||||
@@ -31,7 +39,7 @@ Because nobody should have to deal with a homemade spreadsheet or a shoebox full
|
|||||||
3. CHECK culture in .env file, default is en_US, also setup SMTP for user management if you want that.
|
3. CHECK culture in .env file, default is en_US, also setup SMTP for user management if you want that.
|
||||||
4. Run `docker build -t lubelogger -f Dockerfile .`
|
4. Run `docker build -t lubelogger -f Dockerfile .`
|
||||||
5. CHECK docker-compose.yml and make sure the mounting directories look correct.
|
5. CHECK docker-compose.yml and make sure the mounting directories look correct.
|
||||||
6. If not using traefik, use docker-compose-notraefik.yml
|
6. If using traefik, use docker-compose.traefik.yml
|
||||||
7. Run `docker-compose up`
|
7. Run `docker-compose up`
|
||||||
|
|
||||||
## Additional Docker Instructions
|
## Additional Docker Instructions
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<div class="row">
|
@{
|
||||||
|
ViewData["Title"] = "LubeLogger API";
|
||||||
|
}
|
||||||
|
<div class="row">
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<h6 class="display-6 mt-2">API</h6>
|
<h6 class="display-6 mt-2">API</h6>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,6 +54,28 @@
|
|||||||
vehicleId - Id of Vehicle
|
vehicleId - Id of Vehicle
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1">
|
||||||
|
POST
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<code>/api/vehicle/servicerecords/add</code>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
Adds Service Record to the vehicle
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
vehicleId - Id of Vehicle
|
||||||
|
<br />
|
||||||
|
Body(form-data): {<br />
|
||||||
|
date - Date to be entered<br />
|
||||||
|
odometer - Odometer reading<br />
|
||||||
|
description - Description<br/>
|
||||||
|
cost - Cost<br />
|
||||||
|
notes - notes(optional)<br />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
GET
|
GET
|
||||||
@@ -65,6 +90,28 @@
|
|||||||
vehicleId - Id of Vehicle
|
vehicleId - Id of Vehicle
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1">
|
||||||
|
POST
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<code>/api/vehicle/repairrecords/add</code>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
Adds Repair Record to the vehicle
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
vehicleId - Id of Vehicle
|
||||||
|
<br />
|
||||||
|
Body(form-data): {<br />
|
||||||
|
date - Date to be entered<br />
|
||||||
|
odometer - Odometer reading<br />
|
||||||
|
description - Description<br />
|
||||||
|
cost - Cost<br />
|
||||||
|
notes - notes(optional)<br />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
GET
|
GET
|
||||||
@@ -79,6 +126,28 @@
|
|||||||
vehicleId - Id of Vehicle
|
vehicleId - Id of Vehicle
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1">
|
||||||
|
POST
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<code>/api/vehicle/upgraderecords/add</code>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
Adds Upgrade Record to the vehicle
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
vehicleId - Id of Vehicle
|
||||||
|
<br />
|
||||||
|
Body(form-data): {<br />
|
||||||
|
date - Date to be entered<br />
|
||||||
|
odometer - Odometer reading<br />
|
||||||
|
description - Description<br />
|
||||||
|
cost - Cost<br />
|
||||||
|
notes - notes(optional)<br />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
GET
|
GET
|
||||||
@@ -93,6 +162,27 @@
|
|||||||
vehicleId - Id of Vehicle
|
vehicleId - Id of Vehicle
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1">
|
||||||
|
POST
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<code>/api/vehicle/taxrecords/add</code>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
Adds Tax Record to the vehicle
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
vehicleId - Id of Vehicle
|
||||||
|
<br />
|
||||||
|
Body(form-data): {<br />
|
||||||
|
date - Date to be entered<br />
|
||||||
|
description - Description<br />
|
||||||
|
cost - Cost<br />
|
||||||
|
notes - notes(optional)<br />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
GET
|
GET
|
||||||
@@ -111,6 +201,30 @@
|
|||||||
useUKMPG(bool) - Use UK Imperial Calculation
|
useUKMPG(bool) - Use UK Imperial Calculation
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1">
|
||||||
|
POST
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<code>/api/vehicle/gasrecords/add</code>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
Adds Gas Record to the vehicle
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
vehicleId - Id of Vehicle
|
||||||
|
<br />
|
||||||
|
Body(form-data): {<br />
|
||||||
|
date - Date to be entered<br />
|
||||||
|
odometer - Odometer reading<br />
|
||||||
|
fuelConsumed - Fuel Consumed<br />
|
||||||
|
cost - Cost<br />
|
||||||
|
isFillToFull(bool) - Filled To Full<br />
|
||||||
|
missedFuelUp(bool) - Missed Fuel Up<br />
|
||||||
|
notes - notes(optional)<br />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
GET
|
GET
|
||||||
@@ -127,6 +241,21 @@
|
|||||||
</div>
|
</div>
|
||||||
@if (User.IsInRole(nameof(UserData.IsRootUser)))
|
@if (User.IsInRole(nameof(UserData.IsRootUser)))
|
||||||
{
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-1">
|
||||||
|
GET
|
||||||
|
</div>
|
||||||
|
<div class="col-5">
|
||||||
|
<code>/api/vehicle/reminders/send</code>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
Send reminder emails out to collaborators based on specified urgency.
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
(must be root user)<br />
|
||||||
|
urgencies[]=[NotUrgent,Urgent,VeryUrgent,PastDue]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
GET
|
GET
|
||||||
@@ -164,7 +293,7 @@
|
|||||||
<code>/api/vehicle/odometerrecords/add</code>
|
<code>/api/vehicle/odometerrecords/add</code>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
Returns a list of odometer records for the vehicle
|
Adds Odometer Record to the vehicle
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
vehicleId - Id of Vehicle
|
vehicleId - Id of Vehicle
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
@{
|
@using CarCareTracker.Helper
|
||||||
|
@{
|
||||||
ViewData["Title"] = "Admin";
|
ViewData["Title"] = "Admin";
|
||||||
}
|
}
|
||||||
@inject IConfiguration config;
|
@inject IConfiguration config;
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
bool emailServerIsSetup = true;
|
bool emailServerIsSetup = true;
|
||||||
var mailConfig = config.GetSection("MailConfig").Get<MailConfig>();
|
var mailConfig = config.GetSection("MailConfig").Get<MailConfig>();
|
||||||
|
var userLanguage = config[nameof(UserConfig.UserLanguage)] ?? "en_US";
|
||||||
if (mailConfig is null || string.IsNullOrWhiteSpace(mailConfig.EmailServer))
|
if (mailConfig is null || string.IsNullOrWhiteSpace(mailConfig.EmailServer))
|
||||||
{
|
{
|
||||||
emailServerIsSetup = false;
|
emailServerIsSetup = false;
|
||||||
@@ -17,31 +20,31 @@
|
|||||||
<a href="/Home" class="btn btn-secondary btn-md mt-1 mb-1"><i class="bi bi-arrow-left-square"></i></a>
|
<a href="/Home" class="btn btn-secondary btn-md mt-1 mb-1"><i class="bi bi-arrow-left-square"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-11">
|
<div class="col-11">
|
||||||
<span class="display-6">Admin Panel</span>
|
<span class="display-6">@translator.Translate(userLanguage, "Admin Panel")</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-5 col-12">
|
<div class="col-md-5 col-12">
|
||||||
<span class="lead">Tokens</span>
|
<span class="lead">@translator.Translate(userLanguage, "Tokens")</span>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<button onclick="generateNewToken()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Generate User Token</button>
|
<button onclick="generateNewToken()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Generate User Token")</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 d-flex align-items-center">
|
<div class="col-6 d-flex align-items-center">
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" role="switch" id="enableAutoNotify" @(emailServerIsSetup ? "checked" : "disabled")>
|
<input class="form-check-input" type="checkbox" role="switch" id="enableAutoNotify" @(emailServerIsSetup ? "checked" : "disabled")>
|
||||||
<label class="form-check-label" for="enableAutoNotify">Auto Notify(via Email)</label>
|
<label class="form-check-label" for="enableAutoNotify">@translator.Translate(userLanguage, "Auto Notify(via Email)")</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-4">Token</th>
|
<th scope="col" class="col-4">@translator.Translate(userLanguage, "Token")</th>
|
||||||
<th scope="col" class="col-6">Issued To</th>
|
<th scope="col" class="col-6">@translator.Translate(userLanguage, "Issued To")</th>
|
||||||
<th scope="col" class="col-2">Delete</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Delete")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -59,15 +62,15 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-7">
|
<div class="col-12 col-md-7">
|
||||||
<span class="lead">Users</span>
|
<span class="lead">@translator.Translate(userLanguage, "Users")</span>
|
||||||
<hr />
|
<hr />
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-4">Username</th>
|
<th scope="col" class="col-4">@translator.Translate(userLanguage, "Username")</th>
|
||||||
<th scope="col" class="col-4">Email</th>
|
<th scope="col" class="col-4">@translator.Translate(userLanguage, "Email")</th>
|
||||||
<th scope="col" class="col-2">Is Admin</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Is Admin")</th>
|
||||||
<th scope="col" class="col-2">Delete</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Delete")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -92,7 +95,7 @@
|
|||||||
if (data){
|
if (data){
|
||||||
reloadPage();
|
reloadPage();
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error has occurred, please try again later.");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -104,7 +107,7 @@
|
|||||||
if (data) {
|
if (data) {
|
||||||
reloadPage();
|
reloadPage();
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error has occurred, please try again later.");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -113,7 +116,7 @@
|
|||||||
if (data) {
|
if (data) {
|
||||||
reloadPage();
|
reloadPage();
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error has occurred, please try again later.");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,37 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableAuth = config.GetUserConfig(User).EnableAuth;
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var enableAuth = userConfig.EnableAuth;
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var logoUrl = config.GetLogoUrl();
|
||||||
}
|
}
|
||||||
@model string
|
@model string
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "LubeLogger";
|
ViewData["Title"] = "LubeLogger";
|
||||||
}
|
}
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script src="~/js/garage.js" asp-append-version="true"></script>
|
<script src="~/js/garage.js"></script>
|
||||||
}
|
}
|
||||||
<div class="lubelogger-mobile-nav" onclick="hideMobileNav()">
|
<div class="lubelogger-mobile-nav" onclick="hideMobileNav()">
|
||||||
<ul class="navbar-nav" id="homeTab" role="tablist">
|
<ul class="navbar-nav" id="homeTab" role="tablist">
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @(Model == "garage" ? "active" : "")" id="garage-tab" data-bs-toggle="tab" data-bs-target="#garage-tab-pane" type="button" role="tab"><span class="ms-2 display-3"><i class="bi bi-car-front me-2"></i>Garage</span></button>
|
<button class="nav-link user-select-none @(Model == "garage" ? "active" : "")" ontouchstart="detectLongTouch(this)" ontouchend="detectTouchEndPremature(this)" id="garage-tab" data-bs-toggle="tab" data-bs-target="#garage-tab-pane" type="button" role="tab"><span class="ms-2 display-3"><i class="bi bi-car-front me-2"></i>@translator.Translate(userLanguage,"Garage")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @(Model == "settings" ? "active" : "")" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings-tab-pane" type="button" role="tab"><span class="ms-2 display-3"><i class="bi bi-gear me-2"></i>Settings</span></button>
|
<button class="nav-link @(Model == "settings" ? "active" : "")" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings-tab-pane" type="button" role="tab"><span class="ms-2 display-3"><i class="bi bi-gear me-2"></i>@translator.Translate(userLanguage,"Settings")</span></button>
|
||||||
</li>
|
</li>
|
||||||
@if (User.IsInRole("CookieAuth"))
|
@if (User.IsInRole("CookieAuth"))
|
||||||
{
|
{
|
||||||
@if (User.IsInRole(nameof(UserData.IsAdmin)))
|
@if (User.IsInRole(nameof(UserData.IsAdmin)))
|
||||||
{
|
{
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<a class="dropdown-item" href="/Admin"><span class="display-3 ms-2"><i class="bi bi-people me-2"></i>Admin Panel</span></a>
|
<a class="dropdown-item" href="/Admin"><span class="display-3 ms-2"><i class="bi bi-people me-2"></i>@translator.Translate(userLanguage,"Admin Panel")</span></a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link" onclick="performLogOut()"><span class="display-3 ms-2"><i class="bi bi-box-arrow-right me-2"></i>Logout</span></button>
|
<button class="nav-link" onclick="performLogOut()"><span class="display-3 ms-2"><i class="bi bi-box-arrow-right me-2"></i>@translator.Translate(userLanguage,"Logout")</span></button>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -35,7 +39,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="d-flex lubelogger-navbar">
|
<div class="d-flex lubelogger-navbar">
|
||||||
<img src="/defaults/lubelogger_logo.png" />
|
<img src="@logoUrl" />
|
||||||
<div class="lubelogger-navbar-button">
|
<div class="lubelogger-navbar-button">
|
||||||
<button type="button" class="btn btn-dark" onclick="showMobileNav()"><i class="bi bi-list lubelogger-menu-icon"></i></button>
|
<button type="button" class="btn btn-dark" onclick="showMobileNav()"><i class="bi bi-list lubelogger-menu-icon"></i></button>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,10 +48,10 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<ul class="nav nav-tabs lubelogger-tab" id="homeTab" role="tablist">
|
<ul class="nav nav-tabs lubelogger-tab" id="homeTab" role="tablist">
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @(Model == "garage" ? "active" : "")" id="garage-tab" data-bs-toggle="tab" data-bs-target="#garage-tab-pane" type="button" role="tab"><i class="bi bi-car-front me-2"></i>Garage</button>
|
<button class="nav-link @(Model == "garage" ? "active" : "")" oncontextmenu="sortGarage(this)" id="garage-tab" data-bs-toggle="tab" data-bs-target="#garage-tab-pane" type="button" role="tab"><i class="bi bi-car-front me-2"></i>@translator.Translate(userLanguage,"Garage")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item ms-auto" role="presentation">
|
<li class="nav-item ms-auto" role="presentation">
|
||||||
<button class="nav-link @(Model == "settings" ? "active" : "")" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings-tab-pane" type="button" role="tab"><i class="bi bi-gear me-2"></i>Settings</button>
|
<button class="nav-link @(Model == "settings" ? "active" : "")" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings-tab-pane" type="button" role="tab"><i class="bi bi-gear me-2"></i>@translator.Translate(userLanguage,"Settings")</button>
|
||||||
</li>
|
</li>
|
||||||
@if (User.IsInRole("CookieAuth"))
|
@if (User.IsInRole("CookieAuth"))
|
||||||
{
|
{
|
||||||
@@ -57,11 +61,11 @@
|
|||||||
@if (User.IsInRole(nameof(UserData.IsAdmin)))
|
@if (User.IsInRole(nameof(UserData.IsAdmin)))
|
||||||
{
|
{
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="/Admin"><i class="bi bi-people me-2"></i>Admin Panel</a>
|
<a class="dropdown-item" href="/Admin"><i class="bi bi-people me-2"></i>@translator.Translate(userLanguage,"Admin Panel")</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
<li>
|
<li>
|
||||||
<button class="dropdown-item" onclick="performLogOut()"><i class="bi bi-box-arrow-right me-2"></i>Logout</button>
|
<button class="dropdown-item" onclick="performLogOut()"><i class="bi bi-box-arrow-right me-2"></i>@translator.Translate(userLanguage,"Logout")</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -69,9 +73,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content" id="homeTab">
|
<div class="tab-content" id="homeTab">
|
||||||
<div class="tab-pane fade @(Model == "garage" ? "show active" : "")" id="garage-tab-pane" role="tabpanel" tabindex="0">
|
<div class="tab-pane fade @(Model == "garage" ? "show active" : "")" id="garage-tab-pane" role="tabpanel" tabindex="0">
|
||||||
<div class="row">
|
<div id="garageContainer">
|
||||||
<div id="garageContainer" class="row gy-3 align-items-stretch">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade @(Model == "settings" ? "show active" : "")" id="settings-tab-pane" role="tabpanel" tabindex="0">
|
<div class="tab-pane fade @(Model == "settings" ? "show active" : "")" id="settings-tab-pane" role="tabpanel" tabindex="0">
|
||||||
|
|||||||
@@ -1,24 +1,44 @@
|
|||||||
@model List<Vehicle>
|
@model List<Vehicle>
|
||||||
|
@{
|
||||||
@if (Model.Any())
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
}
|
||||||
|
@if (recordTags.Any())
|
||||||
{
|
{
|
||||||
foreach (Vehicle vehicle in Model)
|
<div class='row'>
|
||||||
{
|
<div class="d-flex align-items-center flex-wrap mt-4">
|
||||||
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4">
|
@foreach (string recordTag in recordTags)
|
||||||
<div class="card" onclick="viewVehicle(@vehicle.Id)">
|
{
|
||||||
<img src="@vehicle.ImageLocation" style="height:145px; object-fit:scale-down;" />
|
<span onclick="filterGarage(this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
<div class="card-body">
|
}
|
||||||
<h5 class="card-title text-truncate">@($"{vehicle.Year}")</h5>
|
<datalist id="tagList">
|
||||||
<h5 class="card-title text-truncate">@($"{vehicle.Make}")</h5>
|
@foreach (string recordTag in recordTags)
|
||||||
<h5 class="card-title text-truncate">@($"{vehicle.Model}")</h5>
|
{
|
||||||
<p class="card-text text-truncate">@vehicle.LicensePlate</p>
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div class="row">
|
||||||
|
<div class="row gy-3 align-items-stretch vehiclesContainer">
|
||||||
|
@foreach (Vehicle vehicle in Model)
|
||||||
|
{
|
||||||
|
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4 user-select-none garage-item" data-tags='@string.Join(" ", vehicle.Tags)' id="gridVehicle_@vehicle.Id" data-bs-toggle="tooltip" data-bs-html="true" data-bs-placement="bottom" data-bs-trigger="manual" onmouseenter="loadPinnedNotes(@vehicle.Id)" ontouchstart="loadPinnedNotes(@vehicle.Id)" ontouchcancel="hidePinnedNotes(@vehicle.Id)" ontouchend="hidePinnedNotes(@vehicle.Id)" onmouseleave="hidePinnedNotes(@vehicle.Id)">
|
||||||
|
<div class="card" onclick="viewVehicle(@vehicle.Id)">
|
||||||
|
<img src="@vehicle.ImageLocation" style="height:145px; object-fit:scale-down;" />
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title text-truncate garage-item-year" data-unit="@vehicle.Year">@($"{vehicle.Year}")</h5>
|
||||||
|
<h5 class="card-title text-truncate">@($"{vehicle.Make}")</h5>
|
||||||
|
<h5 class="card-title text-truncate">@($"{vehicle.Model}")</h5>
|
||||||
|
<p class="card-text text-truncate">@vehicle.LicensePlate</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4 garage-item-add">
|
||||||
|
<div class="card" onclick="showAddVehicleModal()" style="height:100%;">
|
||||||
|
<img src="/defaults/addnew_vehicle.png" style="object-fit:scale-down;height:100%;" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
}
|
|
||||||
<div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-4">
|
|
||||||
<div class="card" onclick="showAddVehicleModal()" style="height:100%;">
|
|
||||||
<img src="/defaults/addnew_vehicle.png" style="object-fit:scale-down;height:100%;" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,144 +1,185 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@model UserConfig
|
@model SettingsViewModel
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userLanguage = Model.UserConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<h6 class="display-6 mt-2">Settings</h6>
|
<h6 class="display-6 mt-2">@translator.Translate(userLanguage, "Settings")</h6>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
|
<input id="preferredGasUnit" style="display:none;" value="@Model.UserConfig.PreferredGasUnit" />
|
||||||
|
<input id="preferredFuelMileageUnit" style="display:none;" value="@Model.UserConfig.PreferredGasMileageUnit" />
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableDarkMode" checked="@Model.UseDarkMode">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableDarkMode" checked="@Model.UserConfig.UseDarkMode">
|
||||||
<label class="form-check-label" for="enableDarkMode">Dark Mode</label>
|
<label class="form-check-label" for="enableDarkMode">@translator.Translate(userLanguage, "Dark Mode")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableCsvImports" checked="@Model.EnableCsvImports">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableCsvImports" checked="@Model.UserConfig.EnableCsvImports">
|
||||||
<label class="form-check-label" for="enableCsvImports">Enable CSV Imports</label>
|
<label class="form-check-label" for="enableCsvImports">@translator.Translate(userLanguage, "Enable CSV Imports")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useMPG" checked="@Model.UseMPG">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useMPG" checked="@Model.UserConfig.UseMPG">
|
||||||
<label class="form-check-label" for="useMPG">Use Imperial Calculation for Fuel Economy Calculations(MPG)<br /><small class="text-body-secondary">This Will Also Change Units to Miles and Gallons</small></label>
|
<label class="form-check-label" for="useMPG">@translator.Translate(userLanguage, "Use Imperial Calculation for Fuel Economy Calculations(MPG)")<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "This Will Also Change Units to Miles and Gallons")</small></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useUKMPG" checked="@Model.UseUKMPG">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useUKMPG" checked="@Model.UserConfig.UseUKMPG">
|
||||||
<label class="form-check-label" for="useUKMPG">Use UK MPG Calculation<br /><small class="text-body-secondary">Input Gas Consumption in Liters, it will be converted to UK Gals for MPG Calculation</small></label>
|
<label class="form-check-label" for="useUKMPG">@translator.Translate(userLanguage, "Use UK MPG Calculation")<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "Input Gas Consumption in Liters, it will be converted to UK Gals for MPG Calculation")</small></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useDescending" checked="@Model.UseDescending">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useDescending" checked="@Model.UserConfig.UseDescending">
|
||||||
<label class="form-check-label" for="useDescending">Sort lists in Descending Order(Newest to Oldest)</label>
|
<label class="form-check-label" for="useDescending">@translator.Translate(userLanguage, "Sort lists in Descending Order(Newest to Oldest)")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="hideZero" checked="@Model.HideZero">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="hideZero" checked="@Model.UserConfig.HideZero">
|
||||||
<label class="form-check-label" for="hideZero">Replace @(0.ToString("C")) Costs with ---</label>
|
<label class="form-check-label" for="hideZero">@translator.Translate(userLanguage, "Replace $0.00 Costs with ---")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useThreeDecimal" checked="@Model.UseThreeDecimalGasCost">
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useThreeDecimal" checked="@Model.UserConfig.UseThreeDecimalGasCost">
|
||||||
<label class="form-check-label" for="useThreeDecimal">Use Three Decimals For Fuel Cost</label>
|
<label class="form-check-label" for="useThreeDecimal">@translator.Translate(userLanguage, "Use Three Decimals For Fuel Cost")</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useMarkDownOnSavedNotes" checked="@Model.UserConfig.UseMarkDownOnSavedNotes">
|
||||||
|
<label class="form-check-label" for="useMarkDownOnSavedNotes">@translator.Translate(userLanguage, "Display Saved Notes in Markdown")</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableAutoReminderRefresh" checked="@Model.UserConfig.EnableAutoReminderRefresh">
|
||||||
|
<label class="form-check-label" for="enableAutoReminderRefresh">@translator.Translate(userLanguage, "Auto Refresh Lapsed Recurring Reminders")</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="enableAutoOdometerInsert" checked="@Model.UserConfig.EnableAutoOdometerInsert">
|
||||||
|
<label class="form-check-label" for="enableAutoOdometerInsert">@translator.Translate(userLanguage, "Auto Insert Odometer Records")<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "Only when Adding Service/Repair/Upgrade/Fuel Record or Completing a Plan")</small></label>
|
||||||
</div>
|
</div>
|
||||||
@if (User.IsInRole(nameof(UserData.IsRootUser)))
|
@if (User.IsInRole(nameof(UserData.IsRootUser)))
|
||||||
{
|
{
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" onChange="enableAuthCheckChanged()" type="checkbox" role="switch" id="enableAuth" checked="@Model.EnableAuth">
|
<input class="form-check-input" onChange="enableAuthCheckChanged()" type="checkbox" role="switch" id="enableAuth" checked="@Model.UserConfig.EnableAuth">
|
||||||
<label class="form-check-label" for="enableAuth">Enable Authentication</label>
|
<label class="form-check-label" for="enableAuth">@translator.Translate(userLanguage, "Enable Authentication")</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<div class="row" id="visibleTabs">
|
<div class="row" id="visibleTabs">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<span class="lead">Visible Tabs</span>
|
<span class="lead">@translator.Translate(userLanguage, "Visible Tabs")</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="ServiceRecord" id="serviceRecordTab" @(Model.VisibleTabs.Contains(ImportMode.ServiceRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="ServiceRecord" id="serviceRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.ServiceRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="serviceRecordTab">Service Records</label>
|
<label class="form-check-label stretched-link" for="serviceRecordTab">@translator.Translate(userLanguage, "Service Records")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item d-none">
|
<li class="list-group-item d-none">
|
||||||
<input onChange="updateSettings()" disabled class="form-check-input me-1" type="checkbox" value="Dashboard" id="dashboardTab" @(Model.VisibleTabs.Contains(ImportMode.Dashboard) ? "checked" : "")>
|
<input onChange="updateSettings()" disabled class="form-check-input me-1" type="checkbox" value="Dashboard" id="dashboardTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.Dashboard) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="dashboardTab">Dashboard</label>
|
<label class="form-check-label stretched-link" for="dashboardTab">@translator.Translate(userLanguage, "Dashboard")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="RepairRecord" id="repairRecordTab" @(Model.VisibleTabs.Contains(ImportMode.RepairRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="RepairRecord" id="repairRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.RepairRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="repairRecordTab">Repairs</label>
|
<label class="form-check-label stretched-link" for="repairRecordTab">@translator.Translate(userLanguage, "Repairs")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="UpgradeRecord" id="upgradeRecordTab" @(Model.VisibleTabs.Contains(ImportMode.UpgradeRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="UpgradeRecord" id="upgradeRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.UpgradeRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="upgradeRecordTab">Upgrades</label>
|
<label class="form-check-label stretched-link" for="upgradeRecordTab">@translator.Translate(userLanguage, "Upgrades")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="GasRecord" id="gasRecordTab" @(Model.VisibleTabs.Contains(ImportMode.GasRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="GasRecord" id="gasRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.GasRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="gasRecordTab">Fuel</label>
|
<label class="form-check-label stretched-link" for="gasRecordTab">@translator.Translate(userLanguage, "Fuel")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="OdometerRecord" id="odometerRecordTab" @(Model.VisibleTabs.Contains(ImportMode.OdometerRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="OdometerRecord" id="odometerRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.OdometerRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="odometerRecordTab">Odometer</label>
|
<label class="form-check-label stretched-link" for="odometerRecordTab">@translator.Translate(userLanguage, "Odometer")</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="TaxRecord" id="taxRecordTab" @(Model.VisibleTabs.Contains(ImportMode.TaxRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="TaxRecord" id="taxRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.TaxRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="taxRecordTab">Taxes</label>
|
<label class="form-check-label stretched-link" for="taxRecordTab">@translator.Translate(userLanguage, "Taxes")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="NoteRecord" id="noteRecordTab" @(Model.VisibleTabs.Contains(ImportMode.NoteRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="NoteRecord" id="noteRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.NoteRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="noteRecordTab">Notes</label>
|
<label class="form-check-label stretched-link" for="noteRecordTab">@translator.Translate(userLanguage, "Notes")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="ReminderRecord" id="reminderRecordTab" @(Model.VisibleTabs.Contains(ImportMode.ReminderRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="ReminderRecord" id="reminderRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.ReminderRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="reminderRecordTab">Reminder</label>
|
<label class="form-check-label stretched-link" for="reminderRecordTab">@translator.Translate(userLanguage, "Reminder")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="SupplyRecord" id="supplyRecordTab" @(Model.VisibleTabs.Contains(ImportMode.SupplyRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="SupplyRecord" id="supplyRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.SupplyRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="supplyRecordTab">Supplies</label>
|
<label class="form-check-label stretched-link" for="supplyRecordTab">@translator.Translate(userLanguage, "Supplies")</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="PlanRecord" id="planRecordTab" @(Model.VisibleTabs.Contains(ImportMode.PlanRecord) ? "checked" : "")>
|
<input onChange="updateSettings()" class="form-check-input me-1" type="checkbox" value="PlanRecord" id="planRecordTab" @(Model.UserConfig.VisibleTabs.Contains(ImportMode.PlanRecord) ? "checked" : "")>
|
||||||
<label class="form-check-label stretched-link" for="planRecordTab">Planner</label>
|
<label class="form-check-label stretched-link" for="planRecordTab">@translator.Translate(userLanguage, "Planner")</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<span class="lead">Default Tab</span>
|
<span class="lead">@translator.Translate(userLanguage, "Default Tab")</span>
|
||||||
<select class="form-select" onchange="updateSettings()" id="defaultTab">
|
<select class="form-select" onchange="updateSettings()" id="defaultTab">
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.Dashboard)) value="Dashboard">Dashboard</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.Dashboard)) value="Dashboard">@translator.Translate(userLanguage, "Dashboard")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model,ImportMode.ServiceRecord)) value="ServiceRecord">Service Record</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.ServiceRecord)) value="ServiceRecord">@translator.Translate(userLanguage, "Service Record")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.RepairRecord)) value="RepairRecord">Repairs</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.RepairRecord)) value="RepairRecord">@translator.Translate(userLanguage, "Repairs")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.UpgradeRecord)) value="UpgradeRecord">Upgrades</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.UpgradeRecord)) value="UpgradeRecord">@translator.Translate(userLanguage, "Upgrades")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.GasRecord)) value="GasRecord">Fuel</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.GasRecord)) value="GasRecord">@translator.Translate(userLanguage, "Fuel")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.TaxRecord)) value="TaxRecord">Tax</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.TaxRecord)) value="TaxRecord">@translator.Translate(userLanguage, "Tax")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.NoteRecord)) value="NoteRecord">Notes</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.NoteRecord)) value="NoteRecord">@translator.Translate(userLanguage, "Notes")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.ReminderRecord)) value="ReminderRecord">Reminders</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.ReminderRecord)) value="ReminderRecord">@translator.Translate(userLanguage, "Reminders")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.SupplyRecord)) value="SupplyRecord">Supplies</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.SupplyRecord)) value="SupplyRecord">@translator.Translate(userLanguage, "Supplies")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.PlanRecord)) value="PlanRecord">Planner</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.PlanRecord)) value="PlanRecord">@translator.Translate(userLanguage, "Planner")</!option>
|
||||||
<!option @(StaticHelper.DefaultTabSelected(Model, ImportMode.OdometerRecord)) value="OdometerRecord">Odometer</!option>
|
<!option @(StaticHelper.DefaultTabSelected(Model.UserConfig, ImportMode.OdometerRecord)) value="OdometerRecord">@translator.Translate(userLanguage, "Odometer")</!option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@if (User.IsInRole(nameof(UserData.IsRootUser)))
|
<div class="col-12 col-md-6">
|
||||||
{
|
<span class="lead">@translator.Translate(userLanguage, "Language")</span>
|
||||||
|
<select class="form-select" onchange="updateSettings()" id="defaultLanguage">
|
||||||
|
@foreach (string uiLanguage in Model.UILanguages)
|
||||||
|
{
|
||||||
|
<!option @(Model.UserConfig.UserLanguage == uiLanguage ? "selected" : "")>@uiLanguage</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (User.IsInRole(nameof(UserData.IsRootUser)))
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<span class="lead">Backups</span>
|
<span class="lead">@translator.Translate(userLanguage, "Backups")</span>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6 d-grid">
|
<div class="col-6 d-grid">
|
||||||
<button onclick="makeBackup()" class="btn btn-primary btn-md">Make</button>
|
<button onclick="makeBackup()" class="btn btn-primary btn-md">@translator.Translate(userLanguage, "Make")</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 d-grid">
|
<div class="col-6 d-grid">
|
||||||
<input onChange="restoreBackup(this)" type="file" accept=".zip" class="d-none" id="inputBackup">
|
<input onChange="restoreBackup(this)" type="file" accept=".zip" class="d-none" id="inputBackup">
|
||||||
<button onclick="openRestoreBackup()" class="btn btn-secondary btn-md">Restore</button>
|
<button onclick="openRestoreBackup()" class="btn btn-secondary btn-md">@translator.Translate(userLanguage, "Restore")</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-6">
|
||||||
|
<span class="lead">@translator.Translate(userLanguage, "Manage Languages")</span>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6 d-grid">
|
||||||
|
<input onChange="uploadLanguage(this)" type="file" accept=".json" class="d-none" id="inputLanguage">
|
||||||
|
<button onclick="openUploadLanguage()" class="btn btn-primary btn-md">@translator.Translate(userLanguage, "Upload")</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-6 d-grid">
|
||||||
}
|
<button onclick="deleteLanguage()" @(Model.UserConfig.UserLanguage == "en_US" ? "disabled" : "") class="btn btn-danger btn-md">@translator.Translate(userLanguage, "Delete")</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<h6 class="display-6 mt-2">About</h6>
|
<h6 class="display-6 mt-2">@translator.Translate(userLanguage, "About")</h6>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
@@ -146,20 +187,20 @@
|
|||||||
<img src="/defaults/lubelogger_logo.png" />
|
<img src="/defaults/lubelogger_logo.png" />
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<small class="text-body-secondary">Version 1.0.6</small>
|
<small class="text-body-secondary">Version 1.1.4</small>
|
||||||
</div>
|
</div>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
Proudly developed in the rural town of Price, Utah by Hargata Softworks.
|
Proudly developed in the rural town of Price, Utah by Hargata Softworks.
|
||||||
</p>
|
</p>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
If you enjoyed using this app, please consider spreading the good word.<br />
|
If you enjoyed using this app, please consider spreading the good word.<br />
|
||||||
If you are a commercial user, or if you just want to support the development of this project, consider subscribing to <a class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href="https://www.patreon.com/LubeLogger" target="_blank">our Patreon</a>
|
If you are a commercial user, or if you just want to support the development of this project, consider subscribing to <a class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href="https://www.patreon.com/LubeLogger" target="_blank">our Patreon</a> or make a <a class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" href="https://buy.stripe.com/aEU9Egc8DdMc9bO144" target="_blank">donation</a>
|
||||||
</p>
|
</p>
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
<h6 class="display-7 mt-2">Hometown Shoutout</h6>
|
<h6 class="display-7 mt-2">Hometown Shoutout</h6>
|
||||||
</div>
|
</div>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
Do you work remotely and are looking for a new place to call home? Consider looking into the rural Eastern Utah town of Price. Price and Carbon County
|
Do you work remotely and are looking for a new place to call home? Consider looking into the rural Eastern Utah town of Price. Price and Carbon County
|
||||||
has experienced pronounced decline in both population and economic activity within the past decade whereas the rest of the state experienced exponential growth.
|
has experienced pronounced decline in both population and economic activity within the past decade whereas the rest of the state experienced exponential growth.
|
||||||
It is conveniently located in between Salt Lake City and Moab Utah. Amenities are relatively complete in terms of big box stores and high speed fiber Internet.
|
It is conveniently located in between Salt Lake City and Moab Utah. Amenities are relatively complete in terms of big box stores and high speed fiber Internet.
|
||||||
Price and its surrounding towns as a whole could really benefit from in-migration. Thank you!
|
Price and its surrounding towns as a whole could really benefit from in-migration. Thank you!
|
||||||
@@ -179,6 +220,7 @@
|
|||||||
<li class="list-group-item">SweetAlert2</li>
|
<li class="list-group-item">SweetAlert2</li>
|
||||||
<li class="list-group-item">CsvHelper</li>
|
<li class="list-group-item">CsvHelper</li>
|
||||||
<li class="list-group-item">Chart.js</li>
|
<li class="list-group-item">Chart.js</li>
|
||||||
|
<li class="list-group-item">Drawdown</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -189,10 +231,18 @@
|
|||||||
});
|
});
|
||||||
return visibleTabs.toArray();
|
return visibleTabs.toArray();
|
||||||
}
|
}
|
||||||
function updateSettings(){
|
function deleteLanguage() {
|
||||||
|
var languageFileLocation = `/translations/${$("#defaultLanguage").val()}.json`;
|
||||||
|
$.post('/Files/DeleteFiles', { fileLocation: languageFileLocation }, function (data) {
|
||||||
|
//reset user language back to en_US
|
||||||
|
$("#defaultLanguage").val('en_US');
|
||||||
|
updateSettings();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function updateSettings() {
|
||||||
var visibleTabs = getCheckedTabs();
|
var visibleTabs = getCheckedTabs();
|
||||||
var defaultTab = $("#defaultTab").val();
|
var defaultTab = $("#defaultTab").val();
|
||||||
if (!visibleTabs.includes(defaultTab)){
|
if (!visibleTabs.includes(defaultTab)) {
|
||||||
defaultTab = "Dashboard"; //default to dashboard.
|
defaultTab = "Dashboard"; //default to dashboard.
|
||||||
}
|
}
|
||||||
var userConfigObject = {
|
var userConfigObject = {
|
||||||
@@ -203,16 +253,22 @@
|
|||||||
hideZero: $("#hideZero").is(":checked"),
|
hideZero: $("#hideZero").is(":checked"),
|
||||||
useUKMpg: $("#useUKMPG").is(":checked"),
|
useUKMpg: $("#useUKMPG").is(":checked"),
|
||||||
useThreeDecimalGasCost: $("#useThreeDecimal").is(":checked"),
|
useThreeDecimalGasCost: $("#useThreeDecimal").is(":checked"),
|
||||||
|
useMarkDownOnSavedNotes: $("#useMarkDownOnSavedNotes").is(":checked"),
|
||||||
|
enableAutoReminderRefresh: $("#enableAutoReminderRefresh").is(":checked"),
|
||||||
|
enableAutoOdometerInsert: $("#enableAutoOdometerInsert").is(":checked"),
|
||||||
|
preferredGasUnit: $("#preferredGasUnit").val(),
|
||||||
|
preferredGasMileageUnit: $("#preferredFuelMileageUnit").val(),
|
||||||
|
userLanguage: $("#defaultLanguage").val(),
|
||||||
visibleTabs: visibleTabs,
|
visibleTabs: visibleTabs,
|
||||||
defaultTab: defaultTab
|
defaultTab: defaultTab
|
||||||
}
|
}
|
||||||
sloader.show();
|
sloader.show();
|
||||||
$.post('/Home/WriteToSettings', { userConfig: userConfigObject}, function(data){
|
$.post('/Home/WriteToSettings', { userConfig: userConfigObject }, function (data) {
|
||||||
sloader.hide();
|
sloader.hide();
|
||||||
if (data) {
|
if (data) {
|
||||||
setTimeout(function () { window.location.href = '/Home/Index?tab=settings' }, 500);
|
setTimeout(function () { window.location.href = '/Home/Index?tab=settings' }, 500);
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error occurred, please try again later.")
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -221,9 +277,37 @@
|
|||||||
window.location.href = data;
|
window.location.href = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function openRestoreBackup(){
|
function openUploadLanguage(){
|
||||||
|
$("#inputLanguage").click();
|
||||||
|
}
|
||||||
|
function openRestoreBackup() {
|
||||||
$("#inputBackup").click();
|
$("#inputBackup").click();
|
||||||
}
|
}
|
||||||
|
function uploadLanguage(event){
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append("file", event.files[0]);
|
||||||
|
sloader.show();
|
||||||
|
$.ajax({
|
||||||
|
url: "/Files/HandleTranslationFileUpload",
|
||||||
|
data: formData,
|
||||||
|
cache: false,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
type: 'POST',
|
||||||
|
success: function (response) {
|
||||||
|
sloader.hide();
|
||||||
|
if (response.success) {
|
||||||
|
setTimeout(function () { window.location.href = '/Home/Index?tab=settings' }, 500);
|
||||||
|
} else {
|
||||||
|
errorToast(response.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
sloader.hide();
|
||||||
|
errorToast("An error has occurred, please check the file size and try again later.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function restoreBackup(event) {
|
function restoreBackup(event) {
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append("file", event.files[0]);
|
formData.append("file", event.files[0]);
|
||||||
@@ -237,29 +321,33 @@
|
|||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (response.trim() != '') {
|
if (response.trim() != '') {
|
||||||
$.post('/Files/RestoreBackup', { fileName : response}, function (data) {
|
$.post('/Files/RestoreBackup', { fileName: response }, function (data) {
|
||||||
sloader.hide();
|
sloader.hide();
|
||||||
if (data){
|
if (data) {
|
||||||
successToast("Backup Restored");
|
successToast("Backup Restored");
|
||||||
setTimeout(function () { window.location.href = '/Home/Index' }, 500);
|
setTimeout(function () { window.location.href = '/Home/Index' }, 500);
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error occurred, please try again later.");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
sloader.hide();
|
||||||
|
errorToast("An error has occurred, please check the file size and try again later.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function enableAuthCheckChanged(){
|
function enableAuthCheckChanged() {
|
||||||
var enableAuth = $("#enableAuth").is(":checked");
|
var enableAuth = $("#enableAuth").is(":checked");
|
||||||
if (enableAuth) {
|
if (enableAuth) {
|
||||||
//swal dialog to set up username and password.
|
//swal dialog to set up username and password.
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Setup Credentials',
|
title: 'Setup Credentials',
|
||||||
html: `
|
html: `
|
||||||
<input type="text" id="authUsername" class="swal2-input" placeholder="Username">
|
<input type="text" id="authUsername" class="swal2-input" placeholder="Username">
|
||||||
<input type="password" id="authPassword" class="swal2-input" placeholder="Password">
|
<input type="password" id="authPassword" class="swal2-input" placeholder="Password">
|
||||||
`,
|
`,
|
||||||
confirmButtonText: 'Setup',
|
confirmButtonText: 'Setup',
|
||||||
focusConfirm: false,
|
focusConfirm: false,
|
||||||
preConfirm: () => {
|
preConfirm: () => {
|
||||||
@@ -276,7 +364,7 @@
|
|||||||
if (data) {
|
if (data) {
|
||||||
setTimeout(function () { window.location.href = '/Login' }, 500);
|
setTimeout(function () { window.location.href = '/Login' }, 500);
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error occurred, please try again later.");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -286,7 +374,7 @@
|
|||||||
if (data) {
|
if (data) {
|
||||||
setTimeout(function () { window.location.href = '/Home' }, 1000);
|
setTimeout(function () { window.location.href = '/Home' }, 1000);
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error occurred, please try again later.");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,32 @@
|
|||||||
@{
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var logoUrl = config.GetLogoUrl();
|
||||||
|
var userLanguage = config.GetServerLanguage();
|
||||||
|
}
|
||||||
|
@{
|
||||||
ViewData["Title"] = "LubeLogger - Login";
|
ViewData["Title"] = "LubeLogger - Login";
|
||||||
}
|
}
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script src="~/js/login.js" asp-append-version="true"></script>
|
<script src="~/js/login.js"></script>
|
||||||
}
|
}
|
||||||
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<img src="/defaults/lubelogger_logo.png" />
|
<img src="@logoUrl" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserName">Username</label>
|
<label for="inputUserName">@translator.Translate(userLanguage, "Username")</label>
|
||||||
<input type="text" id="inputUserName" class="form-control">
|
<input type="text" id="inputUserName" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="button" class="btn btn-warning mt-2" onclick="requestPasswordReset()"><i class="bi bi-box-arrow-in-right me-2"></i>Request</button>
|
<button type="button" class="btn btn-warning mt-2" onclick="requestPasswordReset()"><i class="bi bi-box-arrow-in-right me-2"></i>@translator.Translate(userLanguage, "Request")</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<a href="/Login/ResetPassword" class="btn btn-link mt-2">I Have a Token</a>
|
<a href="/Login/ResetPassword" class="btn btn-link mt-2">@translator.Translate(userLanguage, "I Have a Token")</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<a href="/Login/Index" class="btn btn-link mt-2">Back to Login</a>
|
<a href="/Login/Index" class="btn btn-link mt-2">@translator.Translate(userLanguage, "Back to Login")</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,34 +1,47 @@
|
|||||||
@{
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model string
|
||||||
|
@{
|
||||||
|
var logoUrl = config.GetLogoUrl();
|
||||||
|
var userLanguage = config.GetServerLanguage();
|
||||||
|
}
|
||||||
|
@{
|
||||||
ViewData["Title"] = "LubeLogger - Login";
|
ViewData["Title"] = "LubeLogger - Login";
|
||||||
}
|
}
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script src="~/js/login.js" asp-append-version="true"></script>
|
<script src="~/js/login.js"></script>
|
||||||
}
|
}
|
||||||
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<img src="/defaults/lubelogger_logo.png" />
|
<img src="@logoUrl" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserName">Username</label>
|
<label for="inputUserName">@translator.Translate(userLanguage, "Username")</label>
|
||||||
<input type="text" id="inputUserName" class="form-control">
|
<input type="text" id="inputUserName" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserPassword">Password</label>
|
<label for="inputUserPassword">@translator.Translate(userLanguage, "Password")</label>
|
||||||
<input type="password" id="inputUserPassword" onkeyup="handlePasswordKeyPress(event)" class="form-control">
|
<input type="password" id="inputUserPassword" onkeyup="handlePasswordKeyPress(event)" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" role="switch" id="inputPersistent">
|
<input class="form-check-input" type="checkbox" role="switch" id="inputPersistent">
|
||||||
<label class="form-check-label" for="inputPersistent">Remember Me</label>
|
<label class="form-check-label" for="inputPersistent">@translator.Translate(userLanguage, "Remember Me")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="button" class="btn btn-warning mt-2" onclick="performLogin()"><i class="bi bi-box-arrow-in-right me-2"></i>Login</button>
|
<button type="button" class="btn btn-warning mt-2" onclick="performLogin()"><i class="bi bi-box-arrow-in-right me-2"></i>@translator.Translate(userLanguage, "Login")</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<a href="/Login/ForgotPassword" class="btn btn-link mt-2">Forgot Password</a>
|
<a href="/Login/ForgotPassword" class="btn btn-link mt-2">@translator.Translate(userLanguage, "Forgot Password")</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<a href="/Login/Registration" class="btn btn-link mt-2">Register</a>
|
<a href="/Login/Registration" class="btn btn-link mt-2">@translator.Translate(userLanguage, "Register")</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
function getRedirectURL(){
|
||||||
|
return { url: decodeHTMLEntities('@Model') };
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,34 +1,41 @@
|
|||||||
@{
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var logoUrl = config.GetLogoUrl();
|
||||||
|
var userLanguage = config.GetServerLanguage();
|
||||||
|
}
|
||||||
|
@{
|
||||||
ViewData["Title"] = "LubeLogger - Register";
|
ViewData["Title"] = "LubeLogger - Register";
|
||||||
}
|
}
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script src="~/js/login.js" asp-append-version="true"></script>
|
<script src="~/js/login.js"></script>
|
||||||
}
|
}
|
||||||
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<img src="/defaults/lubelogger_logo.png" />
|
<img src="@logoUrl" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputToken">Token</label>
|
<label for="inputToken">@translator.Translate(userLanguage, "Token")</label>
|
||||||
<input type="text" id="inputToken" class="form-control">
|
<input type="text" id="inputToken" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserName">Email Address</label>
|
<label for="inputUserName">@translator.Translate(userLanguage, "Email Address")</label>
|
||||||
<input type="text" id="inputEmail" class="form-control">
|
<input type="text" id="inputEmail" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserName">Username</label>
|
<label for="inputUserName">@translator.Translate(userLanguage, "Username")</label>
|
||||||
<input type="text" id="inputUserName" class="form-control">
|
<input type="text" id="inputUserName" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserPassword">Password</label>
|
<label for="inputUserPassword">@translator.Translate(userLanguage, "Password")</label>
|
||||||
<input type="password" id="inputUserPassword" class="form-control">
|
<input type="password" id="inputUserPassword" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="button" class="btn btn-warning mt-2" onclick="performRegistration()"><i class="bi bi-box-arrow-in-right me-2"></i>Register</button>
|
<button type="button" class="btn btn-warning mt-2" onclick="performRegistration()"><i class="bi bi-box-arrow-in-right me-2"></i>@translator.Translate(userLanguage, "Register")</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<a href="/Login/Index" class="btn btn-link mt-2">Back to Login</a>
|
<a href="/Login/Index" class="btn btn-link mt-2">@translator.Translate(userLanguage, "Back to Login")</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,30 +1,37 @@
|
|||||||
@{
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var logoUrl = config.GetLogoUrl();
|
||||||
|
var userLanguage = config.GetServerLanguage();
|
||||||
|
}
|
||||||
|
@{
|
||||||
ViewData["Title"] = "LubeLogger - Register";
|
ViewData["Title"] = "LubeLogger - Register";
|
||||||
}
|
}
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script src="~/js/login.js" asp-append-version="true"></script>
|
<script src="~/js/login.js"></script>
|
||||||
}
|
}
|
||||||
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
<div class="container d-flex align-items-center justify-content-center" style="height:100vh">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<img src="/defaults/lubelogger_logo.png" />
|
<img src="@logoUrl" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputToken">Token</label>
|
<label for="inputToken">@translator.Translate(userLanguage, "Token")</label>
|
||||||
<input type="text" id="inputToken" class="form-control">
|
<input type="text" id="inputToken" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserName">Email Address</label>
|
<label for="inputUserName">@translator.Translate(userLanguage, "Email Address")</label>
|
||||||
<input type="text" id="inputEmail" class="form-control">
|
<input type="text" id="inputEmail" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputUserPassword">New Password</label>
|
<label for="inputUserPassword">@translator.Translate(userLanguage, "New Password")</label>
|
||||||
<input type="password" id="inputUserPassword" class="form-control">
|
<input type="password" id="inputUserPassword" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<button type="button" class="btn btn-warning mt-2" onclick="performPasswordReset()"><i class="bi bi-box-arrow-in-right me-2"></i>Reset Password</button>
|
<button type="button" class="btn btn-warning mt-2" onclick="performPasswordReset()"><i class="bi bi-box-arrow-in-right me-2"></i>@translator.Translate(userLanguage, "Reset Password")</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
<a href="/Login/Index" class="btn btn-link mt-2">Back to Login</a>
|
<a href="/Login/Index" class="btn btn-link mt-2">@translator.Translate(userLanguage, "Back to Login")</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
<h1>Access Denied</h1>
|
<div class="row">
|
||||||
|
<div class="col-1">
|
||||||
|
<a href="/Home" class="btn btn-secondary btn-md mt-1 mb-1"><i class="bi bi-arrow-left-square"></i></a>
|
||||||
|
</div>
|
||||||
|
<div class="col-11">
|
||||||
|
<h1>Access Denied</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var userConfig = config.GetUserConfig(User);
|
var userConfig = config.GetUserConfig(User);
|
||||||
var useDarkMode = userConfig.UseDarkMode;
|
var useDarkMode = userConfig.UseDarkMode;
|
||||||
var enableCsvImports = userConfig.EnableCsvImports;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var useMPG = userConfig.UseMPG;
|
||||||
|
var useMarkDown = userConfig.UseMarkDownOnSavedNotes;
|
||||||
|
var useThreeDecimals = userConfig.UseThreeDecimalGasCost;
|
||||||
var shortDatePattern = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
|
var shortDatePattern = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
|
||||||
|
var numberFormat = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
shortDatePattern = shortDatePattern.ToLower();
|
shortDatePattern = shortDatePattern.ToLower();
|
||||||
if (!shortDatePattern.Contains("dd"))
|
if (!shortDatePattern.Contains("dd"))
|
||||||
{
|
{
|
||||||
@@ -27,9 +33,10 @@
|
|||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap-icons.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap-icons.css" />
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap-datepicker/css/bootstrap-datepicker.min.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap-datepicker/css/bootstrap-datepicker.min.css" />
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/lib/bootstrap-tagsinput/bootstrap-tagsinput.css" />
|
||||||
<link rel="stylesheet" href="~/css/loader.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/css/site.css"/>
|
||||||
<link rel="stylesheet" href="~/sweetalert/sweetalert2.min.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/css/loader.css"/>
|
||||||
|
<link rel="stylesheet" href="~/sweetalert/sweetalert2.min.css"/>
|
||||||
<link rel="icon" sizes="192x192" href="~/defaults/lubelogger_icon_192.png" />
|
<link rel="icon" sizes="192x192" href="~/defaults/lubelogger_icon_192.png" />
|
||||||
<link rel="icon" sizes="128x128" href="~/defaults/lubelogger_icon_128.png" />
|
<link rel="icon" sizes="128x128" href="~/defaults/lubelogger_icon_128.png" />
|
||||||
<link rel="apple-touch-icon" sizes="128x128" href="~/defaults/lubelogger_icon_128.png" />
|
<link rel="apple-touch-icon" sizes="128x128" href="~/defaults/lubelogger_icon_128.png" />
|
||||||
@@ -40,13 +47,18 @@
|
|||||||
<script src="~/js/shared.js"></script>
|
<script src="~/js/shared.js"></script>
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="~/lib/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
|
<script src="~/lib/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
|
||||||
|
<script src="~/lib/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
|
||||||
<script src="~/sweetalert/sweetalert2.all.min.js"></script>
|
<script src="~/sweetalert/sweetalert2.all.min.js"></script>
|
||||||
<script src="~/js/loader.js"></script>
|
<script src="~/js/loader.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function getGlobalConfig() {
|
function getGlobalConfig() {
|
||||||
return {
|
return {
|
||||||
useDarkMode : "@useDarkMode" == "True",
|
useDarkMode : "@useDarkMode" == "True",
|
||||||
enableCsvImport : "@enableCsvImports" == "True"
|
enableCsvImport : "@enableCsvImports" == "True",
|
||||||
|
useMarkDown: "@useMarkDown" == "True",
|
||||||
|
currencySymbol: decodeHTMLEntities("@numberFormat.CurrencySymbol"),
|
||||||
|
useThreeDecimals: "@useThreeDecimals" == "True",
|
||||||
|
useMPG: "@useMPG" == "True"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getShortDatePattern() {
|
function getShortDatePattern() {
|
||||||
@@ -54,6 +66,30 @@
|
|||||||
pattern: "@shortDatePattern"
|
pattern: "@shortDatePattern"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function globalParseFloat(input){
|
||||||
|
//remove thousands separator.
|
||||||
|
var thousandSeparator = "@numberFormat.NumberGroupSeparator";
|
||||||
|
var decimalSeparator = "@numberFormat.NumberDecimalSeparator";
|
||||||
|
var currencySymbol = decodeHTMLEntities("@numberFormat.CurrencySymbol");
|
||||||
|
if (input == "---") {
|
||||||
|
input = "0";
|
||||||
|
}
|
||||||
|
//strip thousands from input.
|
||||||
|
input = input.replace(thousandSeparator, "");
|
||||||
|
//convert to JS format where decimal is only separated by .
|
||||||
|
input = input.replace(decimalSeparator, ".");
|
||||||
|
//remove any currency symbol
|
||||||
|
input = input.replace(currencySymbol, "");
|
||||||
|
return parseFloat(input);
|
||||||
|
}
|
||||||
|
function globalFloatToString(input) {
|
||||||
|
var decimalSeparator = "@numberFormat.NumberDecimalSeparator";
|
||||||
|
input = input.replace(".", decimalSeparator);
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
function genericErrorMessage(){
|
||||||
|
return decodeHTMLEntities('@translator.Translate(userLanguage, "An error has occurred, please try again later")');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@await RenderSectionAsync("Scripts", required: false)
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -3,68 +3,71 @@
|
|||||||
ViewData["Title"] = "LubeLogger - View Vehicle";
|
ViewData["Title"] = "LubeLogger - View Vehicle";
|
||||||
}
|
}
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var userConfig = config.GetUserConfig(User);
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
@model Vehicle
|
@model Vehicle
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
<script src="~/js/vehicle.js" asp-append-version="true"></script>
|
<script src="~/js/vehicle.js"></script>
|
||||||
<script src="~/js/servicerecord.js" asp-append-version="true"></script>
|
<script src="~/js/servicerecord.js"></script>
|
||||||
<script src="~/js/gasrecord.js" asp-append-version="true"></script>
|
<script src="~/js/gasrecord.js"></script>
|
||||||
<script src="~/js/collisionrecord.js" asp-append-version="true"></script>
|
<script src="~/js/collisionrecord.js"></script>
|
||||||
<script src="~/js/taxrecord.js" asp-append-version="true"></script>
|
<script src="~/js/taxrecord.js"></script>
|
||||||
<script src="~/js/reminderrecord.js" asp-append-version="true"></script>
|
<script src="~/js/reminderrecord.js"></script>
|
||||||
<script src="~/js/upgraderecord.js" asp-append-version="true"></script>
|
<script src="~/js/upgraderecord.js"></script>
|
||||||
<script src="~/js/note.js" asp-append-version="true"></script>
|
<script src="~/js/note.js"></script>
|
||||||
<script src="~/js/reports.js" asp-append-version="true"></script>
|
<script src="~/js/reports.js"></script>
|
||||||
<script src="~/js/supplyrecord.js" asp-append-version="true"></script>
|
<script src="~/js/supplyrecord.js"></script>
|
||||||
<script src="~/js/planrecord.js" asp-append-version="true"></script>
|
<script src="~/js/planrecord.js"></script>
|
||||||
<script src="~/js/odometerrecord.js" asp-append-version="true"></script>
|
<script src="~/js/odometerrecord.js"></script>
|
||||||
<script src="~/lib/chart-js/chart.umd.js"></script>
|
<script src="~/lib/chart-js/chart.umd.js"></script>
|
||||||
|
<script src="~/lib/drawdown/drawdown.js"></script>
|
||||||
}
|
}
|
||||||
<div class="lubelogger-mobile-nav" onclick="hideMobileNav()">
|
<div class="lubelogger-mobile-nav" onclick="hideMobileNav()">
|
||||||
<ul class="nav navbar-nav" id="vehicleTab" role="tablist">
|
<ul class="nav navbar-nav" id="vehicleTab" role="tablist">
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link" onclick="returnToGarage()"><span class="display-3 ms-2"><i class="bi bi-arrow-left-square"></i>Garage</span></button>
|
<button class="nav-link" onclick="returnToGarage()"><span class="display-3 ms-2"><i class="bi bi-arrow-left-square me-2"></i>@translator.Translate(userLanguage,"Garage")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link" onclick="editVehicle(@Model.Id)"><span class="display-3 ms-2"><i class="bi bi-pencil-square"></i>Edit Vehicle</span></button>
|
<button class="nav-link" onclick="editVehicle(@Model.Id)"><span class="display-3 ms-2"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Edit Vehicle")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.Dashboard)" id="report-tab" data-bs-toggle="tab" data-bs-target="#report-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-file-bar-graph me-2"></i>Dashboard</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.Dashboard)" id="report-tab" data-bs-toggle="tab" data-bs-target="#report-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-file-bar-graph me-2"></i>@translator.Translate(userLanguage, "Dashboard")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.PlanRecord)" id="plan-tab" data-bs-toggle="tab" data-bs-target="#plan-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-bar-chart-steps me-2"></i>Planner</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.PlanRecord)" id="plan-tab" data-bs-toggle="tab" data-bs-target="#plan-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-bar-chart-steps me-2"></i>@translator.Translate(userLanguage, "Planner")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.OdometerRecord)" id="odometer-tab" data-bs-toggle="tab" data-bs-target="#odometer-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-speedometer me-2"></i>Odometer</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.OdometerRecord)" id="odometer-tab" data-bs-toggle="tab" data-bs-target="#odometer-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-speedometer me-2"></i>@translator.Translate(userLanguage, "Odometer")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ServiceRecord)" id="servicerecord-tab" data-bs-toggle="tab" data-bs-target="#servicerecord-tab-pane" type="button" role="tab" aria-selected="true"><span class="display-3 ms-2"><i class="bi bi-card-checklist me-2"></i>Service Records</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ServiceRecord)" id="servicerecord-tab" data-bs-toggle="tab" data-bs-target="#servicerecord-tab-pane" type="button" role="tab" aria-selected="true"><span class="display-3 ms-2"><i class="bi bi-card-checklist me-2"></i>@translator.Translate(userLanguage, "Service Records")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.RepairRecord)" id="accident-tab" data-bs-toggle="tab" data-bs-target="#accident-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-exclamation-octagon me-2"></i>Repairs</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.RepairRecord)" id="accident-tab" data-bs-toggle="tab" data-bs-target="#accident-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-exclamation-octagon me-2"></i>@translator.Translate(userLanguage,"Repairs")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.UpgradeRecord)" id="upgrade-tab" data-bs-toggle="tab" data-bs-target="#upgrade-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-wrench-adjustable me-2"></i>Upgrades</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.UpgradeRecord)" id="upgrade-tab" data-bs-toggle="tab" data-bs-target="#upgrade-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-wrench-adjustable me-2"></i>@translator.Translate(userLanguage, "Upgrades")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.GasRecord)" id="gas-tab" data-bs-toggle="tab" data-bs-target="#gas-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-fuel-pump me-2"></i>Fuel</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.GasRecord)" id="gas-tab" data-bs-toggle="tab" data-bs-target="#gas-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-fuel-pump me-2"></i>@translator.Translate(userLanguage, "Fuel")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.SupplyRecord)" id="supply-tab" data-bs-toggle="tab" data-bs-target="#supply-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-shop me-2"></i>Supplies</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.SupplyRecord)" id="supply-tab" data-bs-toggle="tab" data-bs-target="#supply-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-shop me-2"></i>@translator.Translate(userLanguage, "Supplies")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.TaxRecord)" id="tax-tab" data-bs-toggle="tab" data-bs-target="#tax-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-currency-dollar me-2"></i>Taxes</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.TaxRecord)" id="tax-tab" data-bs-toggle="tab" data-bs-target="#tax-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-currency-dollar me-2"></i>@translator.Translate(userLanguage, "Taxes")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.NoteRecord)" id="notes-tab" data-bs-toggle="tab" data-bs-target="#notes-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-journal-bookmark me-2"></i>Notes</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.NoteRecord)" id="notes-tab" data-bs-toggle="tab" data-bs-target="#notes-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><i class="bi bi-journal-bookmark me-2"></i>@translator.Translate(userLanguage, "Notes")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ReminderRecord)" id="reminder-tab" data-bs-toggle="tab" data-bs-target="#reminder-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><div class="reminderBellDiv" style="display:inline-flex;"><i class="reminderBell bi bi-bell me-2"></i></div>Reminders</span></button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ReminderRecord)" id="reminder-tab" data-bs-toggle="tab" data-bs-target="#reminder-tab-pane" type="button" role="tab" aria-selected="false"><span class="display-3 ms-2"><div class="reminderBellDiv" style="display:inline-flex;"><i class="reminderBell bi bi-bell me-2"></i></div>@translator.Translate(userLanguage, "Reminders")</span></button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button onclick="deleteVehicle(@Model.Id)" class="dropdown-item"><span class="display-3 ms-2"><i class="bi bi-trash me-2"></i>Delete Vehicle</span></button>
|
<button onclick="deleteVehicle(@Model.Id)" class="dropdown-item"><span class="display-3 ms-2"><i class="bi bi-trash me-2"></i>@translator.Translate(userLanguage, "Delete Vehicle")</span></button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -82,42 +85,42 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<ul class="nav nav-tabs lubelogger-tab" id="vehicleTab" role="tablist">
|
<ul class="nav nav-tabs lubelogger-tab" id="vehicleTab" role="tablist">
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.Dashboard)" id="report-tab" data-bs-toggle="tab" data-bs-target="#report-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-file-bar-graph me-2"></i>Dash</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.Dashboard)" id="report-tab" data-bs-toggle="tab" data-bs-target="#report-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-file-bar-graph me-2"></i>@translator.Translate(userLanguage,"Dashboard")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.PlanRecord)" id="plan-tab" data-bs-toggle="tab" data-bs-target="#plan-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-bar-chart-steps me-2"></i>Planner</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.PlanRecord)" id="plan-tab" data-bs-toggle="tab" data-bs-target="#plan-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-bar-chart-steps me-2"></i>@translator.Translate(userLanguage, "Planner")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.OdometerRecord)" id="odometer-tab" data-bs-toggle="tab" data-bs-target="#odometer-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-speedometer me-2"></i>Odometer</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.OdometerRecord)" id="odometer-tab" data-bs-toggle="tab" data-bs-target="#odometer-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-speedometer me-2"></i>@translator.Translate(userLanguage, "Odometer")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ServiceRecord)" id="servicerecord-tab" data-bs-toggle="tab" data-bs-target="#servicerecord-tab-pane" type="button" role="tab" aria-selected="true"><i class="bi bi-card-checklist me-2"></i>Service Records</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ServiceRecord)" id="servicerecord-tab" data-bs-toggle="tab" data-bs-target="#servicerecord-tab-pane" type="button" role="tab" aria-selected="true"><i class="bi bi-card-checklist me-2"></i>@translator.Translate(userLanguage, "Service Records")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.RepairRecord)" id="accident-tab" data-bs-toggle="tab" data-bs-target="#accident-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-exclamation-octagon me-2"></i>Repairs</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.RepairRecord)" id="accident-tab" data-bs-toggle="tab" data-bs-target="#accident-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-exclamation-octagon me-2"></i>@translator.Translate(userLanguage, "Repairs")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.UpgradeRecord)" id="upgrade-tab" data-bs-toggle="tab" data-bs-target="#upgrade-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-wrench-adjustable me-2"></i>Upgrades</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.UpgradeRecord)" id="upgrade-tab" data-bs-toggle="tab" data-bs-target="#upgrade-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-wrench-adjustable me-2"></i>@translator.Translate(userLanguage, "Upgrades")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.GasRecord)" id="gas-tab" data-bs-toggle="tab" data-bs-target="#gas-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-fuel-pump me-2"></i>Fuel</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.GasRecord)" id="gas-tab" data-bs-toggle="tab" data-bs-target="#gas-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-fuel-pump me-2"></i>@translator.Translate(userLanguage, "Fuel")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.SupplyRecord)" id="supply-tab" data-bs-toggle="tab" data-bs-target="#supply-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-shop me-2"></i>Supplies</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.SupplyRecord)" id="supply-tab" data-bs-toggle="tab" data-bs-target="#supply-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-shop me-2"></i>@translator.Translate(userLanguage, "Supplies")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.TaxRecord)" id="tax-tab" data-bs-toggle="tab" data-bs-target="#tax-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-currency-dollar me-2"></i>Taxes</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.TaxRecord)" id="tax-tab" data-bs-toggle="tab" data-bs-target="#tax-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-currency-dollar me-2"></i>@translator.Translate(userLanguage, "Taxes")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.NoteRecord)" id="notes-tab" data-bs-toggle="tab" data-bs-target="#notes-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-journal-bookmark me-2"></i>Notes</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.NoteRecord)" id="notes-tab" data-bs-toggle="tab" data-bs-target="#notes-tab-pane" type="button" role="tab" aria-selected="false"><i class="bi bi-journal-bookmark me-2"></i>@translator.Translate(userLanguage, "Notes")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ReminderRecord)" id="reminder-tab" data-bs-toggle="tab" data-bs-target="#reminder-tab-pane" type="button" role="tab" aria-selected="false"><div class="reminderBellDiv" style="display:inline-flex;"><i class="reminderBell bi bi-bell me-2"></i></div>Reminders</button>
|
<button class="nav-link @StaticHelper.DefaultActiveTab(userConfig, ImportMode.ReminderRecord)" id="reminder-tab" data-bs-toggle="tab" data-bs-target="#reminder-tab-pane" type="button" role="tab" aria-selected="false"><div class="reminderBellDiv" style="display:inline-flex;"><i class="reminderBell bi bi-bell me-2"></i></div>@translator.Translate(userLanguage, "Reminders")</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item dropdown ms-auto" role="presentation">
|
<li class="nav-item dropdown ms-auto" role="presentation">
|
||||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Manage Vehicle</a>
|
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">@translator.Translate(userLanguage, "Manage Vehicle")</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><button onclick="deleteVehicle(@Model.Id)" class="dropdown-item"><i class="bi bi-trash me-2"></i>Delete Vehicle</button></li>
|
<li><button onclick="deleteVehicle(@Model.Id)" class="dropdown-item"><i class="bi bi-trash me-2"></i>@translator.Translate(userLanguage, "Delete Vehicle")</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -147,12 +150,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal fade" id="reminderRecordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
<div class="modal fade" data-bs-focus="false" id="reminderRecordModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content" id="reminderRecordModalContent">
|
<div class="modal-content" id="reminderRecordModalContent">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal fade" data-bs-focus="false" id="inputSuppliesModal" tabindex="-1" role="dialog" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content" id="inputSuppliesModalContent"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
function GetVehicleId() {
|
function GetVehicleId() {
|
||||||
return { vehicleId: @Model.Id};
|
return { vehicleId: @Model.Id};
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
@model ImportMode
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model ImportMode
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">Import Data from CSV</h5>
|
<h5 class="modal-title">@translator.Translate(userLanguage, "Import Data from CSV")</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideBulkImportModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideBulkImportModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -9,37 +16,40 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
In order for this utility to function properly, your CSV file MUST be formatted exactly like the provided sample.
|
@translator.Translate(userLanguage, "In order for this utility to function properly, your CSV file MUST be formatted exactly like the provided sample. Dates must be supplied in a string. Numbers must be supplied as numbers without currency formatting.")
|
||||||
Dates must be supplied in a string.
|
|
||||||
Numbers must be supplied as numbers without currency formatting.
|
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-danger" role="alert">
|
<div class="alert alert-danger" role="alert">
|
||||||
Failure to format the data correctly can cause data corruption. Please make sure you make a copy of the local database before proceeding.
|
@translator.Translate(userLanguage, "Failure to format the data correctly can cause data corruption. Please make sure you make a copy of the local database before proceeding.")
|
||||||
</div>
|
</div>
|
||||||
@if (Model == ImportMode.GasRecord)
|
@if (Model == ImportMode.GasRecord)
|
||||||
{
|
{
|
||||||
<a class="btn btn-link" href="/defaults/gassample.csv" target="_blank">Download Sample</a>
|
<a class="btn btn-link" href="/defaults/gassample.csv" target="_blank">@translator.Translate(userLanguage, "Download Sample")</a>
|
||||||
} else if (Model == ImportMode.ServiceRecord || Model == ImportMode.RepairRecord || Model == ImportMode.UpgradeRecord)
|
}
|
||||||
|
else if (Model == ImportMode.ServiceRecord || Model == ImportMode.RepairRecord || Model == ImportMode.UpgradeRecord)
|
||||||
{
|
{
|
||||||
<a class="btn btn-link" href="/defaults/servicerecordsample.csv" target="_blank">Download Sample</a>
|
<a class="btn btn-link" href="/defaults/servicerecordsample.csv" target="_blank">@translator.Translate(userLanguage, "Download Sample")</a>
|
||||||
} else if (Model == ImportMode.TaxRecord)
|
}
|
||||||
|
else if (Model == ImportMode.TaxRecord)
|
||||||
{
|
{
|
||||||
<a class="btn btn-link" href="/defaults/taxrecordsample.csv" target="_blank">Download Sample</a>
|
<a class="btn btn-link" href="/defaults/taxrecordsample.csv" target="_blank">@translator.Translate(userLanguage, "Download Sample")</a>
|
||||||
} else if (Model == ImportMode.SupplyRecord)
|
}
|
||||||
|
else if (Model == ImportMode.SupplyRecord)
|
||||||
{
|
{
|
||||||
<a class="btn btn-link" href="/defaults/supplysample.csv" target="_blank">Download Sample</a>
|
<a class="btn btn-link" href="/defaults/supplysample.csv" target="_blank">@translator.Translate(userLanguage, "Download Sample")</a>
|
||||||
} else if (Model == ImportMode.PlanRecord)
|
}
|
||||||
|
else if (Model == ImportMode.PlanRecord)
|
||||||
{
|
{
|
||||||
<a class="btn btn-link" href="/defaults/plansample.csv" target="_blank">Download Sample</a>
|
<a class="btn btn-link" href="/defaults/plansample.csv" target="_blank">@translator.Translate(userLanguage, "Download Sample")</a>
|
||||||
} else if (Model == ImportMode.OdometerRecord)
|
}
|
||||||
|
else if (Model == ImportMode.OdometerRecord)
|
||||||
{
|
{
|
||||||
<a class="btn btn-link" href="/defaults/odometersample.csv" target="_blank">Download Sample</a>
|
<a class="btn btn-link" href="/defaults/odometersample.csv" target="_blank">@translator.Translate(userLanguage, "Download Sample")</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="csvFileUploader">Upload CSV File</label>
|
<label for="csvFileUploader">@translator.Translate(userLanguage, "Upload CSV File")</label>
|
||||||
<input onChange="uploadFileAsync(this)" type="file" multiple accept=".csv" class="form-control-file" id="csvFileUploader">
|
<input onChange="uploadFileAsync(this)" type="file" multiple accept=".csv" class="form-control-file" id="csvFileUploader">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -47,8 +57,8 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideBulkImportModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideBulkImportModal()">@translator.Translate(userLanguage, "Cancel")</button>
|
||||||
<button type="button" onclick="importFromCsv()" class="btn btn-primary">Import</button>
|
<button type="button" onclick="importFromCsv()" class="btn btn-primary">@translator.Translate(userLanguage, "Import")</button>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var uploadedFile = "";
|
var uploadedFile = "";
|
||||||
@@ -73,13 +83,13 @@
|
|||||||
getVehicleUpgradeRecords(vehicleId);
|
getVehicleUpgradeRecords(vehicleId);
|
||||||
} else if (mode == "SupplyRecord") {
|
} else if (mode == "SupplyRecord") {
|
||||||
getVehicleSupplyRecords(vehicleId);
|
getVehicleSupplyRecords(vehicleId);
|
||||||
} else if (mode == "PlanRecord"){
|
} else if (mode == "PlanRecord") {
|
||||||
getVehiclePlanRecords(vehicleId);
|
getVehiclePlanRecords(vehicleId);
|
||||||
} else if (mode == "OdometerRecord") {
|
} else if (mode == "OdometerRecord") {
|
||||||
getVehicleOdometerRecords(vehicleId);
|
getVehicleOdometerRecords(vehicleId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error has occurred, please double check the data and try again.");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
@model List<UserCollaborator>
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model List<UserCollaborator>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<span class="lead">Collaborators</span>
|
<span class="lead">@translator.Translate(userLanguage, "Collaborators")</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<button onclick="addCollaborator()" class="btn btn-link btn-sm"><i class="bi bi-person-add"></i></button>
|
<button onclick="addCollaborator()" class="btn btn-link btn-sm"><i class="bi bi-person-add"></i></button>
|
||||||
@@ -11,8 +18,8 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-8">Username</th>
|
<th scope="col" class="col-8">@translator.Translate(userLanguage, "Username")</th>
|
||||||
<th scope="col" class="col-4">Delete</th>
|
<th scope="col" class="col-4">@translator.Translate(userLanguage, "Delete")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -37,7 +44,7 @@
|
|||||||
if (data) {
|
if (data) {
|
||||||
refreshCollaborators();
|
refreshCollaborators();
|
||||||
} else {
|
} else {
|
||||||
errorToast("An error occurred, please try again later");
|
errorToast(genericErrorMessage());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
@model CollisionRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model CollisionRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Repair Record" : "Edit Repair Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Repair Record") : translator.Translate(userLanguage,"Edit Repair Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddCollisionRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddCollisionRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,27 +17,39 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="collisionRecordDate">Date</label>
|
<label for="collisionRecordDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="collisionRecordDate" class="form-control" placeholder="Date repair was performed" value="@Model.Date">
|
<input type="text" id="collisionRecordDate" class="form-control" placeholder="@translator.Translate(userLanguage,"Date repair was performed")" value="@Model.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<label for="collisionRecordMileage">Odometer</label>
|
<label for="collisionRecordMileage">@translator.Translate(userLanguage,"Odometer")</label>
|
||||||
<input type="number" id="collisionRecordMileage" class="form-control" placeholder="Odometer reading when repaired" value="@(isNew ? "" : Model.Mileage)">
|
<input type="number" id="collisionRecordMileage" class="form-control" placeholder="@translator.Translate(userLanguage,"Odometer reading when repaired")" value="@(isNew ? "" : Model.Mileage)">
|
||||||
<label for="collisionRecordDescription">Description</label>
|
<label for="collisionRecordDescription">@translator.Translate(userLanguage,"Description")</label>
|
||||||
<input type="text" id="collisionRecordDescription" class="form-control" placeholder="Description of item(s) repaired(i.e. Alternator)" value="@Model.Description">
|
<input type="text" id="collisionRecordDescription" class="form-control" placeholder="@translator.Translate(userLanguage,"Description of item(s) repaired(i.e. Alternator)")" value="@Model.Description">
|
||||||
<label for="collisionRecordCost">Cost</label>
|
<label for="collisionRecordCost">@translator.Translate(userLanguage,"Cost")</label>
|
||||||
<input type="text" id="collisionRecordCost" class="form-control" placeholder="Cost of the repair" value="@(isNew ? "" : Model.Cost)">
|
<input type="text" id="collisionRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage,"Cost of the repair")" value="@(isNew ? "" : Model.Cost)">
|
||||||
|
@if (isNew)
|
||||||
|
{
|
||||||
|
@await Html.PartialAsync("_SupplyStore", "RepairRecord")
|
||||||
|
}
|
||||||
|
<label for="collisionRecordTag">@translator.Translate(userLanguage,"Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="collisionRecordTag">
|
||||||
|
@foreach (string tag in Model.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="collisionRecordNotes">Notes(optional)</label>
|
<label for="collisionRecordNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="collisionRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="collisionRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
@if (Model.Files.Any())
|
@if (Model.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
<label for="collisionRecordFiles">Upload more documents</label>
|
<label for="collisionRecordFiles">@translator.Translate(userLanguage,"Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="collisionRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="collisionRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -42,12 +59,13 @@
|
|||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
||||||
<label class="form-check-label" for="addReminderCheck">
|
<label class="form-check-label" for="addReminderCheck">
|
||||||
Add Reminder
|
@translator.Translate(userLanguage,"Add Reminder")
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<label for="collisionRecordFiles">Upload documents(optional)</label>
|
<label for="collisionRecordFiles">@translator.Translate(userLanguage,"Upload documents(optional)")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="collisionRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="collisionRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,20 +75,31 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteCollisionRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<div class="btn-group" style="margin-right:auto;">
|
||||||
|
<button type="button" class="btn btn-md mt-1 mb-1 btn-danger" onclick="deleteCollisionRecord(@Model.Id)">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
|
<button type="button" class="btn btn-md btn-danger btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage,"Move To")</h6></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="moveRecord(@Model.Id, 'RepairRecord', 'ServiceRecord')">@translator.Translate(userLanguage,"Service Records")</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="moveRecord(@Model.Id, 'RepairRecord', 'UpgradeRecord')">@translator.Translate(userLanguage,"Upgrades")</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddCollisionRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddCollisionRecordModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveCollisionRecordToVehicle()">Add New Repair Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveCollisionRecordToVehicle()">@translator.Translate(userLanguage,"Add New Repair Record")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveCollisionRecordToVehicle(true)">Edit Repair Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveCollisionRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Repair Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var uploadedFiles = [];
|
var uploadedFiles = [];
|
||||||
|
var selectedSupplies = [];
|
||||||
getUploadedFilesFromModel();
|
getUploadedFilesFromModel();
|
||||||
function getUploadedFilesFromModel() {
|
function getUploadedFilesFromModel() {
|
||||||
@foreach (UploadedFiles filesUploaded in Model.Files)
|
@foreach (UploadedFiles filesUploaded in Model.Files)
|
||||||
|
|||||||
@@ -1,33 +1,49 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var hideZero = userConfig.HideZero;
|
||||||
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
@model List<CollisionRecord>
|
@model List<CollisionRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Repair Records: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="count">@($"{translator.Translate(userLanguage,"# of Repair Records")}: {Model.Count()}")</span>
|
||||||
<span class="ms-2 badge bg-primary">@($"Total: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
<span class="ms-2 badge bg-primary" data-aggregate-type="sum">@($"{translator.Translate(userLanguage,"Total")}: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<span onclick="filterTable('accident-tab-pane', this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
|
}
|
||||||
|
<datalist id="tagList">
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddCollisionRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Repair Record</button>
|
<button onclick="showAddCollisionRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Repair Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('RepairRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('RepairRecord')">@translator.Translate(userLanguage,"Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('RepairRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('RepairRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<button onclick="showAddCollisionRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Repair Record</button>
|
<button onclick="showAddCollisionRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Repair Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,21 +58,21 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">Date</th>
|
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage,"Date")</th>
|
||||||
<th scope="col" class="col-2">Odometer</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage,"Odometer")</th>
|
||||||
<th scope="col" class="col-3 col-xl-4">Description</th>
|
<th scope="col" class="col-3 col-xl-4">@translator.Translate(userLanguage,"Description")</th>
|
||||||
<th scope="col" class="col-2">Cost</th>
|
<th scope="col" class="col-2" onclick="toggleSort('accident-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage,"Cost")</th>
|
||||||
<th scope="col" class="col-3">Notes</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage,"Notes")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (CollisionRecord collisionRecord in Model)
|
@foreach (CollisionRecord collisionRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditCollisionRecordModal(@collisionRecord.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditCollisionRecordModal(@collisionRecord.Id)" data-tags='@string.Join(" ", collisionRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@collisionRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1">@collisionRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-2">@collisionRecord.Mileage</td>
|
<td class="col-2">@collisionRecord.Mileage</td>
|
||||||
<td class="col-3 col-xl-4">@collisionRecord.Description</td>
|
<td class="col-3 col-xl-4">@collisionRecord.Description</td>
|
||||||
<td class="col-2">@((hideZero && collisionRecord.Cost == default) ? "---" : collisionRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-record-type="cost">@((hideZero && collisionRecord.Cost == default) ? "---" : collisionRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(collisionRecord.Notes)</td>
|
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(collisionRecord.Notes)</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
@model CostMakeUpForVehicle
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model CostMakeUpForVehicle
|
||||||
@if (Model.CollisionRecordSum + Model.ServiceRecordSum + Model.GasRecordSum + Model.TaxRecordSum + Model.UpgradeRecordSum > 0)
|
@if (Model.CollisionRecordSum + Model.ServiceRecordSum + Model.GasRecordSum + Model.TaxRecordSum + Model.UpgradeRecordSum > 0)
|
||||||
{
|
{
|
||||||
<canvas id="pie-chart"></canvas>
|
<canvas id="pie-chart"></canvas>
|
||||||
@@ -9,18 +16,22 @@
|
|||||||
new Chart($("#pie-chart"), {
|
new Chart($("#pie-chart"), {
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
data: {
|
data: {
|
||||||
labels: ["Service Records", "Repairs", "Upgrades", "Tax", "Fuel"],
|
labels: [decodeHTMLEntities('@translator.Translate(userLanguage, "Service Records")'),
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Repairs")'),
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Upgrades")'),
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Tax")'),
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Fuel")')],
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "Expenses by Category",
|
label: decodeHTMLEntities('@translator.Translate(userLanguage, "Expenses by Type")'),
|
||||||
backgroundColor: ["#003f5c", "#58508d", "#bc5090", "#ff6361", "#ffa600"],
|
backgroundColor: ["#003f5c", "#58508d", "#bc5090", "#ff6361", "#ffa600"],
|
||||||
data: [
|
data: [
|
||||||
@Model.ServiceRecordSum,
|
globalParseFloat('@Model.ServiceRecordSum'),
|
||||||
@Model.CollisionRecordSum,
|
globalParseFloat('@Model.CollisionRecordSum'),
|
||||||
@Model.UpgradeRecordSum,
|
globalParseFloat('@Model.UpgradeRecordSum'),
|
||||||
@Model.TaxRecordSum,
|
globalParseFloat('@Model.TaxRecordSum'),
|
||||||
@Model.GasRecordSum
|
globalParseFloat('@Model.GasRecordSum')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -34,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: "Expenses by Type",
|
text: decodeHTMLEntities('@translator.Translate(userLanguage, "Expenses by Type")'),
|
||||||
color: useDarkMode ? "#fff" : "#000"
|
color: useDarkMode ? "#fff" : "#000"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -46,6 +57,6 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h4>No data found or all records have zero sums, insert records with non-zero sums to see visualizations here.</h4>
|
<h4>@translator.Translate(userLanguage, "No data found or all records have zero sums, insert records with non-zero sums to see visualizations here.")</h4>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject IGasHelper gasHelper
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@model GasRecordViewModelContainer
|
@model GasRecordViewModelContainer
|
||||||
@{
|
@{
|
||||||
var userConfig = config.GetUserConfig(User);
|
var userConfig = config.GetUserConfig(User);
|
||||||
@@ -9,58 +11,82 @@
|
|||||||
var hideZero = userConfig.HideZero;
|
var hideZero = userConfig.HideZero;
|
||||||
var useThreeDecimals = userConfig.UseThreeDecimalGasCost;
|
var useThreeDecimals = userConfig.UseThreeDecimalGasCost;
|
||||||
var gasCostFormat = useThreeDecimals ? "C3" : "C2";
|
var gasCostFormat = useThreeDecimals ? "C3" : "C2";
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
var useKwh = Model.UseKwh;
|
var useKwh = Model.UseKwh;
|
||||||
|
var useHours = Model.UseHours;
|
||||||
|
var recordTags = Model.GasRecords.SelectMany(x => x.Tags).Distinct();
|
||||||
|
string preferredFuelEconomyUnit = userConfig.PreferredGasMileageUnit;
|
||||||
|
string preferredGasUnit = userConfig.PreferredGasUnit;
|
||||||
string consumptionUnit;
|
string consumptionUnit;
|
||||||
string fuelEconomyUnit;
|
string fuelEconomyUnit;
|
||||||
string distanceUnit = useMPG ? "mi." : "km";
|
string distanceUnit = useHours ? "h" : (useMPG ? "mi." : "km");
|
||||||
if (useKwh)
|
if (useKwh)
|
||||||
{
|
{
|
||||||
consumptionUnit = "kWh";
|
consumptionUnit = "kWh";
|
||||||
fuelEconomyUnit = useMPG ? "mi./kWh" : "kWh/100km";
|
fuelEconomyUnit = useMPG ? $"{distanceUnit}/kWh" : $"kWh/100{distanceUnit}";
|
||||||
}
|
}
|
||||||
else if (useMPG && useUKMPG)
|
else if (useMPG && useUKMPG)
|
||||||
{
|
{
|
||||||
consumptionUnit = "imp gal";
|
consumptionUnit = "imp gal";
|
||||||
fuelEconomyUnit = "mpg";
|
fuelEconomyUnit = useHours ? "h/g" : "mpg";
|
||||||
} else if (useUKMPG)
|
} else if (useUKMPG)
|
||||||
{
|
{
|
||||||
fuelEconomyUnit = "l/100mi.";
|
fuelEconomyUnit = useHours ? "l/100h" : "l/100mi.";
|
||||||
consumptionUnit = "l";
|
consumptionUnit = "l";
|
||||||
distanceUnit = "mi.";
|
distanceUnit = useHours ? "h" : "mi.";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
consumptionUnit = useMPG ? "US gal" : "l";
|
consumptionUnit = useMPG ? "US gal" : "l";
|
||||||
fuelEconomyUnit = useMPG ? "mpg" : "l/100km";
|
fuelEconomyUnit = useHours ? (useMPG ? "h/g" : "l/100h") : (useMPG ? "mpg" : "l/100km");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Gas Records: {Model.GasRecords.Count()}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="count">@($"{translator.Translate(userLanguage,"# of Gas Records")}: {Model.GasRecords.Count()}")</span>
|
||||||
@if (Model.GasRecords.Where(x => x.MilesPerGallon > 0).Any())
|
@if (Model.GasRecords.Where(x => x.MilesPerGallon > 0).Any())
|
||||||
{
|
{
|
||||||
<span class="ms-2 badge bg-primary">@($"Average Fuel Economy: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Average(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
<span class="ms-2 badge bg-primary" id="averageFuelMileageLabel">@($"{translator.Translate(userLanguage,"Average Fuel Economy")}: {gasHelper.GetAverageGasMileage(Model.GasRecords, useMPG)}")</span>
|
||||||
<span class="ms-2 badge bg-primary">@($"Min Fuel Economy: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Min(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
if (useMPG)
|
||||||
<span class="ms-2 badge bg-primary">@($"Max Fuel Economy: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
{
|
||||||
|
<span class="ms-2 badge bg-primary" id="minFuelMileageLabel">@($"{translator.Translate(userLanguage,"Min Fuel Economy")}: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Min(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
|
<span class="ms-2 badge bg-primary" id="maxFuelMileageLabel">@($"{translator.Translate(userLanguage,"Max Fuel Economy")}: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
<span class="ms-2 badge bg-primary" id="minFuelMileageLabel">@($"{translator.Translate(userLanguage,"Min Fuel Economy")}: {Model.GasRecords.Max(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
|
<span class="ms-2 badge bg-primary" id="maxFuelMileageLabel">@($"{translator.Translate(userLanguage,"Max Fuel Economy")}: {Model.GasRecords.Where(y => y.MilesPerGallon > 0)?.Min(x => x.MilesPerGallon).ToString("F") ?? "0"}")</span>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<span class="ms-2 badge bg-success">@($"Total Fuel Consumed: {Model.GasRecords.Sum(x => x.Gallons).ToString("F")}")</span>
|
<span class="ms-2 badge bg-success">@($"{translator.Translate(userLanguage,"Total Fuel Consumed")}: {Model.GasRecords.Sum(x => x.Gallons).ToString("F")}")</span>
|
||||||
<span class="ms-2 badge bg-success">@($"Total Cost: {Model.GasRecords.Sum(x => x.Cost).ToString(gasCostFormat)}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="sum">@($"{translator.Translate(userLanguage,"Total Cost")}: {Model.GasRecords.Sum(x => x.Cost).ToString(gasCostFormat)}")</span>
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<span onclick="toggleGasFilter(this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
|
}
|
||||||
|
<datalist id="tagList">
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddGasRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Gas Record</button>
|
<button onclick="showAddGasRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Gas Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('GasRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('GasRecord')">@translator.Translate(userLanguage,"Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('GasRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('GasRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
} else {
|
} else {
|
||||||
<button onclick="showAddGasRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Gas Record</button>
|
<button onclick="showAddGasRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Gas Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -74,24 +100,26 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2">Date Refueled</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage,"Date Refueled")</th>
|
||||||
<th scope="col" class="col-2">Odometer(@(distanceUnit))</th>
|
<th scope="col" class="col-2">@($"{translator.Translate(userLanguage, "Odometer")}({distanceUnit})")</th>
|
||||||
<th scope="col" class="col-2">Consumption(@(consumptionUnit))</th>
|
<th scope="col" class="col-1" style="cursor:pointer;" onclick="toggleSort('gas-tab-pane', this)">@($"Δ({distanceUnit})")</th>
|
||||||
<th scope="col" class="col-4">Fuel Economy(@(fuelEconomyUnit))</th>
|
<th scope="col" class="col-2" data-gas="consumption" data-unit="@consumptionUnit" onclick="toggleSort('gas-tab-pane', this)" oncontextmenu="toggleUnits(this)" style="cursor:pointer;">@($"{translator.Translate(userLanguage,"Consumption")}({consumptionUnit})")</th>
|
||||||
<th scope="col" class="col-1">Cost</th>
|
<th scope="col" class="col-3" data-gas="fueleconomy" data-unit="@fuelEconomyUnit" onclick="toggleSort('gas-tab-pane', this)" oncontextmenu="toggleUnits(this)" style="cursor:pointer;">@($"{@translator.Translate(userLanguage,"Fuel Economy")}({fuelEconomyUnit})")</th>
|
||||||
<th scope="col" class="col-1">Unit Cost</th>
|
<th scope="col" class="col-1" onclick="toggleSort('gas-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage,"Cost")</th>
|
||||||
|
<th scope="col" class="col-1" onclick="toggleSort('gas-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage,"Unit Cost")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (GasRecordViewModel gasRecord in Model.GasRecords)
|
@foreach (GasRecordViewModel gasRecord in Model.GasRecords)
|
||||||
{
|
{
|
||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditGasRecordModal(@gasRecord.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditGasRecordModal(@gasRecord.Id)" data-tags='@string.Join(" ", gasRecord.Tags)'>
|
||||||
<td class="col-2">@gasRecord.Date</td>
|
<td class="col-2">@gasRecord.Date</td>
|
||||||
<td class="col-2">@gasRecord.Mileage</td>
|
<td class="col-2" data-gas-type="mileage" data-gas-aggregate="@gasRecord.DeltaMileage" data-gas-original="@gasRecord.Mileage">@gasRecord.Mileage</td>
|
||||||
<td class="col-2">@gasRecord.Gallons.ToString("F")</td>
|
<td class="col-1">@(gasRecord.DeltaMileage == default ? "---" : gasRecord.DeltaMileage)</td>
|
||||||
<td class="col-4">@(gasRecord.MilesPerGallon == 0 ? "---" : gasRecord.MilesPerGallon.ToString("F"))</td>
|
<td class="col-2" data-gas-type="consumption" data-gas-aggregate="@gasRecord.Gallons">@gasRecord.Gallons.ToString("F")</td>
|
||||||
<td class="col-1">@((hideZero && gasRecord.Cost == default) ? "---" : gasRecord.Cost.ToString(gasCostFormat))</td>
|
<td class="col-3" data-gas-type="fueleconomy" data-aggregated='@(gasRecord.IncludeInAverage.ToString().ToLower())'>@(gasRecord.MilesPerGallon == 0 ? "---" : gasRecord.MilesPerGallon.ToString("F"))</td>
|
||||||
<td class="col-1">@((hideZero && gasRecord.CostPerGallon == default) ? "---" : gasRecord.CostPerGallon.ToString(gasCostFormat))</td>
|
<td class="col-1" data-record-type="cost">@((hideZero && gasRecord.Cost == default) ? "---" : gasRecord.Cost.ToString(gasCostFormat))</td>
|
||||||
|
<td class="col-1" data-gas-type="unitcost">@((hideZero && gasRecord.CostPerGallon == default) ? "---" : gasRecord.CostPerGallon.ToString(gasCostFormat))</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -106,4 +134,16 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
@if (!string.IsNullOrWhiteSpace(preferredFuelEconomyUnit))
|
||||||
|
{
|
||||||
|
@:convertFuelMileageUnits(decodeHTMLEntities('@fuelEconomyUnit'), decodeHTMLEntities('@preferredFuelEconomyUnit'), false);
|
||||||
|
}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(preferredGasUnit))
|
||||||
|
{
|
||||||
|
@:convertGasConsumptionUnits(decodeHTMLEntities('@consumptionUnit'), decodeHTMLEntities('@preferredGasUnit'), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
@model List<CostForVehicleByMonth>
|
@using CarCareTracker.Helper
|
||||||
@if (Model.Any())
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model List<CostForVehicleByMonth>
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var barGraphColors = new string[] { "#00876c", "#43956e", "#67a371", "#89b177", "#a9be80", "#c8cb8b", "#e6d79b", "#e4c281", "#e3ab6b", "#e2925b", "#e07952", "#db5d4f" };
|
||||||
|
var sortedByMPG = Model.OrderBy(x => x.Cost).ToList();
|
||||||
|
}
|
||||||
|
@if (Model.Where(x=>x.Cost > 0).Any())
|
||||||
{
|
{
|
||||||
<canvas id="bar-chart"></canvas>
|
<canvas id="bar-chart"></canvas>
|
||||||
<script>
|
<script>
|
||||||
@@ -7,11 +16,15 @@
|
|||||||
function renderChart() {
|
function renderChart() {
|
||||||
var barGraphLabels = [];
|
var barGraphLabels = [];
|
||||||
var barGraphData = [];
|
var barGraphData = [];
|
||||||
|
//color gradient from high to low
|
||||||
|
var barGraphColors = [];
|
||||||
var useDarkMode = getGlobalConfig().useDarkMode;
|
var useDarkMode = getGlobalConfig().useDarkMode;
|
||||||
@foreach (CostForVehicleByMonth gasCost in Model)
|
@foreach (CostForVehicleByMonth gasCost in Model)
|
||||||
{
|
{
|
||||||
@:barGraphLabels.push("@gasCost.MonthName");
|
@:barGraphLabels.push(decodeHTMLEntities("@gasCost.MonthName"));
|
||||||
@:barGraphData.push(@gasCost.Cost);
|
@:barGraphData.push(globalParseFloat('@gasCost.Cost'));
|
||||||
|
var index = sortedByMPG.FindIndex(x => x.MonthName == gasCost.MonthName);
|
||||||
|
@:barGraphColors.push('@barGraphColors[index]');
|
||||||
}
|
}
|
||||||
new Chart($("#bar-chart"), {
|
new Chart($("#bar-chart"), {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
@@ -19,15 +32,21 @@
|
|||||||
labels: barGraphLabels,
|
labels: barGraphLabels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "Expenses by Month",
|
label: decodeHTMLEntities('@translator.Translate(userLanguage, "Expenses by Month")'),
|
||||||
backgroundColor: ["#00876c", "#43956e", "#67a371", "#89b177", "#a9be80", "#c8cb8b", "#e6d79b", "#e4c281", "#e3ab6b", "#e2925b", "#e07952", "#db5d4f"],
|
backgroundColor: barGraphColors,
|
||||||
data: barGraphData
|
data: barGraphData
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
plugins: {
|
plugins: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
color: useDarkMode ? "#fff" : "#000",
|
||||||
|
text: decodeHTMLEntities('@translator.Translate(userLanguage, "Expenses by Month")')
|
||||||
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
display: false,
|
||||||
labels: {
|
labels: {
|
||||||
color: useDarkMode ? "#fff" : "#000"
|
color: useDarkMode ? "#fff" : "#000"
|
||||||
}
|
}
|
||||||
@@ -53,6 +72,6 @@
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h4>No data found, insert/select some data to see visualizations here.</h4>
|
<h4>@translator.Translate(userLanguage,"No data found, insert/select some data to see visualizations here.")</h4>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@model GasRecordInputContainer
|
@model GasRecordInputContainer
|
||||||
@{
|
@{
|
||||||
var useMPG = config.GetUserConfig(User).UseMPG;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var useUKMPG = config.GetUserConfig(User).UseUKMPG;
|
var useMPG = userConfig.UseMPG;
|
||||||
|
var useUKMPG = userConfig.UseUKMPG;
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
var useKwh = Model.UseKwh;
|
var useKwh = Model.UseKwh;
|
||||||
|
var useHours = Model.UseHours;
|
||||||
var isNew = Model.GasRecord.Id == 0;
|
var isNew = Model.GasRecord.Id == 0;
|
||||||
string consumptionUnit;
|
string consumptionUnit;
|
||||||
string distanceUnit;
|
string distanceUnit;
|
||||||
@@ -19,7 +23,11 @@
|
|||||||
{
|
{
|
||||||
consumptionUnit = useMPG ? "gallons" : "liters";
|
consumptionUnit = useMPG ? "gallons" : "liters";
|
||||||
}
|
}
|
||||||
if (useUKMPG)
|
if (useHours)
|
||||||
|
{
|
||||||
|
distanceUnit = "hours";
|
||||||
|
}
|
||||||
|
else if (useUKMPG)
|
||||||
{
|
{
|
||||||
distanceUnit = "miles";
|
distanceUnit = "miles";
|
||||||
}
|
}
|
||||||
@@ -29,7 +37,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Gas Record" : "Edit Gas Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Gas Record") : translator.Translate(userLanguage,"Edit Gas Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddGasRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddGasRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -38,55 +46,64 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="gasRecordDate">Date</label>
|
<label for="gasRecordDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="gasRecordDate" placeholder="Date refueled" class="form-control" value="@Model.GasRecord.Date">
|
<input type="text" id="gasRecordDate" placeholder="@translator.Translate(userLanguage,"Date refueled")" class="form-control" value="@Model.GasRecord.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<label for="gasRecordMileage">Odometer Reading(@distanceUnit)</label>
|
<label for="gasRecordMileage">@($"{translator.Translate(userLanguage,"Odometer Reading")}({distanceUnit})")</label>
|
||||||
<input type="number" id="gasRecordMileage" class="form-control" placeholder="Odometer reading when refueled" value="@(isNew ? "" : Model.GasRecord.Mileage)">
|
<input type="number" id="gasRecordMileage" class="form-control" placeholder="@translator.Translate(userLanguage,"Odometer reading when refueled")" value="@(isNew ? "" : Model.GasRecord.Mileage)">
|
||||||
<label for="gasRecordGallons">Fuel Consumption(@(consumptionUnit))</label>
|
<label for="gasRecordGallons">@($"{translator.Translate(userLanguage, "Fuel Consumption")}({consumptionUnit})")</label>
|
||||||
<input type="text" id="gasRecordGallons" class="form-control" placeholder="Amount of gas refueled" value="@(isNew ? "" : Model.GasRecord.Gallons)">
|
<input type="text" id="gasRecordGallons" class="form-control" placeholder="@translator.Translate(userLanguage,"Amount of gas refueled")" value="@(isNew ? "" : Model.GasRecord.Gallons)">
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" role="switch" id="gasIsFillToFull" checked="@Model.GasRecord.IsFillToFull">
|
<input class="form-check-input" type="checkbox" role="switch" id="gasIsFillToFull" checked="@Model.GasRecord.IsFillToFull">
|
||||||
<label class="form-check-label" for="gasIsFillToFull">Is Filled To Full</label>
|
<label class="form-check-label" for="gasIsFillToFull">@translator.Translate(userLanguage,"Is Filled To Full")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" role="switch" id="gasIsMissed" checked="@Model.GasRecord.MissedFuelUp">
|
<input class="form-check-input" type="checkbox" role="switch" id="gasIsMissed" checked="@Model.GasRecord.MissedFuelUp">
|
||||||
<label class="form-check-label" for="gasIsMissed">Missed Fuel Up(Skip MPG Calculation)</label>
|
<label class="form-check-label" for="gasIsMissed">@translator.Translate(userLanguage,"Missed Fuel Up(Skip MPG Calculation)")</label>
|
||||||
</div>
|
</div>
|
||||||
<label for="GasRecordCost">Cost</label>
|
<label for="GasRecordCost">@translator.Translate(userLanguage,"Cost")</label>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="gasRecordCost" class="form-control" placeholder="Cost of gas refueled" value="@(isNew ? "" : Model.GasRecord.Cost)">
|
<input type="text" id="gasRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage,"Cost of gas refueled")" value="@(isNew ? "" : Model.GasRecord.Cost)">
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<select class="form-select form-select-sm" id="gasCostType">
|
<select class="form-select form-select-sm" id="gasCostType">
|
||||||
<option value="total">Total</option>
|
<option value="total">@translator.Translate(userLanguage,"Total")</option>
|
||||||
<option value="unit">Unit</option>
|
<option value="unit">@translator.Translate(userLanguage,"Unit")</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
<input type="text" id="gasRecordCost" class="form-control" placeholder="Cost of gas refueled" value="@(isNew ? "" : Model.GasRecord.Cost)">
|
<input type="text" id="gasRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage,"Cost of gas refueled")" value="@(isNew ? "" : Model.GasRecord.Cost)">
|
||||||
}
|
}
|
||||||
|
<label for="gasRecordTag">@translator.Translate(userLanguage,"Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="gasRecordTag">
|
||||||
|
@foreach (string tag in Model.GasRecord.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="gasRecordNotes">Notes(optional)</label>
|
<label for="gasRecordNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="gasRecordNotes" class="form-control" rows="5">@Model.GasRecord.Notes</textarea>
|
<textarea id="gasRecordNotes" class="form-control" rows="5">@Model.GasRecord.Notes</textarea>
|
||||||
@if (Model.GasRecord.Files.Any())
|
@if (Model.GasRecord.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.GasRecord.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.GasRecord.Files)
|
||||||
<label for="gasRecordFiles">Upload more documents</label>
|
<label for="gasRecordFiles">@translator.Translate(userLanguage,"Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<label for="gasRecordFiles">Upload documents(optional)</label>
|
<label for="gasRecordFiles">@translator.Translate(userLanguage,"Upload documents(optional)")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="gasRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,16 +113,16 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteGasRecord(@Model.GasRecord.Id)" style="margin-right:auto;">Delete</button>
|
<button type="button" class="btn btn-danger" onclick="deleteGasRecord(@Model.GasRecord.Id)" style="margin-right:auto;">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddGasRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddGasRecordModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveGasRecordToVehicle()">Add New Gas Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveGasRecordToVehicle()">@translator.Translate(userLanguage,"Add New Gas Record")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveGasRecordToVehicle(true)">Edit Gas Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveGasRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Gas Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,17 +1,31 @@
|
|||||||
@model List<CostForVehicleByMonth>
|
@using CarCareTracker.Helper
|
||||||
@if (Model.Any())
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model List<CostForVehicleByMonth>
|
||||||
|
@{
|
||||||
|
var barGraphColors = new string[] { "#00876c", "#43956e", "#67a371", "#89b177", "#a9be80", "#c8cb8b", "#e6d79b", "#e4c281", "#e3ab6b", "#e2925b", "#e07952", "#db5d4f" };
|
||||||
|
var sortedByMPG = Model.OrderByDescending(x => x.Cost).ToList();
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@if (Model.Where(x => x.Cost > 0).Any())
|
||||||
{
|
{
|
||||||
|
|
||||||
<canvas id="bar-chart-mpg"></canvas>
|
<canvas id="bar-chart-mpg"></canvas>
|
||||||
<script>
|
<script>
|
||||||
renderChart();
|
renderChart();
|
||||||
function renderChart() {
|
function renderChart() {
|
||||||
var barGraphLabels = [];
|
var barGraphLabels = [];
|
||||||
var barGraphData = [];
|
var barGraphData = [];
|
||||||
|
//color gradient from high to low
|
||||||
|
var barGraphColors = [];
|
||||||
var useDarkMode = getGlobalConfig().useDarkMode;
|
var useDarkMode = getGlobalConfig().useDarkMode;
|
||||||
@foreach (CostForVehicleByMonth gasCost in Model)
|
@foreach (CostForVehicleByMonth gasCost in Model)
|
||||||
{
|
{
|
||||||
@:barGraphLabels.push("@gasCost.MonthName");
|
@:barGraphLabels.push(decodeHTMLEntities("@gasCost.MonthName"));
|
||||||
@:barGraphData.push(@gasCost.Cost);
|
@:barGraphData.push(globalParseFloat('@gasCost.Cost'));
|
||||||
|
var index = sortedByMPG.FindIndex(x => x.MonthName == gasCost.MonthName);
|
||||||
|
@:barGraphColors.push('@barGraphColors[index]');
|
||||||
}
|
}
|
||||||
new Chart($("#bar-chart-mpg"), {
|
new Chart($("#bar-chart-mpg"), {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
@@ -19,15 +33,21 @@
|
|||||||
labels: barGraphLabels,
|
labels: barGraphLabels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "Fuel Mileage by Month",
|
label: decodeHTMLEntities('@translator.Translate(userLanguage, "Fuel Mileage by Month")'),
|
||||||
backgroundColor: ["#00876c", "#43956e", "#67a371", "#89b177", "#a9be80", "#c8cb8b", "#e6d79b", "#e4c281", "#e3ab6b", "#e2925b", "#e07952", "#db5d4f"],
|
backgroundColor: barGraphColors,
|
||||||
data: barGraphData
|
data: barGraphData
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
plugins: {
|
plugins: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
color: useDarkMode ? "#fff" : "#000",
|
||||||
|
text: decodeHTMLEntities('@translator.Translate(userLanguage, "Fuel Mileage by Month")')
|
||||||
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
display: false,
|
||||||
labels: {
|
labels: {
|
||||||
color: useDarkMode ? "#fff" : "#000"
|
color: useDarkMode ? "#fff" : "#000"
|
||||||
}
|
}
|
||||||
@@ -50,9 +70,10 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h4>No data found, insert/select some data to see visualizations here.</h4>
|
<h4>@translator.Translate(userLanguage,"No data found, insert/select some data to see visualizations here.")</h4>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
@model Note
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model Note
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Note" : "Edit Note")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Note") : translator.Translate(userLanguage, "Edit Note"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddNoteModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddNoteModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,13 +17,44 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="noteDescription">Description</label>
|
<div class="form-check form-switch">
|
||||||
<input type="text" id="noteDescription" class="form-control" placeholder="Description of the note" value="@(isNew ? "" : Model.Description)">
|
<input class="form-check-input" type="checkbox" role="switch" id="noteIsPinned" checked="@Model.Pinned">
|
||||||
|
<label class="form-check-label" for="noteIsPinned">@translator.Translate(userLanguage,"Pinned")</label>
|
||||||
|
</div>
|
||||||
|
<label for="noteDescription">@translator.Translate(userLanguage,"Description")</label>
|
||||||
|
<input type="text" id="noteDescription" class="form-control" placeholder="@translator.Translate(userLanguage,"Description of the note")" value="@(isNew ? "" : Model.Description)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="noteTextArea">Notes</label>
|
<label for="noteTextArea">@translator.Translate(userLanguage,"Notes")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea class="form-control vehicleNoteContainer" id="noteTextArea">@Model.NoteText</textarea>
|
<textarea class="form-control vehicleNoteContainer" id="noteTextArea">@Model.NoteText</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
@if (Model.Files.Any())
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
|
<label for="serviceRecordFiles">@translator.Translate(userLanguage, "Upload more documents")</label>
|
||||||
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="noteFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "Max File Size: 28.6MB")</small>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<label for="serviceRecordFiles">@translator.Translate(userLanguage, "Upload documents(optional)")</label>
|
||||||
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="noteFiles">
|
||||||
|
<br />
|
||||||
|
<small class="text-body-secondary">@translator.Translate(userLanguage, "Max File Size: 28.6MB")</small>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<label for="noteRecordTag">@translator.Translate(userLanguage,"Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="noteRecordTag">
|
||||||
|
@foreach (string tag in Model.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -26,19 +62,27 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteNote(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<button type="button" class="btn btn-danger" onclick="deleteNote(@Model.Id)" style="margin-right:auto;">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddNoteModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddNoteModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveNoteToVehicle()">Add New Note</button>
|
<button type="button" class="btn btn-primary" onclick="saveNoteToVehicle()">@translator.Translate(userLanguage,"Add New Note")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveNoteToVehicle(true)">Edit Note</button>
|
<button type="button" class="btn btn-primary" onclick="saveNoteToVehicle(true)">@translator.Translate(userLanguage,"Edit Note")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
var uploadedFiles = [];
|
||||||
|
getUploadedFilesFromModel();
|
||||||
|
function getUploadedFilesFromModel() {
|
||||||
|
@foreach (UploadedFiles filesUploaded in Model.Files)
|
||||||
|
{
|
||||||
|
@:uploadedFiles.push({ name: "@filesUploaded.Name", location: "@filesUploaded.Location" });
|
||||||
|
}
|
||||||
|
}
|
||||||
function getNoteModelData(){
|
function getNoteModelData(){
|
||||||
return { id: @Model.Id}
|
return { id: @Model.Id}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,29 @@
|
|||||||
@model List<Note>
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model List<Note>
|
||||||
|
@{
|
||||||
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Notes: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="count">@($"{translator.Translate(userLanguage,"# of Notes")}: {Model.Count()}")</span>
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<span onclick="filterTable('notes-tab-pane', this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
|
}
|
||||||
|
<datalist id="tagList">
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button onclick="showAddNoteModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Note</button>
|
<button onclick="showAddNoteModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Note")</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -19,16 +37,22 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-3">Description</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage,"Description")</th>
|
||||||
<th scope="col" class="col-9">Note</th>
|
<th scope="col" class="col-9">@translator.Translate(userLanguage,"Note")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (Note note in Model)
|
@foreach (Note note in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditNoteModal(@note.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditNoteModal(@note.Id)" data-tags='@string.Join(" ", note.Tags)'>
|
||||||
<td class="col-3">@note.Description</td>
|
@if (note.Pinned)
|
||||||
<td class="col-9 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(note.NoteText, 100)</td>
|
{
|
||||||
|
<td class="col-3"><i class='bi bi-pin-fill me-2'></i>@note.Description</td>
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
<td class="col-3">@note.Description</td>
|
||||||
|
}
|
||||||
|
<td class="col-9 text-truncate" data-record-type="cost">@CarCareTracker.Helper.StaticHelper.TruncateStrings(note.NoteText, 100)</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
@model OdometerRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model OdometerRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Odometer Record" : "Edit Odometer Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Odometer Record") : translator.Translate(userLanguage,"Edit Odometer Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddOdometerRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddOdometerRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,29 +17,38 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="odometerRecordDate">Date</label>
|
<label for="odometerRecordDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="odometerRecordDate" class="form-control" placeholder="Date recorded" value="@Model.Date">
|
<input type="text" id="odometerRecordDate" class="form-control" placeholder="@translator.Translate(userLanguage,"Date recorded")" value="@Model.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<label for="odometerRecordMileage">Odometer</label>
|
<label for="odometerRecordMileage">@translator.Translate(userLanguage,"Odometer")</label>
|
||||||
<input type="number" id="odometerRecordMileage" class="form-control" placeholder="Odometer reading" value="@(isNew ? "" : Model.Mileage)">
|
<input type="number" id="odometerRecordMileage" class="form-control" placeholder="@translator.Translate(userLanguage,"Odometer reading")" value="@(isNew ? "" : Model.Mileage)">
|
||||||
|
<label for="odometerRecordTag">@translator.Translate(userLanguage,"Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="odometerRecordTag">
|
||||||
|
@foreach (string tag in Model.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="odometerRecordNotes">Notes(optional)</label>
|
<label for="odometerRecordNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="odometerRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="odometerRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
@if (Model.Files.Any())
|
@if (Model.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
<label for="odometerRecordFiles">Upload more documents</label>
|
<label for="odometerRecordFiles">@translator.Translate(userLanguage,"Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="odometerRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="odometerRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<label for="odometerRecordFiles">Upload documents(optional)</label>
|
<label for="odometerRecordFiles">@translator.Translate(userLanguage,"Upload documents(optional)")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="odometerRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="odometerRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,16 +58,16 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteOdometerRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<button type="button" class="btn btn-danger" onclick="deleteOdometerRecord(@Model.Id)" style="margin-right:auto;">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddOdometerRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddOdometerRecordModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveOdometerRecordToVehicle()">Add New Odometer Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveOdometerRecordToVehicle()">@translator.Translate(userLanguage,"Add New Odometer Record")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveOdometerRecordToVehicle(true)">Edit Odometer Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveOdometerRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Odometer Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,32 +1,48 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var hideZero = userConfig.HideZero;
|
||||||
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
@model List<OdometerRecord>
|
@model List<OdometerRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Odometer Records: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="count">@($"{translator.Translate(userLanguage,"# of Odometer Records")}: {Model.Count()}")</span>
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<span onclick="filterTable('odometer-tab-pane', this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
|
}
|
||||||
|
<datalist id="tagList">
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddOdometerRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Odometer Record</button>
|
<button onclick="showAddOdometerRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Odometer Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('OdometerRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('OdometerRecord')">@translator.Translate(userLanguage,"Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('OdometerRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('OdometerRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<button onclick="showAddOdometerRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Odometer Record</button>
|
<button onclick="showAddOdometerRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Odometer Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,18 +57,18 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">Date</th>
|
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage,"Date")</th>
|
||||||
<th scope="col" class="col-3">Odometer</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage,"Odometer")</th>
|
||||||
<th scope="col" class="col-7 col-xl-8">Notes</th>
|
<th scope="col" class="col-7 col-xl-8">@translator.Translate(userLanguage,"Notes")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (OdometerRecord odometerRecord in Model)
|
@foreach (OdometerRecord odometerRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditOdometerRecordModal(@odometerRecord.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditOdometerRecordModal(@odometerRecord.Id)" data-tags='@string.Join(" ", odometerRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@odometerRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1">@odometerRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-3">@odometerRecord.Mileage</td>
|
<td class="col-3" data-record-type="cost">@odometerRecord.Mileage</td>
|
||||||
<td class="col-7 col-xl-8 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(odometerRecord.Notes)</td>
|
<td class="col-7 col-xl-8 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(odometerRecord.Notes, 75)</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@model PlanRecord
|
@model PlanRecord
|
||||||
<div class="taskCard @(Model.Progress == PlanProgress.Done ? "nodrag" : "") text-dark user-select-none mb-2" draggable="@(Model.Progress == PlanProgress.Done ? "false" : "true")" ondragstart="dragStart(event, @Model.Id)" onclick="@(Model.Progress == PlanProgress.Done ? $"deletePlanRecord({Model.Id})" : $"showEditPlanRecordModal({Model.Id})")">
|
<div class="taskCard @(Model.Progress == PlanProgress.Done ? "nodrag" : "") text-dark user-select-none mt-2 mb-2" draggable="@(Model.Progress == PlanProgress.Done ? "false" : "true")" ondragstart="dragStart(event, @Model.Id)" onclick="@(Model.Progress == PlanProgress.Done ? $"deletePlanRecord({Model.Id})" : $"showEditPlanRecordModal({Model.Id})")">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-lg-8 text-truncate">
|
<div class="col-12 col-lg-8 text-truncate">
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
@model PlanRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model PlanRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Plan Record" : "Edit Plan Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Plan Record") : translator.Translate(userLanguage, "Edit Plan Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddPlanRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddPlanRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,49 +17,57 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="planRecordDescription">Description</label>
|
<label for="planRecordDescription">@translator.Translate(userLanguage, "Description")</label>
|
||||||
<input type="text" id="planRecordDescription" class="form-control" placeholder="Describe the Plan" value="@Model.Description">
|
<input type="text" id="planRecordDescription" class="form-control" placeholder="@translator.Translate(userLanguage, "Describe the Plan")" value="@Model.Description">
|
||||||
<label for="planRecordCost">Cost</label>
|
<label for="planRecordCost">@translator.Translate(userLanguage, "Cost")</label>
|
||||||
<input type="text" id="planRecordCost" class="form-control" placeholder="Cost of the Plan" value="@Model.Cost">
|
<input type="text" id="planRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage, "Cost of the Plan")" value="@Model.Cost">
|
||||||
<label for="planRecordType">Type</label>
|
@if (isNew)
|
||||||
|
{
|
||||||
|
@await Html.PartialAsync("_SupplyStore", "PlanRecord")
|
||||||
|
}
|
||||||
|
<label for="planRecordType">@translator.Translate(userLanguage, "Type")</label>
|
||||||
<select class="form-select" id="planRecordType">
|
<select class="form-select" id="planRecordType">
|
||||||
<!option value="ServiceRecord" @(Model.ImportMode == ImportMode.ServiceRecord || isNew ? "selected" : "")>Service</!option>
|
<!option value="ServiceRecord" @(Model.ImportMode == ImportMode.ServiceRecord || isNew ? "selected" : "")>@translator.Translate(userLanguage, "Service")</!option>
|
||||||
<!option value="RepairRecord" @(Model.ImportMode == ImportMode.RepairRecord ? "selected" : "")>Repair</!option>
|
<!option value="RepairRecord" @(Model.ImportMode == ImportMode.RepairRecord ? "selected" : "")>@translator.Translate(userLanguage, "Repair")</!option>
|
||||||
<!option value="UpgradeRecord" @(Model.ImportMode == ImportMode.UpgradeRecord ? "selected" : "")>Upgrade</!option>
|
<!option value="UpgradeRecord" @(Model.ImportMode == ImportMode.UpgradeRecord ? "selected" : "")>@translator.Translate(userLanguage, "Upgrade")</!option>
|
||||||
</select>
|
</select>
|
||||||
<label for="planRecordPriority">Priority</label>
|
<label for="planRecordPriority">@translator.Translate(userLanguage, "Priority")</label>
|
||||||
<select class="form-select" id="planRecordPriority">
|
<select class="form-select" id="planRecordPriority">
|
||||||
<!option value="Critical" @(Model.Priority == PlanPriority.Critical ? "selected" : "")>Critical</!option>
|
<!option value="Critical" @(Model.Priority == PlanPriority.Critical ? "selected" : "")>@translator.Translate(userLanguage, "Critical")</!option>
|
||||||
<!option value="Normal" @(Model.Priority == PlanPriority.Normal || isNew ? "selected" : "")>Normal</!option>
|
<!option value="Normal" @(Model.Priority == PlanPriority.Normal || isNew ? "selected" : "")>@translator.Translate(userLanguage, "Normal")</!option>
|
||||||
<!option value="Low" @(Model.Priority == PlanPriority.Low ? "selected" : "")>Low</!option>
|
<!option value="Low" @(Model.Priority == PlanPriority.Low ? "selected" : "")>@translator.Translate(userLanguage, "Low")</!option>
|
||||||
</select>
|
</select>
|
||||||
<label for="planRecordProgress">Current Stage</label>
|
<label for="planRecordProgress">@translator.Translate(userLanguage, "Current Stage")</label>
|
||||||
<select class="form-select" id="planRecordProgress">
|
<select class="form-select" id="planRecordProgress">
|
||||||
<!option value="Backlog" @(Model.Progress == PlanProgress.Backlog ||isNew ? "selected" : "")>Planned</!option>
|
<!option value = "Backlog" @(Model.Progress == PlanProgress.Backlog || isNew ? "selected" : "")>@translator.Translate(userLanguage, "Planned")</!option>
|
||||||
<!option value="InProgress" @(Model.Progress == PlanProgress.InProgress ? "selected" : "")>Doing</!option>
|
<!option value="InProgress" @(Model.Progress == PlanProgress.InProgress ? "selected" : "")>@translator.Translate(userLanguage, "Doing")</!option>
|
||||||
<!option value="Testing" @(Model.Progress == PlanProgress.Testing ? "selected" : "")>Testing</!option>
|
<!option value = "Testing" @(Model.Progress == PlanProgress.Testing ? "selected" : "")>@translator.Translate(userLanguage, "Testing")</!option>
|
||||||
</select>
|
</select>
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<label>Date Created: @Model.DateCreated</label>
|
<label>@($"{translator.Translate(userLanguage, "Date Created")}: {Model.DateCreated}")</label>
|
||||||
<label>Last Modified: @Model.DateModified</label>
|
<label>@($"{translator.Translate(userLanguage, "Last Modified")}: {Model.DateModified}")</label>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="planRecordNotes">Notes(optional)</label>
|
<label for="planRecordNotes">@translator.Translate(userLanguage, "Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="planRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="planRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
@if (Model.Files.Any())
|
@if (Model.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
<label for="planRecordFiles">Upload more documents</label>
|
<label for="planRecordFiles">@translator.Translate(userLanguage, "Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="planRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="planRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage, "Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<label for="planRecordFiles">Upload documents(optional)</label>
|
<label for="planRecordFiles">@translator.Translate(userLanguage, "Upload documents(optional)")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="planRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="planRecordFiles">
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<small class="text-body-secondary">@translator.Translate(userLanguage, "Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -64,29 +77,39 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deletePlanRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<button type="button" class="btn btn-danger" onclick="deletePlanRecord(@Model.Id)" style="margin-right:auto;">@translator.Translate(userLanguage, "Delete")</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddPlanRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddPlanRecordModal()">@translator.Translate(userLanguage, "Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="savePlanRecordToVehicle()">Add New Plan Record</button>
|
<div class="btn-group">
|
||||||
|
<button onclick="savePlanRecordToVehicle()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add New Plan Record")</button>
|
||||||
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="savePlanRecordTemplate()">@translator.Translate(userLanguage, "Save as Template")</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="showPlanRecordTemplatesModal()">@translator.Translate(userLanguage, "View Templates")</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="savePlanRecordToVehicle(true)">Edit Plan Record</button>
|
<button type="button" class="btn btn-primary" onclick="savePlanRecordToVehicle(true)">@translator.Translate(userLanguage, "Edit Plan Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var uploadedFiles = [];
|
var uploadedFiles = [];
|
||||||
|
var selectedSupplies = [];
|
||||||
getUploadedFilesFromModel();
|
getUploadedFilesFromModel();
|
||||||
function getUploadedFilesFromModel() {
|
function getUploadedFilesFromModel() {
|
||||||
@foreach (UploadedFiles filesUploaded in Model.Files)
|
@foreach (UploadedFiles filesUploaded in Model.Files)
|
||||||
{
|
{
|
||||||
@:uploadedFiles.push({ name: "@filesUploaded.Name", location: "@filesUploaded.Location" });
|
@:uploadedFiles.push({ name: "@filesUploaded.Name", location: "@filesUploaded.Location" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getPlanRecordModelData() {
|
function getPlanRecordModelData() {
|
||||||
return {
|
return {
|
||||||
id: @Model.Id,
|
id: @Model.Id,
|
||||||
dateCreated: decodeHTMLEntities('@(Model.DateCreated)')
|
dateCreated: decodeHTMLEntities('@(Model.DateCreated)')
|
||||||
}
|
}
|
||||||
|
|||||||
87
Views/Vehicle/_PlanRecordTemplateModal.cshtml
Normal file
87
Views/Vehicle/_PlanRecordTemplateModal.cshtml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model List<PlanRecordInput>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">@translator.Translate(userLanguage,"Select Template")</h5>
|
||||||
|
<button type="button" class="btn-close" onclick="hidePlanRecordTemplatesModal()" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
@if (Model.Any())
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12" style="max-height:50vh; overflow-y:auto;">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead class="sticky-top">
|
||||||
|
<tr class="d-flex">
|
||||||
|
<th scope="col" class="col-8">@translator.Translate(userLanguage,"Description")</th>
|
||||||
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Use")</th>
|
||||||
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Delete")</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (PlanRecordInput planRecordTemplate in Model)
|
||||||
|
{
|
||||||
|
<tr class="d-flex" id="supplyRows">
|
||||||
|
<td class="col-8 text-truncate">
|
||||||
|
@StaticHelper.TruncateStrings(planRecordTemplate.Description)
|
||||||
|
@if (planRecordTemplate.Files.Any())
|
||||||
|
{
|
||||||
|
<i class="bi bi-paperclip ms-2"></i>
|
||||||
|
}
|
||||||
|
@if (planRecordTemplate.Supplies.Any())
|
||||||
|
{
|
||||||
|
<i class="bi bi-shop ms-2"></i>
|
||||||
|
}
|
||||||
|
@if (planRecordTemplate.ImportMode == ImportMode.ServiceRecord)
|
||||||
|
{
|
||||||
|
<i class="bi bi-card-checklist ms-2"></i>
|
||||||
|
}
|
||||||
|
else if (planRecordTemplate.ImportMode == ImportMode.UpgradeRecord)
|
||||||
|
{
|
||||||
|
<i class="bi bi-wrench-adjustable ms-2"></i>
|
||||||
|
}
|
||||||
|
else if (planRecordTemplate.ImportMode == ImportMode.RepairRecord)
|
||||||
|
{
|
||||||
|
<i class="bi bi-exclamation-octagon ms-2"></i>
|
||||||
|
}
|
||||||
|
@if (planRecordTemplate.Priority == PlanPriority.Critical)
|
||||||
|
{
|
||||||
|
<i class="bi bi-fire ms-2"></i>
|
||||||
|
}
|
||||||
|
else if (planRecordTemplate.Priority == PlanPriority.Normal)
|
||||||
|
{
|
||||||
|
<i class="bi bi-water ms-2"></i>
|
||||||
|
}
|
||||||
|
else if (planRecordTemplate.Priority == PlanPriority.Low)
|
||||||
|
{
|
||||||
|
<i class="bi bi-snow ms-2"></i>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="col-2"><button type="button" class="btn btn-primary" onclick="usePlannerRecordTemplate(@planRecordTemplate.Id)"><i class="bi bi-plus-square"></i></button></td>
|
||||||
|
<td class="col-2"><button type="button" class="btn btn-danger" onclick="deletePlannerRecordTemplate(@planRecordTemplate.Id)"><i class="bi bi-trash"></i></button></td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="text-center">
|
||||||
|
<h4>@translator.Translate(userLanguage, "No templates are found.")</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="hidePlanRecordTemplatesModal()">@translator.Translate(userLanguage, "Cancel")</button>
|
||||||
|
</div>
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var hideZero = userConfig.HideZero;
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
var backLogItems = Model.Where(x => x.Progress == PlanProgress.Backlog).OrderBy(x=>x.Priority);
|
var backLogItems = Model.Where(x => x.Progress == PlanProgress.Backlog).OrderBy(x=>x.Priority);
|
||||||
var inProgressItems = Model.Where(x => x.Progress == PlanProgress.InProgress).OrderBy(x => x.Priority);
|
var inProgressItems = Model.Where(x => x.Progress == PlanProgress.InProgress).OrderBy(x => x.Priority);
|
||||||
var testingItems = Model.Where(x => x.Progress == PlanProgress.Testing).OrderBy(x => x.Priority);
|
var testingItems = Model.Where(x => x.Progress == PlanProgress.Testing).OrderBy(x => x.Priority);
|
||||||
@@ -12,25 +15,25 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Plan Records: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success">@($"{translator.Translate(userLanguage,"# of Plan Records")}: {Model.Count()}")</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddPlanRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Plan Record</button>
|
<button onclick="showAddPlanRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Plan Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('PlanRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('PlanRecord')">@translator.Translate(userLanguage,"Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('PlanRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('PlanRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<button onclick="showAddPlanRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Plan Record</button>
|
<button onclick="showAddPlanRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Plan Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -46,7 +49,7 @@
|
|||||||
<div class="col-3 d-flex flex-column swimlane mid" ondragover="dragOver(event)" ondrop="dropBox(event, 'Backlog')">
|
<div class="col-3 d-flex flex-column swimlane mid" ondragover="dragOver(event)" ondrop="dropBox(event, 'Backlog')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
||||||
<span class="display-7">Planned</span>
|
<span class="display-7">@translator.Translate(userLanguage,"Planned")</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@foreach (PlanRecord planRecord in backLogItems)
|
@foreach (PlanRecord planRecord in backLogItems)
|
||||||
@@ -57,7 +60,7 @@
|
|||||||
<div class="col-3 d-flex flex-column swimlane mid" ondragover="dragOver(event)" ondrop="dropBox(event, 'InProgress')">
|
<div class="col-3 d-flex flex-column swimlane mid" ondragover="dragOver(event)" ondrop="dropBox(event, 'InProgress')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
||||||
<span class="display-7">Doing</span>
|
<span class="display-7">@translator.Translate(userLanguage,"Doing")</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@foreach (PlanRecord planRecord in inProgressItems)
|
@foreach (PlanRecord planRecord in inProgressItems)
|
||||||
@@ -68,7 +71,7 @@
|
|||||||
<div class="col-3 d-flex flex-column swimlane" ondragover="dragOver(event)" ondrop="dropBox(event, 'Testing')">
|
<div class="col-3 d-flex flex-column swimlane" ondragover="dragOver(event)" ondrop="dropBox(event, 'Testing')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
||||||
<span class="display-7">Testing</span>
|
<span class="display-7">@translator.Translate(userLanguage,"Testing")</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@foreach (PlanRecord planRecord in testingItems)
|
@foreach (PlanRecord planRecord in testingItems)
|
||||||
@@ -79,7 +82,7 @@
|
|||||||
<div class="col-3 d-flex flex-column swimlane end" ondragover="dragOver(event)" ondrop="dropBox(event, 'Done')">
|
<div class="col-3 d-flex flex-column swimlane end" ondragover="dragOver(event)" ondrop="dropBox(event, 'Done')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
<div class="col-12 d-flex justify-content-center" style="height:5vh;">
|
||||||
<span class="display-7">Done</span>
|
<span class="display-7">@translator.Translate(userLanguage,"Done")</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@foreach (PlanRecord planRecord in doneItems)
|
@foreach (PlanRecord planRecord in doneItems)
|
||||||
@@ -97,4 +100,11 @@
|
|||||||
<div class="modal-content" id="planRecordModalContent">
|
<div class="modal-content" id="planRecordModalContent">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" data-bs-focus="false" id="planRecordTemplateModal" tabindex="-1" role="dialog" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content" id="planRecordTemplateModalContent">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,4 +1,11 @@
|
|||||||
@model ReminderMakeUpForVehicle
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model ReminderMakeUpForVehicle
|
||||||
@if (Model.UrgentCount + Model.VeryUrgentCount + Model.NotUrgentCount + Model.PastDueCount > 0)
|
@if (Model.UrgentCount + Model.VeryUrgentCount + Model.NotUrgentCount + Model.PastDueCount > 0)
|
||||||
{
|
{
|
||||||
<canvas id="donut-chart"></canvas>
|
<canvas id="donut-chart"></canvas>
|
||||||
@@ -9,10 +16,15 @@
|
|||||||
new Chart($("#donut-chart"), {
|
new Chart($("#donut-chart"), {
|
||||||
type: 'doughnut',
|
type: 'doughnut',
|
||||||
data: {
|
data: {
|
||||||
labels: ["Not Urgent", "Urgent", "Very Urgent", "Past Due"],
|
labels: [
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Not Urgent")'),
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Urgent")'),
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Very Urgent")'),
|
||||||
|
decodeHTMLEntities('@translator.Translate(userLanguage, "Past Due")')
|
||||||
|
],
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: "Reminders by Category",
|
label: decodeHTMLEntities('@translator.Translate(userLanguage, "Reminders by Category")'),
|
||||||
backgroundColor: ["#488f31", "#ffa600", "#de425b", "#cccccc"],
|
backgroundColor: ["#488f31", "#ffa600", "#de425b", "#cccccc"],
|
||||||
data: [
|
data: [
|
||||||
@Model.NotUrgentCount,
|
@Model.NotUrgentCount,
|
||||||
@@ -33,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: "Reminders by Urgency",
|
text: decodeHTMLEntities('@translator.Translate(userLanguage, "Reminders by Urgency")'),
|
||||||
color: useDarkMode ? "#fff" : "#000"
|
color: useDarkMode ? "#fff" : "#000"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -45,6 +57,6 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h4>No data found, create reminders to see visualizations here.</h4>
|
<h4>@translator.Translate(userLanguage,"No data found, create reminders to see visualizations here.")</h4>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
@model ReminderRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model ReminderRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Reminder" : "Edit Reminder")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Reminder") : translator.Translate(userLanguage, "Edit Reminder"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddReminderRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddReminderRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,55 +17,68 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12" id="reminderOptions">
|
<div class="col-md-6 col-12" id="reminderOptions">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="reminderDescription">Description</label>
|
<label for="reminderDescription">@translator.Translate(userLanguage,"Description")</label>
|
||||||
<input type="text" id="reminderDescription" class="form-control" placeholder="Reminder Description" value="@Model.Description">
|
<input type="text" id="reminderDescription" class="form-control" placeholder="@translator.Translate(userLanguage,"Reminder Description")" value="@Model.Description">
|
||||||
<label>Remind me on:</label>
|
<label>@translator.Translate(userLanguage,"Remind me on")</label>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="radio" name="reminderMetricOptions" id="reminderMetricDate" value="@(ReminderMetric.Date)" checked="@(Model.Metric == ReminderMetric.Date)">
|
<input class="form-check-input" type="radio" name="reminderMetricOptions" id="reminderMetricDate" value="@(ReminderMetric.Date)" checked="@(Model.Metric == ReminderMetric.Date)">
|
||||||
<label class="form-check-label" for="reminderMetricDate">Date</label>
|
<label class="form-check-label" for="reminderMetricDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="reminderDate" class="form-control" placeholder="Future Date" value="@Model.Date">
|
<input type="text" id="reminderDate" class="form-control" placeholder="@translator.Translate(userLanguage,"Future Date")" value="@Model.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input class="form-check-input" type="radio" name="reminderMetricOptions" id="reminderMetricOdometer" value="@(ReminderMetric.Odometer)" checked="@(Model.Metric == ReminderMetric.Odometer)">
|
<input class="form-check-input" type="radio" name="reminderMetricOptions" id="reminderMetricOdometer" value="@(ReminderMetric.Odometer)" checked="@(Model.Metric == ReminderMetric.Odometer)">
|
||||||
<label class="form-check-label" for="reminderMetricOdometer">Odometer</label>
|
<label class="form-check-label" for="reminderMetricOdometer">@translator.Translate(userLanguage,"Odometer")</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="number" id="reminderMileage" class="form-control" placeholder="Future Odometer Reading" value="@(isNew ? "" : Model.Mileage)">
|
<input type="number" id="reminderMileage" class="form-control" placeholder="@translator.Translate(userLanguage,"Future Odometer Reading")" value="@(isNew ? "" : Model.Mileage)">
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<button type="button" class="btn btn-sm btn-primary" onclick="appendMileageToOdometer(500)">+500</button>
|
<button type="button" class="btn btn-sm btn-primary" onclick="appendMileageToOdometer(500)">+500</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check form-check-inline">
|
<div class="form-check form-check-inline">
|
||||||
<input class="form-check-input" type="radio" name="reminderMetricOptions" id="reminderMetricBoth" value="@(ReminderMetric.Both)" checked="@(Model.Metric == ReminderMetric.Both)">
|
<input class="form-check-input" type="radio" name="reminderMetricOptions" id="reminderMetricBoth" value="@(ReminderMetric.Both)" checked="@(Model.Metric == ReminderMetric.Both)">
|
||||||
<label class="form-check-label" for="reminderMetricBoth">Whichever comes first</label>
|
<label class="form-check-label" for="reminderMetricBoth">@translator.Translate(userLanguage,"Whichever comes first")</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="reminderNotes">Notes(optional)</label>
|
<label for="reminderNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="reminderNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="reminderNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" onChange="enableRecurring()" role="switch" id="reminderIsRecurring" checked="@Model.IsRecurring">
|
<input class="form-check-input" type="checkbox" onChange="enableRecurring()" role="switch" id="reminderIsRecurring" checked="@Model.IsRecurring">
|
||||||
<label class="form-check-label" for="reminderIsRecurring">Is Recurring</label>
|
<label class="form-check-label" for="reminderIsRecurring">@translator.Translate(userLanguage,"Is Recurring")</label>
|
||||||
</div>
|
</div>
|
||||||
<label for="reminderRecurringMileage">Odometer</label>
|
<label for="reminderRecurringMileage">@translator.Translate(userLanguage,"Odometer")</label>
|
||||||
<select class="form-select" id="reminderRecurringMileage" @(Model.IsRecurring ? "" : "disabled")>
|
<select class="form-select" onchange="checkCustomMileageInterval()" id="reminderRecurringMileage" @(Model.IsRecurring ? "" : "disabled")>
|
||||||
<!option value="FiveHundredMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FiveHundredMiles || isNew ? "selected" : "")>500 mi. / Km</!option>
|
<!option value="Other" @(Model.ReminderMileageInterval == ReminderMileageInterval.Other ? "selected" : "")>@(Model.ReminderMileageInterval == ReminderMileageInterval.Other && Model.CustomMileageInterval > 0 ? $"{translator.Translate(userLanguage, "Other")}: {Model.CustomMileageInterval}" : $"{translator.Translate(userLanguage, "Other")}") </!option>
|
||||||
|
<!option value="FiftyMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FiftyMiles ? "selected" : "")>50 mi. / Km</!option>
|
||||||
|
<!option value="OneHundredMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.OneHundredMiles ? "selected" : "")>100 mi. / Km</!option>
|
||||||
|
<!option value="FiveHundredMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FiveHundredMiles ? "selected" : "")>500 mi. / Km</!option>
|
||||||
<!option value="OneThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.OneThousandMiles ? "selected" : "")>1000 mi. / Km</!option>
|
<!option value="OneThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.OneThousandMiles ? "selected" : "")>1000 mi. / Km</!option>
|
||||||
<!option value="ThreeThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.ThreeThousandMiles ? "selected" : "")>3000 mi. / Km</!option>
|
<!option value="ThreeThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.ThreeThousandMiles ? "selected" : "")>3000 mi. / Km</!option>
|
||||||
|
<!option value="FourThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FourThousandMiles ? "selected" : "")>4000 mi. / Km</!option>
|
||||||
<!option value="FiveThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FiveThousandMiles || isNew ? "selected" : "")>5000 mi. / Km</!option>
|
<!option value="FiveThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FiveThousandMiles || isNew ? "selected" : "")>5000 mi. / Km</!option>
|
||||||
<!option value="SevenThousandFiveHundredMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.SevenThousandFiveHundredMiles ? "selected" : "")>7500 mi. / Km</!option>
|
<!option value="SevenThousandFiveHundredMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.SevenThousandFiveHundredMiles ? "selected" : "")>7500 mi. / Km</!option>
|
||||||
<!option value="TenThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.TenThousandMiles ? "selected" : "")>10000 mi. / Km</!option>
|
<!option value="TenThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.TenThousandMiles ? "selected" : "")>10000 mi. / Km</!option>
|
||||||
|
<!option value="FifteenThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FifteenThousandMiles ? "selected" : "")>15000 mi. / Km</!option>
|
||||||
|
<!option value="TwentyThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.TwentyThousandMiles ? "selected" : "")>20000 mi. / Km</!option>
|
||||||
|
<!option value="ThirtyThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.ThirtyThousandMiles ? "selected" : "")>30000 mi. / Km</!option>
|
||||||
|
<!option value="FortyThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FortyThousandMiles ? "selected" : "")>40000 mi. / Km</!option>
|
||||||
<!option value="FiftyThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FiftyThousandMiles ? "selected" : "")>50000 mi. / Km</!option>
|
<!option value="FiftyThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.FiftyThousandMiles ? "selected" : "")>50000 mi. / Km</!option>
|
||||||
|
<!option value="SixtyThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.SixtyThousandMiles ? "selected" : "")>60000 mi. / Km</!option>
|
||||||
|
<!option value="OneHundredThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.OneHundredThousandMiles ? "selected" : "")>100000 mi. / Km</!option>
|
||||||
|
<!option value="OneHundredFiftyThousandMiles" @(Model.ReminderMileageInterval == ReminderMileageInterval.OneHundredFiftyThousandMiles ? "selected" : "")>150000 mi. / Km</!option>
|
||||||
</select>
|
</select>
|
||||||
<label for="reminderRecurringMonth">Month</label>
|
<label for="reminderRecurringMonth">Month</label>
|
||||||
<select class="form-select" id="reminderRecurringMonth" @(Model.IsRecurring ? "" : "disabled")>
|
<select class="form-select" id="reminderRecurringMonth" @(Model.IsRecurring ? "" : "disabled")>
|
||||||
<!option value="ThreeMonths" @(Model.ReminderMonthInterval == ReminderMonthInterval.ThreeMonths || isNew ? "selected" : "")>3 Months</!option>
|
<!option value="ThreeMonths" @(Model.ReminderMonthInterval == ReminderMonthInterval.ThreeMonths || isNew ? "selected" : "")>@translator.Translate(userLanguage,"3 Months")</!option>
|
||||||
<!option value="SixMonths" @(Model.ReminderMonthInterval == ReminderMonthInterval.SixMonths ? "selected" : "")>6 Months</!option>
|
<!option value="SixMonths" @(Model.ReminderMonthInterval == ReminderMonthInterval.SixMonths ? "selected" : "")>@translator.Translate(userLanguage,"6 Months")</!option>
|
||||||
<!option value="OneYear" @(Model.ReminderMonthInterval == ReminderMonthInterval.OneYear ? "selected" : "")>1 Year</!option>
|
<!option value="OneYear" @(Model.ReminderMonthInterval == ReminderMonthInterval.OneYear ? "selected" : "")>@translator.Translate(userLanguage, "1 Year")</!option>
|
||||||
<!option value="FiveYears" @(Model.ReminderMonthInterval == ReminderMonthInterval.FiveYears ? "selected" : "")>5 Years</!option>
|
<!option value="TwoYears" @(Model.ReminderMonthInterval == ReminderMonthInterval.TwoYears ? "selected" : "")>@translator.Translate(userLanguage, "2 Years")</!option>
|
||||||
|
<!option value="ThreeYears" @(Model.ReminderMonthInterval == ReminderMonthInterval.ThreeYears ? "selected" : "")>@translator.Translate(userLanguage, "3 Years")</!option>
|
||||||
|
<!option value="FiveYears" @(Model.ReminderMonthInterval == ReminderMonthInterval.FiveYears ? "selected" : "")>@translator.Translate(userLanguage, "5 Years")</!option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,20 +88,21 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteReminderRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<button type="button" class="btn btn-danger" onclick="deleteReminderRecord(@Model.Id)" style="margin-right:auto;">@translator.Translate(userLanguage, "Delete")</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddReminderRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddReminderRecordModal()">@translator.Translate(userLanguage, "Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveReminderRecordToVehicle()">Add New Reminder</button>
|
<button type="button" class="btn btn-primary" onclick="saveReminderRecordToVehicle()">@translator.Translate(userLanguage, "Add New Reminder")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveReminderRecordToVehicle(true)">Edit Reminder</button>
|
<button type="button" class="btn btn-primary" onclick="saveReminderRecordToVehicle(true)">@translator.Translate(userLanguage, "Edit Reminder")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
var customMileageInterval = @Model.CustomMileageInterval;
|
||||||
function getReminderRecordModelData() {
|
function getReminderRecordModelData() {
|
||||||
return { id: @Model.Id}
|
return { id: @Model.Id, mileageInterval: '@Model.ReminderMileageInterval.ToString()'}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -1,15 +1,23 @@
|
|||||||
@model List<ReminderRecordViewModel>
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model List<ReminderRecordViewModel>
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var hasRefresh = Model.Where(x => (x.Urgency == ReminderUrgency.VeryUrgent || x.Urgency == ReminderUrgency.PastDue) && x.IsRecurring).Any();
|
||||||
|
}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Reminders: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success">@($"{translator.Translate(userLanguage, "# of Reminders")}: {Model.Count()}")</span>
|
||||||
<span class="ms-2 badge bg-secondary">@($"Past Due: {Model.Where(x => x.Urgency == ReminderUrgency.PastDue).Count()}")</span>
|
<span class="ms-2 badge bg-secondary">@($"{translator.Translate(userLanguage, "Past Due")}: {Model.Where(x => x.Urgency == ReminderUrgency.PastDue).Count()}")</span>
|
||||||
<span class="ms-2 badge bg-danger">@($"Very Urgent: {Model.Where(x=>x.Urgency == ReminderUrgency.VeryUrgent).Count()}")</span>
|
<span class="ms-2 badge bg-danger">@($"{translator.Translate(userLanguage, "Very Urgent")}: {Model.Where(x=>x.Urgency == ReminderUrgency.VeryUrgent).Count()}")</span>
|
||||||
<span class="ms-2 badge bg-warning">@($"Urgent: {Model.Where(x => x.Urgency == ReminderUrgency.Urgent).Count()}")</span>
|
<span class="ms-2 badge bg-warning">@($"{translator.Translate(userLanguage, "Urgent")}: {Model.Where(x => x.Urgency == ReminderUrgency.Urgent).Count()}")</span>
|
||||||
<span class="ms-2 badge bg-success">@($"Not Urgent: {Model.Where(x => x.Urgency == ReminderUrgency.NotUrgent).Count()}")</span>
|
<span class="ms-2 badge bg-success">@($"{translator.Translate(userLanguage, "Not Urgent")}: {Model.Where(x => x.Urgency == ReminderUrgency.NotUrgent).Count()}")</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button onclick="showAddReminderModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Reminder</button>
|
<button onclick="showAddReminderModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add Reminder")</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,11 +31,15 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-1">Urgency</th>
|
<th scope="col" class="col-1">@translator.Translate(userLanguage, "Urgency")</th>
|
||||||
<th scope="col" class="col-2">Metric</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Metric")</th>
|
||||||
<th scope="col" class="col-5">Description</th>
|
<th scope="col" class="@(hasRefresh ? "col-4" : "col-5")">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-3">Notes</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
<th scope="col" class="col-1">Delete</th>
|
@if (hasRefresh)
|
||||||
|
{
|
||||||
|
<th scope="col" class="col-1">@translator.Translate(userLanguage, "Done")</th>
|
||||||
|
}
|
||||||
|
<th scope="col" class="col-1">@translator.Translate(userLanguage, "Delete")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -36,19 +48,19 @@
|
|||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditReminderRecordModal(@reminderRecord.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditReminderRecordModal(@reminderRecord.Id)">
|
||||||
@if (reminderRecord.Urgency == ReminderUrgency.VeryUrgent)
|
@if (reminderRecord.Urgency == ReminderUrgency.VeryUrgent)
|
||||||
{
|
{
|
||||||
<td class="col-1"><span class="badge text-bg-danger">Very Urgent</span></td>
|
<td class="col-1"><span class="badge text-bg-danger">@translator.Translate(userLanguage, "Very Urgent")</span></td>
|
||||||
}
|
}
|
||||||
else if (reminderRecord.Urgency == ReminderUrgency.Urgent)
|
else if (reminderRecord.Urgency == ReminderUrgency.Urgent)
|
||||||
{
|
{
|
||||||
<td class="col-1"><span class="badge text-bg-warning">Urgent</span></td>
|
<td class="col-1"><span class="badge text-bg-warning">@translator.Translate(userLanguage, "Urgent")</span></td>
|
||||||
}
|
}
|
||||||
else if (reminderRecord.Urgency == ReminderUrgency.PastDue)
|
else if (reminderRecord.Urgency == ReminderUrgency.PastDue)
|
||||||
{
|
{
|
||||||
<td class="col-1"><span class="badge text-bg-secondary">Past Due</span></td>
|
<td class="col-1"><span class="badge text-bg-secondary">@translator.Translate(userLanguage, "Past Due")</span></td>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<td class="col-1"><span class="badge text-bg-success">Not Urgent</span></td>
|
<td class="col-1"><span class="badge text-bg-success">@translator.Translate(userLanguage, "Not Urgent")</span></td>
|
||||||
}
|
}
|
||||||
@if (reminderRecord.Metric == ReminderMetric.Date)
|
@if (reminderRecord.Metric == ReminderMetric.Date)
|
||||||
{
|
{
|
||||||
@@ -62,8 +74,17 @@
|
|||||||
{
|
{
|
||||||
<td class="col-2">@reminderRecord.Metric</td>
|
<td class="col-2">@reminderRecord.Metric</td>
|
||||||
}
|
}
|
||||||
<td class="col-5">@reminderRecord.Description</td>
|
<td class="@(hasRefresh ? "col-4" : "col-5")">@reminderRecord.Description</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(reminderRecord.Notes)</td>
|
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(reminderRecord.Notes)</td>
|
||||||
|
@if (hasRefresh)
|
||||||
|
{
|
||||||
|
<td class="col-1 text-truncate">
|
||||||
|
@if((reminderRecord.Urgency == ReminderUrgency.VeryUrgent || reminderRecord.Urgency == ReminderUrgency.PastDue) && reminderRecord.IsRecurring)
|
||||||
|
{
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="markDoneReminderRecord(@reminderRecord.Id, this)"><i class="bi bi-check-lg"></i></button>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
}
|
||||||
<td class="col-1 text-truncate">
|
<td class="col-1 text-truncate">
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteReminderRecord(@reminderRecord.Id, this)"><i class="bi bi-trash"></i></button>
|
<button type="button" class="btn btn-danger" onclick="deleteReminderRecord(@reminderRecord.Id, this)"><i class="bi bi-trash"></i></button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -1,90 +1,100 @@
|
|||||||
@model ReportViewModel
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model ReportViewModel
|
||||||
<div class="container reportTabContainer">
|
<div class="container reportTabContainer">
|
||||||
<div class="row hideOnPrint">
|
<div class="row hideOnPrint">
|
||||||
<div class="col-md-3 col-12 mt-2">
|
<div class="col-md-3 col-12 mt-2">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<select class="form-select" id="yearOption" onchange="yearUpdated()">
|
<select class="form-select" id="yearOption" onchange="yearUpdated()">
|
||||||
<option value="0">All Time</option>
|
<option value="0">All Time</option>
|
||||||
@foreach (int year in Model.Years)
|
@foreach (int year in Model.Years)
|
||||||
{
|
{
|
||||||
<option value="@year">@year</option>
|
<option value="@year">@year</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="costMakeUpReportContent">
|
||||||
|
@await Html.PartialAsync("_CostMakeUpReport", Model.CostMakeUpForVehicle)
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="col-md-6 col-12 mt-2">
|
||||||
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="costMakeUpReportContent">
|
<div class="row">
|
||||||
@await Html.PartialAsync("_CostMakeUpReport", Model.CostMakeUpForVehicle)
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6 col-12 mt-2">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-1 d-sm-none d-md-block"></div>
|
|
||||||
<div class="col-12 col-md-10 reportsCheckBoxContainer">
|
|
||||||
<div class="form-check form-check-inline">
|
|
||||||
<input class="form-check-input" onChange="updateCheck(this)" type="checkbox" id="serviceExpenseCheck" value="1" checked>
|
|
||||||
<label class="form-check-label" for="serviceExpenseCheck">Service</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check form-check-inline">
|
|
||||||
<input class="form-check-input" onChange="updateCheck(this)" type="checkbox" id="repairExpenseCheck" value="2" checked>
|
|
||||||
<label class="form-check-label" for="repairExpenseCheck">Repairs</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check form-check-inline">
|
|
||||||
<input class="form-check-input" onChange="updateCheck(this)" type="checkbox" id="upgradeExpenseCheck" value="3" checked>
|
|
||||||
<label class="form-check-label" for="upgradeExpenseCheck">Upgrades</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check form-check-inline">
|
|
||||||
<input class="form-check-input" onChange="updateCheck(this)" type="checkbox" id="gasExpenseCheck" value="4" checked>
|
|
||||||
<label class="form-check-label" for="gasExpenseCheck">Gas</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check form-check-inline">
|
|
||||||
<input class="form-check-input" onChange="updateCheck(this)" type="checkbox" id="taxExpenseCheck" value="5" checked>
|
|
||||||
<label class="form-check-label" for="taxExpenseCheck">Tax</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1 d-sm-none d-md-block"></div>
|
<div class="col-md-1 d-sm-none d-md-block"></div>
|
||||||
|
<div class="col-12 col-md-10 reportsCheckBoxContainer">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" onChange="updateCheck()" type="checkbox" id="serviceExpenseCheck" value="1" checked>
|
||||||
|
<label class="form-check-label" for="serviceExpenseCheck">@translator.Translate(userLanguage,"Service")</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" onChange="updateCheck()" type="checkbox" id="repairExpenseCheck" value="2" checked>
|
||||||
|
<label class="form-check-label" for="repairExpenseCheck">@translator.Translate(userLanguage, "Repairs")</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" onChange="updateCheck()" type="checkbox" id="upgradeExpenseCheck" value="3" checked>
|
||||||
|
<label class="form-check-label" for="upgradeExpenseCheck">@translator.Translate(userLanguage, "Upgrades")</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" onChange="updateCheck()" type="checkbox" id="gasExpenseCheck" value="4" checked>
|
||||||
|
<label class="form-check-label" for="gasExpenseCheck">@translator.Translate(userLanguage, "Fuel")</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" onChange="updateCheck()" type="checkbox" id="taxExpenseCheck" value="5" checked>
|
||||||
|
<label class="form-check-label" for="taxExpenseCheck">@translator.Translate(userLanguage, "Taxes")</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1 d-sm-none d-md-block"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="gasCostByMonthReportContent">
|
||||||
|
@await Html.PartialAsync("_GasCostByMonthReport", Model.CostForVehicleByMonth)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="col-md-3 col-12 mt-2">
|
||||||
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="gasCostByMonthReportContent">
|
<div class="row">
|
||||||
@await Html.PartialAsync("_GasCostByMonthReport", Model.CostForVehicleByMonth)
|
<div class="col-12">
|
||||||
|
<select class="form-select" onchange="updateReminderPie()" id="reminderOption">
|
||||||
|
<option value="0">@translator.Translate(userLanguage, "As of Today")</option>
|
||||||
|
<option value="30">@translator.Translate(userLanguage, "+30 Days")</option>
|
||||||
|
<option value="60">@translator.Translate(userLanguage, "+60 Days")</option>
|
||||||
|
<option value="90">@translator.Translate(userLanguage, "+90 Days")</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="reminderMakeUpReportContent">
|
||||||
|
@await Html.PartialAsync("_ReminderMakeUpReport", Model.ReminderMakeUpForVehicle)
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3 col-12 mt-2">
|
<hr />
|
||||||
<div class="row">
|
<div class="row hideOnPrint">
|
||||||
<div class="col-12">
|
<div class="col-md-3 col-12 chartContainer" id="collaboratorContent">
|
||||||
<select class="form-select" onchange="updateReminderPie()" id="reminderOption">
|
@await Html.PartialAsync("_Collaborators", Model.Collaborators)
|
||||||
<option value="0">As of Today</option>
|
</div>
|
||||||
<option value="30">+30 Days</option>
|
<div class="col-md-6 col-12 chartContainer">
|
||||||
<option value="60">+60 Days</option>
|
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="monthFuelMileageReportContent">
|
||||||
<option value="90">+90 Days</option>
|
@await Html.PartialAsync("_MPGByMonthReport", Model.FuelMileageForVehicleByMonth)
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="col-md-3 col-12 chartContainer">
|
||||||
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="reminderMakeUpReportContent">
|
<div class="d-grid">
|
||||||
@await Html.PartialAsync("_ReminderMakeUpReport", Model.ReminderMakeUpForVehicle)
|
<button onclick="generateVehicleHistoryReport()" class="btn btn-secondary btn-md mt-1 mb-1">@translator.Translate(userLanguage, "Vehicle Maintenance Report")<i class="bi ms-2 bi-box-arrow-in-up-right"></i></button>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button onclick="exportAttachments()" class="btn btn-secondary btn-md mt-1 mb-1">@translator.Translate(userLanguage, "Export Attachments")<i class="bi ms-2 bi-box-arrow-in-up-right"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
|
||||||
<div class="row hideOnPrint">
|
|
||||||
<div class="col-md-3 col-12 chartContainer" id="collaboratorContent">
|
|
||||||
@await Html.PartialAsync("_Collaborators", Model.Collaborators)
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6 col-12 chartContainer">
|
|
||||||
<div class="d-flex justify-content-center align-items-center col-12 chartContainer" id="monthFuelMileageReportContent">
|
|
||||||
@await Html.PartialAsync("_MPGByMonthReport", Model.FuelMileageForVehicleByMonth)
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3 col-12 chartContainer">
|
|
||||||
<div class="d-flex justify-content-center">
|
|
||||||
<button onclick="generateVehicleHistoryReport()" class="btn btn-secondary btn-md mt-1 mb-1">Vehicle Maintenance Report<i class="bi ms-2 bi-box-arrow-in-up-right"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="vehicleHistoryReport" class="showOnPrint"></div>
|
<div id="vehicleHistoryReport" class="showOnPrint"></div>
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
@model ServiceRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model ServiceRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Service Record" : "Edit Service Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Service Record") : translator.Translate(userLanguage,"Edit Service Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddServiceRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddServiceRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,27 +17,39 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="serviceRecordDate">Date</label>
|
<label for="serviceRecordDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="serviceRecordDate" class="form-control" placeholder="Date service was performed" value="@Model.Date">
|
<input type="text" id="serviceRecordDate" class="form-control" placeholder="@translator.Translate(userLanguage,"Date service was performed")" value="@Model.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<label for="serviceRecordMileage">Odometer</label>
|
<label for="serviceRecordMileage">@translator.Translate(userLanguage,"Odometer")</label>
|
||||||
<input type="number" id="serviceRecordMileage" class="form-control" placeholder="Odometer reading when serviced" value="@(isNew ? "" : Model.Mileage)">
|
<input type="number" id="serviceRecordMileage" class="form-control" placeholder="@translator.Translate(userLanguage,"Odometer reading when serviced")" value="@(isNew ? "" : Model.Mileage)">
|
||||||
<label for="serviceRecordDescription">Description</label>
|
<label for="serviceRecordDescription">@translator.Translate(userLanguage,"Description")</label>
|
||||||
<input type="text" id="serviceRecordDescription" class="form-control" placeholder="Description of item(s) serviced(i.e. Oil Change)" value="@Model.Description">
|
<input type="text" id="serviceRecordDescription" class="form-control" placeholder="@translator.Translate(userLanguage,"Description of item(s) serviced(i.e. Oil Change)")" value="@Model.Description">
|
||||||
<label for="serviceRecordCost">Cost</label>
|
<label for="serviceRecordCost">@translator.Translate(userLanguage,"Cost")</label>
|
||||||
<input type="text" id="serviceRecordCost" class="form-control" placeholder="Cost of the service" value="@(isNew ? "" : Model.Cost)">
|
<input type="text" id="serviceRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage,"Cost of the service")" value="@(isNew ? "" : Model.Cost)">
|
||||||
|
@if (isNew)
|
||||||
|
{
|
||||||
|
@await Html.PartialAsync("_SupplyStore", "ServiceRecord")
|
||||||
|
}
|
||||||
|
<label for="serviceRecordTag">@translator.Translate(userLanguage,"Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="serviceRecordTag">
|
||||||
|
@foreach(string tag in Model.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="serviceRecordNotes">Notes(optional)</label>
|
<label for="serviceRecordNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="serviceRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="serviceRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
@if (Model.Files.Any())
|
@if (Model.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
<label for="serviceRecordFiles">Upload more documents</label>
|
<label for="serviceRecordFiles">@translator.Translate(userLanguage,"Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -42,12 +59,13 @@
|
|||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
||||||
<label class="form-check-label" for="addReminderCheck">
|
<label class="form-check-label" for="addReminderCheck">
|
||||||
Add Reminder
|
@translator.Translate(userLanguage,"Add Reminder")
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<label for="serviceRecordFiles">Upload documents(optional)</label>
|
<label for="serviceRecordFiles">@translator.Translate(userLanguage,"Upload documents(optional)")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="serviceRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,20 +75,31 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteServiceRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<div class="btn-group" style="margin-right:auto;">
|
||||||
|
<button type="button" class="btn btn-md mt-1 mb-1 btn-danger" onclick="deleteServiceRecord(@Model.Id)">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
|
<button type="button" class="btn btn-md btn-danger btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage,"Move To")</h6></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="moveRecord(@Model.Id, 'ServiceRecord', 'RepairRecord')">@translator.Translate(userLanguage,"Repairs")</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="moveRecord(@Model.Id, 'ServiceRecord', 'UpgradeRecord')">@translator.Translate(userLanguage,"Upgrades")</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddServiceRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddServiceRecordModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveServiceRecordToVehicle()">Add New Service Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveServiceRecordToVehicle()">@translator.Translate(userLanguage,"Add New Service Record")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveServiceRecordToVehicle(true)">Edit Service Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveServiceRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Service Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var uploadedFiles = [];
|
var uploadedFiles = [];
|
||||||
|
var selectedSupplies = [];
|
||||||
getUploadedFilesFromModel();
|
getUploadedFilesFromModel();
|
||||||
function getUploadedFilesFromModel() {
|
function getUploadedFilesFromModel() {
|
||||||
@foreach (UploadedFiles filesUploaded in Model.Files)
|
@foreach (UploadedFiles filesUploaded in Model.Files)
|
||||||
|
|||||||
@@ -1,33 +1,49 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var hideZero = userConfig.HideZero;
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
}
|
}
|
||||||
@model List<ServiceRecord>
|
@model List<ServiceRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Service Records: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="count">@($"{translator.Translate(userLanguage,"# of Service Records")}: {Model.Count()}")</span>
|
||||||
<span class="ms-2 badge bg-primary">@($"Total: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
<span class="ms-2 badge bg-primary" data-aggregate-type="sum">@($"{translator.Translate(userLanguage,"Total")}: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
||||||
|
@foreach(string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<span onclick="filterTable('servicerecord-tab-pane', this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
|
}
|
||||||
|
<datalist id="tagList">
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddServiceRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Service Record</button>
|
<button onclick="showAddServiceRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Service Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('ServiceRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('ServiceRecord')">@translator.Translate(userLanguage,"Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('ServiceRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('ServiceRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<button onclick="showAddServiceRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Service Record</button>
|
<button onclick="showAddServiceRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Service Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,21 +58,21 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">Date</th>
|
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage,"Date")</th>
|
||||||
<th scope="col" class="col-2">Odometer</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Odometer")</th>
|
||||||
<th scope="col" class="col-3 col-xl-4">Description</th>
|
<th scope="col" class="col-3 col-xl-4">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-2">Cost</th>
|
<th scope="col" class="col-2" onclick="toggleSort('servicerecord-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-3">Notes</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (ServiceRecord serviceRecord in Model)
|
@foreach (ServiceRecord serviceRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditServiceRecordModal(@serviceRecord.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditServiceRecordModal(@serviceRecord.Id)" data-tags='@string.Join(" ",serviceRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@serviceRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1">@serviceRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-2">@serviceRecord.Mileage</td>
|
<td class="col-2">@serviceRecord.Mileage</td>
|
||||||
<td class="col-3 col-xl-4">@serviceRecord.Description</td>
|
<td class="col-3 col-xl-4">@serviceRecord.Description</td>
|
||||||
<td class="col-2">@((hideZero && serviceRecord.Cost == default) ? "---" : serviceRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-record-type="cost">@((hideZero && serviceRecord.Cost == default) ? "---" : serviceRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(serviceRecord.Notes)</td>
|
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(serviceRecord.Notes)</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
@model SupplyRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model SupplyRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Supply Record" : "Edit Supply Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Supply Record") : translator.Translate(userLanguage,"Edit Supply Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddSupplyRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddSupplyRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,43 +17,45 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="supplyRecordDate">Date</label>
|
<label for="supplyRecordDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="supplyRecordDate" class="form-control" placeholder="Date purchased" value="@Model.Date">
|
<input type="text" id="supplyRecordDate" class="form-control" placeholder="@translator.Translate(userLanguage,"Date purchased")" value="@Model.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<label for="supplyRecordPartNumber">Part Number</label>
|
<label for="supplyRecordPartNumber">@translator.Translate(userLanguage,"Part Number")</label>
|
||||||
<input type="text" id="supplyRecordPartNumber" class="form-control" placeholder="Part #/Model #/SKU #" value="@(isNew ? "" : Model.PartNumber)">
|
<input type="text" id="supplyRecordPartNumber" class="form-control" placeholder="@translator.Translate(userLanguage,"Part #/Model #/SKU #")" value="@(isNew ? "" : Model.PartNumber)">
|
||||||
<label for="supplyRecordDescription">Description</label>
|
<label for="supplyRecordDescription">@translator.Translate(userLanguage,"Description")</label>
|
||||||
<input type="text" id="supplyRecordDescription" class="form-control" placeholder="Description of the Part/Supplies" value="@Model.Description">
|
<input type="text" id="supplyRecordDescription" class="form-control" placeholder="@translator.Translate(userLanguage,"Description of the Part/Supplies")" value="@Model.Description">
|
||||||
<label for="supplyRecordSupplier">Supplier/Vendor</label>
|
<label for="supplyRecordSupplier">@translator.Translate(userLanguage,"Supplier/Vendor")</label>
|
||||||
<input type="text" id="supplyRecordSupplier" class="form-control" placeholder="Part Supplier" value="@Model.PartSupplier">
|
<input type="text" id="supplyRecordSupplier" class="form-control" placeholder="@translator.Translate(userLanguage,"Part Supplier")" value="@Model.PartSupplier">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="supplyRecordQuantity">Quantity</label>
|
<label for="supplyRecordQuantity">@translator.Translate(userLanguage,"Quantity")</label>
|
||||||
<input type="text" id="supplyRecordQuantity" class="form-control" placeholder="Quantity" value="@(isNew ? "1" : Model.Quantity)">
|
<input type="text" id="supplyRecordQuantity" class="form-control" placeholder="@translator.Translate(userLanguage,"Quantity")" value="@(isNew ? "1" : Model.Quantity)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="supplyRecordCost">Cost</label>
|
<label for="supplyRecordCost">@translator.Translate(userLanguage,"Cost")</label>
|
||||||
<input type="text" id="supplyRecordCost" class="form-control" placeholder="Cost" value="@(isNew ? "" : Model.Cost)">
|
<input type="text" id="supplyRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage,"Cost")" value="@(isNew ? "" : Model.Cost)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="supplyRecordNotes">Notes(optional)</label>
|
<label for="supplyRecordNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="supplyRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="supplyRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
@if (Model.Files.Any())
|
@if (Model.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
<label for="supplyRecordFiles">Upload more documents</label>
|
<label for="supplyRecordFiles">@translator.Translate(userLanguage,"Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="supplyRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="supplyRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<label for="supplyRecordFiles">Upload documents(optional)</label>
|
<label for="supplyRecordFiles">@translator.Translate(userLanguage,"Upload documents(optional)")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="supplyRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="supplyRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -58,16 +65,16 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteSupplyRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<button type="button" class="btn btn-danger" onclick="deleteSupplyRecord(@Model.Id)" style="margin-right:auto;">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddSupplyRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddSupplyRecordModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveSupplyRecordToVehicle()">Add New Supply Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveSupplyRecordToVehicle()">@translator.Translate(userLanguage,"Add New Supply Record")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveSupplyRecordToVehicle(true)">Edit Supply Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveSupplyRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Supply Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,33 +1,38 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var hideZero = userConfig.HideZero;
|
||||||
}
|
}
|
||||||
@model List<SupplyRecord>
|
@model List<SupplyRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Supply Records: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success">@($"{translator.Translate(userLanguage,"# of Supply Records")}: {Model.Count()}")</span>
|
||||||
<span class="ms-2 badge bg-primary">@($"Total: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
<span class="ms-2 badge bg-primary">@($"{translator.Translate(userLanguage,"Total")}: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddSupplyRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Supply Record</button>
|
<button onclick="showAddSupplyRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Supply Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('SupplyRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('SupplyRecord')">@translator.Translate(userLanguage,"Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('SupplyRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('SupplyRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage,"Print")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<button onclick="showAddSupplyRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Supply Record</button>
|
<button onclick="showAddSupplyRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage,"Add Supply Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,13 +47,13 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">Date</th>
|
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage,"Date")</th>
|
||||||
<th scope="col" class="col-2">Part #</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Part #")</th>
|
||||||
<th scope="col" class="col-2">Supplier</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Supplier")</th>
|
||||||
<th scope="col" class="col-2 col-xl-3">Description</th>
|
<th scope="col" class="col-2 col-xl-3">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-1">Quantity</th>
|
<th scope="col" class="col-1" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Quantity")</th>
|
||||||
<th scope="col" class="col-1">Cost</th>
|
<th scope="col" class="col-1" onclick="toggleSort('supply-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-2">Notes</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
98
Views/Vehicle/_SupplyStore.cshtml
Normal file
98
Views/Vehicle/_SupplyStore.cshtml
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model string
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<a onclick="showSuppliesModal()" class="btn btn-link">@translator.Translate(userLanguage,"Choose Supplies")</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
resetSuppliesModal();
|
||||||
|
function GetCaller() {
|
||||||
|
return { tab: '@Model' };
|
||||||
|
}
|
||||||
|
function resetSuppliesModal() {
|
||||||
|
$("#inputSuppliesModalContent").html("");
|
||||||
|
}
|
||||||
|
function selectSupplies() {
|
||||||
|
var selectedSupplyResult = getSuppliesAndQuantity();
|
||||||
|
var caller = GetCaller().tab;
|
||||||
|
switch (caller) {
|
||||||
|
case "ServiceRecord":
|
||||||
|
$('#serviceRecordCost').val(selectedSupplyResult.totalSum);
|
||||||
|
break;
|
||||||
|
case "RepairRecord":
|
||||||
|
$('#collisionRecordCost').val(selectedSupplyResult.totalSum);
|
||||||
|
break;
|
||||||
|
case "UpgradeRecord":
|
||||||
|
$('#upgradeRecordCost').val(selectedSupplyResult.totalSum);
|
||||||
|
break;
|
||||||
|
case "PlanRecord":
|
||||||
|
$('#planRecordCost').val(selectedSupplyResult.totalSum);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
selectedSupplies = getSuppliesAndQuantity().selectedSupplies;
|
||||||
|
hideSuppliesModal();
|
||||||
|
}
|
||||||
|
function hideParentModal(){
|
||||||
|
var caller = GetCaller().tab;
|
||||||
|
switch (caller) {
|
||||||
|
case "ServiceRecord":
|
||||||
|
$('#serviceRecordModal').modal('hide');
|
||||||
|
break;
|
||||||
|
case "RepairRecord":
|
||||||
|
$('#collisionRecordModal').modal('hide');
|
||||||
|
break;
|
||||||
|
case "UpgradeRecord":
|
||||||
|
$('#upgradeRecordModal').modal('hide');
|
||||||
|
break;
|
||||||
|
case "PlanRecord":
|
||||||
|
$('#planRecordModal').modal('hide');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showParentModal() {
|
||||||
|
var caller = GetCaller().tab;
|
||||||
|
switch (caller) {
|
||||||
|
case "ServiceRecord":
|
||||||
|
$('#serviceRecordModal').modal('show');
|
||||||
|
break;
|
||||||
|
case "RepairRecord":
|
||||||
|
$('#collisionRecordModal').modal('show');
|
||||||
|
break;
|
||||||
|
case "UpgradeRecord":
|
||||||
|
$('#upgradeRecordModal').modal('show');
|
||||||
|
break;
|
||||||
|
case "PlanRecord":
|
||||||
|
$('#planRecordModal').modal('show');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showSuppliesModal() {
|
||||||
|
if ($("#inputSuppliesModalContent").html() == "") {
|
||||||
|
getSupplies();
|
||||||
|
} else {
|
||||||
|
hideParentModal();
|
||||||
|
$('#inputSuppliesModal').modal('show');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getSupplies() {
|
||||||
|
var vehicleId = GetVehicleId().vehicleId;
|
||||||
|
$.get(`/Vehicle/GetSupplyRecordsForRecordsByVehicleId?vehicleId=${vehicleId}`, function (data) {
|
||||||
|
if (data) {
|
||||||
|
hideParentModal();
|
||||||
|
$("#inputSuppliesModalContent").html(data);
|
||||||
|
$('#inputSuppliesModal').modal('show');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function hideSuppliesModal() {
|
||||||
|
$('#inputSuppliesModal').modal('hide');
|
||||||
|
showParentModal();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
133
Views/Vehicle/_SupplyUsage.cshtml
Normal file
133
Views/Vehicle/_SupplyUsage.cshtml
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model List<SupplyRecord>
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">@translator.Translate(userLanguage,"Select Supplies")</h5>
|
||||||
|
<button type="button" class="btn-close" onclick="hideSuppliesModal()" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
@if (Model.Any())
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12" style="max-height:50vh; overflow-y:auto;">
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
@translator.Translate(userLanguage,"Supplies are requisitioned immediately after the record is created and cannot be modified. If you have incorrectly entered the amount you needed you will need to correct it in the Supplies tab.")
|
||||||
|
</div>
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead class="sticky-top">
|
||||||
|
<tr class="d-flex">
|
||||||
|
<th scope="col" class="col-1"></th>
|
||||||
|
<th scope="col" class="col-2">@translator.Translate(userLanguage,"Quantity")</th>
|
||||||
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "In Stock")</th>
|
||||||
|
<th scope="col" class="col-5">@translator.Translate(userLanguage, "Description")</th>
|
||||||
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Unit Cost")</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (SupplyRecord supplyRecord in Model)
|
||||||
|
{
|
||||||
|
<tr class="d-flex" id="supplyRows">
|
||||||
|
<td class="col-1"><input class="form-check-input" type="checkbox" onchange="toggleQuantityFieldDisabled(this)" value="@supplyRecord.Id"></td>
|
||||||
|
<td class="col-2"><input type="text" disabled onchange="recalculateTotal()" class="form-control"></td>
|
||||||
|
<td class="col-2 supplyquantity">@supplyRecord.Quantity</td>
|
||||||
|
<td class="col-5">@supplyRecord.Description</td>
|
||||||
|
<td class="col-2 supplyprice">@((supplyRecord.Quantity > 0 ? supplyRecord.Cost / supplyRecord.Quantity : 0).ToString("F"))</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="text-center">
|
||||||
|
<h4>@translator.Translate(userLanguage, "No supplies with quantities greater than 0 is found.")</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<span id="supplySumLabel" style="margin-right:auto;">Total: 0.00</span>
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="hideSuppliesModal()">@translator.Translate(userLanguage, "Cancel")</button>
|
||||||
|
<button type="button" class="btn btn-primary" disabled id="selectSuppliesButton" onclick="selectSupplies()">@translator.Translate(userLanguage, "Select")</button>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function recalculateTotal() {
|
||||||
|
setDebounce(getSuppliesAndQuantity);
|
||||||
|
}
|
||||||
|
function toggleQuantityFieldDisabled(e) {
|
||||||
|
var textField = getTextFieldFromCheckBox(e);
|
||||||
|
var isChecked = $(e).is(":checked");
|
||||||
|
textField.attr('disabled', !isChecked);
|
||||||
|
if (!isChecked) {
|
||||||
|
textField.removeClass("is-invalid");
|
||||||
|
}
|
||||||
|
recalculateTotal();
|
||||||
|
}
|
||||||
|
function getTextFieldFromCheckBox(elem) {
|
||||||
|
var textField = $(elem.parentElement.parentElement).find('.col-2 > input[type=text]')[0];
|
||||||
|
return $(textField);
|
||||||
|
}
|
||||||
|
function getInStockFieldFromCheckBox(elem) {
|
||||||
|
var textField = $(elem.parentElement.parentElement).find('.col-2.supplyquantity')[0];
|
||||||
|
return $(textField);
|
||||||
|
}
|
||||||
|
function getPriceFieldFromCheckBox(elem) {
|
||||||
|
var textField = $(elem.parentElement.parentElement).find('.col-2.supplyprice')[0];
|
||||||
|
return $(textField);
|
||||||
|
}
|
||||||
|
function getSuppliesAndQuantity() {
|
||||||
|
var totalSum = 0;
|
||||||
|
var hasError = false;
|
||||||
|
var selectedSupplies = $("#supplyRows :checked").map(function () {
|
||||||
|
var textField = getTextFieldFromCheckBox(this);
|
||||||
|
var inStock = getInStockFieldFromCheckBox(this);
|
||||||
|
var priceField = getPriceFieldFromCheckBox(this);
|
||||||
|
var requestedQuantity = globalParseFloat(textField.val());
|
||||||
|
var inStockQuantity = globalParseFloat(inStock.text());
|
||||||
|
var unitPrice = globalParseFloat(priceField.text());
|
||||||
|
//validation
|
||||||
|
if (isNaN(requestedQuantity) || requestedQuantity > inStockQuantity) {
|
||||||
|
textField.addClass("is-invalid");
|
||||||
|
hasError = true;
|
||||||
|
} else {
|
||||||
|
textField.removeClass("is-invalid");
|
||||||
|
}
|
||||||
|
//calculate sum.
|
||||||
|
var sum = requestedQuantity * unitPrice;
|
||||||
|
totalSum += sum;
|
||||||
|
return {
|
||||||
|
supplyId: this.value,
|
||||||
|
quantity: textField.val()
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (isNaN(totalSum) || hasError) {
|
||||||
|
$("#supplySumLabel").text(`Total: 0.00`);
|
||||||
|
} else {
|
||||||
|
totalSum = totalSum.toFixed(2);
|
||||||
|
var parsedFloat = globalFloatToString(totalSum);
|
||||||
|
$("#supplySumLabel").text(`Total: ${parsedFloat}`);
|
||||||
|
}
|
||||||
|
$("#selectSuppliesButton").attr('disabled', (hasError || totalSum == 0));
|
||||||
|
if (!hasError) {
|
||||||
|
return {
|
||||||
|
totalSum: totalSum,
|
||||||
|
selectedSupplies: selectedSupplies.toArray()
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
totalSum: 0,
|
||||||
|
selectedSupplies: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
@model TaxRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model TaxRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Tax Record" : "Edit Tax Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Tax Record") : translator.Translate(userLanguage,"Edit Tax Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddTaxRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddTaxRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,25 +17,47 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="taxRecordDate">Date</label>
|
<label for="taxRecordDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="taxRecordDate" class="form-control" placeholder="Date tax was paid" value="@Model.Date">
|
<input type="text" id="taxRecordDate" class="form-control" placeholder="@translator.Translate(userLanguage,"Date tax was paid")" value="@Model.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<label for="taxRecordDescription">Description</label>
|
<label for="taxRecordDescription">@translator.Translate(userLanguage,"Description")</label>
|
||||||
<input type="text" id="taxRecordDescription" class="form-control" placeholder="Description of tax paid(i.e. Registration)" value="@Model.Description">
|
<input type="text" id="taxRecordDescription" class="form-control" placeholder="@translator.Translate(userLanguage,"Description of tax paid(i.e. Registration)")" value="@Model.Description">
|
||||||
<label for="taxRecordCost">Cost</label>
|
<label for="taxRecordCost">@translator.Translate(userLanguage,"Cost")</label>
|
||||||
<input type="text" id="taxRecordCost" class="form-control" placeholder="Cost of tax paid" value="@(isNew? "" : Model.Cost)">
|
<input type="text" id="taxRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage,"Cost of tax paid")" value="@(isNew? "" : Model.Cost)">
|
||||||
|
<label for="taxRecordTag">@translator.Translate(userLanguage,"Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="taxRecordTag">
|
||||||
|
@foreach (string tag in Model.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="taxRecordNotes">Notes(optional)</label>
|
<label for="taxRecordNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="taxRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="taxRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" onChange="enableTaxRecurring()" role="switch" id="taxIsRecurring" checked="@Model.IsRecurring">
|
||||||
|
<label class="form-check-label" for="taxIsRecurring">@translator.Translate(userLanguage,"Is Recurring")</label>
|
||||||
|
</div>
|
||||||
|
<label for="taxRecurringMonth">@translator.Translate(userLanguage,"Month")</label>
|
||||||
|
<select class="form-select" id="taxRecurringMonth" @(Model.IsRecurring ? "" : "disabled")>
|
||||||
|
<!option value="OneMonth" @(Model.RecurringInterval == ReminderMonthInterval.OneMonth ? "selected" : "")>@translator.Translate(userLanguage,"1 Month")</!option>
|
||||||
|
<!option value="ThreeMonths" @(Model.RecurringInterval == ReminderMonthInterval.ThreeMonths || isNew ? "selected" : "")>@translator.Translate(userLanguage, "3 Months")</!option>
|
||||||
|
<!option value="SixMonths" @(Model.RecurringInterval == ReminderMonthInterval.SixMonths ? "selected" : "")>@translator.Translate(userLanguage, "6 Months")</!option>
|
||||||
|
<!option value="OneYear" @(Model.RecurringInterval == ReminderMonthInterval.OneYear ? "selected" : "")>@translator.Translate(userLanguage, "1 Year")</!option>
|
||||||
|
<!option value="TwoYears" @(Model.RecurringInterval == ReminderMonthInterval.TwoYears ? "selected" : "")>@translator.Translate(userLanguage, "2 Years")</!option>
|
||||||
|
<!option value="ThreeYears" @(Model.RecurringInterval == ReminderMonthInterval.ThreeYears ? "selected" : "")>@translator.Translate(userLanguage, "3 Years")</!option>
|
||||||
|
<!option value="FiveYears" @(Model.RecurringInterval == ReminderMonthInterval.FiveYears ? "selected" : "")>@translator.Translate(userLanguage, "5 Years")</!option>
|
||||||
|
</select>
|
||||||
@if (Model.Files.Any())
|
@if (Model.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
<label for="taxRecordFiles">Upload more documents</label>
|
<label for="taxRecordFiles">@translator.Translate(userLanguage,"Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="taxRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="taxRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -40,12 +67,13 @@
|
|||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
||||||
<label class="form-check-label" for="addReminderCheck">
|
<label class="form-check-label" for="addReminderCheck">
|
||||||
Add Reminder
|
@translator.Translate(userLanguage,"Add Reminder")
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<label for="taxRecordFiles">Upload documents(optional)</label>
|
<label for="taxRecordFiles">@translator.Translate(userLanguage,"Upload documents(optional)")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="taxRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="taxRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,16 +83,16 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteTaxRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<button type="button" class="btn btn-danger" onclick="deleteTaxRecord(@Model.Id)" style="margin-right:auto;">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddTaxRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddTaxRecordModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveTaxRecordToVehicle()">Add New Tax Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveTaxRecordToVehicle()">@translator.Translate(userLanguage,"Add New Tax Record")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveTaxRecordToVehicle(true)">Edit Tax Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveTaxRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Tax Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,33 +1,49 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var hideZero = userConfig.HideZero;
|
||||||
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
}
|
}
|
||||||
@model List<TaxRecord>
|
@model List<TaxRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Tax Records: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="count">@($"{translator.Translate(userLanguage,"# of Tax Records")}: {Model.Count()}")</span>
|
||||||
<span class="ms-2 badge bg-primary">@($"Total: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
<span class="ms-2 badge bg-primary" data-aggregate-type="sum">@($"{translator.Translate(userLanguage,"Total")}: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<span onclick="filterTable('tax-tab-pane', this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
|
}
|
||||||
|
<datalist id="tagList">
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddTaxRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Tax Record</button>
|
<button onclick="showAddTaxRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add Tax Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('TaxRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('TaxRecord')">@translator.Translate(userLanguage, "Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('TaxRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('TaxRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<button onclick="showAddTaxRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Tax Record</button>
|
<button onclick="showAddTaxRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add Tax Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,19 +58,19 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-3 col-xl-1">Date</th>
|
<th scope="col" class="col-3 col-xl-1">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-4 col-xl-6">Description</th>
|
<th scope="col" class="col-4 col-xl-6">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-2">Cost</th>
|
<th scope="col" class="col-2" onclick="toggleSort('tax-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-3">Notes</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (TaxRecord taxRecord in Model)
|
@foreach (TaxRecord taxRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditTaxRecordModal(@taxRecord.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditTaxRecordModal(@taxRecord.Id)" data-tags='@string.Join(" ", taxRecord.Tags)'>
|
||||||
<td class="col-3 col-xl-1">@taxRecord.Date.ToShortDateString()</td>
|
<td class="col-3 col-xl-1">@taxRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-4 col-xl-6">@taxRecord.Description</td>
|
<td class="col-4 col-xl-6">@taxRecord.Description</td>
|
||||||
<td class="col-2">@((hideZero && taxRecord.Cost == default) ? "---" : taxRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-record-type="cost">@((hideZero && taxRecord.Cost == default) ? "---" : taxRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(taxRecord.Notes)</td>
|
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(taxRecord.Notes)</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
@model UpgradeRecordInput
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model UpgradeRecordInput
|
||||||
@{
|
@{
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title">@(isNew ? "Add New Upgrade Record" : "Edit Upgrade Record")</h5>
|
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Upgrade Record") : translator.Translate(userLanguage,"Edit Upgrade Record"))</h5>
|
||||||
<button type="button" class="btn-close" onclick="hideAddUpgradeRecordModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddUpgradeRecordModal()" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@@ -12,27 +17,39 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
<input type="text" id="workAroundInput" style="height:0px; width:0px; display:none;">
|
||||||
<label for="upgradeRecordDate">Date</label>
|
<label for="upgradeRecordDate">@translator.Translate(userLanguage,"Date")</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" id="upgradeRecordDate" class="form-control" placeholder="Date upgrade/mods was installed" value="@Model.Date">
|
<input type="text" id="upgradeRecordDate" class="form-control" placeholder="@translator.Translate(userLanguage,"Date upgrade/mods was installed")" value="@Model.Date">
|
||||||
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
<span class="input-group-text"><i class="bi bi-calendar-event"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<label for="upgradeRecordMileage">Odometer</label>
|
<label for="upgradeRecordMileage">@translator.Translate(userLanguage,"Odometer")</label>
|
||||||
<input type="number" id="upgradeRecordMileage" class="form-control" placeholder="Odometer reading when upgraded/modded" value="@(isNew ? "" : Model.Mileage)">
|
<input type="number" id="upgradeRecordMileage" class="form-control" placeholder="@translator.Translate(userLanguage,"Odometer reading when upgraded/modded")" value="@(isNew ? "" : Model.Mileage)">
|
||||||
<label for="upgradeRecordDescription">Description</label>
|
<label for="upgradeRecordDescription">@translator.Translate(userLanguage,"Description")</label>
|
||||||
<input type="text" id="upgradeRecordDescription" class="form-control" placeholder="Description of item(s) upgraded/modded" value="@Model.Description">
|
<input type="text" id="upgradeRecordDescription" class="form-control" placeholder="@translator.Translate(userLanguage,"Description of item(s) upgraded/modded")" value="@Model.Description">
|
||||||
<label for="upgradeRecordCost">Cost</label>
|
<label for="upgradeRecordCost">@translator.Translate(userLanguage,"Cost")</label>
|
||||||
<input type="text" id="upgradeRecordCost" class="form-control" placeholder="Cost of the upgrade/mods" value="@(isNew ? "" : Model.Cost)">
|
<input type="text" id="upgradeRecordCost" class="form-control" placeholder="@translator.Translate(userLanguage,"Cost of the upgrade/mods")" value="@(isNew ? "" : Model.Cost)">
|
||||||
|
@if (isNew)
|
||||||
|
{
|
||||||
|
@await Html.PartialAsync("_SupplyStore", "UpgradeRecord")
|
||||||
|
}
|
||||||
|
<label for="upgradeRecordTag">@translator.Translate(userLanguage,"Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="upgradeRecordTag">
|
||||||
|
@foreach (string tag in Model.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-12">
|
<div class="col-md-6 col-12">
|
||||||
<label for="upgradeRecordNotes">Notes(optional)</label>
|
<label for="upgradeRecordNotes">@translator.Translate(userLanguage,"Notes(optional)")<a class="link-underline link-underline-opacity-0" onclick="showLinks(this)"><i class="bi bi-markdown ms-2"></i></a></label>
|
||||||
<textarea id="upgradeRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
<textarea id="upgradeRecordNotes" class="form-control" rows="5">@Model.Notes</textarea>
|
||||||
@if (Model.Files.Any())
|
@if (Model.Files.Any())
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
@await Html.PartialAsync("_UploadedFiles", Model.Files)
|
||||||
<label for="upgradeRecordFiles">Upload more documents</label>
|
<label for="upgradeRecordFiles">@translator.Translate(userLanguage,"Upload more documents")</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="upgradeRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="upgradeRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -42,12 +59,13 @@
|
|||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
<input class="form-check-input" type="checkbox" value="" id="addReminderCheck">
|
||||||
<label class="form-check-label" for="addReminderCheck">
|
<label class="form-check-label" for="addReminderCheck">
|
||||||
Add Reminder
|
@translator.Translate(userLanguage,"Add Reminder")
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<label for="upgradeRecordFiles">Upload documents(optional)</label>
|
<label for="upgradeRecordFiles">Upload documents(optional)</label>
|
||||||
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="upgradeRecordFiles">
|
<input onChange="uploadVehicleFilesAsync(this)" type="file" multiple accept=".png,.jpg,.jpeg,.pdf,.xls,.xlsx,.docx" class="form-control-file" id="upgradeRecordFiles">
|
||||||
|
<br /><small class="text-body-secondary">@translator.Translate(userLanguage,"Max File Size: 28.6MB")</small>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,20 +75,31 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (!isNew)
|
@if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" onclick="deleteUpgradeRecord(@Model.Id)" style="margin-right:auto;">Delete</button>
|
<div class="btn-group" style="margin-right:auto;">
|
||||||
|
<button type="button" class="btn btn-md mt-1 mb-1 btn-danger" onclick="deleteUpgradeRecord(@Model.Id)">@translator.Translate(userLanguage,"Delete")</button>
|
||||||
|
<button type="button" class="btn btn-md btn-danger btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><h6 class="dropdown-header">@translator.Translate(userLanguage,"Move To")</h6></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="moveRecord(@Model.Id, 'UpgradeRecord', 'ServiceRecord')">@translator.Translate(userLanguage,"Service Records")</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="moveRecord(@Model.Id, 'UpgradeRecord', 'RepairRecord')">@translator.Translate(userLanguage,"Repairs")</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddUpgradeRecordModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddUpgradeRecordModal()">@translator.Translate(userLanguage,"Cancel")</button>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveUpgradeRecordToVehicle()">Add New Upgrade Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveUpgradeRecordToVehicle()">@translator.Translate(userLanguage,"Add New Upgrade Record")</button>
|
||||||
}
|
}
|
||||||
else if (!isNew)
|
else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" onclick="saveUpgradeRecordToVehicle(true)">Edit Upgrade Record</button>
|
<button type="button" class="btn btn-primary" onclick="saveUpgradeRecordToVehicle(true)">@translator.Translate(userLanguage,"Edit Upgrade Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var uploadedFiles = [];
|
var uploadedFiles = [];
|
||||||
|
var selectedSupplies = [];
|
||||||
getUploadedFilesFromModel();
|
getUploadedFilesFromModel();
|
||||||
function getUploadedFilesFromModel() {
|
function getUploadedFilesFromModel() {
|
||||||
@foreach (UploadedFiles filesUploaded in Model.Files)
|
@foreach (UploadedFiles filesUploaded in Model.Files)
|
||||||
|
|||||||
@@ -1,33 +1,49 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var enableCsvImports = config.GetUserConfig(User).EnableCsvImports;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
var enableCsvImports = userConfig.EnableCsvImports;
|
||||||
|
var hideZero = userConfig.HideZero;
|
||||||
|
var recordTags = Model.SelectMany(x => x.Tags).Distinct();
|
||||||
}
|
}
|
||||||
@model List<UpgradeRecord>
|
@model List<UpgradeRecord>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex align-items-center flex-wrap">
|
<div class="d-flex align-items-center flex-wrap">
|
||||||
<span class="ms-2 badge bg-success">@($"# of Upgrade Records: {Model.Count()}")</span>
|
<span class="ms-2 badge bg-success" data-aggregate-type="count">@($"{translator.Translate(userLanguage,"# of Upgrade Records")}: {Model.Count()}")</span>
|
||||||
<span class="ms-2 badge bg-primary">@($"Total: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
<span class="ms-2 badge bg-primary" data-aggregate-type="sum">@($"{translator.Translate(userLanguage,"Total")}: {Model.Sum(x => x.Cost).ToString("C")}")</span>
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<span onclick="filterTable('upgrade-tab-pane', this)" class="user-select-none ms-2 rounded-pill badge bg-secondary tagfilter" style="cursor:pointer;">@recordTag</span>
|
||||||
|
}
|
||||||
|
<datalist id="tagList">
|
||||||
|
@foreach (string recordTag in recordTags)
|
||||||
|
{
|
||||||
|
<!option value="@recordTag"></!option>
|
||||||
|
}
|
||||||
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if (enableCsvImports)
|
@if (enableCsvImports)
|
||||||
{
|
{
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button onclick="showAddUpgradeRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Upgrade Record</button>
|
<button onclick="showAddUpgradeRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add Upgrade Record")</button>
|
||||||
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-md btn-primary btn-md mt-1 mb-1 dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
<span class="visually-hidden">Toggle Dropdown</span>
|
<span class="visually-hidden">Toggle Dropdown</span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('UpgradeRecord')">Import via CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('UpgradeRecord')">@translator.Translate(userLanguage, "Import via CSV")</a></li>
|
||||||
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('UpgradeRecord')">Export to CSV</a></li>
|
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('UpgradeRecord')">@translator.Translate(userLanguage, "Export to CSV")</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#" onclick="printTab()">@translator.Translate(userLanguage, "Print")</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<button onclick="showAddUpgradeRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>Add Upgrade Record</button>
|
<button onclick="showAddUpgradeRecordModal()" class="btn btn-primary btn-md mt-1 mb-1"><i class="bi bi-pencil-square me-2"></i>@translator.Translate(userLanguage, "Add Upgrade Record")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,21 +58,21 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead class="sticky-top">
|
<thead class="sticky-top">
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2 col-xl-1">Date</th>
|
<th scope="col" class="col-2 col-xl-1">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-2">Odometer</th>
|
<th scope="col" class="col-2">@translator.Translate(userLanguage, "Odometer")</th>
|
||||||
<th scope="col" class="col-3 col-xl-4">Description</th>
|
<th scope="col" class="col-3 col-xl-4">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-2">Cost</th>
|
<th scope="col" class="col-2" onclick="toggleSort('upgrade-tab-pane', this)" style="cursor:pointer;">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-3">Notes</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (UpgradeRecord upgradeRecord in Model)
|
@foreach (UpgradeRecord upgradeRecord in Model)
|
||||||
{
|
{
|
||||||
<tr class="d-flex" style="cursor:pointer;" onclick="showEditUpgradeRecordModal(@upgradeRecord.Id)">
|
<tr class="d-flex" style="cursor:pointer;" onclick="showEditUpgradeRecordModal(@upgradeRecord.Id)" data-tags='@string.Join(" ", upgradeRecord.Tags)'>
|
||||||
<td class="col-2 col-xl-1">@upgradeRecord.Date.ToShortDateString()</td>
|
<td class="col-2 col-xl-1">@upgradeRecord.Date.ToShortDateString()</td>
|
||||||
<td class="col-2">@upgradeRecord.Mileage</td>
|
<td class="col-2">@upgradeRecord.Mileage</td>
|
||||||
<td class="col-3 col-xl-4">@upgradeRecord.Description</td>
|
<td class="col-3 col-xl-4">@upgradeRecord.Description</td>
|
||||||
<td class="col-2">@((hideZero && upgradeRecord.Cost == default) ? "---" : upgradeRecord.Cost.ToString("C"))</td>
|
<td class="col-2" data-record-type="cost">@((hideZero && upgradeRecord.Cost == default) ? "---" : upgradeRecord.Cost.ToString("C"))</td>
|
||||||
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(upgradeRecord.Notes)</td>
|
<td class="col-3 text-truncate">@CarCareTracker.Helper.StaticHelper.TruncateStrings(upgradeRecord.Notes)</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
@model List<UploadedFiles>
|
@using CarCareTracker.Helper
|
||||||
<label>Uploaded Documents</label>
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
|
}
|
||||||
|
@model List<UploadedFiles>
|
||||||
|
<label>@translator.Translate(userLanguage, "Uploaded Documents")</label>
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
@foreach (UploadedFiles filesUploaded in Model)
|
@foreach (UploadedFiles filesUploaded in Model)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,34 +1,17 @@
|
|||||||
@using CarCareTracker.Helper
|
@using CarCareTracker.Helper
|
||||||
@inject IConfigHelper config
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
@{
|
@{
|
||||||
var hideZero = config.GetUserConfig(User).HideZero;
|
var userConfig = config.GetUserConfig(User);
|
||||||
var useMPG = config.GetUserConfig(User).UseMPG;
|
var hideZero = userConfig.HideZero;
|
||||||
var useUKMPG = config.GetUserConfig(User).UseUKMPG;
|
var userLanguage = userConfig.UserLanguage;
|
||||||
var useKwh = Model.VehicleData.IsElectric;
|
|
||||||
string fuelEconomyUnit;
|
|
||||||
if (useKwh)
|
|
||||||
{
|
|
||||||
fuelEconomyUnit = useMPG ? "mi./kWh" : "kWh/100km";
|
|
||||||
}
|
|
||||||
else if (useMPG && useUKMPG)
|
|
||||||
{
|
|
||||||
fuelEconomyUnit = "mpg";
|
|
||||||
}
|
|
||||||
else if (useUKMPG)
|
|
||||||
{
|
|
||||||
fuelEconomyUnit = "l/100mi.";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fuelEconomyUnit = useMPG ? "mpg" : "l/100km";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@model VehicleHistoryViewModel
|
@model VehicleHistoryViewModel
|
||||||
<div class="vehicleDetailTabContainer">
|
<div class="vehicleDetailTabContainer">
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<img src="/defaults/lubelogger_logo.png" />
|
<img src="/defaults/lubelogger_logo.png" />
|
||||||
<span class="display-6 ms-5">Vehicle Maintenance Report</span>
|
<span class="display-6 ms-5">@translator.Translate(userLanguage, "Vehicle Maintenance Report")</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
@@ -44,21 +27,21 @@
|
|||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
@if (Model.VehicleData.IsElectric)
|
@if (Model.VehicleData.IsElectric)
|
||||||
{
|
{
|
||||||
<span><i class="bi bi-ev-station"></i> Electric</span>
|
<span><i class="bi bi-ev-station me-2"></i>@translator.Translate(userLanguage, "Electric")</span>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<span><i class="bi bi-fuel-pump"></i> Gasoline</span>
|
<span><i class="bi bi-fuel-pump me-2"></i>@translator.Translate(userLanguage, "Gasoline")</span>
|
||||||
}
|
}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item">Last Reported Odometer Reading: @Model.Odometer</li>
|
<li class="list-group-item">@($"{translator.Translate(userLanguage, "Last Reported Odometer Reading")}: {Model.Odometer}") </li>
|
||||||
<li class="list-group-item">Average Fuel Economy: @($"{Model.MPG.ToString("F")} {fuelEconomyUnit}")</li>
|
<li class="list-group-item">@($"{translator.Translate(userLanguage, "Average Fuel Economy")}: {Model.MPG}") </li>
|
||||||
<li class="list-group-item">Total Spent(excl. fuel): @Model.TotalCost.ToString("C")</li>
|
<li class="list-group-item">@($"{translator.Translate(userLanguage, "Total Spent(excl. fuel)")}: {Model.TotalCost.ToString("C")}") </li>
|
||||||
<li class="list-group-item">Total Spent on Fuel: @Model.TotalGasCost.ToString("C")</li>
|
<li class="list-group-item">@($"{translator.Translate(userLanguage, "Total Spent on Fuel")}: {Model.TotalGasCost.ToString("C")}") </li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -68,34 +51,37 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<th scope="col" class="col-2">Type</th>
|
<th scope="col" class="col-2 servicehistorytype">@translator.Translate(userLanguage, "Type")</th>
|
||||||
<th scope="col" class="col-1">Date</th>
|
<th scope="col" class="col-1 servicehistorydate">@translator.Translate(userLanguage, "Date")</th>
|
||||||
<th scope="col" class="col-1">Odometer</th>
|
<th scope="col" class="col-1">@translator.Translate(userLanguage, "Odometer")</th>
|
||||||
<th scope="col" class="col-3">Description</th>
|
<th scope="col" class="col-3">@translator.Translate(userLanguage, "Description")</th>
|
||||||
<th scope="col" class="col-1">Cost</th>
|
<th scope="col" class="col-1">@translator.Translate(userLanguage, "Cost")</th>
|
||||||
<th scope="col" class="col-4">Notes</th>
|
<th scope="col" class="col-4">@translator.Translate(userLanguage, "Notes")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (GenericReportModel reportData in Model.VehicleHistory)
|
@foreach (GenericReportModel reportData in Model.VehicleHistory)
|
||||||
{
|
{
|
||||||
<tr class="d-flex">
|
<tr class="d-flex">
|
||||||
<td class="col-2">
|
<td class="col-2 servicehistorytype">
|
||||||
@if(reportData.DataType == ImportMode.ServiceRecord)
|
@if (reportData.DataType == ImportMode.ServiceRecord)
|
||||||
{
|
{
|
||||||
<span><i class="bi bi-card-checklist me-2"></i>Service</span>
|
<span><i class="bi bi-card-checklist me-2"></i>@translator.Translate(userLanguage, "Service")</span>
|
||||||
} else if (reportData.DataType == ImportMode.RepairRecord)
|
}
|
||||||
|
else if (reportData.DataType == ImportMode.RepairRecord)
|
||||||
{
|
{
|
||||||
<span><i class="bi bi-exclamation-octagon me-2"></i>Repair</span>
|
<span><i class="bi bi-exclamation-octagon me-2"></i>@translator.Translate(userLanguage, "Repair")</span>
|
||||||
} else if (reportData.DataType == ImportMode.UpgradeRecord)
|
}
|
||||||
|
else if (reportData.DataType == ImportMode.UpgradeRecord)
|
||||||
{
|
{
|
||||||
<span><i class="bi bi-wrench-adjustable me-2"></i>Upgrade</span>
|
<span><i class="bi bi-wrench-adjustable me-2"></i>@translator.Translate(userLanguage, "Upgrade")</span>
|
||||||
} else if (reportData.DataType == ImportMode.TaxRecord)
|
}
|
||||||
|
else if (reportData.DataType == ImportMode.TaxRecord)
|
||||||
{
|
{
|
||||||
<span><i class="bi bi-currency-dollar me-2"></i>Tax</span>
|
<span><i class="bi bi-currency-dollar me-2"></i>@translator.Translate(userLanguage, "Tax")</span>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="col-1">@reportData.Date.ToShortDateString()</td>
|
<td class="col-1 servicehistorydate">@reportData.Date.ToShortDateString()</td>
|
||||||
<td class="col-1">@(reportData.Odometer == default ? "---" : reportData.Odometer.ToString("N0"))</td>
|
<td class="col-1">@(reportData.Odometer == default ? "---" : reportData.Odometer.ToString("N0"))</td>
|
||||||
<td class="col-3">@reportData.Description</td>
|
<td class="col-3">@reportData.Description</td>
|
||||||
<td class="col-1">@((hideZero && reportData.Cost == default) ? "---" : reportData.Cost.ToString("C"))</td>
|
<td class="col-1">@((hideZero && reportData.Cost == default) ? "---" : reportData.Cost.ToString("C"))</td>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
@model Vehicle
|
@using CarCareTracker.Helper
|
||||||
|
@inject IConfigHelper config
|
||||||
|
@inject ITranslationHelper translator
|
||||||
|
@model Vehicle
|
||||||
@{
|
@{
|
||||||
|
var userConfig = config.GetUserConfig(User);
|
||||||
|
var userLanguage = userConfig.UserLanguage;
|
||||||
var isNew = Model.Id == 0;
|
var isNew = Model.Id == 0;
|
||||||
if (Model.ImageLocation == "/defaults/noimage.png")
|
if (Model.ImageLocation == "/defaults/noimage.png")
|
||||||
{
|
{
|
||||||
@@ -7,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="addVehicleModalLabel">@(isNew ? "Add New Vehicle" : "Edit Vehicle")</h5>
|
<h5 class="modal-title" id="addVehicleModalLabel">@(isNew ? translator.Translate(userLanguage, "Add New Vehicle") : translator.Translate(userLanguage, "Edit Vehicle"))</h5>
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn-close" onclick="hideAddVehicleModal()" aria-label="Close"></button>
|
<button type="button" class="btn-close" onclick="hideAddVehicleModal()" aria-label="Close"></button>
|
||||||
@@ -21,25 +26,36 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form class="form-inline">
|
<form class="form-inline">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputYear">Year</label>
|
<label for="inputYear">@translator.Translate(userLanguage, "Year")</label>
|
||||||
<input type="number" id="inputYear" class="form-control" placeholder="Year(must be after 1900)" value="@(isNew ? "" : Model.Year)">
|
<input type="number" id="inputYear" class="form-control" placeholder="@translator.Translate(userLanguage, "Year(must be after 1900)")" value="@(isNew ? "" : Model.Year)">
|
||||||
<label for="inputMake">Make</label>
|
<label for="inputMake">@translator.Translate(userLanguage, "Make")</label>
|
||||||
<input type="text" id="inputMake" class="form-control" placeholder="Make" value="@Model.Make">
|
<input type="text" id="inputMake" class="form-control" placeholder="@translator.Translate(userLanguage, "Make")" value="@Model.Make">
|
||||||
<label for="inputModel">Model</label>
|
<label for="inputModel">@translator.Translate(userLanguage, "Model")</label>
|
||||||
<input type="text" id="inputModel" class="form-control" placeholder="Model" value="@Model.Model">
|
<input type="text" id="inputModel" class="form-control" placeholder="@translator.Translate(userLanguage, "Model")" value="@Model.Model">
|
||||||
<label for="inputLicensePlate">License Plate</label>
|
<label for="inputLicensePlate">@translator.Translate(userLanguage, "License Plate")</label>
|
||||||
<input type="text" id="inputLicensePlate" class="form-control" placeholder="License Plate" value="@Model.LicensePlate">
|
<input type="text" id="inputLicensePlate" class="form-control" placeholder="@translator.Translate(userLanguage, "License Plate")" value="@Model.LicensePlate">
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" role="switch" id="inputIsElectric" checked="@Model.IsElectric">
|
<input class="form-check-input" type="checkbox" role="switch" id="inputIsElectric" checked="@Model.IsElectric">
|
||||||
<label class="form-check-label" for="inputIsElectric">Electric Vehicle</label>
|
<label class="form-check-label" for="inputIsElectric">@translator.Translate(userLanguage, "Electric Vehicle")</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" role="switch" id="inputUseHours" checked="@Model.UseHours">
|
||||||
|
<label class="form-check-label" for="inputUseHours">@translator.Translate(userLanguage, "Use Engine Hours")</label>
|
||||||
|
</div>
|
||||||
|
<label for="inputTag">@translator.Translate(userLanguage, "Tags(optional)")</label>
|
||||||
|
<select multiple class="form-select" id="inputTag">
|
||||||
|
@foreach (string tag in Model.Tags)
|
||||||
|
{
|
||||||
|
<!option value="@tag">@tag</!option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
@if (!string.IsNullOrWhiteSpace(Model.ImageLocation))
|
@if (!string.IsNullOrWhiteSpace(Model.ImageLocation))
|
||||||
{
|
{
|
||||||
<label for="inputImage">Replace picture(optional)</label>
|
<label for="inputImage">@translator.Translate(userLanguage, "Replace picture(optional)")</label>
|
||||||
<input onChange="uploadFileAsync(this)" type="file" accept=".png,.jpg,.jpeg" class="form-control-file" id="inputImage">
|
<input onChange="uploadFileAsync(this)" type="file" accept=".png,.jpg,.jpeg" class="form-control-file" id="inputImage">
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
<label for="inputImage">Upload a picture(optional)</label>
|
<label for="inputImage">@translator.Translate(userLanguage, "Upload a picture(optional)")</label>
|
||||||
<input onChange="uploadFileAsync(this)" type="file" accept=".png,.jpg,.jpeg" class="form-control-file" id="inputImage">
|
<input onChange="uploadFileAsync(this)" type="file" accept=".png,.jpg,.jpeg" class="form-control-file" id="inputImage">
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -48,12 +64,12 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@if (isNew)
|
@if (isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideAddVehicleModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideAddVehicleModal()">@translator.Translate(userLanguage, "Cancel")</button>
|
||||||
<button type="button" onclick="saveVehicle(false)" class="btn btn-primary">Add New Vehicle</button>
|
<button type="button" onclick="saveVehicle(false)" class="btn btn-primary">@translator.Translate(userLanguage, "Add New Vehicle")</button>
|
||||||
} else if (!isNew)
|
} else if (!isNew)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-secondary" onclick="hideEditVehicleModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" onclick="hideEditVehicleModal()">@translator.Translate(userLanguage, "Cancel")</button>
|
||||||
<button type="button" onclick="saveVehicle(true)" class="btn btn-primary">Save Vehicle</button>
|
<button type="button" onclick="saveVehicle(true)" class="btn btn-primary">@translator.Translate(userLanguage, "Save Vehicle")</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -12,10 +12,16 @@
|
|||||||
"UseDescending": false,
|
"UseDescending": false,
|
||||||
"EnableAuth": false,
|
"EnableAuth": false,
|
||||||
"HideZero": false,
|
"HideZero": false,
|
||||||
|
"EnableAutoReminderRefresh": false,
|
||||||
|
"EnableAutoOdometerInsert": false,
|
||||||
"UseUKMPG": false,
|
"UseUKMPG": false,
|
||||||
"UseThreeDecimalGasCost": true,
|
"UseThreeDecimalGasCost": true,
|
||||||
|
"UseMarkDownOnSavedNotes": false,
|
||||||
|
"PreferredGasMileageUnit": "",
|
||||||
|
"PreferredGasUnit": "",
|
||||||
|
"UserLanguage": "en_US",
|
||||||
"VisibleTabs": [ 0, 1, 4, 2, 3, 6, 5, 8 ],
|
"VisibleTabs": [ 0, 1, 4, 2, 3, 6, 5, 8 ],
|
||||||
"DefaultTab": 8,
|
"DefaultTab": 8,
|
||||||
"UserNameHash": "",
|
"UserNameHash": "",
|
||||||
"UserPasswordHash": ""
|
"UserPasswordHash": ""
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user