IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/hrms/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/hrms/employeedocs.blade.php

@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
    <div class="col-lg-5 col-md-5 col-sm-5">
        <div class="card">
            <div class="header">
                <h2><strong>Employee Document</strong></h2>
            </div>
            <div class="body">
                {!! Form::open(['url' => 'school/employeedocs', 'class' => 'form-horizontal','files'=>true]) !!}
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label">
                        <label for="classname" class="required">Select Department</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            {!! Form::select('idDepartment',$departments,null,['class' => 'form-control show-tick ms select2']) !!}
                            @if ($errors->has('idDepartment'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idDepartment') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label">
                        <label for="classname" class="required">Select Designation</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <select name='idDesignation' class="form-control show-tick ms"></select>
                            @if ($errors->has('idDesignation'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idDesignation') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label">
                        <label for="classname" class="required">Enrollement No</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <select name='idEmployee' class="form-control show-tick ms select2"></select>
                            @if ($errors->has('idEmployee'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idEmployee') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
<!--                <div class="row clearfix">
                     <div class="col-sm-5 form-control-label">
                        <label for="classname">Student Name</label>
                    </div>
                    <div class="col-sm-6">
                        <p class="form-control-static" id="stdName"></p>
                    </div>
                </div>-->
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label">
                        <label for="classname" class="required">Document Type</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            {!! Form::select('idDocType',$doctypes,null,['class' => 'form-control show-tick ms']) !!}
                            @if ($errors->has('idDocType'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idDocType') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label">
                        <label for="classname" class="required">Upload</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            {!! Form::file('document',null,['class' => 'form-control']) !!}
                            @if ($errors->has('document'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('document') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        {!! Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                        {!! Form::close() !!} 
                    </div>
                </div>
           
            </div>
        </div>
    </div>

    <div class="col-sm-7">
        <div class="card">
            <div class="header">
                <h2><strong>Empoyee Documents</strong></h2>
            </div>
            <div class="body table-responsive">
                {!! Form::open(['method' => 'GET',  'action' => ['School\StudentController@getStudentDocForm'], 'class' => 'form-horizontal']) !!}
                <div class="row clearfix">
                    <div class="col-sm-3 form-control-label">
                        <label for="classname">Financial Year</label>
                    </div>
                    <div class="col-sm-5">
                        <div class="form-group">
                           {!! Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']) !!}
                        </div>
                    </div>
                    <div class="col-sm-2">
                        {!! Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                    </div>
                </div>
                {!! Form::close() !!} 
                <br>
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable">
                    <thead>
                        <tr>
                            <th>S. No.</th>
                            <th>Name</th>
                            <th>Document Type</th>
                            <th>Uploaded At</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        @foreach($stddocs as $value)
                        <tr>
                            <th scope="row">{{$i}}</th>
                            <td>{{$value->firstName}} {{$value->middleName}} {{$value->lastName}}</td>
                            <td>{{$value->documentType}}</td>
                            <td>{{$value->updated_at}}</td>
                            <td>
                                <a href="{{url('school/employeedocs/'.$value->idStdDocument.'/view')}}"  target="_blank" class="btn btn-sm btn-info">View</a>
                                <a href="#" class="btn btn-sm btn-danger js-sweetalert" data-id="{{$value->idStdDocument}}">Delete</a>
                            </td>
                        </tr>
                        <?php $i++; ?>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@stop
@section('script')
<script>
$(document).ready(function() {
    $('select[name="idDepartment"]').on('change', function() {
        var departmentID = $(this).val();
        if(departmentID) {
            $.ajax({
                url: "{{url('/school/departments') }}"+'/' +departmentID + "/designations",
                type: "GET",
                dataType: "json",
                success:function(data) {
                    $('select[name="idDesignation"]').empty();
                    $('select[name="idDesignation"]').append('<option value="">-- Select Designation --</option>');
                    $.each(data, function(key, value) {
                       $('select[name="idDesignation"]').append('<option value="'+key+'">'+value+'</option>');

                    });
                }
            });
        }else{
            $('select[name="idDesignation"]').empty();
        }
    });
    
        $('select[name="idDesignation"]').on('change', function() {
            var designationIds = $(this).val();
            if(designationIds) {
                $.ajax({
                    url: "{{url('/school/designations') }}"+'/' +designationIds + "/employees",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('select[name="idEmployee"]').empty();
                        $('select[name="idEmployee"]').append('<option value="">--- Select ---</option>');
                        $.each(data, function(key, value) {
                            $('select[name="idEmployee"]').append('<option value="'+ key +'">'+ value +'</option>');
                        });
                    }
                });
            }else{
                $('select[name="idSection"]').empty();
            }
        });
       
    });
$(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 document!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "POST",
                url: "{{url('/school/employeedocs/')}}" +"/"+id + "/delete",
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Document has been successfully deleted", 
                    type: "success"
                },function() {
                    location.reload();
                });
            })
            .error(function(data) {
              swal("Oops", "We couldn't connect to the server!", "error");
            });
            return false;
    });
});
</script>
@stop

Copyright © 2021 - 2025 IMMREX7