[FEAT] APK 機台風味欄位改為自由輸入並補驗證與三語系

1. APK 版本建立頁「機台風味」欄位由固定下拉選單 (x-searchable-select) 改為自由輸入 text input,搭配 datalist 提供常用 flavor 建議值,允許填入任意 flavor。
2. 表單送出新增 flavor 必填驗證,未填時跳出 toast 提示。
3. APK 檔名自動解析填入邏輯改為直接寫入 x-model flavor,移除原 Preline HSSelect 實例操作。
4. 新增多語系 key「Please enter machine flavor」並同步 zh_TW / en / ja。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
sky121113 2026-06-10 14:10:36 +08:00
parent ed79a6ab32
commit 378332be25
4 changed files with 22 additions and 19 deletions

View File

@ -1519,6 +1519,7 @@
"Please enter Webhook URL first.": "Please enter Webhook URL first.", "Please enter Webhook URL first.": "Please enter Webhook URL first.",
"Please enter address first": "Please enter address first", "Please enter address first": "Please enter address first",
"Please enter configuration name": "Please enter configuration name", "Please enter configuration name": "Please enter configuration name",
"Please enter machine flavor": "Please enter machine flavor",
"Please enter version name": "Please enter version name", "Please enter version name": "Please enter version name",
"Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.": "Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.", "Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.": "Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.",
"Please provide a download URL": "Please provide a download URL", "Please provide a download URL": "Please provide a download URL",

View File

@ -1519,6 +1519,7 @@
"Please enter Webhook URL first.": "最初にWebhook URLを入力してください。", "Please enter Webhook URL first.": "最初にWebhook URLを入力してください。",
"Please enter address first": "先に住所を入力してください", "Please enter address first": "先に住所を入力してください",
"Please enter configuration name": "設定名を入力してください", "Please enter configuration name": "設定名を入力してください",
"Please enter machine flavor": "機台フレーバーを入力してください",
"Please enter version name": "Please enter version name", "Please enter version name": "Please enter version name",
"Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.": "商品の画像やスタイル付きコンポーネントを正しく印刷するために、ブラウザの印刷設定で『背景のグラフィック』を有効にしてください。", "Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.": "商品の画像やスタイル付きコンポーネントを正しく印刷するために、ブラウザの印刷設定で『背景のグラフィック』を有効にしてください。",
"Please provide a download URL": "Please provide a download URL", "Please provide a download URL": "Please provide a download URL",

View File

@ -1519,6 +1519,7 @@
"Please enter Webhook URL first.": "請先輸入 Webhook 網址。", "Please enter Webhook URL first.": "請先輸入 Webhook 網址。",
"Please enter address first": "請先輸入地址", "Please enter address first": "請先輸入地址",
"Please enter configuration name": "請輸入設定名稱", "Please enter configuration name": "請輸入設定名稱",
"Please enter machine flavor": "請輸入機台風味",
"Please enter version name": "請輸入版本名稱", "Please enter version name": "請輸入版本名稱",
"Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.": "請確保在瀏覽器列印設定中啟用「背景圖形」,以便正確列印商品圖片和樣式元件。", "Please make sure to enable \"Background graphics\" in your browser print settings to print product images and styled components correctly.": "請確保在瀏覽器列印設定中啟用「背景圖形」,以便正確列印商品圖片和樣式元件。",
"Please provide a download URL": "請提供下載連結", "Please provide a download URL": "請提供下載連結",

View File

@ -75,16 +75,16 @@
{{-- 機台風味 --}} {{-- 機台風味 --}}
<div> <div>
<label class="block text-[11px] font-black text-slate-400 uppercase tracking-[0.2em] mb-2">{{ __('Machine Flavor') }} <span class="text-rose-500">*</span></label> <label class="block text-[11px] font-black text-slate-400 uppercase tracking-[0.2em] mb-2">{{ __('Machine Flavor') }} <span class="text-rose-500">*</span></label>
<x-searchable-select name="flavor" id="apk-flavor-select" <input type="text" name="flavor" x-model="flavor" required
:placeholder="__('Select flavor...')" list="apk-flavor-options"
:selected="old('flavor')" class="luxury-input w-full"
:hasSearch="true" placeholder="{{ __('e.g., S_12_XY_U_General') }}">
required> {{-- 常用建議值(非強制,可自由輸入任意 flavor --}}
{{-- S號 / Android 12 / XY主板 × 客戶專案 --}} <datalist id="apk-flavor-options">
<option value="S_12_XY_U_Chengwai" data-title="S_12_XY_U_Chengwai 晟崴客製 / S12 / XY主板">S_12_XY_U_Chengwai (晟崴客製 / S12 / XY主板</option> <option value="S_12_XY_U_Chengwai">S_12_XY_U_Chengwai(晟崴客製 / S12 / XY主板</option>
<option value="S_12_XY_U_General" data-title="S_12_XY_U_General 通用主幹 / S12 / XY主板">S_12_XY_U_General  (通用主幹 / S12 / XY主板</option> <option value="S_12_XY_U_General">S_12_XY_U_General(通用主幹 / S12 / XY主板</option>
<option value="S_9_XY_U_Cmuh" data-title="S_9_XY_U_Cmuh 中國醫客製 / S9 / XY主板">S_9_XY_U_Cmuh   (中國醫客製 / S9 / XY主板</option> <option value="S_9_XY_U_Cmuh">S_9_XY_U_Cmuh(中國醫客製 / S9 / XY主板</option>
</x-searchable-select> </datalist>
<p class="mt-1.5 text-[10px] font-bold text-slate-400/70 dark:text-slate-500/70 tracking-wide">{{ __('Target hardware flavor for this APK') }}</p> <p class="mt-1.5 text-[10px] font-bold text-slate-400/70 dark:text-slate-500/70 tracking-wide">{{ __('Target hardware flavor for this APK') }}</p>
</div> </div>
@ -198,6 +198,7 @@
isDragging: false, isDragging: false,
versionName: '{{ old('version_name', '') }}', versionName: '{{ old('version_name', '') }}',
versionCode: '{{ old('version_code', '') }}', versionCode: '{{ old('version_code', '') }}',
flavor: '{{ old('flavor', '') }}',
adjustVersionCode(delta) { adjustVersionCode(delta) {
const current = parseInt(this.versionCode) || 0; const current = parseInt(this.versionCode) || 0;
@ -222,6 +223,12 @@
})); }));
return; return;
} }
if (!this.flavor.trim()) {
window.dispatchEvent(new CustomEvent('toast', {
detail: { message: '{{ __('Please enter machine flavor') }}', type: 'error' }
}));
return;
}
if (this.uploadMode === 'file') { if (this.uploadMode === 'file') {
const fileInput = form.querySelector('[name=apk_file]'); const fileInput = form.querySelector('[name=apk_file]');
@ -267,15 +274,8 @@
this.versionCode = (major * 10000 + minor * 100 + patch).toString(); this.versionCode = (major * 10000 + minor * 100 + patch).toString();
} }
// 3. Select Flavor (Preline HSSelect integration) // 3. Fill Flavor (free-text input — 任意 flavor 皆可填入)
const selectEl = document.getElementById('apk-flavor-select'); this.flavor = flavor;
if (selectEl) {
selectEl.value = flavor;
const instance = window.HSSelect?.getInstance(selectEl);
if (instance) {
instance.setValue(flavor);
}
}
window.dispatchEvent(new CustomEvent('toast', { window.dispatchEvent(new CustomEvent('toast', {
detail: { message: '{{ __('已自動解析 APK 檔名並填入欄位!') }}', type: 'success' } detail: { message: '{{ __('已自動解析 APK 檔名並填入欄位!') }}', type: 'success' }