orchidsoftware / crud

Simplify the process of building CRUD (Create, Read, Update, Delete) functionality in Laravel using the features of Orchid.
https://orchid.software
MIT License
143 stars 36 forks source link

does it work laravel columns in crud #83

Open batenko1 opened 1 year ago

batenko1 commented 1 year ago

does it work laravel columns in crud?

batenko1 commented 1 year ago

I mean the use of the ability to break into blocks in the crud fields method

tabuna commented 1 year ago

What do you mean by blocks?

batenko1 commented 1 year ago

in laravel orchid, screens have a layout method that supports the Layout::columns, Layout::rows methods - to break information with fields into blocks. and making the page a little more interesting design. I would like to know in laravel orchid crud for example in PostResourcs the fields method does not support these Layout methods. is it possible to support them?

batenko1 commented 1 year ago

public function fields(): array { return [

        Layout::columns([
            Layout::rows([
                CheckBox::make('disabled')->sendTrueOrFalse()
            ])
        ]),

        Group::make([
            Input::make('name')->title('Назва')->placeholder('Вкажіть назву')->required(),
            Input::make('slug')->type('url')->title('Посилання')->placeholder('Формується автоматично від назви')->required(),

        ]),

    ];
}

--dont work in CRUD PostResource

batenko1 commented 1 year ago

public function layout(): iterable { return [ Layout::columns([ Layout::rows([

                Input::make('name')
                    ->title('Full Name:')
                    ->placeholder('Enter full name')
                    ->required()
                    ->help('Please enter your full name'),

                Input::make('email')
                    ->title('Email address')
                    ->placeholder('Email address')
                    ->help("We'll never share your email with anyone else.")
                    ->popover('Tooltip - hint that user opens himself.'),

                Password::make('password')
                    ->title('Password')
                    ->placeholder('Password'),

                Label::make('static')
                    ->title('Static:')
                    ->value('email@example.com'),

                Select::make('select')
                    ->title('Select')
                    ->options([1, 2]),

                CheckBox::make('checkbox')
                    ->title('Checkbox')
                    ->placeholder('Remember me'),

                Radio::make('radio')
                    ->placeholder('Yes')
                    ->value(1)
                    ->title('Radio'),

                Radio::make('radio')
                    ->placeholder('No')
                    ->value(0),

                TextArea::make('textarea')
                    ->title('Example textarea')
                    ->rows(6),

            ])->title('Base Controls'),
            Layout::rows([
                Input::make('disabled_input')
                    ->title('Disabled Input')
                    ->placeholder('Disabled Input')
                    ->help('A disabled input element is unusable and un-clickable.')
                    ->disabled(),

                Select::make('disabled_select')
                    ->title('Disabled select')
                    ->options([1, 2])
                    ->value(0)
                    ->disabled(),

                TextArea::make('disabled_textarea')
                    ->title('Disabled textarea')
                    ->placeholder('Disabled textarea')
                    ->rows(6)
                    ->disabled(),

                Input::make('readonly_input')
                    ->title('Readonly Input')
                    ->placeholder('Readonly Input')
                    ->readonly(),

                CheckBox::make('readonly_checkbox')
                    ->title('Readonly Checkbox')
                    ->placeholder('Remember me')
                    ->disabled(),

                Radio::make('radio')
                    ->placeholder('Yes')
                    ->value(1)
                    ->title('Radio')
                    ->disabled(),

                Radio::make('radio')
                    ->placeholder('No')
                    ->value(0)
                    ->disabled(),

                TextArea::make('readonly_textarea')
                    ->title('Readonlyd textarea')
                    ->placeholder('Readonlyd textarea')
                    ->rows(7)
                    ->disabled(),

            ])->title('Input States'),
        ]),

        Layout::rows([
            Group::make([
                Button::make('Primary')->method('buttonClickProcessing')->type(Color::PRIMARY()),
                Button::make('Secondary')->method('buttonClickProcessing')->type(Color::SECONDARY()),
                Button::make('Success')->method('buttonClickProcessing')->type(Color::SUCCESS()),
                Button::make('Danger')->method('buttonClickProcessing')->type(Color::DANGER()),
                Button::make('Warning')->method('buttonClickProcessing')->type(Color::WARNING()),
                Button::make('Info')->method('buttonClickProcessing')->type(Color::INFO()),
                Button::make('Light')->method('buttonClickProcessing')->type(Color::LIGHT()),
                Button::make('Dark')->method('buttonClickProcessing')->type(Color::DARK()),
                Button::make('Default')->method('buttonClickProcessing')->type(Color::DEFAULT()),
                Button::make('Link')->method('buttonClickProcessing')->type(Color::LINK()),
            ])->autoWidth(),
        ])->title('Buttons'),

        Layout::rows([
            Input::make('test')
                ->title('Text')
                ->value('Artisanal kale')
                ->help('Basic single-line text fields.')
                ->horizontal(),

            Input::make('search')
                ->type('search')
                ->title('Search')
                ->value('How do I shoot web')
                ->help('Text fields designed for the user to enter search queries into.')
                ->horizontal(),

            Input::make('email')
                ->type('email')
                ->title('Email')
                ->value('bootstrap@example.com')
                ->help('Used to let the user enter and edit an e-mail address')
                ->horizontal(),

            Input::make('url')
                ->type('url')
                ->title('Url')
                ->value('https://getbootstrap.com')
                ->horizontal()
                ->help('You might use this when asking to input their website address for a business directory'),

            Input::make('tel')
                ->type('tel')
                ->title('Telephone')
                ->value('1-(555)-555-5555')
                ->horizontal()
                ->popover('The device’s autocomplete mechanisms kick in and suggest
                    phone numbers that can be autofilled with a single tap.')
                ->help('Focusing input on a telephone field brings up
                    a numeric keypad ready for keying in a number.'),

            Input::make('password')
                ->type('password')
                ->title('Password')
                ->value('Password')
                ->horizontal(),

            Input::make('number')
                ->type('number')
                ->title('Number')
                ->value(42)
                ->horizontal(),

            Input::make('date_and_time')
                ->type('datetime-local')
                ->title('Date and time')
                ->value('2011-08-19T13:45:00')
                ->horizontal(),

            Input::make('date')
                ->type('date')
                ->title('Date')
                ->value('2011-08-19')
                ->horizontal(),

            Input::make('month')
                ->type('month')
                ->title('Month')
                ->value('2011-08')
                ->horizontal(),

            Input::make('week')
                ->type('week')
                ->title('Week')
                ->value('2011-W33')
                ->horizontal(),

            Input::make('Time')
                ->type('time')
                ->title('Time')
                ->value('13:45:00')
                ->horizontal(),

            Input::make('datalist')
                ->title('Datalist example')
                ->help('Most browsers include some support for "datalist"
                             elements, their styling is inconsistent at best.')
                ->datalist([
                    'San Francisco',
                    'New York',
                    'Seattle',
                    'Los Angeles',
                    'Chicago',
                ])
                ->horizontal(),

            Input::make('color')
                ->type('color')
                ->title('Color')
                ->value('#563d7c')
                ->horizontal(),

            Button::make('Submit')
                ->method('buttonClickProcessing')
                ->type(Color::DEFAULT()),

        ])->title('Textual HTML5 Inputs'),
    ];

    but this worked in layout