Browse Source

2024-11-19 修改

修改:
1. 团组酒店 - 酒店预订 添加基础数据源
2. 团组酒店 - 酒店预订 新增字段 并 更新UI界面
3. 团组酒店 - 酒店预订 更新增改功能
zhaiy 1 month ago
parent
commit
ed57c38759

+ 3 - 1
app/src/main/java/com/pan_american/android/OASystem.kt

@@ -6,7 +6,6 @@ import android.content.Context
 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.customer_resource.market_sales_revenue.entity.YearQuarterlyData
-import com.pan_american.android.data.model.financial_module.collection_bill.entity.CollectionBillItem
 import com.pan_american.android.data.model.group_hotel.hotel_predetermine.entity.UpdateHotelPredetermine
 import com.pan_american.android.data.model.group_management.group_info.entity.GroupCustomerInfo
 import com.pan_american.android.data.model.group_management.group_info.network.GroupOperationRequest
@@ -105,6 +104,9 @@ class OASystem : Application() {
         //酒店费用录入,客人名单
         var hotelPredetermineCustomerList = ArrayList<Selector>()
 
+        //酒店费用录入,国家 / 城市
+        var hotelPredetermineCountries = ArrayList<Selector>()
+
         //酒店费用录入,费用操作(增改)request
         lateinit var hotelPredetermineRequest: UpdateHotelPredetermine
 

+ 3 - 0
app/src/main/java/com/pan_american/android/data/model/group_hotel/hotel_predetermine/entity/UpdateHotelPredetermine.kt

@@ -16,6 +16,9 @@ class UpdateHotelPredetermine {
     var reservationsWebsite = 0
     var reservationsNo = ""
     var determineNo = ""
+
+    var areaId = 0
+
     var city = ""
     var hotelName = ""
     var hotelTel = ""

+ 11 - 3
app/src/main/java/com/pan_american/android/data/model/group_hotel/hotel_predetermine/network/HotelPredetermineResourceResponse.kt

@@ -3,9 +3,17 @@ package com.pan_american.android.data.model.group_hotel.hotel_predetermine.netwo
 import com.pan_american.android.base.BaseResponse
 import com.pan_american.android.data.model.common.entity.Selector
 
-class HotelPredetermineResourceResponse(val data: Data): BaseResponse() {
+class HotelPredetermineResourceResponse(val data: Data) : BaseResponse() {
 
-    inner class Data (val guestType: ArrayList<Selector>, val payment: ArrayList<Selector>, val currencyList: ArrayList<Selector>,
-                      val bankCard: ArrayList<Selector>, val bookingWebsite: ArrayList<Selector>, val checkPerson: ArrayList<Selector>, val guestName: ArrayList<Selector>)
+    inner class Data(
+        val guestType: ArrayList<Selector>,
+        val payment: ArrayList<Selector>,
+        val currencyList: ArrayList<Selector>,
+        val bankCard: ArrayList<Selector>,
+        val bookingWebsite: ArrayList<Selector>,
+        val checkPerson: ArrayList<Selector>,
+        val guestName: ArrayList<Selector>,
+        val countrys: ArrayList<Selector>
+    )
 
 }

+ 0 - 4
app/src/main/java/com/pan_american/android/ui/financial_module/collection_bill/AddCollectionBillPaymentActivity.kt

@@ -3,7 +3,6 @@ package com.pan_american.android.ui.financial_module.collection_bill
 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.widget.EditText
@@ -13,7 +12,6 @@ import android.widget.TextView
 import androidx.core.content.res.ResourcesCompat
 import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
-import com.google.gson.Gson
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseActivity
@@ -433,8 +431,6 @@ class AddCollectionBillPaymentActivity : BaseActivity<ActivityAddCollectionBillP
             }
         }
 
-        Log.e("request", Gson().toJson(updateCollectionBillRequest))
-
         apiService.updateCollectionBillPayment(updateCollectionBillRequest).enqueue(object : Callback<BaseResponse> {
             override fun onResponse(p0: Call<BaseResponse>, response: Response<BaseResponse>) {
 

+ 5 - 0
app/src/main/java/com/pan_american/android/ui/group_hotel/hotel_predetermine/AddHotelPredetermineActivity.kt

@@ -100,6 +100,7 @@ class AddHotelPredetermineActivity : BaseActivity<ActivityAddHotelPredetermineBi
         OASystem.hotelPredetermineHotelWebSite.clear()
         OASystem.hotelPredetermineCheckInType.clear()
         OASystem.hotelPredetermineCustomerList.clear()
+        OASystem.hotelPredetermineCountries.clear()
 
         getSelectorResource()
     }
@@ -249,6 +250,10 @@ class AddHotelPredetermineActivity : BaseActivity<ActivityAddHotelPredetermineBi
                                 OASystem.hotelPredetermineCustomerList.add(item)
                             }
 
+                            for (item in resourceResponse.data.countrys) {
+                                OASystem.hotelPredetermineCountries.add(item)
+                            }
+
                             if (fromList) {
                                 getHotelPredetermineDetail()
                             } else {

+ 134 - 0
app/src/main/java/com/pan_american/android/ui/group_hotel/hotel_predetermine/HotelPredetermineBaseFragment.kt

@@ -1,12 +1,19 @@
 package com.pan_american.android.ui.group_hotel.hotel_predetermine
 
 import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.Gravity
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import android.widget.EditText
+import android.widget.LinearLayout
+import android.widget.PopupWindow
 import android.widget.TextView
 import androidx.core.content.res.ResourcesCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseFragment
@@ -37,6 +44,10 @@ class HotelPredetermineBaseFragment : BaseFragment<FragmentHotelPredetermineBase
 
     private var groupId = 0
 
+    private var countryId = 0
+
+    private var countrySelected = false
+
     private var customerTypeId = 0
 
     private var customerTypeSelect = false
@@ -115,6 +126,19 @@ class HotelPredetermineBaseFragment : BaseFragment<FragmentHotelPredetermineBase
 
                 binding.hotelConfirmCode.setText(determineNo)
 
+                run {
+                    for (item in OASystem.hotelPredetermineCountries) {
+                        if (item.id == areaId) {
+                            binding.area.text = String.format(resources.getString(R.string.during_format), item.country, item.city)
+
+                            countryId = item.id
+                            countrySelected
+
+                            return@run
+                        }
+                    }
+                }
+
                 binding.locatedCity.setText(city)
 
                 binding.hotelName.setText(hotelName)
@@ -279,6 +303,110 @@ class HotelPredetermineBaseFragment : BaseFragment<FragmentHotelPredetermineBase
             }
         }
 
+        binding.area.setOnClickListener {
+            val selectorList = ArrayList<Selector>()
+
+            for (item in OASystem.hotelPredetermineCountries) {
+                selectorList.add(item)
+            }
+
+            val popView = View.inflate(OASystem.context, R.layout.popup_smart_refresh_selector, null)
+            popupWindow = PopupWindow(popView, RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT)
+
+            showPopupWindow {
+
+                val searchView: LinearLayout = popView.findViewById(R.id.search_view)
+                searchView.visibility = View.VISIBLE
+
+                val searchText: EditText = popView.findViewById(R.id.search_text)
+
+                selector = popView.findViewById(R.id.selector_list)
+
+                selectorContainer = popView.findViewById(R.id.selector_refresh_container)
+                selectorContainer.setEnableRefresh(false)
+                selectorContainer.setEnableLoadMore(false)
+
+                val layoutManager = LinearLayoutManager(OASystem.context)
+                selector.layoutManager = layoutManager
+
+                val adapter = ListAdapter.Builder<Selector>().apply {
+                    setData(selectorList)
+                    setLayoutId(R.layout.item_selector)
+                    addBindView { itemView, data ->
+                        itemView.findViewById<TextView>(R.id.selector_item_name).apply {
+                            text = String.format(resources.getString(R.string.during_format), data.country, data.city)
+
+                            if (countryId == data.id) {
+                                setTextColor(ResourcesCompat.getColor(resources, R.color.text_color_blue, null))
+                            } else {
+                                setTextColor(ResourcesCompat.getColor(resources, R.color.text_color, null))
+                            }
+                        }
+                    }
+                }.create()
+
+                selector.adapter = adapter
+
+                adapter.onRecyclerViewItemClick =
+                    object : ListAdapter.OnRecyclerViewItemClick<Selector> {
+                        override fun onItemClick(position: Int) {
+                            selectorList[position].apply {
+                                binding.area.text = String.format(resources.getString(R.string.during_format), country, city)
+                                binding.locatedCity.setText(city)
+
+                                countryId = id
+                                countrySelected = true
+
+                                popupWindow.dismiss()
+                            }
+                        }
+                    }
+
+                searchText.addTextChangedListener(object : TextWatcher {
+                    override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+
+                    }
+
+                    override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
+
+                    }
+
+                    override fun afterTextChanged(editable: Editable?) {
+
+                        adapter.notifyItemRangeRemoved(0, selectorList.size)
+
+                        selectorList.clear()
+
+                        if (editable.isNullOrBlank()) {
+
+                            for (item in OASystem.hotelPredetermineCountries) {
+                                selectorList.add(item)
+                            }
+
+                        } else {
+                            for (i in 0 until OASystem.hotelPredetermineCountries.size) {
+                                OASystem.hotelPredetermineCountries[i].apply {
+                                    if (country.contains(editable) || city.contains(editable)) {
+                                        selectorList.add(this)
+                                    }
+                                }
+                            }
+                        }
+
+                        if (selectorList.size == 0) {
+                            showMessage(resources.getString(R.string.no_data))
+                        } else {
+                            for (i in 0 until selectorList.size) {
+                                adapter.notifyItemInserted(i)
+                            }
+                        }
+                    }
+                })
+
+                popupWindow.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0)
+            }
+        }
+
         binding.addCustomer.setOnClickListener {
             showSelector {
                 val adapter = ListAdapter.Builder<Selector>().apply {
@@ -503,6 +631,11 @@ class HotelPredetermineBaseFragment : BaseFragment<FragmentHotelPredetermineBase
                     return false
                 }
 
+                !countrySelected -> {
+                    showMessage(resources.getString(R.string.area_select_hint))
+                    return false
+                }
+
                 binding.locatedCity.text.isNullOrBlank() -> {
                     showMessage(resources.getString(R.string.hotel_located_input_hint))
                     return false
@@ -555,6 +688,7 @@ class HotelPredetermineBaseFragment : BaseFragment<FragmentHotelPredetermineBase
                         gtId = customerTypeId
                         reservationsWebsite = websiteId
                         determineNo = binding.hotelConfirmCode.getText()
+                        areaId = countryId
                         city = binding.locatedCity.text.toString()
                         hotelName = binding.hotelName.text.toString()
                         hotelTel = binding.hotelTel.text.toString()

+ 36 - 0
app/src/main/res/layout/fragment_hotel_predetermine_base.xml

@@ -277,6 +277,42 @@
                     android:layout_marginTop="@dimen/common_padding" />
             </LinearLayout>
 
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/line"
+                android:layout_marginTop="@dimen/common_padding"
+                android:layout_marginBottom="@dimen/common_padding"
+                android:background="@color/line_color" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="@dimen/common_padding"
+                android:layout_marginBottom="@dimen/common_padding"
+                android:orientation="horizontal">
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:text="@string/area"
+                    android:textSize="@dimen/text_size_medium" />
+
+                <TextView
+                    android:id="@+id/area"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/common_padding"
+                    android:layout_weight="1"
+                    android:background="@color/white"
+                    android:gravity="end"
+                    android:hint="@string/please_select"
+                    android:singleLine="true"
+                    android:textColor="@color/text_color"
+                    android:textColorHint="@color/hint_text_color"
+                    android:textSize="@dimen/text_size_medium" />
+            </LinearLayout>
+
             <View
                 android:layout_width="match_parent"
                 android:layout_height="@dimen/line"