fixed product supplier android
This commit is contained in:
@@ -114,9 +114,18 @@ public class ProductSupplierDetailFragment extends Fragment {
|
|||||||
viewModel.setEditMode(productId, supplierId);
|
viewModel.setEditMode(productId, supplierId);
|
||||||
preselectedProductId = productId;
|
preselectedProductId = productId;
|
||||||
preselectedSupplierId = supplierId;
|
preselectedSupplierId = supplierId;
|
||||||
|
|
||||||
binding.tvPSMode.setText("Edit Product Supplier");
|
binding.tvPSMode.setText("Edit Product Supplier");
|
||||||
binding.btnDeletePS.setVisibility(View.VISIBLE);
|
binding.btnDeletePS.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
viewModel.loadProductSupplier().observe(getViewLifecycleOwner(), resource -> {
|
||||||
|
if (resource == null) return;
|
||||||
|
if (resource.status == Resource.Status.SUCCESS && resource.data != null) {
|
||||||
|
if (resource.data.getCost() != null) {
|
||||||
|
binding.etPSCost.setText(resource.data.getCost().toPlainString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
binding.tvPSMode.setText("Add Product Supplier");
|
binding.tvPSMode.setText("Add Product Supplier");
|
||||||
binding.btnDeletePS.setVisibility(View.GONE);
|
binding.btnDeletePS.setVisibility(View.GONE);
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ public class ProductSupplierDetailViewModel extends ViewModel {
|
|||||||
this.editSupplierId = supplierId;
|
this.editSupplierId = supplierId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<Resource<ProductSupplierDTO>> loadProductSupplier() {
|
||||||
|
return psRepository.getProductSupplierById(editProductId, editSupplierId);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEditing() { return isEditing; }
|
public boolean isEditing() { return isEditing; }
|
||||||
public long getEditProductId() { return editProductId; }
|
public long getEditProductId() { return editProductId; }
|
||||||
public long getEditSupplierId() { return editSupplierId; }
|
public long getEditSupplierId() { return editSupplierId; }
|
||||||
|
|||||||
Reference in New Issue
Block a user