<?php
/*
 * *************************************************
 * Copyright (C) 2021 Earworks.                    *
 * Codeigniter Project Template Modification       *
 * Please contact our email for more information : *
 * contact@earworks.co.id                          *
 * *************************************************
 */

defined('BASEPATH') OR exit('No direct script access allowed');
Ci::set_title($form->nama);
?>

<section class="container page-ctn">
    <?= form_open_multipart(current_url() . '?redir=' . $redir) ?>
    <div class="row box">
        <div class="col-sm-8 col-sm-offset-2">
            <h1 class="page-title text-center"><?= $form->nama ?></h1>
            <p style="text-align:justify;font-size:16px;"><?= $form->keterangan ?></p>

            <?php $error_email = isset($errors['email']) ? ' has-error' : null; ?>
            <div class="form-group<?= $error_email ?>">
                <?= lang('email', [], 'email', ['class' => 'control-label']) ?>
                <?= form_input('email', $data_user['email'], ['class' => 'form-control', 'autocomplete' => 'off']) ?>
                <?php if (isset($errors['email'])) : ?>
                    <p class="help-block"><?= $errors['email'] ?></p>
                <?php endif; ?>
            </div>
            <?php $error_sertifikat = isset($errors['sertifikat']) ? ' has-error' : null; ?>
            <div class="form-group<?= $error_sertifikat ?>">
                <?= lang('sertifikat_long_label', [], 'sertifikat', ['class' => 'control-label']) ?>
                <?= form_input('sertifikat', $data_user['sertifikat'], ['class' => 'form-control', 'autocomplete' => 'off']) ?>
                <?php if (isset($errors['sertifikat'])) : ?>
                    <p class="help-block"><?= $errors['sertifikat'] ?></p>
                <?php endif; ?>
            </div>
            <br /><br />
            <?= Ci::partials('layouts/generate_form', ['pertanyaan' => $pertanyaan, 'errors' => $errors, 'jawaban' => $jawaban]) ?>
            <div class="form-group text-center">
                <button type="submit" class="btn btn-primary btn-block" style="margin:0px auto;"> Submit Kuisioner </button>
            </div>
        </div>
    </div>
    <?= form_close() ?>
</section>
<?php
// select2
Ci::set_style('plugins/select2/css/select2.min.css', 'plugin');
Ci::set_style('plugins/select2/css/select2-bootstrap.min.css', 'plugin');
Ci::set_script('plugins/select2/js/select2.min.js', 'plugin');
Ci::set_script(<<<EOD
    var form_script = function () {
        var the;
        return {
            init: function () {
                the = this;
                $('.select2').select2({placeholder: "Select an option"});
            }
        };
    }();
    $(document).ready(function () {
        form_script.init();
    });
EOD
    , 'embed');
