<?php
/**
 * Branding Material Upload Form — Gmind Institute ERP
 * Upload form for branding materials (banner, logo, brochure, standee, other)
 */
$bp = defined('BASE_PATH') ? BASE_PATH : '/gmind';
?>
<div class="admin-page-header" style="display:flex;justify-content:space-between;align-items:center;margin-bottom:24px;">
    <h1 style="margin:0;font-size:22px;font-weight:700;">Upload Branding Material</h1>
    <a href="<?= $bp ?>/admin/branch-branding" class="admin-btn admin-btn-secondary">← Back to Materials</a>
</div>

<div class="admin-form-container" style="max-width:600px;">
    <form method="POST" action="<?= $bp ?>/admin/branch-branding/store" class="admin-form" enctype="multipart/form-data">
        <input type="hidden" name="csrf_token" value="<?= htmlspecialchars($csrfToken, ENT_QUOTES, 'UTF-8') ?>">

        <div class="admin-form-group" style="margin-bottom:16px;">
            <label for="branch_id" class="admin-form-label" style="display:block;margin-bottom:4px;font-weight:600;">Branch <span style="color:#c62828;">*</span></label>
            <select id="branch_id" name="branch_id" class="admin-form-control" style="width:100%;padding:8px 12px;border:1px solid #ccc;border-radius:6px;" required>
                <option value="">— Select Branch —</option>
                <?php if (!empty($branches)): ?>
                    <?php foreach ($branches as $br): ?>
                        <option value="<?= (int)$br['id'] ?>">
                            <?= htmlspecialchars($br['name'], ENT_QUOTES, 'UTF-8') ?>
                            <?php if (!empty($br['city'])): ?> (<?= htmlspecialchars($br['city'], ENT_QUOTES, 'UTF-8') ?>)<?php endif; ?>
                        </option>
                    <?php endforeach; ?>
                <?php endif; ?>
            </select>
        </div>

        <div class="admin-form-group" style="margin-bottom:16px;">
            <label for="material_type" class="admin-form-label" style="display:block;margin-bottom:4px;font-weight:600;">Material Type <span style="color:#c62828;">*</span></label>
            <select id="material_type" name="material_type" class="admin-form-control" style="width:100%;padding:8px 12px;border:1px solid #ccc;border-radius:6px;" required>
                <option value="">— Select Type —</option>
                <option value="banner">Banner</option>
                <option value="logo">Logo</option>
                <option value="brochure">Brochure</option>
                <option value="standee">Standee</option>
                <option value="other">Other</option>
            </select>
        </div>

        <div class="admin-form-group" style="margin-bottom:16px;">
            <label for="file" class="admin-form-label" style="display:block;margin-bottom:4px;font-weight:600;">File <span style="color:#c62828;">*</span></label>
            <input type="file" id="file" name="file" class="admin-form-control" style="width:100%;padding:8px 12px;border:1px solid #ccc;border-radius:6px;" required accept="image/*,.pdf,.doc,.docx">
            <p style="margin:4px 0 0;font-size:12px;color:#999;">Accepted: Images (JPG, PNG, GIF, SVG), PDF, DOC, DOCX</p>
        </div>

        <div style="display:flex;gap:12px;margin-top:24px;">
            <button type="submit" class="admin-btn admin-btn-primary">Upload Material</button>
            <a href="<?= $bp ?>/admin/branch-branding" class="admin-btn admin-btn-secondary">Cancel</a>
        </div>
    </form>
</div>
