refactor: enhance required fields organization and improve ComboBox options in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit

This commit is contained in:
Matheus
2026-09-24 16:10:28 -03:00
parent e6629b76e9
commit 203a323653
+45 -27
View File
@@ -120,19 +120,27 @@
function organizeRequiredFields(whichForm, isToRequest) {
var fields = [];
if(whichForm === "jogos"){
fields = ["txfTitulo", "cbbGenero", "txfAnoLancamento", "txfProdutora", "txaDescricao"];
fields = ["txfCodigo", "txfTitulo", "cbbGenero", "txfAnoLancamento", "txfProdutora", "txaDescricao"];
} else if(whichForm === "avaliacoes") {
fields = ["txfNome", "txfEmail", "txfComentario", "dcfNota"];
}
fields.forEach(function(fieldId) {
var field = engine.getField(fieldId);
if (field) {
field.setRequired(isToRequest);
}
});
}
fields = ["txfCodigoAvaliacao", "txfCodigoJogo", "txfNome", "txfEmail", "txfComentario", "dcfNota"];
}
if(isToRequest) {
fields.forEach(function(fieldId) {
var field = engine.getField(fieldId);
if (field) {
field.setRequired(true);
}
});
} else {
fields.forEach(function(fieldId) {
var field = engine.getField(fieldId);
if (field) {
field.setRequired(false);
}
});
}};
function showTableReviews(gameId) {
if(!gameId) {
var lib_msg = libService.loadScript("messages");
@@ -214,7 +222,7 @@
<onClickScript language="JavaScript">
<![CDATA[
function run() {
engine.getGlobalVariable("organizeRequiredFields")("avaliacoes", true);
engine.getGlobalVariable("organizeRequiredFields")("jogos", false);
engine.getField("txfCodigoJogo").setValue(engine.getField("dbtJogos").getValue());
@@ -547,20 +555,30 @@
</Header>
<Section caption="Cadastro de novo Jogo" subCaption="Insira os dados do jogo" width="100%" height="100%" >
<VerticalLayout width="100%" height="100%" align="MIDDLE_CENTER" spacing="true">
<Panel id="pnlDadosJogo" width="100%" height="100%" margin="true" >
<Panel id="pnlDadosJogo" width="100%" expandRatio="0.7" height="100%" margin="true" >
<VerticalLayout caption="Dados do Jogo" width="100%" spacing="true">
<TextField id="txfCodigo" caption="Código" type="number" width="100%" enabled="false" visible="false"/>
<NumericField id="txfNotaMedia" caption="Nota Média" type="number" width="100%" enabled="false" visible="false"/>
<TextField id="txfTitulo" caption="Título" type="string" width="100%" required="true" minLength="3"/>
<ComboBox id="cbbGenero" type="string" caption="Gênero" width="100%" required="true">
<entry key="ACAO" value="Ação"/>
<entry key="AVENTURA" value="Aventura"/>
<entry key="RPG" value="RPG"/>
<entry key="ESPORTES" value="Esportes"/>
<entry key="ESTRATEGIA" value="Estratégia"/>
<entry key="CORRIDA" value="Corrida"/>
<entry key="Sobrevivencia" value="Sobrevivência"/>
</ComboBox>
<TextField id="txfCodigo" caption="Código" type="number"
width="100%" enabled="false" visible="false" />
<NumericField id="txfNotaMedia" caption="Nota média"
type="number"
width="100%" enabled="false" visible="false" />
<TextField id="txfTitulo" caption="Título" type="string"
width="100%"
required="true" minLength="3" maxLength="100" />
<ComboBox id="cbbGenero" allowNullSelection="true"
caption="Gênero" description="ComboBox Exemplo"
updatable="false" required="true"
visible="true" type="string" width="100%">
<entry value="Ação" key="Ação" />
<entry value="Aventura" key="Aventura" />
<entry value="Terror" key="Terror" />
<entry value="Sobrevivência" key="Sobrevivência" />
<entry value="Infântil" key="Infântil" />
<entry value="Esportes" key="Esportes" />
<entry value="Corrida" key="Corrida" />
<entry value="RPG" key="RPG" />
<entry value="Outro" key="Outro" />
</ComboBox>
<TextField id="txfAnoLancamento" caption="Ano de Lançamento" type="number" width="100%" required="true">
<validation>
<script language="JavaScript">
@@ -593,7 +611,7 @@
<TextArea id="txaDescricao" caption="Descrição" type="string" width="100%" required="true" maxLength="500"/>
</VerticalLayout>
</Panel>
<HorizontalLayout align="MIDDLE_RIGHT" spacing="true" >
<HorizontalLayout align="MIDDLE_RIGHT" expandRatio="0.3" spacing="true" >
<ButtonWidget id="btnVoltar" caption="Voltar" defaultIcon="BACK" style="BLACK">
<onClickScript language="JavaScript">
<![CDATA[
@@ -618,7 +636,7 @@
<onClickScript language="JavaScript">
<![CDATA[
function run() {
engine.getGlobalVariable("organizeRequiredFields")("jogos", true);
engine.getGlobalVariable("organizeRequiredFields")("avaliacoes", false);
if(engine.isValid()){
var config_jogos = engine.getGlobalVariable("config_jogos");
var lib = libService.loadScript("lib_cadastro_padrao");