
<?php $__env->startSection('content'); ?>
<div class="container-fluid py-3">

  <style>
    .card-edge{ border:1px solid #e6e8ef; border-radius:16px; background:#fff; box-shadow:0 4px 18px rgba(17,24,39,.06) }
    .section-title{ font-size:.95rem; font-weight:700; color:#334155 }
    .flag-preview{ height:56px; width:56px; border-radius:50%; object-fit:contain; border:1px solid #e5e7eb; background:#fff; padding:6px }
    @media (max-width:576px){ .btn-wide{ width:100% } }
  </style>

  <div class="d-flex align-items-center gap-2 mb-3">
    <a href="<?php echo e(url('/admin/exchange-countries')); ?>" class="btn btn-light border"><i class="fa-solid fa-arrow-left"></i></a>
    <h5 class="mb-0"><i class="fa-solid fa-plus me-2"></i>Create Country</h5>
  </div>

  <form action="<?php echo e(url('/admin/exchange-countries')); ?>" method="POST" enctype="multipart/form-data" class="card-edge p-3">
    <?php echo csrf_field(); ?>

    <?php if($errors->any()): ?>
      <div class="alert alert-danger"><ul class="mb-0"><?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $e): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><li><?php echo e($e); ?></li><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></ul></div>
    <?php endif; ?>

    <div class="row g-3">
      <div class="col-md-4">
        <label class="form-label">Name *</label>
        <input name="name" class="form-control" value="<?php echo e(old('name')); ?>" required>
      </div>
      <div class="col-md-4">
        <label class="form-label">Slug (optional)</label>
        <input name="slug" class="form-control" value="<?php echo e(old('slug')); ?>" placeholder="auto from name if empty">
      </div>
      <div class="col-md-4">
        <label class="form-label">Currency Name *</label>
        <input name="currency_name" class="form-control" value="<?php echo e(old('currency_name')); ?>" required>
      </div>

      <div class="col-md-3">
        <label class="form-label">Unit Label</label>
        <input name="unit_label" class="form-control" value="<?php echo e(old('unit_label','1')); ?>" placeholder="e.g. 1, 1 Rial">
      </div>
      <div class="col-md-3">
        <label class="form-label">Rate (BDT) *</label>
        <input type="number" step="0.01" name="rate_bdt" class="form-control" value="<?php echo e(old('rate_bdt',0)); ?>" required>
      </div>
      <div class="col-md-3">
        <label class="form-label">Position</label>
        <input type="number" name="position" class="form-control" value="<?php echo e(old('position',0)); ?>" min="0">
      </div>
      <div class="col-md-3">
        <label class="form-label">Active *</label>
        <select name="is_active" class="form-select">
          <option value="1" <?php if(old('is_active','1')==='1'): echo 'selected'; endif; ?>>Active</option>
          <option value="0" <?php if(old('is_active')==='0'): echo 'selected'; endif; ?>>Inactive</option>
        </select>
      </div>

      
      <div class="col-md-12">
        <label class="form-label">Upload Flag</label>
        <input type="file" id="flagFile" name="flag_file" class="form-control" accept="image/*">
        <div class="mt-2 d-none" id="previewWrap">
          <img id="flagPreview" class="flag-preview" src="#" alt="preview">
        </div>
      </div>

      <div class="col-md-4">
        <label class="form-label">Header BG (color/gradient)</label>
        <input name="header_bg" class="form-control" value="<?php echo e(old('header_bg','#4C0519')); ?>" placeholder="#4C0519">
      </div>

      <div class="col-md-4">
        <label class="form-label">Share Title (BN)</label>
        <input name="share_title_bn" class="form-control" value="<?php echo e(old('share_title_bn')); ?>">
      </div>
      <div class="col-md-4">
        <label class="form-label">Share Title (EN)</label>
        <input name="share_title_en" class="form-control" value="<?php echo e(old('share_title_en')); ?>">
      </div>

      <div class="col-md-6">
        <label class="form-label">Share Description (BN)</label>
        <textarea name="share_desc_bn" rows="3" class="form-control"><?php echo e(old('share_desc_bn')); ?></textarea>
      </div>
      <div class="col-md-6">
        <label class="form-label">Share Description (EN)</label>
        <textarea name="share_desc_en" rows="3" class="form-control"><?php echo e(old('share_desc_en')); ?></textarea>
      </div>
    </div>

    <div class="d-flex gap-2 flex-wrap mt-3">
      <button class="btn btn-primary btn-wide"><i class="fa-solid fa-floppy-disk me-1"></i> Save</button>
      <a class="btn btn-outline-secondary btn-wide" href="<?php echo e(url('/admin/exchange-countries')); ?>">Cancel</a>
    </div>
  </form>
</div>

<script>
  document.getElementById('flagFile')?.addEventListener('change', e=>{
    const f = e.target.files?.[0]; if(!f) return;
    const url = URL.createObjectURL(f);
    const img = document.getElementById('flagPreview');
    img.src = url; document.getElementById('previewWrap').classList.remove('d-none');
  });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/ecareba2/new.rkmotorsbike.top/resources/views/backend/exchange_countries/create.blade.php ENDPATH**/ ?>