<?php $this->view("includes/Inc_pagehead");?>
<!-- Page Styles Goes Here-->
<style>
.item_table td{
  padding: .75rem !important;
}
.item_table th{
  white-space: nowrap;
  padding: .75rem !important;
}
.table thead th {
  border-top: 2px solid #f4f5f8 !important;
}
.payment-table tbody td{
  border-top: 2px solid #f4f5f8 !important;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__head .m-invoice__container.m-invoice__container--centered {
  width: 90%;
}
.m-invoice-2 .m-invoice__wrapper .m-invoice__body.m-invoice__body--centered {
  width: 90%;
}
@media print
{
  #print, .print_hide_div
  {
    display: none !important;
  }
}
@media print {
  html, body, div, span, applet, object, iframe, td, tr, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
    font-size: 15pt !important;  }
    h1.entry-title {
      font-size: 15pt !important;
    }
  }
  @media print { tr.bg_S { background-color: rgb(224, 224, 224) !important; -webkit-print-color-adjust: exact; } } @media print { .bg_S th { background-color: rgb(224, 224, 224) !important; } }
  @media print { tr.bg_H { background-color: rgb(224, 224, 224) !important; -webkit-print-color-adjust: exact; } } @media print { .bg_H th { background-color: rgb(224, 224, 224) !important; } }
  @media print { tr.bg_L { background-color: #7f7f7f !important; -webkit-print-color-adjust: exact; } } @media print { .bg_L th { background-color: #7f7f7f !important; } }
  @media print { tr.bg_N { background-color: rgba(94, 94, 94, 0.52) !important; -webkit-print-color-adjust: exact; } } @media print { .bg_N th { background-color: rgba(94, 94, 94, 0.52) !important; } }

  .quotation { font-family:calibri; font-size:15px; text-align:left; font-style:normal; height:60px; text-align:justify; line-height:26px;}
  @font-face {
    font-family: calibri;
    src: url(calibri.ttf);
  }
  form div {
    font-family: calibri;
  }
  #outer{
    width:100%;
    height:100%;
    float:left;
    background-image:url(<?php echo base_url()."uploads/quotation_workorder/".$quotation_data->quotation_header ?>);
    background-repeat:no-repeat;
    background-repeat: no-repeat;
  background-size: 100% 1400px;
  /* -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover; */
  }
</style>
<?php $this->view("includes/Inc_navigation");?>
<div class="m-grid__item m-grid__item--fluid m-wrapper">
  <!-- BEGIN: Subheader -->
  <div class="m-subheader ">
    <div class="d-flex align-items-center">
      <div class="mr-auto">
        <h3 class="m-subheader__title m-subheader__title--separator">
          <?php echo $this->config->item('Quotation_sales_quotation_title') ?>
        </h3>
        <ul class="m-subheader__breadcrumbs m-nav m-nav--inline">
          <li class="m-nav__item m-nav__item--home">
            <a href="#" class="m-nav__link m-nav__link--icon">
              <i class="m-nav__link-icon la la-home"></i>
            </a>
          </li>
          <li class="m-nav__separator">
            -
          </li>
          <li class="m-nav__item">
            <a href="<?php echo base_url().'dashboard'?>" class="m-nav__link">
              <span class="m-nav__link-text">
                Home
              </span>
            </a>
          </li>
          <li class="m-nav__separator">
            -
          </li>
          <li class="m-nav__item">
            <a href="<?php echo base_url().'sales_quotation' ?>" class="m-nav__link">
              <span class="m-nav__link-text">
                <?php echo $this->config->item('Quotation_sales_quotation_title') ?>
              </span>
            </a>
          </li>
        </ul>
      </div>
      <div>
      </div>
    </div>
  </div>
  <!-- END: Subheader -->
  <div class="m-content">
    <div class="m-portlet m-portlet--full-height">
      <div class="m-portlet__head">
        <div class="m-portlet__head-caption">
          <div class="m-portlet__head-title">
            <h3 class="m-portlet__head-text"><?php echo $this->config->item('Quotation_sales_quotation_title') ?> -  <a href="javascript:;"><?php echo "#".$quotation_data->quotation_prefix."-".$quotation_data->quotation_no ?></a></h3>
          </div>
        </div>
        <div class="m-portlet__head-tools" >
          <?php if($quotation_data->approval_status==1){?>
            <a style="margin-left: 5px;margin-right: 5px" href="<?php echo base_url()?>work_order/add?quotation_id=<?php echo $quotation_data->quotation_id ?>" class="btn m-btn--gradient-from-success m-btn--gradient-to-focus  m-btn  m-btn--icon m-btn--air m-btn--pill">
              <span>
                <i class="la la-plus-circle"></i>
                <span>
                  Add Work Order
                </span>
              </span>
            </a>
          <?php } ?>
          <a style="margin-left: 5px;margin-right: 5px" id="btn_print_sales_quotation" class="btn m-btn--gradient-from-warning m-btn--gradient-to-danger  m-btn  m-btn--icon m-btn--air m-btn--pill">
            <span>
              <i class="la la-print"></i>
              <span>
                Print <?php echo $this->config->item('Quotation_sales_quotation_title') ?>
              </span>
            </span>
          </a>
        </div>
      </div>

      <div class="m-portlet__body m-portlet__body--no-padding">
        <form autocomplete="off" id="form_sales_quotation_add" data-form-type="invoice_create" method="post" action="<?php echo base_url()?>invoices/update" enctype="multipart/form-data" class="m-form m-form--fit m-form--state m-form--label-align-right " >
          <div class="row">
            <div class="col-lg-2"></div>
            <div class="col-lg-8" style="margin-top: 20px;font-size:20px !important">
              <?php if($quotation_data->approval_status==1){?>
                <div class="m-alert m-alert--icon m-alert--icon-solid m-alert--outline alert alert-success fade show" role="alert">
                  <div class="m-alert__icon">
                    <i class="fa fa-check-circle"></i>
                    <span></span>
                  </div>
                  <div class="m-alert__text">
                    <strong>Quotation Approved!</strong> <br/><?php echo $quotation_data->approval_remarks ?>
                  </div>
                </div>
              <?php }elseif($quotation_data->approval_status==2){?>
                <div class="m-alert m-alert--icon m-alert--icon-solid m-alert--outline alert alert-danger fade show" role="alert">
                  <div class="m-alert__icon">
                    <i class="fa fa-times-circle"></i>
                    <span></span>
                  </div>
                  <div class="m-alert__text">
                    <strong>Quotation Rejected!</strong> <br/><?php echo $quotation_data->approval_remarks ?>
                  </div>
                </div>
              <?php }else{ ?>
                <div class="m-alert m-alert--icon m-alert--icon-solid m-alert--outline alert alert-warning fade show" role="alert">
                  <div class="m-alert__icon">
                    <i class="flaticon-exclamation-1"></i>
                    <span></span>
                  </div>
                  <div class="m-alert__text">
                    <strong>Quotation Approval Pending!</strong>
                  </div>
                </div>
              <?php } ?>
            </div>
          </div>

          <div id="outer">
            <div style="margin-top:1080px; margin-left:90px; font-family:Arial, Helvetica, sans-serif !important; font-size:30px !important; font-weight:bold !important;"><h2 style="font-family:Arial, Helvetica, sans-serif !important; font-size:1.5em !important; font-weight:bold !important;color: #565656 !important;">WATERPROOFING</h2></div>
            <table width="100%;" border="0" cellspacing="0" cellpadding="0" style="margin-top:25px;margin-left:140px;font-family:Arial, Helvetica, sans-serif !important; font-size:22px !important;">
              <tr>
                <td height="18">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td width="25%" height="27">CUSTOMER NAME</td>
                <td width="23%">QUOTATION NO</td>
                <td width="20%">DATE</td>
                <td width="32%">EXP. DATE</td>
              </tr>
              <tr>
                <td height="27"><strong><?php echo $quotation_data->customer_name ?></strong></td>
                <td><strong><?php echo "#".$quotation_data->quotation_prefix."-".$quotation_data->quotation_no ?></strong></td>
                <td><strong><?php echo date('d-m-Y',strtotime($quotation_data->date)) ?></strong></td>
                <td><strong><?php echo date('d-m-Y',strtotime($quotation_data->expiry_date)) ?></strong></td>
              </tr>
              <tr>
                <td height="30" style="padding-top:20px">ADDRESS</td>
                <td style="padding-top:20px">STATE</td>
                <td style="padding-top:20px">PREPARED BY</td>
                <td style="padding-top:20px">&nbsp;</td>
              </tr>
              <tr>
                <td><strong><?php echo nl2br($quotation_data->customer_address);if($quotation_data->customer_phone!=''){ echo "<br/>Phone: ".$quotation_data->customer_phone;} ?></strong></td>
                  <td><strong><?php echo $quotation_data->state ?></strong></td>
                  <td><strong><?php if(is_numeric($quotation_data->prepared_by)){
                    echo ($quotation_data->prepared_by_name);
                  }else{
                    echo nl2br($quotation_data->prepared_by);
                  }
                  ?></strong></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table>
            </div>
            <table width="100%" border="0">
              <tr>
                <td colspan="4"><img style="width:100%" src="<?php echo base_url()."uploads/quotation_workorder/".$quotation_data->quotation_footer ?>" width="100%" /></td>
              </tr>
              <tr>
                <td colspan="4">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="4">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="4">&nbsp;</td>
              </tr>
            </table>
            <div class="page" >
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td style="background-color:#ececec;height:1550px"><img style="width:100%;" src="<?php echo base_url()."uploads/quotation_workorder/quotation_page_2.jpg" ?>" /></td>
                </tr>
              </table>
            </div>
            <table width="100%" border="0">
              <tr>
                <td colspan="4"><img style="width:100%" src="<?php echo base_url()."uploads/quotation_workorder/".$quotation_data->quotation_footer ?>" width="100%" /></td>
              </tr>
              <tr>
                <td colspan="4">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="4">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="4">&nbsp;</td>
              </tr>
            </table>
        <?php foreach ($items_data as $key => $value) { ?>
          <div style="padding:30px;margin-bottom:100px">
            <table width="100%" border="0" class="item_table" style="font-family:calibri;border-collapse:seperate !important">
              <tr>
                <td>&nbsp;</td>
                <td colspan="2" rowspan="2" style="border: 1px solid black;">
                  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="29" colspan="4" align="center" valign="middle" style="font-size:20px;"><strong><?php echo $value->title ?></strong></td>
                    </tr>
                    <tr>
                      <td height="36" colspan="4" align="center" valign="top" style="font-weight:normal;"><?php echo $value->sub_title ?></td>
                    </tr>
                    <tr>
                      <td colspan="4" align="center" valign="middle"><?php echo $value->description ?>

                      </td>
                    </tr>
                    <tr>
                      <td colspan="4">&nbsp;</td>
                    </tr>
                    <tr>
                      <td colspan="4" bgcolor="#FFFFFF" ><table width="100%" border="0"  bgcolor="#000000" cellpadding="0" cellspacing="1">
                        <tr style="border: 1px solid black !important; ">
                          <td width="19%" height="38" bgcolor="#FFCC00" style="font-size:16px;"><strong>&nbsp;&nbsp;PRODUCTS</strong></td>
                          <td width="22%" bgcolor="#FFCC00" style="font-size:16px;"><strong>&nbsp;&nbsp;AMOUNT /<br/> SQ.FT.(RS)</strong></td>
                          <td width="22%" bgcolor="#FFCC00" style="font-size:16px;"><strong>&nbsp;&nbsp;WARRANTY</strong></td>
                          <td width="37%" bgcolor="#FFCC00" style="font-size:16px;"><strong>&nbsp;&nbsp;METHOD OF APPLICATION</strong></td>
                        </tr>
                        <tr style="border: 1px solid black !important; ">
                          <td style="border: 1px solid black !important; " height="136" align="left" valign="middle" bgcolor="#FFFFFF" style="font-size:14px; padding-left:5px;"><?php echo nl2br($value->products) ?>
                          </td>
                          <td style="border: 1px solid black !important; " align="center" valign="middle" bgcolor="#FFFFFF" style="font-size:14px;"><?php echo $value->unit_price ?></td>
                          <td style="border: 1px solid black !important; " style="font-size:14px; padding-left:5px;" bgcolor="#FFFFFF" ><?php echo nl2br($value->warranty) ?></td>
                          <td style="border: 1px solid black !important; " style="font-size:14px; padding-left:5px;" bgcolor="#FFFFFF"><?php echo nl2br($value->method_of_application) ?></td>
                        </tr>
                        <tr style="border: 1px solid black !important; ">
                          <td style="border: 1px solid black !important; " height="31" colspan="2" bgcolor="#FFFFFF" style="font-size:14px; padding-left:5px;"><strong>Approx. Sq. Ft</strong></td>
                          <td style="border: 1px solid black !important; " colspan="2" bgcolor="#FFFFFF" style="font-size:13px; padding-left:5px;"><strong><?php echo $value->quantity ?></strong></td>
                        </tr>
                        <tr style="border: 1px solid black !important; ">
                          <td style="border: 1px solid black !important; " height="34" colspan="2" style="font-size:14px; padding-left:5px;" bgcolor="#FFFFFF"><strong>Amount</strong></td>
                          <td style="border: 1px solid black !important; " colspan="2" bgcolor="#FFFFFF" style="font-size:14px; padding-left:5px;"><strong><?php echo $value->quantity ?> x <?php echo $value->unit_price ?> = <?php echo $value->total_amount ?>+GST</strong></td>
                        </tr>
                        <tr style="border: 1px solid black !important; ">
                          <td style="border: 1px solid black !important; " height="48" colspan="4" bgcolor="#FFFFFF" style="font-size:14px; padding-left:5px; line-height:24px;"><?php echo $value->notes ?></td>
                        </tr>
                      </table></td>
                    </tr>
                  </table>
                </td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table>
          </div>
        <?php } ?>
        <table width="100%" border="0">
          <tr>
            <td colspan="4"><img style="width:100%" src="<?php echo base_url()."uploads/quotation_workorder/".$quotation_data->quotation_footer ?>" width="100%" /></td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
        </table>
        <div class="page">
          <table  width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><img src="<?php echo base_url()."uploads/quotation_workorder/quotation_page_4.jpg" ?>" style="width:100%;height:1550px" /></td>
            </tr>
          </table>
        </div>
        <table width="100%" border="0">
          <tr>
            <td colspan="4"><img style="width:100%" src="<?php echo base_url()."uploads/quotation_workorder/".$quotation_data->quotation_footer ?>" width="100%" /></td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
        </table>
        <table width="85%" border="0" align="center" style="text-align:justify;margin-bottom:100px">
          <tr>
            <td colspan="4" align="center" valign="middle"><strong style="text-decoration:underline; font-size:20px;">THIS PROPOSAL INCLUDES THE CONDITION NOTED</strong></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="center" valign="middle">&nbsp;</td>
            <td colspan="3" class="quotation">
              <?php
              $terms = unserialize($quotation_data->terms_and_conditions);
              if($terms!='' && $terms!=null) {
                $count = sizeof($terms);
                $i = 1;
                ?>
                <ul>
                  <?php foreach ($terms as $key => $value) { ?>
                    <li><?= nl2br($value['description']) ?></li>
                  <?php } ?>
                </ul>
              <?php } ?>
            </td>
          </tr>

        </table>
        <table width="100%" border="0">
          <tr>
            <td colspan="4"><img style="width:100%" src="<?php echo base_url()."uploads/quotation_workorder/".$quotation_data->quotation_footer ?>" width="100%" /></td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4">&nbsp;</td>
          </tr>
        </table>
      </form>
    </div>
  </div>
</div>
</div>
</div>
<!-- end:: Body -->
<!-- begin::Footer -->

<?php $this->view("includes/Inc_footer");?>
<!-- end::Footer -->

<!-- end:: Page -->

<?php $this->view("includes/Inc_sidebar");?>
<?php $this->view("includes/Inc_scripts");?>
<!--begin::Page Snippets -->
<script>

$("#sales_quotation_menu").addClass('m-menu__item--active m-menu__item--open');
$("#sales_quotation_menu_2").addClass('m-menu__item--active');
$("#page_title").text("<?php echo $this->config->item('Quotation_sales_quotation_title') ?> - <?php echo "#".$quotation_data->quotation_prefix."-".$quotation_data->quotation_no ?>");

$('#btn_print_sales_quotation').click(function(e){
  var quotation_id = "<?php echo $quotation_data->quotation_id?>";
  myWindow = window.open('<?php echo base_url().'sales_quotation/profile/print/'?>'+quotation_id,'newwindow','width=1200,height=700');
  myWindow.document.close();
  myWindow.focus();
  myWindow.print();
});

</script>
<script>

$(".form_submit_btn_4").click(function (e) {

  e.preventDefault();
  var a = $(this),
  l = $(this).closest("form"),
  action = l.attr('action');
  var form_id = l.attr('id');
  l.validate({
    rules: {
      "new_paid_amount": {
        required: !0,
        number: !0
      }
    }, invalidHandler: function (e, r) {
      var i = $("#" + form_id + "_msg");
      i.removeClass("m--hide").show(), mUtil.scrollTo(i, -200)
    }, submitHandler: function (e) {
    }
  }), l.valid() && (a.addClass("m-loader m-loader--right m-loader--light").attr("disabled", !0),
  l.ajaxSubmit({
    url: action,
    success: function (e, t, r, s) {
      var modal_id = l.attr('data-modal-id');
      var form_type = l.attr('data-form-type');
      $("#" + form_id + "_msg").addClass("m--hide");
      // Block UI
      mApp.blockPage({
        overlayColor: "#000000",
        type: "loader",
        state: "success",
        message: "Please wait..."
      }), setTimeout(function () {
        mApp.unblockPage()
      }, 2e3);
      var obj = $.parseJSON(e);
      if (obj.status == 1) {
        a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
        toastr[obj.flashdata_type](obj.flashdata_msg, obj.flashdata_title);
        $("#"+modal_id).modal('toggle');
        $("."+form_id+"_fields").val("");
        location.reload();
      } else {
        a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
        toastr[obj.flashdata_type](obj.flashdata_msg, obj.flashdata_title);
      }
      if (obj == null) {
        setTimeout(function () {
          a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
          toastr["warning"]("Your Attempt is Timed Out. Please Try Again.", "Timed Out");
        }, 2e4)
      }
    },error: function() {
      a.removeClass("m-loader m-loader--right m-loader--light").attr("disabled", !1);
      toastr["error"]("Sorry. There Has Been Some Error Occurred. Please Try Again.", "Error");
    }
  })
)
});

</script>
