widgets, fontawesome add
This commit is contained in:
parent
32fbc234ef
commit
22f7ecff6a
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/app/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
|
35
app/Widgets/ActionButtonWidget.php
Normal file
35
app/Widgets/ActionButtonWidget.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Widgets;
|
||||
|
||||
use Arrilot\Widgets\AbstractWidget;
|
||||
use itguild\forms\debug\Debug;
|
||||
|
||||
class ActionButtonWidget extends AbstractWidget
|
||||
{
|
||||
/**
|
||||
* The configuration array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
* Treat this method as a controller action.
|
||||
* Return view() or other content to display.
|
||||
*/
|
||||
public function run(): \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory|\Illuminate\Foundation\Application
|
||||
{
|
||||
$label = $this->config['label'];
|
||||
$btn_type = $this->config['btn_type'];
|
||||
$url = $this->config['url'];
|
||||
$title = $this->config['title'] ?? '';
|
||||
|
||||
return view('widgets.action_button_widget', [
|
||||
'label' => $label,
|
||||
'btn_type' => $btn_type,
|
||||
'url' => $url,
|
||||
'title' => $title
|
||||
]);
|
||||
}
|
||||
}
|
33
app/Widgets/IconBtnCreateWidget.php
Normal file
33
app/Widgets/IconBtnCreateWidget.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Widgets;
|
||||
|
||||
use Arrilot\Widgets\AbstractWidget;
|
||||
|
||||
class IconBtnCreateWidget extends AbstractWidget
|
||||
{
|
||||
/**
|
||||
* The configuration array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
* Treat this method as a controller action.
|
||||
* Return view() or other content to display.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$url = $this->config['url'];
|
||||
|
||||
$btn = new ActionButtonWidget([
|
||||
// 'label' => "<i class='fa-regular fa-square-plus'></i>",
|
||||
'label' => "Создать",
|
||||
'url' => $url,
|
||||
'btn_type' => "success",
|
||||
'title' => "Создать"
|
||||
]);
|
||||
$btn->run();
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"arrilot/laravel-widgets": "^3.14",
|
||||
"itguild/eloquent-table": "^0.4.1",
|
||||
"itguild/forms": "^0.1.1",
|
||||
"itguild/tables": "^1.0",
|
||||
|
72
composer.lock
generated
72
composer.lock
generated
@ -4,8 +4,76 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1b652e2f5c2b778dd44a54aa287f214d",
|
||||
"content-hash": "d893f1de2b5bcd2628b67c5c6798a7e4",
|
||||
"packages": [
|
||||
{
|
||||
"name": "arrilot/laravel-widgets",
|
||||
"version": "3.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/arrilot/laravel-widgets.git",
|
||||
"reference": "99419f5b6190825733c731bd3b44f49fdc56a6ad"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/arrilot/laravel-widgets/zipball/99419f5b6190825733c731bd3b44f49fdc56a6ad",
|
||||
"reference": "99419f5b6190825733c731bd3b44f49fdc56a6ad",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/cache": ">=9",
|
||||
"illuminate/console": ">=9",
|
||||
"illuminate/container": ">=9",
|
||||
"illuminate/contracts": ">=9",
|
||||
"illuminate/routing": ">=9",
|
||||
"illuminate/support": ">=9",
|
||||
"illuminate/view": ">=9",
|
||||
"php": ">=7.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"nunomaduro/larastan": "^2.6",
|
||||
"phpunit/phpunit": "~8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Widget": "Arrilot\\Widgets\\Facade",
|
||||
"AsyncWidget": "Arrilot\\Widgets\\AsyncFacade"
|
||||
},
|
||||
"providers": [
|
||||
"Arrilot\\Widgets\\ServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Arrilot\\Widgets\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nekrasov Ilya",
|
||||
"email": "nekrasov.ilya90@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A powerful alternative to view composers. Asynchronous widgets, reloadable widgets, console generator, caching - everything you can think of.",
|
||||
"homepage": "https://github.com/arrilot/laravel-widgets",
|
||||
"keywords": [
|
||||
"ajax",
|
||||
"laravel",
|
||||
"widgets"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/arrilot/laravel-widgets/issues",
|
||||
"source": "https://github.com/arrilot/laravel-widgets/tree/3.14.0"
|
||||
},
|
||||
"time": "2023-11-19T18:27:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "brick/math",
|
||||
"version": "0.12.1",
|
||||
@ -8470,5 +8538,5 @@
|
||||
"php": "^8.2"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
2471
package-lock.json
generated
2471
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,5 +16,10 @@
|
||||
"sass": "^1.56.1",
|
||||
"tailwindcss": "^3.4.13",
|
||||
"vite": "^6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^6.7.2",
|
||||
"font-awesome": "^4.7.0",
|
||||
"npm": "^11.0.0"
|
||||
}
|
||||
}
|
||||
|
10
public/build/assets/app-BTTmoT1y.js
Normal file
10
public/build/assets/app-BTTmoT1y.js
Normal file
File diff suppressed because one or more lines are too long
9
public/build/assets/app-VAjrHIxo.css
Normal file
9
public/build/assets/app-VAjrHIxo.css
Normal file
File diff suppressed because one or more lines are too long
BIN
public/build/assets/fa-brands-400-D1LuMI3I.ttf
Normal file
BIN
public/build/assets/fa-brands-400-D1LuMI3I.ttf
Normal file
Binary file not shown.
BIN
public/build/assets/fa-brands-400-D_cYUPeE.woff2
Normal file
BIN
public/build/assets/fa-brands-400-D_cYUPeE.woff2
Normal file
Binary file not shown.
BIN
public/build/assets/fa-regular-400-BjRzuEpd.woff2
Normal file
BIN
public/build/assets/fa-regular-400-BjRzuEpd.woff2
Normal file
Binary file not shown.
BIN
public/build/assets/fa-regular-400-DZaxPHgR.ttf
Normal file
BIN
public/build/assets/fa-regular-400-DZaxPHgR.ttf
Normal file
Binary file not shown.
BIN
public/build/assets/fa-solid-900-CTAAxXor.woff2
Normal file
BIN
public/build/assets/fa-solid-900-CTAAxXor.woff2
Normal file
Binary file not shown.
BIN
public/build/assets/fa-solid-900-D0aA9rwL.ttf
Normal file
BIN
public/build/assets/fa-solid-900-D0aA9rwL.ttf
Normal file
Binary file not shown.
BIN
public/build/assets/fa-v4compatibility-C9RhG_FT.woff2
Normal file
BIN
public/build/assets/fa-v4compatibility-C9RhG_FT.woff2
Normal file
Binary file not shown.
BIN
public/build/assets/fa-v4compatibility-CCth-dXg.ttf
Normal file
BIN
public/build/assets/fa-v4compatibility-CCth-dXg.ttf
Normal file
Binary file not shown.
45
public/build/manifest.json
Normal file
45
public/build/manifest.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.ttf": {
|
||||
"file": "assets/fa-brands-400-D1LuMI3I.ttf",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.ttf"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2": {
|
||||
"file": "assets/fa-brands-400-D_cYUPeE.woff2",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.ttf": {
|
||||
"file": "assets/fa-regular-400-DZaxPHgR.ttf",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.ttf"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.woff2": {
|
||||
"file": "assets/fa-regular-400-BjRzuEpd.woff2",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.woff2"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.ttf": {
|
||||
"file": "assets/fa-solid-900-D0aA9rwL.ttf",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.ttf"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2": {
|
||||
"file": "assets/fa-solid-900-CTAAxXor.woff2",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-v4compatibility.ttf": {
|
||||
"file": "assets/fa-v4compatibility-CCth-dXg.ttf",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-v4compatibility.ttf"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts/fa-v4compatibility.woff2": {
|
||||
"file": "assets/fa-v4compatibility-C9RhG_FT.woff2",
|
||||
"src": "node_modules/@fortawesome/fontawesome-free/webfonts/fa-v4compatibility.woff2"
|
||||
},
|
||||
"resources/js/app.js": {
|
||||
"file": "assets/app-BTTmoT1y.js",
|
||||
"name": "app",
|
||||
"src": "resources/js/app.js",
|
||||
"isEntry": true
|
||||
},
|
||||
"resources/sass/app.scss": {
|
||||
"file": "assets/app-VAjrHIxo.css",
|
||||
"src": "resources/sass/app.scss",
|
||||
"isEntry": true
|
||||
}
|
||||
}
|
@ -6,3 +6,7 @@
|
||||
|
||||
// Bootstrap
|
||||
@import 'bootstrap/scss/bootstrap';
|
||||
|
||||
// Fontawesome
|
||||
@import '@fortawesome/fontawesome-free/css/all.css';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ $title ?? 'Todo Manager' }}</title>
|
||||
<link rel="stylesheet" href="/build/assets/app-BaVMVknW.css">
|
||||
<link rel="stylesheet" href="/build/assets/app-VAjrHIxo.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Todos</h1>
|
||||
|
@ -6,67 +6,77 @@
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
//if ($errors->any())
|
||||
|
||||
$form = new \itguild\forms\ActiveForm();
|
||||
$form->beginForm(isset($model) ? "/admin/user/edit/" . $model->id : "/admin/user/store", enctype: 'multipart/form-data');
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "username", params: [
|
||||
'class' => "form-control",
|
||||
'placeholder' => 'Логин',
|
||||
'value' => $model->username ?? ''
|
||||
])
|
||||
->setLabel("Логин")
|
||||
->render();
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "password", params: [
|
||||
'class' => "form-control",
|
||||
'type' => "password",
|
||||
])
|
||||
->setLabel("Пароль")
|
||||
->render();
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "email", params: [
|
||||
'class' => "form-control",
|
||||
'type' => "email",
|
||||
'placeholder' => 'test@mail.ru',
|
||||
'value' => $model->email ?? ''
|
||||
])
|
||||
->setLabel("Email")
|
||||
->render();
|
||||
|
||||
if (!empty($model->user_photo)){
|
||||
echo "<div><img src='$model->user_photo' width='200px'></div>";
|
||||
}
|
||||
$form->field(class: \itguild\forms\inputs\File::class, name: "user_photo", params: [
|
||||
'class' => "form-control",
|
||||
'value' => $model->user_photo ?? ''
|
||||
])
|
||||
->setLabel("Фото профиля")
|
||||
->render();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2"><?php
|
||||
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
|
||||
'class' => "btn btn-primary ",
|
||||
'value' => 'Отправить',
|
||||
'typeInput' => 'submit'
|
||||
<x-main>
|
||||
<x-slot:title>
|
||||
Custom Title
|
||||
</x-slot>
|
||||
|
||||
@php
|
||||
$form = new \itguild\forms\ActiveForm();
|
||||
$form->beginForm(isset($model) ? "/admin/user/edit/" . $model->id : "/admin/user/store", enctype: 'multipart/form-data');
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "username", params: [
|
||||
'class' => "form-control",
|
||||
'placeholder' => 'Логин',
|
||||
'value' => $model->username ?? ''
|
||||
])
|
||||
->setLabel("Логин")
|
||||
->render();
|
||||
?>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<?php
|
||||
$form->field(\itguild\forms\inputs\Button::class, name: "btn-reset", params: [
|
||||
'class' => "btn btn-warning",
|
||||
'value' => 'Сбросить',
|
||||
'typeInput' => 'reset'
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "password", params: [
|
||||
'class' => "form-control",
|
||||
'type' => "password",
|
||||
])
|
||||
->setLabel("Пароль")
|
||||
->render();
|
||||
?>
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "email", params: [
|
||||
'class' => "form-control",
|
||||
'type' => "email",
|
||||
'placeholder' => 'test@mail.ru',
|
||||
'value' => $model->email ?? ''
|
||||
])
|
||||
->setLabel("Email")
|
||||
->render();
|
||||
|
||||
if (!empty($model->user_photo)){
|
||||
echo "<div><img src='$model->user_photo' width='200px'></div>";
|
||||
}
|
||||
$form->field(class: \itguild\forms\inputs\File::class, name: "user_photo", params: [
|
||||
'class' => "form-control",
|
||||
'value' => $model->user_photo ?? ''
|
||||
])
|
||||
->setLabel("Фото профиля")
|
||||
->render();
|
||||
@endphp
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
@php
|
||||
$form->field(\itguild\forms\inputs\Button::class, name: "btn-submit", params: [
|
||||
'class' => "btn btn-primary ",
|
||||
'value' => 'Отправить',
|
||||
'typeInput' => 'submit'
|
||||
])
|
||||
->render();
|
||||
@endphp
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
@php
|
||||
$form->field(\itguild\forms\inputs\Button::class, name: "btn-reset", params: [
|
||||
'class' => "btn btn-warning",
|
||||
'value' => 'Сбросить',
|
||||
'typeInput' => 'reset'
|
||||
])
|
||||
->render();
|
||||
@endphp
|
||||
@csrf
|
||||
@php
|
||||
$form->endForm();
|
||||
@endphp
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@csrf
|
||||
<?php
|
||||
$form->endForm();
|
||||
</x-main>
|
||||
|
||||
|
@ -35,8 +35,22 @@ $table->columns([
|
||||
return (new DateTimeImmutable($data))->format("d-m-Y");
|
||||
}
|
||||
]);
|
||||
//$table->beforePrint(function () {
|
||||
// return IconBtnCreateWidget::create(['url' => '/admin/user/create'])->run();
|
||||
//});
|
||||
$table->beforePrint(function () {
|
||||
return "<a title='Создать' class='btn btn-success' href='/admin/user/create' style='margin: 3px' ><i class='fa-regular fa-square-plus'></i></a>";
|
||||
});
|
||||
$table->addAction(function($row) {
|
||||
return "<a title='Просмотреть' class='btn btn-primary' href='/admin/user/view/" . $row['id'] . "' style='margin: 3px' ><i class='<i class='fa-regular fa-eye'></i></a>";
|
||||
});
|
||||
$table->addAction(function($row) {
|
||||
return "<a title='Редактировать' class='btn btn-success' href='/admin/user/update/" . $row['id'] . "' style='margin: 3px' ><i class='fa-solid fa-pen'></i></a>";
|
||||
});
|
||||
$table->addAction(function($row) {
|
||||
return "<a title='Удалить' class='btn btn-danger' href='/admin/user/delete/" . $row['id'] . "' style='margin: 3px' ><i class='fa-regular fa-trash-can'></i></a>";
|
||||
});
|
||||
$table->create();
|
||||
//$table->render();
|
||||
|
||||
?>
|
||||
<x-main>
|
||||
|
@ -31,4 +31,15 @@ $table->rows([
|
||||
}
|
||||
]);
|
||||
$table->create();
|
||||
$table->render();
|
||||
?>
|
||||
|
||||
<x-main>
|
||||
<x-slot:title>
|
||||
Custom Title
|
||||
</x-slot>
|
||||
|
||||
@php
|
||||
$table->render();
|
||||
@endphp
|
||||
|
||||
</x-main>
|
||||
|
13
resources/views/widgets/action_button_widget.blade.php
Normal file
13
resources/views/widgets/action_button_widget.blade.php
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<x-main>
|
||||
<x-slot:title>
|
||||
Custom Title
|
||||
</x-slot>
|
||||
|
||||
<a title="{{ $title }}" class='btn btn-{{ $btn_type }}' href='{{ $url }}' style='margin: 3px' >{{ $label }}</a>
|
||||
|
||||
</x-main>
|
1
resources/views/widgets/icon_btn_create_widget.blade.php
Normal file
1
resources/views/widgets/icon_btn_create_widget.blade.php
Normal file
@ -0,0 +1 @@
|
||||
<a title="{{ $title }}" class='btn btn-{{ $btn_type }}' href='{{ $url }}' style='margin: 3px' >{{ $label }}</a>
|
Loading…
x
Reference in New Issue
Block a user