No Description
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.

deklarasi_st.dart 65KB

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