@php $tz = 'Asia/Taipei'; $fmtDt = fn ($d) => $d ? $d->copy()->timezone($tz)->format('Y-m-d\TH:i') : ''; $isPaid = old('price_type', ($course->price ?? 0) > 0 ? 'paid' : 'free') === 'paid'; $saleOn = old('sale_enabled', $course->sale_price !== null ? '1' : '') ? true : false; $selCountries = array_values(old('countries', $course->soldCountries())); $allCodes = \App\Support\Countries::codes(); $presetLabels = ['tw' => __('台灣'), 'greater-china' => __('台港澳陸'), 'chinese-speaking' => __('華語區'), 'asia' => __('亞洲')]; $card = 'bg-ink-900 border rounded-xl p-6 space-y-4'; @endphp
@csrf @if ($course->exists) @method('PUT') @endif

{{ $course->exists ? __('編輯課程') : __('新增課程') }}

@if ($errors->any())
@foreach ($errors->all() as $e)
{{ $e }}
@endforeach
@endif {{-- ① 基本資料 --}}

① {{ __('基本資料') }}

@error('subject_id')

{{ $message }}

@enderror

{{ __('數字小的排前面。') }}

{{-- ② 定價與折扣 --}}

② {{ __('定價與折扣') }}

{{ __('免費課程不能設定折扣;定價會存為 NT$ 0。') }}

{{ __('目前折扣狀態:') }}

@error('price')

{{ $message }}

@enderror @error('sale_price')

{{ $message }}

@enderror @error('sale_ends_at')

{{ $message }}

@enderror
{{-- 學員看到的價格卡(即時預覽) --}}
{{ __('學員看到的價格') }}

{{-- ③ 銷售範圍 --}}

③ {{ __('銷售範圍') }}

{{ __('開放的語系') }}
@foreach (config('locales.supported') as $code => $info) @endforeach

{{ __('只有勾選的語系的學員能在課程列表看到並報名這門課;課程內容本身不會自動翻譯,請確認該語系的教材已備妥再開放。') }}

@error('locales')

{{ $message }}

@enderror
{{ __('銷售國家 / 地區') }}
{{ __('快速選擇:') }} @foreach ($presetLabels as $key => $label) @endforeach
@foreach ($allCodes as $code) @php $cn = \App\Support\Countries::name($code); @endphp @endforeach
@error('countries')

{{ $message }}

@enderror @error('countries.*')

{{ $message }}

@enderror
{{-- ④ 講師 / 音訊 / 內容 --}}

④ {{ __('講師・音訊・內容') }}

@if ($course->exists && auth()->user()->isAdmin())

{{ __('講師只能編輯、上下架、查看學員與提問紀錄,而且只限於自己負責的課程。') }}

@elseif ($course->exists)

{{ __('負責講師:') }}{{ $course->instructor?->name ?? __('未指定') }}

@endif

{{ __('會以醒目的方框顯示在課程頁與分類頁,適合說明「這門課適合誰、與學校進度的關係」。') }}

@if ($course->exists) @php $limit = ini_get('upload_max_filesize'); $draft = __('大家好,我是:name。', ['name' => $course->intro_audio_by ?: __('本課講師')]) . "\n" . __('歡迎來到《:title》。', ['title' => $course->title]) . "\n" . ($course->summary ? $course->summary . "\n" : '') . __('這門課分成 :c 個章節,共 :l 個單元:', ['c' => $course->chapters->count(), 'l' => $course->chapters->flatMap->lessons->count()]) . "\n" . $course->chapters->map(fn ($c, $i) => __('第:n章,:title。', ['n' => $i + 1, 'title' => $c->title]))->implode("\n") . "\n" . __('學完之後,你會(請在這裡說出學員完成後能做到的事)。') . "\n" . __('適合的對象是(請說出適合誰)。') . "\n" . __('現在就開始吧,我們課堂上見!'); @endphp
{{ __('講師真人語音介紹') }}
{{-- 操作步驟 --}}
{{ __('操作步驟(點此展開 / 收合)') }}
  1. {{ __('準備講稿:') }}{{ __('參考下方「建議講稿」,改成講師自己的話,控制在 1~3 分鐘。') }}
  2. {{ __('錄音:') }}{{ __('用手機內建「語音備忘錄」或電腦的 Audacity 都可以。找安靜的房間,嘴巴距離麥克風約一個拳頭,錄完先自己聽一遍。') }}
  3. {{ __('輸出格式:') }}{!! __('存成 :mp3 或 :m4a(手機錄音通常已是 m4a)。檔案建議小於 :limit(目前伺服器的單檔上傳上限)。', ['mp3' => 'MP3', 'm4a' => 'M4A', 'limit' => ''.e($limit).'']) !!}
  4. {{ __('上傳:') }}{{ __('在下方「選擇錄音檔」選好檔案,填上錄音講師姓名,按頁面最下方的「儲存」。') }}
  5. {{ __('確認:') }}{{ __('到前台課程頁,「課程總覽」上方會出現播放器,按下播放聽聽看。要換音檔就重新上傳,要拿掉就勾選「移除目前錄音」。') }}
  6. {{ __('每個單元的導讀:') }}{{ __('在下方「章節與單元」每個單元旁都有「上傳語音」,步驟相同,學員在學習頁會看到。') }}

{!! __('若上傳失敗並提示超過上限:請把音檔壓縮(例如降為 64 kbps 的單聲道 MP3),或請管理者調高 PHP 的 :a 與 :b 後重啟服務。', ['a' => 'upload_max_filesize', 'b' => 'post_max_size']) !!}

@error('intro_audio')

{{ $message }}

@enderror
@if ($course->introAudioUrl())
{{ __('目前的錄音') }}
@else

{{ __('目前還沒有錄音,前台不會顯示播放器。') }}

@endif
{{ __('建議講稿(依本課內容自動產生,請改成自己的語氣再錄)') }}
@endif @unless ($course->exists)

{{ __('儲存後即可在下方新增章節與單元、上傳講師語音。') }}

@endunless
{{-- ⑤ 發布 --}}

⑤ {{ __('發布') }}

@if ($course->exists)

{{ __('章節與單元') }}

@if ($course->chapters->isNotEmpty()) {{ __('匯出整門課簡報(zip)') }} @endif
@foreach ($course->chapters as $ch)
{{ $ch->title }} {{ __('匯出簡報') }}
@csrf @method('DELETE')
    @foreach ($ch->lessons as $l)
  • [{{ __($l->typeLabel()) }}] {{ $l->title }} @if ($l->type === 'quiz') {{ __('(:n 題)', ['n' => $l->questions->count()]) }} @endif
    @if ($l->audioUrl())
    @csrf @method('DELETE')
    @endif
    @csrf
    @csrf @method('DELETE')
  • @endforeach
@csrf
@endforeach
@csrf

{{ __('測驗題目目前以 Seeder / 資料庫匯入,題目編輯介面為下一階段項目。') }}

@endif