add fleet
This commit is contained in:
@@ -6,6 +6,7 @@ import com.restapi.config.AppConfig.Companion.appConfig
|
||||
import com.restapi.config.Auth.validateAuthToken
|
||||
import com.restapi.controllers.*
|
||||
import com.restapi.domain.DataNotFoundException
|
||||
import com.restapi.domain.ReminderLog
|
||||
import com.restapi.domain.Session.currentTenant
|
||||
import com.restapi.domain.Session.currentUser
|
||||
import com.restapi.domain.Session.objectMapper
|
||||
@@ -190,6 +191,7 @@ fun main(args: Array<String>) {
|
||||
delete("/{id}", PaymentCtrl::delete, Roles(Role.Explicit("ROLE_PAYMENT_CREATE")))
|
||||
}
|
||||
path("/fleet") {
|
||||
|
||||
post("", FleetCtrl::create, Roles(Role.Explicit("ROLE_FLEET_CREATE")))
|
||||
get(
|
||||
"/{id}",
|
||||
@@ -219,6 +221,63 @@ fun main(args: Array<String>) {
|
||||
)
|
||||
delete("/{id}", RenewalCtrl::delete, Roles(Role.Explicit("ROLE_FLEET_CREATE")))
|
||||
}
|
||||
path("/reminder") {
|
||||
post("", ReminderCtrl::create, Roles(Role.Explicit("ROLE_REMINDER_CREATE")))
|
||||
get(
|
||||
"/{id}",
|
||||
ReminderCtrl::get,
|
||||
Roles(Role.Explicit("ROLE_REMINDER_VIEW", "ROLE_REMINDER_CREATE"))
|
||||
)
|
||||
put("/{id}", ReminderCtrl::update, Roles(Role.Explicit("ROLE_REMINDER_CREATE")))
|
||||
post(
|
||||
"/getAll",
|
||||
ReminderLogCtrl::getAll,
|
||||
Roles(Role.Explicit("ROLE_REMINDER_CREATE", "ROLE_REMINDER_VIEW"))
|
||||
)
|
||||
post(
|
||||
"/done",
|
||||
ReminderLogCtrl::done,
|
||||
Roles(Role.Explicit("ROLE_REMAINDER_CREATE"))
|
||||
)
|
||||
get(
|
||||
"/getAll/{id}",
|
||||
ReminderCtrl::getAllByFleetId,
|
||||
Roles(Role.Explicit("ROLE_REMINDER_CREATE", "ROLE_REMINDER_VIEW"))
|
||||
)
|
||||
delete(
|
||||
"/{id}",
|
||||
ReminderCtrl::delete,
|
||||
Roles(Role.Explicit("ROLE_REMINDER_CREATE"))
|
||||
)
|
||||
}
|
||||
path("/vehicle") {
|
||||
post("", VehicleCtrl::create, Roles(Role.Explicit("ROLE_FLEET_CREATE")))
|
||||
get(
|
||||
"/{id}",
|
||||
VehicleCtrl::get,
|
||||
Roles(Role.Explicit("ROLE_FLEET_VIEW", "ROLE_FLEET_CREATE"))
|
||||
)
|
||||
put("/{id}", VehicleCtrl::update, Roles(Role.Explicit("ROLE_FLEET_CREATE")))
|
||||
post(
|
||||
"/getAll",
|
||||
VehicleCtrl::getAll,
|
||||
Roles(Role.Explicit("ROLE_FLEET_CREATE", "ROLE_FLEET_VIEW"))
|
||||
)
|
||||
}
|
||||
path("/fleetType") {
|
||||
post("", FleetTypeCtrl::create, Roles(Role.Explicit("ROLE_FLEET_CREATE")))
|
||||
get(
|
||||
"/{id}",
|
||||
FleetTypeCtrl::get,
|
||||
Roles(Role.Explicit("ROLE_FLEET_VIEW", "ROLE_FLEET_CREATE"))
|
||||
)
|
||||
put("/{id}", FleetTypeCtrl::update, Roles(Role.Explicit("ROLE_FLEET_CREATE")))
|
||||
post(
|
||||
"/getAll",
|
||||
FleetTypeCtrl::getAll,
|
||||
Roles(Role.Explicit("ROLE_FLEET_CREATE", "ROLE_FLEET_VIEW"))
|
||||
)
|
||||
}
|
||||
path("/po") {
|
||||
get("/next", PurchaseOrderCtrl::getNextNum, Roles(Role.Explicit("ROLE_PO_CREATE")))
|
||||
post("", PurchaseOrderCtrl::create, Roles(Role.Explicit("ROLE_PO_CREATE")))
|
||||
|
||||
@@ -1047,19 +1047,22 @@ object FleetCtrl {
|
||||
database.save(fleet)
|
||||
ctx.json(fleet).status(HttpStatus.CREATED)
|
||||
}
|
||||
|
||||
fun get(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val fleet = database.find(Fleet::class.java, id)
|
||||
?: throw NotFoundResponse("No fleet found with id $id")
|
||||
ctx.json(fleet).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
data class FLTF(val common: CommonFilters, val fleetFilters: FleetFilters)
|
||||
|
||||
fun getAll(ctx: Context) {
|
||||
val filters = ctx.bodyAsClass<FLTF>()
|
||||
val fleets = searchFleets(filters.common, filters.fleetFilters)
|
||||
val excel = ctx.queryParam("excel")
|
||||
if (excel !== null) {
|
||||
// exportFleets(fleets)
|
||||
exportFleets(fleets)
|
||||
val inputStream = FileInputStream("./excel/Fleets.xls")
|
||||
ctx.result(inputStream).status(HttpStatus.OK)
|
||||
} else {
|
||||
@@ -1067,36 +1070,116 @@ object FleetCtrl {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun update(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val fleet =
|
||||
database.find(Fleet::class.java, id) ?: throw NotFoundResponse("fleet not found for $id")
|
||||
val updatedFleet= ctx.bodyAsClass<Fleet>()
|
||||
val updatedFleet = ctx.bodyAsClass<Fleet>()
|
||||
fleet.patchValues(updatedFleet)
|
||||
fleet.update()
|
||||
ctx.json(fleet).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun delete(ctx: Context) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
object RenewalCtrl{
|
||||
object VehicleCtrl {
|
||||
fun create(ctx: Context) {
|
||||
val vehicle = ctx.bodyAsClass<Vehicle>()
|
||||
database.save(vehicle)
|
||||
ctx.json(vehicle).status(HttpStatus.CREATED)
|
||||
}
|
||||
|
||||
fun get(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val vehicle = database.find(Vehicle::class.java, id)
|
||||
?: throw NotFoundResponse("No vehicle found with id $id")
|
||||
ctx.json(vehicle).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun getAll(ctx: Context) {
|
||||
val vehicles = database.find(Vehicle::class.java).findList()
|
||||
val excel = ctx.queryParam("excel")
|
||||
if (excel !== null) {
|
||||
// exportVehicles(vehicles)
|
||||
val inputStream = FileInputStream("./excel/Vehicles.xls")
|
||||
ctx.result(inputStream).status(HttpStatus.OK)
|
||||
} else {
|
||||
ctx.json(vehicles).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun update(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val vehicle =
|
||||
database.find(Vehicle::class.java, id) ?: throw NotFoundResponse("vehicle not found for $id")
|
||||
val updatedVehicle = ctx.bodyAsClass<Vehicle>()
|
||||
vehicle.patchValues(updatedVehicle)
|
||||
vehicle.update()
|
||||
ctx.json(vehicle).status(HttpStatus.OK)
|
||||
}
|
||||
}
|
||||
|
||||
object FleetTypeCtrl {
|
||||
fun create(ctx: Context) {
|
||||
val fleetType = ctx.bodyAsClass<FleetType>()
|
||||
database.save(fleetType)
|
||||
ctx.json(fleetType).status(HttpStatus.CREATED)
|
||||
}
|
||||
|
||||
fun get(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val fleetType = database.find(FleetType::class.java, id)
|
||||
?: throw NotFoundResponse("No fleetType found with id $id")
|
||||
ctx.json(fleetType).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun getAll(ctx: Context) {
|
||||
val fleetTypes = database.find(FleetType::class.java).findList()
|
||||
val excel = ctx.queryParam("excel")
|
||||
if (excel !== null) {
|
||||
// exportFleetTypes(fleetTypes)
|
||||
val inputStream = FileInputStream("./excel/FleetTypes.xls")
|
||||
ctx.result(inputStream).status(HttpStatus.OK)
|
||||
} else {
|
||||
ctx.json(fleetTypes).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun update(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val fleetType =
|
||||
database.find(FleetType::class.java, id) ?: throw NotFoundResponse("fleetType not found for $id")
|
||||
val updatedFleetType = ctx.bodyAsClass<FleetType>()
|
||||
fleetType.patchValues(updatedFleetType)
|
||||
fleetType.update()
|
||||
ctx.json(fleetType).status(HttpStatus.OK)
|
||||
}
|
||||
}
|
||||
|
||||
object RenewalCtrl {
|
||||
fun create(ctx: Context) {
|
||||
val renewal = ctx.bodyAsClass<Renewal>()
|
||||
database.save(renewal)
|
||||
ctx.json(renewal).status(HttpStatus.CREATED)
|
||||
}
|
||||
|
||||
fun get(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val renewal = database.find(Renewal::class.java, id)
|
||||
?: throw NotFoundResponse("No renewal found with id $id")
|
||||
ctx.json(renewal).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
//data class RNLF(val common: CommonFilters, val renewalFilters: RenewalFilters)
|
||||
fun getAll(ctx: Context) {
|
||||
// val filters = ctx.bodyAsClass<FLTF>()
|
||||
// val renewals = searchRenewals(filters.common, filters.renewalFilters)
|
||||
// val filters = ctx.bodyAsClass<FLTF>()
|
||||
// val renewals = searchRenewals(filters.common, filters.renewalFilters)
|
||||
val renewals = database.find(Renewal::class.java).findList()
|
||||
val excel = ctx.queryParam("excel")
|
||||
if (excel !== null) {
|
||||
@@ -1108,15 +1191,166 @@ object RenewalCtrl{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun update(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val renewal =
|
||||
database.find(Renewal::class.java, id) ?: throw NotFoundResponse("renewal not found for $id")
|
||||
val updatedRenewal= ctx.bodyAsClass<Renewal>()
|
||||
val updatedRenewal = ctx.bodyAsClass<Renewal>()
|
||||
renewal.patchValues(updatedRenewal)
|
||||
renewal.update()
|
||||
ctx.json(renewal).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun delete(ctx: Context) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
object ReminderCtrl {
|
||||
fun create(ctx: Context) {
|
||||
val renewal = ctx.bodyAsClass<Reminder>()
|
||||
database.save(renewal)
|
||||
val entry = ReminderLog()
|
||||
entry.apply {
|
||||
reminder = renewal
|
||||
reminderDate = renewal.nextRenewalDate
|
||||
reminderType = renewal.type
|
||||
fleet = renewal.fleet
|
||||
amount = 0.0
|
||||
actedUpon = false
|
||||
}
|
||||
ReminderLogCtrl.create(entry)
|
||||
ctx.json(renewal).status(HttpStatus.CREATED)
|
||||
}
|
||||
|
||||
fun getAllByFleetId(ctx: Context) {
|
||||
val fleetId = ctx.pathParam("id").toLong()
|
||||
val history = database.find(Reminder::class.java)
|
||||
.where()
|
||||
.eq("fleet_sys_pk", fleetId)
|
||||
.findList()
|
||||
ctx.json(history).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun get(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val renewal = database.find(Reminder::class.java, id)
|
||||
?: throw NotFoundResponse("No renewal found with id $id")
|
||||
ctx.json(renewal).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
//data class RNLF(val common: CommonFilters, val renewalFilters: ReminderFilters)
|
||||
fun getAll(ctx: Context) {
|
||||
// val filters = ctx.bodyAsClass<FLTF>()
|
||||
// val renewals = searchReminders(filters.common, filters.renewalFilters)
|
||||
val renewals = database.find(Reminder::class.java).findList()
|
||||
val excel = ctx.queryParam("excel")
|
||||
if (excel !== null) {
|
||||
// exportReminders(renewals)
|
||||
val inputStream = FileInputStream("./excel/Reminders.xls")
|
||||
ctx.result(inputStream).status(HttpStatus.OK)
|
||||
} else {
|
||||
ctx.json(renewals).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun update(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val renewal =
|
||||
database.find(Reminder::class.java, id) ?: throw NotFoundResponse("renewal not found for $id")
|
||||
val updatedReminder = ctx.bodyAsClass<Reminder>()
|
||||
renewal.patchValues(updatedReminder)
|
||||
renewal.update()
|
||||
ctx.json(renewal).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun delete(ctx: Context) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
object ReminderLogCtrl {
|
||||
fun create(entry: ReminderLog) {
|
||||
// val renewal = ctx.bodyAsClass<ReminderLog>()
|
||||
|
||||
database.save(entry)
|
||||
return
|
||||
//ctx.json(renewal).status(HttpStatus.CREATED)
|
||||
}
|
||||
|
||||
data class Done(
|
||||
val logId: Long,
|
||||
val reminderId: Long,
|
||||
val renewalDate: LocalDate,
|
||||
val nextRenewalDate: LocalDate,
|
||||
val amount: Double,
|
||||
val documents: List<String>?
|
||||
)
|
||||
|
||||
fun done(ctx: Context) {
|
||||
val req = ctx.bodyAsClass<Done>()
|
||||
val reminder =
|
||||
database.find(Reminder::class.java, req.reminderId) ?: throw NotFoundResponse("No Reminder found")
|
||||
//update reminder
|
||||
reminder.apply {
|
||||
lastRenewalDate = req.renewalDate
|
||||
nextRenewalDate = req.nextRenewalDate
|
||||
}
|
||||
reminder.update()
|
||||
val entry = database.find(ReminderLog::class.java, req.logId) ?: throw NotFoundResponse("Log not found")
|
||||
entry.apply {
|
||||
actedUpon = true
|
||||
documents = req.documents
|
||||
amount = req.amount
|
||||
}
|
||||
entry.update()
|
||||
ctx.json(entry).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun getAllByFleetId(ctx: Context) {
|
||||
val fleetId = ctx.pathParam("id").toLong()
|
||||
val history = database.find(ReminderLog::class.java)
|
||||
.where()
|
||||
.eq("fleet_sys_pk", fleetId)
|
||||
.findList()
|
||||
ctx.json(history).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun get(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val renewal = database.find(ReminderLog::class.java, id)
|
||||
?: throw NotFoundResponse("No renewal found with id $id")
|
||||
ctx.json(renewal).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
data class LOGF(val common: CommonFilters, val reminderLogFilters: ReminderLogFilters)
|
||||
|
||||
fun getAll(ctx: Context) {
|
||||
val filters = ctx.bodyAsClass<LOGF>()
|
||||
val entries = searchReminderLogs(filters.common, filters.reminderLogFilters)
|
||||
val excel = ctx.queryParam("excel")
|
||||
if (excel !== null) {
|
||||
exportReminderLogs(entries)
|
||||
val inputStream = FileInputStream("./excel/ReminderLogs.xls")
|
||||
ctx.result(inputStream).status(HttpStatus.OK)
|
||||
} else {
|
||||
ctx.json(entries).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun update(ctx: Context) {
|
||||
val id = ctx.pathParam("id").toLong()
|
||||
val renewal =
|
||||
database.find(ReminderLog::class.java, id) ?: throw NotFoundResponse("renewal not found for $id")
|
||||
val updatedReminderLog = ctx.bodyAsClass<ReminderLog>()
|
||||
renewal.patchValues(updatedReminderLog)
|
||||
renewal.update()
|
||||
ctx.json(renewal).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
fun delete(ctx: Context) {
|
||||
|
||||
}
|
||||
|
||||
@@ -495,6 +495,51 @@ fun exportInvoices(invoices: List<Invoice>) {
|
||||
saveExcelFileLocally("Invoices.xls", wb)
|
||||
}
|
||||
|
||||
fun exportFleets(fleets: List<Fleet>) {
|
||||
val wb = HSSFWorkbook()
|
||||
val sh = wb.createSheet()
|
||||
|
||||
val headers: List<String> = listOf("Type", "Reg. Number", "Reg. Date", "Model", "Make", "Driver", "Mileage")
|
||||
createHeaderRow(headers, sh, wb)
|
||||
|
||||
var rowCnt = 1
|
||||
|
||||
for (flt in fleets) {
|
||||
val row = sh.createRow(rowCnt++)
|
||||
var i = 0
|
||||
row.createCell(i++).setCellValue(flt.type)
|
||||
row.createCell(i++).setCellValue(flt.regNumber)
|
||||
row.createCell(i++).setCellValue(flt.regDate)
|
||||
row.createCell(i++).setCellValue(flt.model)
|
||||
row.createCell(i++).setCellValue(flt.make)
|
||||
row.createCell(i++).setCellValue(flt.driver)
|
||||
row.createCell(i++).setCellValue(flt.mileage)
|
||||
}
|
||||
saveExcelFileLocally("Fleets.xls", wb)
|
||||
}
|
||||
|
||||
fun exportReminderLogs(logs: List<ReminderLog>) {
|
||||
val wb = HSSFWorkbook()
|
||||
val sh = wb.createSheet()
|
||||
|
||||
val headers: List<String> = listOf("Type", "Amount", "Frequency", "Reminder Date", "Acted Upon", "Vehicle")
|
||||
createHeaderRow(headers, sh, wb)
|
||||
|
||||
var rowCnt = 1
|
||||
|
||||
for (log in logs) {
|
||||
val row = sh.createRow(rowCnt++)
|
||||
var i = 0
|
||||
row.createCell(i++).setCellValue(log.reminderType)
|
||||
row.createCell(i++).setCellValue(log.amount)
|
||||
row.createCell(i++).setCellValue(log.reminder?.frequency.toString())
|
||||
row.createCell(i++).setCellValue(log.reminderDate)
|
||||
row.createCell(i++).setCellValue(log.actedUpon)
|
||||
row.createCell(i++).setCellValue(log.reminder?.fleet?.regNumber)
|
||||
}
|
||||
saveExcelFileLocally("ReminderLogs.xls", wb)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
//ImportFromExcel(FileType.QUOTES, "C:\\Users\\arsalan\\Downloads\\Book.xlsx")
|
||||
TemplateExcelFile(FileType.PRODS)
|
||||
|
||||
@@ -97,10 +97,17 @@ data class PaymentFilters(
|
||||
val amountLessThan: Double = Double.MAX_VALUE
|
||||
) : CustomFilters
|
||||
|
||||
|
||||
|
||||
data class FleetFilters(
|
||||
val fleetNameLike: String = IGNORE
|
||||
):CustomFilters
|
||||
|
||||
data class ReminderLogFilters(
|
||||
val reminderType: String = IGNORE,
|
||||
val actedUpon: Boolean? = null,
|
||||
val fleetId: Long? = null
|
||||
)
|
||||
fun <T> applyVendorHelper(q: io.ebean.ExpressionList<T>, vids: List<Long>?) {
|
||||
if (vids.isNullOrEmpty()) return
|
||||
// q.apply {
|
||||
@@ -275,16 +282,29 @@ fun searchFleets(filters: CommonFilters, fleetFilters: FleetFilters) : List<Flee
|
||||
.where()
|
||||
.ilike("name", "%" + fleetFilters.fleetNameLike + "%")
|
||||
|
||||
q.raw("(insurance_renewal_date >= ? and insurance_renewal_date <= ?)" +
|
||||
"or (pollution_renewal_date >= ? and pollution_renewal_date <= ?)" +
|
||||
"or (fitness_renewal_date >= ? and fitness_renewal_date <= ?)",
|
||||
filters.from, filters.to, filters.from, filters.to, filters.from, filters.to
|
||||
)
|
||||
// q.raw("(insurance_renewal_date >= ? and insurance_renewal_date <= ?)" +
|
||||
// "or (pollution_renewal_date >= ? and pollution_renewal_date <= ?)" +
|
||||
// "or (fitness_renewal_date >= ? and fitness_renewal_date <= ?)",
|
||||
// filters.from, filters.to, filters.from, filters.to, filters.from, filters.to
|
||||
// )
|
||||
// applyFromToHelper(q, filters.from, filters.to, "insuranceRenewalDate")
|
||||
// applyFromToHelper(q, filters.from, filters.to, "pollutionRenewalDate")
|
||||
// applyFromToHelper(q, filters.from, filters.to, "fitnessRenewalDate")
|
||||
return q.findList()
|
||||
}
|
||||
|
||||
fun searchReminderLogs(filters: CommonFilters, reminderLogFilters: ReminderLogFilters) : List<ReminderLog> {
|
||||
val q = database.find(ReminderLog::class.java)
|
||||
.where()
|
||||
.ilike("reminder_type", reminderLogFilters.reminderType)
|
||||
if(reminderLogFilters.actedUpon != null){
|
||||
q.eq("acted_upon", reminderLogFilters.actedUpon)
|
||||
}
|
||||
if(reminderLogFilters.fleetId != null){
|
||||
q.eq("fleet_sys_pk", reminderLogFilters.fleetId)
|
||||
}
|
||||
return q.findList()
|
||||
}
|
||||
|
||||
//if date is null then fromtoheper drops that///
|
||||
|
||||
//if date is null then fromtoheper drops that///
|
||||
@@ -521,7 +521,8 @@ open class Payment : BaseTenantModel() {
|
||||
}
|
||||
|
||||
|
||||
data class FleetRenewal(val renewal : String, val date : LocalDate)
|
||||
data class FR(val renewal: String, val date: LocalDate)
|
||||
|
||||
@Entity
|
||||
open class Fleet : BaseTenantModel() {
|
||||
fun patchValues(updated: Fleet) {
|
||||
@@ -538,11 +539,13 @@ open class Fleet : BaseTenantModel() {
|
||||
this.pollutionRenewalDate = updated.pollutionRenewalDate
|
||||
this.fitnessRenewalDate = updated.fitnessRenewalDate
|
||||
this.renewals = updated.renewals
|
||||
this.regDate = updated.regDate
|
||||
}
|
||||
|
||||
var name: String = ""
|
||||
var type: String = ""
|
||||
var regNumber: String = ""
|
||||
var regDate: LocalDate?=null
|
||||
var model: String = ""
|
||||
var make: String = ""
|
||||
var driver: String = ""
|
||||
@@ -552,8 +555,9 @@ open class Fleet : BaseTenantModel() {
|
||||
var insuranceRenewalDate: LocalDate? = null
|
||||
var pollutionRenewalDate: LocalDate? = null
|
||||
var fitnessRenewalDate: LocalDate? = null
|
||||
|
||||
@DbJsonB
|
||||
var renewals: List<FleetRenewal>?=null
|
||||
var renewals: List<FR>? = null
|
||||
}
|
||||
|
||||
@Entity
|
||||
@@ -583,4 +587,52 @@ open class Renewal : BaseTenantModel() {
|
||||
}
|
||||
|
||||
var name: String = ""
|
||||
}
|
||||
|
||||
@Entity
|
||||
open class Reminder : BaseTenantModel() {
|
||||
fun patchValues(updated: Reminder) {
|
||||
this.type = updated.type
|
||||
this.nextRenewalDate = updated.nextRenewalDate
|
||||
this.lastRenewalDate = updated.lastRenewalDate
|
||||
this.frequency = updated.frequency
|
||||
this.documents = updated.documents
|
||||
}
|
||||
|
||||
var type: String = "Other"
|
||||
var nextRenewalDate: LocalDate? = null
|
||||
var lastRenewalDate: LocalDate? = null
|
||||
var amount: Double = 0.0
|
||||
var frequency: Int = 1
|
||||
|
||||
@DbArray
|
||||
var documents: List<String>? = arrayListOf()
|
||||
|
||||
@ManyToOne
|
||||
var fleet: Fleet? = null
|
||||
}
|
||||
|
||||
@Entity
|
||||
open class ReminderLog : BaseTenantModel() {
|
||||
fun patchValues(updated: ReminderLog) {
|
||||
this.fleet = updated.fleet
|
||||
this.reminderDate = updated.reminderDate
|
||||
this.reminderType = updated.reminderType
|
||||
this.actedUpon = updated.actedUpon
|
||||
this.documents = updated.documents
|
||||
this.amount = updated.amount
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
var reminder: Reminder? = null
|
||||
var reminderType: String = "Other"
|
||||
var reminderDate: LocalDate? = null
|
||||
|
||||
@ManyToOne
|
||||
var fleet: Fleet? = null
|
||||
var actedUpon: Boolean = false
|
||||
var amount: Double = 0.0
|
||||
|
||||
@DbArray
|
||||
var documents: List<String>? = null
|
||||
}
|
||||
Reference in New Issue
Block a user