Advertisement
Eko_Sariyanto

multi shift

Apr 20th, 2022
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.15 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. //import Icon from 'react-native-vector-icons/dist/FontAwesome';
  3. import { AppRegistry, CheckBox, Animated, StyleSheet, FlatList, Image, TextInput, TouchableOpacity, TouchableHighlight, Text, ScrollView, SafeAreaView, View, Alert, ActivityIndicator, Platform, RefreshControl } from 'react-native';
  4. import { ListItem, SearchBar, Avatar } from 'react-native-elements';
  5. import moment from "moment";
  6. import NetInfo from '@react-native-community/netinfo'
  7. import AwesomeButtonRick from "react-native-really-awesome-button/src/themes/rick";
  8. import Modal from "react-native-modal";
  9. import SearchableDropdown from 'react-native-searchable-dropdown';
  10. import DatePicker from 'react-native-datepicker'
  11. import DateTimePickerModal from 'react-native-modal-datetime-picker';
  12. import TouchableScale from 'react-native-touchable-scale';
  13. import LinearGradient from 'react-native-linear-gradient';
  14. import { Container, Header, Button, Content, Card, Left, Right, CardItem, Item, Thumbnail, Body, Icon } from 'native-base';
  15. import { Table, TableWrapper, Row, Rows, Col, Cell } from 'react-native-table-component';
  16. import { Dropdown } from 'react-native-material-dropdown-v2';
  17. import RNSmtpMailer from "react-native-smtp-mailer";
  18. import AnimateLoadingButton from 'react-native-animate-loading-button';
  19. import HandleBack from "./HandleBack";
  20. import ActionButton from 'react-native-action-button';
  21. import Config from './Config';
  22. var tempCheckValues = [];
  23.  
  24. class FeatureManageSchedule extends Component {
  25.  
  26. static navigationOptions = {
  27. title: 'Manage Schedule',
  28. tabBarOptions: {
  29. labelStyle: {
  30. fontSize: 16,
  31. color: 'red',
  32. },
  33. headerStyle: {
  34. backgroundColor: 'red',
  35. height: 80
  36. },
  37. },
  38. };
  39.  
  40. constructor(props) {
  41.  
  42. super(props);
  43. this.backButtonClick = this.backButtonClick.bind(this);
  44. this.state = {
  45. isLoading: false,
  46. search: '',
  47. isModalVisible: false,
  48. isModalVisibleList: false,
  49. connection_Status: "",
  50. isLoading: true,
  51. itemsatasan: '',
  52. bonuskota: '',
  53. breaktime: '',
  54. shiftidnya: '',
  55. employee_id: '',
  56. empId: '',
  57. Memo: '',
  58. checkBoxChecked: [],
  59. items: '',
  60. items1: '',
  61. items2: '',
  62. items3: '',
  63. serverData: [],
  64. serverDataatasan: [],
  65. serverData1: [],
  66. serverData2: [],
  67. serverDataBonus: [],
  68. ServerDatabreaktime: [],
  69. dataHeadnye: [],
  70. dataCheck: [],
  71. tbHead: ['Tanggal', ' SHIFT', ' BTStart', ' BTEnd', ' OTStart', ' OTEnd', ' OTBT ', ' OTBTE'],
  72. shiftidnya: "",
  73. widths: [50, 50, 50, 50, 50, 50, 50, 50],
  74. datestart: '--Pilih Tanggal--',
  75. dateend: '--Pilih Tanggal--',
  76. isDateTimePickerVisibleOvr: false,
  77. timestart: '00:00',
  78. timeend: '00:00',
  79. datas: []
  80.  
  81. }
  82. this.dataSource = [];
  83.  
  84. }
  85.  
  86.  
  87. setisModalVisible(visible) {
  88. this.setState({ isModalVisible: visible });
  89.  
  90. }
  91.  
  92.  
  93. toggleModalList = (
  94. employee_id, employee_firts_name, fotonya, atasan_id, Division_ID, dept_name, approval1, approval2, email, email_atasan
  95. ) => {
  96. this.setState({
  97. isModalVisibleList: !this.state.isModalVisibleList
  98. , Niknya: employee_id
  99. , Namenya: employee_firts_name
  100. , Fotone: fotonya
  101. , depidnya: Division_ID
  102. , deptname: dept_name
  103. , approval1nya: approval1
  104. , approval2nya: approval2
  105. , email: email
  106. , email_atasan: email_atasan
  107. });
  108.  
  109. };
  110.  
  111. setisModalVisibleList(visible) {
  112. this.setState({ isModalVisibleList: visible });
  113.  
  114. }
  115.  
  116. toggleModalpicker = (
  117. employee_id, employee_firts_name, fotonya, atasan_id, Division_ID, dept_name, approval1, approval2, email, email_atasan
  118. ) => {
  119. this.setState({
  120. isModalVisiblepicker: !this.state.isModalVisiblepicker
  121. , Niknya: employee_id
  122. , Namenya: employee_firts_name
  123. , Fotone: fotonya
  124. , depidnya: Division_ID
  125. , deptname: dept_name
  126. , approval1nya: approval1
  127. , approval2nya: approval2
  128. , email: email
  129. , email_atasan: email_atasan
  130. });
  131.  
  132. };
  133.  
  134. setisModalVisiblepicker(visible) {
  135. this.setState({ isModalVisiblepicker: visible });
  136.  
  137. }
  138.  
  139.  
  140. showDateTimePickerOvr = () => {
  141. this.setState({ isDateTimePickerVisibleOvr: true });
  142. };
  143.  
  144. hideDateTimePickerOvr = () => {
  145. this.setState({ isDateTimePickerVisibleOvr: false });
  146. this.setisModalVisiblepicker(false)
  147. };
  148. handleDatePickedOvr = time => {
  149. console.log("A date has been picked: ", time);
  150.  
  151.  
  152.  
  153. let hours = time.getHours();
  154. let minutes = time.getMinutes();
  155. let seconds = time.getSeconds();
  156. console.log(`${hours}:${minutes}:${seconds}`)
  157. this.setState({ timestart: `${hours}:${minutes}:${seconds}` })
  158.  
  159. this.hideDateTimePickerOvr();
  160. this.setisModalVisiblepicker(false)
  161.  
  162. };
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181. CekNet = () => {
  182.  
  183. const unsubscribe = NetInfo.addEventListener(state => {
  184. console.log("Connection type", state.type);
  185. console.log("Is connected?", state.isConnected);
  186. if (state.isConnected == true) {
  187. this.setState({ connection_Status: "Online" })
  188. }
  189. else {
  190. this.setState({ connection_Status: "Offline" })
  191.  
  192. }
  193. });
  194.  
  195. unsubscribe();
  196. }
  197.  
  198. GetData = () => {
  199. NetInfo.fetch().then(state => {
  200. console.log("Connection type", state.type);
  201. console.log("Is connected?", state.isConnected);
  202. if (state.isConnected == true) {
  203. this.setState({ connection_Status: "Online" })
  204.  
  205.  
  206. }
  207. else {
  208. this.setState({ connection_Status: "Offline" })
  209.  
  210. }
  211. });
  212. this.CekNet();
  213.  
  214. if (this.state.connection_Status == "Offline") {
  215. alert('Not Internet Connection')
  216. } else {
  217.  
  218. const { navigation } = this.props;
  219. ///your fetch
  220.  
  221. }
  222. };
  223. componentDidMount() {
  224.  
  225.  
  226. NetInfo.fetch().then(state => {
  227. console.log("Connection type", state.type);
  228. console.log("Is connected?", state.isConnected);
  229. if (state.isConnected == true) {
  230. this.setState({ connection_Status: "Online" })
  231.  
  232.  
  233. }
  234. else {
  235. this.setState({ connection_Status: "Offline" })
  236.  
  237. }
  238. });
  239. this.CekNet();
  240.  
  241. if (this.state.connection_Status == "Offline") {
  242. alert('Not Internet Connection')
  243. } else {
  244.  
  245. // BackHandler.addEventListener("hardwareBackPress", this.BacktoHome);
  246. const { navigation } = this.props;
  247. const sales = navigation.getParam('idSales', 'NO-Pass');
  248.  
  249. fetch(Config.api_path + 'charis_view_subordinate.php', {
  250. method: 'POST',
  251. headers: {
  252. 'Accept': 'application/json',
  253. 'Content-Type': 'application/json',
  254. },
  255. body: JSON.stringify({
  256. sales: navigation.getParam('fpnya', 'NO-User'),
  257.  
  258. })
  259. })
  260.  
  261. .then((response) => response.json())
  262. .then((responseJson) => {
  263. this.setState({
  264. dataSource: responseJson,
  265. isLoading: false
  266.  
  267.  
  268.  
  269. }, function () {
  270. this.dataSource = responseJson;
  271. });
  272. })
  273. .catch((error) => {
  274. console.error(error);
  275. });
  276.  
  277. fetch(Config.api_path + 'AA_list_unitORG_Divisi.php', {
  278. method: 'POST',
  279. headers: {
  280. 'Accept': 'application/json',
  281. 'Content-Type': 'application/json',
  282. },
  283. body: JSON.stringify({
  284. // sales: id_sales1,
  285.  
  286. })
  287. })
  288. .then(response => response.json())
  289. .then(responseJson => {
  290. if (responseJson != []) {
  291. this.setState({
  292. serverData: responseJson,
  293.  
  294. //adding the new data in Data Source of the SearchableDropdown
  295. });
  296. } else {
  297. alert("Not Have Customers");
  298. }
  299. })
  300. .catch(error => {
  301. console.error(error);
  302. });
  303.  
  304.  
  305. fetch(Config.api_path + 'AA_list_shift.php', {
  306. method: 'POST',
  307. headers: {
  308. 'Accept': 'application/json',
  309. 'Content-Type': 'application/json',
  310. },
  311. body: JSON.stringify({
  312.  
  313.  
  314. })
  315. })
  316. .then(response => response.json())
  317. .then(responseJson => {
  318. if (responseJson != []) {
  319.  
  320. this.setState({
  321.  
  322. serverData2: responseJson,
  323.  
  324.  
  325. });
  326. } else {
  327. alert("Not Have Customers");
  328. }
  329. })
  330. .catch(error => {
  331. console.error(error);
  332. });
  333. fetch(Config.api_path + 'AA_list_bonus_kota.php', {
  334. method: 'POST',
  335. headers: {
  336. 'Accept': 'application/json',
  337. 'Content-Type': 'application/json',
  338. },
  339. body: JSON.stringify({
  340. //sales: id_sales1,
  341.  
  342. })
  343. })
  344. .then(response => response.json())
  345. .then(responseJson => {
  346. if (responseJson != []) {
  347. this.setState({
  348. serverDataBonus: responseJson,
  349.  
  350. });
  351. } else {
  352. alert("Not Have Customers");
  353. }
  354. })
  355. .catch(error => {
  356. console.error(error);
  357. });
  358.  
  359.  
  360. fetch(Config.api_path + 'AA_list_break_time.php', {
  361. method: 'POST',
  362. headers: {
  363. 'Accept': 'application/json',
  364. 'Content-Type': 'application/json',
  365. },
  366. body: JSON.stringify({
  367. // sales: id_sales1,
  368.  
  369. })
  370. })
  371. .then(response => response.json())
  372. .then(responseJson => {
  373. if (responseJson != []) {
  374. this.setState({
  375. ServerDatabreaktime: responseJson,
  376. //adding the new data in Data Source of the SearchableDropdown
  377. });
  378. } else {
  379. alert("Not Have Customers");
  380. }
  381. })
  382. .catch(error => {
  383. console.error(error);
  384. });
  385.  
  386.  
  387. }
  388.  
  389. }
  390.  
  391.  
  392.  
  393. backButtonClick() {
  394. if (this.props.navigation && this.props.navigation.goBack) {
  395. this.props.navigation.goBack(null);
  396. return true;
  397. }
  398. return false;
  399. }
  400.  
  401. handleConnectivityChange = (isConnected) => {
  402. if (isConnected == true) {
  403. this.setState({ connection_Status: "Online" })
  404.  
  405. }
  406. else {
  407. this.setState({ connection_Status: "Offline" })
  408. alert('Offline Mode No Internet Connection')
  409. }
  410. };
  411.  
  412.  
  413. onRefresh() {
  414.  
  415. this.setState({ dataSource: [] });
  416.  
  417. this.GetData();
  418. }
  419.  
  420.  
  421. FlatListItemSeparator = () => {
  422. return (
  423. <View
  424. style={{
  425. height: 1,
  426. width: "100%",
  427. backgroundColor: "#607D8B",
  428. }}
  429. />
  430. );
  431. }
  432.  
  433.  
  434.  
  435. renderSeparator = () => {
  436. return (
  437. <View
  438. style={{
  439. height: 1,
  440. width: '86%',
  441. backgroundColor: '#CED0CE',
  442. marginLeft: '12%',
  443. }}
  444. />
  445. );
  446. };
  447.  
  448. search = text => {
  449. console.log(text);
  450. };
  451. clear = () => {
  452. this.search.clear();
  453. };
  454.  
  455. SearchFilterFunction(text) {
  456.  
  457. const newData = this.dataSource.filter(function (item) {
  458.  
  459. const itemData = `${item.employee_id.toUpperCase()} ${item.employee_firts_name.toUpperCase()}`;
  460. const textData = text.toUpperCase();
  461. return itemData.indexOf(textData) > -1;
  462. });
  463. this.setState({
  464.  
  465. dataSource: newData,
  466. search: text,
  467. });
  468. }
  469.  
  470. showDateTimePickerOver = () => {
  471. this.setState({
  472. isDateTimePickerVisibleOver: true,
  473.  
  474. });
  475. };
  476. hideDateTimePickerOver = () => {
  477. this.setState({ isDateTimePickerVisible: false });
  478. };
  479.  
  480. showDateTimePicker = () => {
  481. this.setState({
  482. isDateTimePickerVisible: true,
  483.  
  484. });
  485. };
  486.  
  487. hideDateTimePicker = () => {
  488. this.setState({ isDateTimePickerVisible: false });
  489. };
  490. handleDatePicked = time => {
  491. console.log("A date has been picked: ", time);
  492.  
  493.  
  494.  
  495. let years = time.getFullYear();
  496. let month = time.getMonth() + 1;
  497. let date = time.getDate();
  498. console.log("A date has been picked:===== ", `${years}-${month}-${date}`);
  499.  
  500. this.setState({ datestart: `${years}-${month}-${date}` }, () => {
  501. this.setDateRange(this.state.checkBoxChecked);
  502. })
  503.  
  504. this.hideDateTimePicker();
  505.  
  506.  
  507. };
  508.  
  509.  
  510. showDateTimePickerAkhir = () => {
  511. this.setState({
  512. isDateTimePickerVisibleAkhir: true,
  513.  
  514. });
  515. };
  516.  
  517. hideDateTimePickerAkhir = () => {
  518. this.setState({ isDateTimePickerVisibleAkhir: false });
  519. };
  520.  
  521.  
  522.  
  523. checkBoxChanged(employee_id, employee_first_name, value) {
  524. console.log(employee_id, employee_first_name);
  525. this.setState({
  526. checkBoxChecked: tempCheckValues
  527. })
  528. var tempCheckBoxChecked = this.state.checkBoxChecked;
  529. tempCheckBoxChecked[employee_id] = !value;
  530. this.setState({
  531. checkBoxChecked: tempCheckBoxChecked
  532. })
  533. }
  534.  
  535. setDateRange = (checkBoxChecked) => {
  536. console.log("employee terpilih", checkBoxChecked)
  537.  
  538. const arrdatestart = this.state.datestart.split("-");
  539. const arrdateend = this.state.dateend.split("-");
  540. const dateend = new Date()
  541. dateend.setDate(arrdateend[2]);
  542. dateend.setMonth(arrdateend[1] - 1);
  543. dateend.setFullYear(arrdateend[0]);
  544. const datestart = new Date()
  545. datestart.setDate(arrdatestart[2]);
  546. datestart.setMonth(arrdatestart[1] - 1);
  547. datestart.setFullYear(arrdatestart[0]);
  548. // var empID = this.state.checkBoxChecked;
  549. // console.log("ye",empID);
  550. var now = new Date();
  551. var datas = [];
  552.  
  553. for (var d = datestart; d <= dateend; d.setDate(d.getDate() + 1)) {
  554.  
  555. const newdate = new Date()
  556. newdate.setDate(d.getDate());
  557. newdate.setMonth(d.getMonth());
  558. newdate.setFullYear(d.getFullYear());
  559. datas.push({ date: newdate, shiftName: this.state.nameshiftnya, shiftId: this.state.shiftidnya });
  560.  
  561. }
  562. this.setState({ datas: datas });
  563. console.log(datas);
  564. }
  565. handleDatePickedAkhir = time => {
  566. console.log("A date has been picked: ", time);
  567.  
  568.  
  569.  
  570. let years = time.getFullYear();
  571. let month = time.getMonth() + 1;
  572. let date = time.getDate();
  573. console.log("A date has been picked:===== ", `${years}-${month}-${date}`);
  574.  
  575. this.setState({ dateend: `${years}-${month}-${date}` }, () => {
  576. this.setDateRange(this.state.checkBoxChecked);
  577. })
  578.  
  579. this.hideDateTimePickerAkhir();
  580.  
  581.  
  582. };
  583.  
  584.  
  585.  
  586.  
  587. showalert = () => {
  588.  
  589. Alert.alert(
  590. "INFO",
  591. "Data Request Lembur Tersimpan",
  592. [
  593. { text: "OK", onPress: () => this.gotorefresh() }
  594. ])
  595. }
  596.  
  597.  
  598. gotorefresh = () => {
  599. NetInfo.fetch().then(state => {
  600. console.log("Connection type", state.type);
  601. console.log("Is connected?", state.isConnected);
  602. if (state.isConnected == true) {
  603. this.setState({ connection_Status: "Online" })
  604.  
  605.  
  606. }
  607. else {
  608. this.setState({ connection_Status: "Offline" })
  609.  
  610. }
  611. });
  612. this.CekNet();
  613.  
  614. if (this.state.connection_Status == "Offline") {
  615. alert('Not Internet Connection')
  616. } else {
  617.  
  618. // BackHandler.addEventListener("hardwareBackPress", this.BacktoHome);
  619. const { navigation } = this.props;
  620. const sales = navigation.getParam('idSales', 'NO-Pass');
  621.  
  622. fetch(Config.api_path + 'charis_view_subordinate.php', {
  623. method: 'POST',
  624. headers: {
  625. 'Accept': 'application/json',
  626. 'Content-Type': 'application/json',
  627. },
  628. body: JSON.stringify({
  629. sales: navigation.getParam('fpnya', 'NO-User'),
  630.  
  631. })
  632. })
  633.  
  634. .then((response) => response.json())
  635. .then((responseJson) => {
  636. this.setState({
  637. dataSource: responseJson,
  638. isLoading: false
  639.  
  640.  
  641. }, function () {
  642.  
  643. });
  644. })
  645. .catch((error) => {
  646. console.error(error);
  647. });
  648.  
  649. fetch(Config.api_path + 'AA_list_unitORG_Divisi.php', {
  650. method: 'POST',
  651. headers: {
  652. 'Accept': 'application/json',
  653. 'Content-Type': 'application/json',
  654. },
  655. body: JSON.stringify({
  656. // sales: id_sales1,
  657.  
  658. })
  659. })
  660. .then(response => response.json())
  661. .then(responseJson => {
  662. if (responseJson != []) {
  663. this.setState({
  664. serverData: responseJson,
  665. //adding the new data in Data Source of the SearchableDropdown
  666. });
  667. } else {
  668. alert("Not Have Customers");
  669. }
  670. })
  671. .catch(error => {
  672. console.error(error);
  673. });
  674.  
  675. }
  676.  
  677.  
  678. }
  679.  
  680. carinextatasan = () => {
  681.  
  682. if (this.state.connection_Status == "Offline") {
  683. alert('No Internet Connection')
  684.  
  685. } else {
  686.  
  687. this.setState({
  688.  
  689. nikatasan: '',
  690. namaatasanneee: ''
  691. });
  692.  
  693. fetch(Config.api_path + 'AA_list_AtasanId.php', {
  694. method: 'POST',
  695. headers: {
  696. 'Accept': 'application/json',
  697. 'Content-Type': 'application/json',
  698. },
  699. body: JSON.stringify({
  700. idunitorgDivisi: this.state.shiftidnya,
  701.  
  702. })
  703. })
  704. .then(response => response.json())
  705. .then(responseJson => {
  706. if (responseJson != []) {
  707. this.setState({
  708. serverDataatasan: responseJson,
  709. //adding the new data in Data Source of the SearchableDropdown
  710. });
  711. } else {
  712. alert("Not Have Customers");
  713. }
  714. })
  715. .catch(error => {
  716. console.error(error);
  717. });
  718.  
  719. }
  720. }
  721.  
  722.  
  723.  
  724.  
  725. sendEmail = (
  726. Niknya, Namenya, email, email_atasan, datestar, timestar, timeend, DeptId, Destination, breaktime, Customer, DONumebr, Memo
  727. ) => {
  728. RNSmtpMailer.sendMail({
  729. mailhost: Config.mailhost,
  730. port: Config.port,
  731. ssl: true, //if ssl: false, TLS is enabled,**note:** in iOS TLS/SSL is determined automatically, so either true or false is the same
  732. username: Config.username,
  733. password: Config.password,
  734. from: "" + email + "",
  735. recipients: "" + email_atasan + "",
  736. recipients: "eko.it@taysbakers.com",
  737. subject: "Pengajuan Overtime " + Niknya + " " + Namenya + " ",
  738. htmlBody: "<h3>Notifikasi Pengajuan Overtime</h3><p> Pengajuan Overtime pada tanggal " + datestar + " jam " + timestar + " sampai " + timeend + " dengan istirahat " + breaktime + " jam" + Memo + "Note </p><p> Mohon melakukan approval di charis app bagian Menu Approval --> Overtime</p>",
  739.  
  740.  
  741. // attachmentPaths: ["pathToFile1.png","pathToFile2.txt","pathToFile3.csv"],
  742. // attachmentNames: ["image.jpg", "firstFile.txt", "secondFile.csv"],//only used in android, these are renames of original files. in ios filenames will be same as specified in path. In ios-only application, leave it empty: attachmentNames:[]
  743. // attachmentTypes: ["img", "txt", "csv"]//needed for android, in ios-only application, leave it empty: attachmentTypes:[]
  744. })
  745. .then(success =>
  746. this.setState({
  747. isLoading: false
  748. }),
  749. alert("Request dan Email Pengajuan Overtime telah dikirim"))
  750. .catch(err =>
  751. alert(err));
  752. };
  753.  
  754.  
  755. AmbilArray() {
  756.  
  757. alert('dapet gk?');
  758.  
  759. }
  760.  
  761.  
  762.  
  763.  
  764. render() {
  765.  
  766. // items1 = this.state.serverData1
  767. const format1 = "YYYY-MM-DD HH:mm:ss"
  768. const breaktime = this.state.ServerDatabreaktime
  769. const bonuskota = this.state.serverDataBonus
  770. const dataCheck = this.state.checkBoxChecked;
  771.  
  772. if (this.state.isLoading) {
  773. return (
  774. <View style={{ flex: 1, paddingTop: 20 }}>
  775. <ActivityIndicator />
  776. </View>
  777. );
  778. }
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787. // const datas = [];
  788. // for (let i = 0; i < 2; i += 1) {
  789. // const totlatRows = [];
  790. // for (let j = 0; j < 9; j += 1) {
  791. // totlatRows.push(`${i}${j}`);
  792. // }
  793. // datas.push(totlatRows);
  794. // }
  795.  
  796. const state = this.state;
  797.  
  798. const { navigation } = this.props;
  799. const fpnya = navigation.getParam('fpnya', 'NO-fpnya');
  800. const nik = navigation.getParam('nik', 'NO-nik');
  801. const nama = navigation.getParam('nama', 'NO-nama');
  802. const tgllahir = navigation.getParam('tgllahir', 'NO-tgllahir');
  803. const tempatlahir = navigation.getParam('tempatlahir', 'NO-tgllahir');
  804. const nomerktp = navigation.getParam('nomerktp', 'NO-nomerktp');
  805. const statusktp = navigation.getParam('statusktp', 'NO-statusktp');
  806. const jneiskelamin = navigation.getParam('jneiskelamin', 'NO-jneiskelamin');
  807. const agama = navigation.getParam('agama', 'NO-agama');
  808. const nikah = navigation.getParam('nikah', 'NO-nikah');
  809. const negara = navigation.getParam('negara', 'NO-negara');
  810. const atasan = navigation.getParam('atasan', 'NO-atasan');
  811. const namaatasan = navigation.getParam('namaatasan', 'NO-namaatasan');
  812. const telpon = navigation.getParam('telpon', 'NO-telpon');
  813. const nopajak = navigation.getParam('nopajak', 'NO-nopajak');
  814. const bpjskes = navigation.getParam('bpjskes', 'NO-bpjskes');
  815. const bpjstku = navigation.getParam('bpjstku', 'NO-bpjstku');
  816. const norek = navigation.getParam('norek', 'NO-norek');
  817. const alamat = navigation.getParam('alamat', 'NO-alamat');
  818. const nokk = navigation.getParam('nokk', 'NO-nokk');
  819. const noskck = navigation.getParam('noskck', 'NO-noskck');
  820. const departemenkerja = navigation.getParam('departemenkerja', 'NO-departemenkerja');
  821. const tanggalgabung = navigation.getParam('tanggalgabung', 'NO-tanggalgabung');
  822. const npwp = navigation.getParam('npwp', 'NO-npwp');
  823. const pendidikan = navigation.getParam('pendidikan', 'NO-pendidikan');
  824. const foto = navigation.getParam('foto', 'NO-foto');
  825. const statukerja = navigation.getParam('statukerja', 'NO-statukerja');
  826. const email = navigation.getParam('email', 'NO-email');
  827. const emailatasan = navigation.getParam('emailatasan', 'NO-emailatasan');
  828. const levelposisi = navigation.getParam('levelposisi', 'NO-levelposisi');
  829. const akhirkontrak = navigation.getParam('akhirkontrak', 'NO-akhirkontrak');
  830. const levelkerja = navigation.getParam('levelkerja', 'NO-levelkerja');
  831. items = this.state.serverData
  832. items2 = this.state.serverData2
  833. var datazg = this.state.datas
  834. const element = (data, index) => (
  835. <TouchableOpacity onPress={() => this._alertIndex(index)}>
  836. <View style={styles.btn2}>
  837. <Text style={styles.btnText}>button</Text>
  838. </View>
  839. </TouchableOpacity>
  840. );
  841.  
  842.  
  843. if (this.state.isLoading) {
  844. return (
  845. <View style={{ flex: 1, paddingTop: 20 }}>
  846. <ActivityIndicator />
  847. </View>
  848. );
  849.  
  850.  
  851.  
  852. } else {
  853.  
  854. return (
  855. <Container>
  856.  
  857. <Content style={{ flex: 1, }}>
  858. <View style={{ paddingVertical: 10 }} />
  859. {/* {(this.state.dataHeadnye !== []) && ( */}
  860. <Item>
  861. <View style={{ width: '100%', flexDirection: 'row', alignItems: 'center' }}>
  862. <View style={{ padding: 10 }}><Image style={{ width: 35, height: 35 }} source={require('../assets/customers.png')} /></View>
  863.  
  864. <View style={{ marginLeft: 20 }}>
  865. <Text style={{ fontSize: 12, fontWeight: 'bold', fontWeight: 'bold' }}>Employee</Text>
  866. <Text
  867. onPress={() => {
  868. this.toggleModalList(false)
  869. }}
  870. placeholder="Masukkan Employee"
  871. >Masukkan Employee</Text>
  872. {dataCheck.map((item, employee_id) => (
  873. <View style={{ width: '100%', flexDirection: 'row' }}>
  874. <Text style={{ fontSize: 12, fontWeight: 'bold', fontWeight: 'bold' }}>{employee_id}</Text>
  875. </View>
  876. ))}
  877.  
  878. </View>
  879. </View>
  880. </Item>
  881. <Item>
  882.  
  883. <View style={{ width: '100%', flexDirection: 'row' }}>
  884. <View style={{ padding: 10 }}><Image style={{ width: 35, height: 35 }} source={require('../assets/customers.png')} /></View>
  885. <View style={{ marginLeft: 20 }}>
  886. <Text style={{ fontSize: 12, fontWeight: 'bold', fontWeight: 'bold' }}>Tanggal Awal</Text>
  887. {this.state.datestart !== '' && (<Text style={{ fontSize: 12, fontStyle: 'normal' }} onPress={this.showDateTimePicker}>{this.state.datestart}</Text>)}
  888.  
  889. <DateTimePickerModal
  890. isVisible={this.state.isDateTimePickerVisible}
  891. placeholder="select date"
  892. mode="date"
  893. locale="en_GB" // Use "en_GB" here
  894. onConfirm={this.handleDatePicked}
  895. onCancel={this.hideDateTimePicker}
  896. />
  897. </View>
  898. <View style={{ alignItems: 'center' }}>
  899. <Text style={{ fontSize: 12, fontWeight: 'bold', fontWeight: 'bold' }}> s/d</Text>
  900. </View>
  901. <View style={{ marginLeft: 50 }}>
  902. <Text style={{ fontSize: 12, fontWeight: 'bold', fontWeight: 'bold' }}>Tanggal Akhir</Text>
  903. {this.state.dateend !== '' && (<Text style={{ fontSize: 12, fontWeight: 'normal' }} onPress={this.showDateTimePickerAkhir}>{this.state.dateend}</Text>)}
  904.  
  905. <DateTimePickerModal
  906. isVisible={this.state.isDateTimePickerVisibleAkhir}
  907. placeholder="select date"
  908. mode="date"
  909. locale="en_GB" // Use "en_GB" here
  910. onConfirm={this.handleDatePickedAkhir}
  911. onCancel={this.hideDateTimePickerAkhir}
  912. />
  913. </View>
  914. </View>
  915. </Item>
  916.  
  917. <Item>
  918. <View style={{ width: '100%', flexDirection: 'row', alignItems: 'center' }}>
  919. <View style={{ padding: 10 }}><Image style={{ width: 35, height: 35 }} source={require('../assets/customers.png')} /></View>
  920. <View style={{ marginLeft: 20 }}>
  921. <Text style={{ fontSize: 12, fontWeight: 'bold', fontWeight: 'bold' }}>Pilih Shift</Text>
  922. <SearchableDropdown
  923. onItemSelect={(item) => {
  924.  
  925. this.setState({
  926. selectedItems: items,
  927. shiftidnya: item.id,
  928. nameshiftnya: item.name,
  929.  
  930. }, () => {
  931. this.setDateRange(this.state.checkBoxChecked);
  932. });
  933.  
  934. }}
  935. containerStyle={{ padding: 5 }}
  936. onRemoveItem={(item, index) => {
  937. const items = this.state.selectedItems.filter((sitem) => sitem.id !== item.id);
  938. this.setState({ selectedItems: items });
  939. }}
  940.  
  941. itemStyle={{
  942. padding: 10,
  943. marginTop: 2,
  944. backgroundColor: '#ddd',
  945. borderColor: '#000',
  946. borderWidth: 1,
  947. borderRadius: 5,
  948. }}
  949. itemTextStyle={{ color: '#222' }}
  950. itemsContainerStyle={{ maxHeight: 1400 }}
  951. items={items2}
  952. defaultIndex={2}
  953. resetValue={false}
  954. textInputProps={
  955. {
  956. placeholder: "Select Shift",
  957. underlineColorAndroid: "transparent",
  958. style: {
  959. padding: 10,
  960. borderWidth: 1,
  961. borderColor: '#ccc',
  962. // borderRadius: 5,
  963. width: "100%",
  964. },
  965. }
  966. }
  967. listProps={
  968. {
  969. // nestedScrollEnabled: true,
  970. }
  971. }
  972. />
  973. {/* <Text style={{ fontSize: 10, fontWeight: 'bold', fontWeight: 'bold' }}>Pilih Shift {this.state.nameshiftnya}</Text> */}
  974. </View>
  975. </View>
  976. </Item>
  977. {/* )} */}
  978. <SafeAreaView style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
  979. <View style={{ flexDirection: 'row' }}>
  980. {/* <Right>
  981. <View style={{ marginHorizontal: 17, paddingTop: 15 }}>
  982. <Button small rounded primary onPress={this.AmbilArray}>
  983. <Text style={{ color: '#fff' }}> Next </Text>
  984. </Button>
  985. </View>
  986. </Right> */}
  987. </View>
  988. </SafeAreaView>
  989.  
  990.  
  991. <View style={styles.container}>
  992.  
  993.  
  994. {this.state.datas == '[]' && (
  995. <View>
  996. <Text style={{ fontSize: 14, fontWeight: 'bolt', textAlign: 'center', marginTop: 50 }}>Tidak ada Data</Text>
  997. </View>
  998. )}
  999.  
  1000. {this.state.datas !== [] && (
  1001. <View>
  1002. <ScrollView
  1003. horizontal={true}
  1004. >
  1005. <FlatList
  1006. data={this.state.datas}
  1007. ItemSeparatorComponnt={this.renderSeparator}
  1008. ListHeaderComponent={this.renderHeader}
  1009. renderItem={({ item }) => (
  1010. <ListItem style={styles.list}
  1011. badge={{ value: item.STATUS, textStyle: { textAlign: 'center', fontSize: 12, width: 80, fontWeight: 'bold', color: '#fff' }, containerStyle: { marginTop: -20 }, status: item.STATUS == "PRS" ? "success" : "error" }}
  1012. // title={`${moment(item.date).format("DD/MM/YYYY")} ${item.shiftName} ${<TouchableHighlight><Button onPress={this.showDateTimePickerOvr} />
  1013. // <Text style={{ color: 'red' }}>{this.state.timestart}</Text>
  1014. // <DateTimePickerModal
  1015. // isVisible={this.state.isDateTimePickerVisibleOvr}
  1016. // placeholder="select date"
  1017. // mode="time"
  1018. // locale="en_GB" // Use "en_GB" here
  1019. // onConfirm={this.handleDatePickedOvr}
  1020. // onCancel={this.hideDateTimePickerOvr}
  1021. // />
  1022. // </TouchableHighlight>
  1023. // } ${`00:00`} ${`00:00`} ${`00:00`}`}
  1024. subtitle={
  1025. <View style={{ flexDirection: 'row' }}>
  1026.  
  1027.  
  1028. {this.state.datestart !== '' && (
  1029. <TouchableHighlight onPress={this.toggleModalpicker}>
  1030.  
  1031. <Text style={{ fontSize: 18 }} >akulahku</Text>
  1032. </TouchableHighlight>
  1033. )}
  1034.  
  1035. <DateTimePickerModal
  1036. isVisible={this.state.isDateTimePickerVisible}
  1037. placeholder="select date"
  1038. mode="date"
  1039. locale="en_GB" // Use "en_GB" here
  1040. onConfirm={this.handleDatePicked}
  1041. onCancel={this.hideDateTimePicker}
  1042. />
  1043.  
  1044.  
  1045.  
  1046. </View>
  1047.  
  1048.  
  1049.  
  1050. }
  1051.  
  1052. />
  1053. )}
  1054. keyExtractor={(item) => item.no_doc}
  1055. refreshControl={
  1056. <RefreshControl
  1057.  
  1058. refreshing={this.state.isLoading}
  1059. onRefresh={this.onRefresh.bind(this)}
  1060. />
  1061. }
  1062.  
  1063. />
  1064. </ScrollView>
  1065.  
  1066.  
  1067. </View>
  1068.  
  1069. )}
  1070. <View>
  1071. {/* {(this.state.dataSource !== []) && ( */}
  1072. {/* <View style={styles.lowerSection}> */}
  1073. <View style={{ paddingVertical: 10 }} />
  1074. <SafeAreaView style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
  1075. <View style={{ width: '100%', flexDirection: 'row' }}>
  1076. <Right>
  1077. <AnimateLoadingButton
  1078. ref={c => (this.loadingButton = c)}
  1079. width={70}
  1080. height={40}
  1081. marginTop={80}
  1082. title="Submit"
  1083. titleFontSize={18}
  1084. titleColor="rgb(255,255,255)"
  1085. backgroundColor="#FE001C"
  1086. borderRadius={10}
  1087. // onPess={this.rSubmitAddEmp.bind(this)}
  1088. />
  1089. </Right>
  1090.  
  1091. </View>
  1092. </SafeAreaView>
  1093.  
  1094. <View style={{ flex: 1, backgroundColor: '#f3f3f3' }}>
  1095. {/* Rest of the app comes ABOVE the action button component !*/}
  1096. </View>
  1097. <View style={{ paddingVertical: 20 }} />
  1098. </View>
  1099. {/* )} */}
  1100.  
  1101. {/* </View> */}
  1102. </View>
  1103.  
  1104.  
  1105.  
  1106. <View style={styles.container}>
  1107. <Modal style={{ flex: 1, boderRadius: 2 }} isVisible={this.state.isModalVisibleList} animationType="slide" onRequestClose={() => {
  1108. this.setisModalVisibleList(false)
  1109. }}>
  1110. <ScrollView>
  1111. {/* <ScrollView keyboardShouldPersistTaps="handled"> */}
  1112. <Button full style={styles.btn}>
  1113. <Text style={{ color: 'white' }}>Pilih Employee</Text>
  1114. </Button>
  1115.  
  1116. <View style={styles.lowerSection}>
  1117. <View style={styles.centerDatePIcker}>
  1118.  
  1119. <SearchBar
  1120. placeholder="Cari Dengan NIK / Nama "
  1121. lightTheme
  1122. round
  1123. searchIcon={{ size: 24 }}
  1124. color='#ffffff'
  1125. onChangeText={text => this.SearchFilterFunction(text)}
  1126. onClear={text => this.SearchFilterFunction('')}
  1127. autoCorrect={false}
  1128. value={this.state.search}
  1129.  
  1130. containerStyle={{ backgroundColor: '#ffffff' }}
  1131. inputStyle={{ backgroundColor: '#ffffff' }}
  1132. />
  1133.  
  1134. </View>
  1135. {this.state.dataSource == '[]' && (
  1136. <View>
  1137. <Text style={{ fontSize: 14, fontWeight: 'bolt', textAlign: 'center', marginTop: 50 }}>Tidak ada Data</Text>
  1138. </View>
  1139. )}
  1140.  
  1141. {this.state.dataSource !== [] && (
  1142.  
  1143. <View>
  1144.  
  1145. <FlatList
  1146.  
  1147. data={this.state.dataSource}
  1148.  
  1149. // ItemSeparatorComponnt={this.renderSeparator}
  1150. // ListHeaderComponent={this.renderHeader}
  1151.  
  1152.  
  1153. renderItem={({ item }) => (
  1154.  
  1155.  
  1156. // <TouchableHighlight
  1157. // activeOpacity={0.5}
  1158. // onPress={() => this.toggleModal(item.employee_id, item.employee_firts_name, item.fotonya, item.atasan_id, item.dept_id, item.approval1, item.approval2, item.jatah_sisa, item.pindahan_sisa, item.jatah_digunakan, item.pindahan_digunakan)}
  1159. // >
  1160. <ListItem style={styles.list}
  1161. leftAvatar={{ source: { uri: item.fotonya } }}
  1162. title={item.employee_firts_name}
  1163. subtitle={`${item.employee_id}`}
  1164.  
  1165. rightSubtitle={<CheckBox
  1166. value={this.state.checkBoxChecked[item.employee_id]}
  1167. onValueChange={() =>
  1168. this.checkBoxChanged(item.employee_id, item.employee_firts_name, this.state.checkBoxChecked[item.employee_id])
  1169. }
  1170. // onPress={this._onPressHandler}
  1171. />
  1172. }
  1173.  
  1174.  
  1175. />
  1176. // </TouchableHighlight>
  1177. )}
  1178. keyExtractor={(item) => item.employee_id}
  1179.  
  1180.  
  1181.  
  1182. refreshControl={
  1183. <RefreshControl
  1184.  
  1185. refreshing={this.state.isLoading}
  1186. onRefresh={this.onRefresh.bind(this)}
  1187. />
  1188. }
  1189.  
  1190. />
  1191.  
  1192. {/* </View> */}
  1193.  
  1194. </View>
  1195.  
  1196.  
  1197.  
  1198. )}
  1199.  
  1200.  
  1201.  
  1202. <View style={{ paddingTop: 30 }}>
  1203. <SafeAreaView style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
  1204. <View style={{ flexDirection: 'row' }}>
  1205.  
  1206. {/* <Left>
  1207. <View style={{ marginHorizontal: 17, paddingTop: 15 }}>
  1208. {(this.state.dataSource !== []) && (
  1209. <Button small rounded success onPress={this.SubmitAddEmp.bind(this)}>
  1210. <Text style={{ color: '#fff' }}> Save </Text>
  1211. </Button>
  1212. )}
  1213. </View>
  1214. </Left> */}
  1215. <Right>
  1216. <View style={{ marginHorizontal: 17, paddingTop: 15 }}>
  1217. <Button small rounded danger onPress={() => {
  1218. this.setisModalVisibleList(false)
  1219.  
  1220. }}>
  1221. <Text style={{ color: '#fff' }}> Proses </Text>
  1222. </Button>
  1223. </View>
  1224.  
  1225. </Right>
  1226. </View>
  1227. </SafeAreaView>
  1228. </View>
  1229.  
  1230. <View style={{ paddingVertical: 15 }} />
  1231.  
  1232. </View>
  1233. </ScrollView>
  1234. {/* </ScrollView> */}
  1235. </Modal>
  1236. </View>
  1237.  
  1238. <View style={styles.container}>
  1239. <Modal style={{ flex: 1, boderRadius: 2 }} isVisible={this.state.isModalVisiblepicker} animationType="slide" onRequestClose={() => {
  1240. this.setisModalVisiblepicker(false)
  1241. }}>
  1242. <DateTimePickerModal
  1243. isVisible={true}
  1244. placeholder="select date"
  1245. mode="time"
  1246. locale="en_GB" // Use "en_GB" here
  1247. onConfirm={this.handleDatePickedOvr}
  1248. onCancel={this.hideDateTimePickerOvr}
  1249. />
  1250. </Modal>
  1251. </View>
  1252. </Content>
  1253. </Container>
  1254.  
  1255. )
  1256. }
  1257. }
  1258. }
  1259.  
  1260. const styles = StyleSheet.create({
  1261. container: { flex: 1, padding: 16, paddingTop: 30, backgroundColor: '#fff' },
  1262. header: { height: 50, backgroundColor: '#537791' },
  1263. text: { textAlign: 'center', fontWeight: '100' },
  1264. text2: { textAlign: 'center', backgroundColor: '#ffffff' },
  1265. dataWrapper: { marginTop: -1 },
  1266. row: { height: 40, backgroundColor: '#E7E6E1' },
  1267. list: { fontSize: 12, fontWeight: 'bold' },
  1268. HeadStyle: {
  1269. height: 50,
  1270. alignContent: "center",
  1271. backgroundColor: '#686868'
  1272. },
  1273. TableText: {
  1274. margin: 10,
  1275. color: '#fff'
  1276. },
  1277. headerWrapper: {
  1278. height: 50,
  1279. backgroundColor: '#686868',
  1280. },
  1281. viewjam: {
  1282. backgroundColor: 'red',
  1283. height: 30,
  1284. width: 70,
  1285. // borderRadius: 10,
  1286. },
  1287. lowerSection: {
  1288. paddingVertical: 30,
  1289. paddingHorizontal: 20,
  1290. backgroundColor: '#fff',
  1291. },
  1292. btnText: { textAlign: 'center', color: '#fff' },
  1293. btn2: { width: 58, height: 18, backgroundColor: '#78B7BB', borderRadius: 2 },
  1294. btn: {
  1295. backgroundColor: 'red'
  1296. },
  1297. label: {
  1298. position: 'absolute',
  1299. backgroundColor: 'white',
  1300. left: 22,
  1301. top: 8,
  1302. zIndex: 999,
  1303. paddingHorizontal: 8,
  1304. fontSize: 14,
  1305. },
  1306. placeholderStyle: {
  1307. fontSize: 16,
  1308. },
  1309. selectedTextStyle: {
  1310. fontSize: 16,
  1311. },
  1312. textStyle: {
  1313. color: '#fff'
  1314. },
  1315. iconStyle: {
  1316. width: 20,
  1317. height: 20,
  1318. },
  1319. inputSearchStyle: {
  1320. height: 40,
  1321. fontSize: 16,
  1322. },
  1323. textArea: {
  1324. height: 150,
  1325. justifyContent: "flex-start"
  1326. },
  1327.  
  1328. textAreaContainer: {
  1329. borderColor: 'grey',
  1330. width: "90%",
  1331.  
  1332. },
  1333.  
  1334. });
  1335. export default FeatureManageSchedule;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement