refudn list
This commit is contained in:
parent
efb0c76f69
commit
f142df0144
33
.idea/.gitignore
vendored
33
.idea/.gitignore
vendored
@ -1,33 +0,0 @@
|
|||||||
# Built files
|
|
||||||
*.apk
|
|
||||||
*.aab
|
|
||||||
*.dex
|
|
||||||
*.class
|
|
||||||
|
|
||||||
# Gradle
|
|
||||||
.gradle/
|
|
||||||
build/
|
|
||||||
*/build/
|
|
||||||
|
|
||||||
**/build/
|
|
||||||
**/build/**
|
|
||||||
**/.transforms/
|
|
||||||
**/intermediates/
|
|
||||||
**/tmp/
|
|
||||||
paysdk-lib/build/
|
|
||||||
|
|
||||||
# Android Studio
|
|
||||||
*.iml
|
|
||||||
.idea/
|
|
||||||
local.properties
|
|
||||||
|
|
||||||
# Keystore
|
|
||||||
*.jks
|
|
||||||
*.keystore
|
|
||||||
|
|
||||||
# OS files
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
# Logs
|
|
||||||
*.log
|
|
||||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="17" />
|
<bytecodeTargetLevel target="21" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -4,14 +4,6 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2025-10-28T19:40:02.148831Z">
|
|
||||||
<Target type="DEFAULT_BOOT">
|
|
||||||
<handle>
|
|
||||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=0123456789ABCDEF" />
|
|
||||||
</handle>
|
|
||||||
</Target>
|
|
||||||
</DropdownSelection>
|
|
||||||
<DialogSelection />
|
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DeviceTable">
|
|
||||||
<option name="columnSorters">
|
|
||||||
<list>
|
|
||||||
<ColumnSorterState>
|
|
||||||
<option name="column" value="Name" />
|
|
||||||
<option name="order" value="ASCENDING" />
|
|
||||||
</ColumnSorterState>
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="temurin-17" />
|
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectMigrations">
|
|
||||||
<option name="MigrateToGradleLocalJavaHome">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -1,9 +1,4 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK" />
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
</project>
|
||||||
@ -40,6 +40,9 @@ android {
|
|||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
debug {
|
||||||
|
debuggable true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package com.utsmm.kbz.ui.qr_pay;
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.databinding.DataBindingUtil;
|
import androidx.databinding.DataBindingUtil;
|
||||||
@ -20,8 +18,8 @@ public class QRHistoryAdapter extends RecyclerView.Adapter<QRHistoryAdapter.View
|
|||||||
|
|
||||||
private List<PayDetail> items = new ArrayList<>();
|
private List<PayDetail> items = new ArrayList<>();
|
||||||
|
|
||||||
public void setItems(List<PayDetail> list){
|
public void setItems(List<PayDetail> data){
|
||||||
items = list;
|
items = data;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package com.utsmm.kbz.ui.qr_pay;
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|||||||
@ -16,14 +16,20 @@ import dagger.hilt.android.lifecycle.HiltViewModel;
|
|||||||
public class QRHistoryViewModel extends ViewModel {
|
public class QRHistoryViewModel extends ViewModel {
|
||||||
private final Repository repository;
|
private final Repository repository;
|
||||||
private final LiveData<List<PayDetail>> history;
|
private final LiveData<List<PayDetail>> history;
|
||||||
|
private final LiveData<List<PayDetail>> refundList;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public QRHistoryViewModel(Repository repository){
|
public QRHistoryViewModel(Repository repository){
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
this.history = repository.getAllQRHistory();
|
this.history = repository.getAllQRHistory();
|
||||||
|
this.refundList = repository.getRefundableQRHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<List<PayDetail>> getAllQrHistory(){
|
public LiveData<List<PayDetail>> getAllQrHistory(){
|
||||||
return history;
|
return history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getRefundableQrHistory(){
|
||||||
|
return refundList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import com.utsmm.kbz.R;
|
|||||||
import com.utsmm.kbz.config.Constants;
|
import com.utsmm.kbz.config.Constants;
|
||||||
import com.utsmm.kbz.ui.adapters.QRPayAdapter;
|
import com.utsmm.kbz.ui.adapters.QRPayAdapter;
|
||||||
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||||
|
import com.utsmm.kbz.ui.management.ManagementViewModel;
|
||||||
|
import com.utsmm.kbz.ui.settlement.SettlementViewModel;
|
||||||
import com.utsmm.kbz.util.Connectivity;
|
import com.utsmm.kbz.util.Connectivity;
|
||||||
import com.utsmm.kbz.util.tms.TMSUtil;
|
import com.utsmm.kbz.util.tms.TMSUtil;
|
||||||
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
@ -18,6 +20,7 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
|||||||
import com.utsmyanmar.paylibs.utils.POSUtil;
|
import com.utsmyanmar.paylibs.utils.POSUtil;
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation;
|
||||||
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
import com.utsmyanmar.paylibs.utils.enums.CurrencyType;
|
||||||
|
import com.utsmyanmar.paylibs.utils.enums.HostType;
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -27,15 +30,16 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
private MainViewModel mainViewModel;
|
private MainViewModel mainViewModel;
|
||||||
private SharedViewModel sharedViewModel;
|
private SharedViewModel sharedViewModel;
|
||||||
|
private SettlementViewModel settlementViewModel;
|
||||||
|
private ManagementViewModel managementViewModel;
|
||||||
private static final int hostId = Constants.NAV_HOST_ID;
|
private static final int hostId = Constants.NAV_HOST_ID;
|
||||||
private int routeId;
|
private int routeId;
|
||||||
private static final int currentId = R.id.dashboardTransFragment;
|
private static final int currentId = R.id.qrFragment;
|
||||||
|
|
||||||
public static QRPayFragment newInstance() {
|
public static QRPayFragment newInstance() {
|
||||||
return new QRPayFragment();
|
return new QRPayFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
private QRPayViewModel vm;
|
|
||||||
private Observer<PayDetail> observeLastTrans;
|
private Observer<PayDetail> observeLastTrans;
|
||||||
private PayDetail lastPay;
|
private PayDetail lastPay;
|
||||||
|
|
||||||
@ -47,9 +51,11 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initViewModel() {
|
protected void initViewModel() {
|
||||||
vm = new ViewModelProvider(this).get(QRPayViewModel.class);
|
|
||||||
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
mainViewModel = new ViewModelProvider(requireActivity()).get(MainViewModel.class);
|
||||||
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
settlementViewModel = getFragmentScopeViewModel(SettlementViewModel.class);
|
||||||
|
managementViewModel = getFragmentScopeViewModel(ManagementViewModel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +74,7 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
onClickQRPay();
|
onClickQRPay();
|
||||||
break;
|
break;
|
||||||
case "Refund":
|
case "Refund":
|
||||||
|
onClickRefund();
|
||||||
break;
|
break;
|
||||||
case "History":
|
case "History":
|
||||||
onClickHistory();
|
onClickHistory();
|
||||||
@ -76,7 +82,7 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
DataBindingConfig config = new DataBindingConfig(R.layout.fragment_qr_pay, BR.vm, vm);
|
DataBindingConfig config = new DataBindingConfig(R.layout.fragment_qr_pay, BR.mainViewModel, mainViewModel);
|
||||||
config.addBindingParam(BR.adapter, adapter);
|
config.addBindingParam(BR.adapter, adapter);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -386,6 +392,13 @@ public class QRPayFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onClickHistory(){
|
private void onClickHistory(){
|
||||||
NavHostFragment.findNavController(this).navigate(R.id.action_qrFragment_to_qrHistory);
|
sharedViewModel.hostType.setValue(HostType.QR);
|
||||||
|
routeId = R.id.action_qrFragment_to_qrHistory;
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onClickRefund(){
|
||||||
|
routeId = R.id.action_qrFragment_to_qr_refund_list;
|
||||||
|
safeNavigateToRouteId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,17 +1,30 @@
|
|||||||
package com.utsmm.kbz.ui.qr_pay;
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
import com.utsmyanmar.baselib.repo.Repository;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel;
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
public class QRPayViewModel extends ViewModel {
|
public class QRPayViewModel extends ViewModel {
|
||||||
public void generateQR(){
|
|
||||||
|
|
||||||
|
private final Repository repository;
|
||||||
|
private final LiveData<List<PayDetail>> refundableHistory;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public QRPayViewModel(Repository repository){
|
||||||
|
this.repository = repository;
|
||||||
|
this.refundableHistory = repository.getRefundableQRHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refundQR(){
|
public LiveData<List<PayDetail>> getRefundableQrHistory(){
|
||||||
|
return refundableHistory;
|
||||||
}
|
|
||||||
|
|
||||||
public void historyQR(){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.BR;
|
||||||
|
import com.utsmm.kbz.R;
|
||||||
|
import com.utsmm.kbz.config.Constants;
|
||||||
|
import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||||
|
import com.utsmyanmar.baselib.fragment.DataBindingFragment;
|
||||||
|
import com.utsmyanmar.baselib.util.DataBindingConfig;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class QRRefundFragment extends DataBindingFragment {
|
||||||
|
|
||||||
|
private static final int hostId = Constants.NAV_HOST_ID;
|
||||||
|
private int routeId;
|
||||||
|
private static final int currentId = R.id.qrRefundList;
|
||||||
|
private QRPayViewModel qrPayViewModel;
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
private QRRefundViewAdapter adapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int currentId() {
|
||||||
|
return currentId;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected int hostId() {return hostId;}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int routeId() {return routeId;}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initViewModel() {
|
||||||
|
sharedViewModel = getFragmentScopeViewModel(SharedViewModel.class);
|
||||||
|
qrPayViewModel = getFragmentScopeViewModel(QRPayViewModel.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DataBindingConfig getDataBindingConfig() {
|
||||||
|
adapter = new QRRefundViewAdapter();
|
||||||
|
return new DataBindingConfig(R.layout.fragment_qr_refund, BR.sharedViewModel, sharedViewModel).addBindingParam(BR.adapter, adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
setToolBarTitleWithBackIcon("Refund");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState){
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
RecyclerView recyclerView = view.findViewById(R.id.qrRefundHistory);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||||
|
recyclerView.setAdapter(adapter);
|
||||||
|
observeData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void observeData(){
|
||||||
|
qrPayViewModel.getRefundableQrHistory().observe(getViewLifecycleOwner(), this::updateList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateList(List<PayDetail> list){
|
||||||
|
if(list == null || list.isEmpty()){
|
||||||
|
showSingleInfoDialog("No data test");
|
||||||
|
adapter.setData(null);
|
||||||
|
}else{
|
||||||
|
adapter.setData(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ClickEvent {
|
||||||
|
public void onCancel(){
|
||||||
|
safeNavigateToRouteId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
package com.utsmm.kbz.ui.qr_pay;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.utsmm.kbz.BR;
|
||||||
|
import com.utsmm.kbz.R;
|
||||||
|
import com.utsmm.kbz.databinding.ItemQrRefundBinding;
|
||||||
|
import com.utsmyanmar.paylibs.model.PayDetail;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class QRRefundViewAdapter extends RecyclerView.Adapter<QRRefundViewAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<PayDetail> payDetailList = new ArrayList<>();
|
||||||
|
|
||||||
|
public QRRefundViewAdapter(){}
|
||||||
|
public QRRefundViewAdapter(List<PayDetail> payDetailList){
|
||||||
|
this.payDetailList = payDetailList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<PayDetail> data){
|
||||||
|
if(data == null) return;
|
||||||
|
payDetailList.clear();
|
||||||
|
payDetailList.addAll(data);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
ItemQrRefundBinding binding = DataBindingUtil.inflate(
|
||||||
|
LayoutInflater.from(parent.getContext()),
|
||||||
|
R.layout.item_qr_refund,
|
||||||
|
parent,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
return new ViewHolder(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
PayDetail payDetail = payDetailList.get(position);
|
||||||
|
holder.bind(payDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return payDetailList == null ? 0 : payDetailList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private final ItemQrRefundBinding binding;
|
||||||
|
|
||||||
|
public ViewHolder(ItemQrRefundBinding binding){
|
||||||
|
super(binding.getRoot());
|
||||||
|
this.binding = binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bind(Object object){
|
||||||
|
binding.setVariable(BR.payDetail, object);
|
||||||
|
binding.executePendingBindings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,10 +6,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
<variable
|
|
||||||
name="vm"
|
|
||||||
type="com.utsmm.kbz.ui.qr_pay.QRPayViewModel" />
|
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="adapter"
|
name="adapter"
|
||||||
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
||||||
|
|||||||
44
app/src/main/res/layout/fragment_qr_refund.xml
Normal file
44
app/src/main/res/layout/fragment_qr_refund.xml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:bind="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<variable
|
||||||
|
name="sharedViewModel"
|
||||||
|
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
|
||||||
|
<variable
|
||||||
|
name="adapter"
|
||||||
|
type="androidx.recyclerview.widget.RecyclerView.Adapter" />
|
||||||
|
|
||||||
|
<!-- Optional: Click handler class (if you want Cancel button or click events) -->
|
||||||
|
<!-- <variable-->
|
||||||
|
<!-- name="click"-->
|
||||||
|
<!-- type="com.utsmm.kbz.ui.qr_pay.QRRefundListFragment.ClickEvent" />-->
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- RecyclerView showing refund history -->
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/qrRefundHistory"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
bind:setAdapter="@{adapter}"
|
||||||
|
tools:listitem="@layout/item_qr_refund" />
|
||||||
|
<!-- Optional empty view (you can control visibility with ViewModel vars) -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtNoData"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="Not Records To Display"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="#888"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</layout>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
android:layout_marginVertical="6dp"
|
android:layout_marginVertical="6dp"
|
||||||
app:cardCornerRadius="12dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
app:cardBackgroundColor="@color/white"
|
app:cardBackgroundColor="@color/colorPrimary"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
@ -41,7 +41,7 @@
|
|||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:src="@drawable/ic_custom_pos"
|
android:src="@drawable/ic_custom_pos"
|
||||||
app:tint="@color/colorPrimary"
|
app:tint="@color/white"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:layout_marginEnd="12dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:layout_gravity="top" />
|
android:layout_gravity="top" />
|
||||||
@ -66,11 +66,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@{POSUtil.getInstance().getTransName(payDetail)}"
|
android:text="@{POSUtil.getInstance().getTransName(payDetail)}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
app:isColorChanges="@{payDetail}"
|
|
||||||
tools:text="SALE" />
|
tools:text="SALE" />
|
||||||
|
|
||||||
<!-- Transaction Amount -->
|
<!-- Transaction Amount -->
|
||||||
@ -78,11 +77,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{POSUtil.getInstance().checkMinusSign(payDetail.transactionType)+POSUtil.getInstance().getDecimalAmountSeparatorFormat(payDetail.amount) + ` `+POSUtil.getInstance().currencyCodeToText(payDetail.currencyCode)}"
|
android:text="@{POSUtil.getInstance().checkMinusSign(payDetail.transactionType)+POSUtil.getInstance().getDecimalAmountSeparatorFormat(payDetail.amount) + ` `+POSUtil.getInstance().currencyCodeToText(payDetail.currencyCode)}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:fontFamily="sans-serif-medium"
|
android:fontFamily="sans-serif-medium"
|
||||||
app:isColorChanges="@{payDetail}"
|
|
||||||
tools:text="1,000.00 MMK" />
|
tools:text="1,000.00 MMK" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -92,11 +90,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{POSUtil.getInstance().convertDateFormatByDateString(payDetail.transDate)}"
|
android:text="@{POSUtil.getInstance().convertDateFormatByDateString(payDetail.transDate)}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:fontFamily="sans-serif"
|
android:fontFamily="sans-serif"
|
||||||
app:isColorChanges="@{payDetail}"
|
|
||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
tools:text="2022-11-26" />
|
tools:text="2022-11-26" />
|
||||||
|
|
||||||
@ -105,7 +102,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@{POSUtil.getInstance().getCardNumMasking(payDetail.cardNo)}"
|
android:text="@{POSUtil.getInstance().getCardNumMasking(payDetail.cardNo)}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:alpha="0.8"
|
android:alpha="0.8"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
@ -124,11 +121,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
app:isTrace="@{payDetail}"
|
app:isTrace="@{payDetail}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/white"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
app:isColorChanges="@{payDetail}"
|
|
||||||
tools:text="TRC:000050" />
|
tools:text="TRC:000050" />
|
||||||
|
|
||||||
<!-- RRN -->
|
<!-- RRN -->
|
||||||
@ -137,12 +133,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@{`RRN:`+payDetail.referNo}"
|
android:text="@{`RRN:`+payDetail.referNo}"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/white"
|
||||||
android:textSize="13sp"
|
android:textSize="13sp"
|
||||||
android:alpha="0.7"
|
android:alpha="0.7"
|
||||||
android:fontFamily="monospace"
|
android:fontFamily="monospace"
|
||||||
android:textAlignment="textEnd"
|
android:textAlignment="textEnd"
|
||||||
app:isColorChanges="@{payDetail}"
|
|
||||||
tools:text="RRN:233001786242" />
|
tools:text="RRN:233001786242" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -154,7 +149,7 @@
|
|||||||
android:layout_width="16dp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:src="@drawable/ic_right_arrow"
|
android:src="@drawable/ic_right_arrow"
|
||||||
app:tint="@color/colorPrimary"
|
app:tint="@color/white"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="8dp" />
|
android:layout_marginStart="8dp" />
|
||||||
|
|||||||
160
app/src/main/res/layout/item_qr_refund.xml
Normal file
160
app/src/main/res/layout/item_qr_refund.xml
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
>
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<import type="com.utsmyanmar.paylibs.utils.POSUtil"/>
|
||||||
|
<variable
|
||||||
|
name="payDetail"
|
||||||
|
type="com.utsmyanmar.paylibs.model.PayDetail" />
|
||||||
|
<variable
|
||||||
|
name="onItemClick"
|
||||||
|
type="com.utsmm.kbz.ui.management.ItemClickListener" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="4dp"
|
||||||
|
android:layout_marginVertical="6dp"
|
||||||
|
app:cardCornerRadius="12dp"
|
||||||
|
app:cardElevation="0dp"
|
||||||
|
app:cardBackgroundColor="@color/colorPrimary"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
|
android:onClick="@{() -> onItemClick.onClickCard(payDetail)}">
|
||||||
|
|
||||||
|
<!-- Card with border -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="2dp"
|
||||||
|
android:background="@drawable/bg_edittext_primary_border"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<!-- Transaction Icon -->
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_custom_pos"
|
||||||
|
app:tint="@color/white"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:layout_gravity="top" />
|
||||||
|
|
||||||
|
<!-- Transaction Details -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<!-- Transaction Type and Amount Row -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginBottom="8dp">
|
||||||
|
|
||||||
|
<!-- Transaction Type -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@{POSUtil.getInstance().getTransName(payDetail)}"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
tools:text="SALE" />
|
||||||
|
|
||||||
|
<!-- Transaction Amount -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{POSUtil.getInstance().checkMinusSign(payDetail.transactionType)+POSUtil.getInstance().getDecimalAmountSeparatorFormat(payDetail.amount) + ` `+POSUtil.getInstance().currencyCodeToText(payDetail.currencyCode)}"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
tools:text="1,000.00 MMK" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Transaction Date -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{POSUtil.getInstance().convertDateFormatByDateString(payDetail.transDate)}"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:layout_marginBottom="6dp"
|
||||||
|
tools:text="2022-11-26" />
|
||||||
|
|
||||||
|
<!-- Card Number -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{POSUtil.getInstance().getCardNumMasking(payDetail.cardNo)}"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
tools:text="468785******9564" />
|
||||||
|
|
||||||
|
<!-- Trace and RRN Row -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<!-- Trace Number -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
app:isTrace="@{payDetail}"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:alpha="0.7"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
tools:text="TRC:000050" />
|
||||||
|
|
||||||
|
<!-- RRN -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@{`RRN:`+payDetail.referNo}"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:alpha="0.7"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:textAlignment="textEnd"
|
||||||
|
tools:text="RRN:233001786242" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Arrow Icon -->
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:src="@drawable/ic_right_arrow"
|
||||||
|
app:tint="@color/white"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginStart="8dp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
</layout>
|
||||||
@ -1084,13 +1084,24 @@
|
|||||||
app:destination="@id/inputAmountFragment" />
|
app:destination="@id/inputAmountFragment" />
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_qrFragment_to_qrHistory"
|
android:id="@+id/action_qrFragment_to_qrHistory"
|
||||||
app:destination="@id/qrHistory"
|
app:destination="@id/reprintAnyTransactionFragment"
|
||||||
|
/>
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_qrFragment_to_qr_refund_list"
|
||||||
|
app:destination="@id/qrRefundList"
|
||||||
/>
|
/>
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
|
<!-- <fragment-->
|
||||||
|
<!-- android:id="@+id/qrHistory"-->
|
||||||
|
<!-- tools:layout="@layout/fragment_qr_history"-->
|
||||||
|
<!-- android:name="com.utsmm.kbz.ui.qr_pay.QRHistoryFragment"-->
|
||||||
|
<!-- >-->
|
||||||
|
<!-- </fragment>-->
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/qrHistory"
|
android:id="@+id/qrRefundList"
|
||||||
tools:layout="@layout/fragment_qr_history"
|
tools:layout="@layout/fragment_qr_refund"
|
||||||
android:name="com.utsmm.kbz.ui.qr_pay.QRHistoryFragment"
|
android:name="com.utsmm.kbz.ui.qr_pay.QRRefundFragment"
|
||||||
>
|
>
|
||||||
</fragment>
|
</fragment>
|
||||||
</navigation>
|
</navigation>
|
||||||
@ -64,4 +64,5 @@
|
|||||||
<dimen name="button_height">48dp</dimen>
|
<dimen name="button_height">48dp</dimen>
|
||||||
<dimen name="button_corner_radius">12dp</dimen>
|
<dimen name="button_corner_radius">12dp</dimen>
|
||||||
<dimen name="fab_size">56dp</dimen>
|
<dimen name="fab_size">56dp</dimen>
|
||||||
|
<dimen name="text_margin">16dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
@ -149,7 +149,11 @@ public interface PayDetailDao {
|
|||||||
@Query("SELECT * FROM paydetail ORDER BY PID DESC")
|
@Query("SELECT * FROM paydetail ORDER BY PID DESC")
|
||||||
LiveData<List<PayDetail>> getAllTrans();
|
LiveData<List<PayDetail>> getAllTrans();
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT * FROM paydetail WHERE transactionType = 20 ORDER BY PID DESC")
|
@Query("SELECT * FROM paydetail WHERE transactionType = 20 ORDER BY PID DESC")
|
||||||
LiveData<List<PayDetail>> getAllQRHistory();
|
LiveData<List<PayDetail>> getAllQRHistory();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM paydetail WHERE transactionType = 20 AND qrTransStatus = 1 ORDER BY PID DESC")
|
||||||
|
LiveData<List<PayDetail>> getRefundableQRHistory();
|
||||||
|
//isReturnGood
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -228,4 +228,6 @@ public class Repository {
|
|||||||
public LiveData<List<PayDetail>> getAllTrans() { return payDetailDao.getAllTrans(); }
|
public LiveData<List<PayDetail>> getAllTrans() { return payDetailDao.getAllTrans(); }
|
||||||
|
|
||||||
public LiveData<List<PayDetail>> getAllQRHistory(){ return payDetailDao.getAllQRHistory();}
|
public LiveData<List<PayDetail>> getAllQRHistory(){ return payDetailDao.getAllQRHistory();}
|
||||||
|
|
||||||
|
public LiveData<List<PayDetail>> getRefundableQRHistory(){ return payDetailDao.getRefundableQRHistory(); }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user