Merge branch 'feature/cart_editing_policy' into dev

This commit is contained in:
2026-08-19 16:47:30 -03:00
32 changed files with 1057 additions and 74 deletions

View File

@@ -0,0 +1,56 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/** @var array<string, string> */
private const TENANT_POLICIES = [
'sonder' => 'quantity_and_remove',
'fiesta_futbol_infantil' => 'full',
'desfile_pura_tendencia' => 'disabled',
];
public function up(): void
{
Schema::table('tenants', function (Blueprint $table): void {
$table->string('cart_editing_policy')
->default('full')
->after('display_cart');
});
DB::table('tenants')
->where('cart_editing_enabled', false)
->update(['cart_editing_policy' => 'disabled']);
foreach (self::TENANT_POLICIES as $tenantCode => $policy) {
DB::table('tenants')
->where('codigo', $tenantCode)
->update(['cart_editing_policy' => $policy]);
}
Schema::table('tenants', function (Blueprint $table): void {
$table->dropColumn('cart_editing_enabled');
});
}
public function down(): void
{
Schema::table('tenants', function (Blueprint $table): void {
$table->boolean('cart_editing_enabled')
->default(true)
->after('display_cart');
});
DB::table('tenants')
->where('cart_editing_policy', 'disabled')
->update(['cart_editing_enabled' => false]);
Schema::table('tenants', function (Blueprint $table): void {
$table->dropColumn('cart_editing_policy');
});
}
};

View File

@@ -74,7 +74,7 @@ class DesfilePuraTendenciaSeeder extends Seeder
'display_categories' => false,
'display_seach_bar' => false,
'display_cart' => true,
'cart_editing_enabled' => false,
'cart_editing_policy' => 'disabled',
'display_cart_item_images' => false,
'scanner_category_validation_enabled' => false,
'website_type_code' => 'onticket',

View File

@@ -75,6 +75,7 @@ class TenantSeeder extends Seeder
'display_categories' => true,
'display_seach_bar' => true,
'display_cart' => true,
'cart_editing_policy' => 'quantity_and_remove',
'header_logo' => $this->uploadedImage('images/tennants/sonder/sonder_header.png', 'sonder_header.png'),
'footer_logo' => $this->uploadedImage('images/tennants/sonder/sonder_footer.png', 'sonder_footer.png'),
'social_media' => self::SOCIAL_MEDIA,
@@ -131,6 +132,7 @@ class TenantSeeder extends Seeder
'display_categories' => false,
'display_seach_bar' => false,
'display_cart' => true,
'cart_editing_policy' => 'full',
'header_logo' => $this->uploadedImage(
'images/tennants/fiesta_futbol_infantil/futbol_infantil_header.png',
'futbol_infantil_header.png',