update show ip & reinstall vps 50%
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
@php
|
||||
$isWindows = Str::contains(Str::lower($vmInfo['os'] ?? ''), 'windows') ||
|
||||
Str::contains(Str::lower($invoice->invoiceItem->first()->os->osGroup->name ?? ''), 'windows');
|
||||
$vmIp = $vmInfo['ip'] ?? '103.42.56.177';
|
||||
$vmIp = $vmInfo['ip_address'] ?? '103.42.56.177';
|
||||
$vmPort = $isWindows ? '3389' : '22';
|
||||
$vmUser = $isWindows ? 'administrator' : 'root';
|
||||
$osName = $invoice->invoiceItem->first()->os->osGroup->name ?? 'Unknown';
|
||||
|
||||
@@ -29,67 +29,146 @@
|
||||
@if ($osGroups->count() > 0)
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">Chọn loại hệ điều hành</label>
|
||||
<flux:select wire:model="selectedOsGroupId" placeholder="Chọn lại Hệ điều hành">
|
||||
<flux:select.option value="">Chọn lại hệ điều hành</flux:select.option>
|
||||
<label
|
||||
class="block text-sm font-medium text-gray-700 mb-2">{{ __('Chọn loại hệ điều hành') }}</label>
|
||||
<flux:select wire:model.live="selectedOsGroupId" placeholder="{{ __('Chọn loại hệ điều hành') }}"
|
||||
:disabled="$isLoading">
|
||||
<flux:select.option value="">{{ __('Chọn loại hệ điều hành') }}</flux:select.option>
|
||||
@foreach ($osGroups as $osGroup)
|
||||
<flux:select.option value="{{ $osGroup->id }}">{{ $osGroup->name }}</flux:select.option>
|
||||
<flux:select.option value="{{ $osGroup->id }}">{{ $osGroup->name }}
|
||||
</flux:select.option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</div>
|
||||
|
||||
@if ($selectedOsGroupId && $operatingSystems->count() > 0)
|
||||
@if ($selectedOsGroupId)
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">{{ __('Chọn phiên bản:') }}</label>
|
||||
<div class="grid grid-cols-1 gap-3 max-h-60 overflow-y-auto">
|
||||
@foreach ($operatingSystems as $os)
|
||||
<label
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
<input type="radio" wire:model="selectedOsId" value="{{ $os->id }}"
|
||||
class="mr-3">
|
||||
<div class="flex-1">
|
||||
<div class="font-medium text-gray-900">{{ $os->osGroup->name . ' - ' . $os->version }}
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
{{ __('Chọn phiên bản:') }}
|
||||
@if ($isLoading)
|
||||
<span class="text-sm text-gray-500 ml-2">
|
||||
<svg class="inline w-4 h-4 animate-spin" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10"
|
||||
stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
||||
</path>
|
||||
</svg>
|
||||
{{ __('Đang tải...') }}
|
||||
</span>
|
||||
@endif
|
||||
</label>
|
||||
|
||||
@if ($isLoading)
|
||||
<div class="text-center py-8">
|
||||
<svg class="mx-auto h-8 w-8 text-gray-400 animate-spin" fill="none"
|
||||
viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10"
|
||||
stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
||||
</path>
|
||||
</svg>
|
||||
<p class="mt-2 text-sm text-gray-500">{{ __('Đang tải danh sách phiên bản...') }}</p>
|
||||
</div>
|
||||
@elseif ($operatingSystems->count() > 0)
|
||||
<div class="grid grid-cols-1 gap-3 max-h-60 overflow-y-auto">
|
||||
@foreach ($operatingSystems as $os)
|
||||
<label
|
||||
class="flex items-center p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
<input type="radio" wire:model.live="selectedOsId" value="{{ $os->id }}"
|
||||
class="mr-3">
|
||||
<div class="flex-1">
|
||||
<div class="font-medium text-gray-900">
|
||||
{{ $os->osGroup->name . ' - ' . $os->version }}
|
||||
</div>
|
||||
@if ($os->description)
|
||||
<div class="text-sm text-gray-500 mt-1">
|
||||
{{ $os->description }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
@if ($currentOs && $currentOs->id == $os->id)
|
||||
<div class="flex items-center space-x-2">
|
||||
@if ($currentOs && $currentOs->id == $os->id)
|
||||
<span
|
||||
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
||||
{{ __('Hiện tại') }}
|
||||
</span>
|
||||
@endif
|
||||
<span
|
||||
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
||||
Hiện tại
|
||||
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||
{{ __('Khả dụng') }}
|
||||
</span>
|
||||
@endif
|
||||
<span
|
||||
class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||
Khả dụng
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
@else
|
||||
<div class="text-center py-8">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor"
|
||||
viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0112 15c-2.34 0-4.47-.881-6.08-2.33" />
|
||||
</svg>
|
||||
<h3 class="mt-2 text-sm font-medium text-gray-900">{{ __('Không có phiên bản nào') }}
|
||||
</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
{{ __('Không có phiên bản hệ điều hành nào khả dụng cho loại này.') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@elseif($selectedOsGroupId)
|
||||
<div class="text-center py-8">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor"
|
||||
viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0112 15c-2.34 0-4.47-.881-6.08-2.33" />
|
||||
</svg>
|
||||
<h3 class="mt-2 text-sm font-medium text-gray-900">{{ __('Không có phiên bản nào') }}</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
{{ __('Không có phiên bản hệ điều hành nào khả dụng cho loại này.') }}</p>
|
||||
@endif
|
||||
|
||||
@if ($selectedOsId && $selectedOsDetails && $vpsInfo)
|
||||
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-4 mt-4">
|
||||
<div class="flex items-start">
|
||||
<svg class="w-5 h-5 text-yellow-600 mr-2 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z" />
|
||||
</svg>
|
||||
<div class="flex-1">
|
||||
<h3 class="text-sm font-medium text-yellow-800 mb-2">{{ __('Quý khách cài đặt lại VPS với thông tin như sau:') }}</h3>
|
||||
<div class="text-sm text-yellow-700 space-y-1">
|
||||
<p><strong>{{ __('VPS:') }}</strong> {{ $vpsIpAddress ?? $moduleVmware?->name ?? $vpsInfo->name ?? 'N/A' }}</p>
|
||||
<p><strong>{{ __('Hệ điều hành:') }}</strong> {{ $selectedOsDetails->osGroup->name ?? '' }} {{ $selectedOsDetails->version ?? '' }}</p>
|
||||
</div>
|
||||
<div class="mt-3 p-3 bg-yellow-100 rounded border border-yellow-300">
|
||||
<p class="text-sm text-yellow-800 font-medium">{{ __('Lưu ý:') }}</p>
|
||||
<p class="text-sm text-yellow-700">{{ __('Hành động này rất nguy hiểm, nó có thể xóa VPS và cài đặt lại. Quý khách vui lòng kiểm tra lại các VPS cần cài đặt lại.') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="flex justify-end space-x-3 pt-4 border-t border-gray-200">
|
||||
<flux:button variant="primary" x-on:click="$flux.modal('reinstall-vm').close()">
|
||||
<flux:button variant="primary" x-on:click="$flux.modal('reinstall-vm').close()" :disabled="$isLoading">
|
||||
{{ __('Hủy') }}
|
||||
</flux:button>
|
||||
<flux:button variant="primary" color="orange" wire:click="confirmReinstall">
|
||||
{{ __('Xác nhận cài lại') }}
|
||||
</flux:button>
|
||||
@if ($selectedOsId && $selectedOsDetails)
|
||||
<flux:button variant="primary" color="orange" wire:click="confirmReinstall" :disabled="$isLoading">
|
||||
@if ($isLoading)
|
||||
<svg class="w-4 h-4 mr-2 animate-spin" fill="none" viewBox="0 0 24 24">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
||||
{{ __('Đang xử lý...') }}
|
||||
@else
|
||||
{{ __('Xác nhận cài lại') }}
|
||||
@endif
|
||||
</flux:button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="text-center py-8">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0112 15c-2.34 0-4.47-.881-6.08-2.33" />
|
||||
</svg>
|
||||
<h3 class="mt-2 text-sm font-medium text-gray-900">{{ __('Không có hệ điều hành nào') }}</h3>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
{{ __('Không có hệ điều hành nào khả dụng cho VPS này.') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</flux:modal>
|
||||
|
||||
Reference in New Issue
Block a user