+ availability
This commit is contained in:
8
RoomType::create([
Normal file
8
RoomType::create([
Normal file
@@ -0,0 +1,8 @@
|
||||
[90m= [39m[34;4mApp\Models\Hotel[39;24m {#5905
|
||||
[34mname[39m: "[32mMountain Lodge[39m",
|
||||
[34maddress[39m: "[32mAlpine Valley, Switzerland[39m",
|
||||
[34mupdated_at[39m: "[32m2026-01-23 22:51:26[39m",
|
||||
[34mcreated_at[39m: "[32m2026-01-23 22:51:26[39m",
|
||||
[34mid[39m: [35m30[39m,
|
||||
}
|
||||
|
||||
@@ -25,20 +25,14 @@ class AuthController extends Controller
|
||||
return redirect()->route('admin.hotels.index');
|
||||
}
|
||||
|
||||
return back()->withErrors([
|
||||
'email' => 'Неверные данные.',
|
||||
])->onlyInput('email');
|
||||
return back()->withErrors(['email' => 'Неверные данные.']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Выход из системы.
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return view('admin.logout');
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
return redirect()->route('admin.login.form')->with('success', 'Вы успешно вышли из системы.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,53 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\RoomType;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AvailabilityController extends Controller
|
||||
{
|
||||
//
|
||||
public function calendar(RoomType $roomType)
|
||||
{
|
||||
$roomType->load('availabilities');
|
||||
|
||||
if (request()->ajax()) {
|
||||
return view('admin.availability._calendar', compact('roomType'))->render();
|
||||
}
|
||||
|
||||
return view('admin.availability.calendar', compact('roomType'));
|
||||
}
|
||||
|
||||
public function store(Request $request, RoomType $roomType)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'required|date|after_or_equal:start_date',
|
||||
'is_available' => 'required|boolean',
|
||||
'price' => 'nullable|numeric|min=0',
|
||||
]);
|
||||
|
||||
$roomType->availabilities()
|
||||
->where('start_date', '<=', $validated['end_date'])
|
||||
->where('end_date', '>=', $validated['start_date'])
|
||||
->delete();
|
||||
|
||||
$roomType->availabilities()->create($validated);
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', 'Период сохранён.');
|
||||
}
|
||||
|
||||
public function destroy(\App\Models\Availability $availability)
|
||||
{
|
||||
$availability->delete();
|
||||
|
||||
if (request()->ajax()) {
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', 'Период удалён.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BookingController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Hotel;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\RoomType;
|
||||
|
||||
class HotelController extends Controller
|
||||
{
|
||||
@@ -19,6 +20,18 @@ class HotelController extends Controller
|
||||
return view('admin.hotels.create');
|
||||
}
|
||||
|
||||
public function calendar(Request $request, $hotelId)
|
||||
{
|
||||
$hotel = \App\Models\Hotel::findOrFail($hotelId);
|
||||
$roomTypes = RoomType::where('hotel_id', $hotelId)->with('availabilities')->get();
|
||||
|
||||
if ($request->ajax()) {
|
||||
return view('admin.hotels._calendar', compact('hotel', 'roomTypes'))->render();
|
||||
}
|
||||
|
||||
return view('admin.hotels.calendar', compact('hotel', 'roomTypes'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
@@ -55,4 +68,4 @@ class HotelController extends Controller
|
||||
$hotel->delete();
|
||||
return redirect()->route('admin.hotels.index')->with('success', 'Отель удалён.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RoomTypeController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\RoomType;
|
||||
use App\Models\RoomAvailability;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BookingController extends Controller
|
||||
{
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'room_type_id' => 'required|exists:room_types,id',
|
||||
'check_in' => 'required|date|after_or_equal:today',
|
||||
'check_out' => 'required|date|after:check_in',
|
||||
'guest_name' => 'required|string|max:255',
|
||||
'guest_email' => 'required|email',
|
||||
'guest_phone' => 'required|string',
|
||||
'confirmation_type' => 'required|in:auto,manual',
|
||||
]);
|
||||
|
||||
$roomType = RoomType::findOrFail($validated['room_type_id']);
|
||||
|
||||
$dates = [];
|
||||
$currentDate = new \DateTime($validated['check_in']);
|
||||
$endDate = new \DateTime($validated['check_out']);
|
||||
|
||||
while ($currentDate < $endDate) {
|
||||
$dates[] = $currentDate->format('Y-m-d');
|
||||
$currentDate->modify('+1 day');
|
||||
}
|
||||
|
||||
$unavailableDates = RoomAvailability::where('room_type_id', $roomType->id)
|
||||
->whereIn('date', $dates)
|
||||
->where('is_available', false)
|
||||
->pluck('date')
|
||||
->toArray();
|
||||
|
||||
if (!empty($unavailableDates)) {
|
||||
throw ValidationException::withMessages([
|
||||
'check_in' => [
|
||||
'The following dates are not available: ' . implode(', ', $unavailableDates)
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$booking = Booking::create([
|
||||
'room_type_id' => $validated['room_type_id'],
|
||||
'check_in' => $validated['check_in'],
|
||||
'check_out' => $validated['check_out'],
|
||||
'guest_name' => $validated['guest_name'],
|
||||
'guest_email' => $validated['guest_email'],
|
||||
'guest_phone' => $validated['guest_phone'],
|
||||
'status' => $validated['confirmation_type'] === 'auto' ? 'confirmed' : 'pending',
|
||||
'confirmed_at' => $validated['confirmation_type'] === 'auto' ? now() : null,
|
||||
'created_by_user_id' => $request->user()->id, // ← ID админа
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json($booking, 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = \App\Models\Booking::with(['roomType', 'roomType.hotel']);
|
||||
|
||||
// Фильтр по статусу
|
||||
if ($request->has('status')) {
|
||||
$query->where('status', $request->status);
|
||||
}
|
||||
|
||||
// Фильтр по отелю
|
||||
if ($request->has('hotel_id')) {
|
||||
$query->whereHas('roomType.hotel', function ($q) use ($request) {
|
||||
$q->where('id', $request->hotel_id);
|
||||
});
|
||||
}
|
||||
|
||||
// Фильтр по дате заезда (от)
|
||||
if ($request->has('from')) {
|
||||
$query->where('check_in', '>=', $request->from);
|
||||
}
|
||||
|
||||
$query->orderBy('created_at', 'desc');
|
||||
|
||||
return response()->json($query->paginate(10));
|
||||
}
|
||||
public function confirm(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::findOrFail($id);
|
||||
|
||||
if ($booking->status !== 'pending') {
|
||||
return response()->json(['error' => 'Booking is not in pending status'], 400);
|
||||
}
|
||||
|
||||
$booking->update([
|
||||
'status' => 'confirmed',
|
||||
'confirmed_at' => now(),
|
||||
]);
|
||||
|
||||
return response()->json($booking);
|
||||
}
|
||||
|
||||
public function cancel(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::findOrFail($id);
|
||||
|
||||
if ($booking->status === 'cancelled') {
|
||||
return response()->json(['error' => 'Booking is already cancelled'], 400);
|
||||
}
|
||||
|
||||
$booking->update([
|
||||
'status' => 'cancelled',
|
||||
]);
|
||||
|
||||
return response()->json($booking);
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Hotel;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HotelController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$hotels = Hotel::all();
|
||||
return view('admin.hotels.index', compact('hotels'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'address' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$hotel = Hotel::create($validated);
|
||||
|
||||
return response()->json($hotel, 201);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$hotel = Hotel::findOrFail($id);
|
||||
|
||||
return response()->json($hotel);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$hotel = Hotel::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'address' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$hotel->update($validated);
|
||||
|
||||
return response()->json($hotel);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$hotel = Hotel::findOrFail($id);
|
||||
|
||||
|
||||
//if ($hotel->bookings()->exists()) {
|
||||
// return response()->json(['error' => 'Cannot delete hotel with bookings'], 400);
|
||||
//}
|
||||
|
||||
$hotel->delete();
|
||||
|
||||
return response()->json(['message' => 'Hotel deleted successfully']);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Orders extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Hamcrest\Number\OrderingComparison;
|
||||
use Illuminate\Container\Attributes\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Orders;
|
||||
|
||||
class OrdersController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return response()->json(Orders::all()->toJson);
|
||||
}
|
||||
public function create(Request $request)
|
||||
{
|
||||
$status = $request->get(key: 'status');
|
||||
$description = $request->get(key: 'description');
|
||||
|
||||
|
||||
|
||||
$order = new Order();
|
||||
$order ->status = $status;
|
||||
$order ->description = $description;
|
||||
|
||||
$order ->total = $request->get('total',0);
|
||||
$order ->save();
|
||||
|
||||
|
||||
|
||||
return response()->json($order->toJson());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\RoomType;
|
||||
use App\Models\RoomAvailability;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class RoomAvailabilityController extends Controller
|
||||
{
|
||||
public function index(Request $request, $roomTypeId)
|
||||
{
|
||||
$roomType = RoomType::findOrFail($roomTypeId);
|
||||
|
||||
$from = $request->query('from');
|
||||
$to = $request->query('to');
|
||||
|
||||
if (!$from || !$to) {
|
||||
throw ValidationException::withMessages([
|
||||
'from' => ['The from date is required.'],
|
||||
'to' => ['The to date is required.'],
|
||||
]);
|
||||
}
|
||||
|
||||
$fromDate = \DateTime::createFromFormat('Y-m-d', $from);
|
||||
$toDate = \DateTime::createFromFormat('Y-m-d', $to);
|
||||
|
||||
if (!$fromDate || !$toDate) {
|
||||
throw ValidationException::withMessages([
|
||||
'from' => ['Invalid from date format. Use YYYY-MM-DD.'],
|
||||
'to' => ['Invalid to date format. Use YYYY-MM-DD.'],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($fromDate > $toDate) {
|
||||
throw ValidationException::withMessages([
|
||||
'from' => ['From date must be before to date.'],
|
||||
]);
|
||||
}
|
||||
|
||||
$availabilities = RoomAvailability::where('room_type_id', $roomTypeId)
|
||||
->whereBetween('date', [$from, $to])
|
||||
->orderBy('date')
|
||||
->get();
|
||||
|
||||
return response()->json($availabilities);
|
||||
}
|
||||
|
||||
public function bulkUpdate(Request $request, $roomTypeId)
|
||||
{
|
||||
$roomType = RoomType::findOrFail($roomTypeId);
|
||||
|
||||
$validated = $request->validate([
|
||||
'data' => 'required|array',
|
||||
'data.*.date' => 'required|date_format:Y-m-d|after_or_equal:today',
|
||||
'data.*.is_available' => 'required|boolean',
|
||||
'data.*.price_override' => 'nullable|numeric|min:0',
|
||||
]);
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
foreach ($validated['data'] as $item) {
|
||||
RoomAvailability::updateOrCreate(
|
||||
[
|
||||
'room_type_id' => $roomTypeId,
|
||||
'date' => $item['date'],
|
||||
],
|
||||
[
|
||||
'is_available' => $item['is_available'],
|
||||
'price_override' => $item['price_override'] ?? null,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json(['message' => 'Availability updated successfully']);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Hotel;
|
||||
use App\Models\RoomType;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class RoomTypeController extends Controller
|
||||
{
|
||||
public function store(Request $request, $hotelId)
|
||||
{
|
||||
$hotel = Hotel::findOrFail($hotelId);
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'capacity' => 'required|integer|min:1',
|
||||
'base_price' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
$roomType = $hotel->roomTypes()->create($validated);
|
||||
|
||||
return response()->json($roomType, 201);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$roomType = RoomType::findOrFail($id);
|
||||
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'capacity' => 'required|integer|min:1',
|
||||
'base_price' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
$roomType->update($validated);
|
||||
|
||||
return response()->json($roomType);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$roomType = RoomType::findOrFail($id);
|
||||
|
||||
|
||||
if ($roomType->bookings()->exists()) {
|
||||
return response()->json(['error' => 'Cannot delete room type with active bookings'], 400);
|
||||
}
|
||||
|
||||
|
||||
if ($roomType->availabilities()->exists()) {
|
||||
return response()->json(['error' => 'Cannot delete room type with availability records'], 400);
|
||||
}
|
||||
|
||||
$roomType->delete();
|
||||
|
||||
return response()->json(['message' => 'Room type deleted successfully']);
|
||||
}
|
||||
|
||||
public function hotel()
|
||||
{
|
||||
return $this->belongsTo(Hotel::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function availabilities()
|
||||
{
|
||||
return $this->hasMany(RoomAvailability::class);
|
||||
}
|
||||
}
|
||||
31
app/Models/Availability.php
Normal file
31
app/Models/Availability.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Availability extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'room_type_id',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'is_available',
|
||||
'price',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_available' => 'boolean',
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
'price' => 'decimal:2',
|
||||
];
|
||||
|
||||
public function roomType()
|
||||
{
|
||||
return $this->belongsTo(RoomType::class);
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,15 @@ class Booking extends Model
|
||||
'guest_name',
|
||||
'guest_email',
|
||||
'guest_phone',
|
||||
'status',
|
||||
'confirmed_at',
|
||||
'is_confirmed',
|
||||
'total_price',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'check_in' => 'date',
|
||||
'check_out' => 'date',
|
||||
'confirmed_at' => 'datetime',
|
||||
'is_confirmed' => 'boolean',
|
||||
'total_price' => 'decimal:2',
|
||||
];
|
||||
|
||||
public function roomType()
|
||||
|
||||
@@ -16,7 +16,7 @@ class Hotel extends Model
|
||||
|
||||
public function roomTypes()
|
||||
{
|
||||
return $this->hasMany(RoomType::class);
|
||||
return $this->hasMany(\App\Models\RoomType::class);
|
||||
}
|
||||
|
||||
//public function bookings()
|
||||
|
||||
@@ -12,8 +12,8 @@ class RoomType extends Model
|
||||
protected $fillable = [
|
||||
'hotel_id',
|
||||
'name',
|
||||
'capacity',
|
||||
'base_price',
|
||||
'description',
|
||||
'max_guests',
|
||||
];
|
||||
|
||||
public function hotel()
|
||||
@@ -21,13 +21,13 @@ class RoomType extends Model
|
||||
return $this->belongsTo(Hotel::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function availabilities()
|
||||
{
|
||||
return $this->hasMany(RoomAvailability::class);
|
||||
return $this->hasMany(Availability::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(\App\Models\Booking::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,22 +22,19 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
//$this->routesPath = base_path('routes');
|
||||
$this->routes(function () {
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
|
||||
//$this->routes(function () {
|
||||
//Route::middleware('web')
|
||||
//->group($this->routesPath . '/web.php');
|
||||
|
||||
//Route::middleware(['web', 'auth'])
|
||||
//->prefix('admin')
|
||||
//->group($this->routesPath . '/admin.php');
|
||||
//});
|
||||
// Route::middleware(['web', 'auth'])
|
||||
// ->prefix('admin')
|
||||
// ->group(base_path('routes/admin.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
|
||||
628
cription' => 'С панорамным видом',
Normal file
628
cription' => 'С панорамным видом',
Normal file
@@ -0,0 +1,628 @@
|
||||
|
||||
SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS
|
||||
|
||||
Commands marked with * may be preceded by a number, _N.
|
||||
Notes in parentheses indicate the behavior if _N is given.
|
||||
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
|
||||
|
||||
h H Display this help.
|
||||
q :q Q :Q ZZ Exit.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
MMOOVVIINNGG
|
||||
|
||||
e ^E j ^N CR * Forward one line (or _N lines).
|
||||
y ^Y k ^K ^P * Backward one line (or _N lines).
|
||||
f ^F ^V SPACE * Forward one window (or _N lines).
|
||||
b ^B ESC-v * Backward one window (or _N lines).
|
||||
z * Forward one window (and set window to _N).
|
||||
w * Backward one window (and set window to _N).
|
||||
ESC-SPACE * Forward one window, but don't stop at end-of-file.
|
||||
d ^D * Forward one half-window (and set half-window to _N).
|
||||
u ^U * Backward one half-window (and set half-window to _N).
|
||||
ESC-) RightArrow * Right one half screen width (or _N positions).
|
||||
ESC-( LeftArrow * Left one half screen width (or _N positions).
|
||||
ESC-} ^RightArrow Right to last column displayed.
|
||||
ESC-{ ^LeftArrow Left to first column.
|
||||
F Forward forever; like "tail -f".
|
||||
ESC-F Like F but stop when search pattern is found.
|
||||
r ^R ^L Repaint screen.
|
||||
R Repaint screen, discarding buffered input.
|
||||
---------------------------------------------------
|
||||
Default "window" is the screen height.
|
||||
Default "half-window" is half of the screen height.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
SSEEAARRCCHHIINNGG
|
||||
|
||||
/_p_a_t_t_e_r_n * Search forward for (_N-th) matching line.
|
||||
?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line.
|
||||
n * Repeat previous search (for _N-th occurrence).
|
||||
N * Repeat previous search in reverse direction.
|
||||
ESC-n * Repeat previous search, spanning files.
|
||||
ESC-N * Repeat previous search, reverse dir. & spanning files.
|
||||
^O^N ^On * Search forward for (_N-th) OSC8 hyperlink.
|
||||
^O^P ^Op * Search backward for (_N-th) OSC8 hyperlink.
|
||||
^O^L ^Ol Jump to the currently selected OSC8 hyperlink.
|
||||
ESC-u Undo (toggle) search highlighting.
|
||||
ESC-U Clear search highlighting.
|
||||
&_p_a_t_t_e_r_n * Display only matching lines.
|
||||
---------------------------------------------------
|
||||
A search pattern may begin with one or more of:
|
||||
^N or ! Search for NON-matching lines.
|
||||
^E or * Search multiple files (pass thru END OF FILE).
|
||||
^F or @ Start search at FIRST file (for /) or last file (for ?).
|
||||
^K Highlight matches, but don't move (KEEP position).
|
||||
^R Don't use REGULAR EXPRESSIONS.
|
||||
^S _n Search for match in _n-th parenthesized subpattern.
|
||||
^W WRAP search if no match found.
|
||||
^L Enter next character literally into pattern.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
JJUUMMPPIINNGG
|
||||
|
||||
g < ESC-< * Go to first line in file (or line _N).
|
||||
G > ESC-> * Go to last line in file (or line _N).
|
||||
p % * Go to beginning of file (or _N percent into file).
|
||||
t * Go to the (_N-th) next tag.
|
||||
T * Go to the (_N-th) previous tag.
|
||||
{ ( [ * Find close bracket } ) ].
|
||||
} ) ] * Find open bracket { ( [.
|
||||
ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>.
|
||||
ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>.
|
||||
---------------------------------------------------
|
||||
Each "find close bracket" command goes forward to the close bracket
|
||||
matching the (_N-th) open bracket in the top line.
|
||||
Each "find open bracket" command goes backward to the open bracket
|
||||
matching the (_N-th) close bracket in the bottom line.
|
||||
|
||||
m_<_l_e_t_t_e_r_> Mark the current top line with <letter>.
|
||||
M_<_l_e_t_t_e_r_> Mark the current bottom line with <letter>.
|
||||
'_<_l_e_t_t_e_r_> Go to a previously marked position.
|
||||
'' Go to the previous position.
|
||||
^X^X Same as '.
|
||||
ESC-m_<_l_e_t_t_e_r_> Clear a mark.
|
||||
---------------------------------------------------
|
||||
A mark is any upper-case or lower-case letter.
|
||||
Certain marks are predefined:
|
||||
^ means beginning of the file
|
||||
$ means end of the file
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
CCHHAANNGGIINNGG FFIILLEESS
|
||||
|
||||
:e [_f_i_l_e] Examine a new file.
|
||||
^X^V Same as :e.
|
||||
:n * Examine the (_N-th) next file from the command line.
|
||||
:p * Examine the (_N-th) previous file from the command line.
|
||||
:x * Examine the first (or _N-th) file from the command line.
|
||||
^O^O Open the currently selected OSC8 hyperlink.
|
||||
:d Delete the current file from the command line list.
|
||||
= ^G :f Print current file name.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS
|
||||
|
||||
-_<_f_l_a_g_> Toggle a command line option [see OPTIONS below].
|
||||
--_<_n_a_m_e_> Toggle a command line option, by name.
|
||||
__<_f_l_a_g_> Display the setting of a command line option.
|
||||
___<_n_a_m_e_> Display the setting of an option, by name.
|
||||
+_c_m_d Execute the less cmd each time a new file is examined.
|
||||
|
||||
!_c_o_m_m_a_n_d Execute the shell command with $SHELL.
|
||||
#_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt.
|
||||
|XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command.
|
||||
s _f_i_l_e Save input to a file.
|
||||
v Edit the current file with $VISUAL or $EDITOR.
|
||||
V Print version number of "less".
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
OOPPTTIIOONNSS
|
||||
|
||||
Most options may be changed either on the command line,
|
||||
or from within less by using the - or -- command.
|
||||
Options may be given in one of two forms: either a single
|
||||
character preceded by a -, or a name preceded by --.
|
||||
|
||||
-? ........ --help
|
||||
Display help (from command line).
|
||||
-a ........ --search-skip-screen
|
||||
Search skips current screen.
|
||||
-A ........ --SEARCH-SKIP-SCREEN
|
||||
Search starts just after target line.
|
||||
-b [_N] .... --buffers=[_N]
|
||||
Number of buffers.
|
||||
-B ........ --auto-buffers
|
||||
Don't automatically allocate buffers for pipes.
|
||||
-c ........ --clear-screen
|
||||
Repaint by clearing rather than scrolling.
|
||||
-d ........ --dumb
|
||||
Dumb terminal.
|
||||
-D xx_c_o_l_o_r . --color=xx_c_o_l_o_r
|
||||
Set screen colors.
|
||||
-e -E .... --quit-at-eof --QUIT-AT-EOF
|
||||
Quit at end of file.
|
||||
-f ........ --force
|
||||
Force open non-regular files.
|
||||
-F ........ --quit-if-one-screen
|
||||
Quit if entire file fits on first screen.
|
||||
-g ........ --hilite-search
|
||||
Highlight only last match for searches.
|
||||
-G ........ --HILITE-SEARCH
|
||||
Don't highlight any matches for searches.
|
||||
-h [_N] .... --max-back-scroll=[_N]
|
||||
Backward scroll limit.
|
||||
-i ........ --ignore-case
|
||||
Ignore case in searches that do not contain uppercase.
|
||||
-I ........ --IGNORE-CASE
|
||||
Ignore case in all searches.
|
||||
-j [_N] .... --jump-target=[_N]
|
||||
Screen position of target lines.
|
||||
-J ........ --status-column
|
||||
Display a status column at left edge of screen.
|
||||
-k _f_i_l_e ... --lesskey-file=_f_i_l_e
|
||||
Use a compiled lesskey file.
|
||||
-K ........ --quit-on-intr
|
||||
Exit less in response to ctrl-C.
|
||||
-L ........ --no-lessopen
|
||||
Ignore the LESSOPEN environment variable.
|
||||
-m -M .... --long-prompt --LONG-PROMPT
|
||||
Set prompt style.
|
||||
-n ......... --line-numbers
|
||||
Suppress line numbers in prompts and messages.
|
||||
-N ......... --LINE-NUMBERS
|
||||
Display line number at start of each line.
|
||||
-o [_f_i_l_e] .. --log-file=[_f_i_l_e]
|
||||
Copy to log file (standard input only).
|
||||
-O [_f_i_l_e] .. --LOG-FILE=[_f_i_l_e]
|
||||
Copy to log file (unconditionally overwrite).
|
||||
-p _p_a_t_t_e_r_n . --pattern=[_p_a_t_t_e_r_n]
|
||||
Start at pattern (from command line).
|
||||
-P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t]
|
||||
Define new prompt.
|
||||
-q -Q .... --quiet --QUIET --silent --SILENT
|
||||
Quiet the terminal bell.
|
||||
-r -R .... --raw-control-chars --RAW-CONTROL-CHARS
|
||||
Output "raw" control characters.
|
||||
-s ........ --squeeze-blank-lines
|
||||
Squeeze multiple blank lines.
|
||||
-S ........ --chop-long-lines
|
||||
Chop (truncate) long lines rather than wrapping.
|
||||
-t _t_a_g .... --tag=[_t_a_g]
|
||||
Find a tag.
|
||||
-T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e]
|
||||
Use an alternate tags file.
|
||||
-u -U .... --underline-special --UNDERLINE-SPECIAL
|
||||
Change handling of backspaces, tabs and carriage returns.
|
||||
-V ........ --version
|
||||
Display the version number of "less".
|
||||
-w ........ --hilite-unread
|
||||
Highlight first new line after forward-screen.
|
||||
-W ........ --HILITE-UNREAD
|
||||
Highlight first new line after any forward movement.
|
||||
-x [_N[,...]] --tabs=[_N[,...]]
|
||||
Set tab stops.
|
||||
-X ........ --no-init
|
||||
Don't use termcap init/deinit strings.
|
||||
-y [_N] .... --max-forw-scroll=[_N]
|
||||
Forward scroll limit.
|
||||
-z [_N] .... --window=[_N]
|
||||
Set size of window.
|
||||
-" [_c[_c]] . --quotes=[_c[_c]]
|
||||
Set shell quote characters.
|
||||
-~ ........ --tilde
|
||||
Don't display tildes after end of file.
|
||||
-# [_N] .... --shift=[_N]
|
||||
Set horizontal scroll amount (0 = one half screen width).
|
||||
|
||||
--exit-follow-on-close
|
||||
Exit F command on a pipe when writer closes pipe.
|
||||
--file-size
|
||||
Automatically determine the size of the input file.
|
||||
--follow-name
|
||||
The F command changes files if the input file is renamed.
|
||||
--header=[_L[,_C[,_N]]]
|
||||
Use _L lines (starting at line _N) and _C columns as headers.
|
||||
--incsearch
|
||||
Search file as each pattern character is typed in.
|
||||
--intr=[_C]
|
||||
Use _C instead of ^X to interrupt a read.
|
||||
--lesskey-context=_t_e_x_t
|
||||
Use lesskey source file contents.
|
||||
--lesskey-src=_f_i_l_e
|
||||
Use a lesskey source file.
|
||||
--line-num-width=[_N]
|
||||
Set the width of the -N line number field to _N characters.
|
||||
--match-shift=[_N]
|
||||
Show at least _N characters to the left of a search match.
|
||||
--modelines=[_N]
|
||||
Read _N lines from the input file and look for vim modelines.
|
||||
--mouse
|
||||
Enable mouse input.
|
||||
--no-keypad
|
||||
Don't send termcap keypad init/deinit strings.
|
||||
--no-histdups
|
||||
Remove duplicates from command history.
|
||||
--no-number-headers
|
||||
Don't give line numbers to header lines.
|
||||
--no-search-header-lines
|
||||
Searches do not include header lines.
|
||||
--no-search-header-columns
|
||||
Searches do not include header columns.
|
||||
--no-search-headers
|
||||
Searches do not include header lines or columns.
|
||||
--no-vbell
|
||||
Disable the terminal's visual bell.
|
||||
--redraw-on-quit
|
||||
Redraw final screen when quitting.
|
||||
--rscroll=[_C]
|
||||
Set the character used to mark truncated lines.
|
||||
--save-marks
|
||||
Retain marks across invocations of less.
|
||||
--search-options=[EFKNRW-]
|
||||
Set default options for every search.
|
||||
--show-preproc-errors
|
||||
Display a message if preprocessor exits with an error status.
|
||||
--proc-backspace
|
||||
Process backspaces for bold/underline.
|
||||
--PROC-BACKSPACE
|
||||
Treat backspaces as control characters.
|
||||
--proc-return
|
||||
Delete carriage returns before newline.
|
||||
--PROC-RETURN
|
||||
Treat carriage returns as control characters.
|
||||
--proc-tab
|
||||
Expand tabs to spaces.
|
||||
--PROC-TAB
|
||||
Treat tabs as control characters.
|
||||
--status-col-width=[_N]
|
||||
Set the width of the -J status column to _N characters.
|
||||
--status-line
|
||||
Highlight or color the entire line containing a mark.
|
||||
--use-backslash
|
||||
Subsequent options use backslash as escape char.
|
||||
--use-color
|
||||
Enables colored text.
|
||||
--wheel-lines=[_N]
|
||||
Each click of the mouse wheel moves _N lines.
|
||||
--wordwrap
|
||||
Wrap lines at spaces.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
LLIINNEE EEDDIITTIINNGG
|
||||
|
||||
These keys can be used to edit text being entered
|
||||
on the "command line" at the bottom of the screen.
|
||||
|
||||
RightArrow ..................... ESC-l ... Move cursor right one character.
|
||||
LeftArrow ...................... ESC-h ... Move cursor left one character.
|
||||
ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word.
|
||||
ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word.
|
||||
HOME ........................... ESC-0 ... Move cursor to start of line.
|
||||
END ............................ ESC-$ ... Move cursor to end of line.
|
||||
BACKSPACE ................................ Delete char to left of cursor.
|
||||
DELETE ......................... ESC-x ... Delete char under cursor.
|
||||
ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor.
|
||||
ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
|
||||
ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
|
||||
UpArrow ........................ ESC-k ... Retrieve previous command line.
|
||||
DownArrow ...................... ESC-j ... Retrieve next command line.
|
||||
TAB ...................................... Complete filename & cycle.
|
||||
SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle.
|
||||
ctrl-L ................................... Complete filename, list all.
|
||||
|
||||
SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS
|
||||
|
||||
Commands marked with * may be preceded by a number, _N.
|
||||
Notes in parentheses indicate the behavior if _N is given.
|
||||
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
|
||||
|
||||
h H Display this help.
|
||||
q :q Q :Q ZZ Exit.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
MMOOVVIINNGG
|
||||
|
||||
e ^E j ^N CR * Forward one line (or _N lines).
|
||||
y ^Y k ^K ^P * Backward one line (or _N lines).
|
||||
f ^F ^V SPACE * Forward one window (or _N lines).
|
||||
b ^B ESC-v * Backward one window (or _N lines).
|
||||
z * Forward one window (and set window to _N).
|
||||
w * Backward one window (and set window to _N).
|
||||
ESC-SPACE * Forward one window, but don't stop at end-of-file.
|
||||
d ^D * Forward one half-window (and set half-window to _N).
|
||||
u ^U * Backward one half-window (and set half-window to _N).
|
||||
ESC-) RightArrow * Right one half screen width (or _N positions).
|
||||
ESC-( LeftArrow * Left one half screen width (or _N positions).
|
||||
ESC-} ^RightArrow Right to last column displayed.
|
||||
ESC-{ ^LeftArrow Left to first column.
|
||||
F Forward forever; like "tail -f".
|
||||
ESC-F Like F but stop when search pattern is found.
|
||||
r ^R ^L Repaint screen.
|
||||
R Repaint screen, discarding buffered input.
|
||||
---------------------------------------------------
|
||||
Default "window" is the screen height.
|
||||
Default "half-window" is half of the screen height.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
SSEEAARRCCHHIINNGG
|
||||
|
||||
/_p_a_t_t_e_r_n * Search forward for (_N-th) matching line.
|
||||
?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line.
|
||||
n * Repeat previous search (for _N-th occurrence).
|
||||
N * Repeat previous search in reverse direction.
|
||||
ESC-n * Repeat previous search, spanning files.
|
||||
ESC-N * Repeat previous search, reverse dir. & spanning files.
|
||||
^O^N ^On * Search forward for (_N-th) OSC8 hyperlink.
|
||||
^O^P ^Op * Search backward for (_N-th) OSC8 hyperlink.
|
||||
^O^L ^Ol Jump to the currently selected OSC8 hyperlink.
|
||||
ESC-u Undo (toggle) search highlighting.
|
||||
ESC-U Clear search highlighting.
|
||||
&_p_a_t_t_e_r_n * Display only matching lines.
|
||||
---------------------------------------------------
|
||||
A search pattern may begin with one or more of:
|
||||
^N or ! Search for NON-matching lines.
|
||||
^E or * Search multiple files (pass thru END OF FILE).
|
||||
^F or @ Start search at FIRST file (for /) or last file (for ?).
|
||||
^K Highlight matches, but don't move (KEEP position).
|
||||
^R Don't use REGULAR EXPRESSIONS.
|
||||
^S _n Search for match in _n-th parenthesized subpattern.
|
||||
^W WRAP search if no match found.
|
||||
^L Enter next character literally into pattern.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
JJUUMMPPIINNGG
|
||||
|
||||
g < ESC-< * Go to first line in file (or line _N).
|
||||
G > ESC-> * Go to last line in file (or line _N).
|
||||
p % * Go to beginning of file (or _N percent into file).
|
||||
t * Go to the (_N-th) next tag.
|
||||
T * Go to the (_N-th) previous tag.
|
||||
{ ( [ * Find close bracket } ) ].
|
||||
} ) ] * Find open bracket { ( [.
|
||||
ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>.
|
||||
ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_>.
|
||||
---------------------------------------------------
|
||||
Each "find close bracket" command goes forward to the close bracket
|
||||
matching the (_N-th) open bracket in the top line.
|
||||
Each "find open bracket" command goes backward to the open bracket
|
||||
matching the (_N-th) close bracket in the bottom line.
|
||||
|
||||
m_<_l_e_t_t_e_r_> Mark the current top line with <letter>.
|
||||
M_<_l_e_t_t_e_r_> Mark the current bottom line with <letter>.
|
||||
'_<_l_e_t_t_e_r_> Go to a previously marked position.
|
||||
'' Go to the previous position.
|
||||
^X^X Same as '.
|
||||
ESC-m_<_l_e_t_t_e_r_> Clear a mark.
|
||||
---------------------------------------------------
|
||||
A mark is any upper-case or lower-case letter.
|
||||
Certain marks are predefined:
|
||||
^ means beginning of the file
|
||||
$ means end of the file
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
CCHHAANNGGIINNGG FFIILLEESS
|
||||
|
||||
:e [_f_i_l_e] Examine a new file.
|
||||
^X^V Same as :e.
|
||||
:n * Examine the (_N-th) next file from the command line.
|
||||
:p * Examine the (_N-th) previous file from the command line.
|
||||
:x * Examine the first (or _N-th) file from the command line.
|
||||
^O^O Open the currently selected OSC8 hyperlink.
|
||||
:d Delete the current file from the command line list.
|
||||
= ^G :f Print current file name.
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS
|
||||
|
||||
-_<_f_l_a_g_> Toggle a command line option [see OPTIONS below].
|
||||
--_<_n_a_m_e_> Toggle a command line option, by name.
|
||||
__<_f_l_a_g_> Display the setting of a command line option.
|
||||
___<_n_a_m_e_> Display the setting of an option, by name.
|
||||
+_c_m_d Execute the less cmd each time a new file is examined.
|
||||
|
||||
!_c_o_m_m_a_n_d Execute the shell command with $SHELL.
|
||||
#_c_o_m_m_a_n_d Execute the shell command, expanded like a prompt.
|
||||
|XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command.
|
||||
s _f_i_l_e Save input to a file.
|
||||
v Edit the current file with $VISUAL or $EDITOR.
|
||||
V Print version number of "less".
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
OOPPTTIIOONNSS
|
||||
|
||||
Most options may be changed either on the command line,
|
||||
or from within less by using the - or -- command.
|
||||
Options may be given in one of two forms: either a single
|
||||
character preceded by a -, or a name preceded by --.
|
||||
|
||||
-? ........ --help
|
||||
Display help (from command line).
|
||||
-a ........ --search-skip-screen
|
||||
Search skips current screen.
|
||||
-A ........ --SEARCH-SKIP-SCREEN
|
||||
Search starts just after target line.
|
||||
-b [_N] .... --buffers=[_N]
|
||||
Number of buffers.
|
||||
-B ........ --auto-buffers
|
||||
Don't automatically allocate buffers for pipes.
|
||||
-c ........ --clear-screen
|
||||
Repaint by clearing rather than scrolling.
|
||||
-d ........ --dumb
|
||||
Dumb terminal.
|
||||
-D xx_c_o_l_o_r . --color=xx_c_o_l_o_r
|
||||
Set screen colors.
|
||||
-e -E .... --quit-at-eof --QUIT-AT-EOF
|
||||
Quit at end of file.
|
||||
-f ........ --force
|
||||
Force open non-regular files.
|
||||
-F ........ --quit-if-one-screen
|
||||
Quit if entire file fits on first screen.
|
||||
-g ........ --hilite-search
|
||||
Highlight only last match for searches.
|
||||
-G ........ --HILITE-SEARCH
|
||||
Don't highlight any matches for searches.
|
||||
-h [_N] .... --max-back-scroll=[_N]
|
||||
Backward scroll limit.
|
||||
-i ........ --ignore-case
|
||||
Ignore case in searches that do not contain uppercase.
|
||||
-I ........ --IGNORE-CASE
|
||||
Ignore case in all searches.
|
||||
-j [_N] .... --jump-target=[_N]
|
||||
Screen position of target lines.
|
||||
-J ........ --status-column
|
||||
Display a status column at left edge of screen.
|
||||
-k _f_i_l_e ... --lesskey-file=_f_i_l_e
|
||||
Use a compiled lesskey file.
|
||||
-K ........ --quit-on-intr
|
||||
Exit less in response to ctrl-C.
|
||||
-L ........ --no-lessopen
|
||||
Ignore the LESSOPEN environment variable.
|
||||
-m -M .... --long-prompt --LONG-PROMPT
|
||||
Set prompt style.
|
||||
-n ......... --line-numbers
|
||||
Suppress line numbers in prompts and messages.
|
||||
-N ......... --LINE-NUMBERS
|
||||
Display line number at start of each line.
|
||||
-o [_f_i_l_e] .. --log-file=[_f_i_l_e]
|
||||
Copy to log file (standard input only).
|
||||
-O [_f_i_l_e] .. --LOG-FILE=[_f_i_l_e]
|
||||
Copy to log file (unconditionally overwrite).
|
||||
-p _p_a_t_t_e_r_n . --pattern=[_p_a_t_t_e_r_n]
|
||||
Start at pattern (from command line).
|
||||
-P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t]
|
||||
Define new prompt.
|
||||
-q -Q .... --quiet --QUIET --silent --SILENT
|
||||
Quiet the terminal bell.
|
||||
-r -R .... --raw-control-chars --RAW-CONTROL-CHARS
|
||||
Output "raw" control characters.
|
||||
-s ........ --squeeze-blank-lines
|
||||
Squeeze multiple blank lines.
|
||||
-S ........ --chop-long-lines
|
||||
Chop (truncate) long lines rather than wrapping.
|
||||
-t _t_a_g .... --tag=[_t_a_g]
|
||||
Find a tag.
|
||||
-T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e]
|
||||
Use an alternate tags file.
|
||||
-u -U .... --underline-special --UNDERLINE-SPECIAL
|
||||
Change handling of backspaces, tabs and carriage returns.
|
||||
-V ........ --version
|
||||
Display the version number of "less".
|
||||
-w ........ --hilite-unread
|
||||
Highlight first new line after forward-screen.
|
||||
-W ........ --HILITE-UNREAD
|
||||
Highlight first new line after any forward movement.
|
||||
-x [_N[,...]] --tabs=[_N[,...]]
|
||||
Set tab stops.
|
||||
-X ........ --no-init
|
||||
Don't use termcap init/deinit strings.
|
||||
-y [_N] .... --max-forw-scroll=[_N]
|
||||
Forward scroll limit.
|
||||
-z [_N] .... --window=[_N]
|
||||
Set size of window.
|
||||
-" [_c[_c]] . --quotes=[_c[_c]]
|
||||
Set shell quote characters.
|
||||
-~ ........ --tilde
|
||||
Don't display tildes after end of file.
|
||||
-# [_N] .... --shift=[_N]
|
||||
Set horizontal scroll amount (0 = one half screen width).
|
||||
|
||||
--exit-follow-on-close
|
||||
Exit F command on a pipe when writer closes pipe.
|
||||
--file-size
|
||||
Automatically determine the size of the input file.
|
||||
--follow-name
|
||||
The F command changes files if the input file is renamed.
|
||||
--header=[_L[,_C[,_N]]]
|
||||
Use _L lines (starting at line _N) and _C columns as headers.
|
||||
--incsearch
|
||||
Search file as each pattern character is typed in.
|
||||
--intr=[_C]
|
||||
Use _C instead of ^X to interrupt a read.
|
||||
--lesskey-context=_t_e_x_t
|
||||
Use lesskey source file contents.
|
||||
--lesskey-src=_f_i_l_e
|
||||
Use a lesskey source file.
|
||||
--line-num-width=[_N]
|
||||
Set the width of the -N line number field to _N characters.
|
||||
--match-shift=[_N]
|
||||
Show at least _N characters to the left of a search match.
|
||||
--modelines=[_N]
|
||||
Read _N lines from the input file and look for vim modelines.
|
||||
--mouse
|
||||
Enable mouse input.
|
||||
--no-keypad
|
||||
Don't send termcap keypad init/deinit strings.
|
||||
--no-histdups
|
||||
Remove duplicates from command history.
|
||||
--no-number-headers
|
||||
Don't give line numbers to header lines.
|
||||
--no-search-header-lines
|
||||
Searches do not include header lines.
|
||||
--no-search-header-columns
|
||||
Searches do not include header columns.
|
||||
--no-search-headers
|
||||
Searches do not include header lines or columns.
|
||||
--no-vbell
|
||||
Disable the terminal's visual bell.
|
||||
--redraw-on-quit
|
||||
Redraw final screen when quitting.
|
||||
--rscroll=[_C]
|
||||
Set the character used to mark truncated lines.
|
||||
--save-marks
|
||||
Retain marks across invocations of less.
|
||||
--search-options=[EFKNRW-]
|
||||
Set default options for every search.
|
||||
--show-preproc-errors
|
||||
Display a message if preprocessor exits with an error status.
|
||||
--proc-backspace
|
||||
Process backspaces for bold/underline.
|
||||
--PROC-BACKSPACE
|
||||
Treat backspaces as control characters.
|
||||
--proc-return
|
||||
Delete carriage returns before newline.
|
||||
--PROC-RETURN
|
||||
Treat carriage returns as control characters.
|
||||
--proc-tab
|
||||
Expand tabs to spaces.
|
||||
--PROC-TAB
|
||||
Treat tabs as control characters.
|
||||
--status-col-width=[_N]
|
||||
Set the width of the -J status column to _N characters.
|
||||
--status-line
|
||||
Highlight or color the entire line containing a mark.
|
||||
--use-backslash
|
||||
Subsequent options use backslash as escape char.
|
||||
--use-color
|
||||
Enables colored text.
|
||||
--wheel-lines=[_N]
|
||||
Each click of the mouse wheel moves _N lines.
|
||||
--wordwrap
|
||||
Wrap lines at spaces.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
LLIINNEE EEDDIITTIINNGG
|
||||
|
||||
These keys can be used to edit text being entered
|
||||
on the "command line" at the bottom of the screen.
|
||||
|
||||
RightArrow ..................... ESC-l ... Move cursor right one character.
|
||||
LeftArrow ...................... ESC-h ... Move cursor left one character.
|
||||
ctrl-RightArrow ESC-RightArrow ESC-w ... Move cursor right one word.
|
||||
ctrl-LeftArrow ESC-LeftArrow ESC-b ... Move cursor left one word.
|
||||
HOME ........................... ESC-0 ... Move cursor to start of line.
|
||||
END ............................ ESC-$ ... Move cursor to end of line.
|
||||
BACKSPACE ................................ Delete char to left of cursor.
|
||||
DELETE ......................... ESC-x ... Delete char under cursor.
|
||||
ctrl-BACKSPACE ESC-BACKSPACE ........... Delete word to left of cursor.
|
||||
ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
|
||||
ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
|
||||
UpArrow ........................ ESC-k ... Retrieve previous command line.
|
||||
DownArrow ...................... ESC-j ... Retrieve next command line.
|
||||
TAB ...................................... Complete filename & cycle.
|
||||
SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle.
|
||||
ctrl-L ................................... Complete filename, list all.
|
||||
@@ -15,7 +15,7 @@ return new class extends Migration
|
||||
$table->id();
|
||||
$table->foreignId('hotel_id')->constrained()->onDelete('cascade');
|
||||
$table->string('name');
|
||||
$table->integer('capacity');
|
||||
$table->integer('capacity')->nullable()->default(2)->change();
|
||||
$table->decimal('base_price', 10, 2);
|
||||
$table->timestamps();
|
||||
});
|
||||
@@ -24,8 +24,10 @@ return new class extends Migration
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('room_types');
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
$table->integer('capacity')->default(2)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,24 +9,21 @@ return new class extends Migration
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('bookings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('booking_number')->nullable();
|
||||
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
|
||||
$table->date('check_in');
|
||||
$table->date('check_out');
|
||||
$table->string('guest_name');
|
||||
$table->string('guest_email')->nullable();
|
||||
$table->string('guest_phone')->nullable();
|
||||
$table->enum('status', ['pending', 'confirmed', 'cancelled', 'completed'])->default('pending');
|
||||
$table->enum('confirmation_type', ['auto', 'manual'])->default('auto');
|
||||
$table->unsignedBigInteger('created_by_user_id')->nullable();
|
||||
$table->timestamp('confirmed_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bookings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
|
||||
$table->date('check_in');
|
||||
$table->date('check_out');
|
||||
$table->string('guest_name');
|
||||
$table->string('guest_email');
|
||||
$table->string('guest_phone')->nullable();
|
||||
$table->boolean('is_confirmed')->default(false);
|
||||
$table->decimal('total_price', 10, 2)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('availabilities', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('room_type_id')->constrained()->onDelete('cascade');
|
||||
$table->date('start_date');
|
||||
$table->date('end_date');
|
||||
$table->boolean('is_available')->default(true);
|
||||
$table->decimal('price', 8, 2)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('availabilities');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
$table->text('description')->nullable()->after('name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
$table->dropColumn('description');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
$table->integer('max_guests')->default(2)->after('description');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
$table->dropColumn('max_guests');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
// Изменяем capacity: делаем nullable и добавляем default
|
||||
$table->integer('capacity')->nullable()->default(2)->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
$table->integer('capacity')->default(2)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
// Изменяем base_price: делаем nullable и добавляем default
|
||||
$table->decimal('base_price', 8, 2)->nullable()->default(5000.00)->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('room_types', function (Blueprint $table) {
|
||||
$table->decimal('base_price', 8, 2)->default(5000.00)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
97
resources/views/admin/hotels/_calendar.blade.php
Normal file
97
resources/views/admin/hotels/_calendar.blade.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<div>
|
||||
@if($roomTypes->isEmpty())
|
||||
<p>Нет типов номеров. <a href="{{ route('admin.room-types.create') }}">Создать тип номера</a></p>
|
||||
@else
|
||||
@foreach($roomTypes as $type)
|
||||
<div style="margin-bottom: 25px; padding: 15px; border: 1px solid #eee; border-radius: 6px;">
|
||||
<h3>{{ $type->name }}</h3>
|
||||
|
||||
<!-- Форма добавления периода -->
|
||||
<form class="availability-form" data-room-type-id="{{ $type->id }}" style="margin-bottom: 15px;">
|
||||
@csrf
|
||||
<div style="display: flex; gap: 10px; margin-bottom: 10px;">
|
||||
<input type="date" name="start_date" required style="flex:1; padding:6px; border:1px solid #ccc; border-radius:4px;">
|
||||
<input type="date" name="end_date" required style="flex:1; padding:6px; border:1px solid #ccc; border-radius:4px;">
|
||||
</div>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<label>
|
||||
<input type="checkbox" name="is_available" value="1" checked> Доступен
|
||||
</label>
|
||||
</div>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<input type="number" name="price" step="0.01" placeholder="Цена" style="width:100%; padding:6px; border:1px solid #ccc; border-radius:4px;">
|
||||
</div>
|
||||
<button type="submit" class="btn" style="padding:6px 12px;">Сохранить</button>
|
||||
</form>
|
||||
|
||||
<!-- Список периодов -->
|
||||
@if($type->availabilities->isEmpty())
|
||||
<p>Нет периодов.</p>
|
||||
@else
|
||||
<table style="width:100%; font-size:0.9rem;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>С</th>
|
||||
<th>По</th>
|
||||
<th>Статус</th>
|
||||
<th>Цена</th>
|
||||
<th>Действие</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($type->availabilities as $period)
|
||||
<tr>
|
||||
<td>{{ $period->start_date }}</td>
|
||||
<td>{{ $period->end_date }}</td>
|
||||
<td>
|
||||
@if($period->is_available)
|
||||
<span style="color:green;">Доступен</span>
|
||||
@else
|
||||
<span style="color:red;">Недоступен</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $period->price ? number_format($period->price, 2) : '-' }}</td>
|
||||
<td>
|
||||
<form method="POST" action="/admin/availability/{{ $period->id }}" style="display:inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-danger" style="padding:4px 8px; font-size:0.8rem;" onclick="return confirm('Удалить период?')">
|
||||
Удалить
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.querySelectorAll('.availability-form').forEach(form => {
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(form);
|
||||
const roomTypeId = form.dataset.roomTypeId;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/admin/room-types/${roomTypeId}/availability`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
location.reload(); // Обновить модалку
|
||||
} else {
|
||||
alert('Ошибка сохранения');
|
||||
}
|
||||
} catch (error) {
|
||||
alert('Ошибка сети');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn">Сохранить</button>
|
||||
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6c757d; text-decoration: none; margin-left: 10px;">Отмена</a>
|
||||
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6a1b9a; margin-left: 10px;">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
@endsections
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn">Сохранить</button>
|
||||
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6c757d; text-decoration: none; margin-left: 10px;">Отмена</a>
|
||||
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6a1b9a; margin-left: 10px;">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -4,7 +4,7 @@
|
||||
<div>
|
||||
<h1>Отели</h1>
|
||||
|
||||
<a href="{{ route('admin.hotels.create') }}" class="btn" style="display: inline-block; margin-bottom: 20px;">Добавить отель</a>
|
||||
<a href="{{ route('admin.hotels.create') }}" class="btn">Добавить отель</a>
|
||||
|
||||
@if($hotels->isEmpty())
|
||||
<p>Нет отелей.</p>
|
||||
@@ -25,14 +25,20 @@
|
||||
<td>{{ $hotel->address ?? '-' }}</td>
|
||||
<td>{{ $hotel->phone ?? '-' }}</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.hotels.edit', $hotel) }}" class="btn" style="background: #6c757d; margin-right: 6px;">Редактировать</a>
|
||||
<a href="{{ route('admin.hotels.edit', $hotel) }}" class="btn" style="margin-right: 5px;">
|
||||
Редактировать
|
||||
</a>
|
||||
<form action="{{ route('admin.hotels.destroy', $hotel) }}" method="POST" style="display: inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn" style="background: #aaa;" onclick="return confirm('Удалить отель?')">
|
||||
<button type="submit" class="btn btn-danger" style="margin-right: 5px;" onclick="return confirm('Удалить отель?')">
|
||||
Удалить
|
||||
</button>
|
||||
</form>
|
||||
<!-- Кнопка шахматки -->
|
||||
<button type="button" class="btn btn-secondary open-calendar-modal" data-hotel-id="{{ $hotel->id }}">
|
||||
Календарь
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@@ -40,4 +46,43 @@
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- Модальное окно для шахматки -->
|
||||
<div id="calendarModal" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:1000;">
|
||||
<div style="background:white;margin:50px auto;padding:25px;border-radius:8px;max-width:800px;box-shadow:0 4px 20px rgba(0,0,0,0.3);">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;">
|
||||
<h2>Доступные даты: <span id="modalHotelName"></span></h2>
|
||||
<button id="closeCalendarModal" style="background:none;border:none;font-size:1.5rem;cursor:pointer;">×</button>
|
||||
</div>
|
||||
<div id="calendarModalContent">Загрузка...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const modal = document.getElementById('calendarModal');
|
||||
const closeModalBtn = document.getElementById('closeCalendarModal');
|
||||
|
||||
document.querySelectorAll('.open-calendar-modal').forEach(button => {
|
||||
button.addEventListener('click', async function () {
|
||||
const hotelId = this.dataset.hotelId;
|
||||
const hotelName = this.closest('tr').querySelector('td:first-child').textContent;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/admin/hotels/${hotelId}/calendar`, {
|
||||
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
||||
});
|
||||
document.getElementById('modalHotelName').textContent = hotelName;
|
||||
document.getElementById('calendarModalContent').innerHTML = await response.text();
|
||||
modal.style.display = 'block';
|
||||
} catch (e) {
|
||||
alert('Ошибка загрузки шахматки');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
closeModalBtn.onclick = () => modal.style.display = 'none';
|
||||
window.onclick = (e) => { if (e.target === modal) modal.style.display = 'none'; };
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -17,7 +17,7 @@
|
||||
padding: 20px;
|
||||
}
|
||||
header {
|
||||
background-color: #4a4a4a;
|
||||
background-color: #4a148c;
|
||||
color: white;
|
||||
padding: 15px 20px;
|
||||
display: flex;
|
||||
@@ -26,10 +26,6 @@
|
||||
margin-bottom: 25px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
nav a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
@@ -39,7 +35,7 @@
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
nav a:hover {
|
||||
background-color: #5a5a5a;
|
||||
background-color: #6a1b9a;
|
||||
}
|
||||
main {
|
||||
background: white;
|
||||
@@ -47,13 +43,9 @@
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||
}
|
||||
h1, h2, h3 {
|
||||
color: #2d2d2d;
|
||||
margin-top: 0;
|
||||
}
|
||||
.btn {
|
||||
display: inline-block;
|
||||
background-color: #6c757d;
|
||||
background-color: #4a148c;
|
||||
color: white;
|
||||
padding: 8px 16px;
|
||||
text-decoration: none;
|
||||
@@ -63,37 +55,14 @@
|
||||
font-size: 0.95rem;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
.btn:hover {
|
||||
background-color: #5a6268;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 20px 0;
|
||||
}
|
||||
th, td {
|
||||
padding: 12px 15px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #eaeaea;
|
||||
}
|
||||
th {
|
||||
background-color: #f1f1f1;
|
||||
font-weight: 600;
|
||||
color: #444;
|
||||
}
|
||||
tr:hover {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
.alert {
|
||||
padding: 12px;
|
||||
margin: 16px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.alert-success {
|
||||
background-color: #e0f0e0;
|
||||
color: #2d5d2d;
|
||||
border-left: 4px solid #4caf50;
|
||||
}
|
||||
.btn:hover { background-color: #6a1b9a; }
|
||||
.btn-secondary { background-color: #7b1fa2; }
|
||||
.btn-secondary:hover { background-color: #9c27b0; }
|
||||
.btn-danger { background-color: #000000; }
|
||||
.btn-danger:hover { background-color: #212121; }
|
||||
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
|
||||
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eaeaea; }
|
||||
th { background-color: #f1f1f1; font-weight: 600; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -102,17 +71,17 @@
|
||||
<nav>
|
||||
<a href="{{ route('admin.hotels.index') }}">Отели</a>
|
||||
<form action="{{ route('admin.logout') }}" method="POST" style="display: inline;">
|
||||
@csrf
|
||||
<button type="submit" style="background: none; border: none; color: white; cursor: pointer; padding: 6px 12px; border-radius: 4px;">
|
||||
Выйти
|
||||
</button>
|
||||
</form>
|
||||
@csrf
|
||||
<button type="submit" style="background: none; border: none; color: white; cursor: pointer;">Выйти</button>
|
||||
</form>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
<div style="padding:12px;background:#e0f0e0;color:#2d5d2d;border-left:4px solid #4caf50;margin:16px 0;border-radius:4px;">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@yield('content')
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<h2>Вход в админку</h2>
|
||||
|
||||
@if ($errors->any())
|
||||
<div class="alert alert-error" style="background: #ffeaea; color: #c0392b; padding: 12px; border-radius: 4px; border-left: 4px solid #e74c3c; margin-bottom: 20px;">
|
||||
<div style="background: #ffeaea; color: #c0392b; padding: 12px; border-radius: 4px; margin-bottom: 20px;">
|
||||
Неверные данные.
|
||||
</div>
|
||||
@endif
|
||||
@@ -13,16 +13,15 @@
|
||||
<form method="POST" action="{{ route('admin.login') }}">
|
||||
@csrf
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="email" style="display: block; margin-bottom: 6px; font-weight: 500;">Email</label>
|
||||
<label for="email" style="display: block; margin-bottom: 6px;">Email</label>
|
||||
<input type="email" name="email" id="email" required
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;"
|
||||
value="{{ old('email') }}">
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;" value="{{ old('email') }}">
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label for="password" style="display: block; margin-bottom: 6px; font-weight: 500;">Пароль</label>
|
||||
<label for="password" style="display: block; margin-bottom: 6px;">Пароль</label>
|
||||
<input type="password" name="password" id="password" required
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px;">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn" style="width: 100%;">Войти</button>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('content')
|
||||
<div style="text-align: center; padding: 40px;">
|
||||
<h2>Вы вышли из системы</h2>
|
||||
<p>До скорой встречи!</p>
|
||||
<a href="{{ route('admin.login.form') }}" class="btn">Войти снова</a>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -17,8 +17,8 @@ Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::delete('/hotels/{id}', [HotelController::class, 'destroy']);
|
||||
});
|
||||
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::post('/bookings/{id}/invoice', [InvoiceController::class, 'generate']);
|
||||
Route::get('/hotels/{hotel}/room-types', function ($hotelId) {
|
||||
return \App\Models\RoomType::where('hotel_id', $hotelId)->get(['id', 'name']);
|
||||
});
|
||||
|
||||
Route::post('/admin/login', [AdminAuthController::class, 'login']);
|
||||
@@ -34,11 +34,6 @@ Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::get('/user', function (\Illuminate\Http\Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
Route::get('/orders', [OrdersController::class, 'index']);
|
||||
Route::post('/orders', [OrdersController::class, 'create']);
|
||||
|
||||
Route::get('/room_types', [RoomTypesController::class, 'index']);
|
||||
});
|
||||
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
@@ -53,6 +48,10 @@ Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::post('/room-types/{id}/availability/bulk', [RoomAvailabilityController::class, 'bulkUpdate']);
|
||||
});
|
||||
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::post('/bookings/{id}/invoice', [InvoiceController::class, 'generate']);
|
||||
});
|
||||
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::post('/bookings', [BookingController::class, 'store']);
|
||||
});
|
||||
|
||||
@@ -4,34 +4,33 @@ use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\Admin\HotelController;
|
||||
use App\Http\Controllers\Admin\AuthController;
|
||||
|
||||
Route::get('/admin/login', [AuthController::class, 'showLoginForm'])->name('admin.login.form');
|
||||
Route::post('/admin/login', [AuthController::class, 'login'])->name('admin.login');
|
||||
// Вход
|
||||
Route::get('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'showLoginForm'])->name('admin.login.form');
|
||||
Route::post('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'login'])->name('admin.login');
|
||||
|
||||
// Админка (требует авторизации)
|
||||
Route::middleware('auth')->prefix('admin')->group(function () {
|
||||
Route::get('/hotels', [HotelController::class, 'index'])->name('admin.hotels.index');
|
||||
Route::get('/hotels/create', [HotelController::class, 'create'])->name('admin.hotels.create');
|
||||
Route::post('/hotels', [HotelController::class, 'store'])->name('admin.hotels.store');
|
||||
Route::get('/hotels/{hotel}/edit', [HotelController::class, 'edit'])->name('admin.hotels.edit');
|
||||
Route::put('/hotels/{hotel}', [HotelController::class, 'update'])->name('admin.hotels.update');
|
||||
Route::delete('/hotels/{hotel}', [HotelController::class, 'destroy'])->name('admin.hotels.destroy');
|
||||
// Отели
|
||||
Route::get('/hotels', [\App\Http\Controllers\Admin\HotelController::class, 'index'])->name('admin.hotels.index');
|
||||
Route::get('/hotels/create', [\App\Http\Controllers\Admin\HotelController::class, 'create'])->name('admin.hotels.create');
|
||||
Route::post('/hotels', [\App\Http\Controllers\Admin\HotelController::class, 'store'])->name('admin.hotels.store');
|
||||
Route::get('/hotels/{hotel}/edit', [\App\Http\Controllers\Admin\HotelController::class, 'edit'])->name('admin.hotels.edit');
|
||||
Route::put('/hotels/{hotel}', [\App\Http\Controllers\Admin\HotelController::class, 'update'])->name('admin.hotels.update');
|
||||
Route::delete('/hotels/{hotel}', [\App\Http\Controllers\Admin\HotelController::class, 'destroy'])->name('admin.hotels.destroy');
|
||||
// Шахматка для отеля
|
||||
Route::get('/hotels/{hotelId}/calendar', [\App\Http\Controllers\Admin\HotelController::class, 'calendar'])->name('admin.hotels.calendar');
|
||||
// Сохранение периода
|
||||
Route::post('/room-types/{roomType}/availability', [\App\Http\Controllers\Admin\AvailabilityController::class, 'store'])->name('admin.availability.store');
|
||||
// Удаление периода
|
||||
Route::delete('/availability/{availability}', [\App\Http\Controllers\Admin\AvailabilityController::class, 'destroy'])->name('admin.availability.destroy');
|
||||
// Бронирования
|
||||
Route::get('/bookings/create', [\App\Http\Controllers\Admin\BookingController::class, 'create'])->name('admin.bookings.create');
|
||||
Route::post('/bookings', [\App\Http\Controllers\Admin\BookingController::class, 'store'])->name('admin.bookings.store');
|
||||
|
||||
Route::post('/logout', [AuthController::class, 'logout'])->name('admin.logout');
|
||||
// Выход
|
||||
Route::post('/logout', [\App\Http\Controllers\Admin\AuthController::class, 'logout'])->name('admin.logout');
|
||||
});
|
||||
|
||||
// → форма входа
|
||||
Route::get('/admin/login', [AuthController::class, 'showLoginForm'])->name('admin.login.form');
|
||||
Route::post('/admin/login', [AuthController::class, 'login'])->name('admin.login');
|
||||
|
||||
// → админка
|
||||
Route::middleware('auth')->prefix('admin')->group(function () {
|
||||
Route::get('/hotels', [HotelController::class, 'index'])->name('admin.hotels.index');
|
||||
Route::post('/logout', [AuthController::class, 'logout'])->name('admin.logout');
|
||||
});
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::get('/{any?}', function () {
|
||||
return view('app');
|
||||
})->where('any', '.*');
|
||||
// Вход
|
||||
Route::get('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'showLoginForm'])->name('admin.login.form');
|
||||
Route::post('/admin/login', [\App\Http\Controllers\Admin\AuthController::class, 'login'])->name('admin.login');
|
||||
Reference in New Issue
Block a user