Skip to content

Commit

Permalink
优化产品相关功能和UI
Browse files Browse the repository at this point in the history
- 调整品牌资源表单布局,提高可读性
- 设置品牌状态默认值和必填项
- 优化产品分类列表,增加复制功能
- 修复产品SKU相关错误,并优化界面逻辑
- 更新部分中文字体显示
  • Loading branch information
liushoukun committed Oct 14, 2024
1 parent 41dca02 commit a1ca985
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
14 changes: 8 additions & 6 deletions src/Clusters/Product/Resources/BrandResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ public static function form(Form $form) : Form
->required(),
Forms\Components\TextInput::make('english_name')
->label(__('red-jasmine-product::brand.fields.english_name'))
,
,
Forms\Components\TextInput::make('initial')
->maxLength(1)
->label(__('red-jasmine-product::brand.fields.initial'))
,
,
Forms\Components\TextInput::make('description')
->label(__('red-jasmine-product::brand.fields.description'))
->maxLength(255),
Forms\Components\FileUpload::make('logo')
->label(__('red-jasmine-product::brand.fields.logo'))
->image(),
->label(__('red-jasmine-product::brand.fields.logo'))
->image(),
Forms\Components\Radio::make('is_show')
->label(__('red-jasmine-product::brand.fields.is_show'))
->boolean()
Expand All @@ -92,6 +92,8 @@ public static function form(Form $form) : Form
Forms\Components\ToggleButtons::make('status')->label(__('red-jasmine-product::brand.fields.status'))
->inline()
->grouped()
->required()
->default(BrandStatusEnum::ENABLE)
->useEnum(BrandStatusEnum::class)
,

Expand All @@ -104,11 +106,11 @@ public static function table(Table $table) : Table

return $table
->columns([
Tables\Columns\TextColumn::make('id'),
Tables\Columns\TextColumn::make('id')->copyable(),
Tables\Columns\TextColumn::make('parent.name')->label(__('red-jasmine-product::brand.fields.parent.name')),
Tables\Columns\TextColumn::make('name')
->label(__('red-jasmine-product::brand.fields.name'))
->searchable(),
->searchable()->copyable(),

Tables\Columns\TextColumn::make('initial')
->label(__('red-jasmine-product::brand.fields.initial')),
Expand Down
12 changes: 6 additions & 6 deletions src/Clusters/Product/Resources/ProductCategoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ public static function table(Table $table) : Table
->columns([
Tables\Columns\TextColumn::make('id')
->label('ID')
->sortable(),
->sortable()->copyable(),
Tables\Columns\TextColumn::make('parent.name')
->label(__('red-jasmine-product::product-category.fields.parent_id'))
->sortable(),
Tables\Columns\TextColumn::make('name')
->label(__('red-jasmine-product::product-category.fields.name'))
->searchable(),
->searchable()->copyable(),
Tables\Columns\ImageColumn::make('image')
->label(__('red-jasmine-product::product-category.fields.image'))
,
Expand Down Expand Up @@ -152,16 +152,16 @@ public static function table(Table $table) : Table
Tables\Actions\BulkActionGroup::make([
// Tables\Actions\DeleteBulkAction::make(),
]),
]);
])->recordUrl(null);
}


public static function getPages() : array
{
return [
'index' => ListProductCategories::route('/'),
// 'create' => CreateProductCategory::route('/create'),
'edit' => EditProductCategory::route('/{record}/edit'),
'index' => ListProductCategories::route('/'),
'create' => CreateProductCategory::route('/create'),
'edit' => EditProductCategory::route('/{record}/edit'),
];
}
}
15 changes: 10 additions & 5 deletions src/Clusters/Product/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,16 @@ protected static function specifications() : array
$item['values'] = array_values($item['values'] ?? []);
return $item;
}, $saleProps);


$oldSku = $get('skus') ?? [];
if($oldSku === null){
$oldSku = [];
}
$service = app(PropertyValidateService::class);
$crossJoin = $service->crossJoin($saleProps);

$oldSku = $get('skus') ?? [];

$oldSku = collect($oldSku)->keyBy('properties_sequence');

$skus = [];
Expand Down Expand Up @@ -621,7 +627,7 @@ protected static function skus() : TableRepeater
Forms\Components\TextInput::make('width')->nullable()->numeric()->maxLength(32),
Forms\Components\TextInput::make('height')->nullable()->numeric()->maxLength(32),

Forms\Components\Select::make('status')->required()->default(ProductStatusEnum::ON_SALE->value)->options(ProductStatusEnum::skusStatus()),
Forms\Components\Select::make('status')->selectablePlaceholder(false)->required()->default(ProductStatusEnum::ON_SALE->value)->options(ProductStatusEnum::skusStatus()),


])
Expand Down Expand Up @@ -721,15 +727,14 @@ public static function operateFields() : array
->live()
->grouped()
->useEnum(OrderQuantityLimitTypeEnum::class)
->default(OrderQuantityLimitTypeEnum::UNLIMITED),
->default(OrderQuantityLimitTypeEnum::UNLIMITED->value),
Forms\Components\TextInput::make('order_quantity_limit_num')
->label(__('red-jasmine-product::product.fields.order_quantity_limit_num'))
->required()
->numeric()
->default(null)
->minValue(1)
->suffix('')
->visible(fn(Forms\Get $get) => $get('order_quantity_limit_type') !== OrderQuantityLimitTypeEnum::UNLIMITED->value),
->hidden(fn(Forms\Get $get) => $get('order_quantity_limit_type') === OrderQuantityLimitTypeEnum::UNLIMITED->value),


];
Expand Down

0 comments on commit a1ca985

Please sign in to comment.