feat(Admin/Company): 擴充業務類型與合約期間功能,補齊多語系翻譯詞條
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 1m9s

This commit is contained in:
2026-03-30 09:08:02 +08:00
parent c875ab7d29
commit fdd3589d7b
8 changed files with 237 additions and 43 deletions

View File

@@ -48,11 +48,13 @@ class CompanyController extends Controller
$validated = $request->validate([ $validated = $request->validate([
'name' => 'required|string|max:255', 'name' => 'required|string|max:255',
'code' => 'required|string|max:50|unique:companies,code', 'code' => 'required|string|max:50|unique:companies,code',
'original_type' => 'required|string|in:buyout,lease',
'tax_id' => 'nullable|string|max:50', 'tax_id' => 'nullable|string|max:50',
'contact_name' => 'nullable|string|max:255', 'contact_name' => 'nullable|string|max:255',
'contact_phone' => 'nullable|string|max:50', 'contact_phone' => 'nullable|string|max:50',
'contact_email' => 'nullable|email|max:255', 'contact_email' => 'nullable|email|max:255',
'valid_until' => 'nullable|date', 'start_date' => 'nullable|date',
'end_date' => 'nullable|date',
'status' => 'required|boolean', 'status' => 'required|boolean',
'note' => 'nullable|string', 'note' => 'nullable|string',
'settings' => 'nullable|array', 'settings' => 'nullable|array',
@@ -73,11 +75,14 @@ class CompanyController extends Controller
$company = Company::create([ $company = Company::create([
'name' => $validated['name'], 'name' => $validated['name'],
'code' => $validated['code'], 'code' => $validated['code'],
'original_type' => $validated['original_type'],
'current_type' => $validated['original_type'], // 新增時同步
'tax_id' => $validated['tax_id'] ?? null, 'tax_id' => $validated['tax_id'] ?? null,
'contact_name' => $validated['contact_name'] ?? null, 'contact_name' => $validated['contact_name'] ?? null,
'contact_phone' => $validated['contact_phone'] ?? null, 'contact_phone' => $validated['contact_phone'] ?? null,
'contact_email' => $validated['contact_email'] ?? null, 'contact_email' => $validated['contact_email'] ?? null,
'valid_until' => $validated['valid_until'] ?? null, 'start_date' => $validated['start_date'] ?? null,
'end_date' => $validated['end_date'] ?? null,
'status' => $validated['status'], 'status' => $validated['status'],
'note' => $validated['note'] ?? null, 'note' => $validated['note'] ?? null,
'settings' => $validated['settings'] ?? [], 'settings' => $validated['settings'] ?? [],
@@ -131,11 +136,13 @@ class CompanyController extends Controller
$validated = $request->validate([ $validated = $request->validate([
'name' => 'required|string|max:255', 'name' => 'required|string|max:255',
'code' => 'required|string|max:50|unique:companies,code,' . $company->id, 'code' => 'required|string|max:50|unique:companies,code,' . $company->id,
'current_type' => 'required|string|in:buyout,lease',
'tax_id' => 'nullable|string|max:50', 'tax_id' => 'nullable|string|max:50',
'contact_name' => 'nullable|string|max:255', 'contact_name' => 'nullable|string|max:255',
'contact_phone' => 'nullable|string|max:50', 'contact_phone' => 'nullable|string|max:50',
'contact_email' => 'nullable|email|max:255', 'contact_email' => 'nullable|email|max:255',
'valid_until' => 'nullable|date', 'start_date' => 'nullable|date',
'end_date' => 'nullable|date',
'status' => 'required|boolean', 'status' => 'required|boolean',
'note' => 'nullable|string', 'note' => 'nullable|string',
'settings' => 'nullable|array', 'settings' => 'nullable|array',

View File

@@ -26,7 +26,7 @@ class EnsureTenantAccess
return redirect()->route('login')->with('error', __('Your account is associated with a deactivated company.')); return redirect()->route('login')->with('error', __('Your account is associated with a deactivated company.'));
} }
if ($company->valid_until && $company->valid_until->isPast()) { if ($company->end_date && $company->end_date->isPast()) {
auth()->logout(); auth()->logout();
return redirect()->route('login')->with('error', __('Your company contract has expired.')); return redirect()->route('login')->with('error', __('Your company contract has expired.'));
} }

View File

@@ -16,18 +16,22 @@ class Company extends Model
protected $fillable = [ protected $fillable = [
'name', 'name',
'code', 'code',
'original_type',
'current_type',
'tax_id', 'tax_id',
'contact_name', 'contact_name',
'contact_phone', 'contact_phone',
'contact_email', 'contact_email',
'status', 'status',
'valid_until', 'start_date',
'end_date',
'note', 'note',
'settings', 'settings',
]; ];
protected $casts = [ protected $casts = [
'valid_until' => 'date', 'start_date' => 'date',
'end_date' => 'date',
'status' => 'integer', 'status' => 'integer',
'settings' => 'array', 'settings' => 'array',
]; ];

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('companies', function (Blueprint $table) {
// 重新命名現有欄位
$table->renameColumn('valid_until', 'end_date');
// 新增業務類型
$table->string('original_type')->default('lease')->after('code')->comment('原始類型: buyout, lease');
$table->string('current_type')->default('lease')->after('original_type')->comment('當前類型: buyout, lease');
// 新增起始日
$table->date('start_date')->nullable()->after('status')->comment('合約起始日');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('companies', function (Blueprint $table) {
$table->renameColumn('end_date', 'valid_until');
$table->dropColumn(['original_type', 'current_type', 'start_date']);
});
}
};

View File

@@ -76,6 +76,7 @@
"Batch No": "Batch No", "Batch No": "Batch No",
"Belongs To": "Belongs To", "Belongs To": "Belongs To",
"Belongs To Company": "Belongs To Company", "Belongs To Company": "Belongs To Company",
"Buyout": "Buyout",
"Cancel": "Cancel", "Cancel": "Cancel",
"Cancel Purchase": "Cancel Purchase", "Cancel Purchase": "Cancel Purchase",
"Cannot Delete Role": "Cannot Delete Role", "Cannot Delete Role": "Cannot Delete Role",
@@ -105,6 +106,7 @@
"Config Name": "配置名稱", "Config Name": "配置名稱",
"Configuration Name": "Configuration Name", "Configuration Name": "Configuration Name",
"Confirm": "Confirm", "Confirm": "Confirm",
"Contract Period": "Contract Period",
"Confirm Deletion": "Confirm Deletion", "Confirm Deletion": "Confirm Deletion",
"Confirm Password": "Confirm Password", "Confirm Password": "Confirm Password",
"Connecting...": "Connecting...", "Connecting...": "Connecting...",
@@ -126,6 +128,7 @@
"Critical": "Critical", "Critical": "Critical",
"Current Password": "Current Password", "Current Password": "Current Password",
"Current Stock": "Current Stock", "Current Stock": "Current Stock",
"Business Type": "Business Type",
"Customer Info": "Customer Info", "Customer Info": "Customer Info",
"Customer Management": "Customer Management", "Customer Management": "Customer Management",
"Customer Payment Config": "Customer Payment Config", "Customer Payment Config": "Customer Payment Config",
@@ -141,6 +144,8 @@
"Define and manage security roles and permissions.": "Define and manage security roles and permissions.", "Define and manage security roles and permissions.": "Define and manage security roles and permissions.",
"Define new third-party payment parameters": "Define new third-party payment parameters", "Define new third-party payment parameters": "Define new third-party payment parameters",
"Feature Toggles": "Feature Toggles", "Feature Toggles": "Feature Toggles",
"Current": "Current",
"Current Type": "Current Type",
"Delete": "Delete", "Delete": "Delete",
"Delete Account": "Delete Account", "Delete Account": "Delete Account",
"Delete Permanently": "Delete Permanently", "Delete Permanently": "Delete Permanently",
@@ -186,6 +191,7 @@
"Error": "Error", "Error": "Error",
"Execution Time": "Execution Time", "Execution Time": "Execution Time",
"Expired": "Expired", "Expired": "Expired",
"End Date": "End Date",
"Expired / Disabled": "Expired / Disabled", "Expired / Disabled": "Expired / Disabled",
"Expiry Date": "Expiry Date", "Expiry Date": "Expiry Date",
"Expiry Management": "Expiry Management", "Expiry Management": "Expiry Management",
@@ -347,6 +353,7 @@
"Name": "Name", "Name": "Name",
"Never Connected": "Never Connected", "Never Connected": "Never Connected",
"New Password": "New Password", "New Password": "New Password",
"Lease": "Lease",
"New Password (leave blank to keep current)": "New Password (leave blank to keep current)", "New Password (leave blank to keep current)": "New Password (leave blank to keep current)",
"New Record": "New Record", "New Record": "New Record",
"New Sub Account Role": "New Sub Account Role", "New Sub Account Role": "New Sub Account Role",
@@ -383,6 +390,8 @@
"OEE.Orders": "Orders", "OEE.Orders": "Orders",
"OEE.Sales": "Sales", "OEE.Sales": "Sales",
"Offline": "Offline", "Offline": "Offline",
"Original": "Original",
"Original Type": "Original Type",
"Offline Machines": "Offline Machines", "Offline Machines": "Offline Machines",
"Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.": "Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.", "Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.": "Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.",
"Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.": "Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.", "Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.": "Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.",
@@ -542,6 +551,7 @@
"Store ID": "Store ID", "Store ID": "Store ID",
"Store Management": "Store Management", "Store Management": "Store Management",
"StoreID": "StoreID", "StoreID": "StoreID",
"Start Date": "Start Date",
"Sub Account Management": "Sub Account Management", "Sub Account Management": "Sub Account Management",
"Sub Account Roles": "Sub Account Roles", "Sub Account Roles": "Sub Account Roles",
"Sub Accounts": "Sub Accounts", "Sub Accounts": "Sub Accounts",

View File

@@ -76,6 +76,8 @@
"Batch No": "批號", "Batch No": "批號",
"Belongs To": "所属", "Belongs To": "所属",
"Belongs To Company": "所属会社", "Belongs To Company": "所属会社",
"Business Type": "業務タイプ",
"Buyout": "買取",
"Cancel": "キャンセル", "Cancel": "キャンセル",
"Cancel Purchase": "購入キャンセル", "Cancel Purchase": "購入キャンセル",
"Cannot Delete Role": "ロールを削除できません", "Cannot Delete Role": "ロールを削除できません",
@@ -105,6 +107,7 @@
"Config Name": "配置名稱", "Config Name": "配置名稱",
"Configuration Name": "設定名称", "Configuration Name": "設定名称",
"Confirm": "確認", "Confirm": "確認",
"Contract Period": "契約期間",
"Confirm Deletion": "削除の確認", "Confirm Deletion": "削除の確認",
"Confirm Password": "新しいパスワード(確認)", "Confirm Password": "新しいパスワード(確認)",
"Connecting...": "接続中...", "Connecting...": "接続中...",
@@ -125,6 +128,8 @@
"Create a new role and assign permissions.": "新しいロールを作成し、権限を割り当てます。", "Create a new role and assign permissions.": "新しいロールを作成し、権限を割り当てます。",
"Critical": "致命的", "Critical": "致命的",
"Current Password": "現在のパスワード", "Current Password": "現在のパスワード",
"Current": "現在",
"Current Type": "現タイプ",
"Current Stock": "現在の在庫", "Current Stock": "現在の在庫",
"Customer Info": "顧客情報", "Customer Info": "顧客情報",
"Customer Management": "顧客管理", "Customer Management": "顧客管理",
@@ -184,6 +189,7 @@
"Enter your password to confirm": "確認のためパスワードを入力してください", "Enter your password to confirm": "確認のためパスワードを入力してください",
"Equipment efficiency and OEE metrics": "設備効率と OEE 指標", "Equipment efficiency and OEE metrics": "設備効率と OEE 指標",
"Error": "エラー", "Error": "エラー",
"End Date": "終了日",
"Execution Time": "実行時間", "Execution Time": "実行時間",
"Expired": "期限切れ", "Expired": "期限切れ",
"Expired / Disabled": "期限切れ / 停止中", "Expired / Disabled": "期限切れ / 停止中",
@@ -250,6 +256,7 @@
"Key": "キー (Key)", "Key": "キー (Key)",
"Key No": "キー番号", "Key No": "キー番号",
"Identity & Codes": "識別とコード", "Identity & Codes": "識別とコード",
"Lease": "リース",
"LEVEL TYPE": "層級タイプ", "LEVEL TYPE": "層級タイプ",
"LINE Pay Direct": "LINE Pay 直結決済", "LINE Pay Direct": "LINE Pay 直結決済",
"LINE Pay Direct Settings Description": "LINE Pay 公式直結設定", "LINE Pay Direct Settings Description": "LINE Pay 公式直結設定",
@@ -373,6 +380,8 @@
"No slots found": "未找到貨道資訊", "No slots found": "未找到貨道資訊",
"No users found": "ユーザーが見つかりません", "No users found": "ユーザーが見つかりません",
"None": "なし", "None": "なし",
"Original": "最初",
"Original Type": "元タイプ",
"Normal": "正常", "Normal": "正常",
"Not Used": "未使用", "Not Used": "未使用",
"Not Used Description": "不使用第三方支付介接", "Not Used Description": "不使用第三方支付介接",
@@ -547,6 +556,7 @@
"Store ID": "加盟店ID (MerchantID)", "Store ID": "加盟店ID (MerchantID)",
"Store Management": "店舗管理", "Store Management": "店舗管理",
"StoreID": "加盟店ID (StoreID)", "StoreID": "加盟店ID (StoreID)",
"Start Date": "開始日",
"Sub Account Management": "サブアカウント管理", "Sub Account Management": "サブアカウント管理",
"Sub Account Roles": "サブアカウントロール", "Sub Account Roles": "サブアカウントロール",
"Sub Accounts": "サブアカウント", "Sub Accounts": "サブアカウント",

View File

@@ -129,8 +129,10 @@
"Customer Info": "客戶資訊", "Customer Info": "客戶資訊",
"Customer Management": "客戶管理", "Customer Management": "客戶管理",
"Customer Payment Config": "客戶金流設定", "Customer Payment Config": "客戶金流設定",
"Customer created successfully.": "客戶新增成功", "Customer created successfully.": "客戶新增成功",
"Customer updated successfully.": "客戶更新成功", "Customer updated successfully.": "客戶更新成功",
"Current Type": "當前類型",
"Contract Period": "合約期間",
"Danger Zone: Delete Account": "危險區域:刪除帳號", "Danger Zone: Delete Account": "危險區域:刪除帳號",
"Dashboard": "儀表板", "Dashboard": "儀表板",
"Data Configuration": "資料設定", "Data Configuration": "資料設定",
@@ -616,6 +618,14 @@
"Utilization Timeline": "稼動時序", "Utilization Timeline": "稼動時序",
"Utilization, OEE and Operational Intelligence": "稼動率、OEE 與營運情報", "Utilization, OEE and Operational Intelligence": "稼動率、OEE 與營運情報",
"Valid Until": "合約到期日", "Valid Until": "合約到期日",
"Buyout": "買斷",
"Lease": "租賃",
"Original Type": "原始類型",
"Business Type": "業務類型",
"Start Date": "起始日",
"End Date": "截止日",
"Original": "原始",
"Current": "當前",
"Vending Page": "販賣頁", "Vending Page": "販賣頁",
"Venue Management": "場地管理", "Venue Management": "場地管理",
"View Details": "查看詳情", "View Details": "查看詳情",

View File

@@ -8,11 +8,14 @@
id: '', id: '',
name: '', name: '',
code: '', code: '',
original_type: 'lease',
current_type: 'lease',
tax_id: '', tax_id: '',
contact_name: '', contact_name: '',
contact_phone: '', contact_phone: '',
contact_email: '', contact_email: '',
valid_until: '', start_date: '',
end_date: '',
status: 1, status: 1,
note: '', note: '',
settings: { settings: {
@@ -23,8 +26,9 @@
openCreateModal() { openCreateModal() {
this.editing = false; this.editing = false;
this.currentCompany = { this.currentCompany = {
id: '', name: '', code: '', tax_id: '', contact_name: '', contact_phone: '', id: '', name: '', code: '', original_type: 'lease', current_type: 'lease',
contact_email: '', valid_until: '', status: 1, note: '', tax_id: '', contact_name: '', contact_phone: '',
contact_email: '', start_date: '', end_date: '', status: 1, note: '',
settings: { enable_material_code: false, enable_points: false } settings: { enable_material_code: false, enable_points: false }
}; };
this.showModal = true; this.showModal = true;
@@ -33,6 +37,8 @@
this.editing = true; this.editing = true;
this.currentCompany = { this.currentCompany = {
...company, ...company,
start_date: company.start_date ? company.start_date.substring(0, 10) : '',
end_date: company.end_date ? company.end_date.substring(0, 10) : '',
settings: { settings: {
enable_material_code: company.settings?.enable_material_code || false, enable_material_code: company.settings?.enable_material_code || false,
enable_points: company.settings?.enable_points || false enable_points: company.settings?.enable_points || false
@@ -49,8 +55,9 @@
statusToggleSource: 'edit', statusToggleSource: 'edit',
showDetail: false, showDetail: false,
detailCompany: { detailCompany: {
id: '', name: '', code: '', tax_id: '', contact_name: '', contact_phone: '', id: '', name: '', code: '', original_type: 'lease', current_type: 'lease',
contact_email: '', valid_until: '', status: 1, note: '', tax_id: '', contact_name: '', contact_phone: '', contact_email: '',
start_date: '', end_date: '', status: 1, note: '',
settings: { enable_material_code: false, enable_points: false }, settings: { enable_material_code: false, enable_points: false },
users_count: 0, machines_count: 0 users_count: 0, machines_count: 0
}, },
@@ -146,6 +153,9 @@
<th <th
class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800"> class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800">
{{ __('Customer Info') }}</th> {{ __('Customer Info') }}</th>
<th
class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800 text-center">
{{ __('Business Type') }}</th>
<th <th
class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800 text-center"> class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800 text-center">
{{ __('Status') }}</th> {{ __('Status') }}</th>
@@ -154,7 +164,7 @@
{{ __('Accounts / Machines') }}</th> {{ __('Accounts / Machines') }}</th>
<th <th
class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800 text-center"> class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800 text-center">
{{ __('Valid Until') }}</th> {{ __('Contract Period') }}</th>
<th <th
class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800 text-right"> class="px-6 py-4 text-[12px] font-black text-slate-400 dark:text-slate-500 uppercase tracking-widest border-b border-slate-100 dark:border-slate-800 text-right">
{{ __('Actions') }}</th> {{ __('Actions') }}</th>
@@ -174,15 +184,36 @@
</svg> </svg>
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex items-center gap-2">
<span <span
class="text-base font-extrabold text-slate-800 dark:text-slate-100 group-hover:text-cyan-600 dark:group-hover:text-cyan-400 transition-colors">{{ class="text-base font-extrabold text-slate-800 dark:text-slate-100 group-hover:text-cyan-600 dark:group-hover:text-cyan-400 transition-colors">{{
$company->name }}</span> $company->name }}</span>
</div>
<span <span
class="text-xs font-mono font-bold text-slate-500 dark:text-slate-400 mt-0.5 tracking-widest uppercase">{{ class="text-xs font-mono font-bold text-slate-500 dark:text-slate-400 mt-0.5 tracking-widest uppercase">{{
$company->code }}</span> $company->code }}</span>
</div> </div>
</div> </div>
</td> </td>
<td class="px-6 py-6 text-center">
<div class="flex flex-col items-center gap-1">
<div class="flex items-center gap-1.5">
<span class="text-[10px] font-black text-slate-400 uppercase tracking-tighter">{{ __('Original') }}</span>
<span class="px-2 py-0.5 rounded-md text-[10px] font-black {{ $company->original_type === 'buyout' ? 'bg-amber-500/10 text-amber-600' : 'bg-blue-500/10 text-blue-600' }} uppercase tracking-widest">
{{ __($company->original_type === 'buyout' ? 'Buyout' : 'Lease') }}
</span>
</div>
<div class="text-slate-300 dark:text-slate-700">
<svg class="size-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path d="M19 9l-7 7-7-7" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></svg>
</div>
<div class="flex items-center gap-1.5">
<span class="text-[10px] font-black text-slate-400 uppercase tracking-tighter">{{ __('Current') }}</span>
<span class="px-2 py-0.5 rounded-md text-[10px] font-black {{ $company->current_type === 'buyout' ? 'bg-amber-500/10 text-amber-600 font-bold border border-amber-500/20' : 'bg-blue-500/10 text-blue-600 font-bold border border-blue-500/20' }} uppercase tracking-widest">
{{ __($company->current_type === 'buyout' ? 'Buyout' : 'Lease') }}
</span>
</div>
</div>
</td>
<td class="px-6 py-6 text-center"> <td class="px-6 py-6 text-center">
@if($company->status) @if($company->status)
<span <span
@@ -210,10 +241,15 @@
</div> </div>
</td> </td>
<td class="px-6 py-6 text-center"> <td class="px-6 py-6 text-center">
<span <div class="flex flex-col items-center gap-0.5">
class="text-[13px] font-bold font-display tracking-widest {{ $company->valid_until && $company->valid_until->isPast() ? 'text-rose-500' : 'text-slate-600 dark:text-slate-300' }}"> <span class="text-[12px] font-bold font-mono text-slate-500 dark:text-slate-400 uppercase tracking-tighter">
{{ $company->valid_until ? $company->valid_until->format('Y/m/d') : __('Permanent') }} {{ $company->start_date ? $company->start_date->format('Y-m-d') : '--' }}
</span> </span>
<div class="h-2 w-px bg-slate-200 dark:bg-slate-700"></div>
<span class="text-[13px] font-black font-display tracking-widest {{ $company->end_date && $company->end_date->isPast() ? 'text-rose-500' : 'text-slate-800 dark:text-slate-200' }}">
{{ $company->end_date ? $company->end_date->format('Y-m-d') : __('Permanent') }}
</span>
</div>
</td> </td>
<td class="px-6 py-6 text-right"> <td class="px-6 py-6 text-right">
<div class="flex items-center justify-end gap-x-2"> <div class="flex items-center justify-end gap-x-2">
@@ -342,6 +378,50 @@
__('Company Information') }}</h4> __('Company Information') }}</h4>
</div> </div>
<!-- Business Type Selector -->
<div class="p-4 rounded-2xl bg-slate-50/50 dark:bg-slate-800/50 border border-slate-100 dark:border-slate-700/50 space-y-3">
<label class="text-[11px] font-black text-slate-500 uppercase tracking-widest pl-1">{{ __('Business Type') }}</label>
<!-- 新增模式:顯示切換按鈕 -->
<div x-show="!editing" class="flex p-1 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-slate-700 w-fit">
<button type="button" @click="currentCompany.original_type = 'lease'"
:class="currentCompany.original_type === 'lease' ? 'bg-blue-500 text-white shadow-lg shadow-blue-500/20' : 'text-slate-400 hover:text-slate-600'"
class="px-4 py-1.5 rounded-lg text-xs font-black uppercase tracking-widest transition-all">
{{ __('Lease') }}
</button>
<button type="button" @click="currentCompany.original_type = 'buyout'"
:class="currentCompany.original_type === 'buyout' ? 'bg-amber-500 text-white shadow-lg shadow-amber-500/20' : 'text-slate-400 hover:text-slate-600'"
class="px-4 py-1.5 rounded-lg text-xs font-black uppercase tracking-widest transition-all">
{{ __('Buyout') }}
</button>
<input type="hidden" name="original_type" :value="currentCompany.original_type">
</div>
<!-- 編輯模式:顯示原始類型固定值 + 當前類型切換 -->
<div x-show="editing" class="flex flex-col gap-4">
<div class="flex items-center gap-3">
<span class="text-xs font-bold text-slate-400">{{ __('Original Type') }}:</span>
<span class="px-3 py-1 bg-slate-100 dark:bg-slate-800 rounded-lg text-xs font-black uppercase tracking-widest text-slate-600 dark:text-slate-400" x-text="currentCompany.original_type === 'buyout' ? '{{ __('Buyout') }}' : '{{ __('Lease') }}'"></span>
</div>
<div class="flex items-center gap-3">
<span class="text-xs font-bold text-slate-400">{{ __('Current Type') }}:</span>
<div class="flex p-1 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-slate-700 w-fit">
<button type="button" @click="currentCompany.current_type = 'lease'"
:class="currentCompany.current_type === 'lease' ? 'bg-blue-500 text-white shadow-lg shadow-blue-500/20' : 'text-slate-400 hover:text-slate-600'"
class="px-4 py-1.5 rounded-lg text-xs font-black uppercase tracking-widest transition-all">
{{ __('Lease') }}
</button>
<button type="button" @click="currentCompany.current_type = 'buyout'"
:class="currentCompany.current_type === 'buyout' ? 'bg-amber-500 text-white shadow-lg shadow-amber-500/20' : 'text-slate-400 hover:text-slate-600'"
class="px-4 py-1.5 rounded-lg text-xs font-black uppercase tracking-widest transition-all">
{{ __('Buyout') }}
</button>
<input type="hidden" name="current_type" :value="currentCompany.current_type">
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="space-y-2"> <div class="space-y-2">
<label class="text-xs font-black text-slate-500 uppercase tracking-widest pl-1">{{ <label class="text-xs font-black text-slate-500 uppercase tracking-widest pl-1">{{
@@ -364,11 +444,19 @@
<input type="text" name="tax_id" x-model="currentCompany.tax_id" <input type="text" name="tax_id" x-model="currentCompany.tax_id"
class="luxury-input w-full"> class="luxury-input w-full">
</div> </div>
<div class="grid grid-cols-2 gap-3">
<div class="space-y-2"> <div class="space-y-2">
<label class="text-xs font-black text-slate-500 uppercase tracking-widest pl-1">{{ <label class="text-xs font-black text-slate-500 uppercase tracking-widest pl-1">{{
__('Contract Until (Optional)') }}</label> __('Start Date') }}</label>
<input type="date" name="valid_until" x-model="currentCompany.valid_until" <input type="date" name="start_date" x-model="currentCompany.start_date"
class="luxury-input w-full"> class="luxury-input w-full px-2">
</div>
<div class="space-y-2">
<label class="text-xs font-black text-slate-500 uppercase tracking-widest pl-1">{{
__('End Date') }}</label>
<input type="date" name="end_date" x-model="currentCompany.end_date"
class="luxury-input w-full px-2">
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -574,8 +662,9 @@
<!-- Validity & Status Section --> <!-- Validity & Status Section -->
<section class="space-y-4"> <section class="space-y-4">
<h3 class="text-xs font-black text-emerald-500 uppercase tracking-[0.3em]">{{ __('Account Status') }}</h3> <h3 class="text-xs font-black text-emerald-500 uppercase tracking-[0.3em]">{{ __('Account Status') }}</h3>
<div class="grid grid-cols-2 gap-4"> <div class="grid grid-cols-1 gap-4">
<div class="bg-slate-50 dark:bg-slate-800/40 p-5 rounded-2xl border border-slate-100 dark:border-slate-800/80"> <div class="bg-slate-50 dark:bg-slate-800/40 p-5 rounded-2xl border border-slate-100 dark:border-slate-800/80 flex items-center justify-between">
<div>
<span class="text-xs font-bold text-slate-400 uppercase tracking-widest block mb-1.5">{{ __('Current Status') }}</span> <span class="text-xs font-bold text-slate-400 uppercase tracking-widest block mb-1.5">{{ __('Current Status') }}</span>
<template x-if="detailCompany.status"> <template x-if="detailCompany.status">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@@ -590,9 +679,36 @@
</div> </div>
</template> </template>
</div> </div>
</div>
<!-- Business Type -->
<div class="bg-slate-50 dark:bg-slate-800/40 p-5 rounded-2xl border border-slate-100 dark:border-slate-800/80"> <div class="bg-slate-50 dark:bg-slate-800/40 p-5 rounded-2xl border border-slate-100 dark:border-slate-800/80">
<span class="text-xs font-bold text-slate-400 uppercase tracking-widest block mb-1.5">{{ __('Valid Until') }}</span> <span class="text-xs font-bold text-slate-400 uppercase tracking-widest block mb-3">{{ __('Business Type') }}</span>
<div class="text-sm font-black text-slate-700 dark:text-slate-300" x-text="detailCompany.valid_until ? detailCompany.valid_until : '{{ __('Permanent') }}'"></div> <div class="flex items-center gap-4">
<div class="flex-1">
<p class="text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1">{{ __('Original') }}</p>
<span class="px-2.5 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest"
:class="detailCompany.original_type === 'buyout' ? 'bg-amber-500/10 text-amber-600' : 'bg-blue-500/10 text-blue-600'"
x-text="detailCompany.original_type === 'buyout' ? '{{ __('Buyout') }}' : '{{ __('Lease') }}'"></span>
</div>
<div class="w-px h-8 bg-slate-200 dark:bg-slate-700"></div>
<div class="flex-1 text-right">
<p class="text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1">{{ __('Current') }}</p>
<span class="px-2.5 py-1 rounded-lg text-[10px] font-black uppercase tracking-widest"
:class="detailCompany.current_type === 'buyout' ? 'bg-amber-500/10 text-amber-600' : 'bg-blue-500/10 text-blue-600'"
x-text="detailCompany.current_type === 'buyout' ? '{{ __('Buyout') }}' : '{{ __('Lease') }}'"></span>
</div>
</div>
</div>
<!- Contract Period -->
<div class="bg-slate-50 dark:bg-slate-800/40 p-5 rounded-2xl border border-slate-100 dark:border-slate-800/80">
<span class="text-xs font-bold text-slate-400 uppercase tracking-widest block mb-2">{{ __('Contract Period') }}</span>
<div class="flex items-center gap-2">
<div class="text-sm font-black text-slate-700 dark:text-slate-300" x-text="detailCompany.start_date || '--'"></div>
<span class="text-slate-300 text-xs"></span>
<div class="text-sm font-black text-slate-700 dark:text-slate-300" x-text="detailCompany.end_date || '{{ __('Permanent') }}'"></div>
</div>
</div> </div>
</div> </div>
</section> </section>