Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix section icon when shoe the form as a page #265

Merged
merged 3 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"pest_2.34.2","defects":[],"times":{"P\\Tests\\FormsTest::__pest_evaluable_it_see_ended_form_date":0.033,"P\\Tests\\FormsTest::__pest_evaluable_it_can_not_edit":0.136,"P\\Tests\\FormsTest::__pest_evaluable_it_can_list_Form":0.007,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_date_is_valid":0.011,"P\\Tests\\FormsTest::__pest_evaluable_it_the_form_can_be_rendered":0.007,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_list_Forms":0.01,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_when_not_require_login":0.007,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_Form_List":0.12,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_require_login_for_guest_user":0.009,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_show_Form":0.009,"P\\Tests\\FormsTest::__pest_evaluable_it_can_create":0.005,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_when_not_require_login_for_guest":0.007,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_require_login_for_logged_in_user":0.007,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_create_form_page":0.124,"P\\Tests\\FormsTest::__pest_evaluable_it_can_save":1.187,"P\\Tests\\FormsTest::__pest_evaluable_it_can_retrieve_data":0.047,"P\\Tests\\ArchTest::__pest_evaluable_it_will_not_use_debugging_functions":0.169,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_test":0.003,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_render_form_list":0.046,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_render_category_list":0.071,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_render_collection_list":0.027}}
{"version":"pest_2.34.5","defects":[],"times":{"P\\Tests\\ArchTest::__pest_evaluable_it_will_not_use_debugging_functions":0.236,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_test":0.004,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_render_collection_list":0.205,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_render_form_list":0.076,"P\\Tests\\ResourcesTest::__pest_evaluable_it_can_render_category_list":0.082,"P\\Tests\\FormsTest::__pest_evaluable_it_can_retrieve_data":0.112,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_require_login_for_logged_in_user":0.015,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_Form_List":0.05,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_when_not_require_login_for_guest":0.009,"P\\Tests\\FormsTest::__pest_evaluable_it_can_save":1.285,"P\\Tests\\FormsTest::__pest_evaluable_it_the_form_can_be_rendered":0.008,"P\\Tests\\FormsTest::__pest_evaluable_it_can_not_edit":0.047,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_require_login_for_guest_user":0.01,"P\\Tests\\FormsTest::__pest_evaluable_it_can_create":0.006,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_date_is_valid":0.013,"P\\Tests\\FormsTest::__pest_evaluable_it_see_form_when_not_require_login":0.008,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_list_Forms":0.014,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_create_form_page":0.089,"P\\Tests\\FormsTest::__pest_evaluable_it_see_ended_form_date":0.008,"P\\Tests\\FormsTest::__pest_evaluable_it_can_list_Form":0.006,"P\\Tests\\FormsTest::__pest_evaluable_it_can_render_show_Form":0.011}}
383 changes: 191 additions & 192 deletions composer.lock

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions database/factories/CategoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ class CategoryFactory extends Factory
{
protected $model = Category::class;

/**
* Define the model's default state.
*
* @return array
*
* @throws \JsonException
*/
public function definition()
public function definition(): array
{
return [
'name' => $this->faker->words(3, true),
Expand Down
9 changes: 1 addition & 8 deletions database/factories/CollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ class CollectionFactory extends Factory
{
protected $model = Collection::class;

/**
* Define the model's default state.
*
* @return array
*
* @throws \JsonException
*/
public function definition()
public function definition(): array
{
return [
'name' => $this->faker->words(3, true),
Expand Down
7 changes: 1 addition & 6 deletions database/factories/FieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class FieldFactory extends Factory
{
protected $model = Field::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
public function definition(): array
{
return [
'name' => $this->faker->words(3, true),
Expand Down
7 changes: 1 addition & 6 deletions database/factories/FieldResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class FieldResponseFactory extends Factory
{
protected $model = FieldResponse::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
public function definition(): array
{
return [
'form_id' => BoltPlugin::getModel('Forms')::factory(),
Expand Down
7 changes: 1 addition & 6 deletions database/factories/FormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class FormFactory extends Factory
{
protected $model = Form::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
public function definition(): array
{
return [
'name' => $this->faker->words(3, true),
Expand Down
7 changes: 1 addition & 6 deletions database/factories/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class ResponseFactory extends Factory
{
protected $model = Response::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
public function definition(): array
{
return [
'form_id' => BoltPlugin::getModel('Form')::factory(),
Expand Down
7 changes: 1 addition & 6 deletions database/factories/SectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ class SectionFactory extends Factory
{
protected $model = Section::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
public function definition(): array
{
return [
'name' => $this->faker->words(3, true),
Expand Down
3 changes: 0 additions & 3 deletions database/factories/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ class UserFactory extends Factory
{
protected $model = User::class;

/**
* Define the model's default state.
*/
public function definition(): array
{
return [
Expand Down
1 change: 1 addition & 0 deletions src/Concerns/Designer.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ private static function drawSections(Form $zeusForm, ZeusSection $section, array
->description($section->description)
->aside(fn () => $section->aside)
->compact(fn () => $section->compact)
->icon($section->icon ?? null)
->collapsible();

if (optional($zeusForm->options)['show-as'] === 'tabs') {
Expand Down
9 changes: 5 additions & 4 deletions src/Fields/FieldsContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,16 @@ public function appendFilamentComponentsOptions($component, $zeusField, bool $ha
return true;
}

if (is_array($get('zeusData.' . $relatedField))) {
return in_array($relatedFieldValues, $get('zeusData.' . $relatedField));
$relatedFieldArray = Arr::wrap($get('zeusData.' . $relatedField));
if (in_array($relatedFieldValues, $relatedFieldArray)) {
return true;
}

return $relatedFieldValues === $get('zeusData.' . $relatedField);
return false;
});

if ($hasVisibility) {
return $component->live(onBlur: $hasVisibility);
return $component->live();
}

return $component;
Expand Down