IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/stock/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/resources/views/schools/stock/supplier.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>@if(isset($supplier))Edit @else  Add @endif Vendor/Supplier</strong></h2>
            </div>
            <div class="body">
                @if(isset($supplier))
                {!! Form::model($supplier, ['method' => 'PATCH', 'action' => ['School\Stock\SupplierController@update', $supplier->idSupplier], 'class' => 'form-horizontal','files'=>true]) !!}
                @else
                {!! Form::open(['url' => 'school/suppliers', 'class' => 'form-horizontal','id'=>'form','files'=>true]) !!}
                @endif
                
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Business Name</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('bussinessName',null,['class' => 'form-control','required'=>'required']) !!}
                            @if ($errors->has('bussinessName'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('bussinessName') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Contact Person</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('contactPerson',null,['class' => 'form-control','required'=>'required']) !!}
                            @if ($errors->has('contactPerson'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('contactPerson') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Contact No</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('contactNo',null,['class' => 'form-control','required'=>'required','minlength'=>'10','maxlength'=>'10']) !!}
                            @if ($errors->has('contactNo'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('contactNo') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Email</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('email',null,['class' => 'form-control','required'=>'required']) !!}
                            @if ($errors->has('email'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('email') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">GST No</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('gstNo',null,['class' => 'form-control','required'=>'required','minlength'=>'15','maxlength'=>'15']) !!}
                            @if ($errors->has('gstNo'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('gstNo') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Supplier Of</label>
                    </div>
                    <div class="col-sm-3">
                        <div class="form-group">
                            {!! Form::text('commodity',null,['class' => 'form-control','required'=>'required']) !!}
                            @if ($errors->has('commodity'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('commodity') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-2 form-control-label required">
                        <label for="classname">Address</label>
                    </div>
                    <div class="col-sm-7">
                        <div class="form-group">
                            {!! Form::textarea('address',null,['class' => 'form-control','size'=>'30x2','required'=>'required']) !!}
                            @if ($errors->has('address'))
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong>{{ $errors->first('address') }}</strong>
                            </label>
                            @endif
                        </div>
                    </div>
                    
                </div>
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        @if(isset($supplier))
                        {!! 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','id'=>'submit-btn']) !!}
                        @endif
                        {!! 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>Vendors/Suppliers</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>Business Name</th>
                            <th>Contact Person</th>
                            <th>Address</th>
                            <th>Contact No</th>
                            <th>Email</th>
                            <th>GST No.</th>
                            <th>Supplier Of</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        @foreach($suppliers as $value)
                        <tr>
                            <th scope="row">{{$i}}</th>
                            <td>{{$value->bussinessName}}</td>
                            <td>{{$value->contactPerson}}</td>
                            <td>{{$value->address}}</td>
                            <td>{{$value->contactNo}}</td>
                            <td>{{$value->email}}</td>
                            <td>{{$value->gstNo}}</td>
                            <td>{{$value->commodity}}</td>
                            <td>
                                <a href="{{ url('school/suppliers/' . $value->idSupplier . '/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->idSupplier}}" 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  Supplier!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "{{url('/school/suppliers/')}}" +"/"+id,
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Supplier 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