<section class="container collapse" id="tncInfo">
    <div class="jumbotron bg-white">
        <h6 class="text-danger">Accomodation</h6>
        <ul>
            <li>
                5.4.1 Purchases for business purposes must be prudently justified and supported
                by receipts. SALIHIN will not reimburse claims for purchases of gifts and
                personal items.
            </li>
            <li>
                5.4.2 Where accommodation is not provided by the Company, the staff
                may claim for one of the following:
            </li>
            <li>
                5.4.2.1 Accommodation with receipts : staff may claim
                hotel/lodging expenses based on receipts but subject to his
                entitlement.
            </li>
            <li>
                5.4.2.2 Accommodation without receipts : where receipts cannot
                be produced, a staff may claim according to his entitlement
                with prior approval from management
            </li>
            <li>
                5.4.3 Entitlement for claims for accommodation with receipts and
                without receipts as follows:
                <br/>
                <label><b>A. Within Peninsular Malaysia</b></label>
                <table class="table-bordered" width="100%">
                    <thead>
                        <tr>
                            <th>Category</th>
                            <th>With Receipts</th>
                            <th>Without Receipts</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Senior Manager / Manager</td>
                            <td>Actual bills up to a maximum of RM200 net per night</td>
                            <td>RM100 per night</td>
                        </tr>
                        <tr>
                            <td>Executive</td>
                            <td>Actual bills up to a maximum of RM150 net per night</td>
                            <td>RM70 per night</td>
                        </tr>
                    </tbody>
                </table>

                <br/>
                <label><b>B. Within East Malaysia</b></label>
                <table class="table-bordered" width="100%">
                    <thead>
                        <tr>
                            <th>Category</th>
                            <th>With Receipts</th>
                            <th>Without Receipts</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Senior Manager / Manager</td>
                            <td>Actual bills up to a maximum of RM250 net per night</td>
                            <td>RM125 per night</td>
                        </tr>
                        <tr>
                            <td>Executive</td>
                            <td>Actual bills up to a maximum of RM200 net per night</td>
                            <td>RM100 per night</td>
                        </tr>
                    </tbody>
                </table>
                
                <br>
                <label><b>Overseas</b></label>
                <table class="table-bordered" width="100%">
                    <tbody>
                        <tr>
                            <td>All Categories</td>
                            <td>Actual bills at hotels authorized by the Company</td>
                        </tr>
                    </tbody>
                </table>
            </li>
            <li>
                5.4.4 If SALIHIN has provided an appropriate accommodation, the staff
                is not entitled to claim for accommodation expenses either with or
                without receipt.
            </li>
            <li>
                5.4.5 When a guaranteed reservation has been made and there is a change
                in itinerary or schedule, it is the staff’s responsibility to cancel the
                reservation before the deadline imposed as some hotels charge for
                cancellation or no-show costs per the stipulated times. 
            </li>
        </ul>
        <small>Reference : <a href="http://salihin.noip.me/spserp/assets/uploads/hr/tnc/Travel_-_(Revision_2).pdf" target="_blank">Local and Business Travel (Revision no: 2) Effective date : 1st January 2018</a></small>
    </div>
</section>

<section class="container">
    <div class="card no-shadow">
        <div class="card-body">
            <div class="row">
                <div class="col">
                    <h2>Accomodation <small>(Submission <?php echo date('F-Y',strtotime('01-'.$month.'-'.$year));?>)</small> </h2>
                </div>
                <div class="col-2 text-right">
                    <button class="btn btn-sm btn-outline-dark" data-trigger="hover" data-tooltip="tooltip" title="" type="button" data-toggle="collapse" data-target="#tncInfo" data-original-title="Terms and Condition Reference">
                        <i class="fas fa-info"></i>
                    </button>
                </div>
            </div>
        </div>
    </div>
</section>
<?php $this->load->view('hr/claim/page/traveling/type'); ?>

<!-- local traveling -->
<section class="container d-none mb-3" id="option_local">
    <div class="card no-shadow">
        <div class="card-body">
            
            <div class="row">
                <div class="col">
                    <div class="row">
                        <div class="col-3">
                            <label><b>From<span class="text-danger">*</span></b></label>
                        </div>
                        <div class="col">
                            <input type="text" class="form-control claimdate" id="date_from_local" placeholder="Enter starting travel date (<?php echo date('d-M-Y'); ?>)" />
                        </div>
                    </div>
                </div>
                <div class="col">
                    <div class="row">
                        <div class="col-3">
                            <label><b>To<span class="text-danger">*</span></b></label>
                        </div>
                        <div class="col">
                            <input type="text" class="form-control claimdate" id="date_to_local" placeholder="Enter end travel date (<?php echo date('d-M-Y'); ?>)"/>
                        </div>
                    </div>
                </div>
                <div class="col">
                    <div class="row">
                        <div class="col-3">
                            <label><b>Location<span class="text-danger">*</span></b></label>
                        </div>
                        <div class="col">
                            <select class="form-control" id="location-local">
                                <option selected disabled>Please Select</option>
                                <?php foreach($accomodation_entitlements as $key => $value): ?>
                                    <option data-with_receipt="<?php echo $value->with_receipt; ?>" data-without_receipt="<?php echo $value->without_receipt; ?>" value="<?php echo $value->zone; ?>"><?php echo $value->zone; ?></option>
                                <?php endforeach; ?>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
                
            <br>
            <div class="row">
                <div class="col">
                    <div class="row">
                        <div class="col-lg-2">
                            <label><b>Amount<span class="text-danger">*</span></b></label>
                        </div>
                        <div class="col">
                            <input type="number" class="form-control currency_input" id="amount-local" placeholder="0.00">
                        </div>
                    </div>
                </div>
                <div class="col">
                    <div class="row">
                        <div class="col-lg-2">
                            <label><b>Receipt</b></label>
                        </div>
                        <div class="col">
                            <div class="input-group mb-3">
                                <input type="text" class="form-control" placeholder="Receipt" id="uploaded-receipt" readonly>
                                <div class="input-group-append">
                                    <!-- <span class="input-group-text"> -->
                                        <label class="btn btn-primary btn-sm h-100">
                                            <span class="animated infinite rotateIn delay-2s d-none" id="spinner"><i class="fas fa-spinner"></i> </span><span id="btn-upload">Upload Receipts</span>
                                            <input type="file" style="display:none;" id="upload-receipt" onchange="uploadReceipt()">
                                        </label>
                                    <!-- </span> -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col">

                    <label><b>Staff Movements</b></label>
                    <div class="row">
                        <div class="col text-right pr-4">
                            <!-- <button class="btn btn-sm btn-primary"><i class="fas fa-sync-alt"></i></button> -->
                        </div>
                    </div>

                    <table class="table table-bordered" id="table-local">
                        <thead>
                            <tr>
                                <th>Date</th>
                                <th>Movement Type</th>
                                <th>Client</th>
                                <th>Destination</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>

                </div>
            </div>
            
            <div class="row">
                <div class="col-12 mb-3">
                    <label><b>Description</b></label>
                    <textarea class="form-control" style="min-height:150px;" id="desc-local" placeholder="Description"></textarea>
                </div>
            </div>


            <!--     
            <div class="row">
                <div class="col">
                    <label><b>Attachments</b></label>
                    <div class="row">
                        <div class="col text-right pr-4">
                            <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mdl-attachment"><i class="fas fa-plus"></i></button>
                        </div>
                    </div>
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Description</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
            -->

            <div class="row">
                <div class="col text-right pr-4">
                    <button class="btn btn-success" onclick="saveLocalAccomodation()"><i class="fas fa-save"></i> Save</button>
                </div>
            </div>
        </div>
    </div>
</section>
<!-- !local traveling -->

<!-- international traveling -->
<section class="container d-none mb-3" id="option_international">
    <div class="card no-shadow">
        <div class="card-body">

            <div class="row">
                <div class="col-lg-2">
                    <label><b>From<span class="text-danger">*</span></b></label>
                </div>
                <div class="col">
                    <input type="text" class="form-control claimdate" id="date_from_international" placeholder="Enter starting travel date (<?php echo date('d-M-Y'); ?>)" />
                </div>
                <div class="col-lg-2">
                    <label><b>To<span class="text-danger">*</span></b></label>
                </div>
                <div class="col">
                    <input type="text" class="form-control claimdate" id="date_to_international" placeholder="Enter end travel date (<?php echo date('d-M-Y'); ?>)" />
                </div>
            </div>
            
            <br>
            <div class="row">
                <div class="col-lg-2">
                    <label><b>Amount<span class="text-danger">*</span></b></label>
                </div>
                <div class="col-lg-4">
                    <input type="number" class="form-control currency_input" id="amount-international" placeholder="0.00"/>
                </div>
                <div class="col-lg-2">
                    <label><b>Receipt<span class="text-danger">*</span></b></label>
                </div>
                <div class="col">
                    <div class="input-group mb-3">
                        <input type="text" class="form-control" placeholder="Receipt" id="uploaded-internationl-receipt" disabled>
                        <div class="input-group-append">
                            <label class="btn btn-primary btn-sm h-100">
                                <span class="animated infinite rotateIn delay-2s d-none" id="spinner-international"><i class="fas fa-spinner"></i> </span><span id="btn-upload-international">Upload Receipts</span>
                                <input type="file" style="display:none;" id="upload-international-receipt" onchange="uploadInternationalReceipt()">
                            </label>
                        </div>
                    </div>

                </div>
            </div>

            <div class="row">
                <div class="col">

                    <label><b>Staff Movements</b></label>
                    <div class="row">
                        <div class="col text-right pr-4">
                            <!-- <button class="btn btn-sm btn-primary"><i class="fas fa-sync-alt"></i></button> -->
                        </div>
                    </div>

                    <table class="table table-bordered" id="table-international">
                        <thead>
                            <tr>
                                <th>Date</th>
                                <th>Movement Type</th>
                                <th>Client</th>
                                <th>Destination</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>

                </div>
            </div>

             <div class="row">
                <div class="col-12 mb-3">
                    <label><b>Description</b></label>
                    <textarea class="form-control" style="min-height:150px;" id="desc-international" placeholder="Description"></textarea>
                </div>
            </div>

            <!-- <div class="row">
                <div class="col">
                    <label><b>Attachments</b></label>
                    <div class="row">
                        <div class="col text-right pr-4">
                            <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mdl-attachment"><i class="fas fa-plus"></i></button>
                        </div>
                    </div>
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Description</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div> -->

            <div class="row">
                <div class="col text-right mr-3">
                    <button class="btn btn-success" onclick="saveInternationalAccomodation()"><i class="fas fa-save"></i> Save</button>
                </div>
            </div>
            
        </div>
    </div>
</section>
<!-- !international traveling -->

<!-- attachements modal -->
<div class="modal fade" id="mdl-attachment" tabindex="-1" role="dialog" >
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Uploading Attachments</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <div class="row">
            <div class="col">
                <label><b>File</b></label>
                <input type="file" class="form-control">
            </div>
        </div>
        <div class="row">
            <div class="col">
                <label><b>Description</b></label>
                <textarea cols="30" rows="10" class="form-control"></textarea>
            </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
<!-- attachments modal -->

<script>
    var staff_movement                              = [];
    var staff_movement_international                = [];
    var receipts                                    = [];
    var receipts_international                      = [];

    var claim_year                                  = <?php echo $year; ?>; //2018
    var claim_month                                 = <?php echo $month; ?>; //8
    
    var date                                        = new Date();
    var full_start_date                             = date.setFullYear(claim_year,claim_month-1 , 1);
    var start_claim                                 = moment(full_start_date).subtract(2,'months').startOf('month').format('DD-MM-YYYY');

    var full_end_date                               = date.setFullYear(claim_year,claim_month,1);
    var end_claim                                   = moment(full_end_date).subtract(2,'months').endOf('month').format('DD-MM-YYYY');
    
    var amount_with_receipt                         = 0;
    var amount_without_receipt                      = 0;

    $(document).ready(function(){

        if(claim_year == 2020 && claim_month == 2)
        {
            console.log('submission bulan dua claim');
            start_claim = '01-01-2020';
            end_claim = '31-01-2020';
        }



        $( ".claimdate" ).datepicker(
            {
                uiLibrary: 'bootstrap4',
                format: 'dd-mm-yyyy',
                autoclose: true,
                changeMonth: true, 
                changeYear: true,
                startDate :start_claim,
                endDate:end_claim
            }
        );

        /**
            - local
         */
        $('#date_from_local').change(function()
            {
                let date_from   = $('#date_from_local').val();
                let date_to     = $('#date_to_local').val();

                let from_is_valid   = moment(date_from,'DD-MM-YYYY'); 
                let to_is_valid     = moment(date_to,'DD-MM-YYYY'); 


                if(from_is_valid.isValid() && to_is_valid.isValid())
                {
                    if(date_from && date_to)
                    {
                        fetchMovement(date_from,date_to);
                        accomodationCeilling();
                    }
                }else{
                    staff_movement = [];
                }
                
            }
        );

        $('#date_to_local').change(function()
            {
                let date_from   = $('#date_from_local').val();
                let date_to     = $('#date_to_local').val();

                let form_is_valid   = moment(date_from,'DD-MM-YYYY')
                let to_is_valid     = moment(date_to,'DD-MM-YYYY');


                if(form_is_valid.isValid() && to_is_valid.isValid())
                {
                    if(date_from && date_to)
                    {
                        fetchMovement(date_from,date_to);
                        accomodationCeilling();
                    }
                }else{
                    staff_movement = [];
                }
            }
        );

        $('#location-local').change(function(){
            accomodationCeilling();
        });


        
        /**
        - international 
         */
        $('#date_from_international').change(function()
            {
                let date_from   = $('#date_from_international').val();
                let date_to     = $('#date_to_international').val();

                let form_is_valid   = moment(date_from,'DD-MM-YYYY'); 
                let to_is_valid     = moment(date_to,'DD-MM-YYYY');

                if(form_is_valid.isValid() && to_is_valid.isValid())
                {
                    if(date_from && date_to)
                    {
                        fetchMovementInternational(date_from,date_to);
                    }
                }else{
                    staff_movement_international                = [];
                }
            }
        );

        $('#date_to_international').change(function()
            {
                let date_from   = $('#date_from_international').val();
                let date_to     = $('#date_to_international').val();

                let form_is_valid   = moment(date_from,'DD-MM-YYYY');
                let to_is_valid     = moment(date_to,'DD-MM-YYYY');

                if(form_is_valid.isValid() && to_is_valid.isValid())
                {
                    if(date_from && date_to)
                    {
                        fetchMovementInternational(date_from,date_to);
                    }
                }else{
                    staff_movement_international                = [];
                }                   
            }
        );

    });


    /**
        - local
     */
    function fetchMovement(date_from,date_to)
    {
        if(date_from && date_to)
        {
            let url = '<?php echo base_url('hr/api_movement/getUserMovementBetweenDate/'); ?>';
            let data = 
            {
                token:'<?php echo $token; ?>',
                date_from:date_from,
                date_to:date_to,
                user_id:<?php echo $user_id; ?>,
            }

            $.ajax({
                url: url,
                type: 'POST',
                data:data,
                dataType: 'JSON',
                success: function(data)
                {
                    staff_movement = data.results;
                    createTable();
                },error:function(err)
                {
                }
            });

        }
    }

    function createTable()
    {
        var table   = $('#table-local').DataTable();
        table.clear().draw();

        $.each(staff_movement,function(index,value){
            table.row.add({
                0:moment(value.movement_date).format('DD/MM/YYYY'),
                1:value.movement_type,
                2:value.client,
                3:value.destination,
                4:'<button class="btn btn-danger btn-sm" onclick="removeStaffMovement('+index+')" ><i class="fas fa-trash-alt"></i></button>',
            }).draw();
        });
    }

    function removeStaffMovement(index)
    {
        staff_movement.splice(index,1);
        createTable();
    }

    function accomodationCeilling()
    {
        let date_from           = $('#date_from_local').val();
        let date_to             = $('#date_to_local').val();
        let with_receipt        = $('#location-local option:selected').data('with_receipt');
        let without_receipt     = $('#location-local option:selected').data('without_receipt');
        
        if(date_from && date_to && with_receipt && without_receipt)
        {
            var start                   = moment(date_from, "DD-MM-YYYY");
            var end                     = moment(date_to, "DD-MM-YYYY");
            var days                    = staff_movement.length;

            // var days                    = moment.duration(end.diff(start)).asDays()+1;

            amount_with_receipt         = days * with_receipt;
            amount_without_receipt      = days * without_receipt;
        }

        if(receipts.file_size > 0)
        {
            return amount_with_receipt;
        }else
        {
            return amount_without_receipt;
        }
    }

    function uploadReceipt()
    {
        $('#spinner').removeClass('d-none');
        $('#btn-upload').text(' Uploading..');

        formData = new FormData();
        formData.append('files',$('#upload-receipt').prop('files')[0]);

        $.ajax({
            url: '<?php echo base_url('hr/claim/addAttachment/71/'); ?>',
            type: "POST",             
            data: formData, 
            contentType:false,       
            cache: false,             
            processData:false,
            dataType: 'JSON',
            success: function(data){
                $('#spinner').addClass('d-none');
                $('#btn-upload').text('Upload Receipt');
                if(data.orig_name)
                {
                    iziToast.success({
                        position: 'bottomRight',
                        title: 'Success',
                        message: 'Successfully upload new receipt'
                    });

                    receipts = data;
                    accomodationCeilling();
                    $('#uploaded-receipt').val(data.orig_name);
                }else{
                    iziToast.error({
                        position: 'bottomRight',
                        title: 'Failed',
                        message: 'Failed to upload receipt',
                    });
                }
            }
        }); 


    }




    /**
        - international 
     */
    function fetchMovementInternational(date_from,date_to)
    {
        if(date_from && date_to)
        {
            let url = '<?php echo base_url('hr/api_movement/getUserMovementBetweenDate/'); ?>';
            let data = 
            {
                token:'<?php echo $token; ?>',
                date_from:date_from,
                date_to:date_to,
                user_id:<?php echo $user_id; ?>,
            }

            $.ajax({
                url: url,
                type: 'POST',
                data:data,
                dataType: 'JSON',
                success: function(data)
                {
                    staff_movement_international = data.results;
                    createTableInternational();
                },error:function(err)
                {
                }
            });

        }
    }

    function createTableInternational()
    {
        var table   = $('#table-international').DataTable();
        table.clear().draw();

        $.each(staff_movement_international,function(index,value){
            table.row.add({
                0:moment(value.movement_date).format('DD/MM/YYYY'),
                1:value.movement_type,
                2:value.client,
                3:value.destination,
                4:'<button class="btn btn-danger btn-sm" onclick="removeStaffMovementInternational('+index+')" ><i class="fas fa-trash-alt"></i></button>',
            }).draw();
        });
    }

    function removeStaffMovementInternational(index)
    {
        staff_movement_international.splice(index,1);
        createTableInternational();
    }

    function uploadInternationalReceipt()
    {
        $('#spinner-international').removeClass('d-none');
        $('#btn-upload-international').text(' Uploading..');

        formData = new FormData();
        formData.append('files',$('#upload-international-receipt').prop('files')[0]);

        $.ajax({
            url: '<?php echo base_url('hr/claim/addAttachment/712/'); ?>',
            type: "POST",             
            data: formData, 
            contentType:false,       
            cache: false,             
            processData:false,
            dataType: 'JSON',
            success: function(data){
                $('#spinner-international').addClass('d-none');
                $('#btn-upload-international').text('Upload Receipt');
                if(data.orig_name)
                {
                    $('#uploaded-internationl-receipt').val(data.orig_name);
                    iziToast.success({
                        position: 'bottomRight',
                        title: 'Success',
                        message: 'Successfully upload new receipt'
                    });
                    receipts_international = data;
                }else{
                    iziToast.error({
                        position: 'bottomRight',
                        title: 'Failed',
                        message: 'Failed to upload receipt',
                    });
                }
            }
        }); 


    }



    /**
        - local save process
     */
    function saveLocalAccomodation()
    {
        if(is_validAmount() && is_inputFilled() && is_staffMovement())
        {
            let url = '<?php echo base_url('/hr/api/claim/createAccomodation/'); ?>';
            let data = 
            {
                token:'<?php echo $token; ?>',
                from:$('#date_from_local').val(),
                to:$('#date_to_local').val(),
                location:$('#location-local').val(),
                amount:$('#amount-local').val(),
                description: $('#desc-local').val(),
                receipt:receipts,
                type:0,
                staff_movement:staff_movement,
                claim_id:<?php echo $claim_id; ?>
            }
            // console.log(data);
            // return false;
            let redirect = '<?php echo base_url('/hr/claim/myClaimDetail/'.$year.'/'.$month.'/'.$user_id.'/'.$claim_id); ?>';
            ajxRequest(url, 'POST', data, redirect);
        }   
    }

    function is_validAmount()
    {
        let amount          = $('#amount-local').val();
        let ceiling_amount  = accomodationCeilling();
        
        if(amount > ceiling_amount)
        {
            iziToast.error({
                position: 'bottomRight',
                title: 'Failed',
                message: 'Amount need to be less than : RM'+ceiling_amount,
            });
            return false;
        }else{
            return true;
        }
    }

    function is_inputFilled()
    {
        let from            = $('#date_from_local').val(); 
        let to              = $('#date_to_local').val();
        let location        = $('#location-local').val();
        let amount          = $('#amount-local').val();

        if(from && to && location && amount)
        {
            return true;
        }else
        {
            iziToast.error({
                position: 'bottomRight',
                title: 'Failed',
                message: 'From, To, Location and Amount are required',
            });
            return false;
        }
    }

    function is_staffMovement()
    {
        if(staff_movement.length > 0)
        {
            return true;
        }else
        {
            iziToast.error({
                position: 'bottomRight',
                title: 'Failed',
                message: 'Unable to find any movememt',
            });
            return false;
        }
    }


    /**
        - international save process
     */
    function saveInternationalAccomodation()
    {
        if(is_inputInternationalFilled() && is_staffMovementInternational() && is_receiptsInternational())
        {
            let url = '<?php echo base_url('/hr/api/claim/createAccomodation/'); ?>';
            let data = 
            {
                token:'<?php echo $token; ?>',
                from:$('#date_from_international').val(),
                to:$('#date_to_international').val(),
                location:null,
                amount:$('#amount-international').val(),
                description: $('#desc-international').val(),
                receipt:receipts_international,
                type:1,
                staff_movement:staff_movement_international,
                claim_id:<?php echo $claim_id; ?>
            }
            let redirect = '<?php echo base_url('/hr/claim/myClaimDetail/'.$year.'/'.$month.'/'.$user_id.'/'.$claim_id); ?>';
            ajxRequest(url, 'POST', data, redirect);
        }
    }

    function is_inputInternationalFilled()
    {
        let from                    = $('#date_from_international').val();
        let to                      = $('#date_to_international').val();
        let amount                  = $('#amount-international').val();
        let receipts_uploaded       = is_receiptsInternational();
        let staffmovement_uploads   = is_staffMovementInternational();


        if(from && to && amount && receipts_uploaded)
        {
            if(staffmovement_uploads)
            {
                console.log('save content');
            }
            return true;
        }else{
            iziToast.error({
                position: 'bottomRight',
                title: 'Failed',
                message: 'From,To,Amount and Receipts are required',
            });
            return false;
        }
    }

    function is_staffMovementInternational()
    {
         if(staff_movement_international.length <= 0)
         {
            iziToast.error({
                position: 'bottomRight',
                title: 'Failed',
                message: 'Unable to find any movement',
            });
            return false;
         }else
         {
            console.log('staff movement international');
            return true;
         }
    }

    function is_receiptsInternational()
    {
         if(receipts_international.length <= 0)
         {
            iziToast.error({
                position: 'bottomRight',
                title: 'Failed',
                message: 'Receipts is required',
            });
            return false;
         }else{
            return true;
         }
    }
</script>