From 370834856b0e1ad9b391a7c88a481335f8d461f5 Mon Sep 17 00:00:00 2001 From: nahu Date: Mon, 28 Sep 2026 17:37:14 +0000 Subject: [PATCH] feat(website-assets): update ShopIt website assets and adjust favicon paths --- ..._08_26_000000_set_website_type_favicon.php | 2 +- ...9_28_000000_update_shopit_admin_assets.php | 47 ++++++++++++++++++ database/seeders/WebsiteTypeSeeder.php | 43 +++++++++++++--- .../{ => onticket}/onticket_favicon.svg | 0 .../{ => onticket}/onticket_footer_logo.png | Bin .../{ => onticket}/onticket_logo.png | Bin .../website_types/shopit/shopit-favicon.svg | 10 ++++ .../shopit/shopit_footer_logo.png | Bin 0 -> 1104 bytes .../shopit_footer_logo.png:Zone.Identifier | Bin 0 -> 25 bytes .../website_types/shopit/shopit_logo.png | Bin 0 -> 2869 bytes .../shopit/shopit_logo.png:Zone.Identifier | Bin 0 -> 25 bytes .../Migrations/SetWebsiteTypeFaviconTest.php | 2 +- .../Feature/Seeders/WebsiteTypeSeederTest.php | 15 +++--- 13 files changed, 103 insertions(+), 16 deletions(-) create mode 100644 database/migrations/2026_09_28_000000_update_shopit_admin_assets.php rename public/images/website_types/{ => onticket}/onticket_favicon.svg (100%) rename public/images/website_types/{ => onticket}/onticket_footer_logo.png (100%) rename public/images/website_types/{ => onticket}/onticket_logo.png (100%) create mode 100644 public/images/website_types/shopit/shopit-favicon.svg create mode 100644 public/images/website_types/shopit/shopit_footer_logo.png create mode 100644 public/images/website_types/shopit/shopit_footer_logo.png:Zone.Identifier create mode 100644 public/images/website_types/shopit/shopit_logo.png create mode 100644 public/images/website_types/shopit/shopit_logo.png:Zone.Identifier 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 0000000000000000000000000000000000000000..b8b6ae1d705a09ed71bb6bc868d92e26d79d611c GIT binary patch literal 1104 zcmV-W1h4yvP)E ziSAcn*#(I%>E~ynF;SBkSHdxYl}xzZO3rI++&VID3K@{oU0)J?CD9#jQ@N4rAgeYI zci+^Ut&uIdlCUo%JPVbIn%rmP`3Sqw_UtB+JMhd~@H9lXURxRA&7$Oo1MOEx2s8K> zz-KcNbh2egSu-975|FQq*xBUvlIR-Z_v&kgbhN;DlHLZVpg(Ylo%yvMbuV-&7zj{-sa0@uLb++o~xh(sN`ZL>mODI$!Hu5bO1>%UjI8m zo8UV{i(b7Qlk(-w?%|SczP#s>JR8M264$MLw^iq8AoK7y=Oce)d+Q8@7~FTOlXSE- zB)^1WJQ+st77Zj6oMIRw>0dJfP$E*~O_9AC-SCoDT$Y3CWSdC{c zJHrdqGSLjTmGD7er*v(V&yoxEerWeAaBePL&uP?LTp%kIpQ|Go#ZyB9K_$i2*iG1N zYH1!5Ro((i6+pE6GD=@y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)T zgW_=LbubpPRp&!-(E>fVV+EzO5H9k}LXq5X9}H4|>$`Hpr4)|nY|5k!t0=~<#p(rX zooo$M=x+xb4yHLDuAwz;!ojeSY%5Vsj)dooT9%FXQIlQ2YP%6A z;xin(Iug@{6bPZcaW}gTmlgEbS?DHo;O5!XH-KstAUkMHlhtvctI*XkmbwH8_z0lXw3?Nf&WxT#i zJ4|4TRFLq@B}GBrIB?vNAe?EMM3^SzK$dJJ3VN7!(myHi{|J@vEN>h*?np2sd~&A- zM}&}U)87}-KvH;4ZX7u7P?{tnU6`31+RcP+lzt}QCzwJD!9Fy>nuC`BuAPt_7o;W) zB-k2;L0M4|CJToMJ$0j}4_a9&ro)dyEv*P+Ahc?YaiotaPBye+PjS4EONR>uz{T)knP3aD2!BP0tQbAbL-7XIv9YK_&pN;qQy~5e3Ubkw TJlDmW00000NkvXXu0mjfI-Xg$ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..d6c1ec682968c796b9f5e9e080cc6f674b57c766 GIT binary patch literal 25 dcma!!%Fjy;DN4*MPD?F{<>dl#JyUFr831@K2xassertSame(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);