<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3><?= __('Edit condition') ?></h3>
</div>

<form data-ajax action="<?= admin_url_to('/configs/reset/conditions/edit/' . $index) ?>" method="post">
    <?= csrf_field() ?>

    <div class="modal-body">
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label" for="starts"><?= __('Resets starts') ?> <span class="required">*</span></label>
                    <input type="text" value="<?= $condition['starts'] ?>" name="starts" class="form-control" id="starts" />
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label" for="ends"><?= __('Resets ends') ?> <span class="required">*</span></label>
                    <input type="text" value="<?= $condition['ends'] ?>" name="ends" class="form-control" id="ends" />
                </div>
            </div>
        </div>

        <div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
                <?php $i = 0; foreach (config('vip.types', []) as $code => $name): ?>
                    <li class="<?= $i++ == 0 ? 'active' : '' ?>"><a href="#vip-<?= $code ?>" data-toggle="tab"><?= $name ?></a></li>
                <?php endforeach ?>
            </ul>
            <div class="tab-content" style="padding:10px 0 0 0">
                <?php $i = 0; foreach (config('vip.types', []) as $code => $name): ?>
                    <div class="tab-pane<?= $i++ == 0 ? ' active' : '' ?>" id="vip-<?= $code ?>">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label" for="level-<?= $code ?>"><?= __('Level to reset') ?></label>
                                    <input type="text" value="<?= $condition['level_required'][$code] ?? '' ?>" name="level_required[<?= $code ?>]" class="form-control" id="level-<?= $code ?>" />
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label" for="level-after-<?= $code ?>"><?= __('Level after') ?></label>
                                    <input type="text" value="<?= $condition['level_after'][$code] ?? '' ?>" name="level_after[<?= $code ?>]" class="form-control" id="level-after-<?= $code ?>" />
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label" for="zen-<?= $code ?>"><?= __('Zen required') ?></label>
                                    <input type="text" value="<?= $condition['zen_required'][$code] ?? '' ?>" name="zen_required[<?= $code ?>]" class="form-control" id="zen-<?= $code ?>" />
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label" for="points-<?= $code ?>"><?= __('Points') ?></label>
                                    <input type="text" value="<?= $condition['points'][$code] ?? '' ?>" name="points[<?= $code ?>]" class="form-control" id="points-<?= $code ?>" />
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="clear-magics-<?= $code ?>"><?= __('Clear magics') ?></label>
                                    <div>
                                        <input class="form-control toggle"<?= $condition['clear_magics'][$code] ?? false ? ' checked' : '' ?> type="checkbox" id="clear-magics-<?= $code ?>" value="1" name="clear_magics[<?= $code ?>]" />
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="clear-items-<?= $code ?>"><?= __('Clear items') ?></label>
                                    <div>
                                        <input class="form-control toggle"<?= $condition['clear_items'][$code] ?? false ? ' checked' : '' ?> type="checkbox" id="clear-items-<?= $code ?>" value="1" name="clear_items[<?= $code ?>]" />
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="clear-quests-<?= $code ?>"><?= __('Clear quests') ?></label>
                                    <div>
                                        <input class="form-control toggle"<?= $condition['clear_quests'][$code] ?? false ? ' checked' : '' ?> type="checkbox" id="clear-quests-<?= $code ?>" value="1" name="clear_quests[<?= $code ?>]" />
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label for="clear-master-level-<?= $code ?>"><?= __('Clear master level') ?></label>
                                    <div>
                                        <input class="form-control toggle"<?= $condition['clear_master_level'][$code] ?? false ? ' checked' : '' ?> type="checkbox" id="clear-master-level-<?= $code ?>" value="1" name="clear_master_level[<?= $code ?>]" />
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="sql-additional-<?= $code ?>"><?= __('SQL additional') ?></label>
                            <div>
                                <textarea class="form-control" id="sql-additional-<?= $code ?>" name="sql_additional[<?= $code ?>]"><?= $condition['sql_additional'][$code] ?? '' ?></textarea>
                            </div>
                        </div>
                    </div>
                <?php endforeach ?>
            </div>
        </div>
    </div>

    <div class="modal-footer" style="margin-top:0">
        <input type="submit" class="btn btn-primary" value="<?= __('Save') ?>" />
    </div>
</form>