<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from akademi.dexignlab.com/codeigniter/demo/student by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 06 Mar 2024 10:51:33 GMT -->
<!-- Added by HTTrack -->
<meta http-equiv="content-type" content="text/html;charset=UTF-8" /><!-- /Added by HTTrack -->

<head>
    <!-- Title -->
    <title> Add Faculty</title>
    <!-- Meta -->

    <style>
        .custom-card {
            margin-top: 200px;
        }
    </style>

</head>

<body>

    <div class="row p-5 custom-card">
        <div class="col-lg-12">
            <div class="card ">
                <div class="card-body">
                    <h3 class="">Add Faculty</h3>
                    <br>
                    <form action="<?php echo base_url(); ?>ApplicationController/store" method="post" enctype="multipart/form-data" id="registration_form">
                    
                    <div class="row">
                        <div class="form-group col-md-4">
                            <label >Name</label>
                            <input type="text" class="form-control" name="facultyname" placeholder="name" required>
                        </div>
                        <div class="form-group col-md-4">
                            <label >Mobile</label>
                            <input name="mobile" id="mobile" type="number" class="form-control" placeholder="Mobile_number" value="<?php echo (isset($_POST[''])) ? $_POST[''] : ''; ?>" required>
                            <?php if ($this->session->flashdata('mobile')) : ?>
                                <span style="color: red;"><?= $this->session->flashdata('mobile') ?></span>
                                <?php unset($_SESSION['mobile']); ?>
                            <?php endif;  ?>
                        </div>
                        <div class="form-group col-md-4">
                            <label >Email</label>
                            <input name="email" id="email" type="email" class="form-control" placeholder="Email" value="<?php echo (isset($_POST[''])) ? $_POST[''] : ''; ?>" required>
                            <?php if (form_error('email')) { ?>
                                <div id="summernote" class="alert alert-danger alert-dismissible fade show" role="alert">
                                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                        <span aria-hidden="true">×</span>
                                    </button>
                                    <?php echo form_error('email'); ?>
                                </div>
                            <?php } ?>
                        </div>

                        <div class="form-group col-md-4 mt-3">
                                        <label for="login_pass" class="form_label">Password</label>
                                        <div class="control">
                                            <input type="password" name="password" id="login_pass" class="form-control password" autocomplete="off" placeholder="Password" />

                                            <!-- <span class="input-group-text">
                                                <i class="eye showPwd1"></i>
                                            </span> -->

                                            <?php if (form_error('password')) {?>
                                            <div class="alert alert-danger alert-dismissible fade show pb-0 mt-1" role="alert">
                                                <?php echo form_error('password'); ?>
                                            </div>
                                        <?php }?>
                                            

                                        </div>
                                    </div>


                                    <div class="form-group col-md-4 mt-3">
                                        <label for="login_pass" class="form_label">confirm Password</label>
                                        <div class="control">
                                            <!-- <input type="password" name="Password" id="login_pass" class="form-control password" autocomplete="off" placeholder="Enter password" /> -->
                                            <input type="password" name="c_password" id="login_pass2" class="form-control password2" autocomplete="off" placeholder="Confirm password" />
                                            
                                            <!-- <span class="input-group-text">
                                                <i class="eye showPwd2"></i>
                                            </span>  -->

                                            <?php if (form_error('c_password')) {?>
                                            <div class="alert alert-danger alert-dismissible fade show pb-0 mt-1" role="alert">
                                                <?php echo form_error('c_password'); ?>
                                            </div>
                                        <?php }?>

                                        </div>
                                    </div>



                       
                    </div>
                    <div class="form-group mt-3 col-md-4">
                            <div class="">
                                <button name="submit" type="submit" class="btn btn-primary waves-effect waves-light mr-1">
                                    Submit
                                </button>
                                <a href="<?php echo base_url('ApplicationController/faculty'); ?>" class="btn btn-secondary waves-effect">Cancel </a>
                            </div>
                        </div>
                    
                </form>

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







</body>

</html>

<script>
    function edit(id, name) {
        $('#tution_name_err').text(' ')

        $('#id').val(id)
        $('#tution_name').val(name)
        $('#formTitle').text('Edit Tution')

        $("#tutionModal").modal('show');

    }

    function deletetution(id, status) {

        $('#tutionId').val(id)
        $('#tutionStatus').val(status)
        $("#statusModal").show();
    }

    $('#open-modal').on('click', function() {

        $("#tutionModal").modal('show');
    });

    $('.closemodel').on('click', function() {

        $("#statusModal").hide();
    });

    $(document).ready(function() {
        $('#registration_form').validate({
            rules: {
                facultyname: {
                    required: true
                },
                mobile: {
                    required: true,
                    number: true
                },
                email: {
                    required: true,
                    email: true
                },
                Password: {
                    required: true
                },
                confirm_password: {
                    required: true,
                    equalTo: "#Password" // Ensure it matches the password field
                }
            },
            messages: {
                facultyname: {
                    required: "Please enter your name"
                },
                mobile: {
                    required: "Please enter your mobile number",
                    number: "Please enter a valid mobile number"
                },
                email: {
                    required: "Please enter your email address",
                    email: "Please enter a valid email address"
                },
                Password: {
                    required: "Please enter a password"
                },
                confirm_password: {
                    required: "Please confirm your password",
                    equalTo: "Passwords do not match"
                }
            },
            errorElement: 'span',
            errorPlacement: function(error, element) {
                error.addClass('invalid-feedback');
                element.closest('.form-group').append(error);
            },
            highlight: function(element, errorClass, validClass) {
                $(element).addClass('is-invalid');
            },
            unhighlight: function(element, errorClass, validClass) {
                $(element).removeClass('is-invalid');
            }
        });
    });


    let pwd1 = document.getElementById('login_pass'),
        eye1 = document.querySelector('.showPwd1');

    eye1.addEventListener('click', function() {
        toggleType1();
    })


    function toggleType1() {

        if (eye1.classList.contains('closed')) {
            pwd1.type = 'password';
        } else {
            pwd1.type = 'text';
        }
        eye1.classList.toggle('closed');
    }
    //end of password toggle


    //start of confirm password toggle
    let pwd2 = document.getElementById('login_pass2');
    eye2 = document.querySelector('.showPwd2');

    eye2.addEventListener('click', function() {
        toggleType2();
    })


    function toggleType2() {

        if (eye2.classList.contains('closed')) {
            pwd2.type = 'password';
        } else {
            pwd2.type = 'text';
        }
        eye2.classList.toggle('closed');
    }
</script>