misc
This commit is contained in:
parent
4e2c1837ee
commit
60f32a6468
@ -13,6 +13,7 @@
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Str;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class DepartmentResource extends Resource
|
||||
@ -26,9 +27,13 @@ public static function form(Form $form): Form
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('guid')
|
||||
->label('Unique ID')
|
||||
->default(sprintf('DEP-%s', Str::of(Uuid::uuid4())->lower()))
|
||||
->disabled()
|
||||
->dehydrated()
|
||||
->required()
|
||||
->maxLength(40)
|
||||
->default(sprintf('FAC-%s', Uuid::uuid4())),
|
||||
->unique(ignoreRecord: true),
|
||||
Toggle::make('is_active')
|
||||
->required(),
|
||||
Select::make('organization_id')
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
use App\Filament\Resources\OrganizationResource\Pages;
|
||||
use App\Models\Organization;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
@ -14,6 +15,7 @@
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Str;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class OrganizationResource extends Resource
|
||||
@ -27,15 +29,20 @@ public static function form(Form $form): Form
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('guid')
|
||||
->label('Unique ID')
|
||||
->default(sprintf('ORG-%s', Str::of(Uuid::uuid4())->lower()))
|
||||
->disabled()
|
||||
->dehydrated()
|
||||
->required()
|
||||
->maxLength(40)
|
||||
->default(sprintf('INS-%s', Uuid::uuid4())),
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
->unique(ignoreRecord: true),
|
||||
Toggle::make('is_active')
|
||||
->required(),
|
||||
TextInput::make('address')
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->unique(ignoreRecord: true)
|
||||
->maxLength(255),
|
||||
TextArea::make('address')
|
||||
->maxLength(255),
|
||||
TextInput::make('logo_path')
|
||||
->maxLength(255),
|
||||
|
@ -7,7 +7,6 @@
|
||||
use App\Models\User;
|
||||
use App\Services\ACL\RoleService;
|
||||
use App\Services\TimezoneList;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
@ -41,7 +40,7 @@ public static function form(Form $form): Form
|
||||
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('guid')
|
||||
TextInput::make('guid')
|
||||
->label('Unique ID')
|
||||
->default(sprintf('USR-%s', Str::of(Uuid::uuid4())->lower()))
|
||||
->disabled()
|
||||
|
@ -10,7 +10,7 @@ public function up(): void
|
||||
{
|
||||
Schema::create('organizations', static function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('guid', 40)->unique()->index()->default(DB::raw("concat('INS-', gen_random_uuid())"));
|
||||
$table->string('guid', 40)->unique()->index()->default(DB::raw("concat('ORG-', gen_random_uuid())"));
|
||||
$table->string('name')->unique();
|
||||
$table->boolean('is_active')->default(false);
|
||||
$table->string('address')->nullable();
|
||||
|
@ -11,7 +11,7 @@ public function up(): void
|
||||
{
|
||||
Schema::create('departments', static function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('guid', 40)->unique()->index()->default(DB::raw("concat('FAC-', gen_random_uuid())"));
|
||||
$table->string('guid', 40)->unique()->index()->default(DB::raw("concat('DEP-', gen_random_uuid())"));
|
||||
$table->boolean('is_active')->default(false)->index();
|
||||
$table->foreignIdFor(Organization::class)->constrained()->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
|
Loading…
Reference in New Issue
Block a user