Added Breeze

This commit is contained in:
amikhaylov
2026-05-18 23:43:26 +03:00
parent 0c06d83b0b
commit c9a514b0fa
17 changed files with 249 additions and 59 deletions
+7 -5
View File
@@ -14,13 +14,12 @@ class MapController extends Controller
private array $apiParams; private array $apiParams;
public function index(int $id) public function index(int $id)
{ {
$this->apiParams = array( $this->apiParams = [
"apikey" => $this->yandex_key, "apikey" => $this->yandex_key,
"lang" =>"ru_RU", "lang" =>"ru_RU",
); ];
$apiCall = $this->createApiCall(); $apiCall = $this->createApiCall();
@@ -32,10 +31,13 @@ class MapController extends Controller
public function getPlace(int $id) public function getPlace(int $id)
{ {
$place = Place::find($id); $place = Place::find($id);
[ $x, $y ] = explode("|",$place->Gps); [ $x, $y ] = explode("|", $place->gps);
return response()->json([ return response()->json([
'x' => $x, 'y' => $y 'x' => $x,
'y' => $y,
'id' => $id,
'name' => $place->Name,
]); ]);
} }
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Http\Controllers;
use App\Models\ORM\Place;
use Illuminate\Http\Request;
class PlacesController extends Controller
{
public function index()
{
$places = Place::paginate(10);
return view('places.index', compact('places'));
}
public function store(Request $request) {
$data = $request->validate([
'name' => 'required|string|max:255',
'lat' => 'required|numeric',
'lng' => 'required|numeric',
]);
Place::create($data);
return redirect()
->route('places.index')
->with('status', 'Локация создана!');
}
public function edit(Place $place) {
return view('places.edit', compact('place'));
}
public function update(Request $request, Place $place) {
$data = $request->validate([
'name' => 'required|string|max:255',
'lat' => 'required|numeric',
'lng' => 'required|numeric',
]);
$place->update($data);
return redirect()
->route('places.index')
->with('status', 'Обновлено!');
}
public function destroy(Place $place) {
$place->delete();
return redirect()
->route('places.index')
->with('status', 'Удалено!');
}
}
+7 -7
View File
@@ -12,18 +12,18 @@ class GigsLoader
$data = Event::select( $data = Event::select(
"Event.Name as event", "Event.Name as event",
"Event.PlaceId as place_id", "Event.PlaceId as place_id",
"Place.Name as place", "places.name as place",
"Place.Address as address", "places.address as address",
"Place.Phone as phone", "places.phone as phone",
"Place.Url as url", "places.url as url",
DB::Raw("DAY(Event.Date) as mday"), DB::Raw("DAY(Event.Date) as mday"),
DB::Raw("MONTH(Event.Date) as month"), DB::Raw("MONTH(Event.Date) as month"),
DB::Raw("DATE_FORMAT(Event.Time, '%H:%s') as time"), DB::Raw("DATE_FORMAT(Event.Time, '%H:%s') as time"),
DB::Raw("CONCAT(DATE_FORMAT(Event.Date,'%Y-%m-%d'), DB::Raw("CONCAT(DATE_FORMAT(Event.Date,'%Y-%m-%d'),
'T',DATE_FORMAT(Event.Time, '%H:%i:%s')) as fulldate") 'T',DATE_FORMAT(Event.Time, '%H:%i:%s')) as fulldate")
)->join("Place", function ($join){ )->join("places", function ($join){
$join->on("Place.Id", "=", "Event.PlaceId") $join->on("places.id", "=", "Event.PlaceId")
->where("Place.DeleteDate", NULL); ->where("places.deleted_at", NULL);
}); });
$data = $data->get(); $data = $data->get();
+13 -7
View File
@@ -2,18 +2,24 @@
namespace App\Models\Loaders; namespace App\Models\Loaders;
use App\Models\ORM\User; use App\Models\ORM\User as Contact;
class UsersLoader class UsersLoader
{ {
public function getContacts(): array public function getContacts(): array
{ {
$data = User::select( $data = Contact::select(
"users.id","users.login","users.firstName","users.lastName", "users.id",
"users.phone", "users.email", "users.vkcom as webPage", "users.name as first_name",
"users.img_large","users.img_small","contactRoles.name as role" "users.last_name",
)->join("contactRoles", "users.contactRole", "=", "contactRoles.id") "users.phone",
->where("users.useAsContact", 1) "users.email",
"users.vk_id as web_page",
"users.img_large",
"users.img_small",
"contact_roles.description as role"
)->join("contact_roles", "users.contact_role", "=", "contact_roles.id")
->where("users.use_as_contact", 1)
->get(); ->get();
return $data ? $data->toArray() : []; return $data ? $data->toArray() : [];
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Models\ORM;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ContactRole extends Model
{
use HasFactory;
protected $primaryKey = 'id';
protected $table = 'contact_roles';
}
+4 -4
View File
@@ -9,10 +9,10 @@ class Place extends Model
{ {
use SoftDeletes; use SoftDeletes;
const CREATED_AT = 'DateOfCreation'; const CREATED_AT = 'created_at';
const UPDATED_AT = 'UpdateDate'; const UPDATED_AT = 'updated_at';
const DELETED_AT = 'DeleteDate'; const DELETED_AT = 'deleted_at';
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $table = 'Place'; protected $table = 'places';
} }
+3 -10
View File
@@ -5,7 +5,6 @@ namespace App\Models\Objects;
class Contact class Contact
{ {
private ?int $id; private ?int $id;
private string $login;
private string $firstName; private string $firstName;
private string $lastName; private string $lastName;
private string $phone; private string $phone;
@@ -51,12 +50,11 @@ class Contact
public function setAttributes(array $attributes = []):void public function setAttributes(array $attributes = []):void
{ {
$this->id = $attributes['id'] ?? null; $this->id = $attributes['id'] ?? null;
$this->login = $attributes['login']; $this->firstName = $attributes['first_name'];
$this->firstName = $attributes['firstName']; $this->lastName = $attributes['last_name'];
$this->lastName = $attributes['lastName'];
$this->phone = $attributes['phone']; $this->phone = $attributes['phone'];
$this->email = $attributes['email']; $this->email = $attributes['email'];
$this->webPage = $attributes['webPage'] ?? null; $this->webPage = $attributes['web_page'] ?? null;
$this->role = $attributes['role'] ?? null; $this->role = $attributes['role'] ?? null;
$this->imgSmall = $this->setImagePath($attributes['img_small']) ?? null; $this->imgSmall = $this->setImagePath($attributes['img_small']) ?? null;
$this->imgLarge = $this->setImagePath($attributes['img_large']) ?? null; $this->imgLarge = $this->setImagePath($attributes['img_large']) ?? null;
@@ -88,11 +86,6 @@ class Contact
return $this->id; return $this->id;
} }
public function getLogin(): string
{
return $this->login;
}
public function getFirstName(): string public function getFirstName(): string
{ {
return $this->firstName; return $this->firstName;
+2 -1
View File
@@ -2,6 +2,7 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
@@ -19,6 +20,6 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
// Paginator::useTailwind();
} }
} }
+1
View File
@@ -15,6 +15,7 @@
}, },
"require-dev": { "require-dev": {
"fakerphp/faker": "^1.23", "fakerphp/faker": "^1.23",
"laravel/breeze": "^2.4",
"laravel/pail": "^1.2.2", "laravel/pail": "^1.2.2",
"laravel/pint": "^1.24", "laravel/pint": "^1.24",
"laravel/sail": "^1.41", "laravel/sail": "^1.41",
@@ -11,12 +11,27 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('contact_roles', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->timestamp('created_at')->default(now());
$table->timestamp('updated_at')->useCurrent();
});
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->string('last_name')->nullable();
$table->string('phone')->nullable();
$table->string('vk_id')->nullable();
$table->string('email')->unique(); $table->string('email')->unique();
$table->boolean('use_as_contact')->default(false);
$table->integer('contact_role')->default(0);
$table->string('img_small')->nullable();
$table->string('img_large')->nullable();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password')->nullable();
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
}); });
@@ -42,6 +57,7 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('contact_roles');
Schema::dropIfExists('users'); Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens'); Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions'); Schema::dropIfExists('sessions');
+8 -4
View File
@@ -2,7 +2,7 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\Models\User; use App\Models\ORM\ContactRole;
use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@@ -17,9 +17,13 @@ class DatabaseSeeder extends Seeder
{ {
// User::factory(10)->create(); // User::factory(10)->create();
User::factory()->create([ ContactRole::insert([
'name' => 'Test User', [ 'name' => 'tech', 'description' => 'Технические вопросы' ],
'email' => 'test@example.com', [ 'name' => 'org', 'description' => 'Организация концертов' ]
]);
$this->call([
UserSeeder::class,
]); ]);
} }
} }
+5 -1
View File
@@ -7,11 +7,15 @@
"dev": "vite" "dev": "vite"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/vite": "^4.0.0", "@tailwindcss/vite": "^4.0.0",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
"axios": "^1.11.0", "axios": "^1.11.0",
"concurrently": "^9.0.1", "concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0", "laravel-vite-plugin": "^2.0.0",
"tailwindcss": "^4.0.0", "postcss": "^8.4.31",
"tailwindcss": "^3.1.0",
"vite": "^7.0.7" "vite": "^7.0.7"
} }
} }
+3 -11
View File
@@ -1,11 +1,3 @@
@import 'tailwindcss'; @tailwind base;
@tailwind components;
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php'; @tailwind utilities;
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}
+6
View File
@@ -1 +1,7 @@
import './bootstrap'; import './bootstrap';
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();
+81
View File
@@ -0,0 +1,81 @@
@push('scripts')
<script>
/**
* Открывает всплывающее окно для локации
*/
const openMap = (name, id, width = 640, height = 480) => {
const url = `/${name}/index/id/${id}`;
const windowName = `${name}_window_${id}`;
const features = `width=${width},height=${height},scrollbars=yes,resizable=yes`;
window.open(url, windowName, features);
};
</script>
@endpush
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Концертные площадки') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900">
<!-- Сюда вставляйте вашу таблицу или данные -->
<div class="p-6 text-gray-900">
<table class="min-w-full border">
<thead>
<tr class="bg-gray-100">
<th class="border p-2">ID</th>
<th class="border p-2">Название</th>
<th class="border p-2">Адрес</th>
<th class="border p-2 w-48">Телефон</th>
<th class="border p-2 ">Карта</th>
</tr>
</thead>
<tbody>
@foreach($places as $place)
<tr>
<td class="border p-2">{{ $place->id }}</td>
<td class="border p-2">
<a class="text-indigo-600 hover:text-indigo-900 transition-colors"
href="{{ $place->url }}">{{ $place->name }}</a>
</td>
<td class="border p-2">{{ $place->address }}</td>
<td class="border p-2">{{ $place->phone }}</td>
<td class="p-2 border text-center w-12">
<a href="#" title="Показать на карте"
class="text-gray-500 hover:text-blue-600 transition-colors flex items-center justify-center"
onclick="openMap('map', {{ $place->id }}); return false;">
<svg class="size-6 w-5 h-5 text-blue-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z" />
</svg>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="mt-4 flex justify-start pagination-wrapper">
{{ $places->links() }}
</div>
</div>
</div>
</div>
</div>
</div>
</x-app-layout>
<style>
/* Прямая правка стилей без компиляции Tailwind */
nav[role="navigation"] div,
nav[role="navigation"] a,
nav[role="navigation"] span {
background-color: white !important;
color: #374151 !important; /* Серый текст */
border-color: #e5e7eb !important; /* Светлая рамка */
}
</style>
+25
View File
@@ -1,5 +1,6 @@
<?php <?php
use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Http\Controllers\MainController; use App\Http\Controllers\MainController;
use App\Http\Controllers\RiderController; use App\Http\Controllers\RiderController;
@@ -9,6 +10,29 @@ use App\Http\Controllers\GigsController;
use App\Http\Controllers\NewsController; use App\Http\Controllers\NewsController;
use App\Http\Controllers\ContactsController; use App\Http\Controllers\ContactsController;
use App\Http\Controllers\MapController; use App\Http\Controllers\MapController;
use App\Http\Controllers\PlacesController;
Route::get('/welcome', function () {
return view('welcome');
});
Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
Route::middleware('auth')->group(function () {
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});
Route::middleware('auth')
->group(function () {
Route::get('/places', [PlacesController::class, 'index'])->name('places.index');
Route::patch('/places', [PlacesController::class, 'update'])->name('places.update');
Route::post('/places', [PlacesController::class, 'create'])->name('places.create');
Route::delete('/places', [PlacesController::class, 'delete'])->name('places.delete');
});
Route::get('/', [MainController::class, 'index']); Route::get('/', [MainController::class, 'index']);
Route::get('/rider', [RiderController::class, 'index']); Route::get('/rider', [RiderController::class, 'index']);
@@ -22,3 +46,4 @@ Route::get('/contacts', [ContactsController::class, 'index']);
Route::get('/map/index/id/{id}', [ MapController::class, 'index' ]); Route::get('/map/index/id/{id}', [ MapController::class, 'index' ]);
Route::get('/api/getplace/id/{id}', [ MapController::class, 'getPlace' ]); Route::get('/api/getplace/id/{id}', [ MapController::class, 'getPlace' ]);
require __DIR__.'/auth.php';
-7
View File
@@ -1,6 +1,5 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin'; import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
@@ -8,11 +7,5 @@ export default defineConfig({
input: ['resources/css/app.css', 'resources/js/app.js'], input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true, refresh: true,
}), }),
tailwindcss(),
], ],
server: {
watch: {
ignored: ['**/storage/framework/views/**'],
},
},
}); });