import React, { useState, useEffect } from 'react';
import Container from '../components/container';
import { useRoute } from '@react-navigation/native';
import { globalStyles, customStyles, GetPageTheme } from "../styles/Global";
import { StatusBar, Image, TextInput, View, Text, ScrollView, TouchableOpacity, Platform, SafeAreaView } from 'react-native';
import { ReactReduxContext, connect, useSelector, useDispatch } from 'react-redux';
import { mapStateToProps, mapDispatchToProps } from '../reducers/contextProvider';
import moment from 'moment';
import { CustomPicker } from '../components/CustomPicker';
import cameraImg from '../assets/performics/camera_front_image.svg'

import CustomHeader from '../components/customHeader';
import Svg, { SvgUri, SvgXml } from 'react-native-svg';
import CustomLoader from '../components/CustomLoader';
import LinearGradient from 'react-native-linear-gradient';
import * as RNFS from 'react-native-fs';
import MultiSelect from 'react-native-multiple-select';
import { notify } from '../components/notify';
import { get_item } from '../components/localStorage';
import { URL_IMAGE, common_ImagePath, db, resumeurl } from '../constants/constants';
import { PrimaryTheme } from '../styles/Themes';
import CustomCamera from '../components/Camera';
import { FontAwesome, MaterialCommunityIcons } from '../components/icons';
import { UploadData2, UploadFormData, getIf_UserIsManager, marktext1, marktext2, validateNumber } from '../controller/functions';
import { ConfirmSaveAlert } from '../components/alert';
import GradientButton from '../components/gradientButton';
import { AppTables } from '../constants/tableConstants';
import { getDevice } from 'react-native-device-info';
import { UploadImagesWithoutWait, getImagePOSTData } from '../constants/uploadData';
import { METHODS, getMethodName } from '../constants/methodNames';



function AddGateMeeting(props) {
  const route = useRoute();

  const ST = props.StaticText || {};
  let userid = props.UserId;
  console.log('userod', props.sessionData.Designation);
  // let Designation=props.sessionData.Designation;
  // let textDesignation =''
  //  console.log('Designation',Designation)
  //  if(Designation=='Program Manager' || Designation=='Area Manager'){
  //     textDesignation= 'Search Area Manager'
  //  }


  // get all theme styles acc to current theme set 
  const PageTheme = GetPageTheme(props.DarkMode, route.name);
  const customStyle = customStyles(props.DarkMode, route.name);
  const [showCamera, setShowCamera] = useState(false);
  const [rerenderdata, setrerenderdata] = useState(0);

  const [processing, setProcessing] = useState(false);
  const [MerchandiserName, setMerchandiserName] = useState([]);
  const [SupervisorName, setSupervisorName] = useState([]);


  const [EmployeeName, setEmployeeName] = useState('');

  const [EmployeeID, setEmployeeID] = useState('');
  const [supName, setSupName] = useState('');

  const [supID, setSupID] = useState('');

  const [dispoint, setdispoint] = useState("");
  const [image, setimage] = useState({});
  const [getImageProps, setGetImageProps] = useState({});
  const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
  const [showRemoveConfirm_M, setshowRemoveConfirm_M] = useState(false);
  const [toRemoveId, setToRemoveId] = useState('');
  const [showRAllC_M, setShowRAllC_M] = useState(false);
  const [DiscPoints, setDiscPoints] = useState([]);
  const [showAlert, setShowAlert] = useState(false);
  const [loaderTitle, setLoaderTitle] = useState('loading...');

  const [selectedItems, setSelectedItems] = useState([]);
  const [selectedItems1, setSelectedItems1] = useState([]);
  const d1 = new Date();


  const d2 = moment(d1).format('MM/DD/YYYY');

  let userIsManager = getIf_UserIsManager(props);

  useEffect(() => {
    getData();
  }, []);

  async function getData() {
    let d1 = new Date();
    let d2 = moment(d1).format('MM/DD/YYYY');

    var q = `Select * from Sup_SupervisorList `;
    var q2 = `Select * from Sup_TeamList `;
    await db.transaction(async function (txn) {
      await txn.executeSql(q, [], async function (txn2, txnres2) {
        console.log('txnres2', q)

        if (txnres2.rows.length > 0) {
          // show from local
          let employeeName = [];
          for (var i = 0; i < txnres2.rows.length; i++) {
            let data = txnres2.rows.item(i);
            let windowDataObj = { 'EmpId': data.EmpId, 'EmployeeName': data.EmployeeName };
            employeeName.push(windowDataObj)
            if (i == (txnres2.rows.length - 1)) {
              setSupervisorName(employeeName);
              setProcessing(false);

            }
          }
        }
        else {
          setProcessing(false); notify(ST.Nodatafound);
        }
      }, function (txn2, txnerr) { console.log(txnerr); setProcessing(false); notify(ST.Nodatafound); });
    });

    await db.transaction(async function (txn) {
      await txn.executeSql(q2, [], async function (txn2, txnres2) {
        console.log('txnres2', q2)

        if (txnres2.rows.length > 0) {
          // show from local
          let employeeName = [];
          for (var i = 0; i < txnres2.rows.length; i++) {
            let data = txnres2.rows.item(i);
            let windowDataObj = { 'EmpId': data.EmpId, 'EmployeeName': data.EmployeeName };
            employeeName.push(windowDataObj)
            if (i == (txnres2.rows.length - 1)) {
              setMerchandiserName(employeeName);
              setProcessing(false);

            }
          }
        }
        else {
          setProcessing(false); notify(ST.Nodatafound);
        }
      }, function (txn2, txnerr) { console.log(txnerr); setProcessing(false); notify(ST.Nodatafound); });
    });
  }

  async function saveData() {
    console.log('trues')
    setHasUnsavedChanges(false);
    setShowAlert(false);
    setLoaderTitle('Saving Data...');
    setProcessing(true);
    try {
      await db.transaction(async function (txn) {

        var values = ''; var values1 = '';
        let discussionpoint = [];
        const time = moment(d1).format('hh:mm:ss');
        const uniqueId = 'gm' + '_' + moment().format('MMDDYYYYHHmmss');
        values += ` ('${d2}','${props.UserId}','${time}','${uniqueId}','${EmployeeID}','${EmployeeName}','${supID}','${supName}','${image.Image1Name}','${d2}') `;
        for (var i = 0; i < DiscPoints.length; i++) {
          let dp = DiscPoints[i];
          discussionpoint.push(dp)

          values1 += values1 != '' ? ' , ' : '';
          values1 += ` ('${d2}','${props.UserId}','${uniqueId}','${dp}','${d2}') `;
        }

        console.log('values:', values);
        console.log('values1', values1);
        let add_data = `INSERT INTO ${AppTables.GATE_MEETING} (VISIT_DATE,USER_ID,TIME,UNIQUE_ID,EMP_ID,MERCHANDISER_NAME,SUP_ID,SUP_NAME,IMAGE,ADDED_DATE) VALUES ${values} `;
        let dp_data = `INSERT INTO ${AppTables.GATE_MEETING_DISCUSSION} (VISIT_DATE,USER_ID,GATEMEETING_ID,DISCUSSION_POINTS,ADDED_DATE) VALUES ${values1} `;

        await txn.executeSql(add_data, [], async function (txn2, txnres) {
          await txn.executeSql(dp_data, [], async function (txn2, txnres) {
            console.log('GM added');
            notify('Gate Meeting added successfully', 'SHORT');
            setLoaderTitle("Uploading data...");
            setrerenderdata(!rerenderdata);
            uploadGateMeetingData(uniqueId, discussionpoint, time);


          }, function (txnE, txnerr) { console.log(txnerr); setProcessing(false); notify('Cannot add Gate Meeting Discussion Point') },);
        }, function (txnE, txnerr) { console.log(txnerr); setProcessing(false); notify('Cannot add Gate Meeting') },);


      });
    } catch (err) {
      console.log(err);
    }
  }


  async function validate() {
    let isValid = true;

    if (props.sessionData.Designation == 'Program Manager' || props.sessionData.Designation == 'Area Manager') {
      if (supID == '' || supID == null) {
        notify('Please select Supervisor Name');
        isValid = false;
      }
    }

    if (EmployeeID == '' || EmployeeID == null) {
      notify('Please select Merchandiser Name');
      isValid = false;
    }
    else if (image.Image1Path == '' || image.Image1Path == null) {
      notify('Please click Image');
      isValid = false;
    }
    else if (DiscPoints.length <= 0) {
      notify('Please add atleat one Discussion Point');
      isValid = false;
    }

    return isValid;
  }

  async function Add_DP() {

    if (dispoint == null || dispoint == "") {
      notify('Please enter Discussion Points');
    }
    else {
      let arr = DiscPoints;
      arr.push(dispoint);

      // clear data
      setdispoint("");
      notify('Discussion added successfully', 'LONG');
      setDiscPoints(arr);
      setHasUnsavedChanges(true);
      setrerenderdata(!rerenderdata);
    }
  }
  async function getImage(imgdata) {
    if (typeof imgdata == 'object' && imgdata.errorCode == 'camera_unavailable') {
      notify('Camera unavailable');
    }
    // else if(typeof imgdata =='object' && imgdata.uri!=null){
    //     const img=imgdata;
    //     const imgurl=img.uri, imgWidth=img.width, imgHeight=img.height;
    //     let picture_clicked_time=new Date();
    //     picture_clicked_time=moment(picture_clicked_time).format('DDMMYYYYHHmmss')
    //     let filename='GateMeeting'+(props.UserId || '')+picture_clicked_time+'.jpg';

    //     let imagePath='file://'+`${common_ImagePath}${filename}`;
    //     console.log('imagePath',imagePath)


    //     RNFS.moveFile(imgurl,imagePath)
    //     .then(resn => {
    //       let data=image;

    //           data['Image1Path']=imagePath;
    //           data['Image1Name']=filename;


    //       console.log('data:',data);
    //       setimage(data);
    //       setrerenderdata(!rerenderdata);
    //     })
    //     .catch(err => {
    //         console.log('ERROR: image file write failed!!!');
    //         console.log(err.message, err.code);
    //     }); 

    // }   

    else if (typeof imgdata == 'object' && imgdata.uri != null) {
      const img = imgdata;
      const imgurl = img.uri, imgWidth = img.width, imgHeight = img.height;


      let picture_clicked_time = new Date();
      picture_clicked_time = moment(picture_clicked_time).format('DD-MM-YYYY HH:mm:ss')


      const mark_text1 = picture_clicked_time;

      const mark_text2 = ' Name:' + props.UserId + ' | Image Type: GateMeeting' + ' | Date:' + picture_clicked_time;


      console.log('imgurl marktext1:', mark_text2);
      await marktext1(mark_text1, imgurl)
        .then((res) => {
          if (res.success) {

            let uri = res.uri;
            marktext2(mark_text2, uri, imgWidth, imgHeight)
              .then((res) => {

                if (res.success) {
                  let picture_clickedd = new Date();
                  // let picture_clicked_date=moment(picture_clickedd).format('YYYYMMDD');
                  let picture_clicked_time = moment(picture_clickedd).format('HHmmss');
                  let filename = 'GateMeeting' + props.UserId + picture_clicked_time + '.jpg';
                  let alldata = image;

                  let imagePath = 'file://' + `${common_ImagePath}${filename}`;
                  RNFS.moveFile(res.uri, imagePath)
                    .then(resn => {

                      alldata['Image1Path'] = imagePath;
                      alldata['Image1Name'] = filename;
                      setimage(alldata);
                      setrerenderdata(!rerenderdata);

                    })
                    .catch(err => {
                      console.log('ERROR: image file write failed!!!');
                      console.log(err.message, err.code);
                    });

                }
                else {
                  if (res.imagenotfound) {
                    notify(ST.Pleasecaptureaimage);
                  }
                  else {
                    notify(res.error);
                  }
                }

              });


          }
          else {
            if (res.imagenotfound) {
              notify(ST.Pleasecaptureaimage);
            }
            else {
              notify(res.error);
            }
          }
        });
    }
  }

  async function openCamera() {
    setShowCamera(true);
  }

  function showRemoveConfirm(item, index) {
    setToRemoveId(index);
    setshowRemoveConfirm_M(true);
  }

  function Remove_DP() {
    let index = toRemoveId
    let arr = DiscPoints;
    console.log('toRemoveId:', index);
    if (index >= 0 && index < arr.length) {
      arr.splice(index, 1);
      setDiscPoints(arr);
      setHasUnsavedChanges(true);
      notify('Discussion Point removed successfully', 'LONG')
      setrerenderdata(!rerenderdata);
    }
    else {
      notify('Cannot remove! Discussion Point not found', 'LONG')
    }

    setToRemoveId('');
    setshowRemoveConfirm_M(false);
  }


  const onSelectedItemsChange1 = (selectedItems1 = []) => {

    console.log('setMultiSelectValue', selectedItems1);
    setSelectedItems1(selectedItems1)
    let obj = {};
    let anss = [];
    obj["EmployeeId"] = selectedItems1.join(',');
    selectedItems1.map((itemValue) => {
      console.log('itemValue:', itemValue);

      let ans = SupervisorName.find(c1 => c1.EmpId == itemValue);
      if (ans.EmployeeName) { anss.push(ans.EmployeeName) }
    });
    obj["EmployeeName"] = anss.join(',');
    let empid = obj.EmployeeId;
    let empname = obj.EmployeeName;
    setSupID(empid)
    setSupName(empname)

    setHasUnsavedChanges(true);
    setrerenderdata(!rerenderdata);
    console.log('empid:', empid);
    console.log('empname:', empname);


  };

  const onSelectedItemsChange = (selectedItems = []) => {

    console.log('setMultiSelectValue', selectedItems);
    setSelectedItems(selectedItems)
    let obj = {};
    let anss = [];
    obj["EmployeeId"] = selectedItems.join(',');
    selectedItems.map((itemValue) => {
      console.log('itemValue:', itemValue);

      let ans = MerchandiserName.find(c1 => c1.EmpId == itemValue);
      if (ans.EmployeeName) { anss.push(ans.EmployeeName) }
    });
    obj["EmployeeName"] = anss.join(',');
    let empid = obj.EmployeeId;
    let empname = obj.EmployeeName;
    setEmployeeID(empid)
    setEmployeeName(empname)

    setHasUnsavedChanges(true);
    setrerenderdata(!rerenderdata);
    console.log('empid:', empid);
    console.log('empname:', empname);


  };




  async function onSubmitData() {
    let isvalid = await validate();
    if (isvalid) {
      setShowAlert(true);
    }
  }

  // function onFormDataChange(val,key,type=''){
  //   if(val!=''){
  //       let isValid=validateNumber(val,type);
  //       if(!isValid){
  //           return;
  //       }
  //   }

  //   let data=AddVisFormData;
  //   data[key]=val;
  //   setFormData(data);
  //   // setDiscPoints(data);
  //   // setHasUnsavedChanges(true);
  //   setrerenderdata(!rerenderdata);
  // }

  function onSaveCancel() {
    setShowAlert(false);
  }

  async function uploadGateMeetingData(uniqueId, discussionpoint, time) {
    const url = props.baseurl + getMethodName(METHODS.UPLOADJSON_METHOD);
    let employeesArr = EmployeeID != null && EmployeeID != '' && EmployeeID != undefined ? EmployeeID.split(',') : [];
    let obj = {
      "MID": 0,
      "UniqueId": uniqueId,
      "UserId": props.UserId,
      "VisitDate": d2,
      "Time": time,
      "Image": image.Image1Name,
      "MerchandiserId": employeesArr,
      "DiscussionPoints": discussionpoint
    }
    let JsonChange = JSON.stringify(obj)?.replace(/'/g, '"')

    let postData = {
      "MID": 0,
      "Keys": "GateMeeting_Sup",
      "JsonData": JsonChange,
      "UserId": props.UserId,
    };

    console.log('postData', postData)

    let imgPath = image.Image1Path;
    let ImageName = image.Image1Name;

    await UploadData2(url, postData)
      .then(async (res) => {
        console.log('res:', res);
        if (res.UploadJsonResult != null && res.UploadJsonResult == 'Success') {


          // uplod images
          const url2 = (props.imageUploadUrl || URL_IMAGE) + getMethodName(METHODS.UPLOADIMAGES_METHOD);
          let upload_status = 'U'
          if (ImageName != '' && ImageName != null) {
            let file = {
              uri: imgPath,
              type: 'image/jpeg',
              name: ImageName,
              filetype: 'image',
              folderName: 'SupGateMeetingImages',
            }

            let isExists = await RNFS.exists(file.uri).then((res) => { return res; });
            console.log('isExists file', isExists);
            if (isExists == true) {
              let fileData = getImagePOSTData(file, d2);

              let isImageUploaded = await UploadFormData(url2, fileData);
              console.log('isImageUploaded', isImageUploaded)
              if (isImageUploaded.success == false) {
                upload_status = 'D'
                notify('Cannot upload image!');
              }
            }
            else {
              notify("Error uploading image! Image does not exists");
            }
          }

          let isupdated = updateGateMeetUploadStatus(uniqueId, upload_status);
          if (isupdated) {
            notify('Data Uploaded Sucessfully!');
            setProcessing(false);
            props.navigation.goBack();
          }
          else {
            setProcessing(false);
            notify("Cannot update upload status!");
            props.navigation.goBack();
          }

        } else {
          setProcessing(false);
          notify(ST.Cannotuploaddata);
          props.navigation.goBack();
        }
      })
      .catch((err) => {
        console.log(err);
        setProcessing(false);
        notify(ST.Cannotuploaddata);
        props.navigation.goBack();
      });

  }
  async function updateGateMeetUploadStatus(uniqueId, uploadstatus) {
    return new Promise((resolve, reject) => {
      db.transaction(async function (txn) {
        let q = `Update ${AppTables.GATE_MEETING} SET UPLOADSTATUS='${uploadstatus}' WHERE USER_ID='${props.UserId}' AND VISIT_DATE='${d2}' and UNIQUE_ID='${uniqueId}'`;
        await txn.executeSql(q, [], async function (txn2, txnres) {
          console.log('Gate Meeting upload status Updated');
          resolve(true);
        }, function (txn2, txnerr) { console.log(txnerr); resolve(false); },);
      });
    }).then((val) => {
      return val;
    }).catch((err) => {
      console.log(err);
      return false;
    });
  }
  console.log('check',props.sessionData.Designation=='Area Manager' || props.sessionData.Designation=='Program Manager')

  return (
    <Container {...props} pt={0} avoidSafeArea={(Platform.OS == 'ios' ? true : false)}>
      {processing && <CustomLoader fullHeight={true} title={loaderTitle} />}

      <CustomHeader {...props} title={'GateMeeting'} hideBellIcon={false} hideTimer={false} />
      {ConfirmSaveAlert(props, showAlert, onSaveCancel, saveData)}
      {ConfirmSaveAlert(props, showRemoveConfirm_M, () => { setshowRemoveConfirm_M(false) }, Remove_DP, 'Do you really want to remove this Discussion Points?')}
      <CustomCamera cameraType={'back'} enableCameraFlip={true} onImageCaptured={(imgData) => { setShowCamera(false);getImage(imgData) }} showCamera={showCamera} onHideCamera={() => { setShowCamera(false); }} />
      <LinearGradient colors={[PageTheme.$gradient1, PageTheme.$primary_color]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }} style={customStyle.roundScrollWrapper}>
        <View style={[customStyle.pageContentWrapper]}>
          {rerenderdata == rerenderdata &&
            <ScrollView style={customStyle.gm_scrollView} >
              {/* {console.log('check1', userIsManager && true && props?.sessionData?.Designation == 'Area Manager' || props?.sessionData?.Designation == 'Program Manager')} */}

              {userIsManager && (props?.sessionData?.Designation == 'Program Manager' || props?.sessionData?.Designation == 'Area Manager') &&
                <View style={[customStyle.gm_childlayout]}>
                  <MultiSelect
                    items={SupervisorName}
                    uniqueKey="EmpId"
                    // onSelectedItemsChange={onSelectedItemsChange}
                    onSelectedItemsChange={(selectedItems1) => { onSelectedItemsChange1(selectedItems1) }} //setMultiSelectValue(selectedItems,qtn)
                    selectedItems={selectedItems1}
                    selectText={'Search Supervisor'}
                    searchInputPlaceholderText={'Search Supervisor'}
                    onChangeInput={(text1) => console.log(text1)}
                    tagRemoveIconColor={PrimaryTheme.$primary_color}
                    tagBorderColor={PrimaryTheme.$primary_color}
                    tagTextColor={PrimaryTheme.$primary_color}
                    selectedItemTextColor={PrimaryTheme.$primary_color}
                    selectedItemIconColor={PrimaryTheme.$primary_color}
                    itemTextColor={PrimaryTheme.$text_color}
                    displayKey="EmployeeName"
                    searchInputStyle={{ color: '#CCC' }}
                    submitButtonColor={PrimaryTheme.$primary_color}
                    submitButtonText="Submit" />
                </View>
              }
              <View style={[customStyle.gm_childlayout]}>
                <MultiSelect
                  items={MerchandiserName}
                  uniqueKey="EmpId"
                  // onSelectedItemsChange={onSelectedItemsChange}
                  onSelectedItemsChange={(selectedItems) => { onSelectedItemsChange(selectedItems) }} //setMultiSelectValue(selectedItems,qtn)
                  selectedItems={selectedItems}
                  selectText={'Search Merchandiser/Promoter'}
                  searchInputPlaceholderText={'Search Merchandiser/Promoter'}
                  onChangeInput={(text) => console.log(text)}
                  tagRemoveIconColor={PrimaryTheme.$primary_color}
                  tagBorderColor={PrimaryTheme.$primary_color}
                  tagTextColor={PrimaryTheme.$primary_color}
                  selectedItemTextColor={PrimaryTheme.$primary_color}
                  selectedItemIconColor={PrimaryTheme.$primary_color}
                  itemTextColor={PrimaryTheme.$text_color}
                  displayKey="EmployeeName"
                  searchInputStyle={{ color: '#CCC' }}
                  submitButtonColor={PrimaryTheme.$primary_color}
                  submitButtonText="Submit" />
              </View>
              <View style={customStyle.gmVisCameras}>
                <View style={customStyle.openStkCameraCon}>
                  {(image.Image1Path == '' || image.Image1Path == null) &&
                    <TouchableOpacity style={[customStyle.osCat_action_openCam, customStyle.osCat_actn_margin]} onPress={() => { { openCamera() } }}>
                      <SvgXml width={80} height={80} xml={cameraImg} />
                    </TouchableOpacity>
                  }
                  {(image.Image1Path != '' && image.Image1Path != null) &&
                    <View style={customStyle.osCatImageView}>
                      <Image style={customStyle.osCatImage} source={{ uri: image.Image1Path }} />
                      <TouchableOpacity style={[customStyle.osCat_action_reCap]} onPress={() => { { openCamera() } }}>
                        <MaterialCommunityIcons name='camera-retake' size={20} color={PageTheme.$accent_color} />
                      </TouchableOpacity>
                    </View>
                  }
                </View>
              </View>

              <View style={[customStyle.gm_DiscPWrap]}>
                <Text style={customStyle.hr_prd_flexlabel}>Discussion Points</Text>
                <View style={[customStyle.gm_DiscProw]}>
                  <TextInput
                    style={[customStyle.gm_DiscPInputStyle]}
                    placeholder=""
                    placeholderTextColor={PageTheme.$placeholder_color}
                    value={dispoint}
                    onChangeText={(val) => { setdispoint(val) }}
                    // keyboardType='text'
                    multiline={true}
                    autoComplete='off' 
                    />

                  <TouchableOpacity style={[customStyle.gm_DiscPAddBtn]} onPress={() => { Add_DP() }}>
                    <Text style={customStyle.addVisBtnText}>Add</Text>
                  </TouchableOpacity>
                </View>
              </View>

              <View style={customStyle.gm_DisPList}>
                <Text style={customStyle.hr_prd_flexlabel}>Added Discussion Points</Text>
                <View style={customStyle.addVis_listInner}>
                  {DiscPoints?.length > 0 &&
                    DiscPoints?.map((item, index) => {
                      return (
                        <View style={[customStyle.gm_listI_row]} key={"id_" + index}>
                          <Text style={customStyle.gm_listI_Val}>{item}</Text>
                          <TouchableOpacity style={customStyle.gm_btnRemove} onPress={() => { showRemoveConfirm(item, index) }}>
                            <FontAwesome name='trash' size={20} color={'red'} />
                          </TouchableOpacity>
                        </View>
                      );
                    })
                  }
                </View>
              </View>

            </ScrollView>
          }
          <View style={[customStyle.opening_Stock_btnWrap]}>
            <GradientButton {...props} title={'Save And Upload'} onPress={() => { onSubmitData() }} />
          </View>
        </View>
      </LinearGradient>

    </Container>
  );
}






export default connect(mapStateToProps, mapDispatchToProps)(AddGateMeeting);