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;
public function index(int $id)
{
$this->apiParams = array(
$this->apiParams = [
"apikey" => $this->yandex_key,
"lang" =>"ru_RU",
);
];
$apiCall = $this->createApiCall();
@@ -32,10 +31,13 @@ class MapController extends Controller
public function getPlace(int $id)
{
$place = Place::find($id);
[ $x, $y ] = explode("|",$place->Gps);
[ $x, $y ] = explode("|", $place->gps);
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(
"Event.Name as event",
"Event.PlaceId as place_id",
"Place.Name as place",
"Place.Address as address",
"Place.Phone as phone",
"Place.Url as url",
"places.name as place",
"places.address as address",
"places.phone as phone",
"places.url as url",
DB::Raw("DAY(Event.Date) as mday"),
DB::Raw("MONTH(Event.Date) as month"),
DB::Raw("DATE_FORMAT(Event.Time, '%H:%s') as time"),
DB::Raw("CONCAT(DATE_FORMAT(Event.Date,'%Y-%m-%d'),
'T',DATE_FORMAT(Event.Time, '%H:%i:%s')) as fulldate")
)->join("Place", function ($join){
$join->on("Place.Id", "=", "Event.PlaceId")
->where("Place.DeleteDate", NULL);
)->join("places", function ($join){
$join->on("places.id", "=", "Event.PlaceId")
->where("places.deleted_at", NULL);
});
$data = $data->get();
+13 -7
View File
@@ -2,18 +2,24 @@
namespace App\Models\Loaders;
use App\Models\ORM\User;
use App\Models\ORM\User as Contact;
class UsersLoader
{
public function getContacts(): array
{
$data = User::select(
"users.id","users.login","users.firstName","users.lastName",
"users.phone", "users.email", "users.vkcom as webPage",
"users.img_large","users.img_small","contactRoles.name as role"
)->join("contactRoles", "users.contactRole", "=", "contactRoles.id")
->where("users.useAsContact", 1)
$data = Contact::select(
"users.id",
"users.name as first_name",
"users.last_name",
"users.phone",
"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();
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;
const CREATED_AT = 'DateOfCreation';
const UPDATED_AT = 'UpdateDate';
const DELETED_AT = 'DeleteDate';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
const DELETED_AT = 'deleted_at';
protected $primaryKey = 'id';
protected $table = 'Place';
protected $table = 'places';
}
+3 -10
View File
@@ -5,7 +5,6 @@ namespace App\Models\Objects;
class Contact
{
private ?int $id;
private string $login;
private string $firstName;
private string $lastName;
private string $phone;
@@ -51,12 +50,11 @@ class Contact
public function setAttributes(array $attributes = []):void
{
$this->id = $attributes['id'] ?? null;
$this->login = $attributes['login'];
$this->firstName = $attributes['firstName'];
$this->lastName = $attributes['lastName'];
$this->firstName = $attributes['first_name'];
$this->lastName = $attributes['last_name'];
$this->phone = $attributes['phone'];
$this->email = $attributes['email'];
$this->webPage = $attributes['webPage'] ?? null;
$this->webPage = $attributes['web_page'] ?? null;
$this->role = $attributes['role'] ?? null;
$this->imgSmall = $this->setImagePath($attributes['img_small']) ?? null;
$this->imgLarge = $this->setImagePath($attributes['img_large']) ?? null;
@@ -88,11 +86,6 @@ class Contact
return $this->id;
}
public function getLogin(): string
{
return $this->login;
}
public function getFirstName(): string
{
return $this->firstName;
+2 -1
View File
@@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@@ -19,6 +20,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot(): void
{
//
Paginator::useTailwind();
}
}
+2 -1
View File
@@ -15,6 +15,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.4",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",
@@ -86,4 +87,4 @@
},
"minimum-stability": "stable",
"prefer-stable": true
}
}
@@ -11,12 +11,27 @@ return new class extends Migration
*/
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) {
$table->id();
$table->string('name');
$table->string('last_name')->nullable();
$table->string('phone')->nullable();
$table->string('vk_id')->nullable();
$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->string('password');
$table->string('password')->nullable();
$table->rememberToken();
$table->timestamps();
});
@@ -42,6 +57,7 @@ return new class extends Migration
*/
public function down(): void
{
Schema::dropIfExists('contact_roles');
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
+8 -4
View File
@@ -2,7 +2,7 @@
namespace Database\Seeders;
use App\Models\User;
use App\Models\ORM\ContactRole;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
@@ -17,9 +17,13 @@ class DatabaseSeeder extends Seeder
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
ContactRole::insert([
[ 'name' => 'tech', 'description' => 'Технические вопросы' ],
[ 'name' => 'org', 'description' => 'Организация концертов' ]
]);
$this->call([
UserSeeder::class,
]);
}
}
+5 -1
View File
@@ -7,11 +7,15 @@
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/vite": "^4.0.0",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
"axios": "^1.11.0",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0",
"tailwindcss": "^4.0.0",
"postcss": "^8.4.31",
"tailwindcss": "^3.1.0",
"vite": "^7.0.7"
}
}
+3 -11
View File
@@ -1,11 +1,3 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@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';
}
@tailwind base;
@tailwind components;
@tailwind utilities;
+6
View File
@@ -1 +1,7 @@
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
use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\MainController;
use App\Http\Controllers\RiderController;
@@ -9,6 +10,29 @@ use App\Http\Controllers\GigsController;
use App\Http\Controllers\NewsController;
use App\Http\Controllers\ContactsController;
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('/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('/api/getplace/id/{id}', [ MapController::class, 'getPlace' ]);
require __DIR__.'/auth.php';
-7
View File
@@ -1,6 +1,5 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [
@@ -8,11 +7,5 @@ export default defineConfig({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
tailwindcss(),
],
server: {
watch: {
ignored: ['**/storage/framework/views/**'],
},
},
});