 <?php include_once 'header.php';?>

 <?php if ($errors) { ?>
   <div class="alert alert-danger">
     <?php if (isset($errors["e"])) echo $errors["e"];
     if (isset($errors["e1"])) echo $errors["e1"];?>
   </div>
 <?php } ?>

 <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
   <div class="row">
     <div class="col-md-8">

       <div class="card">
         <div class="card-header card-header-icon card-header-success">
           <div class="card-icon">
             <i class="material-icons">create</i>
           </div>
           <h4 class="card-title "><?php echo $jkl["hd220"];?></h4>
         </div>
         <div class="card-body">

           <div class="form-group">
             <label class="control-label" for="department"><?php echo $jkl["g131"];?></label>
             <select name="jak_depid" id="department" class="selectpicker col-12" data-live-search="true">
               <option value="0"<?php if ($JAK_FORM_DATA["depid"] == 0) echo ' selected="selected"';?>><?php echo $jkl["g105"];?></option>
               <?php if (isset($JAK_DEPARTMENTS) && is_array($JAK_DEPARTMENTS)) foreach($JAK_DEPARTMENTS as $z) { ?>

                 <option value="<?php echo $z["id"];?>"<?php if ($JAK_FORM_DATA["depid"] == $z["id"]) echo ' selected="selected"';?>><?php echo $z["title"];?></option>

               <?php } ?>

             </select>
           </div>

           <div class="form-group<?php if (isset($errors["e"])) echo " has-danger";?>">
             <label class="control-label" for="title"><?php echo $jkl["g16"];?></label>
             <input type="text" name="jak_title" id="title" class="form-control" value="<?php echo $JAK_FORM_DATA["title"];?>">
           </div>

           <?php if (JAK_BILLING_MODE == 1) { ?>
           <div class="form-group">
             <label class="control-label" for="credits"><?php echo $jkl["hd56"];?></label>
             <input type="number" min="0" name="credits" id="credits" class="form-control" value="<?php echo $JAK_FORM_DATA["credits"];?>">
           </div>
           <?php } else { ?>
            <input type="hidden" name="credits" value="0">
          <?php } ?>

          <div class="form-group">
             <label class="control-label" for="jak_icon"><?php echo $jkl["hd223"];?></label>
             <div class="input-group">
               <input type="text" name="jak_icon" class="form-control" value="<?php echo $JAK_FORM_DATA["icon"];?>">
               <div class="input-group-append">
                 <span class="input-group-text">
                   <a class="btn btn-rose btn-round btn-fab" href="http://fontawesome.io/icons/" target="_blank"><i class="fa fa-link"></i></a>
                 </span>
               </div>
             </div>
           </div>

           <div class="form-group">
             <label class="control-label" for="jak_oponly"><?php echo $jkl["hd150"];?></label>
             <div class="form-check">
               <label class="form-check-label">
                 <input class="form-check-input" type="radio" name="jak_oponly" value="1"<?php if ($JAK_FORM_DATA["oponly"] == 1) { ?> checked="checked"<?php } ?>> <?php echo $jkl["g19"];?>
                 <span class="circle">
                   <span class="check"></span>
                 </span>
               </label>
             </div>
             <div class="form-check">
               <label class="form-check-label">
                 <input class="form-check-input" type="radio" name="jak_oponly" value="0"<?php if ($JAK_FORM_DATA["oponly"] == 0) { ?> checked="checked"<?php } ?>> <?php echo $jkl["g18"];?>
                 <span class="circle">
                   <span class="check"></span>
                 </span>
               </label>
             </div>
           </div>

           <div class="form-group">
             <label class="control-label" for="order"><?php echo $jkl["g102"];?></label>
             <input type="number" name="jak_order" id="order" class="form-control" value="<?php echo $JAK_FORM_DATA["dorder"];?>">
           </div>

         </div>
         <div class="card-footer">
           <a href="<?php echo JAK_rewrite::jakParseurl('customfield', 'options');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
           <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
         </div>
       </div>
     </div>
     <div class="col-md-4">

       <div class="card">
         <div class="card-header card-header-icon card-header-rose">
           <div class="card-icon">
             <i class="material-icons">language</i>
           </div>
           <h4 class="card-title "><?php echo $jkl["hd146"];?></h4>
         </div>
         <div class="card-body">

           <?php if (isset($lang_files) && is_array($lang_files)) foreach($lang_files as $lf) { ?>

             <?php $newtransl = array();
             if (isset($JAK_PRIO_TRANSLATION) && is_array($JAK_PRIO_TRANSLATION)) foreach($JAK_PRIO_TRANSLATION as $tr) {
               if ($tr['lang'] == $lf) {
                 $newtransl = $tr;
               }
             }?>

             <div class="form-group">
               <label class="control-label" for="title_<?php echo $lf;?>"><?php echo strtoupper($lf).' - '.$jkl["g16"];?></label>
               <input type="text" name="title_<?php echo $lf;?>" id="title_<?php echo $lf;?>" class="form-control" value="<?php if (isset($newtransl['title'])) echo $newtransl['title'];?>">
             </div>

             <?php if (is_array($newtransl) && !empty($newtransl)) { ?>
               <div class="form-check form-check-inline">
                 <label class="form-check-label">
                   <input class="form-check-input" type="checkbox" name="deltrans_<?php echo $lf;?>" value="<?php echo $lf;?>"> <?php echo $jkl["hd147"];?>
                   <span class="form-check-sign">
                     <span class="check"></span>
                   </span>
                 </label>
               </div>
               <hr>
             <?php } } ?>
           </div>
           <div class="card-footer">
             <a href="<?php echo JAK_rewrite::jakParseurl('customfield', 'options');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
             <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
           </div>
         </div>
       </div>
     </div>
   </form>

   <?php include_once 'footer.php';?>
