<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $form PortalPeople\gforce\models\RateUploadForm */

$this->title = 'Import GForce Rate Sheet';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="gforce-rate-upload">

    <div class="card mb-3">
        <div class="card-header">
            <h4 class="mb-0">Import GForce Rate Sheet</h4>
        </div>
        <div class="card-body">

            <p class="text-muted mb-3">
                Upload a GForce pricing spreadsheet (<code>.xlsx</code> / <code>.xls</code>).
                Each row will be imported as an individual postcode Shippingcosts record — no consolidation is applied.
            </p>

            <div class="alert alert-info">
                <strong>Expected column layout:</strong>
                <code>Provider | ERPID | Service | PostCode | [Concat] | Micro | Mini QP | Qtr | &hellip; price columns</code>
                <ul class="mb-0 mt-1 small">
                    <li>The header row is detected automatically.</li>
                    <li>Price cells containing <em>N/A</em> or blank are skipped.</li>
                    <li>PostCode ranges (e.g. <code>AB1-5</code>) are expanded to individual postcodes.</li>
                </ul>
            </div>

            <?php $activeForm = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>

                <?= $activeForm->field($form, 'priceFile')->fileInput(['accept' => '.xlsx,.xls']) ?>

                <div class="mt-3">
                    <?= Html::submitButton('Upload &amp; Import', ['class' => 'btn btn-primary']) ?>
                </div>

            <?php ActiveForm::end() ?>

        </div>
    </div>

</div>
