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

<div class="row">
  <div class="col-md-4">
    <div class="card">
      <div class="card-header card-header-icon card-header-success">
        <div class="card-icon">
          <i class="material-icons">add</i>
        </div>
        <h4 class="card-title "><?php echo $jkl["g175"];?></h4>
      </div>
      <div class="card-body">
        
        <?php if ($errors) { ?>
          <div class="alert alert-danger"><?php if (isset($errors["e"])) echo $errors["e"];
          if (isset($errors["e1"])) echo $errors["e1"];
          if (isset($errors["e3"])) echo $errors["e3"];
          if (isset($errors["e4"])) echo $errors["e4"];?></div>
        <?php } ?>
        
        <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
          
          <div class="form-group">
            <label class="control-label" for="path"><?php echo $jkl["g167"];?></label>
            <input type="text" name="path" class="form-control<?php if (isset($errors["e"])) echo " is-invalid";?>" value="<?php if (isset($_POST["path"])) echo $_POST["path"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="showalert"><?php echo $jkl["g191"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="showalert" value="1"<?php if (!isset($_POST["showalert"]) || isset($_POST["showalert"]) && $_POST["showalert"] == 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="showalert" value="0"<?php if (isset($_POST["showalert"]) && $_POST["showalert"] == 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="soundtype"><?php echo $jkl["g314"];?></label>
            <select name="jak_ringtone" id="soundtype" class="selectpicker play-tone col-12" data-live-search="true">
              <option <?php if (!isset($_POST["jak_ringtone"])) echo ' selected="selected"';?>>-</option>
              <?php if (isset($sound_files) && is_array($sound_files)) foreach($sound_files as $sfc) { ?><option value="<?php echo $sfc;?>"<?php if (isset($_POST["jak_ringtone"]) && $_POST["jak_ringtone"] == $sfc) echo ' selected="selected"';?>><?php echo $sfc;?></option><?php } ?>
            </select>
          </div>
          
          <div class="form-group">
            <label class="control-label" for="onsite"><?php echo $jkl["g194"];?></label>
            <select name="onsite" class="selectpicker col-12" data-live-search="true">
              <option value="1">1 <?php echo $jkl["g196"];?></option>
              <option value="5">5 <?php echo $jkl["g196"];?></option>
              <option value="15">15 <?php echo $jkl["g196"];?></option>
              <option value="30">30 <?php echo $jkl["g196"];?></option>
              <option value="60">1 <?php echo $jkl["g197"];?></option>
              <option value="120">2 <?php echo $jkl["g197"];?></option>
              <option value="180">3 <?php echo $jkl["g197"];?></option>
              <option value="240">4 <?php echo $jkl["g197"];?></option>
              <option value="300">5 <?php echo $jkl["g197"];?></option>
            </select>
          </div>
          
          <div class="form-group">
            <label class="control-label" for="visited"><?php echo $jkl["g195"];?></label>
            <select name="visited" class="selectpicker col-12" data-live-search="true">
              <?php for ($i = 1; $i <= 20; $i++) { ?>
                <option value="<?php echo $i ?>"><?php echo $i; ?> <?php echo $jkl["g198"];?></option>
              <?php } ?>
            </select>
          </div>
          
          <div class="form-group<?php if (isset($errors["e2"])) echo " has-danger";?>">
            <label class="control-label" for="title"><?php echo $jkl["g16"];?></label>
            <input type="text" name="title" id="title" class="form-control" value="<?php if (isset($_POST["title"])) echo $_POST["title"];?>" />
          </div>
          
          <div class="form-group<?php if (isset($errors["e"])) echo " has-danger";?>">
            <label class="control-label" for="imgpath"><?php echo $jkl["g265"];?></label>
            <input type="text" name="imgpath" id="imgpath" class="form-control" value="<?php if (isset($_POST["imgpath"])) echo $_POST["imgpath"];?>">
            <a href="javascript:void(0)" class="btn btn-info btn-sm btn-round btn-fab" onclick="md.showNotification('add_alert', '<?php echo addslashes($jkl["h19"]);?>', 'info', 'top', 'center')"><i class="material-icons">help</i></a>
          </div>
          
          <div class="form-group<?php if (isset($errors["e1"])) echo " has-danger";?>">
            <label class="control-label" for="response"><?php echo $jkl["g146"];?></label>
            <textarea name="message" class="form-control" rows="3"><?php if (isset($_POST["message"])) echo $_POST["message"];?></textarea>
          </div>

          <div class="form-group<?php if (isset($errors["e3"])) echo " has-danger";?>">
            <label class="control-label" for="btn-s"><?php echo $jkl["g281"];?></label>
            <input type="text" name="btn-s" id="btn-s" class="form-control" value="<?php if (isset($_POST["btn-s"])) echo $_POST["btn-s"];?>" />
          </div>

          <div class="form-group<?php if (isset($errors["e4"])) echo " has-danger";?>">
            <label class="control-label" for="btn-c"><?php echo $jkl["g282"];?></label>
            <input type="text" name="btn-c" id="btn-c" class="form-control" value="<?php if (isset($_POST["btn-c"])) echo $_POST["btn-c"];?>" />
          </div>
          
          <div class="form-actions">
            <button type="submit" name="insert_proactive" class="btn btn-primary btn-block"><?php echo $jkl["g38"];?></button>
          </div>

        </form>
      </div>
    </div>
  </div>
  <div class="col-md-8">
    <div class="card">
      <div class="card-header card-header-icon card-header-rose">
        <div class="card-icon">
          <i class="material-icons">cast</i>
        </div>
        <h4 class="card-title "><?php echo $jkl["g176"];?></h4>
      </div>
      <div class="card-body">

        <?php if (isset($PROACTIVE_ALL) && is_array($PROACTIVE_ALL) && !empty($PROACTIVE_ALL)) { ?>
          <div class="table-responsive">
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>#</th>
                  <th><?php echo $jkl["g167"];?></th>
                  <th><?php echo $jkl["g146"];?></th>
                  <th><?php echo $jkl["g47"];?></th>
                  <th><?php echo $jkl["g48"];?></th>
                </tr>
              </thead>
              <?php foreach($PROACTIVE_ALL as $v) { ?>
                <tr>
                  <td><?php echo $v["id"];?></td>
                  <td class="title"><a href="<?php echo JAK_rewrite::jakParseurl('proactive', 'edit', $v["id"]);?>"><?php echo $v["path"];?></a></td>
                  <td class="desc"><?php echo $v["message"];?></td>
                  <td><a class="btn btn-default btn-sm" href="<?php echo JAK_rewrite::jakParseurl('proactive', 'edit', $v["id"]);?>"><i class="fa fa-pencil"></i></a></td>
                  <td><a class="btn btn-danger btn-sm btn-confirm" href="<?php echo JAK_rewrite::jakParseurl('proactive', 'delete', $v["id"]);?>" data-title="<?php echo addslashes($jkl["g48"]);?>" data-text="<?php echo addslashes($jkl["e30"]);?>" data-type="warning" data-okbtn="<?php echo addslashes($jkl["g279"]);?>" data-cbtn="<?php echo addslashes($jkl["g280"]);?>"><i class="fa fa-trash"></i></a></td>
                </tr>
              <?php } ?>
            </table>
          </div>
        <?php } else { ?>

          <div class="alert alert-rose">
            <?php echo $jkl['i3'];?>
          </div>

        <?php } ?>

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

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