Compare commits

..
18 Commits
Author SHA1 Message Date
Matheus ed2fbc5fa2 fix: update foreign key reference in matheus_medeiros_jogos.xml
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-10-01 15:34:21 -03:00
Matheus 8cf91179c6 fix: update game search field caption and enhance delete functionality in cadastro_jogos desktop XML 2026-10-01 15:31:58 -03:00
Matheus 6561615978 fix: enhance delete functionality and improve UI elements in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-25 11:54:42 -03:00
Matheus 18602e75d9 fix: add drop tables and sequences changeSets in matheus_medeiros_jogos.xml
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-25 11:08:58 -03:00
Matheus 82202e77f0 fix: remove entries from DATABASECHANGELOG for matheus_medeiros_jogos.xml
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-25 10:54:40 -03:00
Matheus 655e67a0f9 atual
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-25 10:39:38 -03:00
Matheus 461a573145 fix: update search field ID and improve SQL query for game search in cadastro_jogos desktop XML 2026-09-25 09:17:38 -03:00
Matheus 211721edf8 fix: retrieve selected game ID for review display in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-25 08:45:03 -03:00
Matheus 1aa8093e99 fix: update notification message for game selection in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-25 08:25:47 -03:00
Matheus 1269965ec8 refactor: add Nota Média field and improve form layout in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-24 20:41:59 -03:00
Matheus 8256d40b41 refactor: streamline form fields and update ComboBox options in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-24 16:15:43 -03:00
Matheus 203a323653 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
2026-09-24 16:10:28 -03:00
Matheus e6629b76e9 refactor: update data types and constraints in jogos and avaliacoes tables
davinTI/jogos_matheus/pipeline/head Something is wrong with the build of this commit
2026-09-24 15:02:31 -03:00
Matheus ae2ee70203 refactor: add database change log for jogos and avaliacoes tables with constraints
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-24 14:55:31 -03:00
Matheus 28adf521c4 refactor: add new database change log for jogos tables and sequences
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-24 14:52:17 -03:00
Matheus c6d7c5f59a refactor: clean up comments and improve SQL injection prevention in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-24 14:49:01 -03:00
Matheus c4fce638ca refactor: remove unnecessary fields and improve validation in cadastro_jogos desktop XML
davinTI/jogos_matheus/pipeline/head There was a failure building this commit
2026-09-24 14:26:57 -03:00
Matheus 6891f63534 refactor: update sequences in cadastro_jogos desktop XML 2026-09-24 11:21:18 -03:00
5 changed files with 774 additions and 147 deletions
Vendored
BIN
View File
Binary file not shown.
+528 -130
View File
@@ -1,18 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<panel-form xmlns="http://www.davinti.com.br/vitruvio/form/panel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbucket.org/davinTI/vitruvio-xds/raw/master/vitruvio-panel-form.xsd">
<form formKey="formCadastroJogos" width="100%" height="100%">
<name>Cadastro de jogos</name>
<description>Painel para cadastro de jogos</description>
<panel-form xmlns="http://www.davinti.com.br/vitruvio/form/panel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.davinti.com.br/vitruvio/form/panel https://bitbucket.org/davinTI/vitruvio-xds/raw/master/vitruvio-panel-form.xsd">
<form width="100%" height="100%" target="DEFAULT" formKey="formTeste">
<description></description>
<initScript language="JavaScript">
<![CDATA[
var lib_cadastro_padrao = libService.loadScript("lib_cadastro_padrao");
var config_jogos = {
tabela:
{
conexao : 'vitruvio',
nome : '',
sequence : '',
nome : 'TB_MATHEUS_MEDEIROS_JOGOS',
sequence : 'TB_MATHEUS_MEDEIROS_JOGOS_SEQ',
idTabela : 'CODIGO',
campos: [
'CODIGO',
@@ -51,8 +55,8 @@
var config_avaliacoes = {
tabela: {
conexao : 'vitruvio',
nome : '',
sequence : '',
nome : 'TB_MATHEUS_MEDEIROS_AVALIACOES',
sequence : 'TB_MATHEUS_MEDEIROS_AVALIACOES_SEQ',
idTabela : 'CODIGO',
campos: [
'CODIGO',
@@ -169,147 +173,541 @@
engine.setGlobalVariable("resetPanelGames", resetPanelGames);
}
]]>
</initScript>
<components>
<VerticalLayout width="100%" height="100%" >
<CrudPanel width="100%" height="100%" visible="true">
<Header>
<Caption></Caption>
<SubCaption>Cadastro de jogos</SubCaption>
</Header>
<Section height="100%" width="100%" caption="Jogos" subCaption="Veja todos os jogos" id = "secJogos">
<VerticalLayout height="100%" width="100%" align="MIDDLE_CENTER" spacing="true">
<HorizontalLayout width="100%" spacing="true">
<TextField id="txfPesquisaJogo" expandRatio="0.8" width="100%" caption="Pesquisar jogo" type="string" immediate="true">
<events>
<valueChange>
<script language="JavaScript">
<![CDATA[
]]>
</script>
</valueChange>
</events>
</TextField>
<ButtonWidget id="btnPesquisar" caption="Pesquisar" defaultIcon="SEARCH" style="BLACK">
<onClickScript language="JavaScript">
<![CDATA[ ]]>
</onClickScript>
</ButtonWidget>
</HorizontalLayout>
<DBTable id="dbtJogos" align="MIDDLE_CENTER" width="100%" height="100%" type="string" expandRatio="0.5" showRowCount="true" drawRefreshButton="true" gridSelectable="true" >
<datasource>
<sqlBuilderDataSource connection-key="" language="JavaScript">
</initScript>
</sqlBuilderDataSource>
<components>
<VerticalLayout width="100%" height="100%" align="MIDDLE_RIGHT">
<WindowLayout id="wltCriarAvaliacoes" windowModal="true" windowHeight="70%"
windowWidth="80%" windowTitle="Nova avaliação">
<VerticalLayout width="100%" height="100%" spacing="true" margin="true">
<TextField width="100%" id="txfCodigoAvaliacao" type="number"
caption="Código"
required="false" enabled="false" visible="false" />
<DateField caption="Data da avaliação"
required="false" enabled="false" width="100%" visible="false"
id="dtfDataAvaliacao" format="dd/MM/yyyy"
type="date" />
<TextField width="100%" id="txfCodigoJogo" type="number"
caption="Código do jogo"
required="true" enabled="false" visible="false" />
<TextField width="100%" id="txfNome" type="string" caption="Nome"
required="true" />
<TextField width="100%" id="txfEmail" type="email" caption="E-mail"
required="true" />
<TextField width="100%" id="txfComentario" type="string"
caption="Comentário" required="true" />
<DecimalField width="100%" id="dcfNota" type="decimal"
caption="Nota (0 a 10)"
required="true" />
<ButtonWidget id="btnSalvarAvaliacao" caption="Salvar" defaultIcon="SAVE"
style="BLUE">
<onClickScript language="JavaScript">
<![CDATA[
function run() {
engine.getGlobalVariable("organizeRequiredFields")("jogos", false);
engine.getField("txfCodigoJogo").setValue(engine.getField("dbtJogos").getValue());
var hoje = new Date();
var javaDate = new java.util.Date(hoje.getTime());
engine.getField("dtfDataAvaliacao").setValue(javaDate);
if(engine.isValid()){
engine.getField("txfCodigo").setValue(engine.getField("dbtJogos").getValue());
var config_avaliacoes = engine.getGlobalVariable("config_avaliacoes");
var lib = libService.loadScript("lib_cadastro_padrao");
var id = engine.getField("txfCodigoAvaliacao").getValue();
var retorno = lib.fncGravarRegistro(config_avaliacoes, id);
engine.getField("dbtJogos").refresh();
if (retorno) {
var lib_msg = libService.loadScript("messages");
engine.getField("txfCodigoAvaliacao").setValue(retorno);
engine.getField("dbtAvaliacoes").refresh();
lib_msg.showNotification({
type: lib_msg.notificationType.tray,
caption: "Sucesso!",
msg: "Avaliação foi salva com sucesso!",
position: lib_msg.notificationPosition.bottom_right,
});
}
engine.getLayout("wltCriarAvaliacoes").closeWindow();
engine.getLayout("wltListaAvaliacoes").showWindow();
engine.getGlobalVariable("organizeRequiredFields")("jogos", true);
}
}
]]>
</onClickScript>
</ButtonWidget>
</VerticalLayout>
</WindowLayout>
<WindowLayout id="wltListaAvaliacoes" windowModal="true" windowHeight="80%"
windowWidth="80%">
<VerticalLayout spacing="true" margin="true" height="100%">
<Label id="lblTitle">
<value>Avaliações</value>
</Label>
<DBTable id="dbtAvaliacoes" type="string" width="100%"
gridSelectable="true" selectable="false" height="100%"
expandRatio="0.2" showRowCount="true">
<datasource>
<sqlBuilderDataSource connection-key="vitruvio"
language="JavaScript">
<![CDATA[
function buildSQL(_){
var txfPesquisa = engine.getField("txfPesquisaJogo").getValue();
var sqlBase = "SELECT * FROM TB_MATHEUS_MEDEIROS_AVALIACOES ORDER BY CODIGO";
var id_jogo = engine.getField("dbtJogos").getValue();
if(id_jogo != null){
sqlBase = "SELECT * FROM TB_MATHEUS_MEDEIROS_AVALIACOES WHERE ID_JOGO = " + id_jogo + " ORDER BY CODIGO";
}
return sqlBase;
}
]]>
</sqlBuilderDataSource>
</datasource>
<key-field>
CODIGO
</key-field>
<key-field>CODIGO</key-field>
<columns>
<column name="CODIGO" caption="ID" />
<column name="NOME" caption="NOME" />
<column name="EMAIL" caption="E-MAIL" />
<column name="COMENTARIO" caption="COMENTÁRIO" />
<column name="NOTA" caption="NOTA" />
<column name="DATA_AVALIACAO" caption="DATA DE AVALIAÇÃO" />
<generated name="EDITAR" caption="EDITAR" align="CENTER">
<scriptColumnGenerator language="JavaScript">
<![CDATA[
function Generator() {
var comp = libService.loadScript("vaadinComponents");
this.generate = function (itemId, columnId, item, container) {
var btn = comp.buttonIcon("Editar", function () {
var id = itemId;
engine.getField("txfCodigoAvaliacao").setValue(id);
if (id != null) {
engine.getLayout("wltCriarAvaliacoes").showWindow();
engine.getLayout("wltListaAvaliacoes").closeWindow();
var config_avaliacoes = engine.getGlobalVariable('config_avaliacoes');
var lib = libService.loadScript('lib_cadastro_padrao');
var sql = lib.fncCarregarCampos(config_avaliacoes, id);
}
}, "pencil");
return btn;
}
}
var script = new Generator();
]]>
</scriptColumnGenerator>
</generated>
<generated name="EXCLUIR" caption="EXCLUIR" align="CENTER">
<scriptColumnGenerator language="JavaScript">
<![CDATA[
function Generator() {
var comp = libService.loadScript("vaadinComponents");
this.generate = function (itemId, columnId, item, container) {
var btn = comp.buttonIcon(
"Excluir",
function () {
var lib = engine.getGlobalVariable("lib_cadastro_padrao");
var config_avaliacoes = engine.getGlobalVariable("config_avaliacoes");
var registro = itemId + " - " + item.getItemProperty("nome");
var msg = "Tem certeza de que deseja excluir o comentário " + registro + "?";
var lib_msg = libService.loadScript("messages");
lib_msg.confirmationBox(
{
icon: lib_msg.confirmationIcon.question,
caption: "Confirmar operação",
msg: msg,
actions: lib_msg.confirmationControls.yes_no,
},
function(action) {
if(action.yes()) {
try{
lib.fncDeletarRegistro(config_avaliacoes, itemId);
engine.getField("dbtAvaliacoes").refresh();
} catch (error) {
engine.getField("dbtAvaliacoes").refresh();
lib_msg.showNotification({
type: lib_msg.notificationType.tray,
caption: "Avaliação apagada!",
msg: "A avaliação foi apagada com sucesso.",
position: lib_msg.notificationPosition.bottom_right,
});
return;
}
}
}
);
},
"trash",
);
return btn;
}
}
var script = new Generator();
]]>
</scriptColumnGenerator>
</generated>
</columns>
</DBTable>
<HorizontalLayout spacing="true" align="MIDDLE_RIGHT">
<ButtonWidget id="btnVoltarAvaliacoes" style="BLACK" caption="Voltar"
width="20%" align="MIDDLE_RIGHT" defaultIcon="BACK">
<onClickScript language="JavaScript">
<![CDATA[
function run() {
engine.getLayout("wltListaAvaliacoes").closeWindow();
}
]]>
</onClickScript>
</ButtonWidget>
<ButtonWidget id="btnAdicionarAvaliacoes" style="GREEN"
caption="Nova Avaliação"
width="20%" align="MIDDLE_RIGHT" defaultIcon="ADD">
<onClickScript language="JavaScript">
<![CDATA[
function run (){
engine.getGlobalVariable("resetPanelReviews")();
engine.getLayout("wltCriarAvaliacoes").showWindow();
engine.getLayout("wltListaAvaliacoes").closeWindow();
}
]]>
</onClickScript>
</ButtonWidget>
</HorizontalLayout>
</VerticalLayout>
</WindowLayout>
<CrudPanel id="pnlListaJogos" width="100%" height="100%" visible="true">
<Header backgroundColor="ORANGE">
<Caption>Avaliações dos jogos</Caption>
<SubCaption>Os melhores jogos já feitos</SubCaption>
</Header>
<Section height="100%" caption="Jogos" subCaption="Veja todos os jogos"
id="secDadosJogo">
<VerticalLayout width="100%" height="100%" align="MIDDLE_CENTER"
spacing="true">
<HorizontalLayout width="100%" spacing="true">
<TextField expandRatio="0.8" width="100%" id="txfPesquisaJogo"
caption="Pesquise o nome do jogo" type="string"
immediate="true">
<events>
<valueChange>
<script language="JavaScript">
<![CDATA[
function run(){
engine.getField("dbtJogos").refresh();
}
]]>
</script>
</valueChange>
</events>
</TextField>
<ButtonWidget defaultIcon="SEARCH" id="btnPesquisar"
caption="Pesquisar" style="BLUE" expandRatio="0.2">
<onClickScript language="JavaScript">
<![CDATA[
function run() {
engine.getField("dbtJogos").refresh();
}
]]>
</onClickScript>
</ButtonWidget>
</HorizontalLayout>
<DBTable id="dbtJogos" align="MIDDLE_CENTER" type="string" width="100%"
gridSelectable="true" height="100%"
expandRatio="0.5" showRowCount="true" drawRefreshButton="true">
<datasource>
<sqlBuilderDataSource connection-key="vitruvio"
language="JavaScript">
<![CDATA[
function buildSQL(_){
var txfPesquisa = engine.getField("txfPesquisaJogo").getValue();
var sqlBase = "SELECT J.CODIGO, J.TITULO, J.GENERO, J.ANO_LANCAMENTO, J.PRODUTORA, COALESCE(ROUND(AVG(A.NOTA), 2), 0) AS NOTA_MEDIA, J.DESCRICAO FROM TB_MATHEUS_MEDEIROS_JOGOS J LEFT JOIN TB_MATHEUS_MEDEIROS_AVALIACOES A ON J.CODIGO = A.ID_JOGO";
if (txfPesquisa) {
sqlBase += " WHERE UPPER(J.TITULO) LIKE UPPER('%" + txfPesquisa + "%')";
}
sqlBase += " GROUP BY J.CODIGO, J.TITULO, J.GENERO, J.ANO_LANCAMENTO, J.PRODUTORA, J.DESCRICAO";
sqlBase += " ORDER BY J.CODIGO";
return sqlBase;
}
]]>
</sqlBuilderDataSource>
</datasource>
<key-field>CODIGO</key-field>
<columns>
<column name="CODIGO" caption="ID" />
<column name="TITULO" caption="TÍTULO" />
<column name="GENERO" caption="GÊNERO" />
<column name="ANO_LANCAMENTO" caption="ANO DE LANÇAMENTO" />
<column name="PRODUTORA" caption="PRODUTORA" />
<column name="NOTA_MEDIA" caption="NOTA MÉDIA" />
<column name="DESCRICAO" caption="DESCRIÇÃO" />
<generated name="AVALIACOES" caption="AVALIAÇÕES" align="CENTER">
<generated name="AVALIACOES" caption="AVALIACOES" align="CENTER">
<scriptColumnGenerator language="JavaScript">
<![CDATA[ ]]>
</scriptColumnGenerator>
<![CDATA[
function Generator() {
var comp = libService.loadScript("vaadinComponents");
this.generate = function (itemId, columnId, item, container) {
var btn = comp.buttonIcon("Avaliações", function () {
engine.getField("dbtJogos").setValue(itemId);
engine.getField("dbtAvaliacoes").refresh();
var idJogoSelecionado = engine.getField("dbtJogos").getValue();
engine.getGlobalVariable("showTableReviews")(itemId);
}, "star");
return btn;
}
}
var script = new Generator();
]]>
</scriptColumnGenerator>
</generated>
<generated name="EDITAR" caption="EDITAR" align="CENTER">
<scriptColumnGenerator language="JavaScript">
<![CDATA[ ]]>
</scriptColumnGenerator>
<![CDATA[
function Generator() {
var comp = libService.loadScript("vaadinComponents");
this.generate = function (itemId, columnId, item, container) {
var btn = comp.buttonIcon("Editar", function () {
var id = itemId;
engine.getField("txfCodigo").setValue(id);
if (id != null) {
engine.getGlobalVariable("changeCrudPanel")("cadastroJogo");
var config_jogos = engine.getGlobalVariable('config_jogos');
var lib = libService.loadScript('lib_cadastro_padrao');
var sql = lib.fncCarregarCampos(config_jogos, id);
}
}, "pencil");
return btn;
}
}
var script = new Generator();
]]>
</scriptColumnGenerator>
</generated>
<generated name="EXCLUIR" caption="EXCLUIR" align="CENTER">
<scriptColumnGenerator language="JavaScript">
<![CDATA[ ]]>
</scriptColumnGenerator>
<![CDATA[
function Generator() {
var comp = libService.loadScript("vaadinComponents");
this.generate = function (itemId, columnId, item, container) {
var btn = comp.buttonIcon(
"Excluir",
function () {
var lib = engine.getGlobalVariable("lib_cadastro_padrao");
var config_jogos = engine.getGlobalVariable("config_jogos");
var registro = itemId + " - " + item.getItemProperty("titulo");
var msg = "Tem certeza de que deseja excluir o jogo " + registro + "?";
var lib_msg = libService.loadScript("messages");
lib_msg.confirmationBox(
{
icon: lib_msg.confirmationIcon.question,
caption: "Confirmar operação",
msg: msg,
actions: lib_msg.confirmationControls.yes_no,
},
function(action) {
if(action.yes()) {
try {
lib.fncDeletarRegistro(config_jogos, itemId);
engine.getField("dbtJogos").refresh();
} catch (error) {
engine.getField("dbtJogos").refresh();
lib_msg.showNotification({
type: lib_msg.notificationType.tray,
caption: "Apagado!!",
msg: "O jogo foi apagado com sucesso.",
position: lib_msg.notificationPosition.bottom_right,
});
return;
}
}
}
);
},
"trash",
);
return btn;
}
}
var script = new Generator();
]]>
</scriptColumnGenerator>
</generated>
</columns>
</DBTable>
<HorizontalLayout align="MIDDLE_RIGHT" spacing="true">
<ButtonWidget id="btnNovoJogo" caption="Novo Jogo" defaultIcon="ADD" style="GREEN">
<onClickScript language="JavaScript">
<![CDATA[ ]]>
</onClickScript>
</ButtonWidget>
<ButtonWidget id="btnVerAvaliacoes" caption="Ver Avaliações" defaultIcon="STAR" style="BLUE">
<onClickScript language="JavaScript">
<![CDATA[ ]]>
</onClickScript>
</ButtonWidget>
</HorizontalLayout>
</VerticalLayout>
</Section>
</CrudPanel>
<CrudPanel id="pnlCadastroJogo" width="100%" height="100%" visible="false">
<Header>
<Caption> Cadastro de um novo jogo</Caption>
<SubCaption>Cadastro de jogo</SubCaption>
</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="pnlCadastroJogo" width="100%" 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"/>
<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="txfAnoLancamento" caption="Ano de Lançamento" type="number" width="100%" required="true">
<validation>
<script language="JavaScript">
<![CDATA[
function validate() {
var ano = this.getValue();
var anoAtual = new Date().getFullYear();
if (ano < 1950 || ano > anoAtual) {
throw new Error("Ano de lançamento inválido. Deve estar entre 1950 e " + anoAtual);
</columns>
</DBTable>
<HorizontalLayout align="MIDDLE_RIGHT" spacing="true">
<ButtonWidget defaultIcon="ADD" id="btnAdicionarJogo" style="GREEN"
caption="Novo">
<onClickScript language="JavaScript">
<![CDATA[
function run (){
engine.getGlobalVariable("changeCrudPanel")("cadastroJogo");
}
}
]]>
</script>
</validation>
</TextField>
<TextField id="txfProdutora" caption="Produtora" type="string" width="100%" required="true" maxLength="50"/>
<TextArea id="txaDescricao" caption="Descrição" type="string" width="100%" required="true" maxLength="500"/>
]]>
</onClickScript>
</ButtonWidget>
<ButtonWidget defaultIcon="STAR" id="btnVerAvaliacoes" style="ORANGE"
caption="Avaliações">
<onClickScript language="JavaScript">
<![CDATA[
function run (){
engine.getField("dbtAvaliacoes").refresh();
var idJogoSelecionado = engine.getField("dbtJogos").getValue();
engine.getGlobalVariable("showTableReviews")(idJogoSelecionado);
}
]]>
</onClickScript>
</ButtonWidget>
</HorizontalLayout>
</VerticalLayout>
</Panel>
<HorizontalLayout align="MIDDLE_RIGHT" spacing="true" >
<ButtonWidget id="btnVoltar" caption="Voltar" defaultIcon="BACK" style="BLACK">
<onClickScript language="JavaScript">
<![CDATA[ ]]>
</onClickScript>
</ButtonWidget>
<ButtonWidget id="btnLimpar" caption="Limpar" defaultIcon="REMOVE" style="BLUE">
<onClickScript language="JavaScript">
<![CDATA[ ]]>
</onClickScript>
</ButtonWidget>
<ButtonWidget id="btnSalvarJogo" caption="Salvar" defaultIcon="SAVE" style="GREEN">
<onClickScript language="JavaScript">
<![CDATA[ ]]>
</onClickScript>
</ButtonWidget>
</HorizontalLayout>
</VerticalLayout>
</Section>
</Section>
</CrudPanel>
</CrudPanel>
</VerticalLayout>
</components>
</form>
</panel-form>
<CrudPanel id="pnlCadastroJogo" width="100%" height="100%" visible="false">
<Header backgroundColor="ORANGE">
<Caption>Cadastro de jogos</Caption>
<SubCaption>Dados para cadastro de jogos</SubCaption>
</Header>
<Section caption="Novo jogo" subCaption="Informe os dados abaixo" width="100%">
<VerticalLayout width="100%" height="100%" align="MIDDLE_CENTER"
spacing="true">
<Panel id="pnlDadosJogos" width="100%" height="100%" caption="Dados do Jogo" 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" maxLength="100" />
<ComboBox id="cbbGenero" allowNullSelection="false"
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="Corrida" key="Corrida" />
<entry value="Esporte" key="Esporte" />
<entry value="Estratégia" key="Estratégia" />
<entry value="Luta" key="Luta" />
<entry value="RPG" key="RPG" />
<entry value="Simulação" key="Simulação" />
<entry value="Terror" key="Terror" />
<entry value="Sobrevivência" key="Sobrevivência" />
<entry value="Infântil" key="Infântil" />
</ComboBox>
<TextField id="txfAnoLancamento" caption="Ano de Lançamento"
type="number" width="100%" required="true" maxLength="4">
<validation>
<script language="JavaScript">
<![CDATA[
function validator(){
this.getMessage = function(){
return "O ano de lançamento deve ser um número válido entre 1970 e o ano atual.";
};
this.isValid = function(){
if(!engine.getField("txfAnoLancamento").isRequired()){
return true;
}
var value = engine.getField("txfAnoLancamento").getValue();
var currentYear = new Date().getFullYear();
return value >= 1970 && value <= currentYear;
};
}
var script = new validator();
]]>
</script>
</validation>
</TextField>
<TextField id="txfProdutora" caption="Produtora" type="string"
width="100%" required="true" maxLength="50" />
<TextArea id="txaDescricao" caption="Descrição do Jogo"
type="string" width="100%" height="" maxLength="500" />
</VerticalLayout>
</Panel>
<HorizontalLayout align="MIDDLE_RIGHT" spacing="true">
<ButtonWidget id="btnLimpar" caption="Limpar" defaultIcon="REFRESH"
style="ORANGE">
<onClickScript language="JavaScript">
<![CDATA[
function run(){
var config_jogos = engine.getGlobalVariable('config_jogos');
var lib = libService.loadScript('lib_cadastro_padrao');
var retorno = lib.fncLimpaCampos(config_jogos);
}
]]>
</onClickScript>
</ButtonWidget>
<ButtonWidget id="btnSalvar" caption="Salvar" defaultIcon="SAVE"
style="BLUE">
<onClickScript language="JavaScript">
<![CDATA[
function run() {
engine.getGlobalVariable("organizeRequiredFields")("avaliacoes", false);
if(engine.isValid()){
var config_jogos = engine.getGlobalVariable("config_jogos");
var lib = libService.loadScript("lib_cadastro_padrao");
var id = engine.getField("txfCodigo").getValue();
var retorno = lib.fncGravarRegistro(config_jogos, id);
if (retorno) {
var lib_msg = libService.loadScript("messages");
engine.getField("dbtJogos").refresh();
engine.getGlobalVariable("resetPanelGames")();
engine.getGlobalVariable("changeCrudPanel")("listaJogos");
lib_msg.showNotification({
type: lib_msg.notificationType.tray,
caption: "Sucesso!",
msg: "O jogo foi gravado com sucesso",
position: lib_msg.notificationPosition.bottom_right,
});
}
}
}
]]>
</onClickScript>
</ButtonWidget>
<ButtonWidget id="btnVoltar" caption="Voltar" defaultIcon="BACK"
style="BLACK">
<onClickScript language="JavaScript">
<![CDATA[
function run() {
engine.getGlobalVariable("changeCrudPanel")("listaJogos");
}
]]>
</onClickScript>
</ButtonWidget>
</HorizontalLayout>
</VerticalLayout>
</Section>
</CrudPanel>
</VerticalLayout>
</components>
</form>
</panel-form>
BIN
View File
Binary file not shown.
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="nome.usuario" id="id_unico_changeset">
<preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
<not>
<tableExists tableName="go_setor" />
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">CREATE TABLE tabela ()</sql>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,246 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="matheus.medeiros" id="matheus.medeiros-1">
<preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
<not>
<tableExists tableName="TB_MATHEUS_MEDEIROS_JOGOS" />
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
CREATE TABLE TB_MATHEUS_MEDEIROS_JOGOS (
CODIGO NUMERIC(10) NOT NULL,
TITULO VARCHAR(150) NOT NULL,
GENERO VARCHAR(30) NOT NULL,
ANO_LANCAMENTO NUMERIC(4) NOT NULL,
PRODUTORA VARCHAR(50) NOT NULL,
DESCRICAO VARCHAR(500) NOT NULL,
CONSTRAINT PK_MM_JOGOS PRIMARY KEY (CODIGO),
CONSTRAINT CK_MM_JOGOS_ANO
CHECK (ANO_LANCAMENTO BETWEEN 1970 AND EXTRACT(YEAR FROM CURRENT_DATE)),
CONSTRAINT CK_MM_JOGOS_TITULO
CHECK (LENGTH(TITULO) BETWEEN 3 AND 100)
);
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-2">
<preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
<not>
<sequenceExists sequenceName="TB_MATHEUS_MEDEIROS_JOGOS_SEQ" />
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
CREATE SEQUENCE TB_MATHEUS_MEDEIROS_JOGOS_SEQ
START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-4">
<preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
<not>
<tableExists tableName="TB_MATHEUS_MEDEIROS_AVALIACOES" />
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
CREATE TABLE TB_MATHEUS_MEDEIROS_AVALIACOES (
CODIGO NUMERIC(10) NOT NULL,
NOME VARCHAR(100) NOT NULL,
EMAIL VARCHAR(150) NOT NULL,
COMENTARIO VARCHAR(1000) NOT NULL,
NOTA NUMERIC(4,2) NOT NULL,
DATA_AVALIACAO DATE DEFAULT CURRENT_DATE NOT NULL,
ID_JOGO NUMERIC(10) NOT NULL,
CONSTRAINT PK_MM_AVALIACOES PRIMARY KEY (CODIGO),
CONSTRAINT FK_MM_AVAL_JOGO
FOREIGN KEY (ID_JOGO)
REFERENCES TB_MATHEUS_MEDEIROS_JOGOS (CODIGO),
CONSTRAINT CK_MM_AVAL_NOTA
CHECK (NOTA BETWEEN 0 AND 10)
);
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-3">
<preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
<not>
<sequenceExists sequenceName="TB_MATHEUS_MEDEIROS_AVALIACOES_SEQ" />
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
CREATE SEQUENCE TB_MATHEUS_MEDEIROS_AVALIACOES_SEQ
START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
</sql>
</changeSet>
<!-- ========================================================= -->
<!-- NOVOS CHANGESETS - SEM ALTERAR OS ANTIGOS -->
<!-- ========================================================= -->
<changeSet author="matheus.medeiros" id="matheus.medeiros-5">
<preConditions onError="WARN" onFail="MARK_RAN">
<tableExists tableName="TB_MATHEUS_MEDEIROS_JOGOS"/>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
ALTER TABLE TB_MATHEUS_MEDEIROS_JOGOS
ALTER COLUMN TITULO TYPE VARCHAR(100);
ALTER TABLE TB_MATHEUS_MEDEIROS_JOGOS
ALTER COLUMN DESCRICAO DROP NOT NULL;
ALTER TABLE TB_MATHEUS_MEDEIROS_JOGOS
ALTER COLUMN CODIGO SET DEFAULT NEXTVAL('TB_MATHEUS_MEDEIROS_JOGOS_SEQ');
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-6">
<preConditions onError="WARN" onFail="MARK_RAN">
<tableExists tableName="TB_MATHEUS_MEDEIROS_JOGOS"/>
<not>
<columnExists tableName="TB_MATHEUS_MEDEIROS_JOGOS" columnName="NOTA_MEDIA"/>
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
ALTER TABLE TB_MATHEUS_MEDEIROS_JOGOS
ADD COLUMN NOTA_MEDIA NUMERIC(3,1);
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-7">
<preConditions onError="WARN" onFail="MARK_RAN">
<tableExists tableName="TB_MATHEUS_MEDEIROS_JOGOS"/>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="true">
ALTER TABLE TB_MATHEUS_MEDEIROS_JOGOS
DROP CONSTRAINT IF EXISTS CK_MM_JOGOS_NOTA_MEDIA;
ALTER TABLE TB_MATHEUS_MEDEIROS_JOGOS
ADD CONSTRAINT CK_MM_JOGOS_NOTA_MEDIA
CHECK (
NOTA_MEDIA IS NULL
OR NOTA_MEDIA BETWEEN 0 AND 10
);
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-8">
<preConditions onError="WARN" onFail="MARK_RAN">
<tableExists tableName="TB_MATHEUS_MEDEIROS_AVALIACOES"/>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ALTER COLUMN COMENTARIO TYPE VARCHAR(300);
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ALTER COLUMN COMENTARIO DROP NOT NULL;
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ALTER COLUMN NOTA TYPE NUMERIC(3,1);
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ALTER COLUMN NOTA DROP NOT NULL;
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ALTER COLUMN DATA_AVALIACAO TYPE TIMESTAMP;
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ALTER COLUMN DATA_AVALIACAO SET DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ALTER COLUMN CODIGO SET DEFAULT NEXTVAL('TB_MATHEUS_MEDEIROS_AVALIACOES_SEQ');
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-9">
<preConditions onError="WARN" onFail="MARK_RAN">
<tableExists tableName="TB_MATHEUS_MEDEIROS_AVALIACOES"/>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="true">
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
DROP CONSTRAINT IF EXISTS CK_MM_AVAL_NOTA;
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ADD CONSTRAINT CK_MM_AVAL_NOTA
CHECK (
NOTA IS NULL
OR NOTA BETWEEN 0 AND 10
);
</sql>
</changeSet>
<changeSet author="matheus.medeiros" id="matheus.medeiros-10">
<preConditions onError="WARN" onFail="MARK_RAN">
<tableExists tableName="TB_MATHEUS_MEDEIROS_AVALIACOES"/>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="true">
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
DROP CONSTRAINT IF EXISTS UK_MM_AVAL_EMAIL_JOGO;
ALTER TABLE TB_MATHEUS_MEDEIROS_AVALIACOES
ADD CONSTRAINT UK_MM_AVAL_EMAIL_JOGO
UNIQUE (EMAIL, ID_JOGO);
</sql>
</changeSet>
<!-- Tabela de vendas de jogos -->
<changeSet author="matheus.medeiros" id="matheus.medeiros-11" objectQuotingStrategy="LEGACY">
<preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
<not>
<tableExists tableName="TB_MATHEUS_MEDEIROS_VENDAS_JOGOS"/>
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
CREATE TABLE TB_MATHEUS_MEDEIROS_VENDAS_JOGOS (
ID NUMERIC(10) NOT NULL,
ID_JOGO NUMERIC(10) NOT NULL,
QTD_VENDIDA NUMERIC(10) NOT NULL,
PRECO_UN NUMERIC(12,2) NOT NULL,
VALOR_TOTAL NUMERIC(14,2) NOT NULL,
VENDEDOR VARCHAR(100) NOT NULL,
NOME_CLIENTE VARCHAR(150) NOT NULL,
NOME_LOJA VARCHAR(150) NOT NULL,
DTA_VENDA TIMESTAMP NOT NULL,
CONSTRAINT PK_MM_VENDAS_JOGOS
PRIMARY KEY (ID),
CONSTRAINT FK_MM_VENDAS_JOGO
FOREIGN KEY (ID_JOGO)
REFERENCES TB_MATHEUS_MEDEIROS_JOGOS (CODIGO),
CONSTRAINT CK_MM_VENDAS_QTD
CHECK (QTD_VENDIDA > 0),
CONSTRAINT CK_MM_VENDAS_PRECO
CHECK (PRECO_UN >= 0),
CONSTRAINT CK_MM_VENDAS_TOTAL
CHECK (VALOR_TOTAL >= 0)
);
</sql>
</changeSet>
<!-- Sequência para geração automática do ID -->
<changeSet author="matheus.medeiros" id="matheus.medeiros-12">
<preConditions onError="WARN" onFail="MARK_RAN" onSqlOutput="IGNORE">
<not>
<sequenceExists
sequenceName="TB_MATHEUS_MEDEIROS_VENDAS_JOGOS_SEQ"/>
</not>
</preConditions>
<sql endDelimiter=";" splitStatements="true" stripComments="false">
CREATE SEQUENCE TB_MATHEUS_MEDEIROS_VENDAS_JOGOS_SEQ
START WITH 1
INCREMENT BY 1
CACHE 1
NO CYCLE;
</sql>
</changeSet>
</databaseChangeLog>