PageRenderTime 142ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/jit_bec/shopifine
PHP | 280 lines | 229 code | 39 blank | 12 comment | 5 complexity | 5aed66532943f918a832513e208c934b MD5 | raw file
Possible License(s): LGPL-3.0
  1. <html>
  2. <head>
  3. <?php $this->load->view("common/header"); ?>
  4. <!-- <script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>-->
  5. <style>
  6. .column {
  7. float: left;
  8. padding: 1em;
  9. width:45%;
  10. }
  11. .base-column{
  12. width:100%;
  13. }
  14. .extra-wide{
  15. width:95%;
  16. }
  17. .field{
  18. width:100%;
  19. }
  20. .ui-widget-header {height:12px;}
  21. .quote-column {
  22. float: left;
  23. padding-bottom: 0.5em;
  24. width: 45em;
  25. }
  26. .ui-combobox-input{
  27. width:23em;
  28. }
  29. #supplierOp-input{
  30. width:10em;
  31. }
  32. #warehouseOp-input{
  33. width:10em;
  34. }
  35. .calculated {
  36. color: green;
  37. font-size: 90%;
  38. }
  39. .row{
  40. width:95%;
  41. clear:both;
  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: 90%;
  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. // Main Request For Quotation Grid
  85. var myGrid = $("#quotes");
  86. var settingsObj ={grid_id:'quotes',pager:'pager',multiselect:true};
  87. prepareRFQGrid(settingsObj,{_status: 'waitingforapproval',mode:'admin'},true,{},{},{});
  88. myGrid.navGrid("#pager",{edit:false,add:false,del:false,search:false},{},{},{},{},{});
  89. var buttons = {approve:true,approve_bulk:true,comments:true,mark_approver:true,assign:true,load_approver_all:true};
  90. addCustomButtonsInRFQGrid('quotes', 'pager', null, buttons, null);
  91. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  92. // approve or reject dialog
  93. $( "#dialog-form" ).dialog({
  94. autoOpen: false,
  95. height: 'auto',
  96. width: '52%',
  97. position:[350,25],
  98. modal: true,
  99. buttons: {
  100. "DoneButton": {
  101. id:"doneBtn",
  102. text:"Approve",
  103. click:function() {
  104. var isValid = $("#quoteForm").valid();
  105. if (isValid){
  106. $.ajax({url:"index.php/procurement/approveOrReject",
  107. type:"POST",
  108. data:{
  109. action:'approve',
  110. quoteId:myGrid.getGridParam('selrow'),
  111. quote_approval_notes:$("#approveNotes").val(),
  112. entity:'rfq'
  113. },
  114. success:function(response)
  115. {
  116. emptyMessages();
  117. showSuccessMessage("Quoation Has Been Approved And Purchase Order Generated");
  118. myGrid.trigger("reloadGrid");
  119. }
  120. }) //end ajax
  121. $( this ).dialog( "close" );
  122. } //end ifvalid
  123. }}, //end of Create button
  124. "RejectButton": {id:"rejectBtn",
  125. text:"Reject",
  126. click:function() {
  127. var isValid = $("#quoteForm").valid();
  128. if (isValid){
  129. $.ajax({url:"index.php/procurement/approveOrReject",
  130. type:"POST",
  131. data:{
  132. action:'reject',
  133. quoteId:myGrid.getGridParam('selrow'),
  134. quote_approval_notes:$("#approveNotes").val(),
  135. entity:'rfq'
  136. },
  137. success:function(response)
  138. {
  139. emptyMessages();
  140. showSuccessMessage("Quoation Has Been Rejected.Please Modify And Resubmit");
  141. myGrid.trigger("reloadGrid");
  142. }
  143. }) //end ajax
  144. $( this ).dialog( "close" );
  145. } //end ifvalid
  146. }}
  147. },//end buttons
  148. open: function(){
  149. console.log(user_id);
  150. console.log(myGrid.getGridParam('postData'));
  151. $( "#tabs" ).tabs({
  152. //cache
  153. beforeLoad: function( event, ui ) {
  154. var tabcache = $("#tabcache").val();
  155. if (tabcache==1){
  156. if ( ui.tab.data( "loaded" ) ) {
  157. event.preventDefault();
  158. return;
  159. }
  160. ui.jqXHR.success(function() {
  161. ui.tab.data( "loaded", true );
  162. });
  163. }
  164. },
  165. beforeActivate: function (event,ui){
  166. if (ui.oldTab[0].id=="notesLink"){
  167. $("#tabcache").val("1");
  168. }
  169. },
  170. //load contents after the tab loading is complete
  171. load: function(event,ui){
  172. $.ajax({
  173. method:"POST",
  174. url:'index.php/procurement/getRFQDetails',
  175. data:{quoteId: myGrid.getGridParam('selrow')},
  176. success:function(response){
  177. //console.log(response);
  178. var resJson = JSON.parse(response);
  179. //console.log(resJson);
  180. $("#quoteRef").text(resJson.reference);
  181. $("#supplierOP").text(resJson.supplier_name);
  182. $("#warehouseOP").text(resJson.warehouse);
  183. $("#quoteOP").text(resJson.reference);
  184. $("#raisedByOP").text(resJson.raised_by_name);
  185. $("#approvedByOP").text(resJson.approved_by_name);
  186. $("#estValueOP").text(resJson.estimated_value);
  187. }
  188. });
  189. var lineSettingObj ={grid_id:'lineItems',pager:'pagerPk'};
  190. prepareRFQItemsGrid(lineSettingObj,{quoteId:myGrid.getGridParam('selrow')}, {}, {});
  191. $("#lineItems").navGrid("#pagerPk",{edit:false,add:false,del:false,search:false},{},{},{},{},{});
  192. $("#lineItems").jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  193. }
  194. });
  195. },
  196. close: function() {
  197. //allFields.val( "" ).removeClass( "ui-state-error" );
  198. $("#quoteForm").data('validator').resetForm();
  199. $("#quoteForm")[0].reset();
  200. $("#tabcache").val("0");
  201. $("#lineItems").jqGrid("GridUnload");
  202. $( "#tabs" ).tabs("destroy");
  203. }
  204. });
  205. });
  206. $(window).load(function(){
  207. var warningDialogs={one:true,none:true,morethanone:true,exactlyone:true};
  208. initDialogs(warningDialogs);
  209. initCommentsForQuote();
  210. initAssignmentCommon();
  211. });
  212. </script>
  213. </head>
  214. <body>
  215. <?php $this->load->view("common/menubar"); ?>
  216. <?php $this->load->view("common/dialogs"); ?>
  217. <div id ="dialog-form" class="inithide">
  218. <h1 id="formHeader">RFQ # <span id="quoteRef"></span> Details</h1>
  219. <form id="quoteForm">
  220. <fieldset>
  221. <div id="tabs">
  222. <ul>
  223. <li id="baseLink"><a href="<?php echo site_url('procurement/loadWaitingForApprovalRFQFormFragment') ?>">Basic Details</a></li>
  224. <li id="notesLink"><a href="<?php echo site_url('procurement/loadWaitingForApprovalRFQNotesFragment') ?>">Notes</a></li>
  225. </ul>
  226. </div>
  227. </fieldset>
  228. </form>
  229. </div>
  230. <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">
  231. <?php $this->load->view("common/message"); ?>
  232. <div class="table-grid">
  233. <h1 id="quote_header">Request For Quotations</h1>
  234. <table id="quotes"><tr><td/></tr></table>
  235. <div id="pager"></div>
  236. </div>
  237. </div>
  238. <input id="tabcache" name="tabcache" value="0" type="hidden"/>
  239. <?php $this->load->view("partial/footer"); ?>
  240. </body>
  241. </html>