feat: custom labels toggle and inline editing in product list

Adds session-based show/hide toggle for custom labels in admin product list, inline editable fields for custom_label_0..4, and label suggestions with custom entry support. Includes repository/controller updates, UI fixes, tests, and PAUL docs release updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jacek
2026-04-19 11:09:19 +02:00
parent 41e491c6b7
commit 9577d4944a
15 changed files with 856 additions and 42 deletions

View File

@@ -1313,4 +1313,55 @@ class ProductRepositoryTest extends TestCase
$method->setAccessible(true);
$method->invoke($repository, 55, [], [], []);
}
public function testCustomLabelNamesUsesDbSettingsWithFallback(): void
{
$mockDb = $this->createMock(\medoo::class);
$mockDb->expects($this->once())
->method('select')
->with(
'pp_settings',
['param', 'value'],
$this->callback(function ($where) {
return isset($where['param']) && is_array($where['param']) && count($where['param']) === 10;
})
)
->willReturn([
['param' => 'custom_label_0_name', 'value' => 'Sezon'],
['param' => 'google_custom_label_2_name', 'value' => 'Kampania'],
['param' => 'custom_label_4_name', 'value' => ''],
]);
$repository = new ProductRepository($mockDb);
$names = $repository->customLabelNames();
$this->assertSame('Sezon', $names['custom_label_0']);
$this->assertSame('Custom label 1', $names['custom_label_1']);
$this->assertSame('Kampania', $names['custom_label_2']);
$this->assertSame('Custom label 3', $names['custom_label_3']);
$this->assertSame('Custom label 4', $names['custom_label_4']);
}
public function testCustomLabelSuggestionsReturnsEmptyForInvalidLabelType(): void
{
$mockDb = $this->createMock(\medoo::class);
$mockDb->expects($this->never())->method('query');
$repository = new ProductRepository($mockDb);
$result = $repository->customLabelSuggestions('abc', 'custom_label_10');
$this->assertSame([], $result);
}
public function testSaveCustomLabelReturnsFalseForInvalidLabelType(): void
{
$mockDb = $this->createMock(\medoo::class);
$mockDb->expects($this->never())->method('update');
$repository = new ProductRepository($mockDb);
$result = $repository->saveCustomLabel(1, 'abc', 'custom_label_10');
$this->assertFalse($result);
}
}