initial commit
This commit is contained in:
commit
1e1aa7d461
215 changed files with 35140 additions and 0 deletions
10
app/View/Components/ClassIcon.php
Normal file
10
app/View/Components/ClassIcon.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class ClassIcon extends Icon
|
||||
{
|
||||
protected $prefix = 'classes';
|
||||
}
|
||||
32
app/View/Components/Form.php
Normal file
32
app/View/Components/Form.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Form extends Component
|
||||
{
|
||||
public string $method;
|
||||
|
||||
public $spoofMethod = false;
|
||||
|
||||
public function __construct($method = 'POST')
|
||||
{
|
||||
if (in_array($method, ['DELETE'])) {
|
||||
$this->spoofMethod = $method;
|
||||
$method = 'POST';
|
||||
}
|
||||
|
||||
$this->method = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.form');
|
||||
}
|
||||
}
|
||||
37
app/View/Components/Form/Input.php
Normal file
37
app/View/Components/Form/Input.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Form;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Input extends Component
|
||||
{
|
||||
public string $type;
|
||||
|
||||
public ?string $id;
|
||||
|
||||
public string $name;
|
||||
|
||||
public ?string $value;
|
||||
|
||||
public string $disabled;
|
||||
|
||||
public function __construct($name, ?string $id = null, string $type = 'text', ?string $value = null, bool $disabled = false)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->type = $type;
|
||||
$this->name = $name;
|
||||
$this->value = old($name, $value);
|
||||
$this->disabled = $disabled ? 'disabled=disabled' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.inputs.input');
|
||||
}
|
||||
}
|
||||
11
app/View/Components/Form/Password.php
Normal file
11
app/View/Components/Form/Password.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Form;
|
||||
|
||||
class Password extends Input
|
||||
{
|
||||
public function __construct($name = 'password', ?string $id = null, ?string $value = null, bool $disabled = false)
|
||||
{
|
||||
parent::__construct($name, $id, 'password', $value, $disabled);
|
||||
}
|
||||
}
|
||||
37
app/View/Components/Form/Select.php
Normal file
37
app/View/Components/Form/Select.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Form;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Select extends Component
|
||||
{
|
||||
public ?string $id;
|
||||
|
||||
public string $name;
|
||||
|
||||
public ?string $value;
|
||||
|
||||
public string $disabled;
|
||||
|
||||
public $options;
|
||||
|
||||
public function __construct($name, $options, ?string $id = null, ?string $value = null, bool $disabled = false)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->value = old($name, $value);
|
||||
$this->disabled = $disabled ? 'disabled=disabled' : '';
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.inputs.select');
|
||||
}
|
||||
}
|
||||
34
app/View/Components/Form/Textarea.php
Normal file
34
app/View/Components/Form/Textarea.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components\Form;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Textarea extends Component
|
||||
{
|
||||
public ?string $id;
|
||||
|
||||
public string $name;
|
||||
|
||||
public ?string $value;
|
||||
|
||||
public string $disabled;
|
||||
|
||||
public function __construct($name, ?string $id = null, ?string $value = null, bool $disabled = false)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->value = old($name, $value);
|
||||
$this->disabled = $disabled ? 'disabled=disabled' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.form.inputs.textarea');
|
||||
}
|
||||
}
|
||||
35
app/View/Components/Icon.php
Normal file
35
app/View/Components/Icon.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
abstract class Icon extends Component
|
||||
{
|
||||
protected $prefix = '';
|
||||
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $name)
|
||||
{
|
||||
$file = sprintf('%s/%s.jpg', $this->prefix, Str::lower($name));
|
||||
$this->url = Storage::disk('images')->url($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.class-icon');
|
||||
}
|
||||
}
|
||||
33
app/View/Components/Layout.php
Normal file
33
app/View/Components/Layout.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Layout extends Component
|
||||
{
|
||||
/**
|
||||
* Layout script
|
||||
*/
|
||||
protected string $name;
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name = 'default')
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view("layouts.{$this->name}");
|
||||
}
|
||||
}
|
||||
53
app/View/Components/Notifications.php
Normal file
53
app/View/Components/Notifications.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Notifications extends Component
|
||||
{
|
||||
/**
|
||||
* Types of messages.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $types = [ 'info', 'success', 'warning', 'error' ];
|
||||
|
||||
/**
|
||||
* Position (left,center or right)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public string $position = 'center';
|
||||
|
||||
/**
|
||||
* Type and css class mapping.
|
||||
*/
|
||||
protected $cssClasses = [
|
||||
'info' => 'info',
|
||||
'success' => 'success',
|
||||
'warning' => 'warning',
|
||||
'error' => 'danger'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$messages = [];
|
||||
|
||||
foreach($this->types as $type) {
|
||||
|
||||
if (Session::has($type)) {
|
||||
$class = $this->cssClasses[$type];
|
||||
$messages[$class] = Session::get($type);
|
||||
}
|
||||
}
|
||||
|
||||
return view('components.notifications', [ 'messages' => $messages ]);
|
||||
}
|
||||
}
|
||||
8
app/View/Components/ProfessionIcon.php
Normal file
8
app/View/Components/ProfessionIcon.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
class ProfessionIcon extends Icon
|
||||
{
|
||||
protected $prefix = 'professions';
|
||||
}
|
||||
Reference in a new issue