<?php
/** @var array $p */
/** @var string $slug */
/** @var string $err */
use Core\Theme;
?>
<section class="page-hero">
    <div class="container"><h1>立即下单</h1><p><?php echo e($p['name']); ?></p></div>
</section>
<div class="container">
    <nav class="breadcrumb"><a href="<?php echo site_url(); ?>">首页</a> / <a href="<?php echo site_url('products'); ?>">产品中心</a> / <?php echo e($p['name']); ?></nav>
    <div class="form-card">
        <?php if ($err): ?><div class="alert alert-err"><?php echo e($err); ?></div><?php endif; ?>
        <div style="display:flex;gap:14px;align-items:center;margin-bottom:6px">
            <div style="width:60px;height:60px;border-radius:14px;display:grid;place-items:center;color:#fff;font-size:24px;background:<?php echo gradient($p['id']); ?>">❄</div>
            <div>
                <div style="font-weight:800;font-size:17px"><?php echo e($p['name']); ?></div>
                <div style="color:var(--c-muted)">单价 ¥<?php echo e($p['price']); ?> / 套</div>
            </div>
        </div>
        <form method="post" action="<?php echo site_url('order/store'); ?>" style="margin-top:20px">
            <?php echo csrf_field(); ?>
            <input type="hidden" name="slug" value="<?php echo e($slug); ?>">
            <div class="field"><label>姓名 / 单位 *</label><input name="name" required placeholder="如：张三 / 某某公司"></div>
            <div class="field"><label>手机号 *</label><input name="phone" required placeholder="用于订单查询与发货联系"></div>
            <div class="field"><label>邮箱（选填）</label><input name="email" placeholder="可留空"></div>
            <div class="field"><label>数量（套）</label><input name="qty" type="number" min="1" value="1"></div>
            <div class="form-actions">
                <button class="btn btn-primary magnetic" type="submit">提交订单并支付</button>
                <a class="btn btn-ghost" href="<?php echo site_url('products/' . $slug); ?>">返回</a>
            </div>
        </form>
    </div>
</div>
