Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/resources/views/admin/categories/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/resources/views/admin/categories/edit.blade.php
@extends('layouts.admin.app')
@section('content')
<div class="row">
    <div class="col-md-12">
        <section class="content">
        @include('layouts.errors-and-messages')
            <div class="box">
                <form action="{{ route('admin.categories.update', $category->id) }}" method="post" id="frm_edit" class="form" enctype="multipart/form-data">
                    <div class="box-body">
                        <input type="hidden" name="_method" value="put">
                        {{ csrf_field() }}
                        <div class="col-md-12">
                            <h3 class="bold">Product Category</h3>
                            <div class="row">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="name">Category Name <span class="text-danger">*</span></label>
                                        <input type="text" name="name" id="name" placeholder="Name" class="form-control input-lg" value="{!! $category->name ?: old('name')  !!}">
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="parent">Parent Category</label>
                                        <select name="parent" id="parent" class="form-control custom-select input-lg">
                                            <option value="0">No parent</option>
                                            @foreach($categories as $cat)
                                                <option @if($cat->id == $category->parent_id) selected="selected" @endif value="{{$cat->id}}">{{$cat->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="status">Status <span class="text-danger">*</span></label>
                                        <select name="status" id="status" class="form-control custom-select input-lg">
                                            <option value="0" @if($category->status == 0) selected="selected" @endif>Disable</option>
                                            <option value="1" @if($category->status == 1) selected="selected" @endif>Enable</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label for="description">Description </label>
                                        <textarea class="form-control ckeditor" name="description" id="description" rows="5" placeholder="Description">{!! $category->description ?: old('description')  !!}</textarea>
                                    </div>
                                </div>
                            </div>
                            @if(isset($category->cover))
                            <div class="row">
                                <div class="col-md-6">
                                    @if(!empty($category->cover))
                                    <div class="form-group" id="cat_cover">
                                        <img src="{{ asset("/public/storage/$category->cover") }}" alt="" class="img-responsive img-thumbnail" />
                                        <div>
                                             <button type="button" class="btn btn-danger btn-sm btn-block remove_image" id="header_logo-but">Remove image?</button>
                                        </div>
                                    </div>
                                    @endif
                                </div>
                                <div class="col-md-6">
                            @else
                            <div class="row">
                                <div class="col-md-12">
                            @endif
                                    <div class="form-group">
                                        <label for="cover">Upload a Cover Image</label>
                                        <input type="file" name="cover" id="cover" class="form-control input-lg">
                                    </div>
                                </div>
                            </div>
                            <h3 class="bold">Featured Category? <small>(to be shown on product listing page)</small></h3>
                            <div class="row">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="status">Activation <span class="text-danger">*</span></label>
                                        <select name="featured_category" id="featured_category" class="form-control custom-select input-lg">
                                            <option value="0" @if($category->featured_category == '0') selected="selected" @endif>Disable</option>
                                            <option value="1" @if($category->featured_category == '1') selected="selected" @endif>Enable</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="status">Font Colour</label>
                                        <select name="featured_category_template" id="featured_category_template" class="form-control custom-select input-lg">
                                            <option value="font-black-main" @if($category->featured_category_template == 'font-black-main') selected="selected" @endif>Black</option>
                                            <option value="font-white" @if($category->featured_category_template == 'font-white') selected="selected" @endif>White</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label for="status">Order Sequence</label>
                                        <select name="featured_category_sequence" id="featured_category_sequence" class="form-control custom-select input-lg">
                                            <option value="">Select</option>
                                            @for( $counter=1; $counter<=10; $counter++ )
                                            	@php $selected = ''; @endphp
                                            	@if( $category->featured_category_sequence == $counter )
                									@php $selected = 'selected'; @endphp
                                            	@endif
                                            	<option value="{{ $counter }}" {{ $selected }}>{{ $counter }}</option>
                                            @endfor
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box-footer">
                        <div class="row">
                            <div class="col-md-6">
                                <button type="submit" class="btn btn-lg btn-block btn-success">Update</button>
                            </div>
                            <div class="col-md-6">
                                <a href="{{ route('admin.categories.index') }}" class="btn btn-lg btn-block btn-danger">Back</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </section>
    </div>
</div>
@endsection
@section('js')
<script src="{{ asset('https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.min.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#frm_edit').validate({
        errorPlacement: function(error, element) {
            if (element.parent('.input-group').length) {
                error.insertAfter(element.parent());
            } else {
                error.insertAfter(element);
            }
        },
        rules: {
			name: { required: true }
		},
		messages: {
			name: { required: 'Please enter a category name' }
		}
    });
    $(document).on('click','.remove_image',function(e) {
        e.preventDefault();
        var attrVal =  $(this).attr('id');
        var data = {id : "{{$category->id}}"};
        var dataUrl = "{{url('/admin/remove-image-category')}}";
        $.ajax({
            type: "POST",
            url:dataUrl,
            data : data,
            success: function(data) {
                if (data == '1') {
                    $('#cat_cover').remove();
                    toastr.remove();
                    toastr.clear();
                    toastr.options.closeButton = true;
                    toastr.options.debug = false;
                    toastr.options.progressBar = false;
                    toastr.options.positionClass = 'toast-bottom-full-width';
                    toastr.options.preventDuplicates = true;
                    toastr.options.onclick = null;
                    toastr.options.showDuration = 1000;
                    toastr.options.hideDuration = 1000;
                    toastr.options.timeOut = 5000;
                    toastr.options.extendedTimeOut = 1000;
                    toastr.options.showEasing = 'swing';
                    toastr.options.hideEasing = 'linear';
                    toastr.options.showMethod = 'fadeIn';
                    toastr.options.hideMethod = 'fadeOut';
                    toastr.success('Image Removed Successfully','Success');
                } else {
                    toastr.clear();
                    toastr.options.closeButton = true;
                    toastr.options.debug = false;
                    toastr.options.progressBar = false;
                    toastr.options.positionClass = 'toast-bottom-full-width';
                    toastr.options.preventDuplicates = true;
                    toastr.options.onclick = null;
                    toastr.options.showDuration = 1000;
                    toastr.options.hideDuration = 1000;
                    toastr.options.timeOut = 5000;
                    toastr.options.extendedTimeOut = 1000;
                    toastr.options.showEasing = 'swing';
                    toastr.options.hideEasing = 'linear';
                    toastr.options.showMethod = 'fadeIn';
                    toastr.options.hideMethod = 'fadeOut';
                    toastr.error('Invalid Request','Error');
                }
            }
        });
    });
});
</script>
@endsection

Spamworldpro Mini