$(document).ready(function() {

  $("#quotationmail").css("width","900px");

  $('.quotation_mailbtn').on('click',function(){

    var id=$(this).data('id');
     
    var productrows="";
    var subttl=0;
    var gstttl=0;
    var grndttl=0;
    var i_show=0;
    var cs_show=0;
    
 
    $.ajaxSetup({
  
      headers: {

      'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

      }

    });  
    $.ajax({

      url:url_getquotationdetail,

      method:"POST",

      data:
      {id:id},
      success:function(data){
        
            
        var countofproduct=(data.product).length;
        
        var count=1;

        for (var i = 0; i <countofproduct; i++) {
                 
            if(data.product[i]['i_gst']=='null')
            {
              cs_show=1;
              total=(data.product[i]['unit_cost']*data.product[i]['quantity']);
              gst=((((data.product[i]['unit_cost']/100)*(((data.product[i]['c_s_gst']).replace(/[\*\^\'\!\%\+]/g, '').split(' ')[0]))*2)*data.product[i]['quantity']));
              subttl=subttl+total;
              gstttl=gstttl+gst;

              
              productrows += '<tr id=products-'+count+'>'+
                '<td align="left" width="5%" style="font-family:  Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+count+'</td>'+
                '<td id="vrajesh-testing" align="left" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px; max-width: 60ch !important;word-break: break-word !important;hyphens: auto !important; ">'+data.product[i]['name']+'</td>'+
                '<td align="left" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['HSN']+'</td>'+
                '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['unit_cost']+'</td>'+
                '<td align="left" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['quantity']+'</td>'+
                '<td align="left" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['c_s_gst']+'</td>'+
                '<td align="left" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">₹'+((gst).toFixed(0))+'</td>'+
                '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">₹'+total+'</td>'+
              '</tr>'
               
            }
            else if(data.product[i]['c_s_gst']=='null')
            {
              i_show=1;
              total=(data.product[i]['unit_cost']*data.product[i]['quantity']);
              gst=(((data.product[i]['unit_cost']/100)*(data.product[i]['i_gst'].replace(/[\*\^\'\!\%\+\.]/g, '')))*data.product[i]['quantity']);
              subttl=subttl+total;
              gstttl=gstttl+gst;

              productrows += '<tr id=products-'+count+'>'+
                '<td align="left" width="5%" style="font-family:  Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+count+'</td>'+
                '<td id="vrajesh-testing" align="left" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px; max-width: 60ch !important;word-break: break-word !important; hyphens: auto !important;">'+data.product[i]['name']+'</td>'+
                '<td align="left" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['HSN']+'</td>'+
                '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['unit_cost']+'</td>'+
                '<td align="left" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['quantity']+'</td>'+
                '<td align="left" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">'+data.product[i]['i_gst']+'</td>'+
                '<td align="left" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">₹'+((gst).toFixed(0))+'</td>'+
                '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 18px; line-height: 28px;">₹'+total+'</td>'+
              '</tr>'

            }
          count++;
          
        }
        
        $(document).find('#quotation_ida').val(data.data['quotation_no']);

          grndttl=subttl+gstttl;

        if(i_show==1)
        {
          $("#quotation-details").append(
            
            '<table  style="max-width:810px;margin:20px;background-color:#fff;padding:50px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);-moz-box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); border-top: solid 10px green;">'+
              '<thead>'+
                '<tr>'+
                  '<th style="text-align:left;"><img style="max-width: 150px;" src="'+ttb_logo+'" alt="bachana tours"></th>'+
                  '<th style=" padding:0 0 0 20px; font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 20px; line-height: 24px; "><storng>TANNA TECH BIZ</storng>'+
                      '<p style="margin:0px 0 0 30px;padding:0;font-size:13px; text-align: justify;">Vraj-Bhoomi, 22 New Jagnath Plot,</p>'+
                      '<p style="margin:0px 0 0 30px;padding:0;font-size:13px; text-align: justify;">Rajkot, Gujarat, 360 001</p>'+
                      '<p style="margin:0px 0 0 30px;padding:0;font-size:14px; text-align: justify;">+919974300810</p>'+
                      '<p style="margin:0px 0 0 30px;padding:0;font-size:14px; text-align: justify;">info@tannatechbiz.com</p>'+
                  '</th>'+
                '</tr>'+
              '</thead>'+
              '<tbody id="mailquotation">'+
                '<tr>'+
                  '<td style="height:35px;"></td>'+
                '</tr>'+
                '<tr>'+
                  '<td style="border:solid #ddd;border-width: 1px 0px 0px 1px; width:50%;padding:10px;vertical-align:top">'+
                    '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px">Invoice To:</span>'+data.company['name']+'</p>'+
                    '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">GST NO:</span>'+data.company['gstin']+'</p>'+
                  '</td>'+
                  '<td style="border:solid #ddd;border-width: 1px 1px 0px 0px; width:50%;padding:10px;vertical-align:top">'+
                    '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Quotation No:</span> '+data.data['quotation_no']+'</p>'+
                    '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Date of Invoice</span> '+data.data['issue_date']+'</p>'+
                  '</td>'+
                '</tr>'+
                '<tr>'+
                  '<td style="border:solid #ddd;border-width: 0px 0px 1px 1px; width:50%;padding:10px;vertical-align:top">'+
                      '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px; max-width: 40ch !important; word-break: break-word !important; ">Billing Address</span>'+data.billing['address_line1']+','+data.billing['address_line2']+','+data.billing['address_line3']+',</br>'+data.billing['name']+','+data.billing['state_title']+','+data.billing['country']+',</br>Pincode:-'+data.billing['pincode']+'</p>'+
                      '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Email Id</span> abc@gmail.com</p>'+
                      '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Phone Number</span> '+data.billing['mobile']+'</p>'+
                    '</td>'+
                    '<td style="border:solid #ddd;border-width: 0px 1px 1px 0px; width:50%;padding:10px;vertical-align:top">'+
                      '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px; max-width: 40ch !important; word-break: break-word !important;">Shipping Address</span>'+data.shipping['address_line1']+','+data.shipping['address_line2']+','+data.shipping['address_line3']+',</br>'+data.shipping['name']+','+data.shipping['state_title']+','+data.shipping['country']+',</br>Pincode:-'+data.shipping['pincode']+'</p>'+
                      '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Email Id</span> abc@gmail.com</p>'+
                      '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Phone Number</span> '+data.shipping['mobile']+'</p>'+
                    '</td>'+
                  '</tr>'+
                  
                  '<tr>'+
                    '<td colspan="2" style="font-size:20px;padding:30px 15px 0 0;">Products</td>'+
                  '</tr>'+
            
                  '<tr>'+
                      '<td colspan="2" align="left" bgcolor="#ffffff" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;">'+
                        '<table border="0" cellpadding="0" cellspacing="0" width="100%">'+
                          '<tr>'+
                            '<td align="left" bgcolor="#D2C7BA" width="5%"  style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>NO</strong></td>'+
                            '<td align="left" bgcolor="#D2C7BA" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; "><strong>Product Name</strong></td>'+
                            '<td align="left" bgcolor="#D2C7BA" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>HSN</strong></td>'+
                            '<td align="left" bgcolor="#D2C7BA" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>Unit Cost</strong></td>'+
                            '<td align="left" bgcolor="#D2C7BA" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>Quantity</strong></td>'+
                            '<td align="left" bgcolor="#D2C7BA" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>IGST</strong></td>'+
                            '<td align="left" bgcolor="#D2C7BA" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>GST Amount</strong></td>'+
                            '<td align="left" bgcolor="#D2C7BA" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>Total</strong></td>'+
                          '</tr>'+
            
                          productrows+
          
                          '<tr>'+
                            '<td colspan="6"></td>'+
                            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>Sub Total</strong></td>'+
                            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>₹'+((subttl).toFixed(0))+'</strong></td>'+
                          '</tr>'+
                          '<tr>'+
                            '<td colspan="6"></td>'+
                            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>GST Total</strong></td>'+
                            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>₹'+((gstttl).toFixed(0))+'</strong></td>'+
                          '</tr>'+
                          '<tr>'+
                            '<td colspan="6"></td>'+
                            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>Total</strong></td>'+
                            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>₹'+((grndttl).toFixed(0))+'</strong></td>'+
                          '</tr>'+
                        '</table>'+
                      '</td>'+
                  '</tr>'+
              '</tbody>'+
              '<tfooter>'+
                '<tr>'+
                    '<td colspan="2" style="font-size:16px;padding:50px 15px 0 15px;">'+
                        '<strong style="display:block;margin:0 0 10px 0;">Note:</strong>'+
                        '<p>'+data.company['note']+'</p>'+
                      '</td>'+
                    '</tr>'+
              '</tfooter>'+
            '</table>'
             
          );
          
           
        }
        else if(cs_show==1)
        {
          $("#quotation-details").append(
            
            '<table  style="max-width:810px;margin:20px;background-color:#fff;padding:50px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);-moz-box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24); border-top: solid 10px green;">'+
            '<thead>'+
            '<tr>'+
            '<th style="text-align:left;"><img style="max-width: 150px;" src="'+ttb_logo+'" alt="bachana tours"></th>'+
            '<th style=" padding:0 0 0 20px; font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 20px; line-height: 24px; "><storng>TANNA TECH BIZ</storng>'+
            '<p style="margin:0px 0 0 30px;padding:0;font-size:13px; text-align: justify;">Vraj-Bhoomi, 22 New Jagnath Plot,</p>'+
            '<p style="margin:0px 0 0 30px;padding:0;font-size:13px; text-align: justify;">Rajkot, Gujarat, 360 001</p>'+
            '<p style="margin:0px 0 0 30px;padding:0;font-size:14px; text-align: justify;">+919974300810</p>'+
            '<p style="margin:0px 0 0 30px;padding:0;font-size:14px; text-align: justify;">info@tannatechbiz.com</p>'+
            '</th>'+
            '</tr>'+
            '</thead>'+
            '<tbody id="mailquotation">'+
            '<tr>'+
            '<td style="height:35px;"></td>'+
            '</tr>'+
            '<tr>'+
            '<td style="border:solid #ddd;border-width: 1px 0px 0px 1px; width:50%;padding:10px;vertical-align:top">'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px">Invoice To:</span>'+data.company['name']+'</p>'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">GST NO:</span>'+data.company['gstin']+'</p>'+
            '</td>'+
            '<td style="border:solid #ddd;border-width: 1px 1px 0px 0px; width:50%;padding:10px;vertical-align:top">'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Quotation No:</span> '+data.data['quotation_no']+'</p>'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Date of Invoice</span> '+data.data['issue_date']+'</p>'+
            '</td>'+
            '</tr>'+
            '<tr>'+
            '<td style="border:solid #ddd;border-width: 0px 0px 1px 1px; width:50%;padding:10px;vertical-align:top">'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;max-width: 40ch !important; word-break: break-word !important;">Billing Address</span>'+data.billing['address_line1']+','+data.billing['address_line2']+','+data.billing['address_line3']+',</br>'+data.billing['name']+','+data.billing['state_title']+','+data.billing['country']+',</br>Pincode:-'+data.billing['pincode']+'</p>'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Email Id</span> abc@gmail.com</p>'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Phone Number</span> '+data.billing['mobile']+'</p>'+
            '</td>'+
            '<td style="border:solid #ddd;border-width: 0px 1px 1px 0px; width:50%;padding:10px;vertical-align:top">'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;max-width: 40ch !important; word-break: break-word !important;">Shipping Address</span>'+data.shipping['address_line1']+','+data.shipping['address_line2']+','+data.shipping['address_line3']+',</br>'+data.shipping['name']+','+data.shipping['state_title']+','+data.shipping['country']+',</br>Pincode:-'+data.shipping['pincode']+'</p>'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Email Id</span> abc@gmail.com</p>'+
            '<p style="margin:0 0 10px 0;padding:0;font-size:15px;"><span style="display:block;font-weight:bold;font-size:15px;">Phone Number</span> '+data.shipping['mobile']+'</p>'+
            '</td>'+
            '</tr>'+
            
            '<tr>'+
            '<td colspan="2" style="font-size:20px;padding:30px 15px 0 0;">Products</td>'+
            '</tr>'+
            
            '<tr>'+
            '<td colspan="2" align="left" bgcolor="#ffffff" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;">'+
            '<table border="0" cellpadding="0" cellspacing="0" width="100%">'+
            '<tr>'+
            '<td align="left" bgcolor="#D2C7BA" width="5%"  style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>NO</strong></td>'+
            '<td align="left" bgcolor="#D2C7BA" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>Product Name</strong></td>'+
            '<td align="left" bgcolor="#D2C7BA" width="20%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>HSN</strong></td>'+
            '<td align="left" bgcolor="#D2C7BA" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>Unit Cost</strong></td>'+
            '<td align="left" bgcolor="#D2C7BA" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>Quantity</strong></td>'+
            '<td align="left" bgcolor="#D2C7BA" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>C_S_GST</strong></td>'+
            '<td align="left" bgcolor="#D2C7BA" width="15%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>GST Amount</strong></td>'+
            '<td align="left" bgcolor="#D2C7BA" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;"><strong>Total</strong></td>'+
            '</tr>'+
            
            productrows+
          
            '<tr>'+
            '<td colspan="6"></td>'+
            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>Sub Total</strong></td>'+
            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>₹'+((subttl).toFixed(0))+'</strong></td>'+
            '</tr>'+
            '<tr>'+
            '<td colspan="6"></td>'+
            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>GST Total</strong></td>'+
            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>₹'+((gstttl).toFixed(0))+'</strong></td>'+
            '</tr>'+
            '<tr>'+
            '<td colspan="6"></td>'+
            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>Total</strong></td>'+
            '<td align="left" width="10%" style="font-family: Source Sans Pro, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px; border-top: 2px dashed #D2C7BA; border-bottom: 2px dashed #D2C7BA;"><strong>₹'+((grndttl).toFixed(0))+'</strong></td>'+
            '</tr>'+
            '</table>'+
            '</td>'+
            '</tr>'+
            '</tbody>'+
            '<tfooter>'+
            '<tr>'+
            '<td colspan="2" style="font-size:16px;padding:50px 15px 0 15px;">'+
            '<strong style="display:block;margin:0 0 10px 0;">Note:</strong>'+
            '<p>'+data.company['note']+'</p>'+
            '</td>'+
            '</tr>'+
            '</tfooter>'+
            '</table>'
            
          );
          
          
        }          
      }
      
    })
    $("#quotation_mail").modal('show');
  });
 
  
$('#submitbtn').on('click',function(e){
  
  e.preventDefault(e);
      var receiverID=$('#email').val();
      var mailsubject=$('#subject').val();
      var quotation_ida=$('#quotation_ida').val();
      var mailbody=CKEDITOR.instances['compose-textarea'].getData();
      var mailquotation=$('#quotation-details').html();
      
      $.ajaxSetup({
  
        headers: {
  
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  
        }
  
      });  
      $.ajax({
   
        url:url_postemail,
  
        method:"POST",
  
        data:
        {
          receiverID:receiverID,
          mailsubject:mailsubject,
          mailbody:mailbody,
          quotation_ida:quotation_ida,
          mailquotation:mailquotation
        },
        success:function(data){

            
            
              if(data=='HTML Email Sent. Check your inbox.')
              {
                $("#quotation_mail").modal('hide');
                var success="";

                success=success+
              
                '<p style="text-align:center;"><b>Mail sent Successfully !!!</b></p>';
              
                $('#quotation_success').append(success);
                $('#quotation_success').removeClass("hide");
              
                setTimeout(function(){
                 location.reload();
                }, 200);
              }

              $("#quotation-details").empty();
              
            
          
        }
        
      })
      
});


$('#close_mail').on('click',function(){

    $("#quotation-details").empty();

});

});