From 893bea1492a68018363dc5328508d52144bb76e3 Mon Sep 17 00:00:00 2001 From: ncoronel Date: Fri, 31 Jul 2026 12:06:13 -0300 Subject: [PATCH] feat(website-type): add login_header_footer_color field and update related tests --- app/Domains/Tenant/Models/WebsiteType.php | 1 + app/Domains/Tenant/Resources/TenantResource.php | 12 ------------ .../Tenant/Services/TenantInformationService.php | 1 - ...presentation_fields_to_website_type_table.php | 4 +++- public/images/website_types/shopit_logo.png | Bin 0 -> 3120 bytes .../Tenant/BootstrapTenantControllerTest.php | 1 + .../Feature/Tenant/StoreTenantWithExtrasTest.php | 2 +- tests/Feature/Tenant/WebsiteExtrasTest.php | 3 +++ tests/Feature/Tenant/WebsiteTypeServiceTest.php | 2 ++ 9 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 public/images/website_types/shopit_logo.png diff --git a/app/Domains/Tenant/Models/WebsiteType.php b/app/Domains/Tenant/Models/WebsiteType.php index 8bc62b7..308236f 100644 --- a/app/Domains/Tenant/Models/WebsiteType.php +++ b/app/Domains/Tenant/Models/WebsiteType.php @@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; 'secondary_color', 'danger_color', 'success_color', + 'login_header_footer_color', 'site_logo', ])] class WebsiteType extends Model diff --git a/app/Domains/Tenant/Resources/TenantResource.php b/app/Domains/Tenant/Resources/TenantResource.php index 5c98f9e..abdff89 100644 --- a/app/Domains/Tenant/Resources/TenantResource.php +++ b/app/Domains/Tenant/Resources/TenantResource.php @@ -32,18 +32,6 @@ class TenantResource extends JsonResource 'header_bg_color' => $this->header_bg_color, 'footer_bg_color' => $this->footer_bg_color, 'website_type_code' => $this->website_type_code, - 'website_type' => $this->whenLoaded( - 'websiteType', - fn () => $this->websiteType ? [ - 'codigo' => $this->websiteType->codigo, - 'nombre' => $this->websiteType->nombre, - 'primary_color' => $this->websiteType->primary_color, - 'secondary_color' => $this->websiteType->secondary_color, - 'danger_color' => $this->websiteType->danger_color, - 'success_color' => $this->websiteType->success_color, - 'site_logo' => $this->websiteType->siteLogo?->getTemporaryUrl(1440), - ] : null - ), 'extras' => $this->whenLoaded( 'websiteExtras', fn () => $this->websiteExtras diff --git a/app/Domains/Tenant/Services/TenantInformationService.php b/app/Domains/Tenant/Services/TenantInformationService.php index 11826bb..10fdf18 100644 --- a/app/Domains/Tenant/Services/TenantInformationService.php +++ b/app/Domains/Tenant/Services/TenantInformationService.php @@ -14,7 +14,6 @@ class TenantInformationService 'headerLogo', 'footerLogo', 'socialMedia', - 'websiteType.siteLogo', 'websiteExtras.websiteTypeExtra', ]; diff --git a/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php b/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php index 2127445..0be6a26 100644 --- a/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php +++ b/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php @@ -13,7 +13,8 @@ return new class extends Migration $table->string('secondary_color')->nullable()->after('primary_color'); $table->string('danger_color')->nullable()->after('secondary_color'); $table->string('success_color')->nullable()->after('danger_color'); - $table->unsignedBigInteger('site_logo')->nullable()->after('success_color'); + $table->string('login_header_footer_color')->nullable()->after('success_color'); + $table->unsignedBigInteger('site_logo')->nullable()->after('login_header_footer_color'); $table->foreign('site_logo') ->references('id') @@ -34,6 +35,7 @@ return new class extends Migration 'secondary_color', 'danger_color', 'success_color', + 'login_header_footer_color', 'site_logo', ]); }); diff --git a/public/images/website_types/shopit_logo.png b/public/images/website_types/shopit_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..12cd5949e73fbee21064307f7be9861ad5642c53 GIT binary patch literal 3120 zcmV-04A1k4P)+#mPe>@cXes=5bIw~$&wNHEs#J#6UFM}Jjyb$zvf zJt0SM2443WNO=ZLL5Ky!%Rj^f7SN&)VCue4e)COp1ctM zUH%R~CP;JbyPIDyS*|AQ(V}cy@e!>67TSeG^cjw2%_~aGO zwdqz#C??Bu_(9Qey^uMv6l3Oe@}aaay&oEVtWzKB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5R*LT_q6OASPv(YK}I@UA{-Pk(fZ(Z zqIGG!8YpF-IlttDLI}bAJ((FN((8qN<1hPpN~qm!LLHBQDR|2;k;hAg84e&VJ&^AO zu9913Uv4C-h=NCq%>VwI=0#&rT(P3_aF|o25-ZFPnLp}K*ewlF`-m9yN6P6TMP93say1sQ)+p?!r-l>Q~;dmZ+zvvpWyF60o7 z1A*dd-OsLCJ62}!eq!e#UQwxt4n908F`*-X`;x1JIhl$F@H1Cd;}q?<1l!rU$$p6G zxNn(k-0Gn+Buoq36@n-GPTL+kx+%=Pg^7g-z+^zNV|;6wHu1a09Q0n|M2W5Z+0%^6 z<~#Q*dF*I5|!flvW(Zl+8}dJ4ZPo%fi7wB_fS+U-|Q_6@6PgM*Iy`;d#BxcAKaG0000< KMNUMnLSTZe-|FZ9 literal 0 HcmV?d00001 diff --git a/tests/Feature/Tenant/BootstrapTenantControllerTest.php b/tests/Feature/Tenant/BootstrapTenantControllerTest.php index 84f40e2..ac87b6c 100644 --- a/tests/Feature/Tenant/BootstrapTenantControllerTest.php +++ b/tests/Feature/Tenant/BootstrapTenantControllerTest.php @@ -172,6 +172,7 @@ class BootstrapTenantControllerTest extends TestCase $this->getJson('/api/tenants/bootstrap/acme.com') ->assertOk() + ->assertJsonMissingPath('data.website_type') ->assertJsonPath('data.extras.contact.phone', '+54 341 555 0101') ->assertJsonMissingPath('data.extras.banner'); } diff --git a/tests/Feature/Tenant/StoreTenantWithExtrasTest.php b/tests/Feature/Tenant/StoreTenantWithExtrasTest.php index 025d706..4bd1b3e 100644 --- a/tests/Feature/Tenant/StoreTenantWithExtrasTest.php +++ b/tests/Feature/Tenant/StoreTenantWithExtrasTest.php @@ -39,7 +39,7 @@ class StoreTenantWithExtrasTest extends TestCase $response ->assertCreated() ->assertJsonPath('data.website_type_code', 'onticket') - ->assertJsonPath('data.website_type.codigo', 'onticket') + ->assertJsonMissingPath('data.website_type') ->assertJsonPath('data.extras.eventConfig.title', 'Festival'); $tenant = Tenant::query()->where('codigo', 'festival')->sole(); diff --git a/tests/Feature/Tenant/WebsiteExtrasTest.php b/tests/Feature/Tenant/WebsiteExtrasTest.php index 6ddfded..8681fd4 100644 --- a/tests/Feature/Tenant/WebsiteExtrasTest.php +++ b/tests/Feature/Tenant/WebsiteExtrasTest.php @@ -26,6 +26,7 @@ class WebsiteExtrasTest extends TestCase 'secondary_color', 'danger_color', 'success_color', + 'login_header_footer_color', 'site_logo', 'created_at', 'updated_at', @@ -70,6 +71,7 @@ class WebsiteExtrasTest extends TestCase 'secondary_color' => '#222222', 'danger_color' => '#ff0000', 'success_color' => '#00aa55', + 'login_header_footer_color' => '#333333', 'site_logo' => $siteLogo->id, ]); $typeExtra = $type->extras()->create([ @@ -95,6 +97,7 @@ class WebsiteExtrasTest extends TestCase $this->assertSame('#222222', $type->secondary_color); $this->assertSame('#ff0000', $type->danger_color); $this->assertSame('#00aa55', $type->success_color); + $this->assertSame('#333333', $type->login_header_footer_color); $this->assertTrue($type->siteLogo()->firstOrFail()->is($siteLogo)); $this->assertSame($type->codigo, $typeExtra->website_type_code); $this->assertSame('whatsapp', $typeExtra->codigo); diff --git a/tests/Feature/Tenant/WebsiteTypeServiceTest.php b/tests/Feature/Tenant/WebsiteTypeServiceTest.php index f317d81..8bb317e 100644 --- a/tests/Feature/Tenant/WebsiteTypeServiceTest.php +++ b/tests/Feature/Tenant/WebsiteTypeServiceTest.php @@ -23,6 +23,7 @@ class WebsiteTypeServiceTest extends TestCase 'secondary_color' => '#222222', 'danger_color' => '#ff0000', 'success_color' => '#00aa55', + 'login_header_footer_color' => '#333333', 'site_logo' => UploadedFile::fake()->image('site-logo.png'), ]); @@ -34,6 +35,7 @@ class WebsiteTypeServiceTest extends TestCase Storage::disk('s3')->assertExists($siteLogo->path); $this->assertDatabaseHas('website_type', [ 'codigo' => 'marketplace', + 'login_header_footer_color' => '#333333', 'site_logo' => $siteLogo->id, ]); }