285 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			285 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
<?php defined('BASEPATH') or exit('No direct script access allowed'); 
 | 
						|
?>
 | 
						|
<style type="text/css">
 | 
						|
.has-error input[type="text"], .has-error input[type="email"], .has-error input[type="password"], .has-error input[type="date"], .has-error select[multiple], .has-error select {
 | 
						|
    border: 1px solid #a94442;
 | 
						|
}
 | 
						|
.help-block.with-errors {
 | 
						|
    color: #a94442;
 | 
						|
}
 | 
						|
</style>
 | 
						|
<?php if($this->session->flashdata('feedback_error')){ ?>
 | 
						|
    <script>
 | 
						|
    Swal.fire({
 | 
						|
              position: 'center',
 | 
						|
              icon: 'error',
 | 
						|
              title: '<?php echo $this->session->flashdata('feedback_error'); ?>',
 | 
						|
              showConfirmButton: false,
 | 
						|
              timer: 3500
 | 
						|
            })
 | 
						|
    </script>
 | 
						|
<?php } ?>  
 | 
						|
<?php if($this->session->flashdata('feedback_success')){ ?>
 | 
						|
    <script>
 | 
						|
    Swal.fire({
 | 
						|
              position: 'center',
 | 
						|
              icon: 'success',
 | 
						|
              title: '<?php echo $this->session->flashdata('feedback_success'); ?>',
 | 
						|
              showConfirmButton: false,
 | 
						|
              timer: 3500
 | 
						|
            })
 | 
						|
    </script>
 | 
						|
<?php } ?>  
 | 
						|
 
 | 
						|
<div class="app-content content">
 | 
						|
    <section class="content-wrapper">
 | 
						|
        <div class="row">
 | 
						|
            <div class="col-12">
 | 
						|
                <div class="card">
 | 
						|
                    <div class="card-header">
 | 
						|
                        <div class="row">    
 | 
						|
                            <div class="col-12">
 | 
						|
                                <h3 class="font-weight-bold">
 | 
						|
                                    <?php 
 | 
						|
                                    if($vendor->id)
 | 
						|
                                        echo lang('Edit Vendor'); 
 | 
						|
                                    else 
 | 
						|
                                        echo lang('Add Vendor'); 
 | 
						|
                                    ?>
 | 
						|
                                        
 | 
						|
                                </h3>
 | 
						|
                            </div>
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                    <hr class="mt-0 mb-0" />
 | 
						|
                    <div class="card-body">
 | 
						|
                        <div class="row">
 | 
						|
                            <div class="col-md-12">
 | 
						|
                                <form action="<?=base_url()?>master_vendor/addnew"  method="post" data-toggle="validator" novalidate="true" onsubmit="return validateForm()" >
 | 
						|
                                    <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
 | 
						|
                                    <input type="hidden" name="id" value="<?php echo $vendor->id; ?>">
 | 
						|
                                    <div class="row">
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Vendor Name</label>
 | 
						|
                                            <input type="text" class="form-control" value="<?php echo $vendor->vedor_name; ?>" name="vedor_name" id="vedor_name" placeholder="Enter Vendor Name" required data-error="Please enter a value.">
 | 
						|
                                            <div class="txt-red" id="vedor_name_Error" style="color:red;font-size: 12.5px !important;"></div>
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Vendor Phone No.</label>
 | 
						|
                                            <input type="text" class="form-control" value="<?php echo $vendor->vendor_phone; ?>" name="vendor_phone" id="name" placeholder="Enter Vendor Phone No." onkeypress="return isNumberKey(event)" onkeyup="formatPhoneNumber(this.value,this)" onBlur="formatPhoneNumber(this.value,this)"  required data-error="Please enter a value.">
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Vendor Email</label>
 | 
						|
                                            <input type="email" class="form-control" value="<?php echo $vendor->vendor_email; ?>" name="vendor_email" id="vendor_email" placeholder="Enter Vendor Email" required data-error="Please enter a value.">
 | 
						|
                                            <div class="txt-red" id="vedor_email_Error" style="color:red;font-size: 12.5px !important;"></div>
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
 | 
						|
                                        <div class="form-group col-lg-6">                                            
 | 
						|
                                            <label for="exampleInputEmail1" class="required"><?php echo lang('EIN No'); ?></label>
 | 
						|
                                            <input type="text" class="form-control" name="ein_no" value="<?php echo $vendor->ein_no; ?>" placeholder="Enter Vendor EIN No." minlength="9" maxlength="9"  onkeypress="return isNumberKey(event)" required data-error="Please enter a value.">
 | 
						|
                                            <div class="help-block with-errors"></div>
 | 
						|
                                        </div>
 | 
						|
 | 
						|
                                        <div class="form-group col-lg-6">                                            
 | 
						|
                                            <label for="exampleInputEmail1" class="required"><?php echo lang('Fax No.'); ?></label>
 | 
						|
                                            <input type="text" class="form-control" name="fax_no" value="<?php echo $vendor->fax_no; ?>" onkeypress="return isNumberKey(event)" placeholder="Enter Vendor Fax No." required data-error="Please enter a value.">
 | 
						|
                                            <div class="help-block with-errors"></div>
 | 
						|
                                        </div>
 | 
						|
 | 
						|
                                        <div class="form-group col-lg-6">                                            
 | 
						|
                                            <label for="exampleInputEmail1" class="required"><?php echo lang('Web Address'); ?></label>
 | 
						|
                                            <input type="text" class="form-control" placeholder="Enter Vendor Web Address" name="web_address" value="<?php echo $vendor->web_address; ?>" required data-error="Please enter a value.">
 | 
						|
                                            <div class="help-block with-errors"></div>
 | 
						|
                                        </div>
 | 
						|
                                        
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Vendor Address</label>
 | 
						|
                                            <input type="text" class="form-control" value="<?php echo $vendor->vendor_address; ?>" name="vendor_address" id="name" placeholder="Enter Vendor Address" required data-error="Please enter a value.">
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Vendor Type</label>
 | 
						|
                                            <select class="form-control" name="vendor_type" required data-error="Please select a value.">
 | 
						|
                                                <option value="" selected disabled>Choose</option>
 | 
						|
                                                    <?php foreach ($vtype as $value) { ?>
 | 
						|
                                                    <option <?php echo ($vendor->vendor_type == $value->id)?'selected':'' ; ?> value="<?php echo $value->id; ?>" attr_name="<?php echo $value->name; ?>"><?php echo $value->name; ?></option>
 | 
						|
                                                    <?php } ?>
 | 
						|
                                            </select>
 | 
						|
                                            
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Contact Person Name</label>
 | 
						|
                                            <input type="text" class="form-control" value="<?php echo $vendor->contact_person_name; ?>" name="contact_person_name" id="contact_person_name" placeholder="Enter Contact Person Name" required data-error="Please enter a value.">
 | 
						|
                                            <div class="txt-red" id="contact_person_name_Error" style="color:red;font-size: 12.5px !important;"></div>
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Contact Person Phone No.</label>
 | 
						|
                                            <input type="text" class="form-control" value="<?php echo $vendor->contact_person_phone; ?>" name="contact_person_phone" id="name" placeholder="Enter Contact Person Phone No." onkeypress="return isNumberKey(event)" onBlur="formatPhoneNumber(this.value,this)" onkeyup="formatPhoneNumber(this.value,this)"  required data-error="Please enter a value.">
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
                                        <div class="form-group col-md-6">
 | 
						|
                                            <label for="exampleInputEmail1"  class="required">Contact Person Email</label>
 | 
						|
                                            <input type="email" class="form-control" value="<?php echo $vendor->contact_person_email; ?>" name="contact_person_email" id="contact_person_email" placeholder="Enter Contact Person Email" required data-error="Please enter a value.">
 | 
						|
                                            <div class="txt-red" id="contact_person_email_Error" style="color:red;font-size: 12.5px !important;"></div>
 | 
						|
                                            <div class="help-block with-errors"></div> 
 | 
						|
                                        </div>
 | 
						|
                                        
 | 
						|
                                        
 | 
						|
                                        <div class="btn-group col-md-12">
 | 
						|
                                            <button type="submit" name="submit" value="submit"  class="btn btn-primary">Save</button>
 | 
						|
                                        </div>
 | 
						|
                                    </div>
 | 
						|
                                </form>
 | 
						|
                            </div>
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </section>
 | 
						|
</div>
 | 
						|
 | 
						|
<script type="text/javascript">
 | 
						|
    function isNumberKey(evt) {
 | 
						|
        var charCode = (evt.which) ? evt.which : evt.keyCode;
 | 
						|
        if (charCode > 31 && (charCode < 48 || charCode > 57))
 | 
						|
            return false;
 | 
						|
        return true;
 | 
						|
    }
 | 
						|
    // $( document ).ready(function() {
 | 
						|
 | 
						|
    // })
 | 
						|
        // function validateForm(){
 | 
						|
        //     var fldval = $("#slotEditname").val();
 | 
						|
        //     if(fldval == ""){
 | 
						|
        //         $("#msg_rm").html("<div class='alert alert-danger' role='alert'> Please enter a value</div>");
 | 
						|
        //         return false;
 | 
						|
        //     }
 | 
						|
 | 
						|
        //     var fldval = $("#slotEditname").val();
 | 
						|
        //     var currId = $('#nameId').val();
 | 
						|
            
 | 
						|
        //     var msgs = '';
 | 
						|
        //     $.ajax('master_icd/duplicateCheck', {
 | 
						|
        //     type: 'POST',  // http method
 | 
						|
        //     data: { val: fldval,currId:currId },  // data to submit
 | 
						|
        //     async: false,
 | 
						|
        //     success: function (data, status, xhr) {
 | 
						|
        //         // $('p').append('status: ' + status + ', data: ' + data);
 | 
						|
        //         // alert(data);
 | 
						|
        //         msgs = data;
 | 
						|
                
 | 
						|
        //     },
 | 
						|
        //     error: function (jqXhr, textStatus, errorMessage) {
 | 
						|
        //             // $('p').append('Error' + errorMessage);
 | 
						|
        //         alert("error duc");
 | 
						|
                
 | 
						|
        //     }
 | 
						|
 | 
						|
        // });
 | 
						|
 | 
						|
 | 
						|
        //     if(msgs == 'exist'){
 | 
						|
        //         $("#msg_rm").html("<div class='alert alert-danger' role='alert'> Value already exist in the list</div>");
 | 
						|
        //         return false;
 | 
						|
        //     }
 | 
						|
        //    else{
 | 
						|
        //     return true;
 | 
						|
        //    }
 | 
						|
 | 
						|
           
 | 
						|
        // }
 | 
						|
        function validateForm()
 | 
						|
        {
 | 
						|
            
 | 
						|
              var has_error =0;
 | 
						|
              $("#vedor_name_Error").html('');
 | 
						|
              $("#vedor_email_Error").html('');
 | 
						|
              $("#contact_person_name_Error").html('');
 | 
						|
              $("#contact_person_email_Error").html('');
 | 
						|
              $("#emgEmailId_Error").html('');
 | 
						|
              $("#bankName_id_Error").html('');
 | 
						|
              $("#advDNR_Error").html('');
 | 
						|
              var vedor_name  = $('#vedor_name').val();
 | 
						|
              var vedor_email = $('#vendor_email').val();
 | 
						|
              var contact_person_name  = $('#contact_person_name').val();
 | 
						|
              var contact_person_email  = $('#contact_person_email').val();
 | 
						|
              
 | 
						|
              var format = /^[a-zA-Z\s]*$/;
 | 
						|
            
 | 
						|
              if ($.trim(vedor_name) !='' && (!format.test($.trim(vedor_name)))){
 | 
						|
                $('#vedor_name_Error').html("Name field does not contain characters.");
 | 
						|
                $('#vedor_name').focus();
 | 
						|
                has_error++;
 | 
						|
                return false;
 | 
						|
              }
 | 
						|
              if ($.trim(contact_person_name) !='' && (!format.test($.trim(contact_person_name)))){
 | 
						|
                $('#contact_person_name_Error').html("Name field does not contain characters.");
 | 
						|
                $('#contact_person_name').focus();
 | 
						|
                has_error++;
 | 
						|
                return false;
 | 
						|
              }
 | 
						|
 | 
						|
              var ck_email   = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
 | 
						|
 | 
						|
              if ($.trim(vedor_email) !='' && (!ck_email.test($.trim(vedor_email)))){
 | 
						|
                  $('#vedor_email_Error').html('Please enter correct email.');
 | 
						|
                  $('#vedor_email').focus();
 | 
						|
                  has_error++;
 | 
						|
                  return false;
 | 
						|
              }
 | 
						|
 | 
						|
              if ($.trim(contact_person_email) !='' && (!ck_email.test($.trim(contact_person_email)))){
 | 
						|
                  $('#contact_person_email_Error').html('Please enter correct email.');
 | 
						|
                  $('#contact_person_email').focus();
 | 
						|
                   has_error++;
 | 
						|
                   return false;
 | 
						|
              }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
        }
 | 
						|
</script>
 | 
						|
<script>
 | 
						|
   function formatPhoneNumber(phoneNumberString,_this) {
 | 
						|
 | 
						|
    var cleaned = ('' + phoneNumberString).replace(/\D/g, '')
 | 
						|
    if(cleaned.length > 10){
 | 
						|
      cleaned =  cleaned.substr(0, 10);
 | 
						|
    }
 | 
						|
    var match = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/)
 | 
						|
    if (cleaned.length == 10 && match) {
 | 
						|
      var intlCode = (match[1] ? '+1 ' : '')
 | 
						|
      var fres = [intlCode, '(', match[2], ') ', match[3], '-', match[4]].join('')
 | 
						|
      _this.value = fres;
 | 
						|
    }else{
 | 
						|
       _this.value = cleaned
 | 
						|
    }
 | 
						|
    return null
 | 
						|
  }   
 | 
						|
</script> 
 | 
						|
<!-- <script>
 | 
						|
   function formatPhoneNumber(phoneNumberString,_this) {
 | 
						|
 | 
						|
    var cleaned = ('' + phoneNumberString).replace(/\D/g, '')
 | 
						|
    if(cleaned.length > 10){
 | 
						|
      cleaned =  cleaned.substr(0, 10);
 | 
						|
    }
 | 
						|
    var match = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/)
 | 
						|
    if (cleaned.length == 10 && match) {
 | 
						|
      var intlCode = (match[1] ? '+1 ' : '')
 | 
						|
      var fres = [intlCode, '(', match[2], ') ', match[3], '-', match[4]].join('')
 | 
						|
      _this.value = fres;
 | 
						|
    }else{
 | 
						|
       _this.value = cleaned
 | 
						|
    }
 | 
						|
    return null
 | 
						|
  }   
 | 
						|
</script>  -->
 |