加入新增 20250502

This commit is contained in:
allen.yan 2025-05-02 18:07:25 +08:00
parent 3a609e495f
commit 077d418357
23 changed files with 57 additions and 33 deletions

View File

@ -13,8 +13,8 @@ enum UserGender: string
public function labels(): string
{
return match($this) {
self::Male => __('enums.user.gender.Male'),
self::Female => __('enums.user.gender.Female'),
self::Male => __('enums.Male'),
self::Female => __('enums.Female'),
self::Other => __('enums.Other'),
self::Unset => __('enums.Unset'),
};

View File

@ -45,6 +45,7 @@ final class ArtistTable extends PowerGridComponent
->showToggleColumns()
//->showSoftDeletes()
//->showSearchInput()
->includeViewOnTop('livewire.admin.artist-header')
,
PowerGrid::footer()
->showPerPage()

View File

@ -59,6 +59,7 @@ class RoleForm extends Component
$this->resetFields();
$this->showCreateModal = false;
$this->dispatch('pg:eventRefresh-role-table');
}
public function deleteRole($id)

View File

@ -27,8 +27,9 @@ final class RoleTable extends PowerGridComponent
//$this->showCheckBox();
return [
//PowerGrid::header()
PowerGrid::header()
// ->showSearchInput(),
->includeViewOnTop('livewire.admin.role-header'),
//PowerGrid::footer()
// ->showPerPage()
// ->showRecordCount(),
@ -61,7 +62,7 @@ final class RoleTable extends PowerGridComponent
return $rolePermissions->implode(', ');
})
->add('created_at_formatted', fn (Role $model) => Carbon::parse($model->created_at)->format('d/m/Y H:i:s'));
->add('created_at_formatted', fn (Role $model) => Carbon::parse($model->created_at)->format('Y-m-d H:i:s'));
}
public function columns(): array

View File

@ -90,6 +90,7 @@ class SongForm extends Component
$this->resetFields();
$this->showCreateModal = false;
$this->dispatch('pg:eventRefresh-song-table');
}
public function deleteSong($id)

View File

@ -46,6 +46,7 @@ final class SongTable extends PowerGridComponent
->showSoftDeletes()
->showToggleColumns()
//->showSearchInput()
->includeViewOnTop('livewire.admin.song-header')
,
PowerGrid::footer()
->showPerPage()

View File

@ -43,6 +43,7 @@ final class UserTable extends PowerGridComponent
//->showSoftDeletes()
->showToggleColumns()
//->showSearchInput()
->includeViewOnTop('livewire.admin.user-header')
,
PowerGrid::footer()->showPerPage()->showRecordCount(),
];

View File

@ -3,7 +3,7 @@
return [
'management' => '歌手管理',
'list' => '歌手列表',
'CreateNewArtist' => '新增歌手',
'CreateNew' => '新增歌手',
'create_edit' => '新增 / 編輯',
'create' => '新增',
'edit' => '編輯',

View File

@ -2,7 +2,7 @@
return [
'list' => '角色列表',
'CreateNewRole' => '新增角色',
'CreateNew' => '新增角色',
'edit' => '編輯',
'delete' => '刪除',

View File

@ -3,7 +3,7 @@
return [
'management' => '歌曲管理',
'list' => '歌曲列表',
'CreateNewArtist' => '新增歌曲',
'CreateNew' => '新增歌曲',
'create_edit' => '新增 / 編輯',
'create' => '新增',
'edit' => '編輯',

View File

@ -2,7 +2,7 @@
return [
'list' => '使用者列表',
'CreateNewRole' => '新增使用者',
'CreateNew' => '新增使用者',
'edit' => '編輯',
'delete' => '刪除',

View File

@ -12,9 +12,9 @@
</div>
<x-slot name="footer">
<div class="flex justify-center gap-2">
<x-wireui:button primary label="{{__('artists.cancel')}}" x-on:click="$dispatch('close')" />
<x-wireui:button primary label="{{__('artists.submit')}}" wire:click="save" />
<div class="flex justify-between w-full">
<x-wireui:button flat label="{{__('atrists.cancel')}}" @click="$wire.showCreateModal = false" />
<x-wireui:button primary type="submit" label="儲存" />
</div>
</x-slot>
</x-wireui:modal-card>

View File

@ -0,0 +1,8 @@
<div class="flex justify-end mb-2">
<x-wireui:button
wire:click="$dispatchTo('admin.artist-form', 'openCreateArtistModal')"
icon="plus"
label="{{ __('artists.CreateNew') }}"
class="bg-blue-600 text-white"
/>
</div>

View File

@ -1,9 +1,5 @@
<x-layouts.admin>
<x-slot name="header">
歌手管理
</x-slot>
@if (session()->has('message'))
<x-wireui:notifications />
<script>
@ -16,6 +12,8 @@
@endif
{{-- 單一 Livewire 元件,內含資料表與 Modal --}}
<livewire:admin.artist-table />
<livewire:admin.artist-form />
</x-layouts.admin>

View File

@ -15,8 +15,8 @@
</div>
<x-slot name="footer">
<div class="flex justify-center gap-2">
<x-wireui:button primary label="{{__('roles.cancel')}}" x-on:click="$dispatch('close')" />
<div class="flex justify-between w-full">
<x-wireui:button flat label="{{__('roles.cancel')}}" @click="$wire.showCreateModal = false" />
<x-wireui:button primary label="{{__('roles.submit')}}" wire:click="save" />
</div>
</x-slot>

View File

@ -0,0 +1,8 @@
<div class="flex justify-end mb-2">
<x-wireui:button
wire:click="$dispatchTo('admin.role-form', 'openCreateRoleModal')"
icon="plus"
label="{{ __('roles.CreateNew') }}"
class="bg-blue-600 text-white"
/>
</div>

View File

@ -1,9 +1,5 @@
<x-layouts.admin>
<x-slot name="header">
角色管理
</x-slot>
@if (session()->has('message'))
<x-wireui:notifications />
<script>

View File

@ -64,10 +64,10 @@
<x-wireui:textarea label="備註3" wire:model.defer="fields.note03" />
<x-wireui:textarea label="備註4" wire:model.defer="fields.note04" />
</div>
{{-- Footer --}}
<x-slot name="footer">
<div class="flex justify-between w-full">
<x-wireui:button flat label="取消" @click="$wire.showCreateModal = false" />
<x-wireui:button flat label="{{__('songs.cancel')}}" @click="$wire.showCreateModal = false" />
<x-wireui:button primary type="submit" label="儲存" />
</div>
</x-slot>

View File

@ -0,0 +1,8 @@
<div class="flex justify-end mb-2">
<x-wireui:button
wire:click="$dispatchTo('admin.song-form', 'openCreateSongModal')"
icon="plus"
label="{{ __('songs.CreateNew') }}"
class="bg-blue-600 text-white"
/>
</div>

View File

@ -1,9 +1,5 @@
<x-layouts.admin>
<x-slot name="header">
歌曲列表
</x-slot>
@if (session()->has('message'))
<x-wireui:notifications />
<script>

View File

@ -32,8 +32,8 @@
</div>
<x-slot name="footer">
<div class="flex justify-center gap-2">
<x-wireui:button primary label="{{__('users.cancel')}}" x-on:click="$dispatch('close')" />
<div class="flex justify-between w-full">
<x-wireui:button flat label="{{__('users.cancel')}}" @click="$wire.showCreateModal = false" />
<x-wireui:button primary label="{{__('users.submit')}}" wire:click="save" />
</div>
</x-slot>

View File

@ -0,0 +1,8 @@
<div class="flex justify-end mb-2">
<x-wireui:button
wire:click="$dispatchTo('admin.user-form', 'openCreateUserModal')"
icon="plus"
label="{{ __('users.CreateNew') }}"
class="bg-blue-600 text-white"
/>
</div>

View File

@ -1,9 +1,5 @@
<x-layouts.admin>
<x-slot name="header">
使用者管理
</x-slot>
@if (session()->has('message'))
<x-wireui:notifications />
<script>