IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/37e5e12e46e1c4c5af3a2537a3cca6bd0606679a.php

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong><?php if(isset($template)): ?>Edit <?php else: ?>  Add <?php endif; ?></strong>Template</h2>
            </div>
            <div class="body">
                <?php if(isset($template)): ?>
                <?php echo Form::model( $template, ['route' => ['examtemplates.update', $template->idTemplate], 'method' => 'put','class'=>'form-horizontal'] ); ?>

                <?php else: ?>
                <?php echo Form::open(['url' => 'school/examtemplates','class'=>'form-horizontal','id'=>'form']); ?>

                <?php endif; ?>
                
                
                <div class="row clearfix">
                    <?php if(isset($template)): ?>
                       <div class="col-sm-4 form-control-label required">
                            <label for="classname">Template Name</label>
                        </div>
                        <div class="col-sm-6">
                            <div class="form-group">
                                <?php echo Form::text('templateName',null,['class' => 'form-control','required'=>'required']); ?>

                                <?php if($errors->has('templateName')): ?>
                                <label id="minmaxlength-error" class="error" for="minmaxlength">
                                    <strong><?php echo e($errors->first('templateName')); ?></strong>
                                </label>
                                <?php endif; ?>
                            </div>
                        </div>
                    <?php else: ?>
                    <table class="table">
                    <thead>
                        <tr>
                            <th></th>
                            <th>Template Name</th>
                            <th>Exam Type</th>
                            <!--<th>Class</th>-->
                            <th>Size</th>
                            <th>File</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody  id="optional_list">
                      
                        <?php $i =1;?>
                        <tr>
                            <td class="sno"><?php echo e($i); ?></td>
                            <td style="max-width: 250px;min-width: 150px">
                                <?php echo Form::text('templates[1][templateName]',null,['class' => 'form-control','required'=>'required','placeholder'=>'Enter Name']); ?>

                            </td>
                            <td>
                                <?php echo Form::select('templates[1][idExamType]',$types,null,['class' => 'form-control select2 show-tick ms','required'=>'required']); ?>

                            </td>
                            <!--
                            <td style="max-width: 250px;min-width: 150px">
                                <?php echo Form::select('templates[1][idClass][]',$classes,null,['required'=>'required','multiple'=>'multiple']); ?>

                            </td>
                            -->
                            <td style="width: 200px;">
                                <?php echo Form::select('templates[1][size]',$sizes,null,['class' => 'form-control select2 show-tick ms','required'=>'required','id'=>'size_custom','data-id'=>'1']); ?><br>
                                <!--
                                <div style="margin: 5px;display:none;" id="custom_1">
                                     <?php echo Form::text('templates[1][width]',null,['class' => 'form-control','placeholder'=>'Width']); ?>


                                    <?php echo Form::text('templates[1][height]',null,['class' => 'form-control','placeholder'=>'Height']); ?>

                                </div>
                                 -->
                            </td >
                            <td><?php echo Form::file('templates[1][image]',null,['class' => 'form-control']); ?></td>
                            <td></td>
                       </tr>
                        <?php $i++ ; ?>
                    </tbody>
                    <tr>
                            <td colspan="4" style="text-align: right"><input type="button" class="add-row btn btn-sm btn-success" value="Add Row"></td>
                        </tr>
                </table>
                    <?php endif; ?>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        <?php if(isset($template)): ?>
                        <?php echo Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                        <?php else: ?>
                        <?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                        <?php endif; ?>
                        <?php echo Form::close(); ?> 
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>List Of  Exam Templates </strong></h2>
            </div>
            <div class="body table-responsive">
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable">
                    <thead>
                        <tr>
                            <th>S.NO.</th>
                            <th>Name</th>
                            <th>Exam Type</th>
                            <th>Size</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1;?>
                        <?php $__currentLoopData = $templates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                        <tr>
                            <td><?php echo e($i); ?></td>
                            <td><?php echo e($var->templateName); ?></td>
                            <td><?php echo e($var->typeName); ?></td>
                            <td><?php echo e($var->size); ?></td>
                            <td>
                                <a href='<?php echo e(url('/school/examtemplates/'.$var->idTemplate.'/edit')); ?>'  class="btn btn-raised btn-info waves-effect btn-round"><i class="fa fa-edit"></i>Edit</a>
                                <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($var->idTemplate); ?>" data-type="confirm">DELETE</button>
                            </td>
                        </tr>
                        <?php $i++; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
    $( "#size_custom" ).change(function() {
        var id = $(this).data('id');
        if( $(this).val() == 'custom') 
        {
            $("#custom_"+id).show();
            $("#custom_"+id).css('display','inline-flex')
        }
        else $("#custom_"+id).hide();
    });
    var i = $('.sno:last').text();
    $(".add-row").click(function(){
        i++;  
        //<td><select name="templates['+i+'][idClass][]" required="required" multiple="multiple"><?php $__currentLoopData = $classes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($key); ?>"><?php echo e($value); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></td>\n\
        var markup = '<tr><td class="sno">'+i+'</td>\
                <td><input class="form-control" type="text" name="templates['+i+'][templateName]" required="required"  placeholder = "Enter Name"><span id="depterror'+i+'"></span></td>\n\
                <td><select name="templates['+i+'][idExamType]" class = "form-control  show-tick ms" required="required"><?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($key); ?>"><?php echo e($value); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></td>\n\
                <td><select name="templates['+i+'][size]" class = "form-control  show-tick ms" required="required" id="size_custom" data-id="'+i+'"  ><?php $__currentLoopData = $sizes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($key); ?>"><?php echo e($value); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select><div style="display: none;margin: 5px;" id="custom_'+i+'"><input class="form-control" placeholder="Width" name="templates[1][width]" type="text"><input class="form-control" name="templates[1][height]" type="text"></div></td>\n\
                <td><input name="templates['+i+'][image]" type="file"></td>\n\
                <td style="text-align:right;vertical-align: middle;"><input type="button" class="btn btn-sm btn-danger" value="Delete" id="remove_row"></td></tr>';
            setTimeout(function(){
                $('.datepicker').datepicker({
                    autoclose: true,
                    format: 'dd-mm-yyyy',
                    todayBtn:true,
                    todayHighlight:true,
                    orientation: 'auto'
                  });
            }, 100);
            $("#optional_list").append(markup);
    });
    
    $('#optional_list').on('click', 'input[type="button"]', function () {
        $(this).closest('tr').remove();
         i = $('.sno:last').text();
         
    });
    //Add Input field if others is selecyted
});
$(document).on('click', '.js-sweetalert', function (e) {
    $.ajaxSetup({
        headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    e.preventDefault();
    var id = $(this).data('id');
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to delete this  Template!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "<?php echo e(url('/school/examtemplates/')); ?>" +"/"+id,
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Template has been successfully deleted", 
                    type: "success"
                },function() {
                    location.reload();
                });
            })
            .error(function(data) {
              swal("Oops", "We couldn't connect to the server!", "error");
            });
            return false;
    });
});
// Saving form data
$('#form').on('submit',function(e){
    $.ajaxSetup({
    header:$('meta[name="_token"]').attr('content')
});
 var formData =  new FormData($('#form')[0]);
 $("#submit-btn").prop('disabled', true);
    $.ajax({
        type:"POST",
        url: "<?php echo e(url('school/examtemplates')); ?>",
        processData: false,
        contentType: false,
        data:formData,
        dataType: 'json',
        success:function(data){
            if( data[Object.keys(data)[0]] === 'SUCCESS' ){
                $("#submit-btn").prop('disabled', true);
                window.location = "<?php echo e(url('school/examtemplates')); ?>";
            }
            else {                  //False Case: With error msg
                $("#msg").html(data);   //$msg is the id of empty msg
            }
        },

        error: function(data){
                if( data.status === 422 ) {
                    $("#submit-btn").prop('disabled', false);
                    var errors = data.responseJSON.errors;
                    var errorHtml = '<div class="alert alert-danger"><ul>';
                       $('#formerrors').html(errorHtml);
                            $.each(errors, function (key, value) {
                                if (key.split(".")[1] + '.templateName' === key.split(".")[1] + '.' + key.split(".")[2])
                                {
                                    errordept = '<span class="help-block">' + value + '</span>';
                                    $('#depterror' + key.split(".")[1]).html(errordept);
                                }
                    });
                }
            }
    });
    return false;
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7