





<!doctype html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <link href="<?php echo e(asset('static/patients/css/bootstrap.min.css')); ?>" rel="stylesheet">
    <link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.css" rel="stylesheet" type='text/css'>
    <link href="<?php echo e(asset('static/my_auth/font.css')); ?>" rel="stylesheet">
    <link rel="stylesheet" href="<?php echo e(asset('static/patients/css/spur.css')); ?>">
    
    <title>نتیجه تشخیص</title>
    
    <style>
        .result-card {
            border-radius: 15px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }
        
        .prediction-box {
            padding: 20px;
            border-radius: 10px;
            text-align: center;
            margin-bottom: 20px;
        }
        
        .amd-positive {
            background-color: #ffeaea;
            border: 2px solid #ff6b6b;
        }
        
        .amd-negative {
            background-color: #e8f7ef;
            border: 2px solid #4caf50;
        }
        
        .probability-bar {
            height: 25px;
            background: linear-gradient(to right, #4caf50, #ff9800, #f44336);
            border-radius: 12px;
            overflow: hidden;
            position: relative;
            margin: 20px 0;
        }
        
        .probability-indicator {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 2px;
            background-color: #000;
        }
        
        .probability-labels {
            display: flex;
            justify-content: space-between;
            margin-top: 5px;
        }
    </style>
</head>

<body>
<div class="dash">
    <!-- Navigation similar to other pages -->
    <div class="dash-app">
        <main class="dash-content text-right" style="direction: rtl">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="card spur-card result-card">
                            <div class="card-header">
                                <div class="spur-card-icon">
                                    <i class="fas fa-chart-bar"></i>
                                </div>
                                <div class="spur-card-title">نتیجه تشخیص بیماری AMD</div>
                            </div>
                            
                            <div class="card-body">
                                <?php if(session('success')): ?>
                                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                                        <?php echo e(session('success')); ?>

                                        <button type="button" class="close" data-dismiss="alert">
                                            <span>&times;</span>
                                        </button>
                                    </div>
                                <?php endif; ?>
                                
                                <?php if($api_response): ?>
                                    <div class="prediction-box <?php echo e($api_response['predicted_class'] == 1 ? 'amd-positive' : 'amd-negative'); ?>">
                                        <h3 class="mb-3">
                                            <?php if($api_response['predicted_class'] == 1): ?>
                                                <i class="fa fa-exclamation-triangle text-danger"></i>
                                                نتیجه: احتمال ابتلا به AMD
                                            <?php else: ?>
                                                <i class="fa fa-check-circle text-success"></i>
                                                نتیجه: سالم (عدم ابتلا به AMD)
                                            <?php endif; ?>
                                        </h3>
                                        
                                        <div class="probability-display mb-4">
                                            <h4>احتمال AMD: <strong><?php echo e(number_format($api_response['probability_AMD'] * 100, 2)); ?>%</strong></h4>
                                            
                                            <div class="probability-bar">
                                                <div class="probability-indicator" 
                                                     style="left: <?php echo e($api_response['probability_AMD'] * 100); ?>%">
                                                </div>
                                            </div>
                                            
                                            <div class="probability-labels">
                                                <span>0% (سالم)</span>
                                                <span>50%</span>
                                                <span>100% (AMD)</span>
                                            </div>
                                        </div>
                                        
                                        <div class="alert alert-info">
                                            <i class="fa fa-info-circle"></i>
                                            <?php echo e($api_response['message'] ?? '0 = No AMD, 1 = AMD'); ?>

                                        </div>
                                    </div>
                                    
                                    <?php if($diagnosis): ?>
                                        <div class="diagnosis-details mt-4">
                                            <h5>جزئیات تشخیص:</h5>
                                            <table class="table table-bordered">
                                                <tr>
                                                    <th>تاریخ تشخیص:</th>
                                                    <td><?php echo e($diagnosis->created_at->format('Y/m/d H:i')); ?></td>
                                                </tr>
                                                <tr>
                                                    <th>نوع تشخیص:</th>
                                                    <td>
                                                        <?php if($diagnosis->diagnosis_type == 'image'): ?>
                                                            تشخیص با تصویر
                                                        <?php else: ?>
                                                            تشخیص با داده های بالینی
                                                        <?php endif; ?>
                                                    </td>
                                                </tr>
                                                <?php if($diagnosis->patient): ?>
                                                <tr>
                                                    <th>بیمار:</th>
                                                    <td>
                                                        <?php echo e($diagnosis->patient->first_name); ?> <?php echo e($diagnosis->patient->last_name); ?>

                                                        (کد ملی: <?php echo e($diagnosis->patient->national_code); ?>)
                                                    </td>
                                                </tr>
                                                <?php endif; ?>
                                            </table>
                                        </div>
                                    <?php endif; ?>
                                    
                                    <div class="raw-response mt-4" style="direction: ltr">
                                        <h6>پاسخ کامل API:</h6>
                                        <pre style="background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto;">
<?php echo e(json_encode($api_response, JSON_PRETTY_PRINT)); ?>

                                        </pre>
                                    </div>
                                    
                                    <div class="action-buttons mt-4">
                                        <a href="<?php echo e(route('diagnose.clinical')); ?>" class="btn btn-primary">
                                            <i class="fa fa-file-text"></i> تشخیص با داده های بالینی جدید
                                        </a>
                                        <a href="<?php echo e(route('diagnose.scan')); ?>" class="btn btn-success">
                                            <i class="fa fa-camera"></i> تشخیص با تصویر جدید
                                        </a>
                                        <a href="<?php echo e(route('patients.index')); ?>" class="btn btn-secondary">
                                            <i class="fa fa-list"></i> بازگشت به لیست بیماران
                                        </a>
                                        
                                        <?php if($diagnosis): ?>
                                        <button onclick="printResult()" class="btn btn-info">
                                            <i class="fa fa-print"></i> چاپ نتیجه
                                        </button>
                                        <?php endif; ?>
                                    </div>
                                    
                                <?php else: ?>
                                    <div class="alert alert-warning">
                                        <i class="fa fa-exclamation-triangle"></i>
                                        اطلاعات تشخیص یافت نشد. لطفاً ابتدا یک تشخیص انجام دهید.
                                    </div>
                                    
                                    <div class="text-center">
                                        <a href="<?php echo e(route('diagnose.clinical')); ?>" class="btn btn-primary btn-lg m-2">
                                            <i class="fa fa-file-text"></i> تشخیص با داده های بالینی
                                        </a>
                                        <a href="<?php echo e(route('diagnose.scan')); ?>" class="btn btn-success btn-lg m-2">
                                            <i class="fa fa-camera"></i> تشخیص با تصویر
                                        </a>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>
</div>

<script>
    function printResult() {
        window.print();
    }
</script>

<script src="<?php echo e(asset('static/my_auth/jquery.min.js')); ?>"></script>
<script src="<?php echo e(asset('static/my_auth/popper.js')); ?>"></script>
<script src="<?php echo e(asset('static/my_auth/bootstrap.min.js')); ?>"></script>
<script src="<?php echo e(asset('static/patients/js/spur.js')); ?>"></script>

</body>
</html><?php /**PATH /home/mehdi/Pojects/AMD/resources/views/diagnose/result.blade.php ENDPATH**/ ?>