update
This commit is contained in:
parent
27f00e43a7
commit
3572f90b24
24 changed files with 290 additions and 257 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
|
|
@ -7,7 +5,6 @@ import 'package:pharmacy_mobile/tables/ref_categories.dart';
|
|||
import 'package:pharmacy_mobile/tables/ref_generic_names.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget2.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
|
|
@ -91,8 +88,6 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
|
|||
}
|
||||
|
||||
_categoryUUID = await _refCategories.getUUID(_selectedCategory);
|
||||
log('_selectedCategory: $_selectedCategory');
|
||||
log('_categoryUUID: $_categoryUUID');
|
||||
|
||||
final post = await _refGenericNames.postGeneric(_nameController.text, _categoryUUID);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkexisting_function.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_manufactorers.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget2.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
||||
|
||||
|
|
@ -19,17 +23,45 @@ class _AddManufactorerPageState extends State<AddManufactorerPage> {
|
|||
final _formKey = GlobalKey<FormState>();
|
||||
final _nameController = TextEditingController();
|
||||
final _addressController = TextEditingController();
|
||||
final _refManufactorers = RefManufactorers();
|
||||
|
||||
late bool _isLoading = false;
|
||||
|
||||
void saveManufactorer() async {
|
||||
void _saveManufactorer() async {
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
// final existing = await _checkExisting();
|
||||
}
|
||||
try {
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
final existing = await checkExisting(_refManufactorers, _nameController);
|
||||
|
||||
setState(() => _isLoading = false);
|
||||
if (existing && mounted) {
|
||||
showNotification(context, 'Manufactorer already listed', false);
|
||||
return;
|
||||
}
|
||||
|
||||
final post = await _refManufactorers.postManufactorer(_nameController.text, _addressController.text);
|
||||
|
||||
if (post && mounted) {
|
||||
showNotification(context, 'Manufactorer added to list', true);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
context.push('/main');
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: No Internet Connection', false);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: $e', false);
|
||||
}
|
||||
} finally {
|
||||
setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -71,7 +103,7 @@ class _AddManufactorerPageState extends State<AddManufactorerPage> {
|
|||
if (_isLoading)
|
||||
const Center(child: CircularProgressIndicator(color: Colors.white))
|
||||
else
|
||||
ButtonWidget(text: 'Add', onPressed: saveManufactorer)
|
||||
ButtonWidget(text: 'Save Manufactorer', onPressed: _saveManufactorer)
|
||||
],
|
||||
)))
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
|
@ -60,33 +56,6 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
late bool imageUploaded = false;
|
||||
late String imageUrl = '';
|
||||
|
||||
// void _checkResult(List list, String name) {
|
||||
// if (list.isEmpty) {
|
||||
// if (mounted) {
|
||||
// showNotification(context, 'Error: No $name Found', false);
|
||||
|
||||
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// if (mounted) {
|
||||
// context.push('/main');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// } else {
|
||||
// setState(() => {});
|
||||
// }
|
||||
// }
|
||||
|
||||
// Future<Uint8List> compressFile(XFile file) async {
|
||||
// var result = await FlutterImageCompress.compressWithFile(
|
||||
// file.path,
|
||||
// minWidth: 1020,
|
||||
// minHeight: 765,
|
||||
// quality: 90,
|
||||
// format: CompressFormat.webp,
|
||||
// );
|
||||
// return result;
|
||||
// }
|
||||
|
||||
Future<void> _getGenerics() async {
|
||||
_genericNameList = await _refGenericNames.getList();
|
||||
setState(() {
|
||||
|
|
@ -199,15 +168,16 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
|
||||
final imageBytes = await image!.readAsBytes();
|
||||
final webpImage = await _webpConvert(imageBytes);
|
||||
late bool uploaded = false;
|
||||
|
||||
uuid = imageName;
|
||||
|
||||
if (mounted) {
|
||||
imageUrl = await _storage.uploadImage(context, storageName, webpImage, '$imageName.webp');
|
||||
uploaded = await _storage.uploadImage(context, storageName, webpImage, '$imageName.webp');
|
||||
}
|
||||
|
||||
setState(() {
|
||||
if (imageUrl.isEmpty) {
|
||||
if (!uploaded) {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Image Upload failed, try again.', false);
|
||||
}
|
||||
|
|
@ -218,8 +188,6 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
|
|||
Future<Uint8List> _webpConvert(Uint8List file) async {
|
||||
final result = await FlutterImageCompress.compressWithList(
|
||||
file,
|
||||
// minHeight: 1080,
|
||||
// minWidth: 1080,
|
||||
quality: 70,
|
||||
rotate: 0,
|
||||
keepExif: false,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/functions/barcode_scan_function.dart';
|
||||
import 'package:pharmacy_mobile/functions/checkresult_function.dart';
|
||||
import 'package:pharmacy_mobile/security/encryption.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
|
|
@ -20,7 +16,6 @@ import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
|
|||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||
|
||||
class AddStockPage extends StatefulWidget {
|
||||
const AddStockPage({super.key});
|
||||
|
|
@ -34,18 +29,16 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
|
|||
final _refMedicines = RefMedicines();
|
||||
final _quantityController = TextEditingController();
|
||||
final _dateController = TextEditingController();
|
||||
final _medicineController = TextEditingController();
|
||||
final _stocks = Stocks();
|
||||
|
||||
final bool _isLoading = false;
|
||||
|
||||
late bool _isLoading = false;
|
||||
late List _medicineList = [];
|
||||
late String _selectedMedicine = '';
|
||||
late DateTime selectedDate = DateTime.now();
|
||||
late String barcode = '';
|
||||
|
||||
void _getMedicines() async {
|
||||
_medicineList = await _refMedicines.getList2();
|
||||
_medicineList = await _refMedicines.getList();
|
||||
|
||||
setState(() {
|
||||
checkResult(context, _medicineList, 'Medicines');
|
||||
|
|
@ -71,11 +64,27 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
|
|||
}
|
||||
|
||||
void _saveStock() async {
|
||||
final stockNameUUID = await _refMedicines.getUUID(_selectedMedicine);
|
||||
final stockQuantity = _quantityController.text;
|
||||
final stockExpiration = _dateController.text;
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
|
||||
try {
|
||||
if (await InternetConnectionChecker.instance.hasConnection) {
|
||||
final stockNameUUID = await _refMedicines.getUUID(_selectedMedicine);
|
||||
final stockQuantity = _quantityController.text;
|
||||
final stockExpiration = _dateController.text;
|
||||
|
||||
await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
|
||||
} else {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: No Internet Connection', false);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: $e', false);
|
||||
}
|
||||
} finally {
|
||||
setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _scanBarcode() async {
|
||||
|
|
@ -188,12 +197,10 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
|
|||
value: selectedDate,
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Add Stock', onPressed: _saveStock),
|
||||
const Gap(16),
|
||||
TextWidget(
|
||||
text: barcode,
|
||||
size: 14,
|
||||
)
|
||||
if (_isLoading)
|
||||
const Center(child: CircularProgressIndicator(color: Colors.white))
|
||||
else
|
||||
ButtonWidget(text: 'Add Stock', onPressed: _saveStock),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,10 +3,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_types.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/form_border_widget2.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/logo_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:pharmacy_mobile/tables/storage.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
|
||||
class CustomerItemviewPage extends StatelessWidget {
|
||||
|
|
@ -7,13 +6,13 @@ class CustomerItemviewPage extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final storage = Storage();
|
||||
// final storage = Storage();
|
||||
|
||||
void getURL() async {
|
||||
final image = await storage.getPublicURL('ref_medicines_images', 'cb6eafdb-d86f-460a-9571-44446570d4cb.webp');
|
||||
// setState(() {
|
||||
// imageUrl = image;
|
||||
}
|
||||
// void getURL() async {
|
||||
// final image = await storage.getPublicURL('ref_medicines_images', 'cb6eafdb-d86f-460a-9571-44446570d4cb.webp');
|
||||
// // setState(() {
|
||||
// // imageUrl = image;
|
||||
// }
|
||||
|
||||
return Scaffold(
|
||||
body: PageBackgroundWidget(
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/auth/auth_service.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/consultation_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/logo_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/menu_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class CustomerMainPage extends StatefulWidget {
|
||||
// final NotchBottomBarController? controller;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,11 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
import 'package:pharmacy_mobile/tables/storage.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/item_card_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/logo_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
||||
|
||||
class CustomerSearchPage extends StatefulWidget {
|
||||
// final NotchBottomBarController? controller;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
import 'package:pharmacy_mobile/tables/storage.dart';
|
||||
|
|
@ -18,7 +17,6 @@ class ListStocksPage extends StatefulWidget {
|
|||
|
||||
class _ListStocksPageState extends State<ListStocksPage> {
|
||||
final _stocks = Stocks();
|
||||
final _storage = Storage();
|
||||
|
||||
late List _stockList = [];
|
||||
bool _isLoading = false;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class _MainPageState extends State<MainPage> {
|
|||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Manufactorer',
|
||||
description: 'Add Manufactorer to the record',
|
||||
description: 'Register manufactorer to the list',
|
||||
onPressed: () => {context.push('/addmanufactorer')},
|
||||
color: 'blue',
|
||||
),
|
||||
|
|
@ -61,7 +61,7 @@ class _MainPageState extends State<MainPage> {
|
|||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Type',
|
||||
description: 'Create a new medical type',
|
||||
description: 'Register new medical type',
|
||||
onPressed: () => {context.push('/addtype')},
|
||||
color: 'blue',
|
||||
),
|
||||
|
|
@ -69,7 +69,7 @@ class _MainPageState extends State<MainPage> {
|
|||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Category',
|
||||
description: 'Create a new medicine category',
|
||||
description: 'Register new medicine category',
|
||||
onPressed: () => {context.push('/addcategory')},
|
||||
color: 'blue',
|
||||
),
|
||||
|
|
@ -77,35 +77,35 @@ class _MainPageState extends State<MainPage> {
|
|||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Generics',
|
||||
description: 'Add generic name on the list',
|
||||
description: 'Register generic name',
|
||||
onPressed: () => {context.push('/addgenerics')},
|
||||
color: 'blue'),
|
||||
const Gap(32),
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Medicine',
|
||||
description: 'Add generic name on the list',
|
||||
description: 'Register medicine to the global list',
|
||||
onPressed: () => {context.push('/addmedicines')},
|
||||
color: 'green'),
|
||||
const Gap(16),
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.circlePlus,
|
||||
text: 'Add Stock',
|
||||
description: 'Add generic name on the list',
|
||||
description: 'Add a new stock',
|
||||
onPressed: () => {context.push('/addstock')},
|
||||
color: 'green'),
|
||||
const Gap(32),
|
||||
MenuWidget(
|
||||
icon: Icons.delete,
|
||||
text: 'Remove Stock',
|
||||
description: 'Add generic name on the list',
|
||||
description: 'Reduce stock based on purchase',
|
||||
onPressed: () => {context.push('/deletestock')},
|
||||
color: 'red'),
|
||||
const Gap(32),
|
||||
MenuWidget(
|
||||
icon: FontAwesomeIcons.listCheck,
|
||||
text: 'List of Stocks',
|
||||
description: 'Add generic name on the list',
|
||||
description: 'View the list of available stocks',
|
||||
onPressed: () => {context.push('/liststocks')},
|
||||
color: 'yellow'),
|
||||
const Gap(40),
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:internet_connection_checker/internet_connection_checker.dart';
|
||||
import 'package:pharmacy_mobile/auth/auth_service.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/logo_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/snackbar_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
|
|
@ -35,7 +32,6 @@ class _RegisterPageState extends State<RegisterPage> {
|
|||
final confirmPassword = _confirmPasswordController.text;
|
||||
|
||||
if (email.isEmpty) {
|
||||
log('message');
|
||||
if (mounted) {
|
||||
showNotification(context, 'Error: Please enter a valid email', false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue