/
var
/
www
/
html
/
cravings
/
storage
/
framework
/
views
/
Upload File
HOME
<?php $__env->startSection('stylesheets'); ?> <link href="/css/bootstrap.min.css" rel="stylesheet"> <link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700|Chilanka|Nunito" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="/css2/layout.css"> <link rel="stylesheet" href="/css/autocomplete.css"> <link href="<?php echo e(asset('css2/vex.min.css')); ?>" rel="stylesheet"> <link href="<?php echo e(asset('css/style.css')); ?>" rel="stylesheet"> <link href="<?php echo e(asset('css2/suggest.css')); ?>" rel="stylesheet"> <link rel="shortcut icon" href="/images/icon.png" type="image/png"> <style> .input-close { position: relative; } #address { width: 100%; border-radius: 4px; border-right: 1px; font-family: Georgia, "Times New Roman", Times, serif; } @media (max-width: 767px){ .wrapper { padding: 0; } form { width: 100%; } .close-addon { position: absolute; right: 15px; top: 33%; cursor: pointer; } } button { background-color: #c32026 !important; border-color: #c32026 !important; color: #fff !important; } @media (min-width: 576px){ .row>.col-sm-6:first-of-type { padding-right: 10px !important; } .input-group { margin-bottom: 5px; } .btn-group2, #address { height: 50px; } #address { border-top-left-radius: 5px; border-bottom-left-radius: 5px; } } .w-100 { width: 100%; } #img-source { /* display: flex; */ justify-content: space-between; flex-wrap: wrap; } .old-img { display: flex; } .old-img img { width: 100%; max-width: 200px; } .place-img { width: 50%; min-height: 100px; margin-bottom: 10px; } .place-img-w { text-align: center; } @media (max-width: 500px) { .place-img { width: 100%; } } .add-new { display: flex; width: 100%; height: 100%; text-align: center; border: 1px solid #ccc; } .add-icon { margin: auto; } .add-icon > * { color: #222; } .add-icon .fa { font-size: 20px; } .add-icon h4 { font-size: 1.2rem; } .delete-place-picture { cursor: pointer; } .add-food-item { display: flex; flex-direction: column; justify-content: center; align-items: center; } .badge { margin-bottom: 0; } .add-food-item .delete-food { } .badge.badge-warning { padding: 10px; margin-bottom: 5px; font-size: 16px; } .category-container { margin-bottom: 10px; } .category-container .badge { padding: 5px; } .remove-cat { cursor: pointer; } button { border: 1px solid transparent; border-radius: 3px; } </style> <?php $__env->stopSection(); ?> <?php $__env->startSection('content'); ?> <div class="containers"> <form action="<?php echo e(route('store_new_place')); ?>" method="POST" class="place-form" enctype="multipart/form-data"> <?php echo csrf_field(); ?> <input type="hidden" name="edit" id="edit" value="<?php echo e($place['slug'] ?? ''); ?>"> <input type="hidden" name="franchise" id="franinput" value="<?php echo e($place['franchise'] ?? ''); ?>"> <div class="card"> <div class="card-body"> <!-- <h4>Place</h4> --> <div class="form-group suggest input-close"> <input type="text" data-type="place" id="place-name" name="name" class="form-control item-name" placeholder="Name" autocomplete="off" value="<?php echo e($place['name'] ?? ''); ?>" required> </div> <div class="input-group"> <input type="text" name="address" placeholder="Enter Location" class="form-control" value="<?php echo e($place['address'] ?? ''); ?>" id="address" required> <!-- <div class="input-group-append btn-group2"> <button style="white-space: normal; background-color: #e8eeef; color: #8a97a0" type="button" class="btn btn-primary get-location"><i class="ta ta-target"></i></button> </div> --> </div> <input type="hidden" name="latitude" placeholder="Latitude" class="form-control" id="lats" value="<?php echo e(isset($place) ? $place['location'] ? $place['location']['coordinates'][1] : '' : ''); ?>"> <input type="hidden" name="longitude" placeholder="Longitude" class="form-control" id="lngs" value="<?php echo e(isset($place) ? $place['location'] ? $place['location']['coordinates'][0] : '' : ''); ?>"> <!-- <div class="row"> <div class="col-md-6"> <div class="form-group"> <input type="text" name="latitude" placeholder="Latitude" class="form-control" id="lats" value="<?php echo e(isset($place) ? $place['location'] ? $place['location']['coordinates'][1] : '' : ''); ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <input type="text" name="longitude" placeholder="Longitude" class="form-control" id="lngs" value="<?php echo e(isset($place) ? $place['location'] ? $place['location']['coordinates'][0] : '' : ''); ?>"> </div> </div> </div> --> <div class="form-group suggest"> <input type="text" id="phone" name="phone[]" class="form-control" value="<?php echo e($place['phones'][0] ?? ''); ?>" placeholder="Telephone 1 (optional)" autocomplete="off"> </div> <div class="row"> <div class="form-group suggest col-sm-6" style="padding: 0"> <input type="text" id="opening" name="opening" class="form-control timing" placeholder="Opening Time (e.g. 08:00)" value="<?php echo e($place['opening'] ?? ''); ?>"> </div> <div class="form-group suggest col-sm-6" style="padding: 0"> <input type="text" id="closing" name="closing" class="form-control timing" placeholder="Closing Time (e.g. 22:00)" value="<?php echo e($place['closing'] ?? ''); ?>"> </div> </div> <!-- <input type="hidden" role="uploadcare-uploader" name="image" data-crop="800x600" /><br><br> --> <div id="img-source"> <?php if(isset($place) && isset($place['image'])): ?> <?php $__currentLoopData = $place['image']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="place-img"> <div class="place-img-w"> <img src="<?php echo e($image); ?>" class="w-100" /> <a href="#" class="delete-place-picture" data-slug="<?php echo e($place['slug']); ?>" data-index="<?php echo e($loop->index); ?>"> <span class="fa fa-times"></span> </a> </div> </div> <input type="hidden" name="uploadimage[]" value="<?php echo e($image); ?>"> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?> <div id="old-img"></div> <div class="place-img"> <div class="form-group suggest img-input"> <label for="images">Pictures</label> <input type="file" class="form-control" name="image[]"> <input type="file" class="form-control" name="image[]"> </div> </div> </div> <h5 class="text-center type-of-place" style="margin-top: 20px;">Type of Place</h5> <?php $types = [ 'restaurant' => 'Restaurant', 'mamaput' => 'Mama Put', 'bar' => 'Bar', 'streetfood' => 'Street Food', 'fastfood' => 'Fast Food', 'hotel' => 'Hotel', 'eatery' => 'Eatery', 'cafe' => 'Cafe' ] ?> <?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $type): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $in = (isset($place) && isset($place['type'])) && $key === $place['type'] ? 'checked' : ''; ?> <div class="form-check suggest form-check-inline"> <input class="form-check-input" id="<?php echo e($key); ?>" name="type" <?php echo e($in); ?> type="radio" value="<?php echo e($key); ?>"> <label class="form-check-label" for="<?php echo e($key); ?>"><?php echo e($type); ?></label> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <hr> <?php $cats = [ 'african' => 'African', 'continental' => 'Continental', 'chinese' => 'Chinese', 'indian' => 'Indian', 'fast-food' => 'FastFood', 'breakfast' => 'Breakfast', 'seafood' => 'Seafood', 'coffee' => 'Coffee', 'vegetarian' => 'Vegetarian', 'finedining' => 'FineDining', 'healthy' => 'Healthy', 'grill' => 'Grill', 'parking' => 'Parking', 'seating' => 'Seating', 'delivery' => 'Delivery' ] ?> <div id="tags-list"> <h5 class="text-center">Attributes <span style="font-size: 14px">(select all that fit)</span></h5> <?php $__currentLoopData = $cats; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $in = (isset($place) && isset($place['tags'])) && in_array($key, (array) $place['tags']) ? 'checked' : ''; ?> <div class="form-check suggest form-check-inline"> <input class="form-check-input" id="<?php echo e($key); ?>" name="tags[]" <?php echo e($in); ?> type="checkbox" value="<?php echo e($key); ?>"> <label class="form-check-label" for="<?php echo e($key); ?>"><?php echo e($cat); ?></label> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div> <!-- <div class="form-inline flexContainer"> <div id="extra-tags"> <input type="text" id="extra" class="form-control"> </div> <button type="button" class="btn btn-primary" id="add-tag">Add Attribute</button> </div> --> <br> <!-- <p>Add categories one by one or separated by commas (starter, main, entree...)</p> <div class="category-container"> <?php if(isset($place) && isset($place['category'])): ?> <?php $__currentLoopData = $place['category']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <span class="badge badge-warning category"> <?php echo e($cat); ?> <span class="fa fa-times remove-cat" data-index="<?php echo e($loop->index); ?>"></span> <input type="hidden" name="category[]" value="<?php echo e($cat); ?>" /> </span> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?> </div> --> <!-- <div class="flexContainer"> <div id="categories"> <input type="text" id="category" class="form-control"> </div> <button type="button" class="btn btn-primary" id="add-category">Add Category</button> </div> --> <hr> <?php $areas = ["Apapa", "Festac Town", "Gbagada", "Ikeja", "Ikoyi", "Ilupeju", "Lagos Island", "Ajah", "Lekki", "Magodo", "Isolo", "Satellite Town", "Surulere", "Victoria Island", "VGC", "Chevron", "Ikate", "Agungi", "Opebi", "Alausa", "Akoka", "Okota", "Ebute Metta", "Yaba", "Oregun", "Oshodi", "Maryland", "Mainland", "Island", "Lagos"] ?> <div id="delivery-list" style="display: none;"> <h5 class="text-center">Delivery Areas <span style="font-size: 14px">(select many)</span></h5> <?php $__currentLoopData = $areas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $area): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $in = (isset($place) && isset($place['delivery'])) && in_array($area, (array) $place['delivery']) ? 'checked' : ''; $id = implode("-", explode(" ", $area)); ?> <div class="form-check suggest form-check-inline"> <input class="form-check-input" id="<?php echo e($id); ?>" name="delivery[]" type="checkbox" <?php echo e($in); ?> value="<?php echo e($area); ?>"> <label class="form-check-label" for="<?php echo e($id); ?>"><?php echo e($area); ?></label> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <hr> </div> <div class="prev-food" id="prev-food" style="display: flex; flex-wrap: wrap;"> <?php if(isset($food)): ?> <h5 style="font-size: 18px; width: 100%; padding-bottom: 20px;">Click on a food item to edit it</h5><br> <?php $__currentLoopData = $food; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $f): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="add-food-item" style="text-align: center;"> <a href="#" class="edit-prev-food preset" data-id="<?php echo e($f['_id'] ?? ''); ?>" data-description="<?php echo e($f['description'] ?? ''); ?>" data-name="<?php echo e($f['name']); ?>" data-price="<?php echo e($f['price']); ?>"> <span class="badge badge-warning"> <?php echo e($f['name']); ?> - <?php echo e($f['price']); ?> </span> </a> <a href="#" class="delete-food" data-id="<?php echo e($f['_id'] ?? ''); ?>" data-name="<?php echo e($f['name'] ?? ''); ?>"> <i class="fa fa-times"></i> </a> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?> </div> <div class="items"> </div> <div class="add-more" style="margin-bottom: 20px;"> <button type="button" class="btn btn-primary add-item">Add Food</button> </div> <button class="btn btn-success form-control submit-place">Submit</button> </div> </div> </form> </div> <!-- <div class="top-of-page" style="position: fixed; bottom: 50%; right: 20px;"> <button class="go-to-top" style="padding: 5px; background-color: #c32022; color: #fff; font-size: 15px;"> Top </button> <button class="go-to-bottom" style="padding: 5px; background-color: #c32022; color: #fff; font-size: 15px;"> Bottom </button> </div> --> <?php $__env->stopSection(); ?> <?php $__env->startSection('footer'); ?> <?php $__env->stopSection(); ?> <?php $__env->startSection('admin'); ?> <?php $__env->stopSection(); ?> <?php $__env->startSection('javascript'); ?> ##parent-placeholder-b6e13ad53d8ec41b034c49f131c64e99cf25207a## <script src="<?php echo e(asset('js/vex.min.js')); ?>"></script> <script> vex.defaultOptions.className = 'vex-theme-plain'; // let cats = Array.from(document.querySelectorAll('.category')).map(catSpan => catSpan.textContent.trim()) // const loadCategories = () => { // document.querySelectorAll('.item').forEach(foodinput => { // const catSelect = foodinput.querySelector('.food-category') // const currentCat = catSelect.value // catSelect.innerHTML = cats.map(cat => catOption(cat, currentCat || '')).join("") // // catSelect.value = // }) // document.querySelector('.category-container').innerHTML = cats.map((cat, i) => categoryTemplate(cat, i)).join(""); // }; </script> <script src="<?php echo e(asset('js/addfood.js')); ?>"></script> <script src="/js/search.js"></script> <script> function deleteFood(e){ e.preventDefault(); const target = e.currentTarget; const _id = target.dataset.id; // var con = confirm('Are you sure you want to delete ' + name); fetch(`/place/food/delete/${_id}`, {credentials: 'same-origin'}) .then(response => response.json()) .then(result => { target.closest('.add-food-item').style.display = 'none'; }).catch(error => console.log(error)) } var areas = ["Amuwo Odofin", "Apapa", "Festac Town", "Gbagada", "Ikeja", "Ikoyi", "Ilupeju", "Lagos Island", "Ajah", "Lekki", "Magodo", "Ogba", "Ogudu", "Isolo", "Satellite Town", "Surulere", "VGC", "Victoria Island", "Ebute Metta", "Yaba"]; // document.getElementById("upload_widget").addEventListener("click", function(){ // myWidget.open(); // }, false); var long = document.getElementById('longitude'); var lati = document.getElementById('latitude'); (function addsEvent(){ autocomplete(document.getElementById('address')) .then(response => { populate(response); addsEvent(); }); })(); $('.get-location').on('click', function(e){ e.preventDefault(); const $target = $(e.currentTarget); $target.addClass('animated pulse infinite') startMap().then(locate => { console.log(locate); document.getElementById('address').value = locate.address long.value = locate.longitude lati.value = locate.latitude $target.removeClass('animated pulse infinite') }).catch(error => console.log(error)) }) // document.querySelector('.add-image').addEventListener('click', function(e){ // e.preventDefault(); // const el = document.createElement('input'); // el.className = "form-control"; // el.setAttribute('type', 'file'); // el.setAttribute('name', 'image[]'); // document.querySelector('.img-input').appendChild(el); // }) // document.getElementById('add-tag').addEventListener('click', function(e){ // e.preventDefault(); // const extra = document.getElementById('extra'); // const extraTag = extra.value.split(" ").join("") // const newTag = document.createElement('div'); // newTag.classList.add("form-check", "suggest", "form-check-inline"); // newTag.innerHTML = tagTemplate(extraTag); // document.getElementById('tags-list').appendChild(newTag); // extra.value = ""; // }); // const categoryTemplate = (category, index) => ` // <span class="badge badge-warning"> // ${category} <span class="fa fa-times remove-cat" data-index="${index}"></span> // <input type="hidden" name="category[]" value="${category}" /> // </span> // `; // document.querySelector('.category-container').addEventListener('click', function(e){ // if(e.target.dataset.index !== 'undefined') { // cats.splice(e.target.dataset.index, 1) // e.target.closest('.badge').style.display = 'none'; // loadCategories(); // } // }) // document.getElementById('add-category').addEventListener('click', function(e){ // const cat = document.getElementById('category'); // const cats_entered = cat.value.split(",").map(c => c.trim()) // cats.push(...cats_entered); // cat.value = ""; // cat.focus() // loadCategories(); // }); // const catOption = (cat, opt) => ` // <option ${opt === cat && 'selected'} value="${cat}">${cat}</option> // `; var newFood = (food = {}) => { const foodNode = document.createElement('div') foodNode.classList.add('item'); foodNode.innerHTML = ` <div class="item"> <input type="hidden" class="food-id" name="food[id][]" value="${food.id || ''}" /> <div class="form-group suggest"> <input type="text" data-type="food" name="food[food][]" class="form-control food-name" value="${food.name || ''}" placeholder="Food name" autocomplete="off"> </div> <div class="form-group suggest price-check"> <input type="text" name="food[price][]" class="form-control price" value="${food.price || ''}" placeholder="Price" autocomplete="off"> </div> <div class="form-group suggest"> <textarea class="form-control description" name="food[description][]" placeholder="Description">${food.description || ""}</textarea> </div> <div> <button class="btn btn-danger remove-current-item">Remove <i class="fa fa-times"></i></button> </div> </div> `; return foodNode; } var foodsToAdd = {}; function editFood(e){ e.preventDefault(); const target = e.currentTarget; const _id = target.dataset.id; if(!foodsToAdd[_id]){ foodsToAdd[_id] = target.dataset; const foodItems = document.querySelectorAll('.item'); if(!foodItems.length){ document.querySelector('.items').appendChild(newFood(target.dataset)); }else { document.querySelector('.items').insertBefore(newFood(target.dataset), foodItems[0]); } // document.querySelector('.items').innerHTML = + .innerHTML; document.querySelector('.food-name').select(); } target.closest('.add-food-item').style.display = 'none'; } $(document).on('click', '.add-current-item', function(e){ e.preventDefault(); const $target = $(e.currentTarget); const $container = $target.closest('.item'); const _id = $container.find('.food-id').val(); const name = $container.find('.food-name').val(); const price = $container.find('.price').val(); const description = $container.find('.description').val(); // console.log(name); $container.remove() $('#prev-food').append(prevFood({_id, name, price, description})) }); // $(document).on('keyup', '.food-name', function(e){ // let slug = document.querySelector('#edit').value; // console.log(e.target, e.currentTarget) // if(slug){ // console.log('hhh') // autoC(e.currentTarget, function(text){ // text = text.toLowerCase(); // console.log(text) // return $.get(`/place/food/search/${slug}/${e.currentTarget.value}`) // }, function(foodDetails){ // e.currentTarget.value = foodDetails.name; // let container = e.currentTarget.closest('.item'); // container.querySelector('.price').value = foodDetails.price; // container.querySelector('.description').value = foodDetails.description; // const idInput = document.createElement('input'); // idInput.setAttribute('type', 'hidden'); // idInput.value = foodDetails.key; // container.appendChild(idInput); // }) // } // }); document.querySelectorAll('.edit-prev-food.preset').forEach(editButton => { editButton.addEventListener('click', editFood) }) $(document).on('click', '.remove-current-item', function(e){ e.preventDefault(); const $target = $(e.currentTarget); const $container = $target.closest('.item'); // console.log(name); $container.remove(); }); const imgTemp = (img) => ` <div class="place-img"> <div class="place-img-w"> <img src="${img}" class="w-100" /> </div> </div> ` function appendImage(img){ $('#img-source').prepend(imgTemp(img)) } function oldPlace(slug) { const el = document.createElement('input'); el.setAttribute('type', 'hidden'); el.setAttribute('name', 'oldplace'); el.setAttribute('value', slug); document.querySelector('.place-form').appendChild(el); } // const placeSearch = document.querySelector('#place-name'); // autoComplete({ // input: placeSearch, // fetch: async function(text, update) { // text = text.toLowerCase(); // var suggestions = await $.get(`/api/place/search/${text}`) // console.log(suggestions) // update(suggestions) // }, // onSelect: async function({name, slug}) { // placeSearch.value = name; // oldPlace(slug) // const placeDetails = await getPrevFood(name); // resets(placeDetails.place, placeDetails.food); // } // }); // document.querySelector('.check-fran').addEventListener('click', function(e){ // // check // e.preventDefault(); // const placeName = document.querySelector('#place-name').value; // if(placeName.length){ // doFetch(`/api/place/franchise/food/${placeName}`) // .then(places => { // franchisePlaces = places; // newFranCon(places) // }) // } // // document.getElementById('prev-food').innerHTML = food && food.length ? populateFood(food) : ""; // }); // Toggle show delivery areas when delivery is (de)selected // document.getElementById('delivery').addEventListener('change', function(e){ // if(e.target.checked){ // // document.querySelector('#delivery-list').style.display = 'block'; // }else { // document.querySelector('#delivery-list').style.display = 'none'; // } // }) // document.querySelector('.go-to-top').addEventListener('click', function(e){ // e.preventDefault(); // const top = $('.type-of-place').offset().top // goToTop(top) // }) // document.querySelector('.go-to-bottom').addEventListener('click', function(e){ // e.preventDefault(); // const foodItems = document.querySelectorAll('.item') // const bottom = foodItems.length ? foodItems[foodItems.length - 1].offsetTop : document.querySelector('.items').offsetTop; // goToTop(bottom) // }) function goToTop(goto) { $('html, body').animate({ scrollTop: goto }, 800); } </script> <?php $__env->stopSection(); ?> <?php echo $__env->make('layouts.base', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/cravings/resources/views/places/np.blade.php ENDPATH**/ ?>