Commit 80cdc170 authored by mc16's avatar mc16

JAR e projeto novo

parent 2b25af76
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
td{outline-style:solid; outline-width : 2px;
}
.ui-dialog{
min-width:500px;
}
center{padding:2px;}
#data_nota{
width:100%;
}
</style>
<link rel="stylesheet" href="jquery-ui.css" />
<script src="jquery-1.9.1.js"></script>
<script src="jquery-ui.js"></script>
<script src="model/Empresa.js"></script>
<script src="model/Conjunto.js"></script>
<script src="model/DadosEmpresa.js"></script>
<script src="model/MediaRef.js"></script>
<script src="model/NecessidadesNutr.js"></script>
<script src="model/TipoCardapio.js"></script>
<script src="model/Mercadoria.js"></script>
<script src="model/Nota.js"></script>
</head>
</body>
<div id="cadastraNota" title="Dados da nota fiscal" style="display:none">
<table>
<input type=hidden id="dadosNota_id">
<tr><td><input type=text id="numero_nota" placeholder="Numero da nota"></td></tr>
<tr><td><center><input type=date id="data_nota" placeholder="Data"></center></td></tr>
<tr><td><input type=text id="fornecedor_nota" placeholder="Fornecedor"></td></tr>
<tr><td><input type=text id="quantidade_nota" placeholder="Quantidade"></td></tr>
<tr><td><input type=text id="precoMedio_nota" placeholder="Preço médio"></td></tr>
<tr>
<td>
<tbody id = "tmercadorias">
</tbody>
</td>
</tr>
<tr><td><button id="cadastraDadosNota">Salvar</button> <button class="cancelaEditaEmpresa">Cancelar</button></td> </tr>
</table>
</div>
<div id="cadastraMercadoria" title="Dados da mercadoria" style="display:none">
<table>
<input type=hidden id="dadosMercadoria_id">
<tr><td><input type=text id="nome_mercadoria" placeholder="Nome"></td></tr>
<tr><td><input type=text id="medida_mercadoria" placeholder="Valor de unidade"></td></tr>
<tr><td><button id="cadastraDadosMercadoria">Salvar</button> <button class="cancelaEditaEmpresa">Cancelar</button></td> </tr>
</table>
</div>
<div id="verNota" title="Nota" style="display:none">
</div>
<thead>
<table>
<tr>
<td>
<button id="adicionaMercadoria" >Adicionar Mercadoria</button>
</td>
<td>
<button id="adicionaNota" >Adicionar Nota Fiscal</button>
</td>
</tr>
<tr>
<td>
<select id="lista_removeProduto"></select>
<input id="quantidade_removeProduto"type="number" placeholder="Quantidade">
</td>
<td>
<button id="retira_produto">Retirar produto</button>
</td>
</tr>
</table>
<br>
<table>
<thead>
<tr><td>Produto</td><td>Quantidade</td><td>Notas</td></tr>
</thead>
<tbody id="estoque_list">
</tbody>
</table>
<script src="estoque.js">
</script>
</html>
ListaMercadorias = []
ListaNotas = []
function replaceAll(str, de, para){
var pos = str.indexOf(de);
while (pos > -1){
str = str.replace(de, para);
pos = str.indexOf(de);
}
return (str);
}
$("#retira_produto").click( function(){
var produto = lista_removeProduto.options[lista_removeProduto.selectedIndex].value;
var quantidade = parseFloat(quantidade_removeProduto.value);
for(var i in ListaMercadorias){
if(ListaMercadorias[i].getNome() == produto){
ListaMercadorias[i].setQuantidade(
ListaMercadorias[i].getQuantidade()-quantidade
);
}
}
reloadTableMercadoria();
});
function notas_to_options(){
var options = "";
for(var i in ListaMercadorias){
var nome = ListaMercadorias[i].getNome();
options+= "<option value="+nome+">"+nome+"</option>";
}
return options;
}
function verNotas(produto){
var notas = "";
for(var i in ListaNotas){
var nota = ListaNotas[i];
if(nota.getProduto() == produto){
notas+="Número: "+nota.getNumero()+"<br>";
notas+="Data: "+nota.getData()+"<br>";
notas+="Quantidade: "+nota.getQuantidade()+"<br>";
notas+="Fornecedor: "+nota.getFornecedor()+"<br>";
notas+="Valor unitário: "+nota.getValorUnitario()+"<br>";
notas+="<br>";
}
}
$("#verNota").html(notas);
$("#verNota").dialog();
}
function reloadTableMercadoria(){
estoque_list.innerHTML="";
for(var i in ListaMercadorias){
var line = "<tr>";
line += "<td>"+ListaMercadorias[i].getNome()+"</td>";
line += "<td>"+ListaMercadorias[i].getQuantidade()+" ";
line += ListaMercadorias[i].getMedida()+"</td>";
line += "<td><button onClick=verNotas('"+ListaMercadorias[i].getNome()+"');> Ver notas </button></td>";
line += "</tr>";
estoque_list.innerHTML+=line;
}
}
function cadastraMercadoria()
{
ListaMercadorias.push(new Mercadoria(
document.getElementById("nome_mercadoria").value,
document.getElementById("medida_mercadoria").value,
0
));
reloadTableMercadoria();
lista_removeProduto.innerHTML = notas_to_options();
}
function cadastraNota()
{
var e = document.getElementById("mercadoriaEscolhida");
var selecionado= e.options[e.selectedIndex].value;
ListaNotas.push(new NotaFiscal(
document.getElementById("numero_nota").value,
document.getElementById("data_nota").value,
document.getElementById("quantidade_nota").value,
document.getElementById("fornecedor_nota").value,
document.getElementById("precoMedio_nota").value,
selecionado
));
var value = document.getElementById("quantidade_nota").value;
value = parseFloat(value);
for(var i in ListaMercadorias){
if(ListaMercadorias[i].getNome() == selecionado){
ListaMercadorias[i].setQuantidade(
value+ListaMercadorias[i].getQuantidade()
);
}
}
reloadTableMercadoria();
console.log(ListaNotas);
}
$("#adicionaMercadoria").click(function(){
$("#cadastraMercadoria").dialog();
});
$("#adicionaNota").click(function(){
downs = "<form> <select id=mercadoriaEscolhida>";
for(var element in ListaMercadorias)
{
downs += "<option value="+replaceAll( ListaMercadorias[element].getNome(), " ","")+">"+ ListaMercadorias[element].getNome() +"</option>"
}
downs+= "</select> </form>";
document.getElementById("tmercadorias").innerHTML = downs;
$("#cadastraNota").dialog();
});
$("#cadastraDadosMercadoria").click(function(){
cadastraMercadoria();
$(".ui-button").click();
});
$("#cadastraDadosNota").click(function(){
cadastraNota();
$(".ui-button").click();
});
$(".cancelaEditaEmpresa").click( function(){
$(".ui-button").click();
});
This source diff could not be displayed because it is too large. You can view the blob instead.
/*! jQuery UI - v1.10.3 - 2013-05-03
* http://jqueryui.com
* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
/* Layout helpers
----------------------------------*/
.ui-helper-hidden {
display: none;
}
.ui-helper-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.ui-helper-reset {
margin: 0;
padding: 0;
border: 0;
outline: 0;
line-height: 1.3;
text-decoration: none;
font-size: 100%;
list-style: none;
}
.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
content: "";
display: table;
border-collapse: collapse;
}
.ui-helper-clearfix:after {
clear: both;
}
.ui-helper-clearfix {
min-height: 0; /* support: IE7 */
}
.ui-helper-zfix {
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0);
}
.ui-front {
z-index: 100;
}
/* Interaction Cues
----------------------------------*/
.ui-state-disabled {
cursor: default !important;
}
/* Icons
----------------------------------*/
/* states and images */
.ui-icon {
display: block;
text-indent: -99999px;
overflow: hidden;
background-repeat: no-repeat;
}
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.ui-accordion .ui-accordion-header {
display: block;
cursor: pointer;
position: relative;
margin-top: 2px;
padding: .5em .5em .5em .7em;
min-height: 0; /* support: IE7 */
}
.ui-accordion .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-noicons {
padding-left: .7em;
}
.ui-accordion .ui-accordion-icons .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
position: absolute;
left: .5em;
top: 50%;
margin-top: -8px;
}
.ui-accordion .ui-accordion-content {
padding: 1em 2.2em;
border-top: 0;
overflow: auto;
}
.ui-autocomplete {
position: absolute;
top: 0;
left: 0;
cursor: default;
}
.ui-button {
display: inline-block;
position: relative;
padding: 0;
line-height: normal;
margin-right: .1em;
cursor: pointer;
vertical-align: middle;
text-align: center;
overflow: visible; /* removes extra width in IE */
}
.ui-button,
.ui-button:link,
.ui-button:visited,
.ui-button:hover,
.ui-button:active {
text-decoration: none;
}
/* to make room for the icon, a width needs to be set here */
.ui-button-icon-only {
width: 2.2em;
}
/* button elements seem to need a little more width */
button.ui-button-icon-only {
width: 2.4em;
}
.ui-button-icons-only {
width: 3.4em;
}
button.ui-button-icons-only {
width: 3.7em;
}
/* button text element */
.ui-button .ui-button-text {
display: block;
line-height: normal;
}
.ui-button-text-only .ui-button-text {
padding: .4em 1em;
}
.ui-button-icon-only .ui-button-text,
.ui-button-icons-only .ui-button-text {
padding: .4em;
text-indent: -9999999px;
}
.ui-button-text-icon-primary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 1em .4em 2.1em;
}
.ui-button-text-icon-secondary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 2.1em .4em 1em;
}
.ui-button-text-icons .ui-button-text {
padding-left: 2.1em;
padding-right: 2.1em;
}
/* no icon support for input elements, provide padding by default */
input.ui-button {
padding: .4em 1em;
}
/* button icon element(s) */
.ui-button-icon-only .ui-icon,
.ui-button-text-icon-primary .ui-icon,
.ui-button-text-icon-secondary .ui-icon,
.ui-button-text-icons .ui-icon,
.ui-button-icons-only .ui-icon {
position: absolute;
top: 50%;
margin-top: -8px;
}
.ui-button-icon-only .ui-icon {
left: 50%;
margin-left: -8px;
}
.ui-button-text-icon-primary .ui-button-icon-primary,
.ui-button-text-icons .ui-button-icon-primary,
.ui-button-icons-only .ui-button-icon-primary {
left: .5em;
}
.ui-button-text-icon-secondary .ui-button-icon-secondary,
.ui-button-text-icons .ui-button-icon-secondary,
.ui-button-icons-only .ui-button-icon-secondary {
right: .5em;
}
/* button sets */
.ui-buttonset {
margin-right: 7px;
}
.ui-buttonset .ui-button {
margin-left: 0;
margin-right: -.3em;
}
/* workarounds */
/* reset extra padding in Firefox, see h5bp.com/l */
input.ui-button::-moz-focus-inner,
button.ui-button::-moz-focus-inner {
border: 0;
padding: 0;
}
.ui-datepicker {
width: 17em;
padding: .2em .2em 0;
display: none;
}
.ui-datepicker .ui-datepicker-header {
position: relative;
padding: .2em 0;
}
.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
position: absolute;
top: 2px;
width: 1.8em;
height: 1.8em;
}
.ui-datepicker .ui-datepicker-prev-hover,
.ui-datepicker .ui-datepicker-next-hover {
top: 1px;
}
.ui-datepicker .ui-datepicker-prev {
left: 2px;
}
.ui-datepicker .ui-datepicker-next {
right: 2px;
}
.ui-datepicker .ui-datepicker-prev-hover {
left: 1px;
}
.ui-datepicker .ui-datepicker-next-hover {
right: 1px;
}
.ui-datepicker .ui-datepicker-prev span,
.ui-datepicker .ui-datepicker-next span {
display: block;
position: absolute;
left: 50%;
margin-left: -8px;
top: 50%;
margin-top: -8px;
}
.ui-datepicker .ui-datepicker-title {
margin: 0 2.3em;
line-height: 1.8em;
text-align: center;
}
.ui-datepicker .ui-datepicker-title select {
font-size: 1em;
margin: 1px 0;
}
.ui-datepicker select.ui-datepicker-month-year {
width: 100%;
}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year {
width: 49%;
}
.ui-datepicker table {
width: 100%;
font-size: .9em;
border-collapse: collapse;
margin: 0 0 .4em;
}
.ui-datepicker th {
padding: .7em .3em;
text-align: center;
font-weight: bold;
border: 0;
}
.ui-datepicker td {
border: 0;
padding: 1px;
}
.ui-datepicker td span,
.ui-datepicker td a {
display: block;
padding: .2em;
text-align: right;
text-decoration: none;
}
.ui-datepicker .ui-datepicker-buttonpane {
background-image: none;
margin: .7em 0 0 0;
padding: 0 .2em;
border-left: 0;
border-right: 0;
border-bottom: 0;
}
.ui-datepicker .ui-datepicker-buttonpane button {
float: right;
margin: .5em .2em .4em;
cursor: pointer;
padding: .2em .6em .3em .6em;
width: auto;
overflow: visible;
}
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
float: left;
}
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi {
width: auto;
}
.ui-datepicker-multi .ui-datepicker-group {
float: left;
}
.ui-datepicker-multi .ui-datepicker-group table {
width: 95%;
margin: 0 auto .4em;
}
.ui-datepicker-multi-2 .ui-datepicker-group {
width: 50%;
}
.ui-datepicker-multi-3 .ui-datepicker-group {
width: 33.3%;
}
.ui-datepicker-multi-4 .ui-datepicker-group {
width: 25%;
}
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
border-left-width: 0;
}
.ui-datepicker-multi .ui-datepicker-buttonpane {
clear: left;
}
.ui-datepicker-row-break {
clear: both;
width: 100%;
font-size: 0;
}
/* RTL support */
.ui-datepicker-rtl {
direction: rtl;
}
.ui-datepicker-rtl .ui-datepicker-prev {
right: 2px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next {
left: 2px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-prev:hover {
right: 1px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next:hover {
left: 1px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane {
clear: right;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button {
float: left;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
.ui-datepicker-rtl .ui-datepicker-group {
float: right;
}
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
border-right-width: 0;
border-left-width: 1px;
}
.ui-dialog {
position: absolute;
top: 0;
left: 0;
padding: .2em;
outline: 0;
}
.ui-dialog .ui-dialog-titlebar {
padding: .4em 1em;
position: relative;
}
.ui-dialog .ui-dialog-title {
float: left;
margin: .1em 0;
white-space: nowrap;
width: 90%;
overflow: hidden;
text-overflow: ellipsis;
}
.ui-dialog .ui-dialog-titlebar-close {
position: absolute;
right: .3em;
top: 50%;
width: 21px;
margin: -10px 0 0 0;
padding: 1px;
height: 20px;
}
.ui-dialog .ui-dialog-content {
position: relative;
border: 0;
padding: .5em 1em;
background: none;
overflow: auto;
}
.ui-dialog .ui-dialog-buttonpane {
text-align: left;
border-width: 1px 0 0 0;
background-image: none;
margin-top: .5em;
padding: .3em 1em .5em .4em;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
float: right;
}
.ui-dialog .ui-dialog-buttonpane button {
margin: .5em .4em .5em 0;
cursor: pointer;
}
.ui-dialog .ui-resizable-se {
width: 12px;
height: 12px;
right: -5px;
bottom: -5px;
background-position: 16px 16px;
}
.ui-draggable .ui-dialog-titlebar {
cursor: move;
}
.ui-menu {
list-style: none;
padding: 2px;
margin: 0;
display: block;
outline: none;
}
.ui-menu .ui-menu {
margin-top: -3px;
position: absolute;
}
.ui-menu .ui-menu-item {
margin: 0;
padding: 0;
width: 100%;
/* support: IE10, see #8844 */
list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
}
.ui-menu .ui-menu-divider {
margin: 5px -2px 5px -2px;
height: 0;
font-size: 0;
line-height: 0;
border-width: 1px 0 0 0;
}
.ui-menu .ui-menu-item a {
text-decoration: none;
display: block;
padding: 2px .4em;
line-height: 1.5;
min-height: 0; /* support: IE7 */
font-weight: normal;
}
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;