<?php
$this->load->view("top_application");
//trace($factRes);
if (!is_array($factRes['business_nature_alt']) && $factRes['business_nature_alt'] != '') {
  $factRes['business_nature_alt'] = explode(',', $factRes['business_nature_alt']);
}
if (!is_array($factRes['payment_mode']) && $factRes['payment_mode'] != '') {
  $factRes['payment_mode'] = explode(',', $factRes['payment_mode']);
}
?>
<section>
  <div class="tz">
    <!--LEFT SECTION-->
    <div class="tz-l">      
      <?php $this->load->view("members/left"); ?>
    </div>
    <!--CENTER SECTION-->
    <div class="tz-4"> 
      <div class="tz-2-com tz-2-main">
        <h4>Company Factsheet</h4>
        <div class="db-list-com tz-db-table">
          <div class="ds-boar-title">
            <h2>Company Factsheet</h2>
          </div>
          <div class="hom-cre-acc-left hom-cre-acc-right">
            <div class="">
              <?php
              echo validation_message();
              echo error_message();
              ?>
              <form class="" action="" enctype="multipart/form-data" method="post">
                <div class="row">
                  <div class="input-field col s12">
                    <h2>Basic Information</h2>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Nature of Business*</h5>
                    <select multiple name="business_nature[]">
                      <option value="" disabled selected>Nature of Business</option>
                      <?php 
                      $business_nature_array=explode(",",$factRes['business_nature']);
                      foreach ($businessNatureAll as $k => $v) {
                        $sel = (is_array($business_nature_array) && in_array($k, $business_nature_array)) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $k; ?>" <?php echo $sel; ?>><?php echo $v; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <input id="list_phone" name="ceo_name" type="text" value="<?php echo set_value('ceo_name', $factRes['ceo_name']); ?>" class="validate">
                    <label for="ceo_name">CEO Name*</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <textarea id="address" name="registered_address" class="validate"><?php echo set_value('registered_address', $factRes['registered_address']); ?></textarea>
                    <label for="registered_address">Registered Address*</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <textarea id="address" name="about_company" class="validate"><?php echo set_value('about_company', $factRes['about_company']); ?></textarea>
                    <label for="registered_address">About Your Company</label>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s6">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Youtube Video ID</h5>
                    <input type="text" id="youtube_id" name="youtube_id" class="validate" value="<?php echo set_value('youtube_id', $factRes['youtube_id']); ?>">
                  </div>
                  <div class="input-field col s6">
                    <a href="javascript:void(0);" class="modal-dialog modal-lg" data-toggle="modal" data-target="#myYoutubeModal"><img src="<?php echo theme_url(); ?>images/youtube-help.jpg" id="" class="profile_picture" width="" height="100" /></a>
                    <div id="myYoutubeModal" class="modal fade" role="dialog">
                      <div class="modal-dialog">
                        <!-- Modal content-->
                        <div class="modal-content">
                          <div class="modal-body">
                            <img src="<?php echo theme_url(); ?>images/youtube-help.jpg" id="" class="profile_picture" width="575" />
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Select No. of Employees*</h5>
                    <select name="employee_count">
                      <option value="" disabled selected>Select No. of Employees</option>
                      <?php
                      foreach ($employeeCount as $ek => $ev) {
                        $sel = ($ek == $factRes['employee_count'] || $ek == $this->input->post('employee_count')) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $ek; ?>" <?php echo $sel; ?>><?php echo $ev; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12">
                    <input id="establishment_year" name="establishment_year" type="text" value="<?php echo set_value('establishment_year', $factRes['establishment_year']); ?>" class="validate">
                    <label for="establishment_year">Year of Establishment*</label>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Select Legal Status of Firm</h5>
                    <select name="legal_firm_status">
                      <option value="" disabled selected>Select Legal Status of Firm</option>
                      <?php
                      foreach ($firmStatus as $fk => $fv) {
                        $sel = ($fk == $factRes['legal_firm_status'] || $fk == $this->input->post('legal_firm_status')) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $fk; ?>" <?php echo $sel; ?>><?php echo $fv; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12">
                    <input id="landmark" name="promoter_name" type="text" value="<?php echo set_value('promoter_name', $factRes['promoter_name']); ?>" class="validate">
                    <label for="promoter_name">Name of Promoter</label>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Select Turnover*</h5>
                    <select name="turnover">
                      <option value="" disabled selected>Select Turnover*</option>
                      <?php
                      foreach ($turnover as $tk => $tv) {
                        $sel = ($tk == $factRes['turnover'] || $tk == $this->input->post('turnover')) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $tk; ?>" <?php echo $sel; ?>><?php echo $tv; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12"><h2>Infrastructure</h2></div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <input id="landmark" name="building_infrastructure" type="text" value="<?php echo set_value('building_infrastructure', $factRes['building_infrastructure']); ?>" class="validate">
                    <label for="building_infrastructure">Building Infrastructure</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s8">
                    <input id="landmark" name="premises_size" type="text" value="<?php echo set_value('premises_size', $factRes['premises_size']); ?>" class="validate">
                    <label for="premises_size">Premises Size</label>
                  </div>
                  <div class="input-field col s4">
                    <select name="premises_unit" id="premises_unit">
                      <?php
                      foreach ($premises_unit as $key => $val) {
                        $sel = ($key == $this->input->post('premises_unit') || $key == $factRes['premises_unit']) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $key; ?>" <?php echo $sel; ?>><?php echo $val; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12"><h2>Infrastructure Images</h2></div>
                </div>
                <div class="row">
                  <div class="input-field col s8">
                    <input name="infra_img1" type="file" class="validate" />
                  </div>
                  <div class="input-field col s4">
                    <img src="<?php echo get_image('infra',$factRes['infra_img'], '75','75', 'R'); ?>" width="75" />
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s8">
                    <input name="infra_img2" type="file" class="validate" />
                  </div>
                  <div class="input-field col s4">
                    <img src="<?php echo get_image('infra',$factRes['infra_img2'], '75','75', 'R'); ?>" width="75" />
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s8">
                    <input name="infra_img3" type="file" class="validate" />
                  </div>
                  <div class="input-field col s4">
                    <img src="<?php echo get_image('infra',$factRes['infra_img3'], '75','75', 'R'); ?>" width="75" />
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s8">
                    <input name="infra_img4" type="file" class="validate" />
                  </div>
                  <div class="input-field col s4">
                    <img src="<?php echo get_image('infra',$factRes['infra_img4'], '75','75', 'R'); ?>" width="75" />
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12"><h2>Company USP</h2></div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <textarea id="address" name="competitive_advantage" class="validate"><?php echo set_value('competitive_advantage', $factRes['competitive_advantage']); ?></textarea>
                    <label for="competitive_advantage">Primary Competitive Advantage</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <input id="landmark" name="contract_manufacturing" type="text" value="<?php echo set_value('contract_manufacturing', $factRes['contract_manufacturing']); ?>" class="validate">
                    <label for="contract_manufacturing">Contract Manufacturing</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Quality Measures / Testing Facilities</h5>
                    <select name="testing_facilities">
                      <option value="" disabled selected>Quality Measures / Testing Facilities</option>
                      <?php
                      foreach ($testingFacilities as $tk => $tv) {
                        $sel = ($tk == $factRes['testing_facilities'] || $tk == $this->input->post('testing_facilities')) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $tk; ?>" <?php echo $sel; ?>><?php echo $tv; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12"><h2>Statutory Profile</h2></div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <input id="ie_code" name="ie_code" type="text" value="<?php echo set_value('ie_code', $factRes['ie_code']); ?>" class="validate">
                    <label for="ie_code">DGFT / IE Code</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <input id="banker" name="banker" type="text" value="<?php echo set_value('banker', $factRes['banker']); ?>" class="validate">
                    <label for="banker">Banker</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <input id="gst_no" name="gst_no" maxlength="15" type="text" value="<?php echo set_value('gst_no', $factRes['gst_no']); ?>" class="validate">
                    <label for="gst_no">GST No*</label>
                  </div>
                </div>

                <hr />
                <div class="row">
                  <div class="input-field col s12"><h5>Packaging/Payment and Shipment Details</h5></div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Customized Packaging</h5>
                    <select name="customized_packaging">
                      <option value="" disabled selected>Customized Packaging</option>
                      <?php
                      foreach ($customizedPackaging as $ck => $cv) {
                        $sel = ($ck == $factRes['customized_packaging'] || $ck == $this->input->post('customized_packaging')) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $ck; ?>" <?php echo $sel; ?>><?php echo $cv; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12">
                    <h5 style="margin-bottom: 5px; font-size: 14px;">Select Payment Mode</h5>
                    <select name="payment_mode[]" multiple>
                      <option value="" disabled selected>Select Payment Mode</option>
                      <?php
                      foreach ($paymentMode as $pk => $pv) {
                        $sel = (is_array($factRes['payment_mode']) && in_array($pk, $factRes['payment_mode'])) ? 'selected' : '';
                        ?>
                        <option value="<?php echo $pk; ?>" <?php echo $sel; ?>><?php echo $pv; ?></option>
                        <?php
                      }
                      ?>
                    </select>
                  </div>
                </div>

                <div class="row">
                  <div class="input-field col s12">
                    <input id="gst_no" name="shipment_mode" type="text" value="<?php echo set_value('shipment_mode', $factRes['shipment_mode']); ?>" class="validate">
                    <label for="shipment_mode">Shipment Mode</label>
                  </div>
                </div>
                <div class="row">
                  <div class="input-field col s12 v2-mar-top-40 text-center"> <button class="waves-effect waves-light btn-large btn btn-danger" type="submit">Update Company Factsheet</button> </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
  
  </div>
</section>
<?php $this->load->view("bottom_application"); ?>