<?php $__env->startSection('shell_class', 'auth-wide'); ?>

<?php $__env->startSection('content'); ?>
<?php
    $title = 'Create account';
    $isCampus = $plan?->code === 'campus';
?>
<h1><?php echo e($isCampus ? 'Apply for Campus Plan' : 'Create your account'); ?></h1>
<p class="lead">
    <?php if($isCampus): ?>
        Submit a complete sponsorship application with your letter. You cannot sign in to My MeXCo until a Super Admin approves it.
    <?php else: ?>
        One organisation account. Each event keeps its own plan and license.
    <?php endif; ?>
</p>

<?php if($plan): ?>
    <div class="plan-note">
        <span>Selected plan</span>
        <strong><?php echo e($plan->name); ?></strong>
        <?php if($plan->code === 'demo'): ?>
            <span>· Free limited trial</span>
        <?php elseif($plan->code === 'campus'): ?>
            <span>· Sponsored · RM0 · Approval required</span>
        <?php elseif(!$plan->is_custom_pricing && $plan->price_cents > 0): ?>
            <span>· <?php echo e($plan->formattedPrice()); ?> / event</span>
        <?php endif; ?>
    </div>
<?php endif; ?>

<?php if(session('error')): ?>
    <div class="alert-flash alert-danger"><?php echo e(session('error')); ?></div>
<?php endif; ?>

<form method="POST" action="<?php echo e(route('mexco.register.submit')); ?>" <?php if($isCampus): ?> enctype="multipart/form-data" <?php endif; ?>>
    <?php echo csrf_field(); ?>
    <?php if($plan): ?>
        <input type="hidden" name="plan" value="<?php echo e($plan->code); ?>">
    <?php endif; ?>

    <div class="field">
        <label class="form-label" for="name">Your name</label>
        <input class="form-input" type="text" name="name" id="name" value="<?php echo e(old('name')); ?>" required autocomplete="name" placeholder="Full name">
        <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
    </div>

    <div class="row-2">
        <div class="field">
            <label class="form-label" for="email">Email</label>
            <input class="form-input" type="email" name="email" id="email" value="<?php echo e(old('email')); ?>" required autocomplete="email" placeholder="you@organisation.com">
            <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="field">
            <label class="form-label" for="phone">Phone <?php if(!$isCampus): ?><span style="font-weight:500;color:var(--muted)">(optional)</span><?php endif; ?></label>
            <input class="form-input" type="text" name="phone" id="phone" value="<?php echo e(old('phone')); ?>" <?php if($isCampus): ?> required <?php endif; ?> autocomplete="tel" placeholder="+60…">
            <?php $__errorArgs = ['phone'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
    </div>

    <div class="row-2">
        <div class="field">
            <label class="form-label" for="password">Password</label>
            <input class="form-input" type="password" name="password" id="password" required minlength="8" autocomplete="new-password" placeholder="Min. 8 characters">
            <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="field">
            <label class="form-label" for="password_confirmation">Confirm password</label>
            <input class="form-input" type="password" name="password_confirmation" id="password_confirmation" required autocomplete="new-password" placeholder="Repeat password">
        </div>
    </div>

    <div class="row-2">
        <div class="field">
            <label class="form-label" for="organisation_name"><?php echo e($isCampus ? 'Institution / organisation' : 'Organisation name'); ?></label>
            <input class="form-input" type="text" name="organisation_name" id="organisation_name" value="<?php echo e(old('organisation_name')); ?>" required autocomplete="organization" placeholder="University / company">
            <?php $__errorArgs = ['organisation_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="field">
            <label class="form-label" for="organisation_type">Organisation type</label>
            <select class="form-select" name="organisation_type" id="organisation_type" required>
                <?php $__currentLoopData = $orgTypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($value); ?>" <?php if(old('organisation_type', 'university') === $value): echo 'selected'; endif; ?>><?php echo e($label); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <?php $__errorArgs = ['organisation_type'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
    </div>

    <?php if($isCampus): ?>
        <div class="row-2">
            <div class="field">
                <label class="form-label" for="faculty">Faculty</label>
                <input class="form-input" type="text" name="faculty" id="faculty" value="<?php echo e(old('faculty')); ?>" required>
                <?php $__errorArgs = ['faculty'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>
            <div class="field">
                <label class="form-label" for="student_organisation">Student organisation</label>
                <input class="form-input" type="text" name="student_organisation" id="student_organisation" value="<?php echo e(old('student_organisation')); ?>" required>
                <?php $__errorArgs = ['student_organisation'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>
        </div>

        <div class="field">
            <label class="form-label" for="event_name">Event name</label>
            <input class="form-input" type="text" name="event_name" id="event_name" value="<?php echo e(old('event_name')); ?>" required placeholder="e.g. Student Innovation Day 2026">
            <?php $__errorArgs = ['event_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>

        <div class="row-2">
            <div class="field">
                <label class="form-label" for="event_date">Event date</label>
                <input class="form-input" type="date" name="event_date" id="event_date" value="<?php echo e(old('event_date')); ?>" required>
                <?php $__errorArgs = ['event_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>
            <div class="field">
                <label class="form-label" for="expected_participants">Expected participants</label>
                <input class="form-input" type="number" name="expected_participants" id="expected_participants" value="<?php echo e(old('expected_participants')); ?>" min="1" required>
                <?php $__errorArgs = ['expected_participants'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>
        </div>

        <div class="row-2">
            <div class="field">
                <label class="form-label" for="sessions_count">Sessions count</label>
                <input class="form-input" type="number" name="sessions_count" id="sessions_count" value="<?php echo e(old('sessions_count')); ?>" min="0" required>
                <?php $__errorArgs = ['sessions_count'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>
            <div class="field">
                <label class="form-label" for="booths_count">Booths count</label>
                <input class="form-input" type="number" name="booths_count" id="booths_count" value="<?php echo e(old('booths_count')); ?>" min="0" required>
                <?php $__errorArgs = ['booths_count'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>
        </div>

        <div class="field">
            <label class="form-label" for="event_objective">Event objective</label>
            <textarea class="form-input" name="event_objective" id="event_objective" rows="3" required placeholder="Describe the programme objectives"><?php echo e(old('event_objective')); ?></textarea>
            <?php $__errorArgs = ['event_objective'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>

        <div class="field">
            <label class="form-label" for="promotional_exposure">Promotional exposure</label>
            <textarea class="form-input" name="promotional_exposure" id="promotional_exposure" rows="3" required placeholder="How will MeXCo be promoted at your event?"><?php echo e(old('promotional_exposure')); ?></textarea>
            <?php $__errorArgs = ['promotional_exposure'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>

        <div class="field">
            <label class="form-label" for="sponsorship_letter">Sponsorship letter</label>
            <input class="form-input" type="file" name="sponsorship_letter" id="sponsorship_letter" required accept=".pdf,.doc,.docx,.jpg,.jpeg,.png">
            <div style="margin-top:.35rem;font-size:.78rem;color:var(--muted)">PDF, Word, or image · max 10 MB</div>
            <?php $__errorArgs = ['sponsorship_letter'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="form-error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
    <?php endif; ?>

    <button type="submit" class="btn-purple auth-submit">
        <?php if($plan?->code === 'demo'): ?>
            Create account &amp; start demo
        <?php elseif($isCampus): ?>
            Submit application
        <?php else: ?>
            Create account
        <?php endif; ?>
    </button>
</form>

<p class="foot">
    Already approved? <a href="<?php echo e(route('mexco.login')); ?>">Sign in</a>
</p>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('after_card'); ?>
    <a href="<?php echo e(route('mexco.home')); ?>" class="auth-home">← Back to website</a>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('portal.auth.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\myapp\resources\views/portal/auth/register.blade.php ENDPATH**/ ?>