fixed product supplier android

This commit is contained in:
Alex
2026-04-15 02:14:20 -06:00
parent 73b99b4aa0
commit 7f5b0cceb1
2 changed files with 14 additions and 1 deletions

View File

@@ -114,9 +114,18 @@ public class ProductSupplierDetailFragment extends Fragment {
viewModel.setEditMode(productId, supplierId);
preselectedProductId = productId;
preselectedSupplierId = supplierId;
binding.tvPSMode.setText("Edit Product Supplier");
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 {
binding.tvPSMode.setText("Add Product Supplier");
binding.btnDeletePS.setVisibility(View.GONE);

View File

@@ -46,6 +46,10 @@ public class ProductSupplierDetailViewModel extends ViewModel {
this.editSupplierId = supplierId;
}
public LiveData<Resource<ProductSupplierDTO>> loadProductSupplier() {
return psRepository.getProductSupplierById(editProductId, editSupplierId);
}
public boolean isEditing() { return isEditing; }
public long getEditProductId() { return editProductId; }
public long getEditSupplierId() { return editSupplierId; }