<?php
$pageRef='Stock';
include('includes/header.php');
?>
<script>
function successInCreatingSupplierF(transport){
var args=transport.responseText.evalJSON();
//Success in create request
//Operation result advice
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
//Success in create operation
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/suppliers.php';
}else{
//Failure in create operation
}
}
function failureInCreatingSupplierF(){
//Failure in create request
alert('<?php echo _T("NI_newSupplier_I"); ?>');
}
function createSupplier(){
var name = $F('name'); //01
var add1 = $F('add1'); //02
var add2 = $F('add2'); //03
var add3 = $F('add3'); //04
var telephone = $F('telephone'); //05
var fax = $F('fax'); //06
var mobile = $F('mobile'); //07
var website = $F('website'); //08
var email = $F('email'); //09
var referent = $F('referent'); //10
//Validazione dati
if(formValidationRules.validate()){
OL_createNewSupplier(name, add1, add2, add3, telephone, fax, mobile, website, email, referent, {onSuccess: successInCreatingSupplierF, onFailure: failureInCreatingSupplierF});
}else{
// ***************************************************************************************************************************************************
// * Alert sentence: 'There are invalid fields (look at tips in the form)'
// ***************************************************************************************************************************************************
alert('<?php echo _T("NI_newSupplier_II"); ?>');
}
}
function supplierList(){
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/suppliers.php';
}
</script>
<div id="qResult" class="OpResult"></div>
<div class="Columns">
<div class="Column1">
<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>
<?php echo "<li><a href=\"javascript:createSupplier();\">" . _T("Save supplier") . "</a></li>"; ?>
<?php echo "<li><a href=\"javascript:supplierList();\">" . _T("Supplier list") . "</a></li>"; ?>
</ul>
</div>
</div>
</div>
</div>
<div class="MainColumn">
<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 supplier") ?></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" title="<?php echo _T("NI_newSupplier_III") ?>" style="width:100%" id="name"></td></tr>
<tr><td width="10%"><b><?php echo _T("Address") ?>1 :</b></td><td><input type="text" style="width:100%" id="add1"></td></tr>
<tr><td width="10%"><b><?php echo _T("Address") ?>2 :</b></td><td><input type="text" style="width:100%" id="add2"></td></tr>
<tr><td width="10%"><b><?php echo _T("Address") ?>3 :</b></td><td><input type="text" style="width:100%" id="add3"></td></tr>
<tr><td width="10%"><b><?php echo _T("Telephone") ?> :</b></td><td><input type="text" class="validate-number" title="<?php echo _T("NI_newSupplier_IV") ?>" style="width:100%" id="telephone"></td></tr>
<tr><td width="10%"><b><?php echo _T("Fax") ?> :</b></td><td><input type="text" class="validate-number" title="<?php echo _T("NI_newSupplier_V") ?>" style="width:100%" id="fax"></td></tr>
<tr><td width="10%"><b><?php echo _T("Mobile") ?> :</b></td><td><input type="text" class="validate-number" title="<?php echo _T("NI_newSupplier_VI") ?>" style="width:100%" id="mobile"></td></tr>
<tr><td width="10%"><b><?php echo _T("Website") ?> :</b></td><td><input type="text" style="width:100%" id="website"></td></tr>
<tr><td width="10%"><b><?php echo _T("Em@il") ?> :</b></td><td><input type="text" class="validate-email" title="<?php echo _T("NI_newSupplier_VII") ?>" style="width:100%" id="email"></td></tr>
<tr><td width="10%"><b><?php echo _T("Referent") ?> :</b></td><td><input type="text" style="width:100%" id="referent"></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 validator *
// *********************
formValidationRules = new Validation('formToValidate',{immediate:true, onSubmit:false, useTitles:true, stopOnFirst:false});
});
</script>
<!-- tags opened in the header -->
</div>
</div>
</div>
</body>
</html>