<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<link rel="stylesheet" href="<?php echo base_url('/assets/themes/login/Login.css') ?>">
<div class="page-wrapper p-t-70 p-b-70">
   <div class="wrapper wrapper--w1100">
      <div class="card">
         <div class="card-header">
            <div class="col-12 col-md-12 col-lg-12 col-sm-12">
               <div class="row">
                  <div class="col-4 col-md-4 col-lg-4 col-sm-4">
                     <img class="toplogo" src="<?php echo base_url('/assets/images/login/ministry-of-health-and-family-welfarepng.png') ?>" alt="Ministry Of Health and Family Welfare">
                  </div>
                  <div class="col-4 col-md-4 col-lg-4 col-sm-4">
                     <img class="toplogo" src="<?php echo base_url('/assets/images/login/NHM-Logo.png') ?>" alt="NHM">
                  </div>
                  <div class="col-4 col-md-4 col-lg-4 col-sm-4">
                     <img class="toplogo" src="<?php echo base_url('/assets/images/login/family-planning.png') ?>" alt="Family Planning">
                  </div>
               </div>
               <img src="<?php echo base_url('/assets/images/login/anantara.png') ?>" alt="" class="img-fluid antaraimg">
            </div>
         </div>
         <div class="card-body">
            <div class="card-title heading">
               Service Provider Training For Injectable Contraceptive MPA<br />(Antara Program)
            </div>
            <div class="card-text">
               <span class="f-20">Family Planning Division<br />Ministry Of Health & Family Welfare<br />Government Of India</span>
               <p> Submit your response to pre test, session wise questions, post test, & training evaluation here</p>
            </div>
            <hr />
            <div id="LoginDiv" class="row">

               <div class="col-12 col-md-12 col-lg-12 col-sm-12">
                  <?php echo form_open_multipart('', array('role' => 'form')); ?>

                  <div class="row">
                     <?php // first name 
                     ?>
                     <div class="form-group col-md-4 col-lg-4 col-sm-12 <?php echo form_error('first_name') ? ' has-error' : ''; ?>">
                        <?php echo form_label(lang('front_first_name'), 'first_name', array('class' => 'control-label')); ?>
                        <span class="required">*</span>
                        <?php echo form_input(array('name' => 'first_name', 'id' => 'first_name', 'value' => set_value('first_name', (isset($user['first_name']) ? $user['first_name'] : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('first_name')); ?> </span>
                     </div>
                     <?php // last name 
                     ?>
                     <div class="form-group col-md-4 col-lg-4 col-sm-12 <?php echo form_error('last_name') ? ' has-error' : ''; ?>">
                        <?php echo form_label(lang('front_last_name'), 'last_name', array('class' => 'control-label')); ?>
                        <span class="required">*</span>
                        <?php echo form_input(array('name' => 'last_name', 'id' => 'last_name', 'value' => set_value('last_name', (isset($user['last_name']) ? $user['last_name'] : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('last_name')); ?> </span>
                     </div>

                     <?php // Mobile No
                     ?>
                     <div class="form-group col-md-4 col-lg-4 col-sm-12<?php echo form_error('mobile') ? ' has-error' : ''; ?>">
                        <?php echo "<label class='control-label'>Mobile No as (Username)</label>"; //form_label(lang('front_facility'), 'facility', array('class'=>'control-label')); 
                        ?>
                        <span class="required">*</span>
                        <?php echo form_input(array('name' => 'mobile', 'id' => 'mobile', 'value' => set_value('mobile', (isset($user['mobile']) ? $user['mobile'] : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('mobile')); ?> </span>
                     </div>


                  </div>

                  <div class="row">
                     <!-- State List -->
                     <div class="form-group col-md-4 col-lg-4 col-sm-12<?php echo form_error('state') ? ' has-error' : ''; ?>">
                        <?php echo "<label class='control-label'>State</label>"; ?>
                        <span class="required">*</span>
                        <select name="state" id="state" class="form-control input-lg">
                           <option value="">Select State</option>
                           <?php
                           foreach ($states as $row) {
                              echo '<option value="' . $row->id . '">' . $row->name . '</option>';
                           }
                           ?>
                        </select>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('state')); ?> </span>
                     </div>
                     <!-- District List -->
                     <div class="form-group col-md-4 col-lg-4 col-sm-12 <?php echo form_error('district') ? ' has-error' : ''; ?>">
                        <?php echo "<label class='control-label'>District</label>"; ?>
                        <span class="required">*</span>
                        <select name="district" id="district" class="form-control">
                           <option value="">Select District</option>
                        </select>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('district')); ?> </span>
                     </div>

                     <!-- Block Taluka -->
                    <!-- <div class="form-group col-md-4 col-lg-4 col-sm-12 <?php echo form_error('taluka') ? ' has-error' : ''; ?>">
                        <?php  // echo "<label class='control-label'> Block/Taluka </label>"; ?>
                        <span class="required">*</span>
                        <select name="taluka" id="taluka" class="form-control">
                           <option value="">Select Block/Taluka </option>
                        </select>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('taluka')); ?> </span>
                     </div> -->

					 <div class="form-group col-md-4 col-lg-4 col-sm-12 <?php echo form_error('taluka') ? ' has-error' : ''; ?>">
                        <?php echo "<label class='control-label'> Block/Taluka </label>"; ?>
                        <span class="required">*</span>
                        <?php echo form_input(array('name' => 'taluka', 'placeholder' => 'Enter the name of Block/Taluka',
						'id' => 'taluka', 'value' => set_value('taluka', (isset($user['taluka']) ? $user['taluka'] : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('taluka')); ?> </span>
                     </div>
                  </div>
				<!-- display for other District  -->
				  <div class="row" id = "DivOtherDistrict">
					<div class="form-group col-md-4 col-lg-4 col-sm-12 <?php echo form_error('OtherDistrict') ? ' has-error' : ''; ?>">
                        <?php echo "<label class='control-label'> District Name </label>"; ?>
                       
                        <?php echo form_input(array('name' => 'OtherDistrict', 'placeholder' => 'Enter the name of District',
						'id' => 'OtherDistrict', 'value' => set_value('OtherDistrict', (isset($user['OtherDistrict']) ? '' : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('OtherDistrict')); ?> </span>
                     </div>

				  </div>
				  <!-- end display for other District  -->



                  <div class="row">
                     <?php // Designation  change to Faculty Name
                     ?>
                     <div class="form-group col-md-6 col-lg-6 col-sm-12 <?php echo form_error('designation') ? ' has-error' : ''; ?>">
                        <?php echo  form_label('Facility Name', 'designation', array('class' => 'control-label')); ?>
                        <span class="required">*</span>
                        <?php echo form_input(array('name' => 'designation', 'id' => 'designation', 'value' => set_value('designation', (isset($user['designation']) ? $user['designation'] : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('designation')); ?> </span>
                     </div>

                     <!-- Type of Facility  -->

                     <div class="form-group col-md-6 col-lg-6 col-sm-12<?php echo form_error('facility') ? ' has-error' : ''; ?>">
                        <?php echo  form_label('Facility Type', 'facility', array('class' => 'control-label'));
                        ?>
                        <span class="required">*</span>


                        <select name="facility" id="facility" class="form-control input-lg">
                           <option value="">Select facility type</option>
                           <?php
                           foreach ($facilities as $row) {
                              echo '<option value="' . $row->id . '">' . $row->name . '</option>';
                           }
                           ?>
                        </select>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('facility')); ?> </span>
                     </div>
                  </div>

				  <!-- display for other faculty type  -->
				  <div class="row" id = "DivOtherFaculity">
					<div class="form-group col-md-6 col-lg-6 col-sm-12 <?php echo form_error('OtherFaculity') ? ' has-error' : ''; ?>">
                        <?php echo "<label class='control-label'> Facility Type</label>"; ?>
                       
                        <?php echo form_input(array('name' => 'OtherFaculity', 'placeholder' => 'Enter the facility type',
						'id' => 'OtherFaculity', 'value' => set_value('OtherFaculity', (isset($user['OtherFaculity']) ? '' : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('OtherFaculity')); ?> </span>
                     </div>

				  </div>
				  <!-- end display for other faculty type  -->

                  <div class="row">

                     <!-- Language -->
                     <div class="form-group col-md-6 col-lg-6 col-sm-12<?php echo form_error('quelanguage') ? ' has-error' : ''; ?>">
                        <?php echo  form_label('Select Language', 'quelanguage', array('class' => 'control-label'));
                        ?>
                        <span class="required">*</span>


                        <select name="quelanguage" id="quelanguage" class="form-control input-lg">
                            <option value="">Select Language</option> 
                           <?php
                           foreach ($question_lang as $row) {
                              echo '<option value="' . $row->id . '">' . $row->category_title . '</option>';
                           }
                           ?>
                        </select>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('quelanguage')); ?> </span>
                     </div>

                     <?php // language 
                     ?>
                     <!--  <div class="form-group col-6<?php echo form_error('language') ? ' has-error' : ''; ?>">
                        <?php echo form_label(lang('front_language'), 'language', array('class' => 'control-label')); ?>
                        <span class="required">*</span>
                        <?php echo form_dropdown('language', $this->languages, (isset($user['language']) ? $user['language'] : $this->config->item('language')), 'id="language" class="form-control"'); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('language')); ?> </span>
                     </div>
                    </div> -->

                     <div class="form-group col-md-6 col-lg-6 col-sm-12<?php echo form_error('email') ? ' has-error' : ''; ?>">
                        <?php echo form_label(lang('front_email'), 'email', array('class' => 'control-label')); ?>
                        
                        <?php echo form_input(array('name' => 'email', 'value' => set_value('email', (isset($user['email']) ? $user['email'] : '')), 'class' => 'form-control', 'type' => 'email')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('email')); ?> </span>
                     </div>


                  </div>

                  <div style="display: none;" class="row">

                     <?php // username 
                     ?>

                     <div class="form-group col-md-6 col-lg-6 col-sm-12 <?php echo form_error('username') ? ' has-error' : ''; ?>">
                        <?php echo form_label(lang('username'), 'username', array('class' => 'control-label')); ?>
                        <span class="required"> * </span>
                        <?php echo form_input(array('name' => 'username', 'id' => 'username', 'value' => set_value('username', (isset($user['username']) ? $user['username'] : '')), 'class' => 'form-control')); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('username')); ?> </span>
                     </div>

                     <!-- <br style="clear: both;"> -->
                     <div class="form-group col-md-6 col-lg-6 col-sm-12 <?php echo form_error('password') ? ' has-error' : ''; ?>">
                        <?php echo form_label(lang('password'), 'password', array('class' => 'control-label')); ?>
                        <span class="required">* </span>
                        <?php echo form_input(array('name' => 'password', 'value' => 'user123', 'class' => 'form-control', 'autocomplete' => 'off', 'disabled' => TRUE)); ?>
                        <span class="small text-danger"> <?php echo strip_tags(form_error('password')); ?> </span>
                     </div>


                  </div>
                  <div class="row">
                     <div class="form-group col-md-4 mt-4 d-flex justify-content-center"> </div>
                     <div class="form-group col-md-4 mt-4 d-flex justify-content-center">
                        <?php if ($this->session->userdata('logged_in')) : ?>
                           <button type="submit" name="submit" class="btn btn-block btn-success"><span class="glyphicon glyphicon-save"></span> <?php echo lang('core_button_save'); ?></button>
                        <?php else : ?>
                           <button type="submit" name="submit" class="btn btn-block btn-primary btn-lg"><?php echo 'Submit To Register'; ?></button>
                        <?php endif; ?>
                     </div>

                  </div>
                  <div class="row">
                     <div class="form-group col-md-12 mt-12 d-flex justify-content-center">
                        <a href="<?php echo base_url('login'); ?>">↩️ Back</a>
                     </div>
                  </div>
                  <?php echo form_close(); ?>

               </div>

            </div>
         </div>
      </div>
   </div>

   <?php
   if ($this->session->userdata('logged_in')) :
      if (uri_string() == 'user/register') {
         return redirect(base_url('profile'));
      }
   endif;
   ?>