IMMREX7

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

@extends('schools.school_layout')
@section('content')
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Member List</strong></h2>
            </div>
            <div class="body">
               {!! Form::open(['method' => 'GET',  'action' => ['School\Library\MemberController@index'],'class' => 'form-horizontal']) !!}
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Member Type</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                             {!! Form::select('type',['student'=>'Student','employee'=>'Staff'],null,['class' => 'form-control show-tick ms','required'=>'required']) !!}
                        </div>
                    </div>
                    <div class="col-sm-2">
                        {!! Form::submit('SHOW',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                        {!!Form::close()!!}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@if(isset($type) && $type == 'student')
@if(count($members)>0)
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="body table-responsive">
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable">
                    <thead>
                        <tr>
                            <th>Ec.No.</th>
                            <th>Name</th>
                            <th>Father</th>
                            <th>Mobile</th>
                            <th>DOB</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>Ban Member</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($members as $var)
                        <tr>
                            <td>{{$var->ecNo}}</td>
                            <td>{{$var->firstName}} {{$var->middleName}} {{$var->lastName}}</td>
                            <td>{{$var->father_fname}} {{$var->father_lname}}</td>
                            <td>{{$var->father_mobile}}</td>
                            <td>{{$var->studentDob}}</td>
                            <td>{{$var->className}}</td>
                            <td>{{$var->sectionName}}</td>
                            <td>
                                 <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-type="student" data-id="{{$var->idStudent}}" data-type="confirm">BAN</button>
                                <!--<a href="{{url('school/members/student/'.$var->idStudent.'/ban')}}" class="btn btn-sm btn-danger">BAN</a>-->
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endif
@endif

@if(isset($type) && $type == 'employee')
@if(count($members)>0)
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="body table-responsive">
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable">
                    <thead>
                        <tr>
                            <th>Ec.No.</th>
                            <th>Name</th>
                            <th>Mobile</th>
                            <th>Department</th>
                            <th>Designation</th>
                            <th>Ban Member</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($members as $var)
                        <tr>
                            <td>{{$var->enrollmentNo}}</td>
                            <td>{{$var->firstName}} {{$var->middleName}} {{$var->lastName}}</td>
                            <td>{{$var->mobile}}</td>
                            <td>{{$var->departmentName}}</td>
                            <td>{{$var->designationName}}</td>
                            <td>
                                <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-type="employee" data-id="{{$var->idEmployee}}" data-type="confirm">BAN</button>
                                <!--<a href="{{url('school/members/employee/'.$var->idEmployee.'/ban')}}" class="btn btn-sm btn-danger">BAN</a>-->
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endif
@endif

@stop
@section('script')
<script>
$(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');
    var type = $(this).data('type');
    var remarks = '';
    swal({
            title: "Are you sure?",
            text: "Add Remarks!",
            type: "input",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, Ban it!",
            animation: "slide-from-top",
	    inputPlaceholder: "Enter Remarks here",
            closeOnConfirm: false
        },
        function(inputValue) {
			//added for prompt remarks input
			if (inputValue === false) return false;
			if (inputValue === "") {
				swal.showInputError("Please Add Your Remarks Here!"); return false
			}else{
			//end
			//console.log('here');
				$.ajax({
					type: "GET",
					url: "{{url('/school/members/')}}" +"/"+type+ "/" +id+"/ban",
					 data: {id:id,type:type,remarks:inputValue}
				})
				.done(function(data) {
					swal({
						title: "Banned", 
						text: "Member has been banned successfully", 
						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