Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1a7a053f4 | ||
|
|
359f35c53f | ||
|
|
ea3423d32a | ||
|
|
6542a3bb28 | ||
|
|
35d2f1ca0b | ||
|
|
565d5701be | ||
|
|
2eb78ab73c | ||
|
|
edf4647549 | ||
|
|
e87a348b90 | ||
|
|
c15b22c71a | ||
|
|
1c9f9c7803 | ||
|
|
89bdfdefd4 | ||
|
|
2974fd783f | ||
|
|
bd22b5a497 | ||
|
|
8f6408a92b | ||
|
|
20bc28fffa | ||
|
|
3c89e75a34 | ||
|
|
5594356166 | ||
|
|
cea08a59be | ||
|
|
f16ed1a39f | ||
|
|
66032fcf55 | ||
|
|
34a9d56726 | ||
|
|
a0880ad5b6 | ||
|
|
17e8e5914e | ||
|
|
a14f298822 | ||
|
|
afe4078897 | ||
|
|
01f9b455cf | ||
|
|
c9c06f865c | ||
|
|
e2c14afc99 | ||
|
|
415d0abc83 | ||
|
|
d32fd8073d | ||
|
|
d6eab70ca6 | ||
|
|
cc82536970 | ||
|
|
094cf0d7c9 | ||
|
|
24f295c632 | ||
|
|
e9812e7e27 | ||
|
|
785ff9a089 | ||
|
|
b99c3921d7 | ||
|
|
d64777dca6 | ||
|
|
5208437ec2 | ||
|
|
654087b990 | ||
|
|
d294db34fc | ||
|
|
9f9f90fd1d | ||
|
|
051e3476a7 | ||
|
|
845dcb242a | ||
|
|
df165dae6e | ||
|
|
e389a9ac2a | ||
|
|
e2e4169787 | ||
|
|
2a8325c6ce | ||
|
|
cd2e9ebc61 | ||
|
|
1ac3a8b31b | ||
|
|
f07922763b | ||
|
|
9da21b2192 | ||
|
|
a8c85bcd7d | ||
|
|
d597a4ed30 | ||
|
|
45456280b4 | ||
|
|
1d5794e344 | ||
|
|
cd558ba744 | ||
|
|
3a2c82c789 | ||
|
|
d196536d74 | ||
|
|
630a7f2ec6 | ||
|
|
f2bc01289a | ||
|
|
a8d2b37087 | ||
|
|
7436399d90 | ||
|
|
bc3e1f0982 | ||
|
|
d429fa34bd | ||
|
|
5095cb4c61 | ||
|
|
e0df7ee80e | ||
|
|
431de8c3eb | ||
|
|
41793784ea | ||
|
|
85b5ad28bf | ||
|
|
b386012e13 | ||
|
|
df2d7288df | ||
|
|
7a6f796561 | ||
|
|
aee52d0594 | ||
|
|
f8b1de8d15 | ||
|
|
a7896340e1 | ||
|
|
f2a3bb2e9f | ||
|
|
d343619f13 | ||
|
|
adce0efa8b | ||
|
|
fc6f4bc00d | ||
|
|
a16bcf850f | ||
|
|
4ace38f8f3 | ||
|
|
63e330ffb0 | ||
|
|
fc9796081e |
17
.github/workflows/hub.yml
vendored
17
.github/workflows/hub.yml
vendored
@@ -12,25 +12,18 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
id: qemu
|
id: qemu
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
- name: Available platforms
|
- name: Available platforms
|
||||||
run: echo ${{ steps.qemu.outputs.platforms }}
|
run: echo ${{ steps.qemu.outputs.platforms }}
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
- name: Set up build cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: /tmp/.buildx-cache
|
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-buildx-
|
|
||||||
- name: Parse the git tag
|
- name: Parse the git tag
|
||||||
id: get_tag
|
id: get_tag
|
||||||
run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3)
|
run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3)
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
@@ -41,12 +34,10 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
#platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
|
||||||
#platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
push: true
|
push: true
|
||||||
# cache-from: type=local,src=/tmp/.buildx-cache
|
# cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
ARG GO_VERSION=1.16.2
|
ARG GO_VERSION=1.20.6
|
||||||
FROM golang:${GO_VERSION}-alpine AS builder
|
FROM golang:${GO_VERSION}-alpine AS builder
|
||||||
RUN apk update && apk add alpine-sdk git && rm -rf /var/cache/apk/*
|
RUN apk update && apk add alpine-sdk git && rm -rf /var/cache/apk/*
|
||||||
RUN mkdir -p /api
|
RUN mkdir -p /api
|
||||||
@@ -9,9 +9,11 @@ RUN go mod download
|
|||||||
COPY ./server .
|
COPY ./server .
|
||||||
RUN go build -o ./app ./main.go
|
RUN go build -o ./app ./main.go
|
||||||
|
|
||||||
FROM node:14 as build-stage
|
FROM node:16-alpine as build-stage
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
USER node
|
||||||
COPY ./ui/package*.json ./
|
COPY ./ui/package*.json ./
|
||||||
|
RUN apk add --no-cache autoconf automake build-base
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY ./ui .
|
COPY ./ui .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<h1 align="center" style="margin-bottom:0">Hammond</h1>
|
<h1 align="center" style="margin-bottom:0">Hammond</h1>
|
||||||
<p align="center">Current Version - 2022.07.06</p>
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
A self-hosted vehicle expense tracking system with support for multiple users.
|
A self-hosted vehicle expense tracking system with support for multiple users.
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/models"
|
||||||
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisteImportController(router *gin.RouterGroup) {
|
func RegisteImportController(router *gin.RouterGroup) {
|
||||||
router.POST("/import/fuelly", fuellyImport)
|
router.POST("/import/fuelly", fuellyImport)
|
||||||
router.POST("/import/drivvo", drivvoImport)
|
router.POST("/import/drivvo", drivvoImport)
|
||||||
|
router.POST("/import/generic", genericImport)
|
||||||
}
|
}
|
||||||
|
|
||||||
func fuellyImport(c *gin.Context) {
|
func fuellyImport(c *gin.Context) {
|
||||||
@@ -51,3 +54,21 @@ func drivvoImport(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, gin.H{})
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func genericImport(c *gin.Context) {
|
||||||
|
var json models.ImportData
|
||||||
|
if err := c.ShouldBindJSON(&json); err != nil {
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if json.VehicleId == "" {
|
||||||
|
c.JSON(http.StatusUnprocessableEntity, "Missing Vehicle ID")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
errors := service.GenericImport(json, c.MustGet("userId").(string))
|
||||||
|
if len(errors) > 0 {
|
||||||
|
c.JSON(http.StatusUnprocessableEntity, gin.H{"errors": errors})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
"github.com/dgrijalva/jwt-go/request"
|
"github.com/dgrijalva/jwt-go/request"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module github.com/akhilrex/hammond
|
module hammond
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/controllers"
|
"hammond/controllers"
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/service"
|
"hammond/service"
|
||||||
|
|
||||||
"github.com/gin-contrib/location"
|
"github.com/gin-contrib/location"
|
||||||
"github.com/gin-gonic/contrib/static"
|
"github.com/gin-gonic/contrib/static"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package models
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateAlertModel struct {
|
type CreateAlertModel struct {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "github.com/akhilrex/hammond/db"
|
import "hammond/db"
|
||||||
|
|
||||||
type LoginResponse struct {
|
type LoginResponse struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|||||||
22
server/models/import.go
Normal file
22
server/models/import.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type ImportData struct {
|
||||||
|
Data []ImportFillup `json:"data" binding:"required"`
|
||||||
|
VehicleId string `json:"vehicleId" binding:"required"`
|
||||||
|
TimeZone string `json:"timezone" binding:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ImportFillup struct {
|
||||||
|
VehicleID string `json:"vehicleId"`
|
||||||
|
FuelQuantity float32 `json:"fuelQuantity"`
|
||||||
|
PerUnitPrice float32 `json:"perUnitPrice"`
|
||||||
|
TotalAmount float32 `json:"totalAmount"`
|
||||||
|
OdoReading int `json:"odoReading"`
|
||||||
|
IsTankFull *bool `json:"isTankFull"`
|
||||||
|
HasMissedFillup *bool `json:"hasMissedFillup"`
|
||||||
|
Comments string `json:"comments"`
|
||||||
|
FillingStation string `json:"fillingStation"`
|
||||||
|
UserID string `json:"userId"`
|
||||||
|
Date string `json:"date"`
|
||||||
|
FuelSubType string `json:"fuelSubType"`
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import "github.com/akhilrex/hammond/db"
|
import "hammond/db"
|
||||||
|
|
||||||
type UpdateSettingModel struct {
|
type UpdateSettingModel struct {
|
||||||
Currency string `json:"currency" form:"currency" query:"currency"`
|
Currency string `json:"currency" form:"currency" query:"currency"`
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MileageModel struct {
|
type MileageModel struct {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package models
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
|
|
||||||
_ "github.com/go-playground/validator/v10"
|
_ "github.com/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateAlert(model models.CreateAlertModel, vehicleId, userId string) (*db.VehicleAlert, error) {
|
func CreateAlert(model models.CreateAlertModel, vehicleId, userId string) (*db.VehicleAlert, error) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DrivvoParseExpenses(content []byte, user *db.User, vehicle *db.Vehicle) ([]db.Expense, []string) {
|
func DrivvoParseExpenses(content []byte, user *db.User, vehicle *db.Vehicle) ([]db.Expense, []string) {
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/internal/sanitize"
|
"hammond/internal/sanitize"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
|
|
||||||
uuid "github.com/satori/go.uuid"
|
uuid "github.com/satori/go.uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
|
|
||||||
"github.com/leekchan/accounting"
|
"github.com/leekchan/accounting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
47
server/service/genericImportService.go
Normal file
47
server/service/genericImportService.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"hammond/db"
|
||||||
|
"hammond/models"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GenericParseRefuelings(content []models.ImportFillup, user *db.User, vehicle *db.Vehicle, timezone string) ([]db.Fillup, []string) {
|
||||||
|
var errors []string
|
||||||
|
var fillups []db.Fillup
|
||||||
|
dateLayout := "2006-01-02T15:04:05.000Z"
|
||||||
|
loc, _ := time.LoadLocation(timezone)
|
||||||
|
for _, record := range content {
|
||||||
|
date, err := time.ParseInLocation(dateLayout, record.Date, loc)
|
||||||
|
if err != nil {
|
||||||
|
date = time.Date(2000, time.December, 0, 0, 0, 0, 0, loc)
|
||||||
|
}
|
||||||
|
|
||||||
|
var missedFillup bool
|
||||||
|
if record.HasMissedFillup == nil {
|
||||||
|
missedFillup = false
|
||||||
|
} else {
|
||||||
|
missedFillup = *record.HasMissedFillup
|
||||||
|
}
|
||||||
|
|
||||||
|
fillups = append(fillups, db.Fillup{
|
||||||
|
VehicleID: vehicle.ID,
|
||||||
|
UserID: user.ID,
|
||||||
|
Date: date,
|
||||||
|
IsTankFull: record.IsTankFull,
|
||||||
|
HasMissedFillup: &missedFillup,
|
||||||
|
FuelQuantity: float32(record.FuelQuantity),
|
||||||
|
PerUnitPrice: float32(record.PerUnitPrice),
|
||||||
|
FillingStation: record.FillingStation,
|
||||||
|
OdoReading: record.OdoReading,
|
||||||
|
TotalAmount: float32(record.TotalAmount),
|
||||||
|
FuelUnit: vehicle.FuelUnit,
|
||||||
|
Currency: user.Currency,
|
||||||
|
DistanceUnit: user.DistanceUnit,
|
||||||
|
Comments: record.Comments,
|
||||||
|
Source: "Generic Import",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return fillups, errors
|
||||||
|
}
|
||||||
@@ -3,7 +3,8 @@ package service
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
|
"hammond/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WriteToDB(fillups []db.Fillup, expenses []db.Expense) []string {
|
func WriteToDB(fillups []db.Fillup, expenses []db.Expense) []string {
|
||||||
@@ -105,3 +106,27 @@ func FuellyImport(content []byte, userId string) []string {
|
|||||||
|
|
||||||
return WriteToDB(fillups, expenses)
|
return WriteToDB(fillups, expenses)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GenericImport(content models.ImportData, userId string) []string {
|
||||||
|
var errors []string
|
||||||
|
user, err := GetUserById(userId)
|
||||||
|
if err != nil {
|
||||||
|
errors = append(errors, err.Error())
|
||||||
|
return errors
|
||||||
|
}
|
||||||
|
|
||||||
|
vehicle, err := GetVehicleById(content.VehicleId)
|
||||||
|
if err != nil {
|
||||||
|
errors = append(errors, err.Error())
|
||||||
|
return errors
|
||||||
|
}
|
||||||
|
|
||||||
|
var fillups []db.Fillup
|
||||||
|
fillups, errors = GenericParseRefuelings(content.Data, user, vehicle, content.TimeZone)
|
||||||
|
|
||||||
|
if len(errors) != 0 {
|
||||||
|
return errors
|
||||||
|
}
|
||||||
|
|
||||||
|
return WriteToDB(fillups, nil)
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CanInitializeSystem() (bool, error) {
|
func CanInitializeSystem() (bool, error) {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"hammond/common"
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetMileageByVehicleId(vehicleId string, since time.Time, mileageOption string) (mileage []models.MileageModel, err error) {
|
func GetMileageByVehicleId(vehicleId string, since time.Time, mileageOption string) (mileage []models.MileageModel, err error) {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package service
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateUser(userModel *models.RegisterRequest, role db.Role) error {
|
func CreateUser(userModel *models.RegisterRequest, role db.Role) error {
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package service
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"hammond/models"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ module.exports = {
|
|||||||
'no-console': process.env.PRE_COMMIT
|
'no-console': process.env.PRE_COMMIT
|
||||||
? ['error', { allow: ['warn', 'error'] }]
|
? ['error', { allow: ['warn', 'error'] }]
|
||||||
: 'off',
|
: 'off',
|
||||||
|
'vue/multi-word-component-names': 0,
|
||||||
'import/no-relative-parent-imports': 'error',
|
'import/no-relative-parent-imports': 'error',
|
||||||
'import/order': 'error',
|
'import/order': 'error',
|
||||||
'vue/array-bracket-spacing': 'error',
|
'vue/array-bracket-spacing': 'error',
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ WORKDIR /app
|
|||||||
|
|
||||||
# Copy dependency-related files
|
# Copy dependency-related files
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
COPY yarn.lock ./
|
|
||||||
|
|
||||||
# Install project dependencies
|
# Install project dependencies
|
||||||
RUN yarn install
|
RUN npm install
|
||||||
|
|
||||||
# Expose ports 8080, which the dev server will be bound to
|
# Expose ports 8080, which the dev server will be bound to
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
30847
ui/package-lock.json
generated
30847
ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
103
ui/package.json
103
ui/package.json
@@ -6,91 +6,82 @@
|
|||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
"dev:e2e": "cross-env VUE_APP_TEST=e2e vue-cli-service test:e2e --mode=development",
|
"dev:e2e": "cross-env VUE_APP_TEST=e2e vue-cli-service test:e2e --mode=development",
|
||||||
"build": "vue-cli-service build --modern",
|
"build": "vue-cli-service build --modern",
|
||||||
"build:ci": "yarn build --report",
|
"build:ci": "npm build --report",
|
||||||
"lint:eslint": "eslint --fix",
|
"lint:eslint": "eslint --fix",
|
||||||
"lint:stylelint": "stylelint --fix",
|
"lint:stylelint": "stylelint --fix",
|
||||||
"lint:markdownlint": "markdownlint",
|
"lint:markdownlint": "markdownlint",
|
||||||
"lint:prettier": "prettier --write --loglevel warn",
|
"lint:prettier": "prettier --write --loglevel warn",
|
||||||
"lint:all:eslint": "yarn lint:eslint --ext .js,.vue .",
|
|
||||||
"lint:all:stylelint": "yarn lint:stylelint \"src/**/*.{vue,scss}\"",
|
|
||||||
"lint:all:markdownlint": "yarn lint:markdownlint \"docs/*.md\" \"*.md\"",
|
|
||||||
"lint:all:prettier": "yarn lint:prettier \"**/*.{js,json,css,scss,vue,html,md}\"",
|
|
||||||
"lint": "run-s lint:all:*",
|
"lint": "run-s lint:all:*",
|
||||||
"test:unit": "cross-env VUE_APP_TEST=unit vue-cli-service test:unit",
|
"test:unit": "cross-env VUE_APP_TEST=unit vue-cli-service test:unit",
|
||||||
"test:unit:file": "yarn test:unit --bail --findRelatedTests",
|
|
||||||
"test:unit:watch": "yarn test:unit --watch --notify --notifyMode change",
|
|
||||||
"test:unit:ci": "yarn test:unit --coverage --ci",
|
|
||||||
"test:e2e": "cross-env VUE_APP_TEST=e2e vue-cli-service test:e2e --headless",
|
"test:e2e": "cross-env VUE_APP_TEST=e2e vue-cli-service test:e2e --headless",
|
||||||
"test": "run-s test:unit test:e2e",
|
"test": "run-s test:unit test:e2e",
|
||||||
"test:ci": "run-s test:unit:ci test:e2e",
|
"test:ci": "run-s test:unit:ci test:e2e",
|
||||||
"new": "cross-env HYGEN_TMPLS=generators hygen new",
|
"new": "cross-env HYGEN_TMPLS=generators hygen new",
|
||||||
"docs": "vuepress dev",
|
"docs": "vuepress dev"
|
||||||
"docker": "docker-compose exec dev yarn"
|
|
||||||
},
|
},
|
||||||
"gitHooks": {
|
"gitHooks": {
|
||||||
"pre-commit": "cross-env PRE_COMMIT=true lint-staged"
|
"pre-commit": "cross-env PRE_COMMIT=true lint-staged"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "^1.2.27",
|
"@fortawesome/fontawesome-svg-core": "^6.3.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.12.1",
|
"@fortawesome/free-solid-svg-icons": "^6.3.0",
|
||||||
"@fortawesome/vue-fontawesome": "0.1.9",
|
"@fortawesome/vue-fontawesome": "^2.0.10",
|
||||||
"axios": "^0.27.2",
|
"axios": "^1.3.2",
|
||||||
"buefy": "^0.9.7",
|
"buefy": "^0.9.22",
|
||||||
"chart.js": "^2.9.4",
|
"chart.js": "^2.9.4",
|
||||||
"core-js": "3.6.4",
|
"core-js": "^3.27.2",
|
||||||
"currency-formatter": "^1.5.7",
|
"currency-formatter": "^1.5.9",
|
||||||
"date-fns": "2.10.0",
|
"date-fns": "^2.29.3",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"node-gyp": "^9.3.1",
|
"node-gyp": "^9.3.1",
|
||||||
"normalize.css": "8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"vue": "2.6.11",
|
"papaparse": "^5.4.1",
|
||||||
|
"vue": "^2.6.11",
|
||||||
"vue-chartjs": "^3.5.1",
|
"vue-chartjs": "^3.5.1",
|
||||||
"vue-i18n": "^8.28.2",
|
"vue-i18n": "^8.28.2",
|
||||||
"vue-meta": "2.3.3",
|
"vue-meta": "^2.4.0",
|
||||||
"vue-router": "3.1.6",
|
"vue-router": "^3.6.5",
|
||||||
"vuex": "3.1.2"
|
"vuex": "^3.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "4.2.x",
|
"@vue/cli-plugin-babel": "^4.5.19",
|
||||||
"@vue/cli-plugin-eslint": "4.2.x",
|
"@vue/cli-plugin-eslint": "^4.5.19",
|
||||||
"@vue/cli-plugin-unit-jest": "4.2.x",
|
"@vue/cli-plugin-unit-jest": "^4.5.19",
|
||||||
"@vue/cli-service": "4.2.x",
|
"@vue/cli-service": "^4.5.19",
|
||||||
"@vue/eslint-config-prettier": "6.0.x",
|
"@vue/eslint-config-prettier": "6.0.x",
|
||||||
"@vue/eslint-config-standard": "5.1.x",
|
"@vue/eslint-config-standard": "^5.1.1",
|
||||||
"@vue/test-utils": "1.0.0-beta.31",
|
"@vue/test-utils": "^1.3.4",
|
||||||
"babel-core": "7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
"babel-eslint": "10.1.x",
|
"babel-eslint": "10.1.x",
|
||||||
"cross-env": "7.0.x",
|
"cross-env": "^7.0.1",
|
||||||
"eslint": "6.8.x",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-import": "2.20.x",
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-node": "11.0.x",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-promise": "4.2.x",
|
"eslint-plugin-promise": "^4.3.1",
|
||||||
"eslint-plugin-standard": "4.0.x",
|
"eslint-plugin-standard": "^5.0.0",
|
||||||
"eslint-plugin-vue": "6.2.x",
|
"eslint-plugin-vue": "^9.9.0",
|
||||||
"express": "4.17.x",
|
"express": "^4.18.2",
|
||||||
"hygen": "4.0.x",
|
"hygen": "^6.2.11",
|
||||||
"imagemin-lint-staged": "0.4.x",
|
"imagemin-lint-staged": "^0.5.1",
|
||||||
"lint-staged": "10.0.x",
|
"lint-staged": "^13.1.1",
|
||||||
"markdownlint-cli": "^0.31.1",
|
"markdownlint-cli": "^0.33.0",
|
||||||
"npm-run-all": "4.1.x",
|
"npm-run-all": "^4.1.1",
|
||||||
"sass": "1.26.x",
|
"sass": "^1.58.0",
|
||||||
"sass-loader": "8.0.x",
|
"sass-loader": "^8.0.2",
|
||||||
"stylelint": "13.2.x",
|
"stylelint": "^14.16.1",
|
||||||
"stylelint-config-css-modules": "2.2.x",
|
"stylelint-config-css-modules": "^4.1.0",
|
||||||
"stylelint-config-prettier": "8.0.x",
|
"stylelint-config-prettier": "^9.0.4",
|
||||||
"stylelint-config-recess-order": "2.0.x",
|
"stylelint-config-standard": "^29.0.0",
|
||||||
"stylelint-config-standard": "20.0.x",
|
"stylelint-scss": "^4.3.0",
|
||||||
"stylelint-scss": "3.14.x",
|
"vue-template-compiler": "^2.6.11",
|
||||||
"vue-template-compiler": "2.6.11",
|
"vuepress": "^1.9.8"
|
||||||
"vuepress": "1.3.x"
|
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@vue/cli-plugin-unit-jest/jest": "25.1.x",
|
"@vue/cli-plugin-unit-jest/jest": "25.1.x",
|
||||||
"@vue/cli-plugin-unit-jest/babel-jest": "25.1.x"
|
"@vue/cli-plugin-unit-jest/babel-jest": "25.1.x"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.13.3",
|
"node": ">=16.0.0"
|
||||||
"yarn": ">=1.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
<link rel="shortcut icon" href="<%= webpackConfig.output.publicPath %>hammond.png" />
|
<link rel="shortcut icon" href="<%= webpackConfig.output.publicPath %>hammond.png" />
|
||||||
<link rel="apple-touch-icon" href="<%= webpackConfig.output.publicPath %>touch-icon.png" />
|
<link rel="apple-touch-icon" href="<%= webpackConfig.output.publicPath %>touch-icon.png" />
|
||||||
<title><%= webpackConfig.name %></title>
|
<title><%= webpackConfig.name %></title>
|
||||||
|
<!-- Temporary until fontawesome 6 is supported in buefy (see issue: https://github.com/FortAwesome/Font-Awesome/issues/18663) -->
|
||||||
|
<style>
|
||||||
|
.icon svg { width: 1em; height: 1em; max-width: 80%; max-height: 80%; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- This is where our app will be mounted. -->
|
<!-- This is where our app will be mounted. -->
|
||||||
|
|||||||
@@ -95,11 +95,10 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<b-button
|
<b-button
|
||||||
tag="input"
|
tag="button"
|
||||||
native-type="submit"
|
native-type="submit"
|
||||||
:disabled="tryingToCreate"
|
:disabled="tryingToCreate"
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
:value="this.$t('uploadfile')"
|
|
||||||
class="control"
|
class="control"
|
||||||
>
|
>
|
||||||
{{ $t('uploadfile') }}
|
{{ $t('uploadfile') }}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default {
|
|||||||
<b-select
|
<b-select
|
||||||
v-if="unprocessedQuickEntries.length"
|
v-if="unprocessedQuickEntries.length"
|
||||||
v-model="quickEntry"
|
v-model="quickEntry"
|
||||||
:placeholder="this.$t('referquickentry')"
|
:placeholder="$t('referquickentry')"
|
||||||
expanded
|
expanded
|
||||||
@input="showQuickEntry($event)"
|
@input="showQuickEntry($event)"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export default {
|
|||||||
<div class="box" style="max-width:600px">
|
<div class="box" style="max-width:600px">
|
||||||
<h1 class="subtitle">{{ $t('share') }} {{ vehicle.nickname }}</h1>
|
<h1 class="subtitle">{{ $t('share') }} {{ vehicle.nickname }}</h1>
|
||||||
<section>
|
<section>
|
||||||
<div class="columns is-mobile" v-for="model in models" :key="model.id">
|
<div v-for="model in models" :key="model.id" class="columns is-mobile">
|
||||||
<div class="column is-one-third">
|
<div class="column is-one-third">
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-switch v-model="model.isShared" :disabled="model.isOwner" @input="changeShareStatus(model)">
|
<b-switch v-model="model.isShared" :disabled="model.isOwner" @input="changeShareStatus(model)">
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ $size-input-padding-vertical: 0.75em;
|
|||||||
$size-input-padding-horizontal: 1em;
|
$size-input-padding-horizontal: 1em;
|
||||||
$size-input-padding: $size-input-padding-vertical $size-input-padding-horizontal;
|
$size-input-padding: $size-input-padding-vertical $size-input-padding-horizontal;
|
||||||
$size-input-border: 1px;
|
$size-input-border: 1px;
|
||||||
$size-input-border-radius: (1em + $size-input-padding-vertical * 2) / 10;
|
$size-input-border-radius: calc((1em + $size-input-padding-vertical * 2) / 10);
|
||||||
|
|
||||||
// BUTTONS
|
// BUTTONS
|
||||||
$size-button-padding-vertical: $size-grid-padding / 2;
|
$size-button-padding-vertical: calc($size-grid-padding / 2);
|
||||||
$size-button-padding-horizontal: $size-grid-padding / 1.5;
|
$size-button-padding-horizontal: calc($size-grid-padding / 1.5);
|
||||||
$size-button-padding: $size-button-padding-vertical
|
$size-button-padding: $size-button-padding-vertical
|
||||||
$size-button-padding-horizontal;
|
$size-button-padding-horizontal;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
$max-screen,
|
$max-screen,
|
||||||
$max-value
|
$max-value
|
||||||
) {
|
) {
|
||||||
$a: ($max-value - $min-value) / ($max-screen - $min-screen);
|
$a: calc(($max-value - $min-value) / ($max-screen - $min-screen));
|
||||||
$b: $min-value - $a * $min-screen;
|
$b: $min-value - $a * $min-screen;
|
||||||
|
|
||||||
$sign: '+';
|
$sign: '+';
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
"dontimportagain": "Achte darauf, dass du die Datei nicht erneut importierst, da dies zu mehrfachen Einträgen führen würde.",
|
"dontimportagain": "Achte darauf, dass du die Datei nicht erneut importierst, da dies zu mehrfachen Einträgen führen würde.",
|
||||||
"checkpointsimportcsv": "Wenn du alle diese Punkte überprüft hast kannst du unten die CSV importieren.",
|
"checkpointsimportcsv": "Wenn du alle diese Punkte überprüft hast kannst du unten die CSV importieren.",
|
||||||
"importhintunits": "Vergewissere dich ebenfalls, dass die <u>Kraftstoffeinheit</u> und der <u>Kraftstofftyp</u> im Fahrzeug richtig eingestellt sind.",
|
"importhintunits": "Vergewissere dich ebenfalls, dass die <u>Kraftstoffeinheit</u> und der <u>Kraftstofftyp</u> im Fahrzeug richtig eingestellt sind.",
|
||||||
"importhintcurrdist": "Stelle sicher, dass die <u>Währung</u> und die <u>Entfernungseinheit</u> in Hammond korrekt eingestellt sind. Der Import erkennt die Währung nicht automatisch aus der CSV-Datei, sondern verwendet die für den Benutzer eingestellte Währung.",
|
"importhintcurrdist": "Stelle sicher, dass die <u>Währung</u> und die <u>Entfernungseinheit</u> in Hammond korrekt eingestellt sind. Der Import erkennt die Währung nicht automatisch aus der datei, sondern verwendet die für den Benutzer eingestellte Währung.",
|
||||||
"importhintnickname": "Vergewissere dich, dass der Fahrzeugname in Hammond genau mit dem Namen in der Fuelly-CSV-Datei übereinstimmt, sonst funktioniert der Import nicht.",
|
"importhintnickname": "Vergewissere dich, dass der Fahrzeugname in Hammond genau mit dem Namen in der Fuelly-CSV-Datei übereinstimmt, sonst funktioniert der Import nicht.",
|
||||||
"importhintvehiclecreated": "Vergewissere dich, dass du die Fahrzeuge bereits in Hammond erstellt hast.",
|
"importhintvehiclecreated": "Vergewissere dich, dass du die Fahrzeuge bereits in Hammond erstellt hast.",
|
||||||
"importhintcreatecsv": "Exportiere deine Daten aus {name} im CSV-Format. Die Schritte dazu findest du",
|
"importhintcreatecsv": "Exportiere deine Daten aus {name} im CSV-Format. Die Schritte dazu findest du",
|
||||||
|
|||||||
@@ -43,15 +43,15 @@
|
|||||||
"createnow": "Create Now",
|
"createnow": "Create Now",
|
||||||
"yourvehicles": "Your Vehicles",
|
"yourvehicles": "Your Vehicles",
|
||||||
"menu": {
|
"menu": {
|
||||||
"quickentries": "Quick Entries",
|
"quickentries": "Quick Entries",
|
||||||
"logout": "Log out",
|
"logout": "Log out",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"admin": "Admin",
|
"admin": "Admin",
|
||||||
"sitesettings": "Site Settings",
|
"sitesettings": "Site Settings",
|
||||||
"users": "Users",
|
"users": "Users",
|
||||||
"login": "Log in"
|
"login": "Log in"
|
||||||
},
|
},
|
||||||
"enterusername": "Enter your username",
|
"enterusername": "Enter your username",
|
||||||
"enterpassword": "Enter your password",
|
"enterpassword": "Enter your password",
|
||||||
@@ -81,34 +81,34 @@
|
|||||||
"quantity": "Quantity",
|
"quantity": "Quantity",
|
||||||
"gasstation": "Gas Station",
|
"gasstation": "Gas Station",
|
||||||
"fuel": {
|
"fuel": {
|
||||||
"petrol": "Petrol",
|
"petrol": "Petrol",
|
||||||
"diesel": "Diesel",
|
"diesel": "Diesel",
|
||||||
"cng": "CNG",
|
"cng": "CNG",
|
||||||
"lpg": "LPG",
|
"lpg": "LPG",
|
||||||
"electric": "Electric",
|
"electric": "Electric",
|
||||||
"ethanol": "Ethanol"
|
"ethanol": "Ethanol"
|
||||||
},
|
},
|
||||||
"unit": {
|
"unit": {
|
||||||
"long": {
|
"long": {
|
||||||
"litre": "Litre",
|
"litre": "Litre",
|
||||||
"gallon": "Gallon",
|
"gallon": "Gallon",
|
||||||
"kilowatthour": "Kilowatt Hour",
|
"kilowatthour": "Kilowatt Hour",
|
||||||
"kilogram": "Kilogram",
|
"kilogram": "Kilogram",
|
||||||
"usgallon": "US Gallon",
|
"usgallon": "US Gallon",
|
||||||
"minutes": "Minutes",
|
"minutes": "Minutes",
|
||||||
"kilometers": "Kilometers",
|
"kilometers": "Kilometers",
|
||||||
"miles": "Miles"
|
"miles": "Miles"
|
||||||
},
|
},
|
||||||
"short": {
|
"short": {
|
||||||
"litre": "Lt",
|
"litre": "Lt",
|
||||||
"gallon": "Gal",
|
"gallon": "Gal",
|
||||||
"kilowatthour": "KwH",
|
"kilowatthour": "KwH",
|
||||||
"kilogram": "Kg",
|
"kilogram": "Kg",
|
||||||
"usgallon": "US Gal",
|
"usgallon": "US Gal",
|
||||||
"minutes": "Mins",
|
"minutes": "Mins",
|
||||||
"kilometers": "Km",
|
"kilometers": "Km",
|
||||||
"miles": "Mi"
|
"miles": "Mi"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"avgfillupqty": "Avg Fillup Qty",
|
"avgfillupqty": "Avg Fillup Qty",
|
||||||
"avgfillupexpense": "Avg Fillup Expense",
|
"avgfillupexpense": "Avg Fillup Expense",
|
||||||
@@ -117,7 +117,9 @@
|
|||||||
"price": "Price",
|
"price": "Price",
|
||||||
"total": "Total",
|
"total": "Total",
|
||||||
"fulltank": "Tank Full",
|
"fulltank": "Tank Full",
|
||||||
|
"partialfillup": "Partial Fillup",
|
||||||
"getafulltank": "Did you get a full tank?",
|
"getafulltank": "Did you get a full tank?",
|
||||||
|
"tankpartialfull": "Which do you track?",
|
||||||
"by": "By",
|
"by": "By",
|
||||||
"expenses": "Expenses",
|
"expenses": "Expenses",
|
||||||
"expensetype": "Expense Type",
|
"expensetype": "Expense Type",
|
||||||
@@ -130,6 +132,8 @@
|
|||||||
"importdatadesc": "Choose from the following options to import data into Hammond",
|
"importdatadesc": "Choose from the following options to import data into Hammond",
|
||||||
"import": "Import",
|
"import": "Import",
|
||||||
"importcsv": "If you have been using {name} to store your vehicle data, export the CSV file from {name} and click here to import.",
|
"importcsv": "If you have been using {name} to store your vehicle data, export the CSV file from {name} and click here to import.",
|
||||||
|
"importgeneric": "Generic Fillups Import",
|
||||||
|
"importgenericdesc": "Fillups CSV import.",
|
||||||
"choosecsv": "Choose CSV",
|
"choosecsv": "Choose CSV",
|
||||||
"choosephoto": "Choose Photo",
|
"choosephoto": "Choose Photo",
|
||||||
"importsuccessfull": "Data Imported Successfully",
|
"importsuccessfull": "Data Imported Successfully",
|
||||||
@@ -137,13 +141,15 @@
|
|||||||
"importfrom": "Import from {0}",
|
"importfrom": "Import from {0}",
|
||||||
"stepstoimport": "Steps to import data from {name}",
|
"stepstoimport": "Steps to import data from {name}",
|
||||||
"choosecsvimport": "Choose the {name} CSV and press the import button.",
|
"choosecsvimport": "Choose the {name} CSV and press the import button.",
|
||||||
|
"choosedatafile": "Choose the CSV file and then press the import button.",
|
||||||
"dontimportagain": "Make sure that you do not import the file again because that will create repeat entries.",
|
"dontimportagain": "Make sure that you do not import the file again because that will create repeat entries.",
|
||||||
"checkpointsimportcsv": "Once you have checked all these points, just import the CSV below.",
|
"checkpointsimportcsv": "Once you have checked all these points, just import the CSV below.",
|
||||||
"importhintunits": "Similiarly, make sure that the <u>Fuel Unit</u> and <u>Fuel Type</u> are correctly set in the Vehicle.",
|
"importhintunits": "Similiarly, make sure that the <u>Fuel Unit</u> and <u>Fuel Type</u> are correctly set in the Vehicle.",
|
||||||
"importhintcurrdist": "Make sure that the <u>Currency</u> and <u>Distance Unit</u> are set correctly in Hammond. Import will not autodetect Currency from the CSV but use the one set for the user.",
|
"importhintcurrdist": "Make sure that the <u>Currency</u> and <u>Distance Unit</u> are set correctly in Hammond. Import will not autodetect Currency from the file but use the one set for the user.",
|
||||||
"importhintnickname": "Make sure that the Vehicle nickname in Hammond is exactly the same as the name on Fuelly CSV or the import will not work.",
|
"importhintnickname": "Make sure that the Vehicle nickname in Hammond is exactly the same as the name on Fuelly CSV or the import will not work.",
|
||||||
"importhintvehiclecreated": "Make sure that you have already created the vehicles in Hammond platform.",
|
"importhintvehiclecreated": "Make sure that you have already created the vehicles in Hammond platform.",
|
||||||
"importhintcreatecsv": "Export your data from {name} in the CSV format. Steps to do that can be found",
|
"importhintcreatecsv": "Export your data from {name} in the CSV format. Steps to do that can be found",
|
||||||
|
"importgenerichintdata": "Data must be in CSV format.",
|
||||||
"here": "here",
|
"here": "here",
|
||||||
"unprocessedquickentries": "You have one quick entry to be processed. | You have {0} quick entries pending to be processed.",
|
"unprocessedquickentries": "You have one quick entry to be processed. | You have {0} quick entries pending to be processed.",
|
||||||
"show": "Show",
|
"show": "Show",
|
||||||
@@ -178,6 +184,7 @@
|
|||||||
"fillingstation": "Filling Station Name",
|
"fillingstation": "Filling Station Name",
|
||||||
"comments": "Comments",
|
"comments": "Comments",
|
||||||
"missfillupbefore": "Did you miss the fillup entry before this one?",
|
"missfillupbefore": "Did you miss the fillup entry before this one?",
|
||||||
|
"missedfillup": "Missed Fillup",
|
||||||
"fillupdate": "Fillup Date",
|
"fillupdate": "Fillup Date",
|
||||||
"fillupsavedsuccessfully": "Fillup Saved Successfully",
|
"fillupsavedsuccessfully": "Fillup Saved Successfully",
|
||||||
"expensesavedsuccessfully": "Expense Saved Successfully",
|
"expensesavedsuccessfully": "Expense Saved Successfully",
|
||||||
@@ -195,25 +202,25 @@
|
|||||||
"testconn": "Test Connection",
|
"testconn": "Test Connection",
|
||||||
"migrate": "Migrate",
|
"migrate": "Migrate",
|
||||||
"init": {
|
"init": {
|
||||||
"migrateclarkson": "Migrate from Clarkson",
|
"migrateclarkson": "Migrate from Clarkson",
|
||||||
"migrateclarksondesc": "If you have an existing Clarkson deployment and you want to migrate your data from that, press the following button.",
|
"migrateclarksondesc": "If you have an existing Clarkson deployment and you want to migrate your data from that, press the following button.",
|
||||||
"freshinstall": "Fresh Install",
|
"freshinstall": "Fresh Install",
|
||||||
"freshinstalldesc": "If you want a fresh install of Hammond, press the following button.",
|
"freshinstalldesc": "If you want a fresh install of Hammond, press the following button.",
|
||||||
"clarkson": {
|
"clarkson": {
|
||||||
"desc": "<p>You need to make sure that this deployment of Hammond can access the MySQL database used by Clarkson.</p><p>If that is not directly possible, you can make a copy of that database somewhere accessible from this instance.</p><p>Once that is done, enter the connection string to the MySQL instance in the following format.</p><p>All the users imported from Clarkson will have their username as their email in Clarkson database and pasword set to<span class='' style='font-weight:bold'>hammond</span></p><code>user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local</code><br/><br/>",
|
"desc": "<p>You need to make sure that this deployment of Hammond can access the MySQL database used by Clarkson.</p><p>If that is not directly possible, you can make a copy of that database somewhere accessible from this instance.</p><p>Once that is done, enter the connection string to the MySQL instance in the following format.</p><p>All the users imported from Clarkson will have their username as their email in Clarkson database and pasword set to<span class='' style='font-weight:bold'>hammond</span></p><code>user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local</code><br/><br/>",
|
||||||
"success": "We have successfully migrated the data from Clarkson. You will be redirected to the login screen shortly where you can login using your existing email and password : hammond"
|
"success": "We have successfully migrated the data from Clarkson. You will be redirected to the login screen shortly where you can login using your existing email and password : hammond"
|
||||||
},
|
},
|
||||||
"fresh": {
|
"fresh": {
|
||||||
"setupadminuser": "Setup Admin Users",
|
"setupadminuser": "Setup Admin Users",
|
||||||
"yourpassword": "Your Password",
|
"yourpassword": "Your Password",
|
||||||
"youremail": "Your Email",
|
"youremail": "Your Email",
|
||||||
"yourname": "Your Name",
|
"yourname": "Your Name",
|
||||||
"success": "You have been registered successfully. You will be redirected to the login screen shortly where you can login and start using the system."
|
"success": "You have been registered successfully. You will be redirected to the login screen shortly where you can login and start using the system."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"roles": {
|
"roles": {
|
||||||
"ADMIN": "ADMIN",
|
"ADMIN": "ADMIN",
|
||||||
"USER": "USER"
|
"USER": "USER"
|
||||||
},
|
},
|
||||||
"profile": "Profile",
|
"profile": "Profile",
|
||||||
"processedon": "Processed on",
|
"processedon": "Processed on",
|
||||||
@@ -221,4 +228,4 @@
|
|||||||
"disable": "Disable",
|
"disable": "Disable",
|
||||||
"confirm": "Go Ahead",
|
"confirm": "Go Ahead",
|
||||||
"labelforfile": "Label for this file"
|
"labelforfile": "Label for this file"
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
faCheck,
|
faCheck,
|
||||||
faTimes,
|
faTimes,
|
||||||
faArrowUp,
|
faArrowUp,
|
||||||
|
faArrowRotateLeft,
|
||||||
faAngleLeft,
|
faAngleLeft,
|
||||||
faAngleRight,
|
faAngleRight,
|
||||||
faCalendar,
|
faCalendar,
|
||||||
@@ -34,11 +35,11 @@ import '@components/_globals'
|
|||||||
import 'buefy/dist/buefy.css'
|
import 'buefy/dist/buefy.css'
|
||||||
import 'nprogress/nprogress.css'
|
import 'nprogress/nprogress.css'
|
||||||
|
|
||||||
Vue.component('vue-fontawesome', FontAwesomeIcon)
|
|
||||||
library.add(
|
library.add(
|
||||||
faCheck,
|
faCheck,
|
||||||
faTimes,
|
faTimes,
|
||||||
faArrowUp,
|
faArrowUp,
|
||||||
|
faArrowRotateLeft,
|
||||||
faAngleLeft,
|
faAngleLeft,
|
||||||
faAngleRight,
|
faAngleRight,
|
||||||
faCalendar,
|
faCalendar,
|
||||||
@@ -54,7 +55,8 @@ library.add(
|
|||||||
faShare,
|
faShare,
|
||||||
faUserFriends,
|
faUserFriends,
|
||||||
faTimesCircle
|
faTimesCircle
|
||||||
)
|
);
|
||||||
|
Vue.component('VueFontawesome', FontAwesomeIcon)
|
||||||
|
|
||||||
Vue.use(Buefy, {
|
Vue.use(Buefy, {
|
||||||
defaultIconComponent: 'vue-fontawesome',
|
defaultIconComponent: 'vue-fontawesome',
|
||||||
|
|||||||
@@ -419,6 +419,15 @@ export default [
|
|||||||
},
|
},
|
||||||
props: (route) => ({ user: store.state.auth.currentUser || {} }),
|
props: (route) => ({ user: store.state.auth.currentUser || {} }),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/import/generic',
|
||||||
|
name: 'import-generic',
|
||||||
|
component: () => lazyLoadView(import('@views/import-generic.vue')),
|
||||||
|
meta: {
|
||||||
|
authRequired: true,
|
||||||
|
},
|
||||||
|
props: (route) => ({ user: store.state.auth.currentUser || {} }),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/logout',
|
path: '/logout',
|
||||||
name: 'logout',
|
name: 'logout',
|
||||||
|
|||||||
@@ -162,41 +162,41 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form @submit.prevent="createExpense">
|
<form @submit.prevent="createExpense">
|
||||||
<b-field :label="this.$t('selectvehicle')">
|
<b-field :label="$t('selectvehicle')">
|
||||||
<b-select v-model="selectedVehicle" :placeholder="this.$t('vehicle')" required expanded :disabled="expense.id">
|
<b-select v-model="selectedVehicle" :placeholder="$t('vehicle')" required expanded :disabled="expense.id">
|
||||||
<option v-for="option in myVehicles" :key="option.id" :value="option">
|
<option v-for="option in myVehicles" :key="option.id" :value="option">
|
||||||
{{ option.nickname }}
|
{{ option.nickname }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('expenseby')">
|
<b-field :label="$t('expenseby')">
|
||||||
<b-select v-model="expenseModel.userId" :placeholder="this.$t('user')" required expanded :disabled="expense.id">
|
<b-select v-model="expenseModel.userId" :placeholder="$t('user')" required expanded :disabled="expense.id">
|
||||||
<option v-for="option in users" :key="option.userId" :value="option.userId">
|
<option v-for="option in users" :key="option.userId" :value="option.userId">
|
||||||
{{ option.name }}
|
{{ option.name }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('expensedate')">
|
<b-field :label="$t('expensedate')">
|
||||||
<b-datepicker
|
<b-datepicker
|
||||||
v-model="expenseModel.date"
|
v-model="expenseModel.date"
|
||||||
:date-formatter="formatDate"
|
:date-formatter="formatDate"
|
||||||
:placeholder="this.$t('clicktoselect')"
|
:placeholder="$t('clicktoselect')"
|
||||||
icon="calendar"
|
icon="calendar"
|
||||||
:max-date="new Date()"
|
:max-date="new Date()"
|
||||||
>
|
>
|
||||||
</b-datepicker>
|
</b-datepicker>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('expensetype') + `*`">
|
<b-field :label="$t('expensetype') + `*`">
|
||||||
<b-input v-model="expenseModel.expenseType" expanded required></b-input>
|
<b-input v-model="expenseModel.expenseType" expanded required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field :label="this.$t('totalamountpaid')">
|
<b-field :label="$t('totalamountpaid')">
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<span class="button is-static">{{ me.currency }}</span>
|
<span class="button is-static">{{ me.currency }}</span>
|
||||||
</p>
|
</p>
|
||||||
<b-input v-model.number="expenseModel.amount" type="number" min="0" expanded step=".001" required></b-input>
|
<b-input v-model.number="expenseModel.amount" type="number" min="0" expanded step=".001" required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('odometer')">
|
<b-field :label="$t('odometer')">
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<span class="button is-static">{{ $t('unit.short.' + me.distanceUnitDetail.key) }}</span>
|
<span class="button is-static">{{ $t('unit.short.' + me.distanceUnitDetail.key) }}</span>
|
||||||
</p>
|
</p>
|
||||||
@@ -207,7 +207,7 @@ export default {
|
|||||||
<b-switch v-model="showMore">{{ $t('fillmoredetails') }}</b-switch>
|
<b-switch v-model="showMore">{{ $t('fillmoredetails') }}</b-switch>
|
||||||
</b-field>
|
</b-field>
|
||||||
<fieldset v-if="showMore">
|
<fieldset v-if="showMore">
|
||||||
<b-field :label="this.$t('details')">
|
<b-field :label="$t('details')">
|
||||||
<b-input v-model="expenseModel.comments" type="textarea" expanded></b-input>
|
<b-input v-model="expenseModel.comments" type="textarea" expanded></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -216,7 +216,7 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
<br />
|
<br />
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-button tag="input" native-type="submit" :value="this.$t('save')" :disabled="tryingToCreate" type="is-primary" label="Create Expense" expanded> </b-button>
|
<b-button tag="button" native-type="submit" :value="$t('save')" :disabled="tryingToCreate" type="is-primary" label="Create Expense" expanded/>
|
||||||
</b-field>
|
</b-field>
|
||||||
</form>
|
</form>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ export default {
|
|||||||
this.fetchVehicleFuelSubTypes()
|
this.fetchVehicleFuelSubTypes()
|
||||||
if (!this.fillup.id) {
|
if (!this.fillup.id) {
|
||||||
this.fillupModel = this.getEmptyFillup()
|
this.fillupModel = this.getEmptyFillup()
|
||||||
|
if (this.vehicle.fillups.length > 0) {
|
||||||
|
this.fillupModel.odoReading = this.vehicle.fillups[0].odoReading
|
||||||
|
}
|
||||||
this.fillupModel.userId = this.me.id
|
this.fillupModel.userId = this.me.id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -193,21 +196,21 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form class="" @submit.prevent="createFillup">
|
<form class="" @submit.prevent="createFillup">
|
||||||
<b-field :label="this.$t('selectvehicle')">
|
<b-field :label="$t('selectvehicle')">
|
||||||
<b-select v-model="selectedVehicle" :placeholder="this.$t('vehicle')" required expanded :disabled="fillup.id">
|
<b-select v-model="selectedVehicle" :placeholder="$t('vehicle')" required expanded :disabled="fillup.id">
|
||||||
<option v-for="option in myVehicles" :key="option.id" :value="option">
|
<option v-for="option in myVehicles" :key="option.id" :value="option">
|
||||||
{{ option.nickname }}
|
{{ option.nickname }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('expenseby')">
|
<b-field :label="$t('expenseby')">
|
||||||
<b-select v-model="fillupModel.userId" :placeholder="this.$t('user')" required expanded :disabled="fillup.id">
|
<b-select v-model="fillupModel.userId" :placeholder="$t('user')" required expanded :disabled="fillup.id">
|
||||||
<option v-for="option in users" :key="option.userId" :value="option.userId">
|
<option v-for="option in users" :key="option.userId" :value="option.userId">
|
||||||
{{ option.name }}
|
{{ option.name }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('fillupdate')">
|
<b-field :label="$t('fillupdate')">
|
||||||
<b-datepicker
|
<b-datepicker
|
||||||
v-model="fillupModel.date"
|
v-model="fillupModel.date"
|
||||||
:date-formatter="formatDate"
|
:date-formatter="formatDate"
|
||||||
@@ -218,7 +221,7 @@ export default {
|
|||||||
>
|
>
|
||||||
</b-datepicker>
|
</b-datepicker>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('fuelsubtype')">
|
<b-field :label="$t('fuelsubtype')">
|
||||||
<b-autocomplete
|
<b-autocomplete
|
||||||
v-model="fillupModel.fuelSubType"
|
v-model="fillupModel.fuelSubType"
|
||||||
:data="filteredFuelSubtypes"
|
:data="filteredFuelSubtypes"
|
||||||
@@ -229,27 +232,27 @@ export default {
|
|||||||
>
|
>
|
||||||
</b-autocomplete>
|
</b-autocomplete>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('quantity') + `*`" addons>
|
<b-field :label="$t('quantity') + `*`" addons>
|
||||||
<b-input v-model.number="fillupModel.fuelQuantity" type="number" step=".001" min="0" expanded required></b-input>
|
<b-input v-model.number="fillupModel.fuelQuantity" type="number" step=".001" min="0" expanded required></b-input>
|
||||||
<b-select v-model="fillupModel.fuelUnit" :placeholder="this.$t('fuelunit')" required>
|
<b-select v-model="fillupModel.fuelUnit" :placeholder="$t('fuelunit')" required>
|
||||||
<option v-for="(option, key) in fuelUnitMasters" :key="key" :value="key">
|
<option v-for="(option, key) in fuelUnitMasters" :key="key" :value="key">
|
||||||
{{ $t('unit.long.' + option.key) }}
|
{{ $t('unit.long.' + option.key) }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('per', { '0': this.$t('price'), '1': $t('unit.short.' + vehicle.fuelUnitDetail.key) })"
|
<b-field :label="$t('per', { '0': $t('price'), '1': $t('unit.short.' + vehicle.fuelUnitDetail.key) })"
|
||||||
><p class="control">
|
><p class="control">
|
||||||
<span class="button is-static">{{ me.currency }}</span>
|
<span class="button is-static">{{ me.currency }}</span>
|
||||||
</p>
|
</p>
|
||||||
<b-input v-model.number="fillupModel.perUnitPrice" type="number" min="0" step=".001" expanded required></b-input>
|
<b-input v-model.number="fillupModel.perUnitPrice" type="number" min="0" step=".001" expanded required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('totalamountpaid')">
|
<b-field :label="$t('totalamountpaid')">
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<span class="button is-static">{{ me.currency }}</span>
|
<span class="button is-static">{{ me.currency }}</span>
|
||||||
</p>
|
</p>
|
||||||
<b-input v-model.number="fillupModel.totalAmount" type="number" min="0" step=".001" expanded required></b-input>
|
<b-input v-model.number="fillupModel.totalAmount" type="number" min="0" step=".001" expanded required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('odometer')">
|
<b-field :label="$t('odometer')">
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<span class="button is-static">{{ $t('unit.short.' + me.distanceUnitDetail.key) }}</span>
|
<span class="button is-static">{{ $t('unit.short.' + me.distanceUnitDetail.key) }}</span>
|
||||||
</p>
|
</p>
|
||||||
@@ -265,10 +268,10 @@ export default {
|
|||||||
<b-switch v-model="showMore">{{ $t('fillmoredetails') }}</b-switch>
|
<b-switch v-model="showMore">{{ $t('fillmoredetails') }}</b-switch>
|
||||||
</b-field>
|
</b-field>
|
||||||
<fieldset v-if="showMore">
|
<fieldset v-if="showMore">
|
||||||
<b-field :label="this.$t('fillingstation')">
|
<b-field :label="$t('fillingstation')">
|
||||||
<b-input v-model="fillupModel.fillingStation" type="text" expanded></b-input>
|
<b-input v-model="fillupModel.fillingStation" type="text" expanded></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('comments')">
|
<b-field :label="$t('comments')">
|
||||||
<b-input v-model="fillupModel.comments" type="textarea" expanded></b-input>
|
<b-input v-model="fillupModel.comments" type="textarea" expanded></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -277,7 +280,15 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
<br />
|
<br />
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-button tag="input" native-type="submit" :disabled="tryingToCreate" type="is-primary" :value="this.$t('save')" :label="this.$t('createfillup')" expanded> </b-button>
|
<b-button
|
||||||
|
tag="button"
|
||||||
|
native-type="submit"
|
||||||
|
:disabled="tryingToCreate"
|
||||||
|
type="is-primary"
|
||||||
|
:value="$t('save')"
|
||||||
|
:label="$t('createfillup')"
|
||||||
|
expanded
|
||||||
|
/>
|
||||||
<p v-if="authError">
|
<p v-if="authError">
|
||||||
There was an error logging in to your account.
|
There was an error logging in to your account.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -134,53 +134,53 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form @submit.prevent="createVehicle">
|
<form @submit.prevent="createVehicle">
|
||||||
<b-field :label="this.$t('nickname') + `*`">
|
<b-field :label="$t('nickname') + `*`">
|
||||||
<b-input v-model="vehicleModel.nickname" type="text" expanded required></b-input>
|
<b-input v-model="vehicleModel.nickname" type="text" expanded required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('registration') + `*`">
|
<b-field :label="$t('registration') + `*`">
|
||||||
<b-input v-model="vehicleModel.registration" type="text" expanded required></b-input>
|
<b-input v-model="vehicleModel.registration" type="text" expanded required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field label="VIN">
|
<b-field label="VIN">
|
||||||
<b-input v-model="vehicleModel.vin" type="text" expanded></b-input>
|
<b-input v-model="vehicleModel.vin" type="text" expanded></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('fueltype') + `*`">
|
<b-field :label="$t('fueltype') + `*`">
|
||||||
<b-select v-model.number="vehicleModel.fuelType" :placeholder="this.$t('fueltype')" required expanded>
|
<b-select v-model.number="vehicleModel.fuelType" :placeholder="$t('fueltype')" required expanded>
|
||||||
<option v-for="(option, key) in fuelTypeMasters" :key="key" :value="key">
|
<option v-for="(option, key) in fuelTypeMasters" :key="key" :value="key">
|
||||||
{{ $t('fuel.' + option.key) }}
|
{{ $t('fuel.' + option.key) }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field :label="this.$t('fuelunit') + `*`">
|
<b-field :label="$t('fuelunit') + `*`">
|
||||||
<b-select v-model.number="vehicleModel.fuelUnit" :placeholder="this.$t('fuelunit')" required expanded>
|
<b-select v-model.number="vehicleModel.fuelUnit" :placeholder="$t('fuelunit')" required expanded>
|
||||||
<option v-for="(option, key) in fuelUnitMasters" :key="key" :value="key">
|
<option v-for="(option, key) in fuelUnitMasters" :key="key" :value="key">
|
||||||
{{ $t('unit.long.' + option.key) }}
|
{{ $t('unit.long.' + option.key) }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field :label="this.$t('make') + `*`">
|
<b-field :label="$t('make') + `*`">
|
||||||
<b-input v-model="vehicleModel.make" type="text" required expanded></b-input>
|
<b-input v-model="vehicleModel.make" type="text" required expanded></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('model') + `*`">
|
<b-field :label="$t('model') + `*`">
|
||||||
<b-input v-model="vehicleModel.model" type="text" required expanded></b-input>
|
<b-input v-model="vehicleModel.model" type="text" required expanded></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('yearmanufacture') + `*`">
|
<b-field :label="$t('yearmanufacture') + `*`">
|
||||||
<b-input v-model.number="vehicleModel.yearOfManufacture" type="number" expanded number></b-input>
|
<b-input v-model.number="vehicleModel.yearOfManufacture" type="number" expanded number></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('enginesize')">
|
<b-field :label="$t('enginesize')">
|
||||||
<b-input v-model.number="vehicleModel.engineSize" type="number" expanded number></b-input>
|
<b-input v-model.number="vehicleModel.engineSize" type="number" expanded number></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-button
|
<b-button
|
||||||
tag="input"
|
tag="button"
|
||||||
native-type="submit"
|
native-type="submit"
|
||||||
:disabled="tryingToCreate"
|
:disabled="tryingToCreate"
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
:value="this.$t('save')"
|
:value="$t('save')"
|
||||||
:label="this.$t('createvehicle')"
|
:label="$t('createvehicle')"
|
||||||
expanded
|
expanded
|
||||||
>
|
>
|
||||||
<BaseIcon v-if="tryingToCreate" name="sync" spin />
|
<BaseIcon v-if="tryingToCreate" name="sync" spin />
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<b-button tag="input" native-type="submit" :disabled="tryingToCreate" type="is-primary" value="Upload File" class="control">
|
<b-button tag="button" native-type="submit" :disabled="tryingToCreate" type="is-primary" class="control">
|
||||||
Import
|
Import
|
||||||
</b-button>
|
</b-button>
|
||||||
</div></div
|
</div></div
|
||||||
|
|||||||
@@ -9,6 +9,19 @@ export default {
|
|||||||
meta: [{ name: 'description', content: 'The Import Fuelly page.' }],
|
meta: [{ name: 'description', content: 'The Import Fuelly page.' }],
|
||||||
},
|
},
|
||||||
components: { Layout },
|
components: { Layout },
|
||||||
|
props: {
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data: function() {
|
||||||
|
return {
|
||||||
|
file: null,
|
||||||
|
tryingToCreate: false,
|
||||||
|
errors: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState('utils', ['isMobile']),
|
...mapState('utils', ['isMobile']),
|
||||||
uploadButtonLabel() {
|
uploadButtonLabel() {
|
||||||
@@ -27,19 +40,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
props: {
|
|
||||||
user: {
|
|
||||||
type: Object,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: function() {
|
|
||||||
return {
|
|
||||||
file: null,
|
|
||||||
tryingToCreate: false,
|
|
||||||
errors: [],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
importFuelly() {
|
importFuelly() {
|
||||||
if (this.file == null) {
|
if (this.file == null) {
|
||||||
@@ -121,7 +121,7 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<b-button tag="input" native-type="submit" :disabled="tryingToCreate" type="is-primary" :value="this.$t('uploadfile')" class="control">
|
<b-button tag="button" native-type="submit" :disabled="tryingToCreate" type="is-primary" class="control">
|
||||||
{{ $t('import') }}
|
{{ $t('import') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</div></div
|
</div></div
|
||||||
|
|||||||
7
ui/src/router/views/import-generic.unit.js
Normal file
7
ui/src/router/views/import-generic.unit.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import ImportGeneric from './import-generic'
|
||||||
|
|
||||||
|
describe('@views/import-generic', () => {
|
||||||
|
it('is a valid view', () => {
|
||||||
|
expect(ImportGeneric).toBeAViewComponent()
|
||||||
|
})
|
||||||
|
})
|
||||||
411
ui/src/router/views/import-generic.vue
Normal file
411
ui/src/router/views/import-generic.vue
Normal file
@@ -0,0 +1,411 @@
|
|||||||
|
<script>
|
||||||
|
import Layout from '@layouts/main.vue'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
import axios from 'axios'
|
||||||
|
import Papa from 'papaparse'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
page: {
|
||||||
|
title: 'Generic Import',
|
||||||
|
meta: [{ name: 'description', content: 'The Generic Import page.' }],
|
||||||
|
},
|
||||||
|
components: { Layout },
|
||||||
|
props: {
|
||||||
|
user: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data: function () {
|
||||||
|
return {
|
||||||
|
file: null,
|
||||||
|
tryingToCreate: false,
|
||||||
|
errors: [],
|
||||||
|
papaConfig: { dynamicTyping: true, skipEmptyLines: true, complete: this.assignResults },
|
||||||
|
fileData: null,
|
||||||
|
fileHeadings: null,
|
||||||
|
myVehicles: [],
|
||||||
|
selectedVehicle: null,
|
||||||
|
invertFullTank: null,
|
||||||
|
filledValueString: '',
|
||||||
|
notFilledValueString: '',
|
||||||
|
isFullTankString: false,
|
||||||
|
fileHeadingMap: {
|
||||||
|
fuelQuantity: null,
|
||||||
|
perUnitPrice: null,
|
||||||
|
totalAmount: null,
|
||||||
|
odoReading: null,
|
||||||
|
isTankFull: null,
|
||||||
|
hasMissedFillup: null,
|
||||||
|
comments: [], // [int]
|
||||||
|
fillingStation: null,
|
||||||
|
date: null,
|
||||||
|
fuelSubType: null,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState('utils', ['isMobile']),
|
||||||
|
...mapState('vehicles', ['vehicles']),
|
||||||
|
uploadButtonLabel() {
|
||||||
|
if (this.isMobile) {
|
||||||
|
if (this.file == null) {
|
||||||
|
return this.$t('choosephoto')
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.file == null) {
|
||||||
|
return this.$t('choosefile')
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.myVehicles = this.vehicles
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
assignResults(results, file) {
|
||||||
|
this.fileData = results.data
|
||||||
|
this.fileHeadings = results.data[0]
|
||||||
|
},
|
||||||
|
parseCSV() {
|
||||||
|
if (this.file == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.errorMessage = ''
|
||||||
|
Papa.parse(this.file, this.papaConfig)
|
||||||
|
},
|
||||||
|
getUsedHeadings() {
|
||||||
|
return Object.keys(this.fileHeadingMap).filter((k) => this.fileHeadingMap[k] != null) // filter non-null properties
|
||||||
|
},
|
||||||
|
getTimezone() {
|
||||||
|
return Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||||
|
},
|
||||||
|
csvToJson() {
|
||||||
|
const data = []
|
||||||
|
const headings = this.getUsedHeadings().reduce((a, k) => ({ ...a, [k]: this.fileHeadingMap[k] }), {}) // create new object from filter
|
||||||
|
const comments = (row) => {
|
||||||
|
return this.fileHeadingMap.comments.reduce((a, fi) => {
|
||||||
|
// TODO: sanitize to prevent XSS
|
||||||
|
return `${a}${this.fileHeadings[fi]}: ${row[fi]}\n`
|
||||||
|
}, '')
|
||||||
|
}
|
||||||
|
const calculateTotal = (row) => {
|
||||||
|
return this.fileHeadingMap.totalAmount === -1
|
||||||
|
? row[this.fileHeadingMap.fuelQuantity] * row[this.fileHeadingMap.perUnitPrice]
|
||||||
|
: row[this.fileHeadingMap.totalAmount]
|
||||||
|
}
|
||||||
|
|
||||||
|
const setFullTank = (row) => {
|
||||||
|
if (row[this.fileHeadingMap.isTankFull].toLowerCase() === this.filledValueString.toLowerCase()) {
|
||||||
|
return true
|
||||||
|
} else if (row[this.fileHeadingMap.isTankFull].toLowerCase() === this.notFilledValueString.toLowerCase()) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
// TODO: need to handle errors better
|
||||||
|
throw Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let r = 1; r < this.fileData.length; r++) {
|
||||||
|
const row = this.fileData[r]
|
||||||
|
const item = {}
|
||||||
|
Object.keys(headings).forEach((k) => {
|
||||||
|
if (k === 'comments') {
|
||||||
|
item[k] = comments(row)
|
||||||
|
} else if (k === 'totalAmount') {
|
||||||
|
item[k] = calculateTotal(row)
|
||||||
|
} else if (k === 'isTankFull') {
|
||||||
|
if (this.isFullTankString) {
|
||||||
|
item[k] = setFullTank(row)
|
||||||
|
} else {
|
||||||
|
if (this.invertFullTank) {
|
||||||
|
item[k] = Boolean(!row[headings[k]])
|
||||||
|
} else {
|
||||||
|
item[k] = Boolean(row[headings[k]])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (k === 'hasMissedFillup') {
|
||||||
|
// TODO: need to account for this field being a string
|
||||||
|
item[k] = Boolean(row[headings[k]])
|
||||||
|
} else if (k === 'date') {
|
||||||
|
item[k] = new Date(row[headings[k]]).toISOString()
|
||||||
|
} else {
|
||||||
|
item[k] = row[headings[k]]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
data.push(item)
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
},
|
||||||
|
importData() {
|
||||||
|
if (this.errors.length === 0) {
|
||||||
|
try {
|
||||||
|
const content = {
|
||||||
|
data: this.csvToJson(),
|
||||||
|
vehicleId: this.selectedVehicle.id,
|
||||||
|
timezone: this.getTimezone(),
|
||||||
|
}
|
||||||
|
axios
|
||||||
|
.post('/api/import/generic', content)
|
||||||
|
.then((data) => {
|
||||||
|
this.$buefy.toast.open({
|
||||||
|
message: this.$t('importsuccessfull'),
|
||||||
|
type: 'is-success',
|
||||||
|
duration: 3000,
|
||||||
|
})
|
||||||
|
setTimeout(() => this.$router.push({ name: 'home' }), 1000)
|
||||||
|
})
|
||||||
|
.catch((ex) => {
|
||||||
|
this.$buefy.toast.open({
|
||||||
|
duration: 5000,
|
||||||
|
message: this.$t('importerror'),
|
||||||
|
position: 'is-bottom',
|
||||||
|
type: 'is-danger',
|
||||||
|
})
|
||||||
|
console.log(ex)
|
||||||
|
if (ex.response && ex.response.data.error) {
|
||||||
|
this.errors.push(ex.response.data.error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
// TODO: handle error
|
||||||
|
this.errors.push(e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.errors.push('fix errors')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
checkFieldString() {
|
||||||
|
const tankFull = this.fileData[1][this.fileHeadingMap.isTankFull]
|
||||||
|
if (typeof tankFull !== 'boolean' && typeof tankFull === 'string') {
|
||||||
|
this.isFullTankString = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clearHeadingProperty(property) {
|
||||||
|
if (property === 'comments') {
|
||||||
|
this.fileHeadingMap[property] = []
|
||||||
|
} else {
|
||||||
|
this.fileHeadingMap[property] = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Layout>
|
||||||
|
<div class="columns box">
|
||||||
|
<div class="column">
|
||||||
|
<h1 class="title">{{ $t('importgeneric') }}</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div v-if="fileData === null" class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<p class="subtitle"> {{ $t('stepstoimport', { name: 'CSV' }) }}</p>
|
||||||
|
<ol>
|
||||||
|
<!-- <li>{{ $t('importhintcreatecsv', { 'name': 'Fuelly' }) }} <a href="http://docs.fuelly.com/acar-import-export-center" target="_nofollow">{{ $t('here') }}</a>.</li> -->
|
||||||
|
<li>{{ $t('importgenerichintdata') }}</li>
|
||||||
|
<li>{{ $t('importhintvehiclecreated') }}</li>
|
||||||
|
<li v-html="$t('importhintcurrdist')"></li>
|
||||||
|
<li v-html="$t('importhintunits')"></li>
|
||||||
|
<li>
|
||||||
|
<b>{{ $t('dontimportagain') }}</b>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="fileData === null" class="section box">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-two-thirds">
|
||||||
|
<p class="subtitle">{{ $t('choosedatafile') }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="column is-one-third is-flex is-align-content-center">
|
||||||
|
<form @submit.prevent="parseCSV">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<b-field class="file is-primary" :class="{ 'has-name': !!file }">
|
||||||
|
<b-upload v-model="file" class="file-label" accept=".csv" required>
|
||||||
|
<span class="file-cta">
|
||||||
|
<b-icon class="file-icon" icon="upload"></b-icon>
|
||||||
|
<span class="file-label">{{ uploadButtonLabel }}</span>
|
||||||
|
</span>
|
||||||
|
<span v-if="file" class="file-name" :class="isMobile ? 'file-name-mobile' : 'file-name-desktop'">
|
||||||
|
{{ file.name }}
|
||||||
|
</span>
|
||||||
|
</b-upload>
|
||||||
|
</b-field>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<b-button tag="button" native-type="submit" type="is-primary" class="control">
|
||||||
|
{{ $t('import') }}
|
||||||
|
</b-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<p class="subtitle">Map Fields</p>
|
||||||
|
<form class="" @submit.prevent="importData">
|
||||||
|
<b-field :label="$t('selectvehicle')">
|
||||||
|
<b-select v-model="selectedVehicle" :placeholder="$t('vehicle')" required expanded>
|
||||||
|
<option v-for="option in myVehicles" :key="option.id" :value="option">
|
||||||
|
{{ option.nickname }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<span v-if="selectedVehicle !== null">
|
||||||
|
<b-field :label="$t('fillupdate')">
|
||||||
|
<b-select v-model="fileHeadingMap.date" required expanded>
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field>
|
||||||
|
<template v-slot:label>
|
||||||
|
{{ $t('fuelsubtype') }}
|
||||||
|
<b-tooltip type="is-dark" label="Clear selection">
|
||||||
|
<b-button
|
||||||
|
type="is-ghost"
|
||||||
|
size="is-small"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-right="arrow-rotate-left"
|
||||||
|
@click="clearHeadingProperty('fuelSubType')"
|
||||||
|
></b-button>
|
||||||
|
</b-tooltip>
|
||||||
|
</template>
|
||||||
|
<b-select v-model="fileHeadingMap.fuelSubType" expanded>
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field :label="$t('quantity')">
|
||||||
|
<b-select v-model="fileHeadingMap.fuelQuantity" expanded required>
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field :label="$t('per', { '0': $t('price'), '1': $t('unit.short.' + selectedVehicle.fuelUnitDetail.key) })">
|
||||||
|
<b-select v-model.number="fileHeadingMap.perUnitPrice" type="number" min="0" step=".001" expanded required>
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field :label="$t('totalamountpaid')">
|
||||||
|
<b-select v-model.number="fileHeadingMap.totalAmount" expanded required>
|
||||||
|
<option value="-1">Calculated</option>
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field :label="$t('odometer')">
|
||||||
|
<b-select v-model.number="fileHeadingMap.odoReading" expanded required>
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field :label="$t('tankpartialfull')">
|
||||||
|
<b-radio-button v-model="invertFullTank" native-value="false">{{ $t('fulltank') }}</b-radio-button>
|
||||||
|
<b-radio-button v-model="invertFullTank" native-value="true">{{ $t('partialfillup') }}</b-radio-button>
|
||||||
|
</b-field>
|
||||||
|
<b-field>
|
||||||
|
<b-select v-model="fileHeadingMap.isTankFull" required @input="checkFieldString">
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<span v-if="isFullTankString === true" required>
|
||||||
|
<b-field label="Value when tank is filled">
|
||||||
|
<b-input v-model="filledValueString"></b-input>
|
||||||
|
</b-field>
|
||||||
|
<b-field label="Value when tank was not completely filled">
|
||||||
|
<b-input v-model="notFilledValueString"></b-input>
|
||||||
|
</b-field>
|
||||||
|
</span>
|
||||||
|
<b-field>
|
||||||
|
<template v-slot:label>
|
||||||
|
{{ $t('missedfillup') }}
|
||||||
|
<b-tooltip type="is-dark" label="Clear selection">
|
||||||
|
<b-button
|
||||||
|
type="is-ghost"
|
||||||
|
size="is-small"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-right="arrow-rotate-left"
|
||||||
|
@click="clearHeadingProperty('hasMissedFillup')"
|
||||||
|
></b-button>
|
||||||
|
</b-tooltip>
|
||||||
|
</template>
|
||||||
|
<b-select v-model="fileHeadingMap.hasMissedFillup">
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field>
|
||||||
|
<template v-slot:label>
|
||||||
|
{{ $t('fillingstation') }}
|
||||||
|
<b-tooltip type="is-dark" label="Clear selection">
|
||||||
|
<b-button
|
||||||
|
type="is-ghost"
|
||||||
|
size="is-small"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-right="arrow-rotate-left"
|
||||||
|
@click="clearHeadingProperty('fillingStation')"
|
||||||
|
></b-button>
|
||||||
|
</b-tooltip>
|
||||||
|
</template>
|
||||||
|
<b-select v-model="fileHeadingMap.fillingStation">
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<b-field>
|
||||||
|
<template v-slot:label>
|
||||||
|
{{ $t('comments') }}
|
||||||
|
<b-tooltip type="is-dark" label="Clear selection">
|
||||||
|
<b-button
|
||||||
|
type="is-ghost"
|
||||||
|
size="is-small"
|
||||||
|
icon-pack="fas"
|
||||||
|
icon-right="arrow-rotate-left"
|
||||||
|
@click="clearHeadingProperty('comments')"
|
||||||
|
></b-button>
|
||||||
|
</b-tooltip>
|
||||||
|
</template>
|
||||||
|
<b-select v-model="fileHeadingMap.comments" type="textarea" multiple expanded>
|
||||||
|
<option v-for="(option, index) in fileHeadings" :key="index" :value="index">
|
||||||
|
{{ option }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
<br />
|
||||||
|
<b-field>
|
||||||
|
<b-button tag="button" native-type="submit" type="is-primary" :value="$t('save')" :label="$t('import')" expanded />
|
||||||
|
<p v-if="authError"> There was an error logging in to your account. </p>
|
||||||
|
</b-field>
|
||||||
|
</span>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<b-message v-if="errors.length" type="is-danger">
|
||||||
|
<ul>
|
||||||
|
<li v-for="error in errors" :key="error">{{ error }}</li>
|
||||||
|
</ul>
|
||||||
|
</b-message>
|
||||||
|
</Layout>
|
||||||
|
</template>
|
||||||
@@ -18,18 +18,19 @@ export default {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Layout>
|
<Layout>
|
||||||
<div class="columns box"
|
<div class="columns box">
|
||||||
><div class="column">
|
<div class="column">
|
||||||
<h1 class="title">{{ $t('importdata') }}</h1>
|
<h1 class="title">{{ $t('importdata') }}</h1>
|
||||||
<p class="subtitle">{{ $t('importdatadesc') }}</p>
|
<p class="subtitle">{{ $t('importdatadesc') }}</p>
|
||||||
</div></div
|
</div>
|
||||||
>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-one-third">
|
<div class="column is-one-third">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h1 class="title">Fuelly</h1>
|
<h1 class="title">Fuelly</h1>
|
||||||
<p>If you have been using Fuelly to store your vehicle data, export the CSV file from Fuelly and click here to import.</p>
|
<p>If you have been using Fuelly to store your vehicle data, export the CSV file from Fuelly and click here to
|
||||||
|
import.</p>
|
||||||
<br />
|
<br />
|
||||||
<b-button type="is-primary" tag="router-link" to="/import/fuelly">{{ $t('import') }}</b-button>
|
<b-button type="is-primary" tag="router-link" to="/import/fuelly">{{ $t('import') }}</b-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,6 +44,16 @@ export default {
|
|||||||
<b-button type="is-primary" tag="router-link" to="/import/drivvo">{{ $t('import') }}</b-button>
|
<b-button type="is-primary" tag="router-link" to="/import/drivvo">{{ $t('import') }}</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="column is-one-third" to="/import-generic">
|
||||||
|
<div class="box">
|
||||||
|
<h1 class="title">{{ $t('importgeneric') }}</h1>
|
||||||
|
<p>{{ $t('importgenericdesc') }}</p>
|
||||||
|
<br />
|
||||||
|
<b-button type="is-primary" tag="router-link" to="/import/generic">{{ $t('import') }}</b-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ export default {
|
|||||||
{{ connectionError }}
|
{{ connectionError }}
|
||||||
</b-notification>
|
</b-notification>
|
||||||
|
|
||||||
<b-field addons :label="this.$t('mysqlconnstr')">
|
<b-field addons :label="$t('mysqlconnstr')">
|
||||||
<b-input v-model="url" required></b-input>
|
<b-input v-model="url" required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
@@ -200,20 +200,20 @@ export default {
|
|||||||
<div v-if="migrationMode === 'fresh'" class="box content">
|
<div v-if="migrationMode === 'fresh'" class="box content">
|
||||||
<h1 class="title">{{ $t('init.fresh.setupadminuser') }}</h1>
|
<h1 class="title">{{ $t('init.fresh.setupadminuser') }}</h1>
|
||||||
<form @submit.prevent="register">
|
<form @submit.prevent="register">
|
||||||
<b-field :label="this.$t('init.fresh.yourname')">
|
<b-field :label="$t('init.fresh.yourname')">
|
||||||
<b-input v-model="registerModel.name" required></b-input>
|
<b-input v-model="registerModel.name" required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('init.fresh.youremail')">
|
<b-field :label="$t('init.fresh.youremail')">
|
||||||
<b-input v-model="registerModel.email" type="email" required></b-input>
|
<b-input v-model="registerModel.email" type="email" required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('init.fresh.yourpassword')">
|
<b-field :label="$t('init.fresh.yourpassword')">
|
||||||
<b-input v-model="registerModel.password" type="password" required minlength="8" password-reveal></b-input>
|
<b-input v-model="registerModel.password" type="password" required minlength="8" password-reveal></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('currency')">
|
<b-field :label="$t('currency')">
|
||||||
<b-autocomplete
|
<b-autocomplete
|
||||||
v-model="registerModel.currency"
|
v-model="registerModel.currency"
|
||||||
:custom-formatter="formatCurrency"
|
:custom-formatter="formatCurrency"
|
||||||
:placeholder="this.$t('currency')"
|
:placeholder="$t('currency')"
|
||||||
:data="filteredCurrencyMasters"
|
:data="filteredCurrencyMasters"
|
||||||
:keep-first="true"
|
:keep-first="true"
|
||||||
:open-on-focus="true"
|
:open-on-focus="true"
|
||||||
@@ -221,8 +221,8 @@ export default {
|
|||||||
@select="(option) => (selected = option)"
|
@select="(option) => (selected = option)"
|
||||||
></b-autocomplete>
|
></b-autocomplete>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('distanceunit')">
|
<b-field :label="$t('distanceunit')">
|
||||||
<b-select v-model.number="registerModel.distanceUnit" :placeholder="this.$t('distanceunit')" required expanded>
|
<b-select v-model.number="registerModel.distanceUnit" :placeholder="$t('distanceunit')" required expanded>
|
||||||
<option v-for="(option, key) in distanceUnitMasters" :key="key" :value="key">
|
<option v-for="(option, key) in distanceUnitMasters" :key="key" :value="key">
|
||||||
{{ `${$t('unit.long.' + option.key)} (${$t('unit.short.' + option.key)})` }}
|
{{ `${$t('unit.long.' + option.key)} (${$t('unit.short.' + option.key)})` }}
|
||||||
</option>
|
</option>
|
||||||
@@ -230,7 +230,7 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
<br />
|
<br />
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<b-button type="is-primary" native-type="submit" tag="input" :value="this.$t('save')"></b-button>
|
<b-button type="is-primary" native-type="submit" tag="button" :value="$t('save')"></b-button>
|
||||||
|
|
||||||
<b-button type="is-danger is-light" @click="resetMigrationMode">{{ $t('cancel') }}</b-button>
|
<b-button type="is-danger is-light" @click="resetMigrationMode">{{ $t('cancel') }}</b-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export default {
|
|||||||
<b-field :label="$t('password')">
|
<b-field :label="$t('password')">
|
||||||
<b-input v-model="password" tag="b-input" name="password" type="password" :placeholder="placeholders.password" />
|
<b-input v-model="password" tag="b-input" name="password" type="password" :placeholder="placeholders.password" />
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-button tag="input" native-type="submit" :value="$t('login')" :disabled="tryingToLogIn" type="is-primary">
|
<b-button tag="button" native-type="submit" :disabled="tryingToLogIn" type="is-primary">
|
||||||
<BaseIcon v-if="tryingToLogIn" name="sync" spin />
|
<BaseIcon v-if="tryingToLogIn" name="sync" spin />
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ $t('login') }}
|
{{ $t('login') }}
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
<br />
|
<br />
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-button tag="input" native-type="submit" :disabled="tryingToSave" type="is-primary" :value="$t('save')" expanded> </b-button>
|
<b-button tag="button" native-type="submit" :disabled="tryingToSave" type="is-primary" expanded> {{ $t('save') }} </b-button>
|
||||||
</b-field>
|
</b-field>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -185,7 +185,8 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
<p v-if="!passwordValid" class="help is-danger">{{ $t('passworddontmatch') }}</p>
|
<p v-if="!passwordValid" class="help is-danger">{{ $t('passworddontmatch') }}</p>
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-button tag="input" native-type="submit" :disabled="!passwordValid" type="is-primary" :value="$t('changepassword')" expanded>
|
<b-button tag="button" native-type="submit" :disabled="!passwordValid" type="is-primary" expanded>
|
||||||
|
{{ $t('changepassword') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</b-field>
|
</b-field>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<form class="" @submit.prevent="saveSettings">
|
<form class="" @submit.prevent="saveSettings">
|
||||||
<b-field :label="this.$t('currency')">
|
<b-field :label="$t('currency')">
|
||||||
<b-select v-model="settingsModel.currency" :placeholder="this.$t('currency')" required expanded>
|
<b-select v-model="settingsModel.currency" :placeholder="$t('currency')" required expanded>
|
||||||
<option v-for="option in currencyMasters" :key="option.code" :value="option.code">
|
<option v-for="option in currencyMasters" :key="option.code" :value="option.code">
|
||||||
{{ `${option.namePlural} (${option.code})` }}
|
{{ `${option.namePlural} (${option.code})` }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('distanceunit')">
|
<b-field :label="$t('distanceunit')">
|
||||||
<b-select v-model.number="settingsModel.distanceUnit" :placeholder="this.$t('distanceunit')" required expanded>
|
<b-select v-model.number="settingsModel.distanceUnit" :placeholder="$t('distanceunit')" required expanded>
|
||||||
<option v-for="(option, key) in distanceUnitMasters" :key="key" :value="key">
|
<option v-for="(option, key) in distanceUnitMasters" :key="key" :value="key">
|
||||||
{{ `${$t('unit.long.' + option.key)} (${$t('unit.short.' + option.key)})` }}
|
{{ `${$t('unit.long.' + option.key)} (${$t('unit.short.' + option.key)})` }}
|
||||||
</option>
|
</option>
|
||||||
@@ -88,7 +88,7 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
<br />
|
<br />
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-button tag="input" native-type="submit" :disabled="tryingToSave" type="is-primary" :value="this.$t('save')" expanded> </b-button>
|
<b-button tag="button" native-type="submit" :disabled="tryingToSave" type="is-primary" expanded> {{ $t('save') }}</b-button>
|
||||||
</b-field>
|
</b-field>
|
||||||
</form>
|
</form>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@@ -138,13 +138,13 @@ export default {
|
|||||||
<div v-if="showUserForm" class="box content">
|
<div v-if="showUserForm" class="box content">
|
||||||
<h1 class="title">{{ $t('createnewuser') }}</h1>
|
<h1 class="title">{{ $t('createnewuser') }}</h1>
|
||||||
<form @submit.prevent="register">
|
<form @submit.prevent="register">
|
||||||
<b-field :label="this.$t('name')">
|
<b-field :label="$t('name')">
|
||||||
<b-input v-model="registerModel.name" required></b-input>
|
<b-input v-model="registerModel.name" required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('email')">
|
<b-field :label="$t('email')">
|
||||||
<b-input v-model="registerModel.email" type="email" required></b-input>
|
<b-input v-model="registerModel.email" type="email" required></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('password')">
|
<b-field :label="$t('password')">
|
||||||
<b-input
|
<b-input
|
||||||
v-model="registerModel.password"
|
v-model="registerModel.password"
|
||||||
type="password"
|
type="password"
|
||||||
@@ -153,24 +153,24 @@ export default {
|
|||||||
password-reveal
|
password-reveal
|
||||||
></b-input>
|
></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('role')">
|
<b-field :label="$t('role')">
|
||||||
<b-select v-model.number="registerModel.role" :placeholder="this.$t('placeholder')" required expanded>
|
<b-select v-model.number="registerModel.role" :placeholder="$t('role')" required expanded>
|
||||||
<option v-for="(option, key) in roleMasters" :key="key" :value="key">
|
<option v-for="(option, key) in roleMasters" :key="key" :value="key">
|
||||||
{{ `test` }}
|
{{ `${option.key}` }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('currency')">
|
<b-field :label="$t('currency')">
|
||||||
<b-select v-model="registerModel.currency" :placeholder="this.$t('currency')" required expanded>
|
<b-select v-model="registerModel.currency" :placeholder="$t('currency')" required expanded>
|
||||||
<option v-for="option in currencyMasters" :key="option.code" :value="option.code">
|
<option v-for="option in currencyMasters" :key="option.code" :value="option.code">
|
||||||
{{ `${option.namePlural} (${option.code})` }}
|
{{ `${option.namePlural} (${option.code})` }}
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field :label="this.$t('distanceunit')">
|
<b-field :label="$t('distanceunit')">
|
||||||
<b-select
|
<b-select
|
||||||
v-model.number="registerModel.distanceUnit"
|
v-model.number="registerModel.distanceUnit"
|
||||||
:placeholder="this.$t('distanceunit')"
|
:placeholder="$t('distanceunit')"
|
||||||
required
|
required
|
||||||
expanded
|
expanded
|
||||||
>
|
>
|
||||||
@@ -181,28 +181,28 @@ export default {
|
|||||||
</b-field>
|
</b-field>
|
||||||
<br />
|
<br />
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<b-button type="is-primary" native-type="submit" tag="input" :value="this.$t('save')"></b-button>
|
<b-button type="is-primary" native-type="submit" tag="button">{{ $t('save') }}</b-button>
|
||||||
|
|
||||||
<b-button type="is-danger is-light" @click="resetUserForm">{{ $t('cancel') }}</b-button>
|
<b-button type="is-danger is-light" @click="resetUserForm">{{ $t('cancel') }}</b-button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<b-table :data="users" hoverable mobile-cards detail-key="id" paginated per-page="10" :row-class="(row, index) => row.isDisabled && 'is-disabled'">
|
<b-table :data="users" hoverable mobile-cards detail-key="id" paginated per-page="10" :row-class="(row, index) => row.isDisabled && 'is-disabled'">
|
||||||
<b-table-column v-slot="props" field="name" :label="this.$t('name')">
|
<b-table-column v-slot="props" field="name" :label="$t('name')">
|
||||||
{{ `${props.row.name}` }} <template v-if="props.row.id === user.id">({{ $t('you') }})</template>
|
{{ `${props.row.name}` }} <template v-if="props.row.id === user.id">({{ $t('you') }})</template>
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="email" :label="this.$t('email')">
|
<b-table-column v-slot="props" field="email" :label="$t('email')">
|
||||||
{{ `${props.row.email}` }}
|
{{ `${props.row.email}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="role" :label="this.$t('role')">
|
<b-table-column v-slot="props" field="role" :label="$t('role')">
|
||||||
{{ `${$t('roles.' + props.row.roleDetail.key)}` }}
|
{{ `${$t('roles.' + props.row.roleDetail.key)}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="createdAt" :label="this.$t('created')" sortable date>
|
<b-table-column v-slot="props" field="createdAt" :label="$t('created')" sortable date>
|
||||||
{{ formatDate(props.row.createdAt) }}
|
{{ formatDate(props.row.createdAt) }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props">
|
<b-table-column v-slot="props">
|
||||||
<b-button type="is-success" v-if="props.row.isDisabled && props.row.roleDetail.key === 'USER'" @click="changeDisabledStatus(props.row.id, false)">{{ $t('enable') }}</b-button>
|
<b-button v-if="props.row.isDisabled && props.row.roleDetail.key === 'USER'" type="is-success" @click="changeDisabledStatus(props.row.id, false)">{{ $t('enable') }}</b-button>
|
||||||
<b-button type="is-danger" v-if="!props.row.isDisabled && props.row.roleDetail.key === 'USER'" @click="changeDisabledStatus(props.row.id, true)">{{ $t('disable') }}</b-button>
|
<b-button v-if="!props.row.isDisabled && props.row.roleDetail.key === 'USER'" type="is-danger" @click="changeDisabledStatus(props.row.id, true)">{{ $t('disable') }}</b-button>
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
</b-table>
|
</b-table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -92,7 +92,10 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('avgfuelcost'),
|
label: this.$t('avgfuelcost'),
|
||||||
value: this.$t('per', {'0': this.formatCurrency(x.avgFuelPrice, x.currency), '1': this.$t('unit.short.' + this.vehicle.fuelUnitDetail.key)}),
|
value: this.$t('per', {
|
||||||
|
0: this.formatCurrency(x.avgFuelPrice, x.currency),
|
||||||
|
1: this.$t('unit.short.' + this.vehicle.fuelUnitDetail.key),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -309,15 +312,15 @@ export default {
|
|||||||
<div class="column is-one-half" :class="isMobile ? 'has-text-centered' : ''">
|
<div class="column is-one-half" :class="isMobile ? 'has-text-centered' : ''">
|
||||||
<p class="title">{{ vehicle.nickname }} - {{ vehicle.registration }}</p>
|
<p class="title">{{ vehicle.nickname }} - {{ vehicle.registration }}</p>
|
||||||
<p class="subtitle">
|
<p class="subtitle">
|
||||||
{{ [vehicle.make, vehicle.model, this.$t('fuel.' + vehicle.fuelTypeDetail.key)].join(' | ') }}
|
{{ [vehicle.make, vehicle.model, $t('fuel.' + vehicle.fuelTypeDetail.key)].join(' | ') }}
|
||||||
|
|
||||||
<template v-if="users.length > 1">
|
<template v-if="users.length > 1">
|
||||||
| {{ $t("sharedwith") }} :
|
| {{ $t('sharedwith') }} :
|
||||||
{{
|
{{
|
||||||
users
|
users
|
||||||
.map((x) => {
|
.map((x) => {
|
||||||
if (x.userId === me.id) {
|
if (x.userId === me.id) {
|
||||||
return this.$t('you')
|
return $t('you')
|
||||||
} else {
|
} else {
|
||||||
return x.name
|
return x.name
|
||||||
}
|
}
|
||||||
@@ -328,8 +331,8 @@ export default {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div :class="(!isMobile ? 'has-text-right ' : '') + 'column is-one-half buttons'">
|
<div :class="(!isMobile ? 'has-text-right ' : '') + 'column is-one-half buttons'">
|
||||||
<b-button type="is-primary" tag="router-link" :to="`/vehicles/${vehicle.id}/fillup`">{{ this.$t('addfillup') }}</b-button>
|
<b-button type="is-primary" tag="router-link" :to="`/vehicles/${vehicle.id}/fillup`">{{ $t('addfillup') }}</b-button>
|
||||||
<b-button type="is-primary" tag="router-link" :to="`/vehicles/${vehicle.id}/expense`">{{ this.$t('addexpense') }}</b-button>
|
<b-button type="is-primary" tag="router-link" :to="`/vehicles/${vehicle.id}/expense`">{{ $t('addexpense') }}</b-button>
|
||||||
<b-button
|
<b-button
|
||||||
v-if="vehicle.isOwner"
|
v-if="vehicle.isOwner"
|
||||||
tag="router-link"
|
tag="router-link"
|
||||||
@@ -339,9 +342,8 @@ export default {
|
|||||||
props: { vehicle: vehicle },
|
props: { vehicle: vehicle },
|
||||||
params: { id: vehicle.id },
|
params: { id: vehicle.id },
|
||||||
}"
|
}"
|
||||||
>
|
><b-icon pack="fas" icon="edit" type="is-info"> </b-icon>
|
||||||
<b-icon pack="fas" icon="edit" type="is-info"> </b-icon
|
</b-button>
|
||||||
></b-button>
|
|
||||||
<b-button v-if="vehicle.isOwner" :title="$t('sharevehicle')" @click="showShareVehicleModal">
|
<b-button v-if="vehicle.isOwner" :title="$t('sharevehicle')" @click="showShareVehicleModal">
|
||||||
<b-icon pack="fas" icon="user-friends" type="is-info"> </b-icon
|
<b-icon pack="fas" icon="user-friends" type="is-info"> </b-icon
|
||||||
></b-button>
|
></b-button>
|
||||||
@@ -362,42 +364,42 @@ export default {
|
|||||||
<h1 class="title is-4">{{ $t('pastfillups') }}</h1>
|
<h1 class="title is-4">{{ $t('pastfillups') }}</h1>
|
||||||
|
|
||||||
<b-table :data="fillups" hoverable mobile-cards :detailed="isMobile" detail-key="id" paginated per-page="10">
|
<b-table :data="fillups" hoverable mobile-cards :detailed="isMobile" detail-key="id" paginated per-page="10">
|
||||||
<b-table-column v-slot="props" field="date" :label="this.$t('date')" :td-attrs="columnTdAttrs" sortable date>
|
<b-table-column v-slot="props" field="date" :label="$t('date')" :td-attrs="columnTdAttrs" sortable date>
|
||||||
{{ formatDate(props.row.date) }}
|
{{ formatDate(props.row.date) }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="fuelSubType" :label="this.$t('fuelsubtype')" :td-attrs="columnTdAttrs">
|
<b-table-column v-slot="props" field="fuelSubType" :label="$t('fuelsubtype')" :td-attrs="columnTdAttrs">
|
||||||
{{ props.row.fuelSubType }}
|
{{ props.row.fuelSubType }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="fuelQuantity" :label="this.$t('quantity')" :td-attrs="hiddenMobile" numeric>
|
<b-table-column v-slot="props" field="fuelQuantity" :label="$t('quantity')" :td-attrs="hiddenMobile" numeric>
|
||||||
{{ `${props.row.fuelQuantity} ${$t('unit.short.' + props.row.fuelUnitDetail.key)}` }}
|
{{ `${props.row.fuelQuantity} ${$t('unit.short.' + props.row.fuelUnitDetail.key)}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column
|
<b-table-column
|
||||||
v-slot="props"
|
v-slot="props"
|
||||||
field="perUnitPrice"
|
field="perUnitPrice"
|
||||||
:label="this.$t('per', { '0': this.$t('price'), '1': this.$t('unit.short.' + vehicle.fuelUnitDetail.key) })"
|
:label="$t('per', { '0': $t('price'), '1': $t('unit.short.' + vehicle.fuelUnitDetail.key) })"
|
||||||
:td-attrs="hiddenMobile"
|
:td-attrs="hiddenMobile"
|
||||||
numeric
|
numeric
|
||||||
sortable
|
sortable
|
||||||
>
|
>
|
||||||
{{ `${formatCurrency(props.row.perUnitPrice, props.row.currency)}` }}
|
{{ `${formatCurrency(props.row.perUnitPrice, props.row.currency)}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-if="isMobile" v-slot="props" field="totalAmount" :label="this.$t('total')" :td-attrs="hiddenDesktop" sortable numeric>
|
<b-table-column v-if="isMobile" v-slot="props" field="totalAmount" :label="$t('total')" :td-attrs="hiddenDesktop" sortable numeric>
|
||||||
{{ `${me.currency} ${props.row.totalAmount}` }} ({{ `${props.row.fuelQuantity} ${$t('unit.short.' + props.row.fuelUnitDetail.key)}` }} @
|
{{ `${me.currency} ${props.row.totalAmount}` }} ({{ `${props.row.fuelQuantity} ${$t('unit.short.' + props.row.fuelUnitDetail.key)}` }} @
|
||||||
{{ `${me.currency} ${props.row.perUnitPrice}` }})
|
{{ `${me.currency} ${props.row.perUnitPrice}` }})
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-if="!isMobile" v-slot="props" field="totalAmount" :label="this.$t('total')" :td-attrs="hiddenMobile" sortable numeric>
|
<b-table-column v-if="!isMobile" v-slot="props" field="totalAmount" :label="$t('total')" :td-attrs="hiddenMobile" sortable numeric>
|
||||||
{{ `${formatCurrency(props.row.totalAmount, props.row.currency)}` }}
|
{{ `${formatCurrency(props.row.totalAmount, props.row.currency)}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" width="20" field="isTankFull" :label="this.$t('fulltank')" :td-attrs="hiddenMobile">
|
<b-table-column v-slot="props" width="20" field="isTankFull" :label="$t('fulltank')" :td-attrs="hiddenMobile">
|
||||||
<b-icon pack="fas" :icon="props.row.isTankFull ? 'check' : 'times'" type="is-info"> </b-icon>
|
<b-icon pack="fas" :icon="props.row.isTankFull ? 'check' : 'times'" type="is-info"> </b-icon>
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="odoReading" :label="this.$t('odometer')" :td-attrs="hiddenMobile" numeric>
|
<b-table-column v-slot="props" field="odoReading" :label="$t('odometer')" :td-attrs="hiddenMobile" numeric>
|
||||||
{{ `${props.row.odoReading} ${$t('unit.short.' + me.distanceUnitDetail.key)}` }}
|
{{ `${props.row.odoReading} ${$t('unit.short.' + me.distanceUnitDetail.key)}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="fillingStation" :label="this.$t('gasstation')" :td-attrs="hiddenMobile">
|
<b-table-column v-slot="props" field="fillingStation" :label="$t('gasstation')" :td-attrs="hiddenMobile">
|
||||||
{{ `${props.row.fillingStation}` }}
|
{{ `${props.row.fillingStation}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="userId" :label="this.$t('by')" :td-attrs="hiddenMobile">
|
<b-table-column v-slot="props" field="userId" :label="$t('by')" :td-attrs="hiddenMobile">
|
||||||
{{ `${props.row.user.name}` }}
|
{{ `${props.row.user.name}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props">
|
<b-table-column v-slot="props">
|
||||||
@@ -412,7 +414,10 @@ export default {
|
|||||||
>
|
>
|
||||||
<b-icon pack="fas" icon="edit" type="is-info"> </b-icon
|
<b-icon pack="fas" icon="edit" type="is-info"> </b-icon
|
||||||
></b-button>
|
></b-button>
|
||||||
<b-button type="is-ghost" :title="$t('deletefillup')" @click="deleteFillup(props.row.id)">
|
<b-button
|
||||||
|
type="is-ghost"
|
||||||
|
:title="$t('deletefillup')"
|
||||||
|
@click="deleteFillup(props.row.id)">
|
||||||
<b-icon pack="fas" icon="trash" type="is-danger"> </b-icon
|
<b-icon pack="fas" icon="trash" type="is-danger"> </b-icon
|
||||||
></b-button>
|
></b-button>
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
@@ -427,22 +432,22 @@ export default {
|
|||||||
<h1 class="title is-4">{{ $t('expenses') }}</h1>
|
<h1 class="title is-4">{{ $t('expenses') }}</h1>
|
||||||
|
|
||||||
<b-table :data="expenses" hoverable mobile-cards paginated per-page="10">
|
<b-table :data="expenses" hoverable mobile-cards paginated per-page="10">
|
||||||
<b-table-column v-slot="props" field="date" :label="this.$t('date')" :td-attrs="columnTdAttrs" date>
|
<b-table-column v-slot="props" field="date" :label="$t('date')" :td-attrs="columnTdAttrs" date>
|
||||||
{{ formatDate(props.row.date) }}
|
{{ formatDate(props.row.date) }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="expenseType" :label="this.$t('expensetype')">
|
<b-table-column v-slot="props" field="expenseType" :label="$t('expensetype')">
|
||||||
{{ `${props.row.expenseType}` }}
|
{{ `${props.row.expenseType}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
<b-table-column v-slot="props" field="amount" :label="this.$t('total')" :td-attrs="hiddenMobile" sortable numeric>
|
<b-table-column v-slot="props" field="amount" :label="$t('total')" :td-attrs="hiddenMobile" sortable numeric>
|
||||||
{{ `${formatCurrency(props.row.amount, props.row.currency)}` }}
|
{{ `${formatCurrency(props.row.amount, props.row.currency)}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
<b-table-column v-slot="props" field="odoReading" :label="this.$t('odometer')" :td-attrs="columnTdAttrs" numeric>
|
<b-table-column v-slot="props" field="odoReading" :label="$t('odometer')" :td-attrs="columnTdAttrs" numeric>
|
||||||
{{ `${props.row.odoReading} ${$t('unit.short.' + me.distanceUnitDetail.key)}` }}
|
{{ `${props.row.odoReading} ${$t('unit.short.' + me.distanceUnitDetail.key)}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
<b-table-column v-slot="props" field="userId" :label="this.$t('by')" :td-attrs="columnTdAttrs">
|
<b-table-column v-slot="props" field="userId" :label="$t('by')" :td-attrs="columnTdAttrs">
|
||||||
{{ `${props.row.user.name}` }}
|
{{ `${props.row.user.name}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props">
|
<b-table-column v-slot="props">
|
||||||
@@ -467,7 +472,9 @@ export default {
|
|||||||
<br />
|
<br />
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-three-quarters"> <h1 class="title is-4">{{ $t('attachments') }}</h1></div>
|
<div class="column is-three-quarters">
|
||||||
|
<h1 class="title is-4">{{ $t('attachments') }}</h1></div
|
||||||
|
>
|
||||||
<div class="column buttons">
|
<div class="column buttons">
|
||||||
<b-button type="is-primary" @click="showAttachmentForm = true">
|
<b-button type="is-primary" @click="showAttachmentForm = true">
|
||||||
{{ $t('addattachment') }}
|
{{ $t('addattachment') }}
|
||||||
@@ -492,18 +499,18 @@ export default {
|
|||||||
</b-upload>
|
</b-upload>
|
||||||
</b-field>
|
</b-field>
|
||||||
<b-field>
|
<b-field>
|
||||||
<b-input v-model="title" required :placeholder="this.$t('labelforfile')"></b-input>
|
<b-input v-model="title" required :placeholder="$t('labelforfile')"></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field class="buttons">
|
<b-field class="buttons">
|
||||||
<b-button tag="input" native-type="submit" :disabled="tryingToUpload" type="is-primary" label="Upload File" value="Upload File">
|
<b-button tag="button" native-type="submit" :disabled="tryingToUpload" type="is-primary" label="Upload File" value="Upload File">
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button
|
<b-button
|
||||||
tag="input"
|
tag="button"
|
||||||
native-type="submit"
|
native-type="submit"
|
||||||
:disabled="tryingToUpload"
|
:disabled="tryingToUpload"
|
||||||
type="is-danger"
|
type="is-danger"
|
||||||
label="Upload File"
|
label="Cancel"
|
||||||
value="Cancel"
|
value="Cancel"
|
||||||
@click="showAttachmentForm = false"
|
@click="showAttachmentForm = false"
|
||||||
>
|
>
|
||||||
@@ -516,14 +523,14 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<b-table :data="attachments" hoverable mobile-cards>
|
<b-table :data="attachments" hoverable mobile-cards>
|
||||||
<b-table-column v-slot="props" field="title" :label="this.$t('title')" :td-attrs="columnTdAttrs">
|
<b-table-column v-slot="props" field="title" :label="$t('title')" :td-attrs="columnTdAttrs">
|
||||||
{{ `${props.row.title}` }}
|
{{ `${props.row.title}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
|
|
||||||
<b-table-column v-slot="props" field="originalName" :label="this.$t('name')" :td-attrs="columnTdAttrs">
|
<b-table-column v-slot="props" field="originalName" :label="$t('name')" :td-attrs="columnTdAttrs">
|
||||||
{{ `${props.row.originalName}` }}
|
{{ `${props.row.originalName}` }}
|
||||||
</b-table-column>
|
</b-table-column>
|
||||||
<b-table-column v-slot="props" field="id" :label="this.$t('download')" :td-attrs="columnTdAttrs">
|
<b-table-column v-slot="props" field="id" :label="$t('download')" :td-attrs="columnTdAttrs">
|
||||||
<b-button tag="a" :href="`/api/attachments/${props.row.id}/file?access_token=${currentUser.token}`" :download="props.row.originalName">
|
<b-button tag="a" :href="`/api/attachments/${props.row.id}/file?access_token=${currentUser.token}`" :download="props.row.originalName">
|
||||||
<b-icon type="is-primary" icon="download"></b-icon>
|
<b-icon type="is-primary" icon="download"></b-icon>
|
||||||
</b-button>
|
</b-button>
|
||||||
@@ -533,7 +540,9 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column" :class="isMobile ? 'has-text-centered' : ''"> <h1 class="title">{{ $t('statistics') }}</h1></div>
|
<div class="column" :class="isMobile ? 'has-text-centered' : ''">
|
||||||
|
<h1 class="title">{{ $t('statistics') }}</h1></div
|
||||||
|
>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="columns is-pulled-right is-medium">
|
<div class="columns is-pulled-right is-medium">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
|
|||||||
14736
ui/yarn.lock
14736
ui/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user