[go: up one dir, main page]

Menu

[r3]: / newProduct.php  Maximize  Restore  History

Download this file

114 lines (100 with data), 5.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
$pageRef='Stock';
include('includes/header.php');
?>
<script>
function successInCreatingProductF(transport){
var args=transport.responseText.evalJSON();
//Success in update request
//Operation result advice
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
window.location.href = 'http://127.0.0.1/Oreste/stock.php';
}
}
function failureInCreatingProductF(){
// ***************************************************************************************************************************************************
// * Alert sentence: 'An error occurred during the update request to server'
// ***************************************************************************************************************************************************
alert('<?php echo _T("NI_newProduct_"); ?>');
}
function createProduct(){
var name = $F('name');
var description = $F('description');
var cost = $F('cost');
var price = $F('price');
var position = $F('position');
var barcode = $F('barcode');
var cliniccode = $F('cliniccode');
var quantity = $F('quantity');
var threshold = $F('threshold');
if(formValidationRules.validate()){
OL_createNewProduct(name, description, cost, price, position, barcode, cliniccode, quantity, threshold, {onSuccess: successInCreatingProductF, onFailure: failureInCreatingProductF});
}else{
alert('<?php echo _T("NI_newProduct_"); ?>');
}
}
function backToStock(){
window.location.href = 'http://127.0.0.1/Oreste/stock.php';
}
</script>
<div id="qResult" class="OpResult"></div>
<div class="Columns">
<div class="Column1">
<!-- *********************************************************** -->
<!-- * Menu tab * -->
<!-- *********************************************************** -->
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("Actions") ?></span></span><div class="BlockContentBorder">
<ul>
<li><a href="javascript:createProduct();"><?php echo _T("Save product") ?></a></li>
<li><a href="javascript:backToStock();"><?php echo _T("Stock") ?></a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="MainColumn">
<!-- *********************************************************** -->
<!-- * Product properties tab * -->
<!-- *********************************************************** -->
<form id="formToValidate">
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("New product") ?></span></span><div class="BlockContentBorder">
<table width="100%">
<tr><td width="10%"><b><?php echo _T("Name") ?> :</b></td><td><input type="text" class="required" style="width:100%" id="name"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Description") ?> :</b></td><td><input type="text" style="width:100%" id="description"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Cost") ?> :</b></td><td><input type="text" class="validate-number" style="width:100%" id="cost"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Price") ?> :</b></td><td><input type="text" class="validate-number" style="width:100%" id="price"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Position") ?> :</b></td><td><input type="text" style="width:100%" id="position"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Bar code") ?> :</b></td><td><input type="text" style="width:100%" id="barcode"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Clinic code") ?> :</b></td><td><input type="text" style="width:100%" id="cliniccode"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Quantity") ?> :</b></td><td><input type="text" class="validate-number" style="width:100%" id="quantity"></td> <td width="10%"></td><td width="50%"></td></tr>
<tr><td width="10%"><b><?php echo _T("Threshold") ?> :</b></td><td><input type="text" class="validate-number" style="width:100%" id="threshold"></td> <td width="10%"></td><td width="50%"></td></tr>
</table>
</div>
</div>
</div>
</form>
</div>
</div>
<script>
// ************************************************************
// * Observe window load event to call the init page function *
// ************************************************************
Event.observe(window, 'load', function(){
// **************************
// * Install event handlers *
// **************************
Event.observe('qResult', 'mouseover', function(){OL_makeThisElementInvisible('qResult');});
// **********************
// * Install validators *
// **********************
formValidationRules = new Validation('formToValidate',{immediate:true, onSubmit:false, useTitles:true, stopOnFirst:false});
});
</script>
<!-- tags opened in the header -->
</div>
</div>
</div>
</body>
</html>