update
This commit is contained in:
parent
ecc427c958
commit
ee1884790a
11 changed files with 113 additions and 127 deletions
|
|
@ -6,6 +6,7 @@ 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/input_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';
|
||||
|
||||
|
|
@ -59,19 +60,7 @@ class AddGenericsPageState extends State<AddGenericsPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(34, 51, 69, 1),
|
||||
Color.fromRGBO(22, 32, 44, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import 'package:pharmacy_mobile/tables/ref_types.dart';
|
|||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_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';
|
||||
|
||||
|
|
@ -94,19 +95,7 @@ class AddMedicinePageState extends State<AddMedicinePage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(34, 51, 69, 1),
|
||||
Color.fromRGBO(22, 32, 44, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import 'package:flutter/material.dart';
|
|||
import 'package:gap/gap.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/datepicker_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_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';
|
||||
import 'package:intl/intl.dart';
|
||||
|
|
@ -25,6 +27,8 @@ class _AddStockPageState extends State<AddStockPage> {
|
|||
final _refMedicines = RefMedicines();
|
||||
final _quantityController = TextEditingController();
|
||||
final _dateController = TextEditingController();
|
||||
final _stocks = Stocks();
|
||||
final _ref_medicines = RefMedicines();
|
||||
|
||||
late List _medicineList = [];
|
||||
late String _selectedMedicine = '';
|
||||
|
|
@ -50,7 +54,22 @@ class _AddStockPageState extends State<AddStockPage> {
|
|||
// }
|
||||
// }
|
||||
|
||||
void saveStock() async {}
|
||||
// void _saveMedicine() async {
|
||||
// final medName = _nameController.text;
|
||||
// final medGenericUUID = await _refGenericNames.getUUID(_selectedGeneric);
|
||||
// final medTypeUUID = await _refTypes.getUUID(_selectedType);
|
||||
// final medManufactorerUUID = await _refManufactorer.getUUID(_selectedManufactorer);
|
||||
|
||||
// await _refMedicines.postMedicine(medName, medGenericUUID, medManufactorerUUID, medTypeUUID);
|
||||
// }
|
||||
|
||||
void saveStock() async {
|
||||
final stockNameUUID = await _ref_medicines.getUUID(_selectedMedicine);
|
||||
final stockQuantity = _quantityController.text;
|
||||
final stockExpiration = _dateController.text;
|
||||
|
||||
await _stocks.postStock(stockNameUUID, stockExpiration, stockQuantity);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -71,19 +90,7 @@ class _AddStockPageState extends State<AddStockPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height * 8,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(34, 51, 69, 1),
|
||||
Color.fromRGBO(22, 32, 44, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import 'package:pharmacy_mobile/tables/ref_types.dart';
|
|||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/dropdown_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_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';
|
||||
|
||||
|
|
@ -37,19 +38,7 @@ class _AddTypePageState extends State<AddTypePage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(34, 51, 69, 1),
|
||||
Color.fromRGBO(22, 32, 44, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:go_router/go_router.dart';
|
|||
// import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_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';
|
||||
|
||||
|
|
@ -17,20 +18,7 @@ class IndexPage extends StatelessWidget {
|
|||
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(165, 105, 189, 1),
|
||||
Color.fromRGBO(142, 68, 173, 1),
|
||||
Color.fromRGBO(165, 105, 189, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.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';
|
||||
|
||||
|
|
@ -11,34 +12,36 @@ class ListStocksPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ListStocksPageState extends State<ListStocksPage> {
|
||||
List<DataRow> _createRows() {
|
||||
return [
|
||||
DataRow(cells: [DataCell(Text('#100')), DataCell(Text('Flutter Basics')), DataCell(Text('David John'))]),
|
||||
DataRow(cells: [DataCell(Text('#101')), DataCell(Text('Dart Internals')), DataCell(Text('Alex Wick'))])
|
||||
];
|
||||
}
|
||||
|
||||
List<DataColumn> _createColumns() {
|
||||
return [DataColumn(label: Text('ID')), DataColumn(label: Text('Book')), DataColumn(label: Text('Author'))];
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(34, 51, 69, 1),
|
||||
Color.fromRGBO(22, 32, 44, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Column(children: [
|
||||
const Gap(120),
|
||||
const TitleWidget(firstTextSize: 16, secondTextSize: 32),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'List of Stocks'),
|
||||
const Gap(16),
|
||||
DataTable(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black, width: 1.0),
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
color: Color.fromARGB(255, 240, 240, 240),
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(120),
|
||||
const TitleWidget(firstTextSize: 16, secondTextSize: 32),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'List of Stocks'),
|
||||
const Gap(16),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
columns: _createColumns(),
|
||||
rows: _createRows(),
|
||||
)
|
||||
])));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ 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/input_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';
|
||||
import 'package:quickalert/quickalert.dart';
|
||||
|
|
@ -67,19 +68,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(34, 51, 69, 1),
|
||||
Color.fromRGBO(22, 32, 44, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
|
|
@ -107,7 +96,11 @@ class _LoginPageState extends State<LoginPage> {
|
|||
_signIn();
|
||||
}
|
||||
},
|
||||
child: InputWidget(label: 'Password', controller: _passwordController, password: true,),
|
||||
child: InputWidget(
|
||||
label: 'Password',
|
||||
controller: _passwordController,
|
||||
password: true,
|
||||
),
|
||||
),
|
||||
const Gap(24),
|
||||
// TextButton(onPressed: () => {_signIn()}, child: const Text('Login'))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:go_router/go_router.dart';
|
|||
import 'package:pharmacy_mobile/auth/auth_service.dart';
|
||||
import 'package:pharmacy_mobile/widgets/button_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/menu_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';
|
||||
|
||||
|
|
@ -29,19 +30,7 @@ class MainPage extends StatelessWidget {
|
|||
}
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(34, 51, 69, 1),
|
||||
Color.fromRGBO(22, 32, 44, 1),
|
||||
],
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
body: PageBackgroundWidget(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -5,13 +5,15 @@ class RefMedicines {
|
|||
final SupabaseClient _supabase = Supabase.instance.client;
|
||||
|
||||
Future<List> getList() async {
|
||||
final data = await _supabase
|
||||
.from('ref_manufactorers')
|
||||
.select('manufactorer_name')
|
||||
.order('manufactorer_name', ascending: true);
|
||||
final data = await _supabase.from('ref_medicines').select('medicine_name').order('medicine_name', ascending: true);
|
||||
return data.toList();
|
||||
}
|
||||
|
||||
Future<String> getUUID(String name) async {
|
||||
final data = await _supabase.from('ref_medicines').select('ref_medicines_uuid').eq('medicine_name', name);
|
||||
return data.first['ref_medicines_uuid'];
|
||||
}
|
||||
|
||||
Future<void> postMedicine(String name, String muuid, String guuid, String tuuid) async {
|
||||
final uuid = Uuid().v4();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,16 @@ class Stocks {
|
|||
// return data.first['ref_types_uuid'].toString();
|
||||
// }
|
||||
|
||||
// Future<void> postType(String name) async {
|
||||
// final typeUUID = Uuid().v4();
|
||||
Future<void> postStock(String muuid, String name, String quantity) async {
|
||||
final uuid = Uuid().v4();
|
||||
|
||||
// await _supabase.from('ref_types').insert({'ref_types_uuid': typeUUID, 'type_name': name});
|
||||
// }
|
||||
final stock = {
|
||||
'stock_uuid': uuid,
|
||||
'ref_medicines_uuid': muuid,
|
||||
'expiration_date': name,
|
||||
'quantity': quantity,
|
||||
};
|
||||
|
||||
await _supabase.from('stocks').insert(stock);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
lib/widgets/page_background_widget.dart
Normal file
30
lib/widgets/page_background_widget.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class PageBackgroundWidget extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const PageBackgroundWidget({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
tileMode: TileMode.clamp,
|
||||
colors: [
|
||||
Color.fromRGBO(132, 84, 125, 1),
|
||||
Color.fromRGBO(96, 48, 90, 1),
|
||||
Color.fromRGBO(77, 29, 73, 1),
|
||||
// Color.fromRGBO(241, 220, 223, 1),
|
||||
],
|
||||
// begin: Alignment.topCenter,
|
||||
// end: Alignment.bottomCenter,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: child,
|
||||
));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue