diff --git a/lib/config/config.dart b/lib/config/config.dart index 6bf726ac..0b3fc7ea 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index 84691773..3ce724bf 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -21,64 +21,112 @@ class PrescriptionsHistoryPage extends StatelessWidget { return AppScaffold( baseViewModel: prescriptionsViewModel, - body: ListView.builder( + body: ListView.separated( physics: BouncingScrollPhysics(), - itemBuilder: (context, index) => InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionsHistoryDetailsPage( - prescriptionsOrder: - prescriptionsViewModel.prescriptionsHistory[index], - ), - ), - ), - child: Container( - padding: EdgeInsets.all(15.0), - margin: EdgeInsets.all(8.0), - decoration: - BoxDecoration(shape: BoxShape.rectangle, color: Colors.white), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - DateUtil.getDayMonthYearHourMinuteDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), - fontWeight: FontWeight.w300, - ), - SizedBox( - height: 5, - ), - Texts( - '${TranslationBase.of(context).orderNo} ${prescriptionsViewModel.prescriptionsHistory[index].iD}'), - SizedBox( - height: 5, - ), - Texts( - '${prescriptionsViewModel.prescriptionsHistory[index].descriptionN}'), - SizedBox( - height: 5, + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) { + return SizedBox(height: 12); + }, + itemBuilder: (context, index) { + int status = prescriptionsViewModel.prescriptionsHistory[index].status; + String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4) { + //cancel // Rejected + _color = Color(0xffD02127); + } + + return InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: PrescriptionsHistoryDetailsPage( + prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], ), - Texts( - '${TranslationBase.of(context).orderNo}', - fontWeight: FontWeight.w300, + ), + ), + child: Container( + height: 65, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: 6, + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(10.0), + bottomLeft: Radius.circular(10.0), + ), ), - SizedBox( - height: 5, + ), + Expanded( + child: Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.formatDateToDate(prescriptionsViewModel.prescriptionsHistory[index].createdOn, projectViewModel.isArabic), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + DateUtil.formatDateToTime(prescriptionsViewModel.prescriptionsHistory[index].createdOn), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) + ], + ), ), - ], - ), + ) + ], ), - Icon( - Icons.arrow_forward_ios, - size: 25, - ) - ], - ), - ), - ), + )); + }, itemCount: prescriptionsViewModel.prescriptionsHistory.length, ), ); diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 7d65837d..204d917f 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -76,7 +76,10 @@ class _HomePrescriptionsPageState extends State with Sing fontWeight: FontWeight.w600, letterSpacing: -0.48, ), - tabs: [Text(TranslationBase.of(context).prescriptions, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), Text(TranslationBase.of(context).history, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'))], + tabs: [ + Text(TranslationBase.of(context).prescriptions, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + Text(TranslationBase.of(context).orderLog, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins')), + ], ), Expanded( child: TabBarView(