Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <script type='text/javascript'>
- $(document).ready(
- function() {
- $('input#tmpAddRow').click(
- function() {
- var newRow = $('tr#tmp').clone(true).removeAttr('id');
- newRow.find("select").each( function() {
- $(this).children(':first').attr('selected', 'selected');
- });
- newRow.find("input:text").val("");
- newRow.find("input:checkbox").removeAttr('checked');
- newRow.appendTo('.crop tbody');
- $('tr#tmp').closest('table').find('input:text.date').each(function() {
- $(this).removeClass('hasDatepick').datepick({dateFormat: 'dd/mm/yyyy'});
- });
- arrangeCheckboxNames();
- arrangeRadioNames();
- arrangedeleteid();
- }
- );
- $('tr input[type=text]').focus(
- function() {
- $(this).addClass('myFocused');
- }
- ).blur(
- function() {
- $(this).removeClass('myFocused');
- }
- );
- $('.delete-icon').click(function() {
- $(this).closest('tr').remove();
- arrangeCheckboxNames();
- });
- $(".date").datepick({dateFormat: 'dd/mm/yyyy'});
- }
- );
- var arrangeCheckboxNames = function() {
- var length = 1;
- $('tr#tmp').find('input:checkbox').val(length);
- length++;
- $('tr#tmp').nextAll('tr').each( function() {
- $(this).find('input:checkbox').val(length);
- length++;
- });
- };
- var arrangeRadioNames = function() {
- var length = 1;
- $('tr#tmp').find('input:radio').val(length);
- length++;
- $('tr#tmp').nextAll('tr').each( function() {
- $(this).find('input:radio').val(length);
- length++;
- });
- };
- var arrangedeleteid = function() {
- var length = 1;
- $(this).find('img.delete-icon').attr( 'id', 'image'+length );
- length++;
- $('tr#tmp').nextAll('tr').each( function() {
- $(this).find('img.delete-icon').attr( 'id', 'image'+length );
- length++;
- });
- };
- $(document).ready(function() {
- $('#pluginForm').submit(function(e) {
- var isValid = true;
- $(this).find(':text.required').each(function() {
- if($(this).val().replace(/^\s+|\s+$/g,"") == "") {
- isValid = false;
- if($(this).next('span').length == 0 ) {
- $(this).after('<span style="color: #FF0000">Field is required</span>');
- }
- e.preventDefault();
- return;
- } else {
- if($(this).next('span').length > 0 )
- $(this).next('span').remove();
- }
- });
- $(this).find(':text.numeric').each(function() {
- var regex = new RegExp(/^[1-9][0-9]*$/);
- if(!regex.test($(this).val()) && isValid) {
- isValid = false;
- if($(this).next('span').length == 0 ) {
- $(this).after('<span style="color: #FF0000">Numeric Data allowed only.</span>');
- }
- e.preventDefault();
- return;
- } else {
- if($(this).next('span').length > 0 && isValid)
- $(this).next('span').remove();
- }
- });
- });
- });
- </script>
- <style type="text/css">
- * { font-family: Verdana; font-size: 96%; }
- label { width: 10em; float: left; }
- label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
- p { clear: both; }
- .submit { margin-left: 12em; }
- em { font-weight: bold; padding-right: 1em; vertical-align: top; }
- </style>
- </head>
- <table id="hor-minimalist-b" border="1" bgcolor="#F8F8F8">
- <tr>
- <th><?php echo $this->translate("Family information"); ?></th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- <?php
- $convertdate = new App_Model_dateConvertor();
- foreach($this->membername as $family_view){ ?>
- <tr>
- <td ><?php echo $this->translate("Family ID:"); ?></td>
- <td ><?php echo $family_view['family_id']; ?></td>
- <td ><?php echo $this->translate("Caste:"); ?></td>
- <td ><?php echo $family_view['subcaste']; ?></td> </tr>
- <tr>
- <td ><?php echo $this->translate("House No:"); ?></td>
- <td ><?php echo $family_view['house_no']; ?></td>
- <td ><?php echo $this->translate("Ration card:"); ?></td>
- <td ><?php echo $family_view['ration']; ?></td>
- </tr>
- <tr>
- <td ><?php echo $this->translate("Street/Road/Lane:"); ?></td>
- <td ><?php echo $family_view['street']; ?></td>
- <td ><?php echo $this->translate("Health Insurance:"); ?></td>
- <td ><?php foreach($this->insurance as $insurance){ echo $insurance['insurancename']; echo "<br>";
- }?></td>
- </tr>
- <tr>
- <td ><?php echo $this->translate("Colony/Village:"); ?></td>
- <td ><?php echo $family_view['villagename']; ?></td>
- <td ><?php echo $this->translate("NREGS Job Card No:"); ?></td>
- <td ><?php echo $family_view['nregs_jobno']; ?></td> </tr>
- <tr>
- <td ><?php echo $this->translate("Rev Village:"); ?></td>
- <td ><?php echo $this->revvillagename; ?></td>
- <td ><?php echo $this->translate("Major source of income:"); ?></td>
- <td ><?php echo $family_view['income']; ?></td>
- </tr>
- <tr>
- <td ><?php echo $this->translate("Family type:"); ?></td>
- <td ><?php echo $family_view['familytype']; ?></td>
- <td ><?php echo $this->translate("Contact Phone:"); ?></td>
- <td ><?php echo $family_view['mobile']; ?></td>
- </tr>
- <tr>
- <td ><?php echo $this->translate("Category:"); ?></td>
- <td ><?php echo $family_view['caste']; ?></td>
- <td ><?php echo $this->translate("Mobile:"); ?></td>
- <td ><?php echo $family_view['mobile']; ?></td>
- </tr>
- <?php } ?>
- </table>
- <br/>
- <!-- for Agriculture view -->
- <div>
- <?php if($this->agriculture){ ?>
- <table id="hor-minimalist-b" border="1">
- <tr>
- <th align="right"><?php echo $this->translate("Land holding"); ?></th>
- <th align="right"><?php echo $this->translate("Acre"); ?></th>
- <th align="right"><?php echo $this->translate("Gunta"); ?></th>
- <th align="right"><?php echo $this->translate("name of owner"); ?></th>
- <th align="right"><?php echo $this->translate("Survey No"); ?></th>
- <th align="right"><?php echo $this->translate("Village"); ?></th>
- </tr>
- <?php $i =1; foreach($this->agriculture as $agri){ ?>
- <tr>
- <td><?php echo $agri['name']; ?></td>
- <td align="right"><?php echo $agri['acre']; ?></td>
- <td align="right"><?php echo $agri['gunta']; ?></td>
- <td><?php echo $agri['membername']; ?></td>
- <td align="right"><?php echo $agri['survey_no']; ?></td>
- <td><?php echo $agri['villagename']; ?></td>
- </tr>
- <?php } ?>
- <tr>
- <?php foreach($this->acretotal as $total){ ?>
- <td><?php echo $this->translate("Total"); ?></td>
- <td align="right"><?php echo $total['total']; ?></td>
- <?php } ?>
- <?php foreach($this->guntatotal as $gunta){ ?>
- <td align="right"><?php echo $gunta['total']; ?></td>
- <?php } ?>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- </table>
- <?php } ?>
- </div>
- <br>
- <div style="height:250px; width:750px; overflow-x:scroll ; overflow-y: scroll; padding-bottom:10px;">
- <form name="form1" id = "pluginForm" action="<?php echo $this->baseUrl();?>/crop/index/editcrop/id/<?php echo $this->id; ?>/subId/<?php echo 1; ?>/modId/<?php echo 2; ?>" method="POST">
- <table id="hor-minimalist-b" class="crop">
- <tr>
- <th ><?php echo $this->translate("Crop"); ?></th>
- <th ></th>
- <th ><?php echo $this->translate("Acre"); ?></th>
- <th ><?php echo $this->translate("Gunta"); ?></th>
- <th ><?php echo $this->translate("Unit"); ?></th>
- <th ><?php echo $this->translate("Quantity produced in units"); ?></th>
- <th ><?php echo $this->translate("Quantity sold in units"); ?></th>
- <th ><?php echo $this->translate("Price per units"); ?></th>
- <th ><?php echo $this->translate("Price realised"); ?></th>
- <th ></th>
- <th ><?php echo $this->translate("Sold date"); ?></th>
- <th ><?php echo $this->translate("Action"); ?></th>
- </tr>
- <?php $i = 0; ?>
- <?php foreach ($this->editCrop as $editCrop) { $i++;?>
- <?php if ($i == 1) { ?>
- <tr id='tmp'>
- <?php } else { ?>
- <tr>
- <?php } ?>
- <td><select name = "crop_id[]">
- <OPTION value="<?php echo $editCrop["crop_id"]; ?>">
- <?php echo $editCrop["name"]; ?>
- </OPTION>
- <?php foreach ($this->cropdetails as $cropdetails) { ?>
- <? if($editCrop["name"] != $cropdetails["name"] ) {?>
- <option value="<?php echo $cropdetails['id']?>"><?php echo $cropdetails['name']?></option>
- <?php } } $dateconvert= new App_Model_dateConvertor();?>
- </select>
- </td>
- <td align="right">*</td>
- <td><INPUT type="text" name = "acre[]" class="required numeric" value = "<?php echo $editCrop["acre"];?>" size = 10 maxlength="3"></td>
- <td><INPUT type="text" name = "gunta[]" value = "<?php echo $editCrop["gunta"];?>" size = 5 maxlength="2" class="required numeric"></td>
- <td><INPUT type="text" name = "unit[]" value = "<?php echo $editCrop["unit"];?>" size = 5 maxlength="3" class="required numeric"></td>
- <td><INPUT type="text" name = "quantity[]" value = "<?php echo $editCrop["quantity"];?>" size = 10 maxlength="3" class="required numeric"></td>
- <td><INPUT type="text" name = "marketed[]" value = "<?php echo $editCrop["marketed"];?>" size = 10 maxlength="5"></td>
- <td><INPUT type="text" name = "price[]" value = "<?php echo $editCrop["price"];?>" size = 10 maxlength="6"></td>
- <td><INPUT type="text" name = "realised[]" value = "<?php echo $editCrop["realised"];?>" size = 10 maxlength="6"></td>
- <td align="right">*</td>
- <td><INPUT type="text" name = "date[]" class="date required" value = "<?php echo $dateconvert->phpnormalformat($editCrop['sold_date']) ?>"></td>
- <td><img class="delete-icon" id="image<?php echo $i ?>" alt="delete" src="<?php echo $this->baseUrl(); ?>/images/delete.gif" border=0 width='16' height='16'></td>
- </tr>
- <?php } ?>
- </table>
- <input type="button" id="tmpAddRow" name="Add" value="<?php echo $this->translate("Add"); ?>"><input type="submit" id="submit" name="submit" value="<?php echo $this->translate("Submit"); ?>"><a href="<? echo $this->baseUrl();?>/familycommonview/index/commonview/id/<? echo $this->id ?>"><input type="button" id="submit" name="submit" value="<?php echo $this->translate("Back"); ?>"></a>
- </form>
- </div>
Add Comment
Please, Sign In to add comment