IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/subjects/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/subjects/index.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>@if(isset($subject))Edit @else  Add @endif</strong> Subject</h2>
            </div>
            <div class="body">
                @if(isset($subject))
                {!! Form::model($subject, ['method' => 'PATCH', 'action' => ['School\SubjectController@update', $subject->idSubject], 'class' => 'form-horizontal']) !!}
                @else
                {!! Form::open(['url' => 'school/subjects', 'class' => 'form-horizontal']) !!}
                @endif
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label required">
                        <label for="classname">Select Session </label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            {!! Form::select('idFinancialYear',$fys,null,['class' => 'form-control show-tick ms']) !!}
                            @if ($errors->has('idFinancialYear'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idFinancialYear') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label required">
                        <label for="classname">Select Class </label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            {!! Form::select('idClass',$classes,null,['class' => 'form-control show-tick ms select2']) !!}
                            @if ($errors->has('idClass'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('idClass') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label required">
                        <label for="classname">Subject Name</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            {!! Form::text('subjectName',null,['class' => 'form-control required']) !!}
                            @if ($errors->has('subjectName'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('subjectName') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label required">
                        <label for="classname">Subject Code</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            {!! Form::text('subjectCode',null,['class' => 'form-control required']) !!}
                            @if ($errors->has('subjectCode'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('subjectCode') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        @if(isset($subject))
                        {!! Form::submit('UPDATE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                        @else
                        {!! Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']) !!}
                        @endif
                        {!! Form::close() !!} 
                    </div>
                </div>
           
            </div>
        </div>
    </div>

    <div class="col-sm-7">
        <div class="card">
            <div class="header">
                <h2><strong>List Of Subjects</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>Session</th>
                            <th>Class</th>
                            <th>Subject Name</th>
                            <th>Subject Code</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        @foreach($subjects as $value)
                        <tr>
                            <th scope="row">{{$i}}</th>
                            <th>{{$value->fys->financialYearName}}</th>
                            <td>{{$value->classM->className}}</td>
                            <td>{{$value->subjectName}}</td>
                            <td>{{$value->subjectCode}}</td>
                            <td>
                                <a href="{{ url('school/subjects/' . $value->idSubject . '/edit') }}"  class="btn btn-raised btn-info waves-effect btn-round">Edit </a>
                                <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="{{$value->idSubject}}" data-type="confirm">DELETE</button>
                            </td>
                        </tr>
                        <?php $i++; ?>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@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');
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to delete this Subject!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "{{url('/school/subjects/')}}" +"/"+id,
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Subject 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