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
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -120,18 +120,26 @@
|
|||||||
function organizeRequiredFields(whichForm, isToRequest) {
|
function organizeRequiredFields(whichForm, isToRequest) {
|
||||||
var fields = [];
|
var fields = [];
|
||||||
if(whichForm === "jogos"){
|
if(whichForm === "jogos"){
|
||||||
fields = ["txfTitulo", "cbbGenero", "txfAnoLancamento", "txfProdutora", "txaDescricao"];
|
fields = ["txfCodigo", "txfTitulo", "cbbGenero", "txfAnoLancamento", "txfProdutora", "txaDescricao"];
|
||||||
} else if(whichForm === "avaliacoes") {
|
} else if(whichForm === "avaliacoes") {
|
||||||
fields = ["txfNome", "txfEmail", "txfComentario", "dcfNota"];
|
fields = ["txfCodigoAvaliacao", "txfCodigoJogo", "txfNome", "txfEmail", "txfComentario", "dcfNota"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isToRequest) {
|
||||||
fields.forEach(function(fieldId) {
|
fields.forEach(function(fieldId) {
|
||||||
var field = engine.getField(fieldId);
|
var field = engine.getField(fieldId);
|
||||||
if (field) {
|
if (field) {
|
||||||
field.setRequired(isToRequest);
|
field.setRequired(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
fields.forEach(function(fieldId) {
|
||||||
|
var field = engine.getField(fieldId);
|
||||||
|
if (field) {
|
||||||
|
field.setRequired(false);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}};
|
||||||
|
|
||||||
function showTableReviews(gameId) {
|
function showTableReviews(gameId) {
|
||||||
if(!gameId) {
|
if(!gameId) {
|
||||||
@@ -214,7 +222,7 @@
|
|||||||
<onClickScript language="JavaScript">
|
<onClickScript language="JavaScript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
function run() {
|
function run() {
|
||||||
engine.getGlobalVariable("organizeRequiredFields")("avaliacoes", true);
|
engine.getGlobalVariable("organizeRequiredFields")("jogos", false);
|
||||||
|
|
||||||
engine.getField("txfCodigoJogo").setValue(engine.getField("dbtJogos").getValue());
|
engine.getField("txfCodigoJogo").setValue(engine.getField("dbtJogos").getValue());
|
||||||
|
|
||||||
@@ -547,19 +555,29 @@
|
|||||||
</Header>
|
</Header>
|
||||||
<Section caption="Cadastro de novo Jogo" subCaption="Insira os dados do jogo" width="100%" height="100%" >
|
<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">
|
<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">
|
<VerticalLayout caption="Dados do Jogo" width="100%" spacing="true">
|
||||||
<TextField id="txfCodigo" caption="Código" type="number" width="100%" enabled="false" visible="false"/>
|
<TextField id="txfCodigo" caption="Código" type="number"
|
||||||
<NumericField id="txfNotaMedia" caption="Nota Média" type="number" width="100%" enabled="false" visible="false"/>
|
width="100%" enabled="false" visible="false" />
|
||||||
<TextField id="txfTitulo" caption="Título" type="string" width="100%" required="true" minLength="3"/>
|
<NumericField id="txfNotaMedia" caption="Nota média"
|
||||||
<ComboBox id="cbbGenero" type="string" caption="Gênero" width="100%" required="true">
|
type="number"
|
||||||
<entry key="ACAO" value="Ação"/>
|
width="100%" enabled="false" visible="false" />
|
||||||
<entry key="AVENTURA" value="Aventura"/>
|
<TextField id="txfTitulo" caption="Título" type="string"
|
||||||
<entry key="RPG" value="RPG"/>
|
width="100%"
|
||||||
<entry key="ESPORTES" value="Esportes"/>
|
required="true" minLength="3" maxLength="100" />
|
||||||
<entry key="ESTRATEGIA" value="Estratégia"/>
|
<ComboBox id="cbbGenero" allowNullSelection="true"
|
||||||
<entry key="CORRIDA" value="Corrida"/>
|
caption="Gênero" description="ComboBox Exemplo"
|
||||||
<entry key="Sobrevivencia" value="Sobrevivência"/>
|
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>
|
</ComboBox>
|
||||||
<TextField id="txfAnoLancamento" caption="Ano de Lançamento" type="number" width="100%" required="true">
|
<TextField id="txfAnoLancamento" caption="Ano de Lançamento" type="number" width="100%" required="true">
|
||||||
<validation>
|
<validation>
|
||||||
@@ -593,7 +611,7 @@
|
|||||||
<TextArea id="txaDescricao" caption="Descrição" type="string" width="100%" required="true" maxLength="500"/>
|
<TextArea id="txaDescricao" caption="Descrição" type="string" width="100%" required="true" maxLength="500"/>
|
||||||
</VerticalLayout>
|
</VerticalLayout>
|
||||||
</Panel>
|
</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">
|
<ButtonWidget id="btnVoltar" caption="Voltar" defaultIcon="BACK" style="BLACK">
|
||||||
<onClickScript language="JavaScript">
|
<onClickScript language="JavaScript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
@@ -618,7 +636,7 @@
|
|||||||
<onClickScript language="JavaScript">
|
<onClickScript language="JavaScript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
function run() {
|
function run() {
|
||||||
engine.getGlobalVariable("organizeRequiredFields")("jogos", true);
|
engine.getGlobalVariable("organizeRequiredFields")("avaliacoes", false);
|
||||||
if(engine.isValid()){
|
if(engine.isValid()){
|
||||||
var config_jogos = engine.getGlobalVariable("config_jogos");
|
var config_jogos = engine.getGlobalVariable("config_jogos");
|
||||||
var lib = libService.loadScript("lib_cadastro_padrao");
|
var lib = libService.loadScript("lib_cadastro_padrao");
|
||||||
|
|||||||
Reference in New Issue
Block a user