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.

1134 lines
64 KiB

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