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.

592 lines
35 KiB

2 months ago
  1. import 'package:flutter/material.dart';
  2. import 'package:google_fonts/google_fonts.dart';
  3. import '../SlipGaji/background.dart';
  4. class IPPScreen extends StatefulWidget {
  5. const IPPScreen({super.key});
  6. @override
  7. State<IPPScreen> createState() => _IPPScreenState();
  8. }
  9. class _IPPScreenState extends State<IPPScreen> {
  10. @override
  11. Widget build(BuildContext context) {
  12. return Scaffold(
  13. body: SingleChildScrollView(
  14. child: Column(
  15. children: <Widget>[
  16. Stack(
  17. children: [
  18. WavyHeader(),
  19. Container(
  20. margin: EdgeInsets.only(top: MediaQuery.of(context).size.height/6 - 20),
  21. padding: EdgeInsets.fromLTRB(20, 5, 25, 5),
  22. child: Row(
  23. mainAxisAlignment: MainAxisAlignment.end,
  24. crossAxisAlignment: CrossAxisAlignment.end,
  25. children: [
  26. Text(
  27. 'IPP\t\t',
  28. maxLines: 2,
  29. style: GoogleFonts.luckiestGuy(
  30. fontSize: 28,
  31. color: Color(0xFF4858A7),
  32. fontStyle: FontStyle.italic,
  33. ),
  34. ),
  35. Image.asset("assets/icons/menu/ic_ipp.png",
  36. width: 40,
  37. height: 40,
  38. ),
  39. ],
  40. )),
  41. SafeArea(
  42. child: Container(
  43. width: MediaQuery.of(context).size.width,
  44. margin: EdgeInsets.only(
  45. top: MediaQuery.of(context).size.height / 5,
  46. left: 10,
  47. right: 10,
  48. bottom : 15,
  49. ),
  50. child: Column(
  51. children: [
  52. InkWell(
  53. child: Container(
  54. margin: EdgeInsets.only(top: 5, bottom: 15),
  55. padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
  56. width: double.infinity,
  57. decoration: BoxDecoration(
  58. borderRadius: BorderRadius.circular(5),
  59. gradient: LinearGradient(colors: [
  60. Color(0xFF2D4059),
  61. Color(0xFF2D4059),
  62. /*Color(0xFFEAFFD0),
  63. Color(0xFF95E1D3),*/
  64. ])),
  65. child: Row(
  66. mainAxisAlignment: MainAxisAlignment.center,
  67. children: [
  68. Text('See IPP History\t\t',
  69. textAlign: TextAlign.center,
  70. style: TextStyle(
  71. color: Colors.white,
  72. fontSize: 17,
  73. fontWeight: FontWeight.w500)),
  74. Image.asset(
  75. 'assets/images/ic_arrow_white.png',
  76. width: 30,
  77. height: 30,
  78. )
  79. ],
  80. )),
  81. onTap: () {
  82. /* Navigator.push(context, MaterialPageRoute(
  83. builder: (context) => HistoryReimburse()));*/
  84. },
  85. ),
  86. Container(
  87. child: Card(
  88. elevation: 10,
  89. child: Container(
  90. decoration: BoxDecoration(
  91. color: Color(0XFFFAF7EE),
  92. borderRadius: BorderRadius.circular(10)),
  93. child: Column(
  94. children: [
  95. Container(
  96. margin: EdgeInsets.only(
  97. left: 10, right: 10, top: 15, bottom: 10),
  98. child: Text('IPP Submission', style:
  99. GoogleFonts.josefinSans(fontSize: 19, fontWeight: FontWeight.bold, decoration: TextDecoration.underline,
  100. decorationStyle: TextDecorationStyle.dashed),),
  101. ),
  102. /*Container(
  103. margin: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 10),
  104. child: Column(
  105. children: [
  106. Align(
  107. alignment: Alignment.centerLeft,
  108. child: Text(
  109. 'Category',
  110. style: GoogleFonts.inconsolata(
  111. fontSize: 16, fontWeight: FontWeight.bold),
  112. ),
  113. ),
  114. Container(
  115. margin: EdgeInsets.only(top: 7),
  116. decoration: BoxDecoration(
  117. color:
  118. CupertinoColors.systemGrey2,
  119. borderRadius:
  120. BorderRadius.circular(5)),
  121. child: DropdownButton(
  122. menuMaxHeight: size.height * 0.31,
  123. dropdownColor: Colors.grey.shade300,
  124. value: this.selectedCategory,
  125. isExpanded: true,
  126. underline: SizedBox(),
  127. hint: Text(
  128. '\t\t\Choose Category',
  129. style: TextStyle(
  130. color: Colors.black54),
  131. ),
  132. onChanged: (value) {
  133. print(value);
  134. setState(() {
  135. selectedCategory = value!;
  136. for (int i = 0; i < reimburseCategory.length; i++){
  137. if (selectedCategory == reimburseCategory.elementAt(i)){
  138. idReimburse = idReimburseCategory.elementAt(i);
  139. }
  140. }
  141. logDev.log(idReimburse, name: "ID REIMBURSENYA APA");
  142. });
  143. },
  144. items: reimburseCategory
  145. .map(
  146. (e) => DropdownMenuItem(
  147. value: e,
  148. child:
  149. Text("\t\t\t" + e)),
  150. )
  151. .toList(),
  152. ),
  153. ),
  154. ],
  155. ),
  156. ),
  157. Container(
  158. margin: EdgeInsets.only(
  159. left: 10, right: 10, top: 10, bottom: 10),
  160. child: Column(
  161. children: [
  162. Align(
  163. alignment: Alignment.centerLeft,
  164. child: Text(
  165. 'Item Name',
  166. style: GoogleFonts.inconsolata(
  167. fontSize: 16, fontWeight: FontWeight.bold),
  168. ),
  169. ),
  170. Container(
  171. margin: EdgeInsets.only(top: 7),
  172. decoration: BoxDecoration(
  173. color: Colors.white,
  174. borderRadius:
  175. BorderRadius.circular(5)),
  176. child: Padding(
  177. padding: EdgeInsets.only(
  178. left: 10,
  179. right: 10,
  180. top: 5,
  181. bottom: 5),
  182. child: TextFormField(
  183. keyboardType: TextInputType.multiline,
  184. controller: namaProdukTeksController,
  185. maxLines: null,
  186. textInputAction:
  187. TextInputAction.done,
  188. decoration: InputDecoration(
  189. border:
  190. InputBorder.none,
  191. hintText: "ex. Airplane Ticket")),
  192. )),
  193. ],
  194. ),
  195. ),
  196. Container(
  197. margin: EdgeInsets.only(
  198. left: 10, right: 10, top: 10, bottom: 10),
  199. child: Column(
  200. children: [
  201. Column(
  202. children: [
  203. Align(
  204. alignment: Alignment.centerLeft,
  205. child: Text(
  206. 'Date', style: GoogleFonts.inconsolata(fontSize: 16, fontWeight: FontWeight.bold),
  207. ),
  208. ),
  209. ElevatedButton(
  210. onPressed: () async {
  211. DateTime? newDate = await showDatePicker(
  212. context: context,
  213. initialDate: dateFrom,
  214. firstDate:
  215. DateTime(1900),
  216. lastDate:
  217. DateTime(2100));
  218. final DateFormat formatter = DateFormat('yyyy-MM-dd');
  219. if (newDate == null) {
  220. return;
  221. } else {
  222. setState(() {
  223. if (visibleDateFrom == false){
  224. visibleDateFrom = !visibleDateFrom;
  225. }
  226. formattedDateFrom = formatter.format(newDate);
  227. //dateFrom = formattedFrom as DateTime;
  228. });
  229. }
  230. },
  231. child: Container(
  232. width: double.infinity,
  233. child: Text(
  234. "Choose Date",
  235. style: TextStyle(
  236. color: Colors.white,
  237. fontSize: 16,
  238. fontWeight:
  239. FontWeight.w400),
  240. ),
  241. ),
  242. ),
  243. ]
  244. ),
  245. Visibility(
  246. visible: visibleDateFrom,
  247. child: Container(
  248. alignment: Alignment.centerLeft,
  249. margin: EdgeInsets.only(
  250. left: 15,
  251. right: 15,
  252. bottom: 5),
  253. child: Text(formattedDateFrom,
  254. overflow:
  255. TextOverflow.ellipsis,
  256. maxLines: 1,
  257. style: TextStyle(
  258. color: Colors.black54),
  259. ),
  260. ),
  261. )
  262. ],
  263. ),
  264. ),
  265. Container(
  266. margin: EdgeInsets.only(
  267. left: 10, right: 10, top: 10, bottom: 10),
  268. child: Column(
  269. children: [
  270. Align(
  271. alignment: Alignment.centerLeft,
  272. child: Text(
  273. 'Total Amount',
  274. style: GoogleFonts.inconsolata(
  275. fontSize: 16, fontWeight: FontWeight.bold),
  276. )
  277. ),
  278. Container(
  279. margin: EdgeInsets.only(top: 7),
  280. decoration: BoxDecoration(
  281. color: Colors.white,
  282. borderRadius:
  283. BorderRadius.circular(5)),
  284. child: Padding(
  285. padding: EdgeInsets.only(
  286. left: 10,
  287. right: 10,
  288. top: 5,
  289. bottom: 5),
  290. child: TextFormField(
  291. keyboardType:
  292. TextInputType.number,
  293. maxLines: 1,
  294. controller: totalHargaTeksController,
  295. textInputAction:
  296. TextInputAction.next,
  297. decoration: InputDecoration(
  298. border:
  299. InputBorder.none,
  300. hintText:
  301. "ex. 1500500", )),
  302. )
  303. )
  304. ],
  305. ),
  306. ),
  307. Container(
  308. margin: EdgeInsets.only(
  309. left: 10, right: 10, top: 10, bottom: 10),
  310. child: Column(
  311. children: [
  312. Align(
  313. alignment: Alignment.centerLeft,
  314. child: Text(
  315. 'Description',
  316. style: GoogleFonts.inconsolata(
  317. fontSize: 16, fontWeight: FontWeight.bold),
  318. )),
  319. Container(
  320. margin: EdgeInsets.only(top: 7),
  321. decoration: BoxDecoration(
  322. color: Colors.white,
  323. borderRadius:
  324. BorderRadius.circular(5)),
  325. child: Padding(
  326. padding: EdgeInsets.only(
  327. left: 10,
  328. right: 10,
  329. top: 5,
  330. bottom: 5),
  331. child: TextFormField(
  332. keyboardType:
  333. TextInputType.multiline,
  334. controller: deskripsiTeksController,
  335. maxLines: null,
  336. textInputAction:
  337. TextInputAction.done,
  338. decoration: InputDecoration(
  339. border:
  340. InputBorder.none,
  341. hintText: "description")),
  342. )
  343. )
  344. ],
  345. ),
  346. ),
  347. Container(
  348. margin: EdgeInsets.only(
  349. left: 10, right: 10, top: 10, bottom: 10),
  350. child: Column(
  351. children: [
  352. Align(
  353. alignment: Alignment.centerLeft,
  354. child: Text('Payment', style: GoogleFonts.inconsolata(
  355. fontSize: 16, fontWeight: FontWeight.bold),
  356. )
  357. ),
  358. Container(
  359. child: Column(
  360. children: [
  361. Row(
  362. children: [
  363. Radio(
  364. value: "own_account",
  365. groupValue: valuePayment,
  366. onChanged: (value) {
  367. setState(() {
  368. valuePayment = value!;
  369. });
  370. },
  371. ),
  372. Flexible(
  373. child: Text(
  374. "Own (Need Reimburse)", style: TextStyle(color: Colors.black54,
  375. )
  376. )
  377. ),
  378. ],
  379. ),
  380. Row(
  381. children: [
  382. Radio(
  383. value: "company_account",
  384. groupValue: valuePayment,
  385. onChanged: (value) {
  386. setState(() {
  387. valuePayment = value!;
  388. //logDev.log(valuePayment, name: "VALUE PAYMENT");
  389. });
  390. },
  391. ),
  392. Flexible(
  393. child: Text(
  394. "Company",
  395. style: TextStyle(
  396. color: Colors
  397. .black54)))
  398. ],
  399. ),
  400. ],
  401. ),
  402. ),
  403. ],
  404. ),
  405. ),
  406. Container(
  407. margin: EdgeInsets.only(
  408. left: 10, right: 10, top: 10),
  409. child: Column(
  410. children: [
  411. Align(
  412. alignment: Alignment.centerLeft,
  413. child: Text(
  414. 'Attachment',
  415. style: GoogleFonts.inconsolata(
  416. fontSize: 16, fontWeight: FontWeight.bold),
  417. ),
  418. ),
  419. Container(
  420. child: ElevatedButton(
  421. onPressed: () {
  422. _pickMultipleFiles();
  423. },
  424. *//*style: ElevatedButton.styleFrom(
  425. backgroundColor:
  426. CupertinoColors
  427. .systemGrey2),*//*
  428. child: Container(
  429. width: double.infinity,
  430. child: Text("Choose File",
  431. style: TextStyle(
  432. color: Colors.white,
  433. fontSize: 16,
  434. fontWeight:
  435. FontWeight.w400)),
  436. ),
  437. ),
  438. ),
  439. Container(
  440. alignment:
  441. Alignment.centerLeft,
  442. margin: EdgeInsets.only(
  443. left: 15,
  444. right: 15,
  445. bottom: 10),
  446. child: Text(_totalFile + _fileText,
  447. overflow:
  448. TextOverflow.ellipsis,
  449. *//*maxLines: 7,*//*
  450. style: TextStyle(
  451. color: Colors.black54),
  452. ),
  453. ),
  454. ],
  455. ),
  456. ),
  457. InkWell(
  458. child: Container(
  459. margin: EdgeInsets.only(left: 10, right: 10, bottom: 15),
  460. padding: EdgeInsets.fromLTRB(
  461. 10, 10, 10, 10),
  462. width: double.infinity,
  463. decoration: BoxDecoration(
  464. borderRadius:
  465. BorderRadius.circular(5),
  466. gradient: LinearGradient(colors: [
  467. Color(0xFFFF9945),
  468. Color(0xFFFc6076)
  469. ])),
  470. child: Text('Submit',
  471. textAlign: TextAlign.center,
  472. style: TextStyle(
  473. color: Colors.white,
  474. fontSize: 17,
  475. fontWeight: FontWeight.w500)),
  476. ),
  477. onTap: () async {
  478. ProgressDialog loading = ProgressDialog(context);
  479. loading = ProgressDialog(context,
  480. type: ProgressDialogType.normal, isDismissible: false, showLogs: true);
  481. loading.style(
  482. message: 'Please Wait .....',
  483. borderRadius: 3,
  484. backgroundColor: Colors.white,
  485. progressWidget: CircularProgressIndicator(),
  486. elevation: 10.0,
  487. padding: EdgeInsets.all(10),
  488. insetAnimCurve: Curves.easeInOut,
  489. progress: 0.0,
  490. maxProgress: 100.0,
  491. progressTextStyle: TextStyle(
  492. color: Colors.black, fontSize: 10.0, fontWeight: FontWeight.w400),
  493. messageTextStyle: TextStyle(
  494. color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600));
  495. if (!validateFormReimburse(context)){
  496. return;
  497. } else if (validateFormReimburse(context)){
  498. await loading.show();
  499. PengajuanReimburse_Post.connectToAPI(namaProdukTeksController.text.toString(), idReimburse,
  500. formattedDateFrom, totalHargaTeksController.text.toString(), valuePayment,
  501. deskripsiTeksController.text.toString(), fileAttach).then((valueResult) async {
  502. logDev.log(fileAttach.toString(), name: "FILE ATTACH APA AJA");
  503. Map<String, dynamic> object = json.decode(valueResult);
  504. if (object.containsKey("result").toString() == "true") {
  505. String result = object['result'].toString();
  506. if (result.contains("status")) {
  507. await loading.hide();
  508. Widget okButton = TextButton(
  509. child: Text("OK"),
  510. onPressed: () {
  511. Navigator.of(context, rootNavigator: true).pop();
  512. },
  513. );
  514. // set up the AlertDialog
  515. AlertDialog alert = AlertDialog(
  516. title: Text("Employee Self Service"),
  517. content: Text("Error Submit, Please Try Again Later!"),
  518. actions: [
  519. okButton,
  520. ],
  521. );
  522. // show the dialog
  523. showDialog(
  524. context: context,
  525. barrierDismissible: false,
  526. builder: (BuildContext context) {
  527. return alert;
  528. },
  529. );
  530. } else {
  531. await loading.hide();
  532. formattedDateFrom = "";
  533. visibleDateFrom = false;
  534. visibleDateFrom = false;
  535. deskripsiTeksController.clear();
  536. Widget okButton = TextButton(
  537. child: Text("OK"),
  538. onPressed: () {
  539. Navigator.of(context, rootNavigator: true).pop();
  540. Navigator.pushReplacement(context, MaterialPageRoute(
  541. builder: (context) => ReimburseScreen()));
  542. },
  543. );
  544. // set up the AlertDialog
  545. AlertDialog alert = AlertDialog(
  546. title: Text("Employee Self Service"),
  547. content: Text("Success Submit Reimburse"),
  548. actions: [
  549. okButton,
  550. ],
  551. );
  552. // show the dialog
  553. showDialog(
  554. context: context,
  555. barrierDismissible: false,
  556. builder: (BuildContext context) {
  557. return alert;
  558. },
  559. );
  560. }
  561. } else {
  562. await loading.hide();
  563. alertDialogFailedResponse(context);
  564. }
  565. });
  566. }
  567. },
  568. )*/
  569. ],
  570. ),
  571. ),
  572. ),
  573. ),
  574. ],
  575. ),
  576. ),
  577. ),
  578. ],
  579. ),
  580. ],
  581. )),
  582. );
  583. }
  584. }