Files
claude-plugins/perfex-dev/skills/perfex-forms/references/formulario-completo-exemplo.md
Emanuel Almeida 6b3a6f2698 feat: refactor 30+ skills to Anthropic progressive disclosure pattern
- All SKILL.md files now <500 lines (avg reduction 69%)
- Detailed content extracted to references/ subdirectories
- Frontmatter standardised: only name + description (Anthropic standard)
- New skills: brand-guidelines, spec-coauthor, report-templates, skill-creator
- Design skills: anti-slop guidelines, premium-proposals reference
- Removed non-standard frontmatter fields (triggers, version, author, category)

Plugins affected: infraestrutura, marketing, dev-tools, crm-ops, gestao,
core-tools, negocio, perfex-dev, wordpress, design-media

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 15:05:03 +00:00

6.1 KiB

Formulario Completo Exemplo - Perfex CRM

Exemplo completo de view com formulario, validacao client-side e todos os elementos tipicos.


View

<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<?php init_head(); ?>

<div id="wrapper">
    <div class="content">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel_s">
                    <div class="panel-body">

                        <h4 class="no-margin">
                            <?php echo isset($item) ? _l('edit') : _l('create'); ?>
                            <?php echo _l('meu_modulo_item'); ?>
                        </h4>
                        <hr class="hr-panel-heading" />

                        <?php
                        $action = isset($item)
                            ? admin_url('meu_modulo/save/' . $item->id)
                            : admin_url('meu_modulo/save');
                        echo form_open($action, ['id' => 'form-meu-modulo']);
                        ?>

                            <!-- Nome -->
                            <div class="form-group">
                                <label for="name" class="control-label">
                                    <?php echo _l('name'); ?>
                                    <span class="text-danger">*</span>
                                </label>
                                <input type="text" id="name" name="name"
                                       class="form-control"
                                       value="<?php echo isset($item) ? html_escape($item->name) : ''; ?>">
                            </div>

                            <!-- Cliente -->
                            <div class="form-group">
                                <label for="client_id" class="control-label">
                                    <?php echo _l('client'); ?>
                                </label>
                                <select id="client_id" name="client_id"
                                        class="selectpicker"
                                        data-live-search="true"
                                        data-width="100%">
                                    <option value=""><?php echo _l('select'); ?></option>
                                    <?php foreach ($clients as $client): ?>
                                        <option value="<?php echo $client['userid']; ?>"
                                            <?php echo (isset($item) && $item->client_id == $client['userid']) ? 'selected' : ''; ?>>
                                            <?php echo html_escape($client['company']); ?>
                                        </option>
                                    <?php endforeach; ?>
                                </select>
                            </div>

                            <!-- Valor -->
                            <div class="form-group">
                                <label for="amount" class="control-label">
                                    <?php echo _l('amount'); ?>
                                </label>
                                <input type="number" id="amount" name="amount"
                                       class="form-control" step="0.01" min="0"
                                       value="<?php echo isset($item) ? $item->amount : '0.00'; ?>">
                            </div>

                            <!-- Data -->
                            <div class="form-group">
                                <label for="date" class="control-label">
                                    <?php echo _l('date'); ?>
                                </label>
                                <input type="text" id="date" name="date"
                                       class="form-control datepicker"
                                       value="<?php echo isset($item) ? _d($item->date) : _d(date('Y-m-d')); ?>"
                                       autocomplete="off">
                            </div>

                            <!-- Descricao -->
                            <div class="form-group">
                                <label for="description" class="control-label">
                                    <?php echo _l('description'); ?>
                                </label>
                                <textarea id="description" name="description"
                                          class="form-control"
                                          rows="4"><?php echo isset($item) ? html_escape($item->description) : ''; ?></textarea>
                            </div>

                            <!-- Activo -->
                            <div class="checkbox checkbox-primary">
                                <input type="checkbox" id="is_active" name="is_active" value="1"
                                       <?php echo (!isset($item) || $item->is_active == 1) ? 'checked' : ''; ?>>
                                <label for="is_active"><?php echo _l('active'); ?></label>
                            </div>

                            <!-- Botoes -->
                            <div class="btn-bottom-toolbar text-right">
                                <button type="submit" class="btn btn-primary">
                                    <?php echo _l('save'); ?>
                                </button>
                                <a href="<?php echo admin_url('meu_modulo'); ?>" class="btn btn-default">
                                    <?php echo _l('cancel'); ?>
                                </a>
                            </div>

                        <?php echo form_close(); ?>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php init_tail(); ?>
<script>
$(function(){
    // Validacao
    appValidateForm($('#form-meu-modulo'), {
        name: {
            required: true,
            minlength: 3
        },
        amount: {
            number: true,
            min: 0
        }
    });

    // Inicializar datepicker (ja auto via classe)
    // Inicializar selectpicker (ja auto via classe)
});
</script>
</body>
</html>