@php $backUrl = config('app.admin_url'); if (in_array(request()->route()->getActionMethod(), ['edit'])) { $segment = 2; } else { $segment = 1; } if (count(request()->segments()) == 1) { $backUrl = route('dashboard'); } else { $backUrl .= '/' . request()->segment(count(request()->segments()) - $segment); } @endphp
@push('title-bar')
{{ $name }} All
@if (Route::has($routeName . '.export') && isset($export))
@csrf Export
@endif @if (Route::has($routeName . '.import') && isset($import)) Import @endif @if (Route::has($routeName . '.sorting') && isset($sorting)) Sorting @endif @if (@$create) Add New @endif @if (@$submit) @endif
@if (@$searchBar)
@endif @if (@$action) @if (Route::has($routeName . '.action'))
@endif @endif @endpush @push('title-bar-form')
{{ $name }}
@if (@$submit) @endif
@endpush @push('import-modal') @endpush @push('listing-script') @endpush @push('sorting-script') @if (Route::has($routeName . '.sorting')) @endif @endpush @push('media-script') @if (Route::has($routeName . '.media')) @endif @endpush @push('text-area') @include('admin.components.textarea', ['textarea' => 'textarea']) @endpush @push('select2') @endpush @push('ratings') @endpush @push('media')
Media
@endpush @push('image-uploader') @endpush @push('image-uploader-sorting') $('.uploaded').sortable(); $(".delete-image").on("click", function() { deleteImageIds.push($(this).siblings('input').val()); }); @endpush @push('get-text-area') formdata.append("description", $('#textarea').summernote('code')); @endpush @push('call-ajax') @if (Route::has($routeName . '.store')) $.ajax({ url: "{{ route($routeName . '.store') }}", type: 'POST', data: formdata, contentType: false, processData: false, beforeSend: function() { $(ajaxMessage).html( '
Please wait...
' ); }, success: function(res) { $(ajaxMessage).html('
' + res.message + '
'); @if ($routeName . '.store' == 'orders.store' || $routeName . '.store' == 'partner-orders.store') try { let socket = io('https://socket.chooseataxi.in/order', { auth: { token: '{{ session('token') }}' } }); socket.on('connect', () => { console.log('✅ Connected successfully!', 'success'); socket.emit('order:create:web', {order_id: res.data.order.id}); }); socket.on('disconnect', () => { console.log('❌ Disconnected', 'error'); }); socket.on('connect_error', (error) => { console.log('❌ Connection error: ' + error.message, 'error'); }); socket.on('error', (data) => { console.log('❌ Server error: ' + JSON.stringify(data), 'error'); }); {{-- socket.on('booking:new', (data) => { console.log('🚗 Booking new: ' + JSON.stringify(data), 'success'); }); socket.on('booking:created', (data) => { console.log('🚗 Booking created: ' + JSON.stringify(data), 'success'); }); --}} } catch (error) { console.log('❌ Error connecting: ' + error.message, 'error'); } {{-- window.location.href = "{{ route($routeName . '.index') }}"; --}} @endif setTimeout(function() { {{-- window.location.reload(); --}} window.location.href = "{{ route($routeName . '.index') }}"; }, 1000); }, complete: function() { $(this).find('[type=submit]').removeAttr('disabled'); setTimeout(function() { $(ajaxMessage).html(''); }, 20000); }, error: function(data) { let response = JSON.parse(data.responseText); if (data.status === 422) { let errorString = ''; response = errorString; } else { response = response.message; } $(ajaxMessage).html('
' + response + '
'); } }); @endif @endpush @push('image-alt-view')
Update image alt
@endpush @push('image-alt-method') var imgSelector, altSelector, altModalSelector, altMediaId; $('img').on("click", function() { imgSelector = $(this); altMediaId = imgSelector.data('img-id'); let altSrc = imgSelector.attr('src'); if (typeof altMediaId !== 'undefined' && altSrc != "") { altSelector = $("#off-canvas-img-alt"); altSelector.find('img').attr('src', altSrc); $('[name="img_alt"]').val(imgSelector.attr('alt')); altModalSelector = new bootstrap.Offcanvas(altSelector); altModalSelector.show(); } }); $("#ajax-form-alt-img").validate({ rules: { name: { required: true, }, }, messages: { name: "*Please enter img alt name", }, submitHandler: function(form) { $(this).find('[type=submit]').attr('disabled', ''); let formdata = new FormData(form); formdata.append("id", altMediaId); $.ajax({ url: "{{ route('media.name') }}", type: 'POST', data: formdata, contentType: false, processData: false, beforeSend: function() { $(".ajax-maessage-alt-img").html( '
Please wait...
' ); }, success: function(res) { $(".ajax-maessage-alt-img").html('
' + res .message + '
'); imgSelector.attr('alt', $('[name="img_alt"]').val()); setTimeout(function() { altModalSelector.hide(); }, 2000); }, complete: function() { $(this).find('[type=submit]').removeAttr('disabled'); setTimeout(function() { $(".ajax-maessage-alt-img").html(''); }, 2000); }, error: function(data) { let response = JSON.parse(data.responseText); if (data.status === 422) { let errorString = ''; response = errorString; } else { response = response.message; } $(".ajax-maessage-alt-img").html('
' + response + '
'); } }); return false; } }); @endpush @push('image-uploader-asset') for (let i = 0; i < deleteImageIds.length; i++){ formdata.append("delete_image_ids[]", deleteImageIds[i]); } var imagesIds=[]; imagesIds=$('[name="images_old[]" ]').map(function() { return $(this).val(); }).get(); for (let j=0; j < imagesIds.length; j++){ formdata.append("images_ids[]", imagesIds[j]); } @endpush