        									<th class="sorting" tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-label="First Name: activate to sort column ascending" style="width: 400px;">Manufacturer Name</th>
        									<th class="sorting" tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-label="First Name: activate to sort column ascending" style="width: 400px;">Description</th>
        									<th class="sorting" tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-label="Option: activate to sort column ascending" style="width: 147px;">Options</th>
                  			</tr>
                      </thead>

                      <tbody>
                        <!-- php script here-->
                        <?php
    							        $counter = 0;

    							        $results = DB::select("SELECT strPMManuCode, strPMManuName, strPMManuDesc
                                                  FROM tblpmmanufacturer WHERE intStatus = 1;");

                          foreach($results as $data){
                            if($counter%2 == 0){
                                $trClass="even";
                            }else{
                                $trClass="odd";
                            }
                            $counter++;

                            echo '<tr role="row" class="'.$trClass.'">';
                            echo '<td class="sorting_1">'.$data->strPMManuCode.'</td>';
                            echo '<td>'.$data->strPMManuName.'</td>';
                            echo '<td>'.$data->strPMManuDesc.'</td>';
                            echo '
                                  <td align="center">
                                    <table>
                                      <tr>
                                          <button type="button" class="btn btn-success btn-block" href="#manu_form" data-toggle="collapse" onClick="setFormData(\''.
                                                                                                                                                                  $data->strPMManuCode.'\',\''.
                                                                                                                                                                  $data->strPMManuName.'\',\''.
                                                                                                                                                                  $data->strPMManuDesc
                                                                                                                                                                 .'\')"><span class="glyphicon glyphicon-pencil"></span></button>
                                      </tr>
                                      <tr>
                                          <button type="button" class="btn btn-danger btn-block" data-target="#delete" data-toggle="modal" onClick="delMessage(\''.
                                                                                                                                                                  $data->strPMManuCode.'\',\''.
                                                                                                                                                                  $data->strPMManuName
                                                                                                                                                                 .'\')"><span class="glyphicon glyphicon-remove"></span></button>
                                      </tr>
                                    </table>
                                  </td>
                              ';
                            echo '</tr>';
                          }
                       ?>
                      </tbody>
                    </table>

                    <div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            
                            <h4 class="modal-title" id="myModalLabel">Delete</h4>
                          </div>

                          <form method="post" action="{{URL::to('/maintenance/products/med/manudet/delete-manufacturer')}}">
                            <div class="modal-body">
                              <p id = "del_msg"> hehe </p>
                              
                              <input type="hidden" id="del_id" name="del_id">
                              
                              <input type="hidden" id="del_name" name="del_name">
                            </div>

                            <div class="modal-footer">
                              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                              
                              <button type="submit" class="btn btn-danger">Delete</button>
                            </div>
                          </form>
                        </div>
                      </div>
                    </div>

                                <div class="modal fade" id="prompt" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                      <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                          <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                            <h2 class="modal-title" id="myModalLabel" style="text-align:center;color:#DA4453">!</h2>
                                          </div>
                                                <div class="modal-body">
                                                  <p> <h4 style="text-align:center">{{Session::get('message')}} </h4> </p><br><br>
                                              </div>
                                        </div>
                                      </div>
                                    </div>
                  </div>
                </div>
					    </div>
					  </div>
					</div>
        </div>
      </div>
    </div>
  </div>
@stop

@section('internal-scripts')
  <script>//message
    @if(Session::get('message')!= null)
      $('#prompt').modal('show');
    @endif
  </script>
  <script>//validations
    $("#name").blur(function(){
      if(!isManuNameValid(document.getElementById('name').value)){
        document.getElementById('namediv').className = "form-group has-feedback has-error";
        document.getElementById('namespan').className = "glyphicon form-control-feedback glyphicon-remove";
        document.getElementById('namep').innerHTML = '<ul class="list-unstyled"><li style="color:#DA4453">Invalid Manufacturer Name</li></ul>';
        document.getElementById('btnsubmit').className = "btn btn-info disabled";
      }else{
        document.getElementById('namediv').className = "form-group has-feedback";
        document.getElementById('namespan').className = "glyphicon form-control-feedback";
        document.getElementById('btnsubmit').className = "btn btn-info";
        document.getElementById('namep').innerHTML = '';
      }
    });

    function isManuNameValid(name){
      var isValid = true;

      if(name.length <= 0){
        isValid = false;
      }

      if(!/^[a-zA-Z0-9 -'&()\/.,#+]*$/.test(name)){
        isValid = false;
      }

      if(!/^[a-zA-Z0-9]*$/.test(name.charAt(0))){
        isValid = false;
      }

      if(!/^[a-zA-Z0-9)]*$/.test(name.charAt(name.length-1))){
        isValid = false;
      }

      // ----- validation here for allowed appearances of special characters -------
      // if(isValid){
      //   for(var i = 0; i < name.length-1; i++){
      //     if(
      //        !/^[a-zA-Z0-9]*$/.test(name.charAt(i)) &&
      //        !/^[a-zA-Z0-9]*$/.test(name.charAt(i+1)) &&
      //         (name.charAt(i)!= " " || name.charAt(i+1)!= " ") 
      //       ){
      //       isValid = false;
      //       break;
      //     }
      //   }
      // }

      return isValid;
    }
  </script>
  <script>//functions
    function setFormData(code, name, desc){
      document.getElementById('code').value = code;
      document.getElementById('desc').value = desc;
      document.getElementById('name').value = name
	    document.getElementById('manuform').action = '{{URL::to('/maintenance/products/med/manudet/update-manufacturer')}}';
    }

    function delMessage(code,name){
      document.getElementById('del_msg').innerHTML = "Delete " + name + "?";
      document.getElementById('del_