<?php
$pageRef='Patients';
include('includes/header.php');
?>
<script>
function showPetDetails(elem){
var args = elem.name.split("_");
var petId = args[0];
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/viewPatientDetailed.php?pet='+petId;
}
function showClientDetails(elem){
var args = elem.name.split("_");
var clientId = args[0];
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/viewClientDetailed.php?cl='+clientId;
}
function setPetEventHandler(){
//Stick the showPetDetails handler to the click event of all select objects of class aPetName
setTimeout("$$('a.aPetName').each(function(s){Event.observe(s,'click',function(){showPetDetails(s);})})", 1);
//Stick the showClientDetails handler to the click event of all select objects of class aClientNominative
setTimeout("$$('a.aClientNominative').each(function(s){Event.observe(s,'click',function(){showClientDetails(s);})})", 1);
}
</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="#">Menu label</a></li> -->
</ul>
</div>
</div>
</div>
<!-- *********************************************************** -->
<!-- * Search 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("Search for patient") ?></span></span><div class="BlockContentBorder">
<form id="formToValidate">
<table width="100%">
<tr><td style="width:10%;" colspan="2"><?php echo _T("Name") ?></td> <td align="center" style="width:90%;"><input style="width:80%; font-size:0.8em;" id="pName" type="text"/></td> </tr>
<tr><td style="width:10%;" colspan="2"><?php echo _T("Species") ?></td> <td align="center" style="width:90%;"><input style="width:80%; font-size:0.8em;" id="pSpecies" type="text"/></td> </tr>
<tr><td style="width:10%;" colspan="2"><?php echo _T("Breed") ?></td> <td align="center" style="width:90%;"><input style="width:80%; font-size:0.8em;" id="pBreed" type="text"/></td> </tr>
<tr><td style="width:10%;"><?php echo _T("Age") ?></td> <td><select id="pSearchOpt" style="font-size:0.8em;"><option value="0"><?php echo"≥"; ?></option><option value="1"><?php echo"≤"; ?></option><option value="2">=</option></select></td><td style="width=90%" align="center"><input class="validate-number" style="width:80%; font-size:0.8em;" id="pAge" type="text" title="<?php echo _T("NI_patients_I"); ?>" /></td> </tr>
<tr><td style="width:10%;" colspan="2"><?php echo _T("Year") ?></td> <td align="center" style="width:90%;"><input class="validate-number" style="width:80%; font-size:0.8em;" id="pBirthYear" type="text" title="<?php echo _T("NI_patients_I"); ?>" /></td> </tr>
</table>
</form>
</div>
</div>
</div>
</div>
<div class="MainColumn">
<!-- *********************************************************** -->
<!-- * Pets table * -->
<!-- *********************************************************** -->
<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("Patients list") ?></span></span><div class="BlockContentBorder" id="petTable">
</div>
</div>
</div>
</div>
</div>
<script>
// ************************************************************
// * Observe window load event to call the init page function *
// ************************************************************
Event.observe(window, 'load', function(){
// ******************************************
// * Load patients table for the first time *
// ******************************************
OL_petTableLoad('', '', '', '', '', '0', {elementToFill: 'petTable', onSuccess: setPetEventHandler});
// **************************
// * Install event handlers *
// **************************
Event.observe('pName', 'keyup', function(){if(formValidationRules.validate()){OL_petTableLoad($F('pName'), $F('pSpecies'), $F('pBreed'), $F('pAge'), $F('pBirthYear'), $F('pSearchOpt'), {elementToFill: 'petTable', onSuccess: setPetEventHandler});}});
Event.observe('pSpecies', 'keyup', function(){if(formValidationRules.validate()){OL_petTableLoad($F('pName'), $F('pSpecies'), $F('pBreed'), $F('pAge'), $F('pBirthYear'), $F('pSearchOpt'), {elementToFill: 'petTable', onSuccess: setPetEventHandler});}});
Event.observe('pBreed', 'keyup', function(){if(formValidationRules.validate()){OL_petTableLoad($F('pName'), $F('pSpecies'), $F('pBreed'), $F('pAge'), $F('pBirthYear'), $F('pSearchOpt'), {elementToFill: 'petTable', onSuccess: setPetEventHandler});}});
Event.observe('pAge', 'keyup', function(){if(formValidationRules.validate()){OL_petTableLoad($F('pName'), $F('pSpecies'), $F('pBreed'), $F('pAge'), $F('pBirthYear'), $F('pSearchOpt'), {elementToFill: 'petTable', onSuccess: setPetEventHandler});}});
Event.observe('pBirthYear', 'keyup', function(){if(formValidationRules.validate()){OL_petTableLoad($F('pName'), $F('pSpecies'), $F('pBreed'), $F('pAge'), $F('pBirthYear'), $F('pSearchOpt'), {elementToFill: 'petTable', onSuccess: setPetEventHandler});}});
Event.observe('pSearchOpt', 'change', function(){if(formValidationRules.validate()){OL_petTableLoad($F('pName'), $F('pSpecies'), $F('pBreed'), $F('pAge'), $F('pBirthYear'), $F('pSearchOpt'), {elementToFill: 'petTable', onSuccess: setPetEventHandler});}});
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>