@extends(templates/layout_normal)

@section(main)
    <h2><?= isset($community) ? $community->getName() . ' - Edit' : 'New community' ?></h2>
    <div class="box">
        <?php
        $formAction = isset($community) ?
            Container::$routeCollection->getRoute('community-edit-action')->generateLink(['communityId' => $community->getId()]) :
            Container::$routeCollection->getRoute('community-new-action')->generateLink();
        ?>
        <form id="communityForm" action="<?= $formAction ?>" method="post" data-redirect-on-success="true">
            <input type="text" class="text big fullWidth" name="name" placeholder="Name" value="<?= isset($community) ? $community->getName() : '' ?>" required>
            <input type="text" class="text big fullWidth marginTop" name="currency" value="<?= isset($community) ? $community->getCurrency() : '' ?>" placeholder="Default currency" maxlength="3" required>
            <p id="accountFormError" class="formError justify marginTop"></p>
            <div class="right marginTop">
                <button type="submit" name="submit"><?= isset($community) ? 'Save' : 'Create' ?></button>
            </div>
        </form>
    </div>
@endsection