<?php if ($item['action'] == 'hosting'): ?>
  <?php $details = $whmcs->GetProducts($item['productId']);?>
  <div class="cart-item">
      <h4><?php echo $details['name']; ?> <i class="ssicon-<?php echo ($details['module'] ?? 'plesk') === 'plesk' ? 'parallels' : $details['module']; ?>"></i> </h4>
      <p id="service-duration-<?php echo $item['productId']; ?>" data-domain="<?php echo $item['domain']; ?>">
        <?php echo $item['domain'] ?> - Ürün / Hizmet - (1 Yıl)
      </p>
      <div class="row">
        <div class="col-sm-10">
          <usd style="width:100%;">
          <select class="price-usd form-select" data-product-id="<?php echo $item['productId']; ?>" onchange="updateDuration(this)">
              <?php
              $periods = [
                  'monthly' => '1 Ay',
                  'annually' => '1 Yıl',
                  'biennially' => '2 Yıl',
                  'triennially' => '3 Yıl',
              ];

              // USD fiyatları için select oluştur
              if (isset($details['pricing']['USD'])) {
                  $pricing = $details['pricing']['USD'];
                  foreach ($pricing as $period => $price) {
                      if (in_array($period, ['monthly', 'annually', 'biennially', 'triennially']) && $price > 0) {
                          $selected = ($period === 'annually') ? 'selected' : ''; // Varsayılan olarak yıllık seçili
                          echo '<option value="' . $period . '" data-period="' . $price . '" ' . $selected . '>' . $periods[$period] . ' - ($' . number_format($price, 2) . ')</option>' . PHP_EOL;
                      }
                  }
              }
              ?>
          </select>
          </usd>
          <try style="width:100%;">
          <select class="price-try form-select" data-product-id="<?php echo $item['productId']; ?>" onchange="updateDuration(this)">
            <?php
            if (isset($details['pricing']['TRY'])) {
              $pricing = $details['pricing']['TRY'];
              foreach ($pricing as $period => $price) {
                if (in_array($period, ['monthly', 'annually', 'biennially', 'triennially']) && $price > 0) {
                  $selected = ($period === 'annually') ? 'selected' : ''; // Varsayılan olarak yıllık seçili
                  echo '<option value="' . $period . '" data-period="' . $price . '" ' . $selected . '>' . $periods[$period] . ' - (' . $pricing['prefix'] . $price . $pricing['suffix'] . ')</option>' . PHP_EOL;
                }
              }
            }
            ?>
          </select>
          </try>
        </div>
        <div class="col-sm-2">
          <form action="" method="post">
            <input type="hidden" name="delete" value="<?php echo $item['productId']; ?>">
            <button style="width:100%;" type="submit" class="btn btn-warning"><i class="fa-solid fa-trash"></i> Kaldır</button>
          </form>
        </div>
      </div>
      <div style="display:none;">
        <span id="original-price-<?php echo $item['productId']; ?>" class="original-price">0.60</span>
        <span id="discounted-price-<?php echo $item['productId']; ?>" class="discounted-price">0.50 (%20 indirim)</span>
      </div>
  </div>
<?php endif; ?>
