diff --git a/database/migrations/2026_08_26_000000_set_website_type_favicon.php b/database/migrations/2026_08_26_000000_set_website_type_favicon.php index e3699ed6..9669433c 100644 --- a/database/migrations/2026_08_26_000000_set_website_type_favicon.php +++ b/database/migrations/2026_08_26_000000_set_website_type_favicon.php @@ -41,7 +41,7 @@ return new class extends Migration return; } - $sourcePath = public_path('images/website_types/'.self::FILENAME); + $sourcePath = public_path('images/website_types/onticket/'.self::FILENAME); if (! is_file($sourcePath)) { throw new RuntimeException("Favicon not found at path: {$sourcePath}"); diff --git a/database/migrations/2026_09_28_000000_update_shopit_admin_assets.php b/database/migrations/2026_09_28_000000_update_shopit_admin_assets.php new file mode 100644 index 00000000..8003964c --- /dev/null +++ b/database/migrations/2026_09_28_000000_update_shopit_admin_assets.php @@ -0,0 +1,47 @@ +environment('testing')) { + Storage::fake('s3'); + } + + if (! AdminWebsiteType::query()->where('codigo', 'shopit')->exists()) { + return; + } + + app(AdminWebsiteTypeService::class)->updateOrCreate( + ['codigo' => 'shopit'], + [ + 'primary_color' => '#2FD3AC', + 'site_logo' => $this->uploadedImage('shopit_logo.png', 'image/png'), + 'footer_logo' => $this->uploadedImage('shopit_footer_logo.png', 'image/png'), + 'favicon' => $this->uploadedImage('shopit-favicon.svg', 'image/svg+xml'), + ], + ); + } + + public function down(): void + { + // Brand assets are operational data and are intentionally preserved. + } + + private function uploadedImage(string $filename, string $mimeType): UploadedFile + { + $path = public_path("images/website_types/shopit/{$filename}"); + + if (! is_file($path)) { + throw new RuntimeException("ShopIt image not found at path: {$path}"); + } + + return new UploadedFile($path, $filename, $mimeType, null, true); + } +}; diff --git a/database/seeders/WebsiteTypeSeeder.php b/database/seeders/WebsiteTypeSeeder.php index 230a876f..1379136a 100644 --- a/database/seeders/WebsiteTypeSeeder.php +++ b/database/seeders/WebsiteTypeSeeder.php @@ -40,7 +40,7 @@ class WebsiteTypeSeeder extends Seeder public function run(): void { - $shopIt = $this->websiteTypeService->updateOrCreate( + $this->websiteTypeService->updateOrCreate( ['codigo' => 'shopit'], [ 'nombre' => 'ShopIt', @@ -48,9 +48,10 @@ class WebsiteTypeSeeder extends Seeder 'scanner_domain' => 'scanner.localhost', 'site_title' => 'ShopIt', ...self::PRESENTATION, - 'site_logo' => $this->onTicketLogo(), - 'footer_logo' => $this->onTicketFooterLogo(), - 'favicon' => $this->onTicketFavicon(), + 'primary_color' => '#2FD3AC', + 'site_logo' => $this->shopItLogo(), + 'footer_logo' => $this->shopItFooterLogo(), + 'favicon' => $this->shopItFavicon(), ], ); @@ -83,7 +84,7 @@ class WebsiteTypeSeeder extends Seeder ...self::PRESENTATION, 'site_logo' => $this->onTicketLogo(), 'footer_logo' => $this->onTicketFooterLogo(), - 'favicon' => $shopIt->favicon()->firstOrFail()->key, + 'favicon' => $this->onTicketFavicon(), ], ); @@ -204,7 +205,7 @@ class WebsiteTypeSeeder extends Seeder private function onTicketLogo(): UploadedFile { - $path = public_path('images/website_types/onticket_logo.png'); + $path = public_path('images/website_types/onticket/onticket_logo.png'); if (! file_exists($path)) { throw new RuntimeException("OnTicket logo not found at path: {$path}"); @@ -221,7 +222,7 @@ class WebsiteTypeSeeder extends Seeder private function onTicketFooterLogo(): UploadedFile { - $path = public_path('images/website_types/onticket_footer_logo.png'); + $path = public_path('images/website_types/onticket/onticket_footer_logo.png'); if (! file_exists($path)) { throw new RuntimeException("OnTicket footer logo not found at path: {$path}"); @@ -238,7 +239,7 @@ class WebsiteTypeSeeder extends Seeder private function onTicketFavicon(): UploadedFile { - $path = public_path('images/website_types/onticket_favicon.svg'); + $path = public_path('images/website_types/onticket/onticket_favicon.svg'); if (! file_exists($path)) { throw new RuntimeException("OnTicket favicon not found at path: {$path}"); @@ -252,4 +253,30 @@ class WebsiteTypeSeeder extends Seeder true, ); } + + private function shopItLogo(): UploadedFile + { + return $this->uploadedImage('shopit', 'shopit_logo.png', 'image/png'); + } + + private function shopItFooterLogo(): UploadedFile + { + return $this->uploadedImage('shopit', 'shopit_footer_logo.png', 'image/png'); + } + + private function shopItFavicon(): UploadedFile + { + return $this->uploadedImage('shopit', 'shopit-favicon.svg', 'image/svg+xml'); + } + + private function uploadedImage(string $websiteType, string $filename, string $mimeType): UploadedFile + { + $path = public_path("images/website_types/{$websiteType}/{$filename}"); + + if (! file_exists($path)) { + throw new RuntimeException("Website type image not found at path: {$path}"); + } + + return new UploadedFile($path, $filename, $mimeType, null, true); + } } diff --git a/public/images/website_types/onticket_favicon.svg b/public/images/website_types/onticket/onticket_favicon.svg similarity index 100% rename from public/images/website_types/onticket_favicon.svg rename to public/images/website_types/onticket/onticket_favicon.svg diff --git a/public/images/website_types/onticket_footer_logo.png b/public/images/website_types/onticket/onticket_footer_logo.png similarity index 100% rename from public/images/website_types/onticket_footer_logo.png rename to public/images/website_types/onticket/onticket_footer_logo.png diff --git a/public/images/website_types/onticket_logo.png b/public/images/website_types/onticket/onticket_logo.png similarity index 100% rename from public/images/website_types/onticket_logo.png rename to public/images/website_types/onticket/onticket_logo.png diff --git a/public/images/website_types/shopit/shopit-favicon.svg b/public/images/website_types/shopit/shopit-favicon.svg new file mode 100644 index 00000000..3443faac --- /dev/null +++ b/public/images/website_types/shopit/shopit-favicon.svg @@ -0,0 +1,10 @@ + + + + + + + + + +Layer 1 diff --git a/public/images/website_types/shopit/shopit_footer_logo.png b/public/images/website_types/shopit/shopit_footer_logo.png new file mode 100644 index 00000000..b8b6ae1d Binary files /dev/null and b/public/images/website_types/shopit/shopit_footer_logo.png differ diff --git a/public/images/website_types/shopit/shopit_footer_logo.png:Zone.Identifier b/public/images/website_types/shopit/shopit_footer_logo.png:Zone.Identifier new file mode 100644 index 00000000..d6c1ec68 Binary files /dev/null and b/public/images/website_types/shopit/shopit_footer_logo.png:Zone.Identifier differ diff --git a/public/images/website_types/shopit/shopit_logo.png b/public/images/website_types/shopit/shopit_logo.png new file mode 100644 index 00000000..b258833a Binary files /dev/null and b/public/images/website_types/shopit/shopit_logo.png differ diff --git a/public/images/website_types/shopit/shopit_logo.png:Zone.Identifier b/public/images/website_types/shopit/shopit_logo.png:Zone.Identifier new file mode 100644 index 00000000..d6c1ec68 Binary files /dev/null and b/public/images/website_types/shopit/shopit_logo.png:Zone.Identifier differ diff --git a/tests/Feature/Migrations/SetWebsiteTypeFaviconTest.php b/tests/Feature/Migrations/SetWebsiteTypeFaviconTest.php index 6db875d1..d3f91a8e 100644 --- a/tests/Feature/Migrations/SetWebsiteTypeFaviconTest.php +++ b/tests/Feature/Migrations/SetWebsiteTypeFaviconTest.php @@ -34,7 +34,7 @@ class SetWebsiteTypeFaviconTest extends TestCase $this->assertSame(1, DB::table('attachments')->where('filename', 'onticket_favicon.svg')->count()); Storage::disk('s3')->assertExists($attachment->path); $this->assertSame( - file_get_contents(public_path('images/website_types/onticket_favicon.svg')), + file_get_contents(public_path('images/website_types/onticket/onticket_favicon.svg')), Storage::disk('s3')->get($attachment->path), ); } diff --git a/tests/Feature/Seeders/WebsiteTypeSeederTest.php b/tests/Feature/Seeders/WebsiteTypeSeederTest.php index 2678ca3c..d99daf52 100644 --- a/tests/Feature/Seeders/WebsiteTypeSeederTest.php +++ b/tests/Feature/Seeders/WebsiteTypeSeederTest.php @@ -23,7 +23,7 @@ class WebsiteTypeSeederTest extends TestCase $this->assertSame(2, AdminWebsiteType::query()->count()); $this->assertSame(3, StorefrontWebsiteType::query()->count()); - $this->assertSame(5, Attachment::query()->count()); + $this->assertSame(6, Attachment::query()->count()); $expectedPresentation = [ 'primary_color' => '#FF7006', @@ -45,12 +45,15 @@ class WebsiteTypeSeederTest extends TestCase $this->assertSame('ShopIt', $shopIt->nombre); $this->assertSame('localhost', $shopIt->dominio); $this->assertSame('scanner.localhost', $shopIt->scanner_domain); - $this->assertSame($expectedPresentation, $shopIt->only(array_keys($expectedPresentation))); - $this->assertSame('onticket_logo.png', $shopIt->siteLogo->filename); + $this->assertSame( + [...$expectedPresentation, 'primary_color' => '#2FD3AC'], + $shopIt->only(array_keys($expectedPresentation)), + ); + $this->assertSame('shopit_logo.png', $shopIt->siteLogo->filename); Storage::disk('s3')->assertExists($shopIt->siteLogo->path); - $this->assertSame('onticket_footer_logo.png', $shopIt->footerLogo->filename); + $this->assertSame('shopit_footer_logo.png', $shopIt->footerLogo->filename); Storage::disk('s3')->assertExists($shopIt->footerLogo->path); - $this->assertSame('onticket_favicon.svg', $shopIt->favicon->filename); + $this->assertSame('shopit-favicon.svg', $shopIt->favicon->filename); Storage::disk('s3')->assertExists($shopIt->favicon->path); $shopItStorefront = StorefrontWebsiteType::query()->where('codigo', 'shopit')->with('extras')->sole(); $this->assertSame('standard', $shopItStorefront->header_type); @@ -84,7 +87,7 @@ class WebsiteTypeSeederTest extends TestCase Storage::disk('s3')->assertExists($onTicket->footerLogo->path); $this->assertNotSame($shopIt->site_logo, $onTicket->site_logo); $this->assertNotSame($shopIt->footer_logo, $onTicket->footer_logo); - $this->assertSame($shopIt->favicon_id, $onTicket->favicon_id); + $this->assertNotSame($shopIt->favicon_id, $onTicket->favicon_id); $this->assertSame('onticket_favicon.svg', $onTicket->favicon->filename); $onTicketStorefront = StorefrontWebsiteType::query()->where('codigo', 'onticket')->with('extras')->sole(); $this->assertSame('standard', $onTicketStorefront->header_type);