fix saving and display of stocks

This commit is contained in:
Patrick Alvin Alcala 2025-04-07 17:23:57 +08:00
parent 6c5e9f84d7
commit e8d0f213e9
5 changed files with 255 additions and 138 deletions

View file

@ -190,8 +190,20 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
final medTypeUUID = await _refTypes.getUUID(_selectedType);
final medManufacturerUUID = await _refManufacturer.getUUID(_selectedManufacturer);
await _refMedicines.postMedicine(
final posted = await _refMedicines.postMedicine(
uuid, medName, medManufacturerUUID, medGenericUUID, medTypeUUID, encrpytedBarcode);
if (posted) {
if (mounted) {
showNotification(context, 'Medicine Added Successfully', true);
setState(() => _isLoading = false);
context.pop();
}
} else {
if (mounted) {
showNotification(context, 'Error: Medicine Not Added', false);
}
}
} else {
if (mounted) {
showNotification(context, 'Error: No Internet Connection', false);