<script type="text/javascript">

	function getLetterdata(event,selected_booking,letter_type,letter_date,bank)
	{

		event.preventDefault();


		letter_type = $('.'+letter_type).val();
		letter_date = $('.'+letter_date).val();
		bank        = $('.'+bank).val();

        booking = $('.'+selected_booking).val();
        
		var route = "<?php echo e(route('letter.data')); ?>";

		showLoader();
		$.post(route,{letter_type:letter_type,booking:booking,date:letter_date,bank:bank,_token:token},function(data,status)
		{
			console.log(data);
    		$('.right_view').html(data.right_view);
			
    		$('.bottom_view').html(data.bottom_view);

    		removeLoader();
  		},'json')
  		  .fail(function(data) {

          messageToaster('error','Required form validation.','Failed');
          
          ajax_show_error(data,$('#form_pdf_letters'));

         
          removeLoader();
    
        });
	}

	function refreshLetterdata(event,selected_booking,letter_type,letter_date,bank)
	{
		if($('.selected_booking').val() != '')
		{
			getLetterdata(event,selected_booking,letter_type,letter_date,bank);
		}
		else
		{
			$('.right_view').html('');
			
    		$('.bottom_view').html('');
		}
		
	}

    function getProjectBookings(event,branch)
	{

		event.preventDefault();

        branch = $(branch).val();

		var route = '/branchbookings/'+branch;

		showLoader();
		$.get(route,function(data,status)
		{

    		$('.selected_booking').html(data);

    		removeLoader();
  		});
	}
	function resetLetterView(element,class_name)
	{
		var type = $(element).val();
	  class_name = "."+class_name;
	if(type == "Payment Reminder Letter" )
	{
		$('.selected_bank option').first().prop('selected',true);
		 $(class_name).show();

	}
	else
	{
		 $(class_name).hide();
	}
		

		$('.selected_booking option').first().prop('selected',true);
		$('.selected_branch option').first().prop('selected',true);
		$('.letter_date').val('');
		$('.right_view').html('');
		$('.bottom_view').html('');
	}

</script><?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/scripts/letters.blade.php ENDPATH**/ ?>