update
This commit is contained in:
parent
55de28532f
commit
ff619ac88a
13 changed files with 192 additions and 145 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/widgets/customer_pagebackground_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/customer_title_widget.dart';
|
||||
|
|
@ -18,8 +19,18 @@ class CustomerCartPage extends StatelessWidget {
|
|||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(32),
|
||||
const TextWidget(text: 'My Cart'),
|
||||
// const TextWidget(text: 'My Cart'),
|
||||
// const Gap(16),
|
||||
FaIcon(
|
||||
FontAwesomeIcons.cartShopping,
|
||||
size: 56,
|
||||
color: const Color.fromRGBO(255, 255, 255, 1),
|
||||
),
|
||||
const Gap(16),
|
||||
const TextWidget(
|
||||
text: 'No items in cart',
|
||||
size: 24,
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:gap/gap.dart';
|
|||
import 'package:pharmacy_mobile/widgets/consultation_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/customer_pagebackground_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/customer_title_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/indicator_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
|
||||
class CustomerMainPage extends StatefulWidget {
|
||||
|
|
@ -23,16 +24,17 @@ class _CustomerMainPageState extends State<CustomerMainPage> {
|
|||
const Gap(68),
|
||||
const CustomerTitleWidget(),
|
||||
const Gap(16),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: 'Pharmacist Consultation',
|
||||
title: true,
|
||||
size: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
const IndicatorWidget(text: 'Pharmacist Consultation'),
|
||||
// const Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// TextWidget(
|
||||
// text: 'Pharmacist Consultation',
|
||||
// title: true,
|
||||
// size: 14,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
const Gap(8),
|
||||
ConsultationWidget(
|
||||
name: 'Ofelia Franco-Alcala, RPh',
|
||||
|
|
@ -52,16 +54,17 @@ class _CustomerMainPageState extends State<CustomerMainPage> {
|
|||
margin: 32,
|
||||
),
|
||||
const Gap(16),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: 'Doctor Consultation',
|
||||
title: true,
|
||||
size: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
const IndicatorWidget(text: 'Doctor Consultation'),
|
||||
// const Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// TextWidget(
|
||||
// text: 'Doctor Consultation',
|
||||
// title: true,
|
||||
// size: 14,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
const Gap(8),
|
||||
ConsultationWidget(
|
||||
name: 'Floherna Franco-Diccion, PhD',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
||||
import 'package:pharmacy_mobile/tables/stocks.dart';
|
||||
|
|
@ -11,8 +8,6 @@ import 'package:pharmacy_mobile/widgets/customer_title_widget.dart';
|
|||
import 'package:pharmacy_mobile/widgets/indicator_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/item_card_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:toggle_switch/toggle_switch.dart';
|
||||
|
||||
class CustomerSearchPage extends StatefulWidget {
|
||||
const CustomerSearchPage({super.key});
|
||||
|
|
@ -24,12 +19,12 @@ class CustomerSearchPage extends StatefulWidget {
|
|||
class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
||||
final _searchController = TextEditingController();
|
||||
final _storage = Storage();
|
||||
final _refMedicines = RefMedicines();
|
||||
// final _refMedicines = RefMedicines();
|
||||
final _stocks = Stocks();
|
||||
// final _refMedicines = RefMedicines();
|
||||
late String imageUrl = '';
|
||||
late List _stockList = [];
|
||||
late List _medicinesList = [];
|
||||
// late final List _medicinesList = [];
|
||||
|
||||
Future<void> _getURL() async {
|
||||
final image = await _storage.getPublicURL('ref_medicines_images', 'a3e430fe-86c1-4d46-9c6a-aed2dae57fef.webp');
|
||||
|
|
@ -42,12 +37,12 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
_stockList = await _stocks.getList();
|
||||
}
|
||||
|
||||
Future<void> _getAllMedicines() async {
|
||||
_medicinesList = await _refMedicines.getList();
|
||||
}
|
||||
// Future<void> _getAllMedicines() async {
|
||||
// _medicinesList = await _refMedicines.getList();
|
||||
// }
|
||||
|
||||
// void getURLs() async {
|
||||
// try {
|
||||
// try {demo@
|
||||
// for (int i = 1; i <= 4; i++) {
|
||||
// final image = await _storage.getPublicURL(
|
||||
// context,
|
||||
|
|
@ -88,8 +83,6 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// const double imageSize = 180;
|
||||
|
||||
return Scaffold(
|
||||
body: CustomerPagebackgroundWidget(
|
||||
height: MediaQuery.of(context).size.height + 800,
|
||||
|
|
@ -150,6 +143,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: 'imageUrl',
|
||||
text: 'item[medicine_name]',
|
||||
subtext: 'item[generic_name]',
|
||||
price: 123,
|
||||
quantity: 123,
|
||||
isLoading: true,
|
||||
|
|
@ -157,6 +151,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: 'imageUrl',
|
||||
text: 'item[medicine_name]',
|
||||
subtext: 'item[generic_name]',
|
||||
price: 123,
|
||||
quantity: 123,
|
||||
isLoading: true,
|
||||
|
|
@ -164,6 +159,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: 'imageUrl',
|
||||
text: 'item[medicine_name]',
|
||||
subtext: 'item[generic_name]',
|
||||
price: 123,
|
||||
quantity: 123,
|
||||
isLoading: true,
|
||||
|
|
@ -175,6 +171,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: item['medicine_name'].toString(),
|
||||
subtext: item['generic_name'].toString(),
|
||||
price: item['price'].toDouble(),
|
||||
quantity: item['quantity'].toDouble(),
|
||||
isLoading: false,
|
||||
|
|
@ -191,6 +188,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 0,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -198,6 +196,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -205,6 +204,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -221,6 +221,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -228,6 +229,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -235,6 +237,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -251,6 +254,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -258,6 +262,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -265,6 +270,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -281,6 +287,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -288,6 +295,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
@ -295,6 +303,7 @@ class _CustomerSearchPageState extends State<CustomerSearchPage> {
|
|||
ItemCardWidget(
|
||||
imageUrl: imageUrl,
|
||||
text: 'sample',
|
||||
subtext: 'generic_name',
|
||||
price: 500,
|
||||
quantity: 15,
|
||||
isLoading: imageUrl.isEmpty,
|
||||
|
|
|
|||
|
|
@ -10,14 +10,15 @@ class Stocks {
|
|||
try {
|
||||
final data = await _supabase
|
||||
.from('stocks')
|
||||
.select('ref_medicines(medicine_name), expiration_date, quantity, price')
|
||||
.select('ref_medicines(medicine_name, ref_generic_names(generic_name)), expiration_date, quantity, price')
|
||||
.order('ref_medicines(medicine_name)', ascending: true);
|
||||
|
||||
for (var item in data) {
|
||||
stockData.add({
|
||||
'medicine_name': item['ref_medicines']['medicine_name'],
|
||||
'quantity': item['quantity'],
|
||||
'generic_name': item['ref_medicines']['ref_generic_names']['generic_name'],
|
||||
'expiration_date': item['expiration_date'],
|
||||
'quantity': item['quantity'],
|
||||
'price': item['price'],
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
|
@ -7,6 +8,7 @@ import 'package:redacted/redacted.dart';
|
|||
class ItemCardWidget extends StatelessWidget {
|
||||
final String imageUrl;
|
||||
final String text;
|
||||
final String subtext;
|
||||
final double price;
|
||||
final double quantity;
|
||||
final bool isLoading;
|
||||
|
|
@ -15,6 +17,7 @@ class ItemCardWidget extends StatelessWidget {
|
|||
{super.key,
|
||||
required this.imageUrl,
|
||||
required this.text,
|
||||
required this.subtext,
|
||||
required this.price,
|
||||
required this.quantity,
|
||||
required this.isLoading});
|
||||
|
|
@ -48,7 +51,7 @@ class ItemCardWidget extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextWidget(
|
||||
text: text,
|
||||
text: subtext,
|
||||
size: 8,
|
||||
color: const Color.fromRGBO(0, 0, 0, 1),
|
||||
bold: true,
|
||||
|
|
@ -84,18 +87,38 @@ class ItemCardWidget extends StatelessWidget {
|
|||
const Gap(8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset('assets/php_logo.webp',
|
||||
fit: BoxFit.cover, height: 12, cacheHeight: (12 * MediaQuery.of(context).devicePixelRatio).round()),
|
||||
const Gap(4),
|
||||
TextWidget(
|
||||
text: NumberFormat.currency(locale: "en_US", symbol: "").format(price),
|
||||
size: 16,
|
||||
bold: true,
|
||||
color: fontColor,
|
||||
),
|
||||
],
|
||||
child: SizedBox(
|
||||
width: imageSize * 0.9,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Image.asset('assets/php_logo.webp',
|
||||
fit: BoxFit.cover,
|
||||
height: 12,
|
||||
cacheHeight: (12 * MediaQuery.of(context).devicePixelRatio).round()),
|
||||
const Gap(4),
|
||||
TextWidget(
|
||||
text: NumberFormat.currency(locale: "en_US", symbol: "").format(price),
|
||||
size: 16,
|
||||
bold: true,
|
||||
color: fontColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: FaIcon(
|
||||
FontAwesomeIcons.cartShopping,
|
||||
size: 12,
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue