GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1131 lines
64 KiB

2 months ago
  1. import 'dart:convert';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:fluttertoast/fluttertoast.dart';
  5. import 'package:google_fonts/google_fonts.dart';
  6. import 'package:employee_selfservice_mobile/Screens/Menu/SuratTugas/RequestHttp/pengajuanST_post.dart';
  7. import 'package:intl/intl.dart';
  8. import 'package:progress_dialog_null_safe/progress_dialog_null_safe.dart';
  9. import 'dart:developer' as logDev;
  10. import '../SlipGaji/background.dart';
  11. List<String> fileAttach = [""];
  12. TextEditingController keperluanTeksController = TextEditingController();
  13. TextEditingController tujuanTeksController = TextEditingController();
  14. TextEditingController uangMukaTeksController = TextEditingController();
  15. TextEditingController ticketFromTeksController = TextEditingController();
  16. TextEditingController ticketToTeksController = TextEditingController();
  17. TextEditingController ticketPriceTeksController = TextEditingController();
  18. class PengajuanUangMukaTambahan_Screen extends StatefulWidget {
  19. const PengajuanUangMukaTambahan_Screen({Key? key}) : super(key: key);
  20. @override
  21. State<PengajuanUangMukaTambahan_Screen> createState() => _PengajuanUangMukaTambahan_Screen();
  22. }
  23. class _PengajuanUangMukaTambahan_Screen extends State<PengajuanUangMukaTambahan_Screen> {
  24. String _fileText = "";
  25. String _totalFile= "";
  26. bool visibleDateST = false;
  27. bool visibleDateDeparture = false;
  28. bool visibleDateReturn = false;
  29. bool visibleDateTicket = false;
  30. DateTime dateFrom = DateTime.now();
  31. late String formattedDateST = "";
  32. late String formattedDateDeparture = "";
  33. late String formattedDateReturn = "";
  34. late String formattedDateTicket = "";
  35. late String kendaraan;
  36. var selectedTicketType;
  37. initState(){
  38. keperluanTeksController.clear();
  39. tujuanTeksController.clear();
  40. uangMukaTeksController.clear();
  41. ticketFromTeksController.clear();
  42. ticketToTeksController.clear();
  43. ticketPriceTeksController.clear();
  44. //loadingPage();
  45. /*WidgetsBinding.instance.addPostFrameCallback((_) {
  46. cutiType = getJenisCuti();
  47. });*/
  48. super.initState();
  49. }
  50. @override
  51. Widget build(BuildContext context) {
  52. return Scaffold(
  53. body: SingleChildScrollView(
  54. child: Column(
  55. children: <Widget>[
  56. Stack(
  57. children: [
  58. WavyHeader(),
  59. Container(
  60. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
  61. padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
  62. child: Row(
  63. mainAxisAlignment: MainAxisAlignment.end,
  64. crossAxisAlignment: CrossAxisAlignment.end,
  65. children: [
  66. Text(
  67. 'Submission\t\t',
  68. maxLines: 2,
  69. style: GoogleFonts.luckiestGuy(
  70. fontSize: 28,
  71. color: Color(0xFF4858A7),
  72. fontStyle: FontStyle.italic,
  73. ),
  74. ),
  75. Image.asset('assets/images/submit_st.png',
  76. width: 40,
  77. height: 40,
  78. ),
  79. ],
  80. )),
  81. SafeArea(
  82. child: Container(
  83. width: MediaQuery.of(context).size.width,
  84. margin: EdgeInsets.only(
  85. top: MediaQuery.of(context).size.height / 5, left: 10, right: 10, bottom: 10
  86. ),
  87. child: Column(
  88. children: [
  89. Container(
  90. child: Card(
  91. elevation: 10,
  92. child: Container(
  93. decoration: BoxDecoration(
  94. color: Color(0XFFFAF7EE),
  95. borderRadius: BorderRadius.circular(10)),
  96. child: Column(
  97. children: [
  98. Container(
  99. margin: EdgeInsets.only(
  100. left: 10, right: 10, top: 15, bottom: 15),
  101. child: Text('Assignment Letter Submission', style:
  102. GoogleFonts.josefinSans(fontSize: 18, fontWeight: FontWeight.bold, decoration: TextDecoration.underline,
  103. decorationStyle: TextDecorationStyle.dashed),),
  104. ),
  105. Container(
  106. margin: EdgeInsets.only(
  107. left: 10, right: 10, top: 10, bottom: 10),
  108. child: Column(
  109. children: [
  110. Row(
  111. children: [
  112. Expanded(
  113. flex: 3,
  114. child: Text(
  115. 'Assigment Letter Date',
  116. style: GoogleFonts.inconsolata(
  117. fontSize: 17),
  118. )),
  119. Expanded(
  120. flex: 7,
  121. child: Column(
  122. children: [
  123. ElevatedButton(
  124. onPressed: () async {
  125. DateTime? newDate =
  126. await showDatePicker(
  127. context: context,
  128. initialDate: dateFrom,
  129. firstDate:
  130. DateTime(1900),
  131. lastDate:
  132. DateTime(2100));
  133. final DateFormat formatter = DateFormat('yyyy-MM-dd');
  134. if (newDate == null) {
  135. return;
  136. } else {
  137. setState(() {
  138. if (visibleDateST == false){
  139. visibleDateST = !visibleDateST;
  140. }
  141. formattedDateST = formatter.format(newDate);
  142. //dateFrom = formattedFrom as DateTime;
  143. });
  144. }
  145. },
  146. /*style: ElevatedButton.styleFrom(
  147. backgroundColor:
  148. CupertinoColors
  149. .systemGrey2),*/
  150. child: Container(
  151. width: double.infinity,
  152. child: Text(
  153. "Choose Date",
  154. style: TextStyle(
  155. color: Colors.white,
  156. fontSize: 16,
  157. fontWeight:
  158. FontWeight.w400),
  159. ),
  160. ),
  161. ),
  162. ],
  163. ),
  164. ),
  165. ],
  166. ),Row(
  167. children: [
  168. Expanded(
  169. flex: 3,
  170. child: Text(
  171. '',
  172. style: GoogleFonts.inconsolata(
  173. fontSize: 17),
  174. )),
  175. Expanded(
  176. flex: 7,
  177. child: Column(
  178. children: [
  179. Visibility(
  180. visible: visibleDateST,
  181. child: Container(
  182. alignment: Alignment.centerLeft,
  183. margin: EdgeInsets.only(
  184. left: 15,
  185. right: 15,
  186. bottom: 5),
  187. child: Text(formattedDateST,
  188. overflow:
  189. TextOverflow.ellipsis,
  190. maxLines: 1,
  191. style: TextStyle(
  192. color: Colors.black54),
  193. ),
  194. ),
  195. )
  196. ],
  197. ),
  198. ),
  199. ],
  200. ),
  201. ],
  202. ),
  203. ),
  204. Container(
  205. margin: EdgeInsets.only(
  206. left: 10, right: 10, top: 10, bottom: 10),
  207. child: Row(
  208. children: [
  209. Expanded(
  210. flex: 3,
  211. child: Text(
  212. 'Description\nof Needs',
  213. style: GoogleFonts.inconsolata(
  214. fontSize: 17),
  215. )),
  216. Expanded(
  217. flex: 7,
  218. child: Container(
  219. decoration: BoxDecoration(
  220. color: Colors.white,
  221. borderRadius:
  222. BorderRadius.circular(5)),
  223. child: Padding(
  224. padding: EdgeInsets.only(
  225. left: 10,
  226. right: 10,
  227. top: 5,
  228. bottom: 5),
  229. child: TextFormField(
  230. keyboardType:
  231. TextInputType.multiline,
  232. maxLines: 1,
  233. textInputAction:
  234. TextInputAction.next,
  235. controller: keperluanTeksController,
  236. decoration: InputDecoration(
  237. border:
  238. InputBorder.none,
  239. hintText: "description")),
  240. ))),
  241. ],
  242. ),
  243. ),
  244. Container(
  245. margin: EdgeInsets.only(
  246. left: 10, right: 10, top: 10, bottom: 10),
  247. child: Column(
  248. children: [
  249. Row(
  250. children: [
  251. Expanded(
  252. flex: 3,
  253. child: Text(
  254. 'Departure\nDate',
  255. style: GoogleFonts.inconsolata(
  256. fontSize: 17),
  257. )),
  258. Expanded(
  259. flex: 7,
  260. child: Column(
  261. children: [
  262. ElevatedButton(
  263. onPressed: () async {
  264. DateTime? newDate =
  265. await showDatePicker(
  266. context: context,
  267. initialDate: dateFrom,
  268. firstDate:
  269. DateTime(1900),
  270. lastDate:
  271. DateTime(2100));
  272. final DateFormat formatter = DateFormat('yyyy-MM-dd');
  273. if (newDate == null) {
  274. return;
  275. } else {
  276. setState(() {
  277. if (visibleDateDeparture == false){
  278. visibleDateDeparture = !visibleDateDeparture;
  279. }
  280. formattedDateDeparture = formatter.format(newDate);
  281. //dateFrom = formattedFrom as DateTime;
  282. });
  283. }
  284. },
  285. /*style: ElevatedButton.styleFrom(
  286. backgroundColor:
  287. CupertinoColors
  288. .systemGrey2),*/
  289. child: Container(
  290. width: double.infinity,
  291. child: Text(
  292. "Choose Date",
  293. style: TextStyle(
  294. color: Colors.white,
  295. fontSize: 16,
  296. fontWeight:
  297. FontWeight.w400),
  298. ),
  299. ),
  300. ),
  301. ],
  302. ),
  303. ),
  304. ],
  305. ),Row(
  306. children: [
  307. Expanded(
  308. flex: 3,
  309. child: Text(
  310. '',
  311. style: GoogleFonts.inconsolata(
  312. fontSize: 17),
  313. )),
  314. Expanded(
  315. flex: 7,
  316. child: Column(
  317. children: [
  318. Visibility(
  319. visible: visibleDateDeparture,
  320. child: Container(
  321. alignment: Alignment.centerLeft,
  322. margin: EdgeInsets.only(
  323. left: 15,
  324. right: 15,
  325. bottom: 5),
  326. child: Text(formattedDateDeparture,
  327. overflow:
  328. TextOverflow.ellipsis,
  329. maxLines: 1,
  330. style: TextStyle(
  331. color: Colors.black54),
  332. ),
  333. ),
  334. )
  335. ],
  336. ),
  337. ),
  338. ],
  339. ),
  340. ],
  341. ),
  342. ),
  343. Container(
  344. margin: EdgeInsets.only(
  345. left: 10, right: 10, top: 10, bottom: 10),
  346. child: Column(
  347. children: [
  348. Row(
  349. children: [
  350. Expanded(
  351. flex: 3,
  352. child: Text(
  353. 'Return Date',
  354. style: GoogleFonts.inconsolata(
  355. fontSize: 17),
  356. )),
  357. Expanded(
  358. flex: 7,
  359. child: Column(
  360. children: [
  361. ElevatedButton(
  362. onPressed: () async {
  363. DateTime? newDate =
  364. await showDatePicker(
  365. context: context,
  366. initialDate: dateFrom,
  367. firstDate:
  368. DateTime(1900),
  369. lastDate:
  370. DateTime(2100));
  371. final DateFormat formatter = DateFormat('yyyy-MM-dd');
  372. if (newDate == null) {
  373. return;
  374. } else {
  375. setState(() {
  376. if (visibleDateReturn == false){
  377. visibleDateReturn = !visibleDateReturn;
  378. }
  379. formattedDateReturn = formatter.format(newDate);
  380. //dateFrom = formattedFrom as DateTime;
  381. });
  382. }
  383. },
  384. /*style: ElevatedButton.styleFrom(
  385. backgroundColor:
  386. CupertinoColors
  387. .systemGrey2),*/
  388. child: Container(
  389. width: double.infinity,
  390. child: Text(
  391. "Choose Date",
  392. style: TextStyle(
  393. color: Colors.white,
  394. fontSize: 16,
  395. fontWeight:
  396. FontWeight.w400),
  397. ),
  398. ),
  399. ),
  400. ],
  401. ),
  402. ),
  403. ],
  404. ),Row(
  405. children: [
  406. Expanded(
  407. flex: 3,
  408. child: Text(
  409. '',
  410. style: GoogleFonts.inconsolata(
  411. fontSize: 17),
  412. )),
  413. Expanded(
  414. flex: 7,
  415. child: Column(
  416. children: [
  417. Visibility(
  418. visible: visibleDateReturn,
  419. child: Container(
  420. alignment: Alignment.centerLeft,
  421. margin: EdgeInsets.only(
  422. left: 15,
  423. right: 15,
  424. bottom: 5),
  425. child: Text(formattedDateReturn,
  426. overflow:
  427. TextOverflow.ellipsis,
  428. maxLines: 1,
  429. style: TextStyle(
  430. color: Colors.black54),
  431. ),
  432. ),
  433. )
  434. ],
  435. ),
  436. ),
  437. ],
  438. ),
  439. ],
  440. ),
  441. ),
  442. Container(
  443. margin: EdgeInsets.only(
  444. left: 10, right: 10, top: 10, bottom: 10),
  445. child: Row(
  446. children: [
  447. Expanded(
  448. flex: 3,
  449. child: Text(
  450. 'Destination',
  451. style: GoogleFonts.inconsolata(
  452. fontSize: 17),
  453. )),
  454. Expanded(
  455. flex: 7,
  456. child: Container(
  457. decoration: BoxDecoration(
  458. color: Colors.white,
  459. borderRadius:
  460. BorderRadius.circular(5)),
  461. child: Padding(
  462. padding: EdgeInsets.only(
  463. left: 10,
  464. right: 10,
  465. top: 5,
  466. bottom: 5),
  467. child: TextFormField(
  468. keyboardType:
  469. TextInputType.multiline,
  470. maxLines: null,
  471. textInputAction:
  472. TextInputAction.next,
  473. controller: tujuanTeksController,
  474. decoration: InputDecoration(
  475. border:
  476. InputBorder.none,
  477. hintText: "ex. Bali")),
  478. ))),
  479. ],
  480. ),
  481. ),
  482. Container(
  483. margin: EdgeInsets.only(
  484. left: 10, right: 10, top: 10, bottom: 10),
  485. child: Row(
  486. children: [
  487. Expanded(
  488. flex: 3,
  489. child: Text(
  490. 'Down Payment',
  491. style: GoogleFonts.inconsolata(
  492. fontSize: 17),
  493. )),
  494. Expanded(
  495. flex: 7,
  496. child: Container(
  497. decoration: BoxDecoration(
  498. color: Colors.white,
  499. borderRadius:
  500. BorderRadius.circular(5)),
  501. child: Padding(
  502. padding: EdgeInsets.only(
  503. left: 10,
  504. right: 10,
  505. top: 5,
  506. bottom: 5),
  507. child: TextFormField(
  508. keyboardType: TextInputType.number,
  509. maxLines: null,
  510. textInputAction:
  511. TextInputAction.next,
  512. controller: uangMukaTeksController,
  513. decoration: InputDecoration(
  514. border:
  515. InputBorder.none,
  516. hintText: "ex. 1500500")),
  517. ))),
  518. ],
  519. ),
  520. ),
  521. Container(
  522. margin: EdgeInsets.only(
  523. left: 10, right: 10, top: 10, bottom: 10),
  524. child: Row(
  525. children: [
  526. Expanded(
  527. flex: 3,
  528. child: Text(
  529. 'Ticket Type',
  530. style: GoogleFonts.inconsolata(
  531. fontSize: 17),
  532. )),
  533. Expanded(
  534. flex: 7,
  535. child: Container(
  536. decoration: BoxDecoration(
  537. color:
  538. CupertinoColors.systemGrey2,
  539. borderRadius:
  540. BorderRadius.circular(5)),
  541. child: DropdownButton(
  542. value: this.selectedTicketType,
  543. isExpanded: true,
  544. underline: SizedBox(),
  545. hint: Text(
  546. '\t\tChoose Ticket Type',
  547. style: TextStyle(
  548. color: Colors.black54),
  549. ),
  550. onChanged: (value) {
  551. print(value);
  552. setState(() {
  553. selectedTicketType = value!;
  554. if (selectedTicketType == "airplane"){
  555. kendaraan = "pesawat";
  556. } else if (selectedTicketType == "train"){
  557. kendaraan = "kereta";
  558. }
  559. });
  560. },
  561. items: ticketType
  562. .map(
  563. (e) => DropdownMenuItem(
  564. value: e,
  565. child:
  566. Text("\t\t\t" + e)),
  567. )
  568. .toList(),
  569. ),
  570. )),
  571. ],
  572. ),
  573. ),
  574. Container(
  575. margin: EdgeInsets.only(
  576. left: 10, right: 10, top: 10, bottom: 10),
  577. child: Row(
  578. children: [
  579. Expanded(
  580. flex: 3,
  581. child: Text(
  582. 'Ticket From',
  583. style: GoogleFonts.inconsolata(
  584. fontSize: 17),
  585. )),
  586. Expanded(
  587. flex: 7,
  588. child: Container(
  589. decoration: BoxDecoration(
  590. color: Colors.white,
  591. borderRadius:
  592. BorderRadius.circular(5)),
  593. child: Padding(
  594. padding: EdgeInsets.only(
  595. left: 10,
  596. right: 10,
  597. top: 5,
  598. bottom: 5),
  599. child: TextFormField(
  600. keyboardType:
  601. TextInputType.multiline,
  602. maxLines: null,
  603. textInputAction:
  604. TextInputAction.next,
  605. controller: ticketFromTeksController,
  606. decoration: InputDecoration(
  607. border:
  608. InputBorder.none,
  609. hintText: "ex. Jakarta")),
  610. ))),
  611. ],
  612. ),
  613. ),
  614. Container(
  615. margin: EdgeInsets.only(
  616. left: 10, right: 10, top: 10, bottom: 10),
  617. child: Row(
  618. children: [
  619. Expanded(
  620. flex: 3,
  621. child: Text(
  622. 'Ticket To',
  623. style: GoogleFonts.inconsolata(
  624. fontSize: 17),
  625. )),
  626. Expanded(
  627. flex: 7,
  628. child: Container(
  629. decoration: BoxDecoration(
  630. color: Colors.white,
  631. borderRadius:
  632. BorderRadius.circular(5)),
  633. child: Padding(
  634. padding: EdgeInsets.only(
  635. left: 10,
  636. right: 10,
  637. top: 5,
  638. bottom: 5),
  639. child: TextFormField(
  640. keyboardType:
  641. TextInputType.multiline,
  642. maxLines: null,
  643. textInputAction:
  644. TextInputAction.next,
  645. controller: ticketToTeksController,
  646. decoration: InputDecoration(
  647. border:
  648. InputBorder.none,
  649. hintText: "ex. Bali")),
  650. ))),
  651. ],
  652. ),
  653. ),
  654. Container(
  655. margin: EdgeInsets.only(
  656. left: 10, right: 10, top: 10, bottom: 10),
  657. child: Column(
  658. children: [
  659. Row(
  660. children: [
  661. Expanded(
  662. flex: 3,
  663. child: Text(
  664. 'Ticket Date',
  665. style: GoogleFonts.inconsolata(
  666. fontSize: 17),
  667. )),
  668. Expanded(
  669. flex: 7,
  670. child: Column(
  671. children: [
  672. ElevatedButton(
  673. onPressed: () async {
  674. DateTime? newDate =
  675. await showDatePicker(
  676. context: context,
  677. initialDate: dateFrom,
  678. firstDate:
  679. DateTime(1900),
  680. lastDate:
  681. DateTime(2100));
  682. final DateFormat formatter = DateFormat('yyyy-MM-dd');
  683. if (newDate == null) {
  684. return;
  685. } else {
  686. setState(() {
  687. if (visibleDateTicket == false){
  688. visibleDateTicket = !visibleDateTicket;
  689. }
  690. formattedDateTicket = formatter.format(newDate);
  691. //dateFrom = formattedFrom as DateTime;
  692. });
  693. }
  694. },
  695. /*style: ElevatedButton.styleFrom(
  696. backgroundColor:
  697. CupertinoColors
  698. .systemGrey2),*/
  699. child: Container(
  700. width: double.infinity,
  701. child: Text(
  702. "Choose Date",
  703. style: TextStyle(
  704. color: Colors.white,
  705. fontSize: 16,
  706. fontWeight:
  707. FontWeight.w400),
  708. ),
  709. ),
  710. ),
  711. ],
  712. ),
  713. ),
  714. ],
  715. ),Row(
  716. children: [
  717. Expanded(
  718. flex: 3,
  719. child: Text(
  720. '',
  721. style: GoogleFonts.inconsolata(
  722. fontSize: 17),
  723. )),
  724. Expanded(
  725. flex: 7,
  726. child: Column(
  727. children: [
  728. Visibility(
  729. visible: visibleDateTicket,
  730. child: Container(
  731. alignment: Alignment.centerLeft,
  732. margin: EdgeInsets.only(
  733. left: 15,
  734. right: 15,
  735. bottom: 5),
  736. child: Text(formattedDateTicket,
  737. overflow:
  738. TextOverflow.ellipsis,
  739. maxLines: 1,
  740. style: TextStyle(
  741. color: Colors.black54),
  742. ),
  743. ),
  744. )
  745. ],
  746. ),
  747. ),
  748. ],
  749. ),
  750. ],
  751. ),
  752. ),
  753. Container(
  754. margin: EdgeInsets.only(
  755. left: 10, right: 10, top: 10, bottom: 10),
  756. child: Row(
  757. children: [
  758. Expanded(
  759. flex: 3,
  760. child: Text(
  761. 'Ticket Price',
  762. style: GoogleFonts.inconsolata(
  763. fontSize: 17),
  764. )),
  765. Expanded(
  766. flex: 7,
  767. child: Container(
  768. decoration: BoxDecoration(
  769. color: Colors.white,
  770. borderRadius:
  771. BorderRadius.circular(5)),
  772. child: Padding(
  773. padding: EdgeInsets.only(
  774. left: 10,
  775. right: 10,
  776. top: 5,
  777. bottom: 5),
  778. child: TextFormField(
  779. keyboardType:
  780. TextInputType.number,
  781. maxLines: null,
  782. textInputAction:
  783. TextInputAction.done,
  784. controller: ticketPriceTeksController,
  785. decoration: InputDecoration(
  786. border:
  787. InputBorder.none,
  788. hintText: "ex. 1550000")),
  789. ))),
  790. ],
  791. ),
  792. ),
  793. Container(
  794. margin: EdgeInsets.only(
  795. left: 10, right: 10, top: 10, bottom: 10),
  796. child: Column(
  797. children: [
  798. InkWell(
  799. child: Container(
  800. padding: EdgeInsets.fromLTRB(
  801. 10, 10, 10, 10),
  802. width: double.infinity,
  803. decoration: BoxDecoration(
  804. borderRadius:
  805. BorderRadius.circular(5),
  806. gradient: LinearGradient(colors: [
  807. Color(0xFFFF9945),
  808. Color(0xFFFc6076)
  809. ])),
  810. child: Text('Submit',
  811. textAlign: TextAlign.center,
  812. style: TextStyle(
  813. color: Colors.white,
  814. fontSize: 17,
  815. fontWeight: FontWeight.w500)),
  816. ),
  817. onTap: () async {
  818. ProgressDialog loading = ProgressDialog(context);
  819. loading = ProgressDialog(context,
  820. type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
  821. loading.style(
  822. message: 'Please Wait .....',
  823. borderRadius: 3,
  824. backgroundColor: Colors.white,
  825. progressWidget: CircularProgressIndicator(),
  826. elevation: 10.0,
  827. padding: EdgeInsets.all(10),
  828. insetAnimCurve: Curves.easeInOut,
  829. progress: 0.0,
  830. maxProgress: 100.0,
  831. progressTextStyle: TextStyle(
  832. color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
  833. messageTextStyle: TextStyle(
  834. color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
  835. if (!validateFormPengajuanST(context)){
  836. return;
  837. } else if (validateFormPengajuanST(context)){
  838. await loading.show();
  839. PengajuanST_Post.connectToAPI(
  840. formattedDateST, uangMukaTeksController.text.toString(), keperluanTeksController.text.toString(),
  841. formattedDateDeparture, formattedDateReturn, tujuanTeksController.text.toString(), kendaraan,
  842. ticketFromTeksController.text.toString(), ticketToTeksController.text.toString(), formattedDateTicket,
  843. ticketPriceTeksController.text.toString()).then((valueResult) async {
  844. logDev.log(kendaraan, name: "TICKET TYPE - Kendaraan");
  845. Map<String, dynamic> object = json.decode(valueResult);
  846. if (object.containsKey("result").toString() == "true") {
  847. String result = object['result'].toString();
  848. if (result.contains("failed")){
  849. await loading.hide();
  850. Widget okButton = TextButton(
  851. child: Text("OK"),
  852. onPressed: () {
  853. Navigator.of(context, rootNavigator: true).pop();
  854. },
  855. );
  856. // set up the AlertDialog
  857. AlertDialog alert = AlertDialog(
  858. title: Text("Employee Self Service"),
  859. content: Text("Error Submit, Please Try Again Later!"),
  860. actions: [
  861. okButton,
  862. ],
  863. );
  864. // show the dialog
  865. showDialog(
  866. context: context,
  867. builder: (BuildContext context) {
  868. return alert;
  869. },
  870. );
  871. } else {
  872. await loading.hide();
  873. /*formattedDateFrom = "";
  874. visibleDateFrom = false;
  875. visibleDateFrom = false;
  876. deskripsiTeksController.clear();*/
  877. Widget okButton = TextButton(
  878. child: Text("OK"),
  879. onPressed: () {
  880. Navigator.of(context, rootNavigator: true).pop();
  881. Navigator.pushReplacement(context, MaterialPageRoute(
  882. builder: (context) => PengajuanUangMukaTambahan_Screen()));
  883. },
  884. );
  885. // set up the AlertDialog
  886. AlertDialog alert = AlertDialog(
  887. title: Text("Employee Self Service"),
  888. content: Text("Success Submit Assignment Letter"),
  889. actions: [
  890. okButton,
  891. ],
  892. );
  893. // show the dialog
  894. showDialog(
  895. context: context,
  896. builder: (BuildContext context) {
  897. return alert;
  898. },
  899. );
  900. }
  901. } else {
  902. await loading.hide();
  903. alertDialogFailedResponse(context);
  904. }
  905. } );
  906. }
  907. },
  908. )
  909. ],
  910. ),
  911. ),
  912. ],
  913. ),
  914. ),
  915. ),
  916. ),
  917. ],
  918. ),
  919. ),
  920. ),
  921. ],
  922. ),
  923. ],
  924. )),
  925. );
  926. }
  927. bool validateFormPengajuanST (BuildContext context) {
  928. bool result = true;
  929. if (formattedDateST == "") {
  930. Fluttertoast.showToast(
  931. msg: "Assignment Letter Date\nNot Selected",
  932. toastLength: Toast.LENGTH_SHORT,
  933. gravity: ToastGravity.CENTER,
  934. timeInSecForIosWeb: 1,
  935. textColor: Colors.white,
  936. fontSize: 16.0);
  937. result = false;
  938. } else if (keperluanTeksController.text.toString().isEmpty) {
  939. Fluttertoast.showToast(
  940. msg: "Description of Needs Required!",
  941. toastLength: Toast.LENGTH_SHORT,
  942. gravity: ToastGravity.CENTER,
  943. timeInSecForIosWeb: 1,
  944. textColor: Colors.white,
  945. fontSize: 16.0);
  946. result = false;
  947. } else if (formattedDateDeparture == "") {
  948. Fluttertoast.showToast(
  949. msg: "Departure Date Not Selected",
  950. toastLength: Toast.LENGTH_SHORT,
  951. gravity: ToastGravity.CENTER,
  952. timeInSecForIosWeb: 1,
  953. textColor: Colors.white,
  954. fontSize: 16.0);
  955. result = false;
  956. } else if (formattedDateReturn == "") {
  957. Fluttertoast.showToast(
  958. msg: "Return Date Not Selected",
  959. toastLength: Toast.LENGTH_SHORT,
  960. gravity: ToastGravity.CENTER,
  961. timeInSecForIosWeb: 1,
  962. textColor: Colors.white,
  963. fontSize: 16.0);
  964. result = false;
  965. } else if (tujuanTeksController.text.toString().isEmpty) {
  966. Fluttertoast.showToast(
  967. msg: "Destination Required!",
  968. toastLength: Toast.LENGTH_SHORT,
  969. gravity: ToastGravity.CENTER,
  970. timeInSecForIosWeb: 1,
  971. textColor: Colors.white,
  972. fontSize: 16.0);
  973. result = false;
  974. } else if (uangMukaTeksController.text.toString().isEmpty) {
  975. Fluttertoast.showToast(
  976. msg: "Down Payment Required!",
  977. toastLength: Toast.LENGTH_SHORT,
  978. gravity: ToastGravity.CENTER,
  979. timeInSecForIosWeb: 1,
  980. textColor: Colors.white,
  981. fontSize: 16.0);
  982. result = false;
  983. } /*else if (selectedTicketType == null) {
  984. Fluttertoast.showToast(
  985. msg: "Ticket Type Not Selected",
  986. toastLength: Toast.LENGTH_SHORT,
  987. gravity: ToastGravity.CENTER,
  988. timeInSecForIosWeb: 1,
  989. textColor: Colors.white,
  990. fontSize: 16.0);
  991. result = false;
  992. } else if (ticketFromTeksController.text.toString().isEmpty){
  993. Fluttertoast.showToast(
  994. msg: "Ticket From Required!",
  995. toastLength: Toast.LENGTH_SHORT,
  996. gravity: ToastGravity.CENTER,
  997. timeInSecForIosWeb: 1,
  998. textColor: Colors.white,
  999. fontSize: 16.0);
  1000. result = false;
  1001. } else if (ticketToTeksController.text.toString().isEmpty){
  1002. Fluttertoast.showToast(
  1003. msg: "Ticket To Required!",
  1004. toastLength: Toast.LENGTH_SHORT,
  1005. gravity: ToastGravity.CENTER,
  1006. timeInSecForIosWeb: 1,
  1007. textColor: Colors.white,
  1008. fontSize: 16.0);
  1009. result = false;
  1010. } else if (formattedDateTicket == "") {
  1011. Fluttertoast.showToast(
  1012. msg: "Ticket Date Not Selected",
  1013. toastLength: Toast.LENGTH_SHORT,
  1014. gravity: ToastGravity.CENTER,
  1015. timeInSecForIosWeb: 1,
  1016. textColor: Colors.white,
  1017. fontSize: 16.0);
  1018. result = false;
  1019. } else if (ticketPriceTeksController.text.toString().isEmpty){
  1020. Fluttertoast.showToast(
  1021. msg: "Ticket Price Required!",
  1022. toastLength: Toast.LENGTH_SHORT,
  1023. gravity: ToastGravity.CENTER,
  1024. timeInSecForIosWeb: 1,
  1025. textColor: Colors.white,
  1026. fontSize: 16.0);
  1027. result = false;
  1028. }*/
  1029. return result;
  1030. }
  1031. }
  1032. alertDialogFailedRetrievedData(BuildContext context){
  1033. Widget okButton = TextButton(
  1034. child: Text("Refresh"),
  1035. onPressed: () {
  1036. /*Navigator.of(context, rootNavigator: true).pop();
  1037. Navigator.pushReplacement(context, MaterialPageRoute(
  1038. builder: (context) => AjukanCutiScreen()));*/
  1039. },
  1040. );
  1041. Widget noButton = TextButton(
  1042. child: Text("Back"),
  1043. onPressed: () {
  1044. Navigator.of(context, rootNavigator: true).pop();
  1045. Navigator.pop(context);
  1046. },
  1047. );
  1048. // set up the AlertDialog
  1049. AlertDialog alert = AlertDialog(
  1050. title: Text("Employee Self Service"),
  1051. content: Text("Failed to Retrieve Data"),
  1052. actions: [
  1053. noButton,
  1054. okButton,
  1055. ],
  1056. );
  1057. // show the dialog
  1058. showDialog(
  1059. context: context,
  1060. builder: (BuildContext context) {
  1061. return alert;
  1062. },
  1063. );
  1064. }
  1065. alertDialogFailedResponse(BuildContext context){
  1066. Widget okButton = TextButton(
  1067. child: Text("Refresh"),
  1068. onPressed: () {
  1069. /* Navigator.of(context, rootNavigator: true).pop();
  1070. Navigator.pushReplacement(context, MaterialPageRoute(
  1071. builder: (context) => AjukanCutiScreen()));*/
  1072. },
  1073. );
  1074. Widget noButton = TextButton(
  1075. child: Text("Back"),
  1076. onPressed: () {
  1077. Navigator.of(context, rootNavigator: true).pop();
  1078. Navigator.pop(context);
  1079. },
  1080. );
  1081. // set up the AlertDialog
  1082. AlertDialog alert = AlertDialog(
  1083. title: Text("Employee Self Service"),
  1084. content: Text("Server Response Error"),
  1085. actions: [
  1086. noButton,
  1087. okButton,
  1088. ],
  1089. );
  1090. // show the dialog
  1091. showDialog(
  1092. context: context,
  1093. builder: (BuildContext context) {
  1094. return alert;
  1095. },
  1096. );
  1097. }
  1098. List<String> ticketType = [
  1099. "airplane",
  1100. "train"
  1101. ];