feat(website-type): add login_header_footer_color field and update related tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -14,7 +14,6 @@ class TenantInformationService
|
||||
'headerLogo',
|
||||
'footerLogo',
|
||||
'socialMedia',
|
||||
'websiteType.siteLogo',
|
||||
'websiteExtras.websiteTypeExtra',
|
||||
];
|
||||
|
||||
|
||||
@@ -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',
|
||||
]);
|
||||
});
|
||||
|
||||
BIN
public/images/website_types/shopit_logo.png
Normal file
BIN
public/images/website_types/shopit_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -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');
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user