<script type="text/javascript" src="<?php echo $this->config->item('ckeditor_basepath'); ?>ckeditor.js"></script>
<ul class="breadcrumb">
    <li><a href="<?= site_url('admin/dashboard') ?>">Home</a></li> 
    <li class="active"><?php echo isset($province_id) ? $breadcum_edit : $breadcum ?></li> 
</ul>
<div class="page-content-wrap">
    <div class="row">
        <div class="col-md-12">
            <form action="" class="form-horizontal" method="post" enctype="multipart/form-data">
                <div class="panel panel-default">
                    <div class="panel-heading">                       
                        <h3 class="panel-title"><?php if ($province_id) { ?>Edit<?php } else { ?> Add<?php } ?> Province</h3>
                        <ul class="panel-controls">
                            <li><a href="<?php echo site_url() ?>admin/province-list"><span class="fa fa-backward" title="Back"></span></a></li>
                        </ul>
                    </div>

                    <div class="panel-body form-group-separated">

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Country *</label>
                            <div class="col-md-6 col-xs-12">                                                                                            
                                <select class="form-control select" data-live-search="true" name="country_id" id="country_id">  
                                    <option value="">Select Country</option>
                                    <?php foreach ($country_list as $country) { ?>
                                        <option value="<?= $country['ct_id'] ?>"<?php if ($country['ct_id'] == $country_id) { ?> selected="selected" <?php } ?>><?= $country['country_name'] ?></option>  
                                    <?php } ?>
                                </select>
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('country_id')) ?></span>
                            </div>
                        </div> 

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Province Name *</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="province_name" class="form-control" value="<?= $province_name ?>"/>
                                </div>                                            
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('province_name')) ?></span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Province Image *</label>
                            <div class="col-md-6 col-xs-12">  
                                Please Choose a file: <input type="file"  class="fileinput btn-primary" onChange="readURL(this);" id="province_image" name="province_image" value="<?= $province_image ?>" title="Browse file" ><br/>
                                <?php if (isset($province_image) && $province_image != '') { ?>
                                    <img id="province_image_preview" src="<?= base_url() ?>assets/uploads/province_images/<?= $province_image ?>" width="50px" height="50px">
                                <?php } else { ?>
                                    <img id="province_image_preview" src="<?= $this->config->item('adminassets'); ?>img/upload_image.png" width="50px" height="50px">
                                <?php } ?>                            
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('province_image')) ?></span>
                            </div>
                        </div> 

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Province Email ID *</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="province_email_id" class="form-control" value="<?= $province_email_id ?>"/>
                                </div>                                            
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('province_email_id')) ?></span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Contact No</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="telephone" class="form-control" value="<?= $telephone ?>"/>
                                </div>                                            
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('telephone')) ?></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Address</label>
                            <div class="col-md-9 col-xs-12">                                            
                                <textarea class="form-control" rows="4" name="address"><?= $address ?></textarea>
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('address')) ?></span>                         
                            </div>                         
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Copyright Text</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="copyright_text" class="form-control" value="<?= $copyright_text ?>"/>
                                </div>  
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Iframe Code</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="iframe_code" class="form-control" value="<?= $iframe_code ?>"/>
                                </div>  
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Province Description *</label>
                            <div class="col-md-9 col-xs-12">                                            
                                <textarea class="form-control" rows="6" id="editor" name="province_description"><?= $province_description ?></textarea>
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('province_description')) ?></span>                         
                            </div>                         
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">Province Hours *</label>
                            <div class="col-md-9 col-xs-12">                                            
                                <textarea class="form-control" rows="3" id="editor" name="hours"><?= $hours ?></textarea>
                                <span class="help-block" style="color: red;"><?= strip_tags(form_error('hours')) ?></span>                         
                            </div>                         
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">GST</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="gst" class="form-control" value="<?= $gst ?>"/>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">PST</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="pst" class="form-control" value="<?= $pst ?>"/>
                                </div> 
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 col-xs-12 control-label">HST</label>
                            <div class="col-md-6 col-xs-12">                                            
                                <div class="input-group">
                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                    <input type="text" name="hst" class="form-control" value="<?= $hst ?>"/>
                                </div> 
                            </div>
                        </div>

                    </div>                    
                    <div class="panel-footer">
                        <button class="btn btn-default" type="reset">Clear Form</button>                                    
                        <button class="btn btn-primary pull-right">Submit</button>
                    </div>
                </div>
            </form>

        </div>
    </div> 
</div>
<script type="text/javascript" src="<?php echo $this->config->item('ckeditor_basepath'); ?>ckeditor.js"></script>
<script type="text/javascript">
                                    function readURL(input) {
                                        if (input.files && input.files[0]) {
                                            var reader = new FileReader();
                                            reader.onload = function (e) {
                                                $('#' + input.id + '_preview').attr('src', e.target.result);
                                            }
                                            reader.readAsDataURL(input.files[0]);
                                        }
                                    }
</script>
<script type="text/javascript">
    CKEDITOR.replace('editor',
            {
                filebrowserBrowseUrl: '<?php echo $this->config->item('ckeditor_basepath'); ?>ckfinder/ckfinder.html',
                filebrowserImageBrowseUrl: '<?php echo $this->config->item('ckeditor_basepath'); ?>ckfinder/ckfinder.html?type=Images',
                filebrowserFlashBrowseUrl: '<?php echo $this->config->item('ckeditor_basepath'); ?>ckfinder/ckfinder.html?type=Flash'
            });
</script> 