create terms-condition in pharmacy order page
parent
2a91ae787f
commit
709ba2ce97
@ -0,0 +1,33 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart';
|
||||||
|
|
||||||
|
import '../base_service.dart';
|
||||||
|
|
||||||
|
class TermsConditionService extends BaseService{
|
||||||
|
bool isFinished = true;
|
||||||
|
bool hasError = false;
|
||||||
|
String errorMsg = '';
|
||||||
|
String successMsg = '';
|
||||||
|
|
||||||
|
ListUserAgreement listUserAgreement;
|
||||||
|
|
||||||
|
Future getUserTermsAndConditionsForEPharmcy() async {
|
||||||
|
hasError = false;
|
||||||
|
super.error = "";
|
||||||
|
|
||||||
|
Map<String, dynamic> body = Map();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await baseAppClient.post(LAKUM_GET_USER_TERMS_AND_CONDITIONS,
|
||||||
|
onSuccess: (response, statusCode) async {
|
||||||
|
listUserAgreement = ListUserAgreement.fromJson(response['ListUserAgreement'][0]);
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: body);
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/model/pharmacies/ListUserAgreement.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/parmacyModule/terms-condition-service.dart';
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import '../../../locator.dart';
|
||||||
|
import '../base_view_model.dart';
|
||||||
|
|
||||||
|
class TermsConditionViewModel extends BaseViewModel {
|
||||||
|
TermsConditionService _termsConditionService = locator<TermsConditionService>();
|
||||||
|
|
||||||
|
ListUserAgreement get listUserAgreement => _termsConditionService.listUserAgreement;
|
||||||
|
|
||||||
|
Future getUserTermsAndConditionsForEPharmcy() async {
|
||||||
|
setState(ViewState.Busy);
|
||||||
|
await _termsConditionService.getUserTermsAndConditionsForEPharmcy();
|
||||||
|
if (_termsConditionService.hasError) {
|
||||||
|
error = _termsConditionService.error;
|
||||||
|
setState(ViewState.Error);
|
||||||
|
} else {
|
||||||
|
setState(ViewState.Idle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/tems-condition-viewmodel.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_html/flutter_html.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class PharmacyTermsConditions extends StatelessWidget {
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectProvider = Provider.of(context);
|
||||||
|
|
||||||
|
return BaseView<TermsConditionViewModel>(
|
||||||
|
onModelReady: (model) => model.getUserTermsAndConditionsForEPharmcy(),
|
||||||
|
builder: (_, model, wi) => AppScaffold(
|
||||||
|
title: "Terms of service",
|
||||||
|
isShowAppBar: true,
|
||||||
|
isShowDecPage: false,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
baseViewModel: model,
|
||||||
|
body: Container(
|
||||||
|
margin: EdgeInsets.all(8),
|
||||||
|
width: double.infinity,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if (model.listUserAgreement != null &&
|
||||||
|
model.listUserAgreement.userAgreementLAKUM !=
|
||||||
|
null)
|
||||||
|
Html(
|
||||||
|
data: projectProvider.isArabic
|
||||||
|
? model.listUserAgreement.userAgreementTxtn
|
||||||
|
: model.listUserAgreement.userAgreementTxt,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue