<?php
  
   $Image_url = getImage_url();

?>
<!-- PAGE-INDEX-STARTS -->

<div class="breadcrumbs">
    <div class="breadcrumbs-inner">
        <div class="row m-0">
            <div class="col-sm-4">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><?= $pTitle ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-8">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li><a href="<?= base_url() ?>">Dashboard</a></li>
                            <li><a><?= $menu ?></a></li>
                            <li class="active">
                                <?= $smenu ?>
                            </li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- PAGE-INDEX-ENDS -->

<!-- PAGE-CONTENT-STARTS -->

<div class="content">
    <div class="animated fadeIn">
        <div class="row">
            <div class="col-lg-12">
                <?php 
                $url = (!isset($country_id)||empty($country_id))
                ?'country/create_country':'country/edit_country/'.$country_id;
                if($this->session->flashdata('message')) { 
                $flashdata = $this->session->flashdata('message'); ?>
                <div class="alert alert-<?= $flashdata['class'] ?>">
                    <button class="close" data-dismiss="alert" type="button">×</button>
                    <?= $flashdata['message'] ?>
                </div>
                <?php } ?>
                <form role="form" action="<?= base_url($url) ?>" method="post" class="validate" data-parsley-validate="" enctype="multipart/form-data">
                    <div class="card">
                        <div class="card-header">
                            <strong><?= $pDescription ?></strong>
                        </div>
                        <div class="card-body card-block">
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label for="nf-email" class=" form-control-label">Country Name</label>
                                        <input type="text" id="nf-brand" data-parsley-trigger="change" data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" name="country_name" placeholder="Enter Country Name" class="form-control required" value="<?= (isset($countryData->country_name))?$countryData->country_name:'' ?>">
                                    </div>
                                    <div class="col-md-6">
                                        <label for="nf-email" class=" form-control-label">Country Name (Arabic)</label>
                                          <input type="text" id="nf-brand"  name="country_name_arab" placeholder="Enter Country Name In Arabic" class="form-control required" value="<?= (isset($countryData->country_name_arab))?$countryData->country_name_arab:'' ?>">
                                    </div>
                                </div>
                            </div>
                             <div class="form-group">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label for="nf-email" class=" form-control-label">Code</label>
                                        <input type="text" id="nf-brand" data-parsley-trigger="change" data-parsley-minlength="2" data-parsley-pattern="^[0-9\ , - + \/]+$"  name="code" placeholder="Enter Code Name" class="form-control required" value="<?= (isset($countryData->code))?$countryData->code:'' ?>">
                                    </div>
                                    <div class="col-md-6">
                                        <label for="nf-email" class=" form-control-label">Symbol</label>
                                          <input type="text" id="nf-brand"  name="symbol" placeholder="Enter Symbol" class="form-control required" value="<?= (isset($countryData->symbol))?$countryData->symbol:'' ?>">
                                    </div>
                                </div>
                            </div>
                             <div class="form-group">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label for="nf-email" class=" form-control-label">Rate</label>
                                        <input type="text" id="nf-brand" data-parsley-trigger="change" data-parsley-minlength="2" data-parsley-pattern="^[a-zA-Z0-9\ . _ - ' \/]+$" name="rate" placeholder="Enter Rate" class="form-control required" value="<?= (isset($countryData->rate))?$countryData->rate:'' ?>">
                                    </div>
                                    <div class="col-md-6">
                                        <label for="nf-email" class=" form-control-label">VAT</label>
                                          <input type="text" id="nf-brand"  name="vat" placeholder="Enter VAT" class="form-control required" value="<?= (isset($countryData->vat))?$countryData->vat:'' ?>">
                                    </div>
                                </div>
                            </div>
                          
                            
                            <?php $req = (!isset($country_id)||empty($country_id))
                  ?'form-control required':'form-control';?>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-12">
                                        <label for="nf-password" class=" form-control-label">Flag Image</label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-12">
                                      <img id="image_id_1" src="<?= (isset($countryData->flag))?($Image_url.$countryData->flag):'' ?>" onerror="this.src='<?=base_url("assets/images/user_avatar.jpg")?>';" height="75" width="75" />
                                      <input name="flag" type="file" accept="image/*" onchange="setImg(this,'image_id_1');" class="<?= base_url($req) ?>"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-12">
                                        <button type="submit" class="btn btn-primary">
                                            <i class="fa fa-dot-circle-o"></i> Submit
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>       
                    </div>
                </form>
            </div>        
        </div>
    </div>
</div>

<!-- PAGE-CONTENT-ENDS -->