无法显示学生摘要视图,但在员工视图中工作正常

时间:2019-10-15 10:12:02

标签: php laravel

我想从多种关系中以一种视图显示学生交易的摘要。我员工的观点很好用

我降级了PHP版本,它在员工事务中运行良好,而在学生看来,这是行不通的

        @extends ('layouts.report')



    @section('content')


    <div id="breadcrumb">
        <div class="container"> 
            <div class="breadcrumb">                            
                <li class="breadcrumb-item"><a href="{{url('home')}}">Home</a></li>
                <li><a href="">Reports</a></li> 
                <li>Search_Student</li>            
            </div>      
        </div>  
    </div>
    <br>
        <section id="reports">
                    <div class="container-fluid">
                        <div class="row row-offcanvas row-offcanvas-left">        
                                <div class="col-xs-12 col-sm-2 sidebar-offcanvas" id="sidebarLeft" role="navigation">
                                    <div class="well sidebar-nav">
                                        <ul class="nav nav-pill">    

                                            <li role="presentation"><a href="{{url('reports/hepa')}}" >HEPA-B</a></li>
                                            <li role="presentation"><a href="{{url('reports/referral')}}">REFERRAL</a></li>
                                            <li role="presentation"><a href="{{url('reports/med')}}">MEDICINE</a></li>
                                            <li role="presentation"><a href="{{url('reports/infirmary')}}">INFIRMARY</a></li>                        
                                            <li role="presentation"><a href="{{url('reports/physical')}}">PHYSICAL EXAM</a></li>
                                            <li role="presentation"><a href="{{url('reports/inhalation')}}">USN INHALATION</a></li>
                                            <li role="presentation"><a href="{{url('reports/wound')}}">WOUND DRESSING</a></li>
                                            <li role="presentation"><a href="{{url('reports/dental')}}">DENTAL-CHECK UP </a></li>
                                            <li role="presentation"><a href="" class="active">SEARCH STUDENT</a></li>
                                        </ul>
                                    </div>
                                    <!--/.well -->

                                </div>
                        <div class="tab-content">
                            <!--hepa-->
                            <div class="active">
                                    <div class="panel panel-inf">                             
                                            <div class="panel-heading"><p><h4>STUDENT TRANSACTIONS</h4></p></div> 

                                            <form id="search-student" method="POST" role="search">
                                                @csrf
                                                <div class="form-inline mr-auto">
                                            <input class="form-control" type="text" placeholder="Search for Student ID" name="q"aria-label="Search">
                                            <button class="btn btn-mdb-color btn-rounded btn-sm my-0 ml-sm-2" type="submit">Search</button>
                                            </form>


                                        </div>
                                        <br>
                                        <div id="results-form">

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

    </section>

    <script src="{{asset ('js/popper.min.js') }}"></script>
    <script src="{{asset('js/bootstrap4_1.min.js')}}"></script>  
    <script src="{{asset ('js/wow.min.js') }}"></script>
    <script src="{{asset ('js/functions.js') }}"></script> 
    <script src="{{asset ('js/sweetalert2.all.js') }}"></script>
    <script src="{{asset('js/jquery.min.js')}}"></script>
    <script src="{{asset('js/bootstrap3_7.min.js')}}"></script>
    <script src="{{ asset('js/axios.min.js') }}"></script>
    <script src="{{ asset('js/toastr.min.js') }}"></script>
    <script src="{{ asset('/js/jquery.dataTables.min.js') }}"></script>
    <script src="{{ asset('/js/dataTables.bootstrap4.min.js') }}"></script>

    <script>
    $('#search-student').submit(function(event){
        event.preventDefault();
        var route = '{{ url('students/student_sview') }}';
        var data = $('#search-student').serialize();
        axios.post(route, data)
        .then(response => {
            $('#results-form').html(response.data);
        })
        .catch(response => {
            console.log(response.data);
        });
    });

    </script>

    @endsection 


<style>
    .img-with-text{
        text-align: left;
        width:100%;
        color: black;
        font-size: 20px;
    }

    .img-with-text img{
        display:block;
        margin: none;
        height: 230px;
        width: 210px;

    }
    .grid-container {
        display: grid;
        grid-template-columns: auto auto auto auto;
        grid-gap: 10px;
        background-color: #2196F3;
        padding: 10px;
    }
    .grid-container>div {
        background-color: rgba(255, 255, 255, 0.8);
        text-align: center;
        padding:20px 0;
        font-size: 30px;
    }
</style>
<section id="search-student">
            <br>
        <div class="container"> 
                <div class="row">           
            @if($student != null)
            <div class="img-with-text">
                        <div class="col-xs-4 col-sm-3">  
                <img src="{{URL::asset('/images/img_avatar2.png')}}" class="img-rounded" alt="" align="middle">
                            </div>
                        <div class="col-xs-8 col-sm-6">  



                <p><h4><b>Name: {{$student->firstname}}&nbsp;{{$student->middlename}}&nbsp;{{$student->lastname}}</b></h4></p>
                <p><h4><b>Year & Section: {{$student->dental[0]->yearSection}}</b></h4></p>   


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

            <div class="row">
                <div class="col-xs-8 col-sm-4">  
                    <table class="table table-striped">     
                        <thead>
                            <tr>
                                <th scope="col">HEPA</th>
                            </tr>
                        </thead>     
                        @foreach($student->hepa as $hepa)

                        <tr>
                            <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($hepa->created_at)->format('F d, Y h:m:s a')}}</td>
                        </tr>
                        @endforeach 
                    </table> 
                        <table class="table table-striped">                    
                        <thead>
                            <tr>
                                <th scope="col">MEDICINE</th>
                            </tr>
                        </thead>     
                        @foreach($student->med as $med)
                        <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($med->created_at)->format('F d, Y h:m:s a')}}</td>
                        @endforeach
                        </table>
                        <table class="table table-striped">  
                        <thead>
                            <tr>
                                <th scope="col">REFERRAL</th>
                            </tr>
                        </thead>     
                        @foreach($student->referral as $ref)
                        <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($ref->created_at)->format('F d, Y h:m:s a')}}</td>
                        @endforeach
                        </table>

                </div>
                <div class="col-xs-8 col-sm-4">  
                        <table class="table table-striped"> 
                            <thead>
                                <tr>
                                    <th scope="col">DENTAL</th>
                                </tr>
                            </thead> 

                             @foreach($student->dental as $dental)
                            <tr>
                                <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($dental->created_at)->format('F d, Y h:m:s a')}}</td>
                            </tr>
                            @endforeach
                        </table>
                        <table class="table table-striped"> 
                            <thead>
                                <tr>
                                    <th scope="col">INHALATION</th>
                                </tr>
                            </thead>     
                            @foreach($student->usn as $usn)
                            <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($usn->created_at)->format('F d, Y h:m:s a')}}</td>
                            @endforeach
                        </table>
                        <table class="table table-striped">  
                                <thead>
                                    <tr>
                                        <th scope="col">PHYSICAL EXAM</th>
                                    </tr>
                                </thead>     
                                @foreach($student->pe as $pe)
                                <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($pe->created_at)->format('F d, Y h:m:s a')}}</td>
                                @endforeach
                                </table>

                    </div>
                    <div class="col-xs-8 col-sm-4">  

                            <table class="table table-striped"> 
                                <thead>
                                    <tr>
                                        <th scope="col">WOUND DRESSING</th>
                                    </tr>
                                </thead> 

                                @foreach($student->wound as $wound)
                                <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($wound->created_at)->format('F d, Y h:m:s a')}}</td>
                                @endforeach
                            </table>
                            <table class="table table-striped"> 
                                <thead>
                                    <tr>
                                        <th scope="col">INFIRMARY</th>
                                    </tr>
                                </thead>     
                                @foreach($student->infi as $infi)
                                <td class="rows">&nbsp;&nbsp;&nbsp;{{Carbon\Carbon::parse($infi->created_at)->format('F d, Y h:m:s a')}}</td>
                                @endforeach

                            </table>
                        </div>


                @else
                <h5>No Results Found</h5>
                @endif
            </div>
        </div>

</section>            

<!-- if no container ga error -->
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">


    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>Riverside College Clinic Management</title>
    <link rel="icon" type="image/png" href="{{asset('images/logo.png')}}" id="favicon">

    <!-- Scripts -->
    <!-- <script src="{{ asset('js/app.js') }}" defer></script> -->

    <!-- Fonts -->

    <!-- Styles -->
    <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">  -->
    <link href="{{asset('css/bootstrap.min.css')}}" rel="stylesheet"/>
    <link rel="stylesheet" href="{{asset('css/font-awesome.min.css')}}"/>
    <link rel="stylesheet" href="{{asset('css/animate.css')}}"/>
    <link href="{{asset('css/prettyPhoto.css')}}" rel="stylesheet"/>
    <link href="{{asset('css/style.css')}}" rel="stylesheet" /> 
    <link href="{{asset('css/toastr.min.css')}}" rel="stylesheet"/>   

    <script src="{{asset('js/jquery-3.3.1.slim.min.js')}}"></script>
</head>
<style>
    img {

        border-radius: 50%;

    }
</style>
<body>

    <div id="app">
        <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
            <div class="navigation">

                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse.collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <div class="navbar-brand">                          
                        <img src="{{URL::asset('/images/logo.png')}}" alt="img_logo" width="70" height="70" align="left" hspace="20"><h1>Clinic Management System</h1>                         
                    </div>
                </div>

                <div class="navbar-collapse collapse">                          
                    <div class="menu">
                        <ul class="nav nav-tabs" role="tablist">
                            <li role="navigation"><a href="{{url('home')}}">Home</a></li>
                            <li role="navigation"><a href="{{url('about')}}">About Us</a></li>
                            <li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    Services
                                </a>
                                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                    <a class="dropdown-item" href="{{url('services')}}"><center>Students</center></a>
                                    <a class="dropdown-item" href="{{url('Employees/servicesEmp')}}">Employees</a>
                                </li>                    
                                <li class="nav-item dropdown">
                                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                        Reports
                                    </a>
                                    <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                        <a class="dropdown-item" href="{{url('reports/hepa')}}"><center>Students</center></a>
                                        <a class="dropdown-item" href="{{url('EmpReport/EmpHepa')}}">Employees</a>
                                    </li>              
                                    <li class="nav-item dropdown">
                                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            <img src="{{URL::asset('images/'.auth()->user()->username.'.jpg')}}" alt="img_logo"  width="50" height="50" vertical-align="middle">
                                        </a>
                                        <div class="dropdown-menu dropdown-menu-right dropdown-info" aria-labelledby="navbarDropdownMenuLink-4">
                                            <a class="dropdown-item" href="#">My Account</a>                                                 
                                            <a class="dropdown-item" href="{{url('registerEmp')}}">Add Employee</a>  
                                            <a class="dropdown-item" href="{{url('registerStudent')}}">Add Student</a>   
                                            <a class="dropdown-item" href="{{url('register')}}">Add User</a>                                                                                    
                                            <a class="dropdown-item" onclick="showAlert()">Log Out</a>
                                        </div>
                                    </li>
                                    <form action="{{ route('logout') }}" method="POST" id="logout" style="display: hidden;">
                                        {{ csrf_field() }}
                                    </form> 

                                </li>       
                            </ul>

                        </div>
                    </div>                      

                </div>  
            </nav>
        </div>
        <div>@yield('content')</div>
        <script src="{{asset('js/jquery.min.js')}}"></script>
        <script src="{{asset('js/bootstrap3_7.min.js')}}"></script>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.2/html5shiv.js"></script>
        <script src="{{asset('js/respond.min.js')}}"></script>
        <script src="{{asset('js/axios.min.js')}}"></script>
        <script src="{{asset('js/sweetalert2.all.js')}}"></script>
        <link href="{{asset('css/toastr.min.css')}}" rel="stylesheet"/>
        <script src="{{asset('js/jquery.dataTables.min.js')}}"></script>
        <script src="{{asset('js/dataTables.jqueryui.js')}}"></script>
        <link rel="stylesheet" href="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
        <link rel="stylesheet" href="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/jqueryui/dataTables.jqueryui.css">


        <script type="text/javascript">
            function showAlert(){
                swal({
                    title: 'Are you sure?',
                    text: "You will be logged out of the system",
                    type: 'question',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                }).then((result) => {
                    if (result.value) {
                        $('#logout').submit();
                    }
                });
            }
        </script>
        <script src="{{ asset('/js/axios.min.js') }}"></script>

    </body>


    </html>

对于员工

@extends ('layouts.report')

    <link rel="stylesheet" href="{{asset('css/bootstrap.min.css')}}">

@section('content')


<div id="breadcrumb">
    <div class="container"> 
        <div class="breadcrumb">                            
            <li class="breadcrumb-item"><a href="{{url('home')}}">Home</a></li>
            <li><a href="">Reports</a></li> 
            <li>Search_Employee</li>            
        </div>      
    </div>  
</div>
<br>
    <section id="reports">
                <div class="container-fluid">
                    <div class="row row-offcanvas row-offcanvas-left">        
                            <div class="col-xs-12 col-sm-2 sidebar-offcanvas" id="sidebarLeft" role="navigation">
                                <div class="well sidebar-nav">
                                    <ul class="nav nav-pill">    

                                        <li role="presentation"><a href="{{url('EmpReport/EmpHepa')}}">HEPA-B</a></li>
                                        <li role="presentation"><a href="{{url('EmpReport/EmpReferral')}}">REFERRAL</a></li>
                                        <li role="presentation"><a href="{{url('EmpReport/EmpMedicine')}}">MEDICINE</a></li>
                                        <li role="presentation"><a href="{{url('EmpReport/EmpInfirmary')}}">INFIRMARY</a></li>
                                        <li role="presentation"><a href="{{url('EmpReport/EmpPe')}}">PHYSICAL EXAM</a></li>
                                        <li role="presentation"><a href="{{url('EmpReport/EmpInhalation')}}">USN INHALATION</a></li>
                                        <li role="presentation"><a href="{{url('EmpReport/EmpWound')}}">WOUND DRESSING</a></li>
                                        <li role="presentation"><a href="{{url('EmpReport/EmpDental')}}">DENTAL-CHECK UP</a></li>
                                        <li role="presentation"><a href="" class="active">SEARCH EMPLOYEE</a></li>
                                    </ul>
                                </div>
                                <!--/.well -->
                            </div>           
                                <div class="panel panel-inf">                             
                                    <div class="panel-heading"><p><h4>EMPLOYEE TRANSACTIONS</h4></p></div>  
                                        <form id="search-employee" method="POST" role="search">
                                                        @csrf
                                            <div class="form-inline mr-auto">
                                        <input class="form-control" type="text" placeholder="Search for Employee ID" name="q"aria-label="Search">
                                        <button class="btn btn-mdb-color btn-rounded btn-sm my-0 ml-sm-2" type="submit">Search</button>
                                        </form>


</div>


                                                <br>
                                                <div id="results-form">

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

我希望它会显示结果,但是不起作用

0 个答案:

没有答案