| 
					
				 | 
			
			
				@@ -3,10 +3,17 @@ package com.pan_american.android.ui.group_hotel.hotel_predetermine 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.os.Bundle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.text.Editable 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.text.TextWatcher 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.util.Log 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.view.Gravity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.view.View 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.view.ViewGroup 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.widget.PopupWindow 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.widget.TextView 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import androidx.core.content.res.ResourcesCompat 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import androidx.recyclerview.widget.LinearLayoutManager 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.bin.david.form.core.SmartTable 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.bin.david.form.data.style.FontStyle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.google.gson.Gson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.OASystem 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.R 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.base.BaseActivity 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -15,9 +22,12 @@ import com.pan_american.android.base.CardAdapter 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.base.CustomAlertDialog 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 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.network.GroupCostDataRequest 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.pan_american.android.data.model.group_hotel.hotel_payment_insert.entity.HotelCost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.data.model.group_hotel.hotel_payment_insert.entity.UpdateHotelPredetermine 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.data.model.group_hotel.hotel_payment_insert.network.GetHotelPredetermineDetailRequest 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.data.model.group_hotel.hotel_payment_insert.network.GetHotelPredetermineDetailResponse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.pan_american.android.data.model.group_hotel.hotel_payment_insert.network.HotelCostDetailResponse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.data.model.group_hotel.hotel_payment_insert.network.HotelPredetermineResourceRequest 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.data.model.group_hotel.hotel_payment_insert.network.HotelPredetermineResourceResponse 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.pan_american.android.data.network.APIService 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,6 +178,14 @@ class AddHotelPredetermineActivity : BaseActivity<ActivityAddHotelPredetermineBi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private var isAuditGM = -1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private var hotelCostInit = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private var hotelCostCurrency = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private var hotelCostExchangeRate = 0.0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private var hotelCostList = ArrayList<HotelCost>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     override fun getViewBinding() = ActivityAddHotelPredetermineBinding.inflate(layoutInflater) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     override fun onCreate(savedInstanceState: Bundle?) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -204,9 +222,79 @@ class AddHotelPredetermineActivity : BaseActivity<ActivityAddHotelPredetermineBi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 binding.commit.setText(resources.getString(R.string.add)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            rightTextField.apply { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                visibility = View.VISIBLE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                text = resources.getString(R.string.show_cost) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             backButton.setOnClickListener { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 back() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            rightTextField.setOnClickListener { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                val hotelCostPopView = View.inflate(OASystem.context, R.layout.popup_hotel_cost, null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                popupWindow = PopupWindow(hotelCostPopView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                showPopupWindow { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    val currencyAbbr = hotelCostPopView.findViewById<TextView>(R.id.currency_abbr) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    val exchangeRate = hotelCostPopView.findViewById<TextView>(R.id.exchange_rate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    val hotelCostTable = hotelCostPopView.findViewById<SmartTable<HotelCost>>(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 (!hotelCostInit) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        apiService.getGroupHotelCostData(GroupCostDataRequest(groupId, OASystem.C_TABLE_HOTEL_PREDETERMINE)).enqueue(object : Callback<HotelCostDetailResponse> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            override fun onResponse( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                call: Call<HotelCostDetailResponse>, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                response: Response<HotelCostDetailResponse> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                Log.e("request", Gson().toJson(GroupCostDataRequest(groupId, OASystem.C_TABLE_HOTEL_PREDETERMINE))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                val costResponse = response.body() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (costResponse != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (costResponse.code == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        hotelCostCurrency = costResponse.data.modulePromptInfos[0].currencyCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        hotelCostExchangeRate = costResponse.data.modulePromptInfos[0].rate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        hotelCostList = costResponse.data.modulePromptInfos[0].data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        currencyAbbr.text = hotelCostCurrency 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        exchangeRate.text = hotelCostExchangeRate.toString() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        hotelCostTable.setData(hotelCostList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        hotelCostInit = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        showMessage(costResponse.msg) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            override fun onFailure(call: Call<HotelCostDetailResponse>, t: Throwable) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                showErrorInfo(R.string.hotel_cost_detail_get_failed) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        currencyAbbr.text = hotelCostCurrency 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        exchangeRate.text = hotelCostExchangeRate.toString() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        hotelCostTable.setData(hotelCostList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    popupWindow.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |