<?php $this->load->view('site/layout'); ?>
<?php $this->load->view('site/navbar'); ?>

<div class="kt-content  kt-grid__item kt-grid__item--fluid kt-grid kt-grid--hor" id="kt_content">
    <div class="kt-subheader  kt-grid__item" id="kt_subheader">
        <div class="kt-container  kt-container--fluid ">
            <div class="kt-subheader__main">
                <h3 class="kt-subheader__title"><a href="<?php echo base_url() ?>Dashboard/"><?php echo $this->lang->line('dashboard'); ?></a></h3>
                <span class="kt-subheader__separator kt-subheader__separator--v"></span>
                <span class="kt-subheader__desc"><a href="<?= base_url('drivers/drivers') ?>"><?php echo $this->lang->line('drivers') ?></a></span>
            </div>
        </div>
    </div>
    <?php if (isset($msg) || validation_errors() !== ''): ?>
        <div class="alert alert-warning alert-dismissible">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
            <h4><i class="icon fa-warning"></i> Alert!</h4>
            <?= validation_errors(); ?>
            <?= isset($msg) ? $msg : ''; ?>
        </div>
    <?php endif; ?> 
    <div class="kt-portlet">
        <div class="kt-portlet__head">
            <div class="kt-portlet__head-label">
                <h3 class="kt-portlet__head-title">
                    <?php echo $this->lang->line('edit_driver') ?>
                </h3>
            </div>
        </div>
        <!--begin::Form-->
        <!-- <?php echo form_open_multipart(base_url('drivers/' . $thispage . '/add/')); ?> -->
        <form class="kt-form kt-form--label-right" method="post" action="">
            <div class="kt-portlet__body">
                <div class="form-group row">
                    <label for="example-text-input" class="col-2 col-form-label"><?php echo $this->lang->line('name') ?></label>
                    <div class="col-10">
                        <input type="text" class="form-control" id="exampleInputEmail1" value="<?= $driver->name ?>" placeholder="<?php echo $this->lang->line('name') ?> " name="name" />
                    </div>
                </div>
                <div class="form-group row">
                    <label for="example-search-input" class="col-2 col-form-label"> <?php echo $this->lang->line('email') ?></label>
                    <div class="col-10">
                        <input type="text" class="form-control" id="exampleInputEmail1" value="<?= $driver->email ?>" placeholder="<?php echo $this->lang->line('email') ?> " name="email" />
                    </div>
                </div>
                <div class="form-group row">
                    <label for="example-search-input" class="col-2 col-form-label"> <?php echo $this->lang->line('phone') ?></label>
                    <div class="col-10">
                        <input type="text" class="form-control" id="exampleInputEmail1" value="<?= $driver->phone ?>" placeholder="<?php echo $this->lang->line('phone') ?> " name="phone" />
                    </div>
                </div>
                <div class="form-group row">
                    <label for="example-search-input" class="col-2 col-form-label"> <?php echo $this->lang->line('department') ?></label>
                    <div class="col-10">
                        <select name="country" id="country" class="form-control" >
                            <?php
                            foreach ($countries as $country) {
                                $selected = '';
                                if ($driver->country == $country->id) {
                                    $selected = 'selected';
                                }
                                ?>
                                <option <?= $selected ?> value="<?= $country->id ?>"><?= $this->session->userdata('language') == 'english' ? $country->english : $country->arabic ?></option>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <div class="form-group row">
                    <label for="example-email-input" class="col-2 col-form-label"></label>
                    <div class="col-10" style="margin-top: 10px">
                        <a onclick="show_password()" style="cursor: pointer;color: blue"><?= $this->lang->line('change_password') ?> </a>
                    </div>
                </div>

                <div class="form-group row" id="new_pass">
                    <label for="example-email-input" class="col-2 col-form-label"> <?php echo $this->lang->line('new_password') ?></label>
                    <div class="col-10">
                        <input type="password" class="form-control form-control-solid" value="" name="new_password" placeholder="<?= $this->lang->line('enter') . ' ' . $this->lang->line('new_password') ?>" />
                    </div>
                </div>


            </div>
            <div class="kt-portlet__foot">
                <div class="kt-form__actions">
                    <div class="row">
                        <div class="col-2">
                        </div>
                        <div class="col-10">
                            <button type="submit" class="btn btn-primary" name="submit" value="pl"><?php echo $this->lang->line('edit') ?></button>
                            <button type="reset" class="btn btn-secondary">Cancel</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <?php $this->load->view('site/footer_2'); ?>
    <script>
        $(function () {
            $("#country").select2();

            $("#new_pass").hide();
        });
        function show_password() {
            $("#new_pass").show();
        }
    </script>