Commit 5c19a491 authored by iman Fauzi's avatar iman Fauzi

Merge branch 'dev' into cart

parents a15fa3cc 5c379e26
package com.yono.messeripos; package com.yono.messeripos;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
...@@ -43,6 +44,7 @@ public class BottomSheets extends BottomSheetDialogFragment { ...@@ -43,6 +44,7 @@ public class BottomSheets extends BottomSheetDialogFragment {
String defaultText = "0"; String defaultText = "0";
Client client = new Client(); Client client = new Client();
public static long grossAmount; public static long grossAmount;
SharedPreferences sharedPreferences;
PaymentsModels paymentsModels; PaymentsModels paymentsModels;
public BottomSheets(PaymentsModels paymentsModels) { public BottomSheets(PaymentsModels paymentsModels) {
...@@ -71,6 +73,7 @@ public class BottomSheets extends BottomSheetDialogFragment { ...@@ -71,6 +73,7 @@ public class BottomSheets extends BottomSheetDialogFragment {
btnCash = v.findViewById(R.id.btnCash); btnCash = v.findViewById(R.id.btnCash);
totalHarga = v.findViewById(R.id.totalHarga); totalHarga = v.findViewById(R.id.totalHarga);
utils = new Utils(); utils = new Utils();
// sharedPreferences = getActivity().getSharedPreferences(MainActivity.ORDER_ID, Context.MODE_PRIVATE);
long ga = paymentsModels.getGrossAmount(); long ga = paymentsModels.getGrossAmount();
String setCurrency = utils.convertPrice("Rp.", ga); String setCurrency = utils.convertPrice("Rp.", ga);
......
...@@ -95,17 +95,17 @@ public class CartActivity extends AppCompatActivity { ...@@ -95,17 +95,17 @@ public class CartActivity extends AppCompatActivity {
Window w = getWindow(); Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
sharedPreferences = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE); sharedPreferences = getSharedPreferences(MainActivity.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
Log.i("Id Order on acart", "onCreate: "+orderId); // Log.i("Id Order on acart", "onCreate: "+orderId);
if (orderId.isEmpty()){ // if (orderId.isEmpty()){
SharedPreferences.Editor editor = sharedPreferences.edit(); // SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(ORDER_ID, "MES-ORDER"+orderId); // editor.putString(ORDER_ID, "MES-ORDER"+orderId);
//
if (editor.commit()){ // if (editor.commit()){
Toast.makeText(CartActivity.this, orderId, Toast.LENGTH_LONG).show(); // Toast.makeText(CartActivity.this, orderId, Toast.LENGTH_LONG).show();
} // }
} // }
// Toolbars // Toolbars
MaterialToolbar toolbars = findViewById(R.id.cAppBar); MaterialToolbar toolbars = findViewById(R.id.cAppBar);
...@@ -247,4 +247,14 @@ public class CartActivity extends AppCompatActivity { ...@@ -247,4 +247,14 @@ public class CartActivity extends AppCompatActivity {
} }
}); });
} }
@Override
public void onBackPressed() {
if (sharedPreferences.getString(ORDER_ID, "") == null){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(ORDER_ID, "MES-ORDER"+utils.timeStamp());
editor.commit();
}
super.onBackPressed();
}
} }
\ No newline at end of file
...@@ -71,13 +71,14 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -71,13 +71,14 @@ public class FormProductActivity extends AppCompatActivity {
private Utils utils = new Utils(); private Utils utils = new Utils();
ProgressDialog progressDialog; ProgressDialog progressDialog;
Client client = new Client(); Client client = new Client();
ProductModels productModelsIntent;
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.form_product); binding = DataBindingUtil.setContentView(this, R.layout.form_product);
binding.btnAdd.setText("Add New Prooduct"); binding.btnAdd.setText("Add New Product");
productModels = new ProductModels(); productModels = new ProductModels();
requestPermissions(permissions, REQUEST_PERMISSIONS); requestPermissions(permissions, REQUEST_PERMISSIONS);
mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class); mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
...@@ -90,7 +91,7 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -90,7 +91,7 @@ public class FormProductActivity extends AppCompatActivity {
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} }
ProductModels productModelsIntent = getIntent().getParcelableExtra(MainActivity.DATA_PRODUCT); productModelsIntent = getIntent().getParcelableExtra(MainActivity.DATA_PRODUCT);
MaterialToolbar toolbars = findViewById(R.id.topAppBarForm); MaterialToolbar toolbars = findViewById(R.id.topAppBarForm);
...@@ -110,6 +111,10 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -110,6 +111,10 @@ public class FormProductActivity extends AppCompatActivity {
productModels.setPriceProduct(productModelsIntent.getPriceProduct()); productModels.setPriceProduct(productModelsIntent.getPriceProduct());
productModels.setStockProduct(productModelsIntent.getStockProduct()); productModels.setStockProduct(productModelsIntent.getStockProduct());
productModels.setImageProduct(productModelsIntent.getImageProduct()); productModels.setImageProduct(productModelsIntent.getImageProduct());
binding.setProductForm(productModelsIntent);
binding.setPhoto(productModelsIntent.getImageProduct());
binding.btnAdd.setText("UPDATE PRODUCT"); binding.btnAdd.setText("UPDATE PRODUCT");
}else{ }else{
productModelsIntent = new ProductModels("",0,0, utils.convertImageBase64Resource(getResources(), R.drawable.logo_32)); productModelsIntent = new ProductModels("",0,0, utils.convertImageBase64Resource(getResources(), R.drawable.logo_32));
...@@ -169,52 +174,97 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -169,52 +174,97 @@ public class FormProductActivity extends AppCompatActivity {
productModels.setStockProduct(Integer.parseInt(binding.etStock.getText().toString())); productModels.setStockProduct(Integer.parseInt(binding.etStock.getText().toString()));
productModels.setCategoryProduct(binding.listCategory.getSelectedIndex()); productModels.setCategoryProduct(binding.listCategory.getSelectedIndex());
Log.i("save_path", "saveProduct: "+locationPath);
if (locationPath != null){
File fileImage = new File(locationPath);
Log.i("save", "saveProduct: "+locationPath);
if (fileImage.exists()){
if (
!productModels.getProductName().isEmpty() ||
productModels.getPriceProduct() != 0 ||
productModels.getStockProduct() != 0
){
progressDialog.setCancelable(false);
progressDialog.show();
ProductService productService = client.Client(ProductService.class);
Log.i("data_post", "saveProduct: "+utils.convertGson(productModels));
productService.postProduct(productModels).enqueue(new Callback<DataResponse<ProductModels>>() {
@Override
public void onResponse(Call<DataResponse<ProductModels>> call, Response<DataResponse<ProductModels>> response) {
Log.i("Success Post", "onResponse: "+utils.convertGson(response.body()));
if (response.body() != null){
new AlertDialog.Builder(FormProductActivity.this)
.setCancelable(false)
.setTitle("Add New Product")
.setMessage("Add new product success")
.setPositiveButton("Oke", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
startActivity(new Intent(FormProductActivity.this, MainActivity.class));
finish();
}
}).show();
}else{
new AlertDialog.Builder(FormProductActivity.this)
.setTitle("Add New Product")
.setMessage("Add new product failed, try again!").show();
}
progressDialog.dismiss();
}
@Override if (isUpdate){
public void onFailure(Call<DataResponse<ProductModels>> call, Throwable t) { Log.i("update_path", "saveProduct: "+locationPath);
progressDialog.dismiss(); if (
Log.e("Error input", "onFailure: ",t ); !productModels.getProductName().isEmpty() ||
productModels.getPriceProduct() != 0 ||
productModels.getStockProduct() != 0
){
progressDialog.setCancelable(false);
progressDialog.show();
ProductService productService = client.Client(ProductService.class);
Log.i("data_post", "saveProduct: "+utils.convertGson(productModels));
productService.updateProduct(productModels, productModelsIntent.getIdProduct()).enqueue(new Callback<DataResponse<ProductModels>>() {
@Override
public void onResponse(Call<DataResponse<ProductModels>> call, Response<DataResponse<ProductModels>> response) {
Log.i("Success Post", "onResponse: "+utils.convertGson(response.body()));
if (response.body() != null){
new AlertDialog.Builder(FormProductActivity.this)
.setCancelable(false)
.setTitle("Update Product")
.setMessage("Update product success")
.setPositiveButton("Oke", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
startActivity(new Intent(FormProductActivity.this, MainActivity.class));
finish();
}
}).show();
}else{
new AlertDialog.Builder(FormProductActivity.this)
.setTitle("Update Product")
.setMessage("Update product failed, try again!").show();
} }
}); progressDialog.dismiss();
} }
@Override
public void onFailure(Call<DataResponse<ProductModels>> call, Throwable t) {
progressDialog.dismiss();
Log.e("Error input", "onFailure: ",t );
}
});
}
}else {
Log.i("save_path", "saveProduct: "+locationPath);
if (locationPath != null){
File fileImage = new File(locationPath);
Log.i("save", "saveProduct: "+locationPath);
if (fileImage.exists()){
if (
!productModels.getProductName().isEmpty() ||
productModels.getPriceProduct() != 0 ||
productModels.getStockProduct() != 0
){
progressDialog.setCancelable(false);
progressDialog.show();
ProductService productService = client.Client(ProductService.class);
Log.i("data_post", "saveProduct: "+utils.convertGson(productModels));
productService.postProduct(productModels).enqueue(new Callback<DataResponse<ProductModels>>() {
@Override
public void onResponse(Call<DataResponse<ProductModels>> call, Response<DataResponse<ProductModels>> response) {
Log.i("Success Post", "onResponse: "+utils.convertGson(response.body()));
if (response.body() != null){
new AlertDialog.Builder(FormProductActivity.this)
.setCancelable(false)
.setTitle("Add New Product")
.setMessage("Add new product success")
.setPositiveButton("Oke", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
startActivity(new Intent(FormProductActivity.this, MainActivity.class));
finish();
}
}).show();
}else{
new AlertDialog.Builder(FormProductActivity.this)
.setTitle("Add New Product")
.setMessage("Add new product failed, try again!").show();
}
progressDialog.dismiss();
}
@Override
public void onFailure(Call<DataResponse<ProductModels>> call, Throwable t) {
progressDialog.dismiss();
Log.e("Error input", "onFailure: ",t );
}
});
}
}
} }
} }
} }
......
...@@ -66,21 +66,11 @@ public class HistoryActivity extends AppCompatActivity { ...@@ -66,21 +66,11 @@ public class HistoryActivity extends AppCompatActivity {
new Observer<DataResponse<List<PaymentsModels>>>() { new Observer<DataResponse<List<PaymentsModels>>>() {
@Override @Override
public void onChanged(DataResponse<List<PaymentsModels>> listDataResponse) { public void onChanged(DataResponse<List<PaymentsModels>> listDataResponse) {
Log.i("Hasil_transaksi", "onChanged: "+utils.convertGson(listDataResponse.getData()));
ArrayList<PaymentsModels> newData = new ArrayList<>(); ArrayList<PaymentsModels> newData = new ArrayList<>();
newData.addAll(listDataResponse.getData()); newData.addAll(listDataResponse.getData());
transactionAdapter.setTransactionAdapter(HistoryActivity.this, newData); transactionAdapter.setTransactionAdapter(HistoryActivity.this, newData);
/*
* SET RECYCLE VIEW MANAGER DISINI
* GUNAKAN LINEARLAYOUT MANAGER VERTICAL UNTUK SETTING LAYOUT MANAGER
*
* SET RECYCLEVIEW ADAPTER DENGAN TRANSACTION ADAPTER
*
* UNTUK BISA CLICK CARD VIEW NYA
* PANGGIL ADAPTERNYA KEMUDIAN .setList.....
* SILAHKAN PINDAH KE ACTIVITY SELANJUTNYA PADA ON.....
* */
loading.setVisibility(View.GONE); loading.setVisibility(View.GONE);
recyclerView.setLayoutManager(new LinearLayoutManager(HistoryActivity.this,RecyclerView.VERTICAL,false)); recyclerView.setLayoutManager(new LinearLayoutManager(HistoryActivity.this,RecyclerView.VERTICAL,false));
......
...@@ -73,6 +73,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -73,6 +73,7 @@ public class MainActivity extends AppCompatActivity {
Client client = new Client(); Client client = new Client();
public static ArrayList<ProductModels> productModelsArrayList = new ArrayList<>(); public static ArrayList<ProductModels> productModelsArrayList = new ArrayList<>();
public static final String DATA_PRODUCT = "DATA_PRODUCT"; public static final String DATA_PRODUCT = "DATA_PRODUCT";
public static final String MY_SHARED_PREFERENCES = "my_shared_preferences";
ProgressDialog progressDialog; ProgressDialog progressDialog;
MaterialButton btnAddCart; MaterialButton btnAddCart;
...@@ -85,7 +86,6 @@ public class MainActivity extends AppCompatActivity { ...@@ -85,7 +86,6 @@ public class MainActivity extends AppCompatActivity {
ProductAdapter adapter = new ProductAdapter(); ProductAdapter adapter = new ProductAdapter();
binding.rvProduct.setAdapter(adapter); binding.rvProduct.setAdapter(adapter);
// binding.appBarUpdate.setVisibility(View.GONE);
showLoading(true); showLoading(true);
btnAddCart = findViewById(R.id.materialBtnAddCart); btnAddCart = findViewById(R.id.materialBtnAddCart);
...@@ -93,7 +93,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -93,7 +93,7 @@ public class MainActivity extends AppCompatActivity {
categoryAdapter = new CategoryAdapter(); categoryAdapter = new CategoryAdapter();
productAdapter = new ProductAdapter(); productAdapter = new ProductAdapter();
mainViewModelsCart = new ViewModelProvider(MainActivity.this).get(MainViewModelsCart.class); mainViewModelsCart = new ViewModelProvider(MainActivity.this).get(MainViewModelsCart.class);
sharedPreferences = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE); sharedPreferences = getSharedPreferences(MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
checkout = sharedPreferences.getBoolean(CHECKOUT,false); checkout = sharedPreferences.getBoolean(CHECKOUT,false);
orderId = sharedPreferences.getString(ORDER_ID,""); orderId = sharedPreferences.getString(ORDER_ID,"");
progressDialog = new ProgressDialog(MainActivity.this); progressDialog = new ProgressDialog(MainActivity.this);
...@@ -108,7 +108,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -108,7 +108,7 @@ public class MainActivity extends AppCompatActivity {
SharedPreferences.Editor editor = sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(ORDER_ID,"MES-ORDER"+utils.timeStamp()); editor.putString(ORDER_ID,"MES-ORDER"+utils.timeStamp());
if (editor.commit()){ if (editor.commit()){
Toast.makeText(MainActivity.this, orderId, Toast.LENGTH_LONG).show(); // Toast.makeText(MainActivity.this, orderId, Toast.LENGTH_LONG).show();
} }
} }
......
...@@ -77,7 +77,7 @@ public class PaymentActivity extends AppCompatActivity { ...@@ -77,7 +77,7 @@ public class PaymentActivity extends AppCompatActivity {
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
} }
sharedPreferences = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE); sharedPreferences = getSharedPreferences(MainActivity.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
paymentsModels = new PaymentsModels(); paymentsModels = new PaymentsModels();
checkoutAdapter = new CheckoutAdapter(); checkoutAdapter = new CheckoutAdapter();
...@@ -91,7 +91,7 @@ public class PaymentActivity extends AppCompatActivity { ...@@ -91,7 +91,7 @@ public class PaymentActivity extends AppCompatActivity {
setSupportActionBar(toolbars); setSupportActionBar(toolbars);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
mainViewModels = new ViewModelProvider(PaymentActivity.this).get(MainViewModelsCart.class); mainViewModels = new ViewModelProvider(PaymentActivity.this).get(MainViewModelsCart.class);
mainViewModels.getCartProduct().observe(this, new Observer<List<ProductCartModels>>() { mainViewModels.getCartById(orderId).observe(this, new Observer<List<ProductCartModels>>() {
@Override @Override
public void onChanged(List<ProductCartModels> productCartModels) { public void onChanged(List<ProductCartModels> productCartModels) {
String js = new Gson().toJson(productCartModels); String js = new Gson().toJson(productCartModels);
......
...@@ -146,6 +146,12 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo ...@@ -146,6 +146,12 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
binding.setStatus(statusProduct); binding.setStatus(statusProduct);
} }
if (products.getStockProduct() <= 1){
binding.materialBtnAddCart.setEnabled(false);
}else{
binding.materialBtnAddCart.setEnabled(true);
}
binding.materialBtnAddCart.setOnClickListener(new View.OnClickListener() { binding.materialBtnAddCart.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
......
package com.yono.messeripos.adapter; package com.yono.messeripos.adapter;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -25,6 +26,7 @@ public class TransactionAdapter extends RecyclerView.Adapter<TransactionAdapter. ...@@ -25,6 +26,7 @@ public class TransactionAdapter extends RecyclerView.Adapter<TransactionAdapter.
Context context; Context context;
Utils utils = new Utils(); Utils utils = new Utils();
public interface TransactionListener { public interface TransactionListener {
void onShowDetail(PaymentsModels paymentsModels); void onShowDetail(PaymentsModels paymentsModels);
} }
...@@ -35,7 +37,7 @@ public class TransactionAdapter extends RecyclerView.Adapter<TransactionAdapter. ...@@ -35,7 +37,7 @@ public class TransactionAdapter extends RecyclerView.Adapter<TransactionAdapter.
this.listener = listener; this.listener = listener;
} }
public void setTransactionAdapter(Context context, ArrayList<PaymentsModels> paymentsModels){ public void setTransactionAdapter(Context context, ArrayList<PaymentsModels> paymentsModels) {
this.paymentsModels = paymentsModels; this.paymentsModels = paymentsModels;
this.context = context; this.context = context;
notifyDataSetChanged(); notifyDataSetChanged();
...@@ -65,20 +67,31 @@ public class TransactionAdapter extends RecyclerView.Adapter<TransactionAdapter. ...@@ -65,20 +67,31 @@ public class TransactionAdapter extends RecyclerView.Adapter<TransactionAdapter.
} }
public class MyViewHolder extends RecyclerView.ViewHolder { public class MyViewHolder extends RecyclerView.ViewHolder {
private String statusTransaction;
ItemHistoryBinding itemHistoryBinding; ItemHistoryBinding itemHistoryBinding;
public MyViewHolder(@NonNull ItemHistoryBinding itemView) { public MyViewHolder(@NonNull ItemHistoryBinding itemView) {
super(itemView.getRoot()); super(itemView.getRoot());
this.itemHistoryBinding = itemView; this.itemHistoryBinding = itemView;
} }
@SuppressLint("ResourceAsColor")
@RequiresApi(api = Build.VERSION_CODES.O) @RequiresApi(api = Build.VERSION_CODES.O)
public void binData(PaymentsModels paymentsModels){ public void binData(PaymentsModels paymentsModels) {
itemHistoryBinding.setTransaction(paymentsModels); itemHistoryBinding.setTransaction(paymentsModels);
itemHistoryBinding.setDate(utils.convertDate(paymentsModels.getUpdatedAt())); itemHistoryBinding.setDate(utils.convertDate(paymentsModels.getUpdatedAt()));
// itemHistoryBinding.cvHistory.setOnClickListener(view -> listener.onShowDetail(paymentsModels)); itemHistoryBinding.cvHistory.setOnClickListener(view -> listener.onShowDetail(paymentsModels));
if (itemHistoryBinding.getTransaction().equals("Settlement".toLowerCase())){
if (paymentsModels.getTransactionStatus().equals("Settlement".toLowerCase())) {
statusTransaction = "Settlement";
itemHistoryBinding.tvHistory.setBackgroundColor(0x550000FF);
} else if (paymentsModels.getTransactionStatus().equals("Pending".toLowerCase())) {
statusTransaction = "Pending";
itemHistoryBinding.tvHistory.setBackgroundColor(0x55FF0000);
}else if (paymentsModels.getTransactionStatus().equals("Success".toLowerCase())) {
statusTransaction = "Success";
itemHistoryBinding.tvHistory.setBackgroundColor(0xFF12FF45);
} }
} }
} }
......
...@@ -16,6 +16,7 @@ import retrofit2.http.DELETE; ...@@ -16,6 +16,7 @@ import retrofit2.http.DELETE;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Multipart; import retrofit2.http.Multipart;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part; import retrofit2.http.Part;
import retrofit2.http.Path; import retrofit2.http.Path;
...@@ -30,6 +31,9 @@ public interface ProductService { ...@@ -30,6 +31,9 @@ public interface ProductService {
@POST(ApiHelper.VERSI_API_1+"product") @POST(ApiHelper.VERSI_API_1+"product")
Call<DataResponse<ProductModels>> postProduct(@Body ProductModels productModels); Call<DataResponse<ProductModels>> postProduct(@Body ProductModels productModels);
@PUT(ApiHelper.VERSI_API_1+"product/{id}")
Call<DataResponse<ProductModels>> updateProduct(@Body ProductModels productModels, @Path("id") int id);
@Multipart @Multipart
@POST(ApiHelper.VERSI_API_1+"product") @POST(ApiHelper.VERSI_API_1+"product")
Call<DataResponse<ProductModels>> postProducts( Call<DataResponse<ProductModels>> postProducts(
......
package com.yono.messeripos.models; package com.yono.messeripos.models;
import android.util.Log;
import android.widget.ImageView;
import androidx.databinding.BindingAdapter;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.yono.messeripos.R;
public class PaymentsModels { public class PaymentsModels {
@SerializedName("order_code") @SerializedName("order_code")
...@@ -24,6 +30,10 @@ public class PaymentsModels { ...@@ -24,6 +30,10 @@ public class PaymentsModels {
@SerializedName("updated_at") @SerializedName("updated_at")
private String updatedAt; private String updatedAt;
@SerializedName("va_number")
private String nomorPembayaran;
public PaymentsModels() { public PaymentsModels() {
} }
...@@ -89,4 +99,14 @@ public class PaymentsModels { ...@@ -89,4 +99,14 @@ public class PaymentsModels {
public void setUpdatedAt(String updatedAt) { public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public String getNomorPembayaran() {
return nomorPembayaran;
}
public void setNomorPembayaran(String nomorPembayaran) {
this.nomorPembayaran = nomorPembayaran;
}
} }
...@@ -16,6 +16,16 @@ ...@@ -16,6 +16,16 @@
android:textFontWeight="600" android:textFontWeight="600"
android:layout_alignParentStart="true" /> android:layout_alignParentStart="true" />
<TextView
android:id="@+id/changeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change"
android:textSize="20sp"
android:textFontWeight="600"
android:layout_below="@id/totalText"
android:layout_alignParentStart="true" />
<TextView <TextView
android:id="@+id/totalHarga" android:id="@+id/totalHarga"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -25,13 +35,23 @@ ...@@ -25,13 +35,23 @@
android:textFontWeight="600" android:textFontWeight="600"
android:layout_alignParentEnd="true" /> android:layout_alignParentEnd="true" />
<TextView
android:id="@+id/hargaChange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rp. 600.000"
android:textSize="20sp"
android:textFontWeight="600"
android:layout_below="@id/totalHarga"
android:layout_alignParentEnd="true" />
<TextView <TextView
android:id="@+id/label" android:id="@+id/label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Bayar" android:text="Bayar"
android:textFontWeight="600" android:textFontWeight="600"
android:layout_below="@id/totalHarga" /> android:layout_below="@id/changeText" />
<EditText <EditText
android:id="@+id/etBayar" android:id="@+id/etBayar"
...@@ -42,29 +62,13 @@ ...@@ -42,29 +62,13 @@
android:inputType="number" android:inputType="number"
android:imeOptions="actionDone"/> android:imeOptions="actionDone"/>
<TextView
android:id="@+id/textChange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change"
android:layout_below="@id/etBayar"
android:layout_alignParentEnd="true" />
<TextView
android:id="@+id/hargaChange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rp.20.000"
android:layout_below="@id/textChange"
android:layout_alignParentEnd="true"/>
<Button <Button
android:id="@+id/btnCash" android:id="@+id/btnCash"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/hint_pay" android:text="@string/hint_pay"
android:hint="Insert Money" android:hint="Insert Money"
android:layout_below="@id/hargaChange" /> android:layout_below="@id/etBayar" />
</RelativeLayout> </RelativeLayout>
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<variable <variable
name="date" name="date"
type="String" /> type="String" />
<variable
name="transactionStatus"
type="String" />
</data> </data>
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
...@@ -65,13 +69,24 @@ ...@@ -65,13 +69,24 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="84dp" android:layout_marginBottom="84dp"
android:backgroundTint="#8555DA"
android:text="@{transaction.transactionStatus}" android:text="@{transaction.transactionStatus}"
tools:text="@tools:sample/first_names" tools:text="@tools:sample/first_names"
android:textColor="#fff" android:textColor="#fff"
android:background="#C60000" android:background="@color/design_default_color_secondary_variant"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tvVA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{transaction.nomorPembayaran}"
android:textAllCaps="true"
android:textColor="#000"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:text="@tools:sample/first_names" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment