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>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "perfex-dev",
|
||||
"description": "Perfex CRM module development - controllers, views, forms, hooks, menus, migrations, permissions, security and database. Backed by 1 Dify KB dataset.",
|
||||
"description": "Perfex CRM module development - controllers, views, forms, hooks, menus, migrations, permissions, security and database. Backed by NotebookLM notebooks.",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Descomplicar - Crescimento Digital",
|
||||
|
||||
@@ -15,7 +15,6 @@ primary_mcps:
|
||||
- gitea
|
||||
recommended_mcps:
|
||||
- context7
|
||||
- dify-kb
|
||||
- filesystem
|
||||
skills:
|
||||
- _core
|
||||
@@ -49,8 +48,6 @@ created: '2025-01-13'
|
||||
updated: '2026-02-04'
|
||||
author: Descomplicar®
|
||||
---
|
||||
|
||||
|
||||
# Perfex CRM Module Developer Descomplicar
|
||||
|
||||
Especialista em desenvolvimento de modulos customizados, automacao de workflows e criacao de integracoes para sistemas Perfex CRM.
|
||||
@@ -71,13 +68,6 @@ mcp__notebooklm__notebook_query notebook_id:"df4688bb-c2c0-4aba-98c1-38c3b50a353
|
||||
mcp__notebooklm__notebook_query notebook_id:"24947ffa-0019-448a-a340-2f4a275d2eb1" query:"PHP MVC CRM development"
|
||||
```
|
||||
|
||||
### Dify KB (Secundario - se NotebookLM insuficiente)
|
||||
|
||||
```
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"PerfexCRM" query:"module development hooks customization"
|
||||
mcp__dify-kb__dify_kb_retrieve_segments dataset:"Desenvolvimento de Software" query:"PHP MVC CRM development"
|
||||
```
|
||||
|
||||
## System Prompt
|
||||
|
||||
### Papel
|
||||
@@ -143,7 +133,7 @@ Especialista em desenvolvimento de modulos customizados, automacao de workflows
|
||||
|
||||
## MCPs Relevantes
|
||||
- `desk-crm-v3`: Acesso directo à BD Perfex para testes
|
||||
- `notebooklm`: KB primaria (Gemini 2.5 RAG) | `dify-kb`: KB PerfexCRM, Desenvolvimento Software
|
||||
- `notebooklm`: KB primaria (Gemini 2.5 RAG) | ``: KB PerfexCRM, Desenvolvimento Software
|
||||
- `ssh-unified`: Deploy de módulos em servidores
|
||||
- `gitea`: Versionamento de código
|
||||
|
||||
@@ -167,9 +157,9 @@ Especialista em desenvolvimento de modulos customizados, automacao de workflows
|
||||
- Usage: `mcp__ssh-unified__*`
|
||||
|
||||
✓ **notebooklm** (knowledge primaria)
|
||||
✓ **dify-kb** (knowledge fallback)
|
||||
✓ **** (knowledge fallback)
|
||||
- Knowledge base AI
|
||||
- Usage: `mcp__dify-kb__*`
|
||||
- Usage: `mcp____*`
|
||||
|
||||
### Recommended for dev
|
||||
- **context7** - Context documentation
|
||||
@@ -180,13 +170,11 @@ Especialista em desenvolvimento de modulos customizados, automacao de workflows
|
||||
- **cwp** - CentOS Web Panel
|
||||
- **puppeteer** - Browser automation
|
||||
|
||||
### All Available (33 total)
|
||||
### All Available (32 total)
|
||||
moloni, google-analytics, google-workspace, imap, outline-api, youtube-research, youtube-uploader, wikijs, gsc, lighthouse, mcp-time, mcp-mermaid, mcp-echarts, powerpoint, penpot, pixabay, pexels, tavily, elevenlabs, vimeo, design-systems, replicate
|
||||
|
||||
**Discovery:** Use ToolSearch to find specific tools.
|
||||
**Example:** `ToolSearch("ssh upload")` finds SSH upload tools.
|
||||
|
||||
|
||||
## Your Available Skills
|
||||
|
||||
### Primary Skills (Your Domain)
|
||||
@@ -220,13 +208,11 @@ moloni, google-analytics, google-workspace, imap, outline-api, youtube-research,
|
||||
- **/knowledge** - Gestão unificada de conhecimento - pesquisa inteligente com
|
||||
- **/desk** - Integração com Desk CRM via ficheiro .desk-project. Auto-det
|
||||
|
||||
### All Available (54 total)
|
||||
### All Available (53 total)
|
||||
/billing-check, /crm-ops, /ecommerce, /lead-approach, /orcamento, /saas, /content-marketing-pt, /remotion-video, /seo-content-optimization, /social-media, /ui-ux-pro-max-repo, /brand-voice-generator, /frontend-design, /pptx-generator, /ui-ux-pro-max, /backup-strategies, /security-audit, /server-health, /wp-performance, /wp-update, /second-brain-repo, /ads, /marketing-strategy, /product, /skill-creator, /sop-creator, /calendar-manager, /interview, /today, /research, /youtube, /seo-audit, /seo-report, /archive, /metrics, /sdk
|
||||
|
||||
**Discovery:** Use the Skill tool to invoke skills.
|
||||
**Example:** `Skill("skill-name")` invokes the skill.
|
||||
|
||||
|
||||
## Your Team & Responsibilities
|
||||
|
||||
You are part of **3 SDKs** (TaskForce teams):
|
||||
@@ -236,9 +222,6 @@ You are part of **3 SDKs** (TaskForce teams):
|
||||
**Purpose:** NULL
|
||||
|
||||
**Your responsibilities in this TaskForce:**
|
||||
|
||||
- **Sistema de agentes especializados para delegacao de tarefas via Task tool com consulta automatica de datasets Dify.**: NULL
|
||||
|
||||
### TaskForce DeskDev
|
||||
|
||||
**Purpose:** NULL
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"description": "Knowledge sources (NotebookLM + Dify KB) for Perfex CRM Development domain",
|
||||
"description": "Knowledge sources for Perfex CRM Development domain",
|
||||
"sources": {
|
||||
"notebooklm": {
|
||||
"description": "NotebookLM - conhecimento curado profundo via Gemini 2.5 RAG (PRIMARIO)",
|
||||
@@ -10,23 +10,9 @@
|
||||
"title": "Perfex CRM: Gestao de Clientes e Projetos",
|
||||
"topics": [
|
||||
"perfexcrm"
|
||||
],
|
||||
"maps_from_dify": "PerfexCRM"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dify_kb": {
|
||||
"description": "Dify KB - datasets tematicos (FALLBACK)",
|
||||
"query_tool": "mcp__dify-kb__dify_kb_retrieve_segments",
|
||||
"datasets": [
|
||||
{
|
||||
"id": "43354eb6-f0b2-40cc-aa53-44e375ab347c",
|
||||
"name": "PerfexCRM",
|
||||
"priority": 1,
|
||||
"document_count": 144,
|
||||
"word_count": 1547186
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-controllers
|
||||
description: Perfex CRM module controllers. AdminController, ClientsController, routing, ValidatesContact trait. Based on official documentation only. Use when user mentions "perfex controller", "AdminController", "ClientsController", "routing perfex".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Controllers para módulos Perfex CRM — AdminController, ClientsController, routing e trait ValidatesContact. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-controllers - Controllers Perfex CRM
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-database
|
||||
description: Perfex CRM database operations. db_prefix(), options, queries, Active Record. Based on official documentation only. Use when user mentions "perfex database", "db_prefix", "query perfex", "options perfex".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Operações de base de dados em módulos Perfex CRM — db_prefix(), options, queries e Active Record. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-database - Base de Dados Perfex CRM
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
---
|
||||
name: perfex-forms
|
||||
description: Perfex CRM forms handling. form_open(), CSRF tokens, validation, AJAX. Based on official documentation only. Use when user mentions "perfex form", "form_open", "csrf token", "validation perfex".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Gestao de formularios em modulos Perfex CRM -- form_open(), tokens CSRF, validacao e AJAX. Baseado apenas na documentacao oficial.
|
||||
---
|
||||
|
||||
# /perfex-forms - Formulários Perfex CRM
|
||||
# /perfex-forms - Formularios Perfex CRM
|
||||
|
||||
Gestão de formulários em módulos. **Zero assumptions, zero hallucinations** - apenas documentação oficial.
|
||||
Gestao de formularios em modulos. **Zero assumptions, zero hallucinations** - apenas documentacao oficial.
|
||||
|
||||
---
|
||||
|
||||
## Documentação Base
|
||||
## Documentacao Base
|
||||
|
||||
- [Working With Forms](https://help.perfexcrm.com/working-with-forms/)
|
||||
- [CodeIgniter Form Helper](https://codeigniter.com/userguide3/helpers/form_helper.html)
|
||||
@@ -31,19 +26,14 @@ Gestão de formulários em módulos. **Zero assumptions, zero hallucinations** -
|
||||
<?php echo form_close(); ?>
|
||||
```
|
||||
|
||||
**NUNCA usar `<form>` HTML directo:**
|
||||
|
||||
```html
|
||||
<!-- ERRADO - Sem CSRF protection -->
|
||||
<form action="..." method="post">
|
||||
```
|
||||
**NUNCA usar `<form>` HTML directo** - sem CSRF protection.
|
||||
|
||||
---
|
||||
|
||||
## Sintaxe form_open()
|
||||
|
||||
```php
|
||||
// Básico
|
||||
// Basico
|
||||
echo form_open(admin_url('meu_modulo/save'));
|
||||
|
||||
// Com atributos
|
||||
@@ -57,171 +47,33 @@ echo form_open_multipart(admin_url('meu_modulo/upload'), [
|
||||
'id' => 'form-upload',
|
||||
]);
|
||||
|
||||
// Fechar formulário
|
||||
// Fechar formulario
|
||||
echo form_close();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Elementos de Formulário
|
||||
## Elementos de Formulario
|
||||
|
||||
### Input Text
|
||||
Todos os elementos com exemplos completos em: `references/elementos-formulario.md`
|
||||
|
||||
Elementos disponiveis: Input Text, Textarea, Select, Select AJAX, Checkbox, Radio, Date Picker, DateTime Picker, File Upload, Hidden.
|
||||
|
||||
**Padrao geral:**
|
||||
```php
|
||||
<div class="form-group">
|
||||
<label for="name" class="control-label">
|
||||
<?php echo _l('name'); ?>
|
||||
<span class="text-danger">*</span>
|
||||
<label for="CAMPO" class="control-label">
|
||||
<?php echo _l('CAMPO'); ?>
|
||||
<span class="text-danger">*</span> <!-- se obrigatorio -->
|
||||
</label>
|
||||
<input type="text"
|
||||
id="name"
|
||||
name="name"
|
||||
class="form-control"
|
||||
value="<?php echo isset($item) ? html_escape($item->name) : ''; ?>"
|
||||
required>
|
||||
<input type="text" id="CAMPO" name="CAMPO" class="form-control"
|
||||
value="<?php echo isset($item) ? html_escape($item->CAMPO) : ''; ?>">
|
||||
</div>
|
||||
```
|
||||
|
||||
### Textarea
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
### Select
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
### Select com AJAX (Clientes)
|
||||
|
||||
```php
|
||||
<div class="form-group">
|
||||
<label for="clientid" class="control-label">
|
||||
<?php echo _l('client'); ?>
|
||||
</label>
|
||||
<select id="clientid" name="clientid" data-live-search="true"
|
||||
data-width="100%" class="ajax-search"
|
||||
data-none-selected-text="<?php echo _l('dropdown_non_selected_tex'); ?>">
|
||||
<?php if (isset($item) && $item->clientid): ?>
|
||||
<option value="<?php echo $item->clientid; ?>" selected>
|
||||
<?php echo html_escape(get_company_name($item->clientid)); ?>
|
||||
</option>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Checkbox
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
### Radio
|
||||
|
||||
```php
|
||||
<div class="form-group">
|
||||
<label class="control-label"><?php echo _l('status'); ?></label>
|
||||
<div class="radio radio-primary">
|
||||
<input type="radio" name="status" id="status_pending" value="pending"
|
||||
<?php echo (!isset($item) || $item->status == 'pending') ? 'checked' : ''; ?>>
|
||||
<label for="status_pending"><?php echo _l('pending'); ?></label>
|
||||
</div>
|
||||
<div class="radio radio-primary">
|
||||
<input type="radio" name="status" id="status_active" value="active"
|
||||
<?php echo (isset($item) && $item->status == 'active') ? 'checked' : ''; ?>>
|
||||
<label for="status_active"><?php echo _l('active'); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Date Picker
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
### Date Time Picker
|
||||
|
||||
```php
|
||||
<div class="form-group">
|
||||
<label for="datetime" class="control-label">
|
||||
<?php echo _l('date_time'); ?>
|
||||
</label>
|
||||
<input type="text"
|
||||
id="datetime"
|
||||
name="datetime"
|
||||
class="form-control datetimepicker"
|
||||
value="<?php echo isset($item) ? _dt($item->datetime) : ''; ?>"
|
||||
autocomplete="off">
|
||||
</div>
|
||||
```
|
||||
|
||||
### File Upload
|
||||
|
||||
```php
|
||||
<?php echo form_open_multipart(admin_url('meu_modulo/upload')); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="attachment" class="control-label">
|
||||
<?php echo _l('attachment'); ?>
|
||||
</label>
|
||||
<input type="file" id="attachment" name="attachment" class="form-control">
|
||||
</div>
|
||||
|
||||
<?php echo form_close(); ?>
|
||||
```
|
||||
|
||||
### Hidden
|
||||
|
||||
```php
|
||||
<input type="hidden" name="id" value="<?php echo $item->id; ?>">
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Validação Client-Side
|
||||
## Validacao Client-Side
|
||||
|
||||
O Perfex usa jQuery Validation. Usar `appValidateForm()`:
|
||||
|
||||
@@ -250,23 +102,23 @@ $(function(){
|
||||
</html>
|
||||
```
|
||||
|
||||
### Regras de Validação
|
||||
### Regras de Validacao
|
||||
|
||||
| Regra | Descrição |
|
||||
| Regra | Descricao |
|
||||
|-------|-----------|
|
||||
| `required: true` | Campo obrigatório |
|
||||
| `email: true` | Email válido |
|
||||
| `number: true` | Número |
|
||||
| `digits: true` | Apenas dígitos |
|
||||
| `minlength: N` | Mínimo N caracteres |
|
||||
| `maxlength: N` | Máximo N caracteres |
|
||||
| `min: N` | Valor mínimo |
|
||||
| `max: N` | Valor máximo |
|
||||
| `required: true` | Campo obrigatorio |
|
||||
| `email: true` | Email valido |
|
||||
| `number: true` | Numero |
|
||||
| `digits: true` | Apenas digitos |
|
||||
| `minlength: N` | Minimo N caracteres |
|
||||
| `maxlength: N` | Maximo N caracteres |
|
||||
| `min: N` | Valor minimo |
|
||||
| `max: N` | Valor maximo |
|
||||
| `equalTo: '#field'` | Igual a outro campo |
|
||||
|
||||
---
|
||||
|
||||
## Validação Server-Side
|
||||
## Validacao Server-Side
|
||||
|
||||
```php
|
||||
public function save()
|
||||
@@ -275,7 +127,6 @@ public function save()
|
||||
redirect(admin_url('meu_modulo'));
|
||||
}
|
||||
|
||||
// Validação
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('name', _l('name'), 'required|min_length[3]');
|
||||
@@ -283,12 +134,10 @@ public function save()
|
||||
$this->form_validation->set_rules('amount', _l('amount'), 'required|numeric');
|
||||
|
||||
if ($this->form_validation->run() === false) {
|
||||
// Erro de validação
|
||||
set_alert('danger', validation_errors());
|
||||
redirect(admin_url('meu_modulo/create'));
|
||||
}
|
||||
|
||||
// Dados válidos, processar
|
||||
$data = [
|
||||
'name' => $this->input->post('name'),
|
||||
'email' => $this->input->post('email'),
|
||||
@@ -319,28 +168,6 @@ $.post(admin_url + 'meu_modulo/ajax_save', {
|
||||
});
|
||||
```
|
||||
|
||||
### Com $.ajax()
|
||||
|
||||
```javascript
|
||||
$.ajax({
|
||||
url: admin_url + 'meu_modulo/ajax_save',
|
||||
type: 'POST',
|
||||
data: $('#form-meu-modulo').serialize(),
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
alert_float('success', response.message);
|
||||
// Redirecionar ou actualizar UI
|
||||
} else {
|
||||
alert_float('danger', response.message);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
alert_float('danger', 'Erro de comunicação');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Controller AJAX
|
||||
|
||||
```php
|
||||
@@ -378,9 +205,7 @@ Para endpoints que recebem callbacks externos:
|
||||
|
||||
```php
|
||||
// modules/meu_modulo/config/csrf_exclude_uris.php
|
||||
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
return [
|
||||
@@ -392,171 +217,37 @@ return [
|
||||
|
||||
---
|
||||
|
||||
## Formulário Completo Exemplo
|
||||
|
||||
### View
|
||||
|
||||
```php
|
||||
<?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>
|
||||
|
||||
<!-- Descrição -->
|
||||
<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>
|
||||
|
||||
<!-- Botões -->
|
||||
<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(){
|
||||
// Validação
|
||||
appValidateForm($('#form-meu-modulo'), {
|
||||
name: {
|
||||
required: true,
|
||||
minlength: 3
|
||||
},
|
||||
amount: {
|
||||
number: true,
|
||||
min: 0
|
||||
}
|
||||
});
|
||||
|
||||
// Inicializar datepicker (já auto via classe)
|
||||
// Inicializar selectpicker (já auto via classe)
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Anti-Patterns (NUNCA FAZER)
|
||||
|
||||
| Anti-Pattern | Risco | Alternativa |
|
||||
|--------------|-------|-------------|
|
||||
| `<form>` HTML directo | CSRF bypass | `form_open()` |
|
||||
| Valores sem `html_escape()` | XSS | Escape sempre |
|
||||
| Validação só client-side | Bypass | Validar server também |
|
||||
| Validacao so client-side | Bypass | Validar server tambem |
|
||||
| AJAX sem verificar `is_ajax_request()` | Acesso directo | Verificar sempre |
|
||||
|
||||
---
|
||||
|
||||
## Checklist Formulários
|
||||
## Checklist Formularios
|
||||
|
||||
```
|
||||
1. [ ] form_open() para todos os formulários
|
||||
1. [ ] form_open() para todos os formularios
|
||||
2. [ ] html_escape() em todos os values
|
||||
3. [ ] Validação client-side (appValidateForm)
|
||||
4. [ ] Validação server-side (form_validation)
|
||||
5. [ ] Permissões verificadas no controller
|
||||
6. [ ] CSRF excluído apenas para webhooks
|
||||
3. [ ] Validacao client-side (appValidateForm)
|
||||
4. [ ] Validacao server-side (form_validation)
|
||||
5. [ ] Permissoes verificadas no controller
|
||||
6. [ ] CSRF excluido apenas para webhooks
|
||||
7. [ ] form_open_multipart() para uploads
|
||||
8. [ ] is_ajax_request() em endpoints AJAX
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Versão:** 1.0.0 | **Autor:** Descomplicar®
|
||||
## References
|
||||
|
||||
- `references/elementos-formulario.md` - Todos os elementos HTML/PHP com exemplos
|
||||
- `references/formulario-completo-exemplo.md` - View completa com todos os elementos
|
||||
|
||||
---
|
||||
|
||||
**Fonte:** help.perfexcrm.com/working-with-forms
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
# Elementos de Formulario Perfex CRM
|
||||
|
||||
Referencia completa de todos os elementos HTML/PHP para formularios em modulos Perfex.
|
||||
|
||||
---
|
||||
|
||||
## Input Text
|
||||
|
||||
```php
|
||||
<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) : ''; ?>"
|
||||
required>
|
||||
</div>
|
||||
```
|
||||
|
||||
## Textarea
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
## Select
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
## Select com AJAX (Clientes)
|
||||
|
||||
```php
|
||||
<div class="form-group">
|
||||
<label for="clientid" class="control-label">
|
||||
<?php echo _l('client'); ?>
|
||||
</label>
|
||||
<select id="clientid" name="clientid" data-live-search="true"
|
||||
data-width="100%" class="ajax-search"
|
||||
data-none-selected-text="<?php echo _l('dropdown_non_selected_tex'); ?>">
|
||||
<?php if (isset($item) && $item->clientid): ?>
|
||||
<option value="<?php echo $item->clientid; ?>" selected>
|
||||
<?php echo html_escape(get_company_name($item->clientid)); ?>
|
||||
</option>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
```
|
||||
|
||||
## Checkbox
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
## Radio
|
||||
|
||||
```php
|
||||
<div class="form-group">
|
||||
<label class="control-label"><?php echo _l('status'); ?></label>
|
||||
<div class="radio radio-primary">
|
||||
<input type="radio" name="status" id="status_pending" value="pending"
|
||||
<?php echo (!isset($item) || $item->status == 'pending') ? 'checked' : ''; ?>>
|
||||
<label for="status_pending"><?php echo _l('pending'); ?></label>
|
||||
</div>
|
||||
<div class="radio radio-primary">
|
||||
<input type="radio" name="status" id="status_active" value="active"
|
||||
<?php echo (isset($item) && $item->status == 'active') ? 'checked' : ''; ?>>
|
||||
<label for="status_active"><?php echo _l('active'); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
## Date Picker
|
||||
|
||||
```php
|
||||
<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>
|
||||
```
|
||||
|
||||
## Date Time Picker
|
||||
|
||||
```php
|
||||
<div class="form-group">
|
||||
<label for="datetime" class="control-label">
|
||||
<?php echo _l('date_time'); ?>
|
||||
</label>
|
||||
<input type="text"
|
||||
id="datetime"
|
||||
name="datetime"
|
||||
class="form-control datetimepicker"
|
||||
value="<?php echo isset($item) ? _dt($item->datetime) : ''; ?>"
|
||||
autocomplete="off">
|
||||
</div>
|
||||
```
|
||||
|
||||
## File Upload
|
||||
|
||||
```php
|
||||
<?php echo form_open_multipart(admin_url('meu_modulo/upload')); ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="attachment" class="control-label">
|
||||
<?php echo _l('attachment'); ?>
|
||||
</label>
|
||||
<input type="file" id="attachment" name="attachment" class="form-control">
|
||||
</div>
|
||||
|
||||
<?php echo form_close(); ?>
|
||||
```
|
||||
|
||||
## Hidden
|
||||
|
||||
```php
|
||||
<input type="hidden" name="id" value="<?php echo $item->id; ?>">
|
||||
```
|
||||
@@ -0,0 +1,141 @@
|
||||
# Formulario Completo Exemplo - Perfex CRM
|
||||
|
||||
Exemplo completo de view com formulario, validacao client-side e todos os elementos tipicos.
|
||||
|
||||
---
|
||||
|
||||
## View
|
||||
|
||||
```php
|
||||
<?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>
|
||||
```
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-hooks
|
||||
description: Perfex CRM hooks system. Actions, filters, add_action, add_filter, do_action, apply_filters. Complete hook list by category. Based on official documentation only. Use when user mentions "perfex hooks", "action hook", "filter perfex", "extend perfex".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Sistema de hooks Perfex CRM — actions, filters, add_action, add_filter, do_action, apply_filters com lista completa por categoria. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-hooks - Sistema de Hooks Perfex CRM
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-menus
|
||||
description: Perfex CRM menu creation. Sidebar menus, client menus, add_sidebar_menu_item(), positions, icons. Based on official documentation only. Use when user mentions "perfex menu", "sidebar perfex", "menu item", "navigation perfex".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Criação de menus para módulos Perfex CRM — sidebar, menus de cliente, add_sidebar_menu_item(), posições e ícones. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-menus - Menus Perfex CRM
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-migrations
|
||||
description: Perfex CRM module migrations and upgrades. Version management, migration files, database updates. Based on official documentation only. Use when user mentions "perfex migration", "module upgrade", "version perfex", "database migration".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Migrações e upgrades de módulos Perfex CRM — gestão de versões, ficheiros de migração e actualizações de base de dados. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-migrations - Migrations Perfex CRM
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-module-basics
|
||||
description: Perfex CRM module development basics. Folder structure, init file, file headers, CodeIgniter integration. Based on official documentation only. Use when user mentions "perfex module", "criar modulo perfex", "init file perfex", "module structure".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Fundamentos de desenvolvimento de módulos Perfex CRM — estrutura de pastas, ficheiro init, headers e integração CodeIgniter. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-module-basics - Estrutura Base Módulos Perfex CRM
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-permissions
|
||||
description: Perfex CRM permissions system. staff_can(), register_staff_capabilities(), access control. Based on official documentation only. Use when user mentions "perfex permissions", "staff_can", "access control", "capabilities perfex".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Sistema de permissões Perfex CRM — staff_can(), register_staff_capabilities(), controlo de acesso e roles. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-permissions - Permissões Perfex CRM
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-security
|
||||
description: Perfex CRM module security. Input validation, CSRF, XSS prevention, directory traversal. Based on official documentation only. Use when user mentions "perfex security", "input validation", "csrf perfex", "xss protection".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Segurança para módulos Perfex CRM — validação de input, CSRF, prevenção XSS e protecção contra directory traversal. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-security - Segurança Módulos Perfex CRM
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
---
|
||||
name: perfex-views
|
||||
description: Perfex CRM module views. Templates, init_head(), init_tail(), admin and client views, passing data. Based on official documentation only. Use when user mentions "perfex views", "template perfex", "init_head", "init_tail".
|
||||
author: Descomplicar® Crescimento Digital
|
||||
version: 1.0.0
|
||||
quality_score: 70
|
||||
user_invocable: true
|
||||
desk_task: null
|
||||
description: Views e templates para módulos Perfex CRM — init_head(), init_tail(), views admin e cliente, passagem de dados. Baseado apenas na documentação oficial.
|
||||
---
|
||||
|
||||
# /perfex-views - Views Perfex CRM
|
||||
|
||||
Reference in New Issue
Block a user