|
@@ -12,6 +12,8 @@ import androidx.recyclerview.widget.ConcatAdapter
|
|
|
import androidx.recyclerview.widget.DiffUtil
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
|
|
+import com.bin.david.form.core.SmartTable
|
|
|
+import com.bin.david.form.data.style.FontStyle
|
|
|
import com.pan_american.android.OASystem
|
|
|
import com.pan_american.android.R
|
|
|
import com.pan_american.android.base.BaseActivity
|
|
@@ -19,12 +21,15 @@ import com.pan_american.android.base.BaseResponse
|
|
|
import com.pan_american.android.base.ListAdapter
|
|
|
import com.pan_american.android.data.model.common.entity.Selector
|
|
|
import com.pan_american.android.data.model.common.entity.SiftListItem
|
|
|
+import com.pan_american.android.data.model.common.network.GroupCostDataRequest
|
|
|
import com.pan_american.android.data.model.common.network.GroupCurrencyRequest
|
|
|
import com.pan_american.android.data.model.common.network.GroupCurrencyResponse
|
|
|
import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.adapter.GroundConveyFooterAdapter
|
|
|
import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.adapter.GroundConveyHeaderAdapter
|
|
|
import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.adapter.GroundConveyTableAdapter
|
|
|
+import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.entity.GroundConveyCost
|
|
|
import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.entity.GroundConveyTableItem
|
|
|
+import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.network.GroundConveyCostDetailResponse
|
|
|
import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.network.GroundConveyPaymentResourceRequest
|
|
|
import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.network.GroundConveyPaymentResponse
|
|
|
import com.pan_american.android.data.model.group_op.ground_convey_payment_insert.network.UpdateGroundConveyDetailRequest
|
|
@@ -86,6 +91,14 @@ class GroundConveyPaymentDetailActivity : BaseActivity<ActivityGroundConveyPayme
|
|
|
|
|
|
private var itemMaxId = 0
|
|
|
|
|
|
+ private var groundConveyCostInit = false
|
|
|
+
|
|
|
+ private var groundConveyCostCurrency = ""
|
|
|
+
|
|
|
+ private var groundConveyCostExchangeRate = 0.0
|
|
|
+
|
|
|
+ private var groundConveyCostList = ArrayList<GroundConveyCost>()
|
|
|
+
|
|
|
override fun getViewBinding() = ActivityGroundConveyPaymentDetailBinding.inflate(layoutInflater)
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
@@ -108,9 +121,77 @@ class GroundConveyPaymentDetailActivity : BaseActivity<ActivityGroundConveyPayme
|
|
|
titleBinding = LayoutTitleBinding.bind(binding.root).apply {
|
|
|
titleText.text = resources.getString(R.string.cost_entry_detail)
|
|
|
|
|
|
+ rightTextField.apply {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ text = resources.getString(R.string.show_cost)
|
|
|
+ }
|
|
|
+
|
|
|
backButton.setOnClickListener {
|
|
|
back()
|
|
|
}
|
|
|
+
|
|
|
+ rightTextField.setOnClickListener {
|
|
|
+
|
|
|
+ val groundConveyCostPopView = View.inflate(OASystem.context, R.layout.popup_cost_table, null)
|
|
|
+ popupWindow = PopupWindow(groundConveyCostPopView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
|
|
+
|
|
|
+ showPopupWindow {
|
|
|
+
|
|
|
+ val currencyAbbr = groundConveyCostPopView.findViewById<TextView>(R.id.currency_abbr)
|
|
|
+ val exchangeRate = groundConveyCostPopView.findViewById<TextView>(R.id.exchange_rate)
|
|
|
+ val hotelCostTable = groundConveyCostPopView.findViewById<SmartTable<GroundConveyCost>>(R.id.table)
|
|
|
+
|
|
|
+ hotelCostTable.config.apply {
|
|
|
+ isShowXSequence = false
|
|
|
+ isShowYSequence = false
|
|
|
+ tableTitleStyle = FontStyle(50, ResourcesCompat.getColor(resources, R.color.text_color, theme))
|
|
|
+ contentStyle = FontStyle(40, ResourcesCompat.getColor(resources, R.color.text_color, theme))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!groundConveyCostInit) {
|
|
|
+ apiService.getGroundConveyCostData(GroupCostDataRequest(groupId, OASystem.C_TABLE_GROUND_CONVEY)).enqueue(object : Callback<GroundConveyCostDetailResponse> {
|
|
|
+ override fun onResponse(
|
|
|
+ call: Call<GroundConveyCostDetailResponse>,
|
|
|
+ response: Response<GroundConveyCostDetailResponse>
|
|
|
+ ) {
|
|
|
+
|
|
|
+ val costResponse = response.body()
|
|
|
+
|
|
|
+ if (costResponse != null) {
|
|
|
+ if (costResponse.code == 200) {
|
|
|
+
|
|
|
+ groundConveyCostCurrency = costResponse.data.modulePromptInfos[0].currencyCode
|
|
|
+ groundConveyCostExchangeRate = costResponse.data.modulePromptInfos[0].rate
|
|
|
+
|
|
|
+ groundConveyCostList = costResponse.data.modulePromptInfos[0].data
|
|
|
+
|
|
|
+ currencyAbbr.text = groundConveyCostCurrency
|
|
|
+ exchangeRate.text = groundConveyCostExchangeRate.toString()
|
|
|
+
|
|
|
+ hotelCostTable.setData(groundConveyCostList)
|
|
|
+
|
|
|
+ groundConveyCostInit = true
|
|
|
+
|
|
|
+ } else {
|
|
|
+ showMessage(costResponse.msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onFailure(call: Call<GroundConveyCostDetailResponse>, t: Throwable) {
|
|
|
+ showErrorInfo(R.string.hotel_cost_detail_get_failed)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ currencyAbbr.text = groundConveyCostCurrency
|
|
|
+ exchangeRate.text = groundConveyCostExchangeRate.toString()
|
|
|
+
|
|
|
+ hotelCostTable.setData(groundConveyCostList)
|
|
|
+ }
|
|
|
+
|
|
|
+ popupWindow.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|