<div class="d-flex flex-wrap py-5">
    <div class="flex-equal me-5">
        <div class="d-flex flex-wrap py-5">
            <div class="flex-equal me-5">
                <div class="row">
                    <div class="col-md-12">
                        <p class="fs-6 fw-semibold text-gray-600 mb-0"><span class="text-warning">Sunucu Bilgisi:</span> {{ $vm['sip'] }}</a><small class="text-success">({{ $vm['sdata']['name'] }})</small></p>
                        <p class="fs-6 fw-semibold text-gray-600 mb-0"><span class="text-warning">Sunucu Şablonu:</span>  {{ $vm['sdata']['templatename'] }}</p>
                        @if(beCheckPermission('diyovm_show_info',0))
                        <p class="fs-6 fw-semibold text-gray-600"><span class="text-warning">Oturum Bilgileri:</span>     
                            <span class="d-block">
                                {{ $vm['sdata']['config']['username'] }}
                            </span>
                            <span class="d-block">
                                {{ $vm['sdata']['config']['password'] }}
                            </span>
                        </p>
                        @endif
                        @if(beCheckPermission('diyovm_show_info_stats',0))
                        <p class="fs-6 fw-semibold text-gray-600 text-warning"><span class="text-warning">Kullanım CPU/RAM/DISK/HAT:</span>
                            <span class="d-block">
                            <small class="text-success">{{ $vm['sdata']['stats']['cpu_mhz'] }} MHZ</small> / {{ round($vm['sdata']['settings']["core"]*$vm['sdata']['stats']['cpu_hz']*1000) }} MHZ 
                            </span>
                            <span class="d-block">
                            <small class="text-success">{{ $vm['sdata']['stats']['ram_mb'] }} MB</small> / {{ $vm['sdata']['settings']['ram'] }} MB
                            </span>
                            <span class="d-block">
                            <small class="text-success">{{ $vm['sdata']['stats']['disk_gb'] }} GB</small> / {{ $vm['sdata']['settings']['disk'] }} GB
                            </span>
                            <span class="d-block">
                            <small class="text-success">{{ $vm['sdata']['stats']['network'] }} KBSP</small>
                            </span>
                        </p>
                        @endif
                        <a class="btn btn-info" href="https://{{ $server['surl'] }}/sunucu-goruntule/{{ $vm['sid'] }}" target="_blank">Panelde Görütnüle</a>   
                    </div>
                </div>
            </div>
            <div class="flex-equal me-5">
                <div class="row">
                    <div class="col-md-12">
                        @if($vm['sdata']['stats']['power_status'] == 0)
                        @if(beCheckPermission('diyovm_process_start',0))
                        <button class="btn btn-primary setServerPowerAction" data-process="start">Başlat</button>
                        @endif
                        @else
                        @if(beCheckPermission('diyovm_process_stop',0))
                        <button class="btn btn-danger setServerPowerAction" data-process="stop">Durdur</button>
                        @endif
                        @if(beCheckPermission('diyovm_process_restart',0))
                        <button class="btn btn-warning setServerPowerAction" data-process="restart">Yeniden Başlat</button>
                        @endif
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var wait_diyovm1 = false;
    $(".setServerPowerAction").on("click",function(){
        if(!wait_diyovm1){
            wait_diyovm1 = true;
            $(".setServerPowerAction").html('Bekleyin <span class="spinner-border spinner-border-sm align-middle ms-2"></span>');
            var process = $(this).data("process");
            $.ajax({
                url: "{{ beGetRoute('admin.order.automation.module.post') }}",
                type: "post",
                async: true,
                data: {
                    upid:{{ $userproduct['upid'] }},
                    function:"power_action",
                    process: process
                },
                dataType: "json",
                crossDomain: true,
                success: function(response){
                    wait_diyovm1 = false;
                    if(response.status){
                        Swal.fire("Başarılı",response.message,"success");
                    }
                    else{
                        Swal.fire("Bir Hata Oluştu",response.message,"error");
                    }
                    loadModule(module);
                }
            });
        }
        else{
            Swal.fire("Bir Hata Oluştu","Lütfen işlemin tamamlanmasını bekleyin","error");
        }
        return false;
    });
</script>