This commit is contained in:
Patrick Alvin Alcala 2025-02-26 13:45:41 +08:00
parent 6c5742b596
commit 06b853b2ca
18 changed files with 147 additions and 149 deletions

View file

@ -165,10 +165,12 @@ class _AddGenericsPageState extends State<AddGenericsPage> {
Column(
children: [
DropDownWidget(
label: 'Category',
list: _categoryList,
listTitle: 'category_name',
onChanged: _updateCategory),
label: 'Category',
list: _categoryList,
listTitle: 'category_name',
onChanged: _updateCategory,
value: _selectedCategory,
),
const Gap(32),
if (_isLoading)
Center(child: CircularProgressIndicator(color: Colors.white))

View file

@ -276,10 +276,12 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
DropdownWrapperMultiWidget(list: _genericNameList, text: 'Data', children: [
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
DropDownWidget(
label: 'Generic Name',
list: _genericNameList,
listTitle: 'generic_name',
onChanged: _updateGeneric),
label: 'Generic Name',
list: _genericNameList,
listTitle: 'generic_name',
onChanged: _updateGeneric,
value: _selectedGeneric,
),
const Gap(8),
Padding(
padding: const EdgeInsets.only(left: 12),
@ -287,13 +289,20 @@ class _AddMedicinePageState extends State<AddMedicinePage> {
),
const Gap(16),
DropDownWidget(
label: 'Type', list: _typeList, listTitle: 'type_name', onChanged: _updateType),
label: 'Type',
list: _typeList,
listTitle: 'type_name',
onChanged: _updateType,
value: _selectedType,
),
const Gap(16),
DropDownWidget(
label: 'Manufactorer',
list: _manufactorerList,
listTitle: 'manufactorer_name',
onChanged: _updateManufactorer),
label: 'Manufactorer',
list: _manufactorerList,
listTitle: 'manufactorer_name',
onChanged: _updateManufactorer,
value: _selectedManufactorer,
),
const Gap(16),
InputWidget(label: 'Barcode', controller: _barcodeController),
ScanbarcodeWidget(onTap: _scanBarcode),

View file

@ -44,10 +44,6 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
late DateTime selectedDate = DateTime.now();
late String barcode = '';
// void autoRun() async {
// _medicineList = await _refMedicines.getList();
// }
void _getMedicines() async {
_medicineList = await _refMedicines.getList2();
@ -70,38 +66,23 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
}
}
// Future<bool> _getMedicines() async {
// late bool? result;
// _medicineList = await _refMedicines.getList();
// if (mounted) {
// result = await checkResult(context, _medicineList, 'Medicines');
// log(result.toString());
// }
// return result ?? false;
// }
void _updateMedicine(dynamic medicine) {
_selectedMedicine = medicine;
}
void _saveStock() async {
// final stockNameUUID = await _refMedicines.getUUID(_selectedMedicine);
// final stockQuantity = _quantityController.text;
// final stockExpiration = _dateController.text;
final stockNameUUID = await _refMedicines.getUUID(_selectedMedicine);
final stockQuantity = _quantityController.text;
final stockExpiration = _dateController.text;
// await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
final aa = await encrypt('text');
final bb =
await decrypt('4cee2f33af6ebac8dcfdeeccdd6c73c4698ce25b0cb26249c571fafc8483b5a047baefc4d626fa56e027343d');
log('encrypt: $aa');
log('plain: $bb');
await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
}
Future<void> _scanBarcode() async {
final scannedBarcode = await barcodeScan(context);
setState(() {
_selectedMedicine = scannedBarcode;
_updateMedicine(scannedBarcode);
});
}
@ -152,10 +133,12 @@ class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver
text: 'Data',
children: [
DropDownWidget(
label: 'Medicine Name',
list: _medicineList,
listTitle: 'medicine_name',
onChanged: _updateMedicine),
label: 'Medicine Name',
list: _medicineList,
listTitle: 'medicine_name',
onChanged: _updateMedicine,
value: _selectedMedicine,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [

View file

@ -5,7 +5,6 @@ import 'package:pharmacy_mobile/tables/stocks.dart';
import 'package:pharmacy_mobile/widgets/button_widget.dart';
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
import 'package:pharmacy_mobile/widgets/dropdown_wrappermulti_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';
@ -137,7 +136,12 @@ class _DeleteStockPageState extends State<DeleteStockPage> {
children: [
DropdownWrapperMultiWidget(list: _stockList, text: 'Stocks', children: [
DropDownWidget(
label: 'Stocks', list: _stockList, listTitle: 'medicine_name', onChanged: _updateStock),
label: 'Stocks',
list: _stockList,
listTitle: 'medicine_name',
onChanged: _updateStock,
value: _selectedStock,
),
const Gap(16),
InputWidget(label: 'Quantity', controller: _quantityController, onChanged: _setQuantity),
const Gap(32),

View file

@ -34,7 +34,7 @@ class IndexPage extends StatelessWidget {
const Gap(32),
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 38, 0),
child: Image.asset('assets/ph_logo2.webp',
child: Image.asset('assets/ph_logo.webp',
width: 192, cacheWidth: (192 * MediaQuery.of(context).devicePixelRatio).round()),
),
const Gap(64),