<section class="content-header">
  <div class="container-fluid">
    <div class="row mb-2">
      <div class="col-sm-6">
        <h1><?php echo $page_title; ?></h1>
      </div>
      <div class="col-sm-6 text-right">
        <ol class="breadcrumb float-sm-right">
          <li class="breadcrumb-item"><a href="<?php echo site_url('dashboard'); ?>">Dashboard</a></li>
          <li class="breadcrumb-item"><a href="<?php echo site_url('master/harlibur'); ?>">Hari Libur</a></li>
          <li class="breadcrumb-item active"><?php echo $row ? 'Edit' : 'Tambah'; ?></li>
        </ol>
      </div>
    </div>
  </div>
</section>

<section class="content">
  <div class="container-fluid">
    <div class="card card-danger card-outline" style="max-width:500px;">
      <div class="card-header"><h3 class="card-title"><i class="fa fa-calendar-plus-o mr-1"></i> Form Hari Libur</h3></div>
      <div class="card-body">
        <?php
          $action = $row ? site_url('master/harlibur/edit/'.$row->id_libur) : site_url('master/harlibur/tambah');
          echo form_open($action);
        ?>
        <div class="form-group">
          <label>Tanggal <span class="text-danger">*</span></label>
          <input type="date" name="tanggal"
                 class="form-control <?php echo form_error('tanggal') ? 'is-invalid' : ''; ?>"
                 value="<?php echo set_value('tanggal', $row->tanggal ?? ''); ?>">
          <?php if(form_error('tanggal')): ?><div class="invalid-feedback"><?php echo form_error('tanggal'); ?></div><?php endif; ?>
        </div>
        <div class="form-group">
          <label>Nama Hari Libur <span class="text-danger">*</span></label>
          <input type="text" name="nama_libur" maxlength="100"
                 class="form-control <?php echo form_error('nama_libur') ? 'is-invalid' : ''; ?>"
                 value="<?php echo html_escape(set_value('nama_libur', $row->nama_libur ?? '')); ?>"
                 placeholder="Contoh: Hari Raya Idul Fitri">
          <?php if(form_error('nama_libur')): ?><div class="invalid-feedback"><?php echo form_error('nama_libur'); ?></div><?php endif; ?>
        </div>
        <div class="form-group">
          <label>Jenis <span class="text-danger">*</span></label>
          <select name="jenis" class="form-control">
            <option value="NASIONAL"   <?php echo set_select('jenis','NASIONAL',($row->jenis??'NASIONAL')==='NASIONAL'); ?>>Hari Libur Nasional</option>
            <option value="PERUSAHAAN" <?php echo set_select('jenis','PERUSAHAAN',($row->jenis??'')==='PERUSAHAAN'); ?>>Hari Libur Perusahaan</option>
          </select>
        </div>
        <div class="d-flex justify-content-between">
          <a href="<?php echo site_url('master/harlibur'); ?>" class="btn btn-secondary"><i class="fa fa-arrow-left mr-1"></i> Kembali</a>
          <button type="submit" class="btn btn-danger"><i class="fa fa-save mr-1"></i> Simpan</button>
        </div>
        <?php echo form_close(); ?>
      </div>
    </div>
  </div>
</section>
