<form method="post" action="actions.php"><?= csrf_field() ?><input type="hidden" name="action" value="save_fee_rule"><input type="hidden" name="return_page" value="fees"><input type="hidden" name="id" value="<?= e($feeItem['id']) ?>"><div class="form-grid"><div class="form-group"><label>Aplicar para</label><select name="scope_type"><option value="all"<?= selected($feeItem['scope_type'],'all') ?>>Todos</option><option value="role"<?= selected($feeItem['scope_type'],'role') ?>>Perfil</option><option value="segment"<?= selected($feeItem['scope_type'],'segment') ?>>Segmento</option><option value="category"<?= selected($feeItem['scope_type'],'category') ?>>Categoria</option><option value="user"<?= selected($feeItem['scope_type'],'user') ?>>Usuário específico</option></select></div><div class="form-group"><label>Valor do escopo</label><input class="input" name="scope_value" value="<?= e($feeItem['scope_value']) ?>" list="feeScopes" placeholder="Ex.: service_provider, services, 12 ou LXU-..."><small>Deixe vazio somente para “Todos”.</small></div><div class="form-group"><label>Tipo da taxa</label><select name="fee_type"><option value="fixed"<?= selected($feeItem['fee_type'],'fixed') ?>>Valor fixo (R$)</option><option value="percent"<?= selected($feeItem['fee_type'],'percent') ?>>Percentual (%)</option></select></div><div class="form-group"><label>Valor</label><input class="input" name="fee_value" inputmode="decimal" value="<?= e($feeItem['fee_value']) ?>" required></div><div class="form-group"><label>Status</label><select name="status"><option value="active"<?= selected($feeItem['status'],'active') ?>>Ativa</option><option value="inactive"<?= selected($feeItem['status'],'inactive') ?>>Inativa</option></select></div></div><datalist id="feeScopes"><?php foreach($roles as $k=>$v):?><option value="<?= e($k) ?>"><?= e('Perfil: '.$v) ?></option><?php endforeach;?><?php foreach($segments as $s):?><option value="<?= e($s['slug']) ?>"><?= e('Segmento: '.$s['name']) ?></option><?php endforeach;?><?php foreach($categories as $c):?><option value="<?= (int)$c['id'] ?>"><?= e('Categoria: '.$c['name'].' • '.$c['module']) ?></option><?php endforeach;?><?php foreach($users as $uu):?><option value="<?= e($uu['public_id']) ?>"><?= e('Usuário: '.$uu['name']) ?></option><?php endforeach;?></datalist><div class="form-actions"><button class="btn btn-primary">Salvar taxa</button></div></form>
