PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/magehelp/application/views/procurement/quote/approval/quote_approval_grid.php

https://bitbucket.org/jit_bec/shopifine
PHP | 284 lines | 229 code | 45 blank | 10 comment | 2 complexity | 3aa007ad77c8157c9c896b6c60ed858e MD5 | raw file
Possible License(s): LGPL-3.0
  1. <html>
  2. <head>
  3. <?php $this->load->view("common/header"); ?>
  4. <script src="<?php echo base_url();?>js/dialogs.js" type="text/javascript" language="javascript" charset="UTF-8"></script>
  5. <!-- <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>-->
  6. <style>
  7. .column {
  8. float: left;
  9. padding: 1em;
  10. width:45%;
  11. }
  12. .base-column{
  13. width:100%;
  14. }
  15. .extra-wide{
  16. width:95%;
  17. }
  18. .field{
  19. width:100%;
  20. }
  21. .ui-widget-header {height:12px;}
  22. .quote-column {
  23. float: left;
  24. padding-bottom: 0.5em;
  25. width: 45em;
  26. }
  27. .ui-combobox-input{
  28. width:23em;
  29. }
  30. #supplierOp-input{
  31. width:10em;
  32. }
  33. #warehouseOp-input{
  34. width:10em;
  35. }
  36. .calculated {
  37. color: green;
  38. font-size: 90%;
  39. }
  40. .row{
  41. width:95%;
  42. }
  43. .shopifine-ro-label {
  44. float: left;
  45. padding-right: 0.5em;
  46. width: 50%;
  47. word-wrap: break-word;
  48. color:#2E6E9E;
  49. }
  50. .shopifine-output {
  51. float: right;
  52. width: 45%;
  53. word-wrap: break-word;
  54. font-weight:bold;
  55. }
  56. .shopifine-ui-dialog {
  57. padding: 1em 1em;
  58. }
  59. .ui-tabs {
  60. height: 80%;
  61. margin: 0 auto;
  62. width: 100%;
  63. left:0;
  64. }
  65. #notetab {
  66. height:20em;
  67. }
  68. .ui-tabs-nav{
  69. height:22px;
  70. }
  71. #status-message{
  72. margin:5px;
  73. }
  74. p {
  75. padding: 0;
  76. width: 70%;
  77. word-wrap: break-word;
  78. }
  79. </style>
  80. <script type="text/javascript">
  81. $(function() {
  82. //form validation
  83. $("#quoteForm").validate();
  84. $( "#dialog-form" ).dialog({
  85. autoOpen: false,
  86. height: 'auto',
  87. width: '52%',
  88. position:[350,25],
  89. modal: true,
  90. buttons: {
  91. "DoneButton": {
  92. id:"doneBtn",
  93. text:"Approve And Generate PO",
  94. click:function() {
  95. var isValid = $("#quoteForm").valid();
  96. if (isValid){
  97. $.ajax({url:"index.php/procurement/approveOrReject",
  98. type:"POST",
  99. data:{
  100. action:'approve',
  101. quoteId:myGrid.getGridParam('selrow'),
  102. quote_approval_notes:$("#approveNotes").val()
  103. },
  104. success:function(response)
  105. {
  106. emptyMessages();
  107. showSuccessMessage("Quoation Has Been Approved And Purchase Order Generated");
  108. myGrid.trigger("reloadGrid");
  109. }
  110. }) //end ajax
  111. $( this ).dialog( "close" );
  112. } //end ifvalid
  113. }}, //end of Create button
  114. "RejectButton": {id:"rejectBtn",
  115. text:"Reject",
  116. click:function() {
  117. var isValid = $("#quoteForm").valid();
  118. if (isValid){
  119. $.ajax({url:"index.php/procurement/approveOrReject",
  120. type:"POST",
  121. data:{
  122. action:'reject',
  123. quoteId:myGrid.getGridParam('selrow'),
  124. quote_approval_notes:$("#approveNotes").val()
  125. },
  126. success:function(response)
  127. {
  128. emptyMessages();
  129. showSuccessMessage("Quoation Has Been Rejected.Please Modify And Resubmit");
  130. myGrid.trigger("reloadGrid");
  131. }
  132. }) //end ajax
  133. $( this ).dialog( "close" );
  134. } //end ifvalid
  135. }}
  136. },//end buttons
  137. open: function(){
  138. $( "#tabs" ).tabs({
  139. //load contents after the tab loading is complete
  140. load: function(event,ui){
  141. $.ajax({
  142. method:"POST",
  143. url:'index.php/procurement/getQuoteDetails',
  144. data:{quoteId: myGrid.getGridParam('selrow')},
  145. success:function(response){
  146. //console.log(response);
  147. var resJson = JSON.parse(response);
  148. //console.log(resJson);
  149. $("#quoteRef").text(resJson.reference);
  150. $("#supplierOP").text(resJson.supplier_name);
  151. $("#warehouseOP").text(resJson.warehouse);
  152. $("#quoteOP").text(resJson.reference);
  153. $("#raisedByOP").text(resJson.raised_by_name);
  154. $("#approvedByOP").text(resJson.approved_by_name);
  155. $("#estValueOP").text(resJson.estimated_value);
  156. }
  157. })
  158. $("#lineItems").jqGrid({
  159. url:'index.php/procurement/populateQuoteItems?q=2&quoteId='+myGrid.getGridParam('selrow'),
  160. datatype: 'json',
  161. colNames:['Product','Quantity','Need By Date','Unit Price','Estimated Value','Notes'],
  162. colModel :[
  163. {name:'name', index:'name',editable:false, width:120, align:'right'},
  164. {name:'quoted_quantity', index:'quoted_quantity', editable:true,width:50, align:'right'},
  165. {name:'needed_by_date',index:'needed_by_date',editable:true, width:80, align:'right'},
  166. {name:'expected_price',index:'expected_price',editable:true, width:50, align:'right'},
  167. {name:'estimated_value', index:'estimated_value',editable:false, width:60, align:'right'},
  168. {name:'comments', index:'comments',editable:true, width:180, align:'right'}
  169. ],
  170. rowNum:20,
  171. pager: '#pagerPk',
  172. sortname: 'id',
  173. sortorder: "asc",
  174. height: '100%',
  175. jsonReader : {
  176. root:"quoteitemdata",
  177. page: "page",
  178. total: "total",
  179. records: "records",
  180. cell: "dprow",
  181. id: "id"
  182. }
  183. }).navGrid("#pagerPk",{edit:false,add:false,del:true,search:false},{},{},{},{},{});
  184. }
  185. });
  186. },
  187. close: function() {
  188. //allFields.val( "" ).removeClass( "ui-state-error" );
  189. $("#quoteForm").data('validator').resetForm();
  190. $("#quoteForm")[0].reset();
  191. $("#lineItems").jqGrid("GridUnload");
  192. $( "#tabs" ).tabs("destroy");
  193. }
  194. });
  195. // Main Request For Quotation Grid
  196. var myGrid = $("#quotes");
  197. var settingsObj ={grid_id:'quotes',pager:'pager',multiselect:true};
  198. var hiddenObj = {discount_type:true,discount_value:true,pricelist_id:true,discount_amount:true,final_total:true};
  199. prepareQuotesGrid(settingsObj,{_status: 'waitingforapproval',mode:'admin'},true,{},hiddenObj,{});
  200. myGrid.navGrid("#pager",{edit:false,add:false,del:false,search:false},{},{},{},{},{});
  201. var buttons = {approve:true,approve_bulk:true,comments:true,mark_approver:true,assign:true,load_approver_all:true};
  202. addCustomButtonsQuoteGrid(settingsObj,buttons);
  203. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  204. });
  205. $(window).load(function(){
  206. var warningDialogs={one:true,none:true,morethanone:true,exactlyone:true};
  207. initDialogs(warningDialogs);
  208. initCommentsForQuote();
  209. initAssignmentCommon();
  210. });
  211. </script>
  212. </head>
  213. <body>
  214. <?php $this->load->view("common/menubar"); ?>
  215. <?php $this->load->view("common/dialogs"); ?>
  216. <div id ="dialog-form">
  217. <h1 id="formHeader">Quote # <span id="quoteRef"></span> Details</h1>
  218. <form id="quoteForm">
  219. <fieldset>
  220. <div id="tabs">
  221. <ul>
  222. <li id="baseLink"><a href="<?php echo site_url('procurement/loadQuoteFormFragment') ?>">Basic Details</a></li>
  223. <li id="notesLink"><a href="<?php echo site_url('procurement/loadQuoteNotesFragment') ?>">Notes</a></li>
  224. </ul>
  225. </div>
  226. </fieldset>
  227. </form>
  228. </div>
  229. <div style="display: block;height: 100%;" class="shopifine-ui-dialog ui-widget ui-widget-content ui-corner-all" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-dialog-form">
  230. <?php $this->load->view("common/message"); ?>
  231. <div class="table-grid">
  232. <h1 id="quote_header">Quotes</h1>
  233. <table id="quotes"><tr><td/></tr></table>
  234. <div id="pager"></div>
  235. </div>
  236. </div>
  237. <?php $this->load->view("partial/footer"); ?>
  238. </body>
  239. </html>