OwlCyberSecurity - MANAGER
Edit File: edit.blade.php
{{-- Note: User any library only in master/main.blade.php --}} {{-- DO NOT OVERRIDE UNNECESSARY LIBRARIES --}} {{-- Extending main layout --}} @extends('master.main') {{-- Content starts here --}} {{-- This section is already wrapped --}} @section('content') <style> .error_div { background-color: #ffc8c8; border-radius: 4px; padding: 0.4rem; padding-left: 1rem; color: #f11a1a; border: 1px solid #ff2a2a; } .success_div { background-color: #aedcaf; border-radius: 4px; padding: 0.4rem; padding-left: 1rem; color: #1f6d26; border: 1px solid #248526; } </style> <div class="row p-2"> <div class="col-12"> <h3>Edit Store</h3> </div> </div> <div class="row p-2"> <div class="col-12"> <div class="card"> <div class="card-body"> <div class="row"> @if (!empty($errors->all())) <div class="col-12 error_div"> {{ $errors->first() }} </div> @endif @if (session()->has('message')) <div class="col-12 error_div"> {{ session()->get('message') }} </div> @endif @if (session()->has('success')) <div class="col-12 success_div"> {{ session()->get('success') }} </div> @endif </div> <form action="{{ route('post_stores_edit.edit_stores' , ['id' => $store->id]) }}" method="POST" autocomplete="off" enctype="multipart/form-data"> @csrf <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12"> <label for="title" class="form-label">Title</label> <input type="text" name="title" id="title" class="form-control" autofocus value="{{ old('title') ?? $store->title }}"> </div> </div> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="slug" class="form-label">Slug</label> <input type="text" name="slug" id="slug" class="form-control" autofocus value="{{ old('slug') ?? $store->slug }}"> </div> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="short_name" class="form-label">Short Name</label> <input type="text" name="short_name" id="short_name" class="form-control" autofocus value="{{ old('short_name') ?? $store->short_name }}"> </div> </div> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="url" class="form-label">URL</label> <input type="text" name="url" id="url" class="form-control" autofocus value="{{ old('url') ?? $store->url }}"> </div> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="destination_url" class="form-label">Destination URL</label> <input type="text" name="destination_url" id="destination_url" class="form-control" autofocus value="{{ old('destination_url') ?? $store->destination_url }}"> </div> </div> <div class="row pt-2"> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="category" class="form-label">Category</label> <select name="category" id="category" class="form-control"> <option value="0">Select category</option> @foreach ($categories as $c) <option value="{{ $c->id }}" {{ old('category') == $c->id ? "selected" : ($store->category_id == $c->id ? "selected" : "") }}>{{ ucfirst($c->name) }}</option> @endforeach </select> </div> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="network" class="form-label">Network</label> <select name="network" id="network" class="form-control"> <option value="0">Select network</option> @foreach ($networks as $n) <option value="{{ $n->id }}" {{ old('network') == $n->id ? "selected" : ($store->network_id == $n->id ? "selected" : "") }}>{{ ucfirst($n->name) }}</option> @endforeach </select> </div> </div> <div class="row pt-2"> <div class="col-12"> <label for="description" class="form-label">Short Description</label> <textarea rows="6" name="description" id="description" class="form-control">@if (old('description')){{ old('description') }}@elseif(!empty($store->description)){{ $store->description }}@endif</textarea> </div> </div> <div class="row pt-2"> <div class="col-12"> <label for="long_description" class="form-label">Long Description</label> <textarea name="long_description" id="long_description">@if (old('long_description')){{ old('long_description') }}@elseif(!empty($store->long_description)){{ $store->long_description }}@endif</textarea> </div> </div> <div class="row pt-2"> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="meta_title" class="form-label">Meta Title</label> <input type="text" name="meta_title" id="meta_title" class="form-control" autofocus value="{{ old('meta_title') ?? $store->meta_title }}"> </div> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="keywords" class="form-label">Keywords</label> <select name="keywords[]" id="keywords" class="form-control" multiple> @if (is_array(old('keywords'))) @foreach (old('keywords') as $keyword) <option value="{{ $keyword }}" selected="selected">{{ $keyword }}</option> @endforeach @elseif(is_array(explode(',',$store->meta_keywords)) && !empty($store->meta_keywords)) @foreach (explode(',',$store->meta_keywords) as $keyword) <option value="{{ $keyword }}" selected="selected">{{ $keyword }}</option> @endforeach @endif </select> <small><i>comma separated keywords</i></small> </div> </div> <div class="row pt-2"> <div class="col-12"> <label for="meta_description" class="form-label">Meta Description</label> <textarea name="meta_description" class="form-control" id="meta_description">@if (old('meta_description')){{ old('meta_description') }}@elseif(!empty($store->meta_description)){{ $store->meta_description }}@endif</textarea> </div> </div> <div class="row pt-2"> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="image" class="form-label">Image</label> @if (isset($store->image) && !empty($store->image)) <div class="mb-4" id="image_holder"> <div class="row"> <div class="text-right" style="width: 220px;" id="image_delete_icon_holder"> <i class="fa fa-times" aria-hidden="true" style="cursor: pointer;" title="delete image" onclick="deleteImage('{{ $store->id }}')"></i> </div> <div class="col-12"> <img src="{{ url('storage/store_images/'.$store->image) }}" alt="Store image" width="200px"> </div> </div> </div> @endif <div> <input type="file" name="image" id="image"> </div> </div> </div> <div class="row pt-2"> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="og_image" class="form-label">Open Graph Image</label> @if (isset($store->og_image) && !empty($store->og_image)) <div class="mb-4" id="image_holder"> <div class="row"> <!-- <div class="text-right" style="width: 220px;" id="image_delete_icon_holder"> <i class="fa fa-times" aria-hidden="true" style="cursor: pointer;" title="delete image" onclick="deleteImage('{{ $store->id }}')"></i> </div> --> <div class="col-12"> <img src="{{ url('storage/store_images/'.$store->og_image) }}" alt="Store open graph image" width="200px"> </div> </div> </div> @endif <div> <input type="file" name="og_image" id="og_image"> </div> </div> </div> <div class="row mt-2"> <div class="col-lg-6 col-md-6 col-sm-12"> <label for="status" class="form-label">Status</label> <br> <label><input type="radio" name="status" {{ (old('status') != null && old('status') == 1 ? 'checked' : ($store->status == 1 ? 'checked' : '')) }} value="1" style="vertical-align: middle;"> Active </label> <label><input type="radio" name="status" {{ (old('status') != null && old('status') == 0 ? 'checked' : ($store->status == 0 ? 'checked' : '')) }} value="0" style="vertical-align: middle;"> Inactive</label> </div> </div> <div class="row mt-2"> <div class="col-lg-6 col-md-6 col-sm-12"> <label class="form-label">Authentications</label> <br> <label><input type="checkbox" name="is_featured" {{ (old('is_featured') != null && old('is_featured') == 1 ? 'checked' : ($store->is_featured == 1 ? 'checked' : '')) }} value="1" style="vertical-align: middle;"> Featured </label> <br> <label><input type="checkbox" name="is_top_store" {{ (old('is_top_store') != null && old('is_top_store') == 1 ? 'checked' : ($store->is_top_store == 1 ? 'checked' : '')) }} value="1" style="vertical-align: middle;"> Top Store </label> </div> </div> <div class="row pt-4"> <div class="col-lg-6 col-md-6 col-sm-12"> <button type="submit" class="custom-blue-btn width-5-rem ">Save</button> <a href="{{ route('get_stores_index.view_stores') }}"><button type="button" class="custom-grey-btn width-5-rem">Cancel</button></a> </div> </div> </form> </div> </div> </div> </div> <script> // for messages function StoreEditMessage(type = '', message = '', timeout = 3000) { var selectedClass = ''; var holder = $('#storeEditMessageDiv'); if (type.toLowerCase() == 'success') { selectedClass = 'success_div'; } else { selectedClass = 'error_div'; } var ht = `<div class="${selectedClass}">${message}</div>`; holder.html(ht); holder.hide().show().fadeIn('fast').delay(timeout).fadeOut('slow', function() { $(this).stop(true); }); } // delete image function deleteImage(id) { $.ajax({ url: "{{ route('post_stores_delete_image.delete_stores' , ['id' => 'sID' ]) }}/".replace('sID', id), type: "POST", dataType: "JSON", data: { _token: "{{ csrf_token() }}" }, beforeSend: function() { $('#image_delete_icon_holder').html('<span class="spinner-border" style="width: 15px; height: 15px;"></span>'); $('#form-submit-button').hide(); }, success: function(res) { StoreEditMessage('success', res.message); $('#image_holder').remove(); }, error: function(res) { StoreEditMessage('message', res.responseJSON.message); console.log(res.responseJSON.message); }, complete: function() { $('#form-submit-button').show(); } }) } // document ready start $(document).ready(function() { $('#slug').change(function() { var str = $(this).val(); str = str.replace(/\s+/g, '-').toLowerCase(); $('#slug').val(str); }); $('#long_description').summernote({ placeholder: '<small>Description...</small>', tabsize: 2, height: 100, // toolbar: [ // // [groupName, [list of button]] // ['style', ['bold', 'italic', 'underline']], // ['font', ['strikethrough']], // ['fontsize', ['fontsize']], // ['color', ['color']], // ], disableDragAndDrop: false, callbacks: { onImageUpload: function(data) { data.pop(); } }, }); $('#keywords').select2({ tags: true, multiple: true, tokenSeparators: [','] }); }); // document ready end // error and success div timouts setTimeout(() => { $('.error_div').fadeOut('slow'); $('.success_div').fadeOut('slow'); }, 3000); </script> @endsection {{-- Content ends here --}} {{-- Note: User any library only in master/main.blade.php --}} {{-- DO NOT OVERRIDE UNNECESSARY LIBRARIES --}}