123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- import 'dart:convert';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vitalapp/components/appbar.dart';
- import 'package:vitalapp/components/button.dart';
- import 'package:vitalapp/components/dialog_select.dart';
- import 'package:vitalapp/components/side_nav/defines.dart';
- import 'package:vitalapp/components/side_nav/side_nav.dart';
- import 'package:vitalapp/pages/contract/package_list/widgets/capture_portrait.dart';
- import 'package:vitalapp/pages/contract/package_list/widgets/family_doctor_service_package.dart';
- import 'package:vitalapp/pages/contract/package_list/widgets/personal_information.dart';
- import 'package:vitalapp/pages/contract/package_list/widgets/service_information.dart';
- import 'package:vitalapp/pages/contract/package_list/widgets/signing_status.dart';
- import 'controller.dart';
- class ServicePackageContractPage
- extends GetView<ServicePackageContractController> {
- const ServicePackageContractPage({super.key});
- static const double labelSize = 20;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: VAppBar(
- titleText: "签约",
- ),
- backgroundColor: Colors.white,
- body: _buildContent(context),
- );
- }
- static const TextStyle _textStyle = TextStyle(fontSize: 20);
- Widget _buildContent(BuildContext context) {
- TextEditingController? textEditingController =
- TextEditingController(text: controller.state.reasonRefusal);
- return Column(
- children: [
- Padding(
- padding: const EdgeInsets.only(left: 24.0),
- child: Obx(
- () => Row(
- children: [
- const Text(
- "签约选项:",
- style: _textStyle,
- ),
- const SizedBox(
- width: 8,
- ),
- SizedBox(
- height: 50,
- child: Row(
- children: [
- _OptionWidget(
- text: "签约",
- checked: !controller.state.isDenySbaVisa,
- onTap: () {
- if (controller.state.isDenySbaVisa) {
- controller.state.isDenySbaVisa = false;
- }
- },
- ),
- _OptionWidget(
- text: "拒签",
- checked: controller.state.isDenySbaVisa,
- onTap: () async {
- if (!controller.state.isDenySbaVisa) {
- controller.state.isDenySbaVisa = true;
- }
- // final result = await VDialogSelect<String, String>(
- // title: "拒签原因",
- // source: controller.state.reasonRefusals,
- // valueGetter: (data) => data,
- // labelGetter: (data) => data,
- // initialValue: controller.state.reasonRefusal,
- // ).show();
- // if (result != null) {
- // controller.state.reasonRefusal = result;
- // }
- },
- ),
- ],
- ),
- ),
- const SizedBox(
- width: 20,
- ),
- if (controller.state.isDenySbaVisa)
- ElevatedButton(
- onPressed: () {
- controller.submitContract();
- },
- style: ButtonStyle(
- foregroundColor:
- const MaterialStatePropertyAll(Colors.white),
- backgroundColor: MaterialStatePropertyAll(
- Theme.of(context).primaryColor),
- elevation: const MaterialStatePropertyAll(0),
- padding: const MaterialStatePropertyAll(
- EdgeInsets.symmetric(horizontal: 1, vertical: 1),
- ),
- ),
- child: const Text(
- "提交",
- style: _textStyle,
- ),
- ),
- ],
- ),
- ),
- ),
- Obx(() {
- if (!controller.state.isDenySbaVisa) {
- return Container();
- }
- return Padding(
- padding: const EdgeInsets.only(left: 24.0),
- child: Row(
- children: [
- const Text(
- "拒签原因:",
- style: _textStyle,
- ),
- Radio<int>(
- value: 0,
- groupValue: controller.state.selectedReasonIndex,
- onChanged: (value) {
- controller.state.selectedReasonIndex = value!;
- },
- ),
- const Text(
- '不自愿',
- style: _textStyle,
- ),
- Radio<int>(
- value: 1,
- groupValue: controller.state.selectedReasonIndex,
- onChanged: (value) {
- controller.state.selectedReasonIndex = value!;
- },
- ),
- const Text(
- '举家外出',
- style: _textStyle,
- ),
- Radio<int>(
- value: 2,
- groupValue: controller.state.selectedReasonIndex,
- onChanged: (value) {
- controller.state.selectedReasonIndex = value!;
- },
- ),
- const Text(
- '外出上学',
- style: _textStyle,
- ),
- Radio<int>(
- value: 3,
- groupValue: controller.state.selectedReasonIndex,
- onChanged: (value) {
- controller.state.selectedReasonIndex = value!;
- },
- ),
- const Text(
- '婚出',
- style: _textStyle,
- ),
- Radio<int>(
- value: 4,
- groupValue: controller.state.selectedReasonIndex,
- onChanged: (value) {
- controller.state.selectedReasonIndex = value!;
- },
- ),
- const Text(
- '服役',
- style: _textStyle,
- ),
- Radio<int>(
- value: 5,
- groupValue: controller.state.selectedReasonIndex,
- onChanged: (value) {
- controller.state.selectedReasonIndex = value!;
- },
- ),
- const Text(
- '服刑',
- style: _textStyle,
- ),
- Radio<int>(
- value: 6,
- groupValue: controller.state.selectedReasonIndex,
- onChanged: (value) {
- controller.state.selectedReasonIndex = value!;
- },
- ),
- const Text(
- '其他',
- style: _textStyle,
- ),
- const SizedBox(
- width: 8,
- ),
- if (controller.state.selectedReasonIndex == 6)
- Expanded(
- child: TextField(
- keyboardType: TextInputType.text,
- controller: textEditingController,
- onChanged: (value) {
- controller.state.reasonRefusal = value;
- },
- ),
- ),
- const SizedBox(
- width: 30,
- ),
- ],
- ),
- );
- }),
- const SizedBox(
- height: 8,
- ),
- const Divider(height: 1),
- Expanded(
- child: VSideNavView(
- // navId: NavIds.CONTRACT,
- items: _buildItems(),
- ),
- ),
- const Divider(height: 1),
- const SizedBox(
- height: 8,
- ),
- Obx(() {
- if (controller.state.isDenySbaVisa) {
- return Container();
- }
- return VButton(
- label: "签约协议",
- onTap: () {
- if (!controller.verifyData()) {
- return;
- }
- Get.toNamed(
- "/contract/contract_template",
- parameters: {
- "templateCode": controller.templateCode,
- "patientInfo": json.encode(controller.patient.toJson()),
- "servicePackageCodes":
- controller.state.selectedServicePackageCode,
- "servicePackageNames":
- controller.state.selectedServicePackageName,
- "serviceTime": controller.state.serviceTime.toString(),
- "serviceStartDate":
- controller.state.serviceStartDate.toString(),
- "base64Image": controller.state.userImage ?? '',
- "notes": controller.state.notes,
- },
- );
- },
- );
- }),
- const SizedBox(
- height: 8,
- ),
- ],
- );
- }
- List<VSideNavMenuItem> _buildItems() {
- final items = <VSideNavMenuItem>[];
- // items.add(_buildCapturePortrait());
- items.add(_buildPersonalInformation());
- items.add(_buildServiceInformation());
- items.add(_buildFamilyDoctorServicePackage());
- // items.add(_buildSigningStatusItem());
- return items;
- }
- // VSideNavMenuItem _buildCapturePortrait() {
- // return VSideNavMenuItem(
- // title: "人像采集",
- // icon: Icon(Icons.edit_document, color: Colors.grey.shade700),
- // pageBuilder: (context) {
- // return const CapturePortraitPage();
- // },
- // );
- // }
- VSideNavMenuItem _buildServiceInformation() {
- return VSideNavMenuItem(
- title: "服务信息",
- icon: Icon(Icons.edit_document, color: Colors.grey.shade700),
- pageBuilder: (context) {
- return const ServiceInformationPage();
- },
- );
- }
- VSideNavMenuItem _buildFamilyDoctorServicePackage() {
- return VSideNavMenuItem(
- title: "服务包",
- icon: Icon(Icons.edit_document, color: Colors.grey.shade700),
- pageBuilder: (context) {
- return const FamilyDoctorServicePackagePage();
- },
- );
- }
- VSideNavMenuItem _buildPersonalInformation() {
- return VSideNavMenuItem(
- title: "个人信息",
- icon: Icon(Icons.edit_document, color: Colors.grey.shade700),
- pageBuilder: (context) {
- return const PersonalInformationPage();
- },
- );
- }
- // VSideNavMenuItem _buildSigningStatusItem() {
- // return VSideNavMenuItem(
- // title: "签约状态",
- // isRequired: true,
- // icon: Icon(Icons.edit_document, color: Colors.grey.shade700),
- // pageBuilder: (context) {
- // return const SigningStatusPage();
- // },
- // );
- // }
- }
- class _OptionWidget extends StatelessWidget {
- final String text;
- final bool checked;
- final VoidCallback onTap;
- const _OptionWidget({
- super.key,
- required this.text,
- required this.checked,
- required this.onTap,
- });
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: onTap,
- child: Container(
- height: 32,
- width: 80,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(4),
- color: checked ? Theme.of(context).primaryColor : null,
- ),
- child: Text(
- text,
- style: TextStyle(color: checked ? Colors.white : null, fontSize: 20),
- ),
- ),
- );
- }
- }
|