add display, but no edit yet

This commit is contained in:
gowthaman 2024-04-30 01:05:54 +05:30
parent ecf31b1b74
commit 712543ec3c
5 changed files with 21 additions and 9 deletions

View File

@ -125,6 +125,12 @@ fun main(args: Array<String>) {
put("/{id}", VendorCtrl::update, Roles(Role.Explicit("ROLE_VENDOR_CREATE")))
}
path("/incoming") {
get("/plants", IncomingInventoryCtrl::plantsForUser,
Roles(
Role.Explicit("ROLE_INVENTORY_CREATE"),
Role.Explicit("ROLE_INVENTORY_VIEW")
)
)
post("", IncomingInventoryCtrl::create, Roles(Role.Explicit("ROLE_INVENTORY_CREATE")))
get("/next", IncomingInventoryCtrl::getNextNum, Roles(Role.Explicit("ROLE_INVENTORY_CREATE")))
get(

View File

@ -805,6 +805,12 @@ object RequestForQuote {
}
object IncomingInventoryCtrl {
fun plantsForUser(ctx: Context) {
ctx.json(
Session.currentUserPlants()
)
}
fun create(ctx: Context) {
val ticket = ctx.bodyAsClass<IncomingInventory>()
database.save(ticket)

View File

@ -231,10 +231,10 @@ fun searchIncomingInventory(
): List<IncomingInventory> {
val q = database.find(IncomingInventory::class.java)
.where()
.ge("vendorBillAmount", incomingInventoryFilters.vendorBillAmountExceeds)
.le("vendorBillAmount", incomingInventoryFilters.vendorBillAmountLessThan)
.ilike("mrn", "%" + incomingInventoryFilters.mrnLike + "%")
.ilike("vehicle", "%" + incomingInventoryFilters.vehicleLike + "%")
//.ge("vendorBillAmount", incomingInventoryFilters.vendorBillAmountExceeds)
//.le("vendorBillAmount", incomingInventoryFilters.vendorBillAmountLessThan)
//.ilike("mrn", "%" + incomingInventoryFilters.mrnLike + "%")
//.ilike("vehicle", "%" + incomingInventoryFilters.vehicleLike + "%")
applyFromToHelper(q, commonFilters.from, commonFilters.to, "date")
applyVendorHelper(q, commonFilters.vendor)
applySortHelper(q, commonFilters.sortBy, commonFilters.sortAsc)

View File

@ -182,14 +182,14 @@ object Session {
fun currentTenant() = currentUser.get().tenant
fun currentRoles() = currentUser.get().roles
fun currentToken() = currentUser.get().token
fun currentUserPlants() = currentUser.get().plantIds.map {
Session.database.find(Plant::class.java)
fun currentUserPlants() = currentUser.get().plantIds.mapNotNull {
database.find(Plant::class.java)
.where()
.eq("plantId", it)
.findOne()
}.filterNotNull()
}
fun jwk() = keypair.toParams(JsonWebKey.OutputControlLevel.PUBLIC_ONLY)
fun jwk(): MutableMap<String, Any> = keypair.toParams(JsonWebKey.OutputControlLevel.PUBLIC_ONLY)
fun Database.findDataModelByEntityAndUniqId(entity: String, uniqId: String): DataModel {
return find(DataModel::class.java)

View File

@ -21,7 +21,7 @@
</appender>
<!-- SQL and bind values -->
<logger name="io.ebean.SQL" level="WARN"/>
<logger name="io.ebean.SQL" level="TRACE"/>
<!-- Transaction Commit and Rollback events -->
<logger name="io.ebean.TXN" level="DEBUG"/>