Guest User

Untitled

a guest
Jan 13th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.08 KB | None | 0 0
  1. <html>
  2. <script type='text/javascript'>
  3. $(document).ready(
  4. function() {
  5.  
  6. $('input#tmpAddRow').click(
  7. function() {
  8. var newRow = $('tr#tmp').clone(true).removeAttr('id');
  9. newRow.find("select").each( function() {
  10. $(this).children(':first').attr('selected', 'selected');
  11. });
  12. newRow.find("input:text").val("");
  13. newRow.find("input:checkbox").removeAttr('checked');
  14. newRow.appendTo('.crop tbody');
  15. $('tr#tmp').closest('table').find('input:text.date').each(function() {
  16. $(this).removeClass('hasDatepick').datepick({dateFormat: 'dd/mm/yyyy'});
  17. });
  18. arrangeCheckboxNames();
  19. arrangeRadioNames();
  20. arrangedeleteid();
  21. }
  22. );
  23. $('tr input[type=text]').focus(
  24. function() {
  25. $(this).addClass('myFocused');
  26. }
  27. ).blur(
  28. function() {
  29. $(this).removeClass('myFocused');
  30. }
  31. );
  32.  
  33. $('.delete-icon').click(function() {
  34. $(this).closest('tr').remove();
  35. arrangeCheckboxNames();
  36. });
  37. $(".date").datepick({dateFormat: 'dd/mm/yyyy'});
  38.  
  39. }
  40.  
  41. );
  42. var arrangeCheckboxNames = function() {
  43. var length = 1;
  44. $('tr#tmp').find('input:checkbox').val(length);
  45. length++;
  46. $('tr#tmp').nextAll('tr').each( function() {
  47. $(this).find('input:checkbox').val(length);
  48. length++;
  49. });
  50. };
  51. var arrangeRadioNames = function() {
  52. var length = 1;
  53. $('tr#tmp').find('input:radio').val(length);
  54. length++;
  55. $('tr#tmp').nextAll('tr').each( function() {
  56. $(this).find('input:radio').val(length);
  57. length++;
  58. });
  59. };
  60.  
  61. var arrangedeleteid = function() {
  62. var length = 1;
  63. $(this).find('img.delete-icon').attr( 'id', 'image'+length );
  64. length++;
  65.  
  66. $('tr#tmp').nextAll('tr').each( function() {
  67. $(this).find('img.delete-icon').attr( 'id', 'image'+length );
  68. length++;
  69. });
  70. };
  71. $(document).ready(function() {
  72. $('#pluginForm').submit(function(e) {
  73. var isValid = true;
  74. $(this).find(':text.required').each(function() {
  75. if($(this).val().replace(/^\s+|\s+$/g,"") == "") {
  76. isValid = false;
  77. if($(this).next('span').length == 0 ) {
  78. $(this).after('<span style="color: #FF0000">Field is required</span>');
  79. }
  80. e.preventDefault();
  81. return;
  82. } else {
  83. if($(this).next('span').length > 0 )
  84. $(this).next('span').remove();
  85. }
  86. });
  87. $(this).find(':text.numeric').each(function() {
  88. var regex = new RegExp(/^[1-9][0-9]*$/);
  89. if(!regex.test($(this).val()) && isValid) {
  90. isValid = false;
  91. if($(this).next('span').length == 0 ) {
  92. $(this).after('<span style="color: #FF0000">Numeric Data allowed only.</span>');
  93. }
  94. e.preventDefault();
  95. return;
  96. } else {
  97. if($(this).next('span').length > 0 && isValid)
  98. $(this).next('span').remove();
  99. }
  100. });
  101. });
  102. });
  103. </script>
  104. <style type="text/css">
  105. * { font-family: Verdana; font-size: 96%; }
  106. label { width: 10em; float: left; }
  107. label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
  108. p { clear: both; }
  109. .submit { margin-left: 12em; }
  110. em { font-weight: bold; padding-right: 1em; vertical-align: top; }
  111. </style>
  112. </head>
  113. <table id="hor-minimalist-b" border="1" bgcolor="#F8F8F8">
  114. <tr>
  115. <th><?php echo $this->translate("Family information"); ?></th>
  116. <th></th>
  117. <th></th>
  118. <th></th>
  119. </tr>
  120. <?php
  121. $convertdate = new App_Model_dateConvertor();
  122. foreach($this->membername as $family_view){ ?>
  123.  
  124. <tr>
  125. <td ><?php echo $this->translate("Family ID:"); ?></td>
  126. <td ><?php echo $family_view['family_id']; ?></td>
  127. <td ><?php echo $this->translate("Caste:"); ?></td>
  128. <td ><?php echo $family_view['subcaste']; ?></td> </tr>
  129. <tr>
  130. <td ><?php echo $this->translate("House No:"); ?></td>
  131. <td ><?php echo $family_view['house_no']; ?></td>
  132. <td ><?php echo $this->translate("Ration card:"); ?></td>
  133. <td ><?php echo $family_view['ration']; ?></td>
  134. </tr>
  135.  
  136. <tr>
  137. <td ><?php echo $this->translate("Street/Road/Lane:"); ?></td>
  138. <td ><?php echo $family_view['street']; ?></td>
  139. <td ><?php echo $this->translate("Health Insurance:"); ?></td>
  140. <td ><?php foreach($this->insurance as $insurance){ echo $insurance['insurancename']; echo "<br>";
  141. }?></td>
  142. </tr>
  143.  
  144. <tr>
  145. <td ><?php echo $this->translate("Colony/Village:"); ?></td>
  146. <td ><?php echo $family_view['villagename']; ?></td>
  147. <td ><?php echo $this->translate("NREGS Job Card No:"); ?></td>
  148. <td ><?php echo $family_view['nregs_jobno']; ?></td> </tr>
  149.  
  150. <tr>
  151. <td ><?php echo $this->translate("Rev Village:"); ?></td>
  152. <td ><?php echo $this->revvillagename; ?></td>
  153. <td ><?php echo $this->translate("Major source of income:"); ?></td>
  154. <td ><?php echo $family_view['income']; ?></td>
  155. </tr>
  156. <tr>
  157. <td ><?php echo $this->translate("Family type:"); ?></td>
  158. <td ><?php echo $family_view['familytype']; ?></td>
  159. <td ><?php echo $this->translate("Contact Phone:"); ?></td>
  160. <td ><?php echo $family_view['mobile']; ?></td>
  161. </tr>
  162.  
  163. <tr>
  164. <td ><?php echo $this->translate("Category:"); ?></td>
  165. <td ><?php echo $family_view['caste']; ?></td>
  166. <td ><?php echo $this->translate("Mobile:"); ?></td>
  167. <td ><?php echo $family_view['mobile']; ?></td>
  168. </tr>
  169. <?php } ?>
  170. </table>
  171. <br/>
  172. <!-- for Agriculture view -->
  173. <div>
  174. <?php if($this->agriculture){ ?>
  175. <table id="hor-minimalist-b" border="1">
  176. <tr>
  177. <th align="right"><?php echo $this->translate("Land holding"); ?></th>
  178. <th align="right"><?php echo $this->translate("Acre"); ?></th>
  179. <th align="right"><?php echo $this->translate("Gunta"); ?></th>
  180. <th align="right"><?php echo $this->translate("name of owner"); ?></th>
  181. <th align="right"><?php echo $this->translate("Survey No"); ?></th>
  182. <th align="right"><?php echo $this->translate("Village"); ?></th>
  183.  
  184. </tr>
  185. <?php $i =1; foreach($this->agriculture as $agri){ ?>
  186. <tr>
  187. <td><?php echo $agri['name']; ?></td>
  188. <td align="right"><?php echo $agri['acre']; ?></td>
  189. <td align="right"><?php echo $agri['gunta']; ?></td>
  190. <td><?php echo $agri['membername']; ?></td>
  191. <td align="right"><?php echo $agri['survey_no']; ?></td>
  192. <td><?php echo $agri['villagename']; ?></td>
  193.  
  194. </tr>
  195. <?php } ?>
  196. <tr>
  197. <?php foreach($this->acretotal as $total){ ?>
  198.  
  199. <td><?php echo $this->translate("Total"); ?></td>
  200. <td align="right"><?php echo $total['total']; ?></td>
  201. <?php } ?>
  202. <?php foreach($this->guntatotal as $gunta){ ?>
  203. <td align="right"><?php echo $gunta['total']; ?></td>
  204. <?php } ?>
  205.  
  206. <td></td>
  207. <td></td>
  208. <td></td>
  209. </tr>
  210. </table>
  211. <?php } ?>
  212. </div>
  213. <br>
  214. <div style="height:250px; width:750px; overflow-x:scroll ; overflow-y: scroll; padding-bottom:10px;">
  215. <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">
  216. <table id="hor-minimalist-b" class="crop">
  217. <tr>
  218. <th ><?php echo $this->translate("Crop"); ?></th>
  219. <th ></th>
  220. <th ><?php echo $this->translate("Acre"); ?></th>
  221. <th ><?php echo $this->translate("Gunta"); ?></th>
  222. <th ><?php echo $this->translate("Unit"); ?></th>
  223. <th ><?php echo $this->translate("Quantity produced in units"); ?></th>
  224. <th ><?php echo $this->translate("Quantity sold in units"); ?></th>
  225. <th ><?php echo $this->translate("Price per units"); ?></th>
  226. <th ><?php echo $this->translate("Price realised"); ?></th>
  227. <th ></th>
  228. <th ><?php echo $this->translate("Sold date"); ?></th>
  229. <th ><?php echo $this->translate("Action"); ?></th>
  230. </tr>
  231. <?php $i = 0; ?>
  232. <?php foreach ($this->editCrop as $editCrop) { $i++;?>
  233. <?php if ($i == 1) { ?>
  234. <tr id='tmp'>
  235. <?php } else { ?>
  236. <tr>
  237. <?php } ?>
  238. <td><select name = "crop_id[]">
  239. <OPTION value="<?php echo $editCrop["crop_id"]; ?>">
  240. <?php echo $editCrop["name"]; ?>
  241. </OPTION>
  242. <?php foreach ($this->cropdetails as $cropdetails) { ?>
  243. <? if($editCrop["name"] != $cropdetails["name"] ) {?>
  244. <option value="<?php echo $cropdetails['id']?>"><?php echo $cropdetails['name']?></option>
  245. <?php } } $dateconvert= new App_Model_dateConvertor();?>
  246. </select>
  247. </td>
  248. <td align="right">*</td>
  249. <td><INPUT type="text" name = "acre[]" class="required numeric" value = "<?php echo $editCrop["acre"];?>" size = 10 maxlength="3"></td>
  250. <td><INPUT type="text" name = "gunta[]" value = "<?php echo $editCrop["gunta"];?>" size = 5 maxlength="2" class="required numeric"></td>
  251. <td><INPUT type="text" name = "unit[]" value = "<?php echo $editCrop["unit"];?>" size = 5 maxlength="3" class="required numeric"></td>
  252. <td><INPUT type="text" name = "quantity[]" value = "<?php echo $editCrop["quantity"];?>" size = 10 maxlength="3" class="required numeric"></td>
  253. <td><INPUT type="text" name = "marketed[]" value = "<?php echo $editCrop["marketed"];?>" size = 10 maxlength="5"></td>
  254. <td><INPUT type="text" name = "price[]" value = "<?php echo $editCrop["price"];?>" size = 10 maxlength="6"></td>
  255. <td><INPUT type="text" name = "realised[]" value = "<?php echo $editCrop["realised"];?>" size = 10 maxlength="6"></td>
  256. <td align="right">*</td>
  257. <td><INPUT type="text" name = "date[]" class="date required" value = "<?php echo $dateconvert->phpnormalformat($editCrop['sold_date']) ?>"></td>
  258. <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>
  259. </tr>
  260. <?php } ?>
  261. </table>
  262. <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>
  263. </form>
  264. </div>
Add Comment
Please, Sign In to add comment