wagtail-enap-designsystem 1.2.1.131__py3-none-any.whl → 1.2.1.133__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of wagtail-enap-designsystem might be problematic. Click here for more details.

@@ -657,7 +657,7 @@ class CheckboxMultiRedirectFieldBlock(blocks.StructBlock):
657
657
  label="Opções e Ações",
658
658
  help_text="Configure as opções e o que acontece para cada uma",
659
659
  min_num=1,
660
- max_num=10
660
+ max_num=500
661
661
  )
662
662
 
663
663
  class Meta:
@@ -708,6 +708,7 @@ class ConditionalFieldBlock(blocks.StructBlock):
708
708
  choices=[
709
709
  ('show_fields', '👁️ Mostrar campos'),
710
710
  ('nothing', '➡️ Não fazer nada (pular)'),
711
+ ('end_form', '⛔ Encerrar formulário'),
711
712
  ],
712
713
  default='nothing'
713
714
  )),
@@ -806,7 +807,7 @@ class SmartNavigationFieldBlock(blocks.StructBlock):
806
807
  label="Opções e Navegação",
807
808
  help_text="Configure para onde cada resposta leva o usuário",
808
809
  min_num=1,
809
- max_num=10
810
+ max_num=100
810
811
  )
811
812
 
812
813
  class Meta:
@@ -980,6 +981,13 @@ class FormStepBlock(StructBlock):
980
981
  required=False,
981
982
  help_text="Imagem que será exibida no cabeçalho desta etapa (opcional)"
982
983
  )
984
+
985
+ order = CharBlock(
986
+ label="Ordem da Etapa",
987
+ max_length=3,
988
+ help_text="Número para definir a ordem (ex: 1, 2, 3...)",
989
+ default="1"
990
+ )
983
991
 
984
992
  logo_alt = CharBlock(
985
993
  label="Texto Alternativo da Logo",
@@ -992,6 +1000,8 @@ class FormStepBlock(StructBlock):
992
1000
  FORM_FIELD_BLOCKS,
993
1001
  label="Campos desta Etapa",
994
1002
  required=False,
1003
+ min_num=0,
1004
+ max_num=500,
995
1005
  help_text="Adicione os campos que aparecerão nesta etapa"
996
1006
  )
997
1007
 
@@ -1059,7 +1069,7 @@ class FormularioPage(Page):
1059
1069
  verbose_name="Etapas do Formulário",
1060
1070
  use_json_field=True,
1061
1071
  min_num=1,
1062
- max_num=10,
1072
+ max_num=100,
1063
1073
  help_text="Adicione quantas etapas precisar (mínimo 1, máximo 10)"
1064
1074
  )
1065
1075
 
@@ -1102,7 +1112,7 @@ class FormularioPage(Page):
1102
1112
  ))],
1103
1113
  verbose_name="Logo",
1104
1114
  use_json_field=True,
1105
- max_num=1, # Só permite uma logo
1115
+ max_num=100, # Só permite uma logo
1106
1116
  blank=True,
1107
1117
  help_text="Adicione o logo do formulário"
1108
1118
  )
@@ -1114,7 +1124,7 @@ class FormularioPage(Page):
1114
1124
  ))],
1115
1125
  verbose_name="Imagem de Fundo",
1116
1126
  use_json_field=True,
1117
- max_num=1,
1127
+ max_num=500,
1118
1128
  blank=True,
1119
1129
  help_text="Adicione uma imagem de fundo para o formulário"
1120
1130
  )
@@ -1126,7 +1136,7 @@ class FormularioPage(Page):
1126
1136
  ))],
1127
1137
  verbose_name="Imagem de Agradecimento",
1128
1138
  use_json_field=True,
1129
- max_num=1,
1139
+ max_num=500,
1130
1140
  blank=True,
1131
1141
  help_text="Adicione uma imagem para a tela de sucesso"
1132
1142
  )
@@ -1262,46 +1272,6 @@ class FormularioPage(Page):
1262
1272
 
1263
1273
  return submission
1264
1274
 
1265
- def get_all_steps(self):
1266
- """Retorna todas as etapas organizadas com seções - SEM title/subtitle"""
1267
- steps = []
1268
- for index, step_block in enumerate(self.form_steps):
1269
- step_data = {
1270
- 'number': index + 1,
1271
- 'logo': step_block.value.get('logo'),
1272
- 'logo_alt': step_block.value.get('logo_alt', ''),
1273
- 'fields': step_block.value['fields'],
1274
- 'id': step_block.id,
1275
- 'sections': []
1276
- }
1277
-
1278
- # Organizar campos em seções
1279
- current_section = None
1280
- for field_block in step_block.value['fields']:
1281
- if field_block.block_type == 'section_header':
1282
- # Nova seção
1283
- current_section = {
1284
- 'title': field_block.value['title'],
1285
- 'subtitle': field_block.value.get('subtitle', ''),
1286
- 'fields': []
1287
- }
1288
- step_data['sections'].append(current_section)
1289
- else:
1290
- # Campo normal
1291
- if current_section is None:
1292
- # Criar seção padrão se não existir
1293
- current_section = {
1294
- 'title': '',
1295
- 'subtitle': '',
1296
- 'fields': []
1297
- }
1298
- step_data['sections'].append(current_section)
1299
-
1300
- current_section['fields'].append(field_block)
1301
-
1302
- steps.append(step_data)
1303
- return steps
1304
-
1305
1275
  def get_total_steps(self):
1306
1276
  """Retorna o número total de etapas (incluindo boas-vindas e sucesso)"""
1307
1277
  return len(self.form_steps) + 2 # +2 para boas-vindas e sucesso
@@ -1313,7 +1283,7 @@ class FormularioPage(Page):
1313
1283
  return super().serve(request, *args, **kwargs)
1314
1284
 
1315
1285
  def process_form_submission(self, request):
1316
- """Processa os dados do formulário - CORRIGIDO para arquivos"""
1286
+ """Processa os dados do formulário"""
1317
1287
  form_data = {}
1318
1288
  files_data = {} # ← Separar arquivos dos dados
1319
1289
 
@@ -1899,6 +1869,70 @@ class FormularioPage(Page):
1899
1869
  })
1900
1870
 
1901
1871
  return total_score, score_details
1872
+
1873
+ def get_all_steps(self):
1874
+ """Retorna todas as etapas organizadas com seções - COM ORDENAÇÃO"""
1875
+ steps = []
1876
+
1877
+ # DEBUG TEMPORÁRIO
1878
+ print(f"=== GET_ALL_STEPS - PROCESSANDO {len(self.form_steps)} STEPS ===")
1879
+
1880
+ # Criar lista de steps com ordem
1881
+ steps_with_order = []
1882
+ for index, step_block in enumerate(self.form_steps):
1883
+ order = step_block.value.get('order', str(index + 1))
1884
+ print(f"Step {index}: order='{order}'")
1885
+
1886
+ try:
1887
+ order_num = int(order) if order else index + 1
1888
+ except (ValueError, TypeError):
1889
+ order_num = index + 1
1890
+
1891
+ steps_with_order.append((order_num, index, step_block))
1892
+
1893
+ # Ordenar por order_num
1894
+ steps_with_order.sort(key=lambda x: x[0])
1895
+ print(f"Ordem final: {[(x[0], x[1]) for x in steps_with_order]}")
1896
+
1897
+ # Processar steps na ordem correta
1898
+ for position, (order_num, original_index, step_block) in enumerate(steps_with_order):
1899
+ step_data = {
1900
+ 'number': position + 1,
1901
+ 'original_number': original_index + 1,
1902
+ 'order': order_num,
1903
+ 'logo': step_block.value.get('logo'),
1904
+ 'logo_alt': step_block.value.get('logo_alt', ''),
1905
+ 'fields': step_block.value['fields'],
1906
+ 'id': step_block.id,
1907
+ 'sections': []
1908
+ }
1909
+
1910
+ # Organizar campos em seções
1911
+ current_section = None
1912
+ for field_block in step_block.value['fields']:
1913
+ if field_block.block_type == 'section_header':
1914
+ current_section = {
1915
+ 'title': field_block.value['title'],
1916
+ 'subtitle': field_block.value.get('subtitle', ''),
1917
+ 'fields': []
1918
+ }
1919
+ step_data['sections'].append(current_section)
1920
+ else:
1921
+ if current_section is None:
1922
+ current_section = {
1923
+ 'title': '',
1924
+ 'subtitle': '',
1925
+ 'fields': []
1926
+ }
1927
+ step_data['sections'].append(current_section)
1928
+
1929
+ current_section['fields'].append(field_block)
1930
+
1931
+ steps.append(step_data)
1932
+ print(f"Step processado: {position + 1} (ordem {order_num})")
1933
+
1934
+ print(f"=== RETORNANDO {len(steps)} STEPS ===")
1935
+ return steps
1902
1936
  class Meta:
1903
1937
  verbose_name = "Formulário Dinâmico"
1904
1938
  verbose_name_plural = "Formulários Dinâmicos"
@@ -2041,7 +2075,7 @@ class HomePage(Page):
2041
2075
  verbose_name="Botões do Hero",
2042
2076
  use_json_field=True,
2043
2077
  min_num=1,
2044
- max_num=3,
2078
+ max_num=300,
2045
2079
  help_text="Botões principais da seção hero"
2046
2080
  )
2047
2081
 
@@ -2071,7 +2105,7 @@ class HomePage(Page):
2071
2105
  verbose_name="Lista de Funcionalidades",
2072
2106
  use_json_field=True,
2073
2107
  min_num=1,
2074
- max_num=12,
2108
+ max_num=120,
2075
2109
  help_text="Adicione as funcionalidades do sistema"
2076
2110
  )
2077
2111
 
@@ -2094,7 +2128,7 @@ class HomePage(Page):
2094
2128
  verbose_name="Botões do CTA Final",
2095
2129
  use_json_field=True,
2096
2130
  min_num=1,
2097
- max_num=3,
2131
+ max_num=300,
2098
2132
  help_text="Botões da seção final"
2099
2133
  )
2100
2134