202508251200

歌曲編輯加入 db_change
This commit is contained in:
allen.yan 2025-08-25 11:58:37 +08:00
parent 8ea56802b0
commit 46caedfc10
5 changed files with 10 additions and 2 deletions

View File

@ -40,7 +40,7 @@ class SongForm extends Component
'adddate' => '', 'adddate' => '',
'filename' => '', 'filename' => '',
'language_type' => '', 'language_type' => '',
'db_change' => 0,
'vocal' => true, 'vocal' => true,
'situation' => '', 'situation' => '',
'copyright01' => '', 'copyright01' => '',
@ -170,6 +170,8 @@ class SongForm extends Component
$this->fields[$key] = true ; $this->fields[$key] = true ;
}else if($key == 'adddate'){ }else if($key == 'adddate'){
$this->fields[$key] = now()->format('Y-m-d'); $this->fields[$key] = now()->format('Y-m-d');
}else if($key == 'db_change'){
$this->fields[$key]=0;
}else{ }else{
$this->fields[$key] = '' ; $this->fields[$key] = '' ;
} }

View File

@ -114,6 +114,7 @@ final class SongTable extends PowerGridComponent
]); ]);
} ) } )
->add('song_categories', fn(Song $model) => $model->str_categories()) ->add('song_categories', fn(Song $model) => $model->str_categories())
->add('db_change')
->add('vocal') ->add('vocal')
//->add('situation_str', fn (Song $model) => SongSituation::from($model->situation->value)->labels()) //->add('situation_str', fn (Song $model) => SongSituation::from($model->situation->value)->labels())
->add('situation_str', function (Song $model){ ->add('situation_str', function (Song $model){
@ -153,6 +154,8 @@ final class SongTable extends PowerGridComponent
$column[]=Column::make(__('songs.artists'), 'song_artists'); $column[]=Column::make(__('songs.artists'), 'song_artists');
$column[]=Column::make(__('songs.language_type'),'language_type_str', 'songs.language_type')->searchable(); $column[]=Column::make(__('songs.language_type'),'language_type_str', 'songs.language_type')->searchable();
$column[]=Column::make(__('songs.categorys'), 'song_categories'); $column[]=Column::make(__('songs.categorys'), 'song_categories');
$column[]=Column::make('Db change', 'db_change')
->editOnClick(hasPermission: $this->canEdit, dataField: 'db_change', fallback: 'N/A', saveOnMouseOut: true);
$column[]=Column::make(__('songs.vocal'), 'vocal')->toggleable(hasPermission: $this->canEdit, trueLabel: 'yes', falseLabel: 'no'); $column[]=Column::make(__('songs.vocal'), 'vocal')->toggleable(hasPermission: $this->canEdit, trueLabel: 'yes', falseLabel: 'no');
$column[]=Column::make(__('songs.situation'), 'situation_str','songs.situation')->searchable(); $column[]=Column::make(__('songs.situation'), 'situation_str','songs.situation')->searchable();
$column[]=Column::make(__('songs.copyright01'), 'copyright01')->sortable()->searchable() $column[]=Column::make(__('songs.copyright01'), 'copyright01')->sortable()->searchable()
@ -230,7 +233,7 @@ final class SongTable extends PowerGridComponent
public function onUpdatedEditable($id, $field, $value): void public function onUpdatedEditable($id, $field, $value): void
{ {
if (in_array($field,[ if (in_array($field,[
'name','filename', 'name','filename','db_change',
'copyright01','copyright02','note01','note02','note03','note04' 'copyright01','copyright02','note01','note02','note03','note04'
]) && $this->canEdit) { ]) && $this->canEdit) {
$this->noUpdated($id,$field,$value); $this->noUpdated($id,$field,$value);

View File

@ -19,6 +19,7 @@ class Song extends Model
'adddate', 'adddate',
'filename', 'filename',
'language_type', 'language_type',
'db_change',
'vocal', 'vocal',
'situation', 'situation',
'copyright01', 'copyright01',

View File

@ -29,6 +29,7 @@ return [
'note04' => '備註04', 'note04' => '備註04',
'enable' => '狀態', 'enable' => '狀態',
'name_length' => '歌名字數', 'name_length' => '歌名字數',
'db_change'=>'分貝增減',
'vocal' => '人聲', 'vocal' => '人聲',
'situation' => '情境', 'situation' => '情境',
'simplified' => '歌名簡體', 'simplified' => '歌名簡體',

View File

@ -43,6 +43,7 @@
option-label="name" option-label="name"
option-value="value" option-value="value"
/> />
<x-wireui:input label="{{__('songs.db_change')}}" wire:model.defer="fields.db_change" />
<x-wireui:input label="{{__('songs.adddate')}}" wire:model.defer="fields.adddate" type="date" /> <x-wireui:input label="{{__('songs.adddate')}}" wire:model.defer="fields.adddate" type="date" />
</div> </div>