Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Fixes #FINCN-326 Create, update, list tellers and Teller Details implemented #189

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,16 @@

<activity android:name=".ui.online.groups.groupdetails.GroupDetailsActivity" />

<activity android:name=".ui.online.teller.tellerdetails.TellerDetailsActivity" />

<activity
android:name=".ui.online.groups.creategroup.CreateGroupActivity"
android:windowSoftInputMode="adjustResize|stateHidden" />

<activity
android:name=".ui.online.teller.createteller.CreateTellerActivity"
android:windowSoftInputMode="adjustResize|stateHidden" />

<receiver
android:name=".jobs.JobsReceiver"
android:exported="false">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.apache.fineract.data.datamanager

import io.reactivex.Completable
import io.reactivex.Observable
import io.reactivex.ObservableSource
import io.reactivex.functions.Function
Expand All @@ -10,6 +11,7 @@ import javax.inject.Inject
import org.apache.fineract.FakeRemoteDataSource
import org.apache.fineract.data.datamanager.api.DataManagerAuth
import org.apache.fineract.data.datamanager.api.FineractBaseDataManager
import org.apache.fineract.data.models.teller.TellerCommand
import javax.inject.Singleton

@Singleton
Expand All @@ -27,4 +29,14 @@ class DataManagerTeller @Inject constructor(val baseManagerApi: BaseApiManager,
.searchTeller(preferencesHelper.tenantIdentifier, tellerCode)
.onErrorResumeNext(Function<Throwable, ObservableSource<Teller>>
{ Observable.just(FakeRemoteDataSource.getTeller()[0]) })

fun createTeller(teller: Teller): Completable =
baseManagerApi.tellerService.createTeller(preferencesHelper.tenantIdentifier, teller)

fun updateTeller(teller: Teller): Completable =
baseManagerApi.tellerService.updateTeller(preferencesHelper.tenantIdentifier, teller.tellerAccountIdentifier!!, teller)

fun changeTellerStatus(teller: Teller, tellerCommand: TellerCommand): Completable =
baseManagerApi.tellerService.changeTellerStatus(preferencesHelper.tenantIdentifier, teller.tellerAccountIdentifier!!, tellerCommand)

}
32 changes: 16 additions & 16 deletions app/src/main/java/org/apache/fineract/data/models/teller/Teller.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import java.math.BigDecimal
@Parcelize
data class Teller(

@SerializedName("code") val code: String? = null,
@SerializedName("password") val password: String? = null,
@SerializedName("cashdrawLimit") val cashdrawLimit: BigDecimal? = null,
@SerializedName("tellerAccountIdentifier") val tellerAccountIdentifier: String? = null,
@SerializedName("vaultAccountIdentifier") val vaultAccountIdentifier: String? = null,
@SerializedName("chequesReceivableAccount") val chequesReceivableAccount: String? = null,
@SerializedName("cashOverShortAccount") val cashOverShortAccount: String? = null,
@SerializedName("denominationRequired") val denominationRequired: Boolean = false,
@SerializedName("assignedEmployee") val assignedEmployee: String? = null,
@SerializedName("state") val state: State? = null,
@SerializedName("createdBy") val createdBy: String? = null,
@SerializedName("createdOn") val createdOn: String? = null,
@SerializedName("lastModifiedBy") val lastModifiedBy: String? = null,
@SerializedName("lastModifiedOn") val lastModifiedOn: String? = null,
@SerializedName("lastOpenedBy") val lastOpenedBy: String? = null,
@SerializedName("lastOpenedOn") val lastOpenedOn: String? = null
@SerializedName("code") var code: String? = null,
@SerializedName("password") var password: String? = null,
@SerializedName("cashdrawLimit") var cashdrawLimit: BigDecimal? = null,
@SerializedName("tellerAccountIdentifier") var tellerAccountIdentifier: String? = null,
@SerializedName("vaultAccountIdentifier") var vaultAccountIdentifier: String? = null,
@SerializedName("chequesReceivableAccount") var chequesReceivableAccount: String? = null,
@SerializedName("cashOverShortAccount") var cashOverShortAccount: String? = null,
@SerializedName("denominationRequired") var denominationRequired: Boolean = false,
@SerializedName("assignedEmployee") var assignedEmployee: String? = null,
@SerializedName("state") var state: State? = null,
@SerializedName("createdBy") var createdBy: String? = null,
@SerializedName("createdOn") var createdOn: String? = null,
@SerializedName("lastModifiedBy") var lastModifiedBy: String? = null,
@SerializedName("lastModifiedOn") var lastModifiedOn: String? = null,
@SerializedName("lastOpenedBy") var lastOpenedBy: String? = null,
@SerializedName("lastOpenedOn") var lastOpenedOn: String? = null

) : Parcelable {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.apache.fineract.data.models.teller

import com.google.gson.annotations.SerializedName

data class TellerCommand (
@SerializedName("action") var action: String? = null,
@SerializedName("adjustment") var adjustment: String? = "NONE",
@SerializedName("assignedEmployeeIdentifier") var assignedEmployeeIdentifier: String? = null
) {
enum class TellerAction {

@SerializedName("CLOSE")
CLOSE,

@SerializedName("ACTIVATE")
ACTIVATE,

@SerializedName("REOPEN")
REOPEN,

}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.apache.fineract.data.services

import io.reactivex.Completable
import io.reactivex.Observable
import org.apache.fineract.data.models.teller.Teller
import org.apache.fineract.data.models.teller.TellerCommand
import org.apache.fineract.data.remote.EndPoints
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.*

interface TellersService {

Expand All @@ -14,4 +15,19 @@ interface TellersService {
@GET(EndPoints.API_TELLER_PATH + "/offices/{officeIdentifier}/teller/{tellerCode}")
fun searchTeller(@Path("officeIdentifier") officeIdentifier: String,
@Path("tellerCode") tellerCode: String): Observable<Teller>

@POST(EndPoints.API_TELLER_PATH + "/offices/{officeIdentifier}/teller")
fun createTeller(@Path("officeIdentifier") officeIdentifier: String,
@Body teller: Teller): Completable

@PUT(EndPoints.API_TELLER_PATH + "/offices/{officeIdentifier}/teller/{tellerIdentifier}")
fun updateTeller(@Path("officeIdentifier") officeIdentifier: String,
@Path("tellerIdentifier") tellerIdentifier: String,
@Body teller: Teller): Completable

@POST(EndPoints.API_TELLER_PATH + "/offices/{officeIdentifier}/teller/{tellerIdentifier}/commands")
fun changeTellerStatus(@Path("officeIdentifier") officeIdentifier: String,
@Path("tellerIdentifier") tellerIdentifier: String,
@Body tellerCommand: TellerCommand): Completable

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
import org.apache.fineract.ui.online.review.AddLoanReviewFragment;
import org.apache.fineract.ui.online.roles.roleslist.RolesFragment;
import org.apache.fineract.ui.online.teller.TellerFragment;
import org.apache.fineract.ui.online.teller.createteller.CreateTellerActivity;
import org.apache.fineract.ui.online.teller.createteller.TellerDetailsStepFragment;
import org.apache.fineract.ui.online.teller.createteller.TellerReviewStepFragment;
import org.apache.fineract.ui.online.teller.tellerdetails.TellerDetailsFragment;
import org.apache.fineract.ui.online.teller.tellertasks.TellerTasksBottomSheetFragment;
import org.apache.fineract.ui.product.ProductFragment;

import dagger.Subcomponent;
Expand Down Expand Up @@ -159,5 +164,15 @@ public interface ActivityComponent {
void inject(GroupDetailsFragment groupDetailsFragment);

void inject(GroupTasksBottomSheetFragment groupTasksBottomSheetFragment);

void inject(TellerDetailsFragment tellerDetailsFragment);

void inject(CreateTellerActivity createTellerActivity);

void inject(TellerDetailsStepFragment tellerDetailsStepFragment);

void inject(TellerReviewStepFragment tellerReviewStepFragment);

void inject(TellerTasksBottomSheetFragment tellerTasksBottomSheetFragment);
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import kotlinx.android.synthetic.main.item_teller.view.*
import org.apache.fineract.R
import org.apache.fineract.data.models.teller.Teller
import org.apache.fineract.injection.ApplicationContext
import org.apache.fineract.ui.base.OnItemClickListener
import org.apache.fineract.utils.DateUtils
import org.apache.fineract.utils.StatusUtils
import javax.inject.Inject
Expand All @@ -20,6 +22,7 @@ class TellerAdapter @Inject constructor(@ApplicationContext val context: Context
: RecyclerView.Adapter<TellerAdapter.ViewHolder>() {

var tellers: List<Teller> = ArrayList()
lateinit var onItemClickListener: OnItemClickListener

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_teller,
Expand Down Expand Up @@ -56,12 +59,27 @@ class TellerAdapter @Inject constructor(@ApplicationContext val context: Context
notifyDataSetChanged()
}

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
fun setItemClickListener(onItemClickListener: OnItemClickListener) {
this.onItemClickListener = onItemClickListener
}

inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), View.OnClickListener {

val llTeller: LinearLayout = itemView.ll_teller
val tellerIdentifier: TextView = itemView.tv_teller_identifier
val tvModifiedBy: TextView = itemView.tv_modified_by
val tvModifiedOn: TextView = itemView.tv_modified_on
val withDrawLimit: TextView = itemView.tv_cashWithdraw_limit
val statusIndicator: AppCompatImageView = itemView.iv_status_indicator

init {
llTeller.setOnClickListener(this)
}

override fun onClick(v: View?) {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(v, adapterPosition)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.apache.fineract.ui.online.teller

enum class TellerAction {
EDIT,
CREATE
}

This file was deleted.

Loading