<script type="text/javascript">
    function validate_agency(){
        
        var agencyname = $("#agency_name");
        var pnamemsg = $("#msg_agency_name");
        
        if(agencyname.val()==''){
            agencyname.addClass('error');
            agencyname.focus();
            pnamemsg.html('Please enter agency name').show();
            return false;
        }else{
            agencyname.removeClass('error');
            pnamemsg.hide();
        }
        return true;
    }

</script>
<div class="breadcrumb">
    <h1>agencys</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Add New Agency</li>
    </ul>
</div>
<div class="widget-body">
    <div class="portlet-body">
                        
    <?php echo (isset($successMsg) && $successMsg!='') ? "<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($successMsg)."</div>" : '' ; ?>
    <?php echo (isset($failedMsg) && $failedMsg!='') ? "<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($failedMsg)."</div>" : '' ?>
   
    <div id="status_msg" style="display: none;"><div class="alert alert-success"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>
    <div id="alert_msg" style="display: none;"><div class="alert alert-danger"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>

    </div>
</div>
<div class="separator-breadcrumb border-top"></div>
  <div id="results" >
      <div  id="msg_error_name"></div>
  </div>
<div id="status_msg" style="display: none;"><div class="alert alert-success"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>

<div class="row">
    <div class="col-md-12">
        <div class="card mb-4">
            <div class="card-body">
                <div class="card-title mb-3">Add New Agency</div>
                <form action="" id='frm-agency' method="post" enctype="multipart/form-data" onsubmit="return validate_agency();">
                    <?php if(isset($agencyDetail->agency_id ) && $agencyDetail->agency_id !=0) { ?>
                       <input type="hidden" id="agency_id" name="agency_id" value="<?php echo $agencyDetail->agency_id; ?>" />
                    <?php } ?>
                    <div class="row">
                        
                        <div class="col-md-6 form-group mb-3">
                            <label for="agency_name">Agency name <span class="asterisk">*</span></label>
                            <input type="text" class="form-control" id="agency_name" name="agency_name" value="<?php echo $agencyDetail->agency_name ?>" placeholder="Enter agency phone name">
                            <div class="invalid-tooltip" id="msg_agency_name"></div>
                        </div>
                        <div class="col-md-12 form-group mb-3">
                            <label class="control-label">Status</label>
                            <div class="controls">

                            <label class="switch switch-primary mr-3">
                                <input type="checkbox" id="agency_status" name="agency_status" <?php echo ($agencyDetail->agency_status=='1') ? "checked='checked'" : "" ?>>
                                <span class="slider"></span>
                            </label>
                            </div>
                         </div>
                        <div class="col-md-12">
                            <input type="submit" class="btn btn-primary" id="submit" name="submit" value="Submit">
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


