File: //home/marketing.cfbon.ru/public_html/storage/framework/views/67917a775ef4b5a6c9f71dbe827a4632.php
<?php $__env->startSection('title', 'Кофейни на картах'); ?>
<?php $__env->startSection('title_button'); ?>
<div class="col-md-1">
<a href="<?php echo e(route('coffee-shops.create')); ?>" class="btn btn-danger">Добавить</a>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="container mt-3 ms-2">
<div class="row">
<div class="col-md-11">
<table class="table table-hover">
<thead class="bg-light">
<tr>
<th scope="col">Номер</th>
<th scope="col">Адрес</th>
<th scope="col">Метро</th>
<th scope="col">Расписание</th>
<th scope="col">Открыта</th>
<th scope="col">Действия</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $coffeeShops; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $shop): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td><?php echo e($shop->number); ?></td>
<td><?php echo e($shop->address); ?></td>
<td>
<div class="d-flex align-items-center">
<span class="metro-dot" style="background-color: <?php echo e($shop->metro_data->color); ?>"></span>
<span><?php echo e($shop->metro_data->name); ?></span>
</div>
</td>
<td>
<div class="d-flex flex-column">
<div class="d-flex justify-content-between align-items-center gap-2">
<span><?php echo e($shop->schedule->working->days); ?></span>
<span><?php echo e($shop->schedule->working->time); ?></span>
</div>
<?php if($shop->schedule->weekend): ?>
<div class="d-flex justify-content-between align-items-center gap-2 mt-1 text-muted">
<span><?php echo e($shop->schedule->weekend->days); ?></span>
<span><?php echo e($shop->schedule->weekend->time); ?></span>
</div>
<?php endif; ?>
</div>
</td>
<td>
<form action="<?php echo e(route('coffee-shops.changeShopOpen', ['shopId' => $shop->id])); ?>" method="POST">
<?php echo method_field('PATCH'); ?>
<?php echo csrf_field(); ?>
<div class="mb-3 mt-2 switch-wrapper">
<label class="switch-label">
<input type="checkbox" name="is_open"
<?php echo e(old('is_open', $shop->is_open ? 'on' : '') == 'on' ? 'checked' : ''); ?>
class="switch-checkbox is_active_checkbox <?php $__errorArgs = ['is_open'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
<span class="switch-slider"></span>
</label>
<?php $__errorArgs = ['is_open'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
</div>
</form>
</td>
<td>
<div class="d-flex">
<a href="<?php echo e(route('coffee-shops.edit', $shop->id)); ?>" class="btn btn-outline-danger btn-sm me-2">Редактировать</a>
<form action="<?php echo e(route('coffee-shops.destroy', $shop->id)); ?>" method="POST" class="d-inline">
<?php echo csrf_field(); ?>
<?php echo method_field('DELETE'); ?>
<button type="submit" class="btn btn-outline-secondary btn-sm" onclick="return confirm('Вы уверены, что хотите безвозвратно удалить кофейню?')">Удалить</button>
</form>
</div>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
</div>
</div>
<style>
.metro-dot {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
background-color: #ccc;
margin-right: 8px;
}
.table th,
.table td {
vertical-align: middle;
padding: 0.75rem 1rem;
}
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<?php echo \Illuminate\View\Factory::parentPlaceholder('scripts'); ?>
<script>
document.addEventListener('change', function(e) {
if (e.target.classList.contains('is_active_checkbox')) {
const form = e.target.closest('form');
fetch(form.action, {
method: 'PATCH',
headers: {
'X-CSRF-TOKEN': form.querySelector('input[name="_token"]').value,
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
is_open: e.target.checked
})
})
.then(response => response.json())
.then(data => console.log('Ответ сервера:', data))
.catch(error => console.error('Ошибка:', error));
}
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.main', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/marketing.cfbon.ru/public_html/resources/views/coffee-shops/index.blade.php ENDPATH**/ ?>