Song 新增歌曲 會出錯的問題
Song 移除 DB_change 20250725
This commit is contained in:
parent
79588bf0c7
commit
14debd3e63
@ -111,7 +111,7 @@ class ExportSqliteSongJob implements ShouldQueue
|
|||||||
'add_date' => $song->adddate,
|
'add_date' => $song->adddate,
|
||||||
'situation' => $song->situation?->value ?? '未定義',
|
'situation' => $song->situation?->value ?? '未定義',
|
||||||
'vocal' => $song->vocal,
|
'vocal' => $song->vocal,
|
||||||
'db_change' => $song->db_change,
|
'db_change' => $song->db_change ?? 0,
|
||||||
'song_counts' => $song->song_counts ?? 0,
|
'song_counts' => $song->song_counts ?? 0,
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
];
|
];
|
||||||
|
@ -40,8 +40,7 @@ class SongForm extends Component
|
|||||||
'filename' => '',
|
'filename' => '',
|
||||||
'language_type' => '',
|
'language_type' => '',
|
||||||
|
|
||||||
'db_change' => '',
|
'vocal' => true,
|
||||||
'vocal' => '',
|
|
||||||
'situation' => '',
|
'situation' => '',
|
||||||
'copyright01' => '',
|
'copyright01' => '',
|
||||||
'copyright02' => '',
|
'copyright02' => '',
|
||||||
@ -146,7 +145,13 @@ class SongForm extends Component
|
|||||||
public function resetFields()
|
public function resetFields()
|
||||||
{
|
{
|
||||||
foreach ($this->fields as $key => $value) {
|
foreach ($this->fields as $key => $value) {
|
||||||
$this->fields[$key] = is_bool($value) ? false : '';
|
if($key == 'vocal' || $key == 'enable'){
|
||||||
|
$this->fields[$key] = true ;
|
||||||
|
}else if($key == 'adddate'){
|
||||||
|
$this->fields[$key] = now()->format('Y-m-d');
|
||||||
|
}else{
|
||||||
|
$this->fields[$key] = '' ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->songId = null;
|
$this->songId = null;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,6 @@ 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){
|
||||||
@ -156,8 +155,6 @@ 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()
|
||||||
@ -229,7 +226,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','db_change',
|
'name','filename',
|
||||||
'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);
|
||||||
|
@ -19,7 +19,6 @@ class Song extends Model
|
|||||||
'adddate',
|
'adddate',
|
||||||
'filename',
|
'filename',
|
||||||
'language_type',
|
'language_type',
|
||||||
'db_change',
|
|
||||||
'vocal',
|
'vocal',
|
||||||
'situation',
|
'situation',
|
||||||
'copyright01',
|
'copyright01',
|
||||||
|
@ -29,7 +29,6 @@ return [
|
|||||||
'note04' => '備註04',
|
'note04' => '備註04',
|
||||||
'enable' => '狀態',
|
'enable' => '狀態',
|
||||||
'name_length' => '歌名字數',
|
'name_length' => '歌名字數',
|
||||||
'db_change'=>'分貝增減',
|
|
||||||
'vocal' => '人聲',
|
'vocal' => '人聲',
|
||||||
'situation' => '情境',
|
'situation' => '情境',
|
||||||
'simplified' => '歌名簡體',
|
'simplified' => '歌名簡體',
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<x-wireui:modal-card title="{{ $songId ? __('songs.EditSong') : __('songs.CreateNew') }}" wire:model.defer="showModal">
|
<x-wireui:modal-card title="{{ $songId ? __('songs.EditSong') : __('songs.CreateNew') }}" wire:model.defer="showModal">
|
||||||
|
|
||||||
<div class="grid grid-cols-3 gap-4 sm:grid-cols-3">
|
<div class="grid grid-cols-3 gap-4 sm:grid-cols-3">
|
||||||
<x-wireui:input label="{{__('songs.id')}}" wire:model.defer="fields.id" required />
|
<x-wireui:input label="{{__('songs.id')}}" wire:model.defer="fields.id" required />
|
||||||
<x-wireui:input label="{{__('songs.name')}}" wire:model.defer="fields.name" required />
|
<x-wireui:input label="{{__('songs.name')}}" wire:model.defer="fields.name" required />
|
||||||
@ -44,13 +43,12 @@
|
|||||||
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>
|
||||||
<div class="grid grid-cols-2 gap-4 sm:grid-cols-2">
|
<div class="grid grid-cols-2 gap-4 sm:grid-cols-2">
|
||||||
<x-wireui:toggle label="{{__('songs.vocal')}}" wire:model.defer="fields.vocal" />
|
<x-wireui:toggle label="{{__('songs.vocal')}}" wire:model.defer="fields.vocal" :value="$fields['vocal']"/>
|
||||||
<x-wireui:toggle label="{{__('songs.enable')}}" wire:model.defer="fields.enable" />
|
<x-wireui:toggle label="{{__('songs.enable')}}" wire:model.defer="fields.enable" :value="$fields['enable']"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-2 gap-4 sm:grid-cols-2">
|
<div class="grid grid-cols-2 gap-4 sm:grid-cols-2">
|
||||||
<x-wireui:input label="{{__('songs.copyright01')}}" wire:model.defer="fields.copyright01" />
|
<x-wireui:input label="{{__('songs.copyright01')}}" wire:model.defer="fields.copyright01" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user