PageRenderTime 49ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 1ms

/magehelp/application/views/products/products_grid.php

https://bitbucket.org/jit_bec/shopifine
PHP | 837 lines | 596 code | 88 blank | 153 comment | 39 complexity | e778da2e2509f574c1f78dbeaff27aa6 MD5 | raw file
Possible License(s): LGPL-3.0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Product Details</title>
  5. <?php $this->load->view("common/header"); ?>
  6. <!-- <script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.jstree.js"></script>-->
  7. <link rel="stylesheet" rev="stylesheet" href="<?php echo base_url();?>css/chosen.css" />
  8. <script src="<?php echo base_url();?>js/chosen.jquery.min.js" type="text/javascript" language="javascript" charset="UTF-8"></script>
  9. <script src="<?php echo base_url();?>js/jquery.jstree.js" type="text/javascript" language="javascript" charset="UTF-8"></script>
  10. <style type="text/css">
  11. #menubar_admin_navigation {
  12. top:49px;
  13. }
  14. #content_area{
  15. width:95%;
  16. }
  17. .column{width:40em;padding:1em;}
  18. html {
  19. overflow-x:hidden;
  20. }
  21. .chzn-container{
  22. font-size:inherit;
  23. }
  24. .chzn-container-multi .chzn-choices .search-field input {
  25. height:1em;
  26. }
  27. .field{
  28. width:100%;
  29. }
  30. .labeldiv{
  31. width:25%;
  32. }
  33. .ui-combobox{
  34. width:40%;
  35. }
  36. label.error{
  37. width:30%
  38. }
  39. </style>
  40. <script type="text/javascript">
  41. $(function(){
  42. $.validator.addMethod('comboBoxrequired', function(value, element,param) {
  43. var selectId = param;
  44. value = $("#"+selectId).val();
  45. var inputIdSelector = "#" + selectId + "-input";
  46. if (value == ""){
  47. inputVal = $(inputIdSelector).val();
  48. if (inputVal == "" || inputVal == null){
  49. return false;
  50. }
  51. }
  52. return true;
  53. }, 'Please select from the dropdown or add new element in box');
  54. $( "#dialog:ui-dialog" ).dialog( "destroy" );
  55. $( "#productForm" ).validate({
  56. // ignore:[],
  57. errorPlacement: function(error, element) {
  58. console.log(element[0].id);
  59. if (element[0].id=='reqBarcodeMfr'){
  60. error.appendTo( $("#mfrOp").parent());
  61. }
  62. else if (element[0].id=='reqBarcodeModel'){
  63. error.appendTo( $("#modelOp").parent());
  64. }
  65. else{
  66. error.appendTo( element.parent());
  67. }
  68. },
  69. rules :{reqBarcodeMfr:{
  70. comboBoxrequired:'mfrOp'
  71. },
  72. reqBarcodeModel:{
  73. comboBoxrequired:'modelOp'
  74. },
  75. reorderLevel:{
  76. digits:true
  77. //min:1//,
  78. //threshold:'#pp_quantity_receipt'
  79. },
  80. vat:{
  81. number:true
  82. // minStrict:0//,
  83. //threshold:'#pp_amount_receipt'
  84. },
  85. margin_value:{
  86. number:true
  87. // minStrict:0//,
  88. //threshold:'#pp_amount_receipt'
  89. }
  90. }
  91. }
  92. );
  93. $( "#dialog-form" ).dialog({
  94. autoOpen: false,
  95. height: 'auto',
  96. width: '70%',
  97. position:[200,25],
  98. modal: true,
  99. buttons: {
  100. "Create the Product": {
  101. id:"create_product",
  102. text:"Create the Product",
  103. click:function() {
  104. var bValid = $("#productForm").valid();
  105. var mode = $(this).data('grid_data').mode;
  106. var product_id = $(this).data('grid_data').product_id;
  107. var url = "index.php/products/createBarcodeAndProduct";
  108. if (mode=='edit'){
  109. url = 'index.php/products/editProduct';
  110. }
  111. console.log(bValid);
  112. if (bValid ){
  113. var selectedIds = [];
  114. $('#treeViewDiv').jstree('get_selected').each(function(){
  115. selectedIds.push($(this).attr('id'));
  116. });
  117. var checked = $('#hasBarcode').is(':checked');
  118. var barcode = $("#productbarcode").val();
  119. if (checked){
  120. barcode="";
  121. }
  122. $.ajax({
  123. url:url,
  124. data: {barcodeData :{
  125. scannedBarcode : barcode,
  126. mfrOp : $("#mfrOp").val(),
  127. mfrIp: $("#mfrOp-input").val(),
  128. modelOp: $("#modelOp").val(),
  129. modelIp: $("#modelOp-input").val(),
  130. newModelIp: $("#newModelIp").val(),
  131. name: $("#name").val(),
  132. desc: $("#desc").val(),
  133. category:JSON.stringify(selectedIds),
  134. supplierOp: $("#supplierOp").val(),
  135. uomOp: $("#uomOp").val(),
  136. sizeOp: $("#sizeOp").val(),
  137. // costPrice: $("#costPrice").val(),
  138. // price: $("#price").val(),
  139. attributeSet:$("#attributeSetOp").val(),
  140. packageOp: $("#packageOp").val(),override:$("#createOverride").val() },
  141. editData:
  142. {id:product_id,
  143. reorderLevel: $("#reorderLevel").val(),
  144. vat: $("#vat").val(),
  145. name: $("#name").val(),
  146. desc: $("#desc").val(),
  147. metadesc: $("#metadesc").val(),
  148. attributeSet:$("#attributeSetOp").val(),
  149. margin_type:$("#margin_type").val(),
  150. margin_value:$("#margin_value").val()
  151. }
  152. },
  153. type:"POST",
  154. success:function(serverresponse)
  155. {
  156. var response = JSON.parse(serverresponse);
  157. emptyMessages();
  158. if (response.status=='error'){
  159. //showErrorMessage(response.message)
  160. $("#status_warning_text").text(response.message);
  161. $( "#modal-warning-general" ).dialog("open");
  162. }
  163. else if (response.status=='exists'){
  164. emptyMessagesGen('status-message-product')
  165. showErrorMessageGen(response.message, 'status-message-product');
  166. $("#possibleProductCntnr").show();
  167. $("#create_product >span").text("Still Create A New Product")
  168. $("#createOverride").val("1");
  169. var settingsObjMatching= {grid_id:'matchingproduct',pager:'pagerMatchingProduct'};
  170. var postdata = {
  171. mfr_id:$("#mfrOp").val(),
  172. model_id:$("#modelOp").val(),
  173. uom:$("#uomOp").val(),
  174. size:$("#sizeOp").val(),
  175. package_id:$("#packageOp").val(),
  176. product_name:$("#name").val()
  177. };
  178. prepareProductsGrid(settingsObjMatching,postdata,false,{},{description:true,uom:true,measurement_denomination:true,reorder:true,vat:true,generate:true,uomdenom:false});
  179. // $("#matchingproduct").jqGrid('setGridParam',{});
  180. // $("#matchingproduct").trigger("reloadGrid")
  181. //$("#status_warning_text").text(response.message);
  182. //$( "#modal-warning-general" ).dialog("open");
  183. // $( this ).dialog( "close" );
  184. }
  185. else {
  186. $( "#dialog-form" ).dialog( "close" );
  187. showSuccessMessage(response.message)
  188. $("#product").trigger("reloadGrid");
  189. }
  190. }
  191. });
  192. }
  193. }
  194. }
  195. ,
  196. Cancel: function() {
  197. $( this ).dialog( "close" );
  198. }
  199. },
  200. close: function() {
  201. //allFields.val( "" ).removeClass( "ui-state-error" );
  202. $("#productbarcode").attr('disabled',false);
  203. $("#productForm").data('validator').resetForm();
  204. $('#productForm')[0].reset();
  205. $("#supplierOp").val("").trigger('liszt:updated');;
  206. $('#attributeSetOp').val("");
  207. $('.inithide').hide();
  208. $("#productbarcode").removeProp("readonly");
  209. $('.noedit').show();
  210. $("#createOverride").val("0");
  211. $("#create_product >span").text("Create A New Product");
  212. $("#matchingproduct").jqGrid("GridDestroy");
  213. },
  214. open :function(){
  215. $('.inithide').hide();
  216. var product_id = $(this).data('grid_data').product_id;
  217. var barcode = myGrid.getCell(product_id,'barcode');
  218. var mode = $(this).data('grid_data').mode;
  219. console.log("mode = "+ mode + " product_id = " + product_id);
  220. if (mode=='edit'){
  221. $('.noedit').hide();
  222. $("#create_product >span").text("Edit Product");
  223. $('.onlyedit').show();
  224. $("#productbarcode").val(barcode);
  225. $("#productbarcode").prop("readonly","readonly");
  226. $("#name").val(myGrid.getCell(product_id,'product_name'));
  227. $("#desc").val(myGrid.getCell(product_id,'description'));
  228. $("#vat").val(myGrid.getCell(product_id,'vat'));
  229. $("#reorderLevel").val(myGrid.getCell(product_id,'reorder'));
  230. $("#margin_type").val(myGrid.getCell(product_id,'margin_type'));
  231. $("#margin_value").val(myGrid.getCell(product_id,'margin_value'));
  232. var optText = myGrid.getCell(product_id,'attributeset');
  233. console.log("optText == " + optText);
  234. $("#attributeSetOp option").filter(function() {
  235. //may want to use $.trim in here
  236. return $.trim($(this).text().toLowerCase())== $.trim(optText).toLowerCase();
  237. }).attr('selected', true);
  238. }
  239. else {
  240. }
  241. }
  242. });
  243. $("#mfrOp").combobox({
  244. customChange: function () {
  245. if ($("#mfrOp").val()!="") {
  246. $.ajax({
  247. type:"post",
  248. data:{mfrName:$("#mfrOp-input").val(),mfr: $("#mfrOp").val()},
  249. url:"index.php/products/populateModel",
  250. success: function(data){
  251. $("#modelOp").children('option:not(:first)').remove();
  252. $("#modelOp").append(data);
  253. $("#modelOp").combobox();
  254. $("#modelCtnr").parent().slideDown(50);
  255. if (!$("#newModelCtnr").parent().is(':hidden')){
  256. $("#newModelCtnr").parent().slideUp(50);
  257. }
  258. }
  259. });
  260. }
  261. else {
  262. $("#newModelCtnr").parent().slideDown(50);
  263. if (!$("#modelCtnr").parent().is(':hidden')){
  264. $("#modelCtnr").parent().slideUp(50);
  265. }
  266. }
  267. }
  268. });
  269. $("#categoryOp").combobox();
  270. var myGrid = $("#product");
  271. var settingsObj= {grid_id:'product',pager:'pager',multiselect:true};
  272. prepareProductsGrid(settingsObj);
  273. myGrid .navGrid("#pager",{edit:false,add:false,del:false,search:false},{},{},{},{},{});
  274. var buttons = {add:true,edit:true,load_all:true,activate:true,deactivate:true,export_all:true};
  275. addCustomButtonsInProductsGrid(settingsObj, buttons);
  276. // myGrid.jqGrid('navButtonAdd','#pager',{
  277. // caption:"",
  278. // title:"Export as csv",
  279. // id:"export_product",
  280. // onClickButton : function () {
  281. // myGrid.jqGrid('excelExport',{tag:"csv","url":"index.php/products/exportProductsInGrid"});
  282. // }
  283. // });
  284. // myGrid.jqGrid('navButtonAdd','#pager',{
  285. // caption:"",
  286. // title:"Create Product",
  287. // buttonicon:"ui-icon-plus",
  288. // id:"add_product",
  289. // onClickButton : function () {
  290. // $("#newModelCtnr").parent().css("display","none");
  291. // $("#modelCtnr").parent().css("display","none");
  292. // var grid_data = {mode:'add'};
  293. // $( "#dialog-form" ).data('grid_data',grid_data).dialog( "open" );
  294. // }
  295. // });
  296. // myGrid.jqGrid('navButtonAdd','#pager',{
  297. // caption:"",
  298. // title:"Edit Product",
  299. // buttonicon:"ui-icon-pencil",
  300. // id:"edit_product",
  301. // onClickButton : function () {
  302. // $("#newModelCtnr").parent().css("display","none");
  303. // $("#modelCtnr").parent().css("display","none");
  304. // var grid_data = {product_id:myGrid.getGridParam('selrow'),mode:'edit'};
  305. // $( "#dialog-form" ).data('grid_data',grid_data).dialog( "open" );
  306. // }
  307. // });
  308. //
  309. // myGrid.jqGrid('navButtonAdd','#pager',{
  310. // caption:"",
  311. // title:"Mark as inactive",
  312. // id:"inactive_product",
  313. // buttonicon:"ui-icon-locked",
  314. // onClickButton : function (id) {
  315. // var rowid = myGrid.jqGrid('getGridParam', 'selarrrow');
  316. // $.ajax({type:"post",
  317. // url:"index.php/products/deactivate",
  318. // data: {ids : rowid},
  319. // success: function(){
  320. // $("#product").trigger("reloadGrid");
  321. // }
  322. // });
  323. // }
  324. // });
  325. //
  326. // myGrid.jqGrid('navButtonAdd','#pager',{
  327. // caption:"",
  328. // title:"Mark as active",
  329. // id:"active_product",
  330. // buttonicon:"ui-icon-unlocked",
  331. // onClickButton : function (id) {
  332. // var rowid = myGrid.jqGrid('getGridParam', 'selarrrow');
  333. // $.ajax({type:"post",
  334. // url:"index.php/products/activate",
  335. // data: {ids : rowid},
  336. // success: function(){
  337. // $("#product").trigger("reloadGrid");
  338. // }
  339. // });
  340. // }
  341. // });
  342. //
  343. // myGrid.jqGrid('navButtonAdd','#pager',{
  344. // caption:"",
  345. // title:"Load all ",
  346. // id:"load_product",
  347. // buttonicon:"ui-icon-arrow-4-diag",
  348. // onClickButton : function (id) {
  349. // var rowid = myGrid.jqGrid('getGridParam', 'selarrrow');
  350. // $.ajax({type:"post",
  351. // url:"index.php/products/populateProductsInGrid",
  352. // data: {loadall : true},
  353. // success: function(response){
  354. // //$("#product").trigger("reloadGrid");
  355. // var grid = jQuery("#product")[0];
  356. // var myjsongrid = eval("("+response+")");
  357. // grid.addJSONData(myjsongrid);
  358. //
  359. //
  360. // }
  361. // });
  362. // }
  363. // });
  364. //
  365. // myGrid.jqGrid ('navButtonAdd', '#pager',
  366. // { caption: "", buttonicon: "ui-icon-calculator",
  367. // title: "Choose Columns",
  368. // onClickButton: function() {
  369. // myGrid.jqGrid('columnChooser');
  370. // }
  371. // });
  372. $("#add_product").insertBefore("#edit_product");
  373. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  374. $(".chzn-select").chosen();
  375. $("#treeViewDiv")
  376. .jstree({
  377. "plugins" : ["themes", "json_data", "ui"],
  378. "json_data" : {
  379. "ajax" : {
  380. "type": 'GET',
  381. "url": function (node) {
  382. var nodeId = "";
  383. var url = ""
  384. if (node == -1)
  385. {
  386. url = "index.php/utilities/renderParents";
  387. }
  388. else
  389. {
  390. nodeId = node.attr('id');
  391. url = "index.php/utilities/renderChildren";
  392. }
  393. return url;
  394. },
  395. data : function(node) {
  396. if (node != -1){
  397. return {
  398. "nodeid":$.trim(node.attr('id'))
  399. }
  400. }
  401. },
  402. "success": function (new_data) {
  403. return new_data;
  404. }
  405. }
  406. }})
  407. });
  408. $(window).load(function(){
  409. var warningDialogs={one:true,none:true,status:true,exactlyone:true,morethanone:true};
  410. initDialogs(warningDialogs);
  411. initPaymentDialog();
  412. initCommentsForQuote();
  413. initAssignmentCommon();
  414. //initErrorDialogs({total:true,advance:true});
  415. //this is from payment dialog.The Select Inout is in dialogs.php
  416. });
  417. </script>
  418. </head>
  419. <body>
  420. <?php $this->load->view("common/menubar"); ?>
  421. <?php $this->load->view("common/dialogs"); ?>
  422. <!-- <button id="create-product">Create New Product</button> -->
  423. <!--<button id="inv-management" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text"> Manage Inventory</span></button>-->
  424. <div id ="dialog-form" title="Add New Product Entity">
  425. <!-- <h1 id="formHeader">Add New Product Entity</h1> -->
  426. <form id="productForm">
  427. <fieldset>
  428. <div class="row ">
  429. <div class="column noedit">
  430. <div class="field">
  431. <label for="hasBarcode" class="labeldiv">Product Do Not Have Barcode</label>
  432. <input id="hasBarcode" name ="hasBarcode" type="checkbox"/>
  433. </div>
  434. </div>
  435. <div class="column">
  436. <div class="field">
  437. <label for="productbarcode" class="labeldiv">Scan/ Type Barcode:</label>
  438. <input id="productbarcode" name ="productbarcode" type="text" class="required"/>
  439. </div>
  440. </div>
  441. </div>
  442. <div class="row">
  443. <div class="column">
  444. <div class="field">
  445. <label for="name" class="labeldiv">Name of Product Entity:</label>
  446. <input id="name" name ="name" type="text" class="required"/>
  447. </div>
  448. </div>
  449. <div class="column">
  450. <div class="field">
  451. <label for="attributeSetOp" class="labeldiv">Attribute Set:</label>
  452. <select name="attributeSetOp" id ="attributeSetOp" class="required">
  453. <option value="">Choose
  454. <?= $attributeSetOptions ?>
  455. </select>
  456. </div>
  457. </div>
  458. </div>
  459. <div class="row inithide onlyedit">
  460. <div class="column">
  461. <div class="field">
  462. <label for="desc" class="labeldiv">Description:</label>
  463. <textarea id="desc" name ="desc" rows="3" cols="30" class="required"></textarea>
  464. </div>
  465. </div>
  466. <div class="column">
  467. <div class="field">
  468. <label for="metadesc" class="labeldiv">Meta Description:</label>
  469. <textarea id="metadesc" name ="metadesc" rows="3" cols="30"></textarea>
  470. </div>
  471. </div>
  472. </div>
  473. <div class="row noedit">
  474. <div class="column">
  475. <div id="mfrCtnr">
  476. <div class="ui-widget field">
  477. <label for="mfrOp" class="labeldiv">Manufacturer :</label>
  478. <select name="mfrOp" id ="mfrOp" >
  479. <option value="">Select one...
  480. <?= $mfrOptions?>
  481. </select>
  482. </div>
  483. </div>
  484. <div class="row" style="padding-top:5px;">
  485. <input id="reqBarcodeMfr" name ="reqBarcodeMfr" type="checkbox" class="reqBarcode reqBarcodeAC" style="left:26%"/>
  486. <div class="help-message">Caution:Mark As Not Required Only In Exception Circumstances</div>
  487. </div>
  488. </div>
  489. <div class="column" style="display:none">
  490. <div id="modelCtnr">
  491. <div class="ui-widget field">
  492. <label for="modelOp" class="labeldiv">Model :</label>
  493. <select name="modelOp" id ="modelOp">
  494. <option value="">Select one...
  495. <?= $modelOptions?>
  496. </select>
  497. </div>
  498. </div>
  499. <div class="row" style="padding-top:5px;">
  500. <input id="reqBarcodeModel" name ="reqBarcodeModel" type="checkbox" class="reqBarcode reqBarcodeAC" style="left:26%"/>
  501. <div class="help-message">Caution:Mark As Not Required Only In Exception Circumstances</div>
  502. </div>
  503. </div>
  504. <div class="column" style="display:none">
  505. <div id="newModelCtnr">
  506. <div class="field">
  507. <label for="newModelIp" class="labeldiv">Specify New Model Type :</label>
  508. <input id="newModelIp" name ="newModelIp" type="text"/>
  509. </div>
  510. </div>
  511. </div>
  512. </div>
  513. <div class="row noedit">
  514. <div class="column">
  515. <div class="field">
  516. <label for="categoryOp" class="labeldiv">Category:</label>
  517. <!-- <select name="categoryOp" id ="categoryOp" >
  518. <option value="">Choose
  519. <?= $categoryOptions ?>
  520. </select>-->
  521. <div id="treeViewDiv" style="display:inline-block">
  522. </div>
  523. <!--<input id="categoryReq" name ="reqBarcodeCat" type="checkbox" class="reqBarcodeAC "/>-->
  524. </div>
  525. </div>
  526. <div class="column">
  527. <div class="field">
  528. <label for="supplierOp" class="labeldiv">Supplier:</label>
  529. <select name="supplierOp[]" id ="supplierOp" class="chzn-select" multiple="multiple" style="width:15em;;height:1em;">
  530. <?= $supplierOptions ?>
  531. </select>
  532. </div>
  533. </div>
  534. </div>
  535. <div class="row noedit">
  536. <div class="column ">
  537. <div class="field">
  538. <label for="packageOp" class="labeldiv">Package:</label>
  539. <select name="packageOp" id ="packageOp" class="required">
  540. <option value="">Choose
  541. <?= $pkgOptions ?>
  542. </select>
  543. </div>
  544. </div>
  545. <!-- <div class="column inithide onlyedit">
  546. <div class="field">
  547. <label for="reorderLevel" class="labeldiv">Reorder Level :</label>
  548. <input id="reorderLevel" name="reorderLevel" type="text"/>
  549. </div>
  550. </div>-->
  551. </div>
  552. <div class="row noedit">
  553. <div class="column">
  554. <div class="field">
  555. <label for="uomOp" class="labeldiv">Unit Of Measurement:</label>
  556. <select name="uomOp" id ="uomOp" class="required">
  557. <option value="">Choose
  558. </select>
  559. </div>
  560. </div>
  561. <div class="column">
  562. <div class="field" style="display:none">
  563. <label for="sizeOp" class="labeldiv">Measurement Denomination:</label>
  564. <select name="sizeOp" id ="sizeOp" class="required">
  565. <option value="">Choose
  566. </select>
  567. </div>
  568. </div>
  569. </div>
  570. <div class="row inithide onlyedit">
  571. <div class="column ">
  572. <div class="field">
  573. <label for="vat" class="labeldiv">Vat :</label>
  574. <input id="vat" name="vat" type="text"/>
  575. </div>
  576. </div>
  577. <div class="column ">
  578. <div class="field">
  579. <label for="reorderLevel" class="labeldiv">Reorder Level :</label>
  580. <input id="reorderLevel" name="reorderLevel" type="text"/>
  581. </div>
  582. </div>
  583. </div>
  584. <div class="row inithide onlyedit">
  585. <div class="column ">
  586. <div class="field">
  587. <label for="margin_type" class="labeldiv">Margin Type :</label>
  588. <select id="margin_type" name="margin_type">
  589. <option value="none">None</option>
  590. <option value="percentage">Percentage</option>
  591. <option value="amount">Amount</option>
  592. </select>
  593. </div>
  594. </div>
  595. <div class="column ">
  596. <div class="field">
  597. <label for="margin_value" class="labeldiv">Margin Value :</label>
  598. <input id="margin_value" name="margin_value" type="text"/>
  599. </div>
  600. </div>
  601. </div>
  602. <div id="possibleProductCntnr" class="inithide" style="margin-top:5em">
  603. <div class="ui-widget">
  604. <div id ="status-message-product" class="ui-corner-all" style="margin: 0 auto; padding: 0 .7em;">
  605. <p><span style="float: left; margin-right: .3em;"></span>
  606. </p>
  607. </div>
  608. </div>
  609. <div class="table-grid" style="padding-top:2em;">
  610. <h1 id="pkdheader_product">Matching Products</h1>
  611. <table id="matchingproduct"><tr><td/></tr></table>
  612. <div id="pagerMatchingProduct"></div>
  613. </div>
  614. <!-- <div class="table-grid" style="padding-top:2em;">
  615. <h1 id="pkdheader_attribute">Attributes Used In Barcode </h1>
  616. <table id="barcodeAttributes"><tr><td/></tr></table>
  617. <div id="pagerBarcodeAttributes"></div>
  618. </div>-->
  619. </div>
  620. <input id="createOverride" name="createOverride" type="hidden" value="0"/>
  621. <!-- <div class="row">
  622. <div class="column">
  623. <div class="field">
  624. <label for="costPrice" class="labeldiv">Cost Price :</label>
  625. <input id="costPrice" name="costPrice" type="text"/>
  626. </div>
  627. </div>
  628. <div class="column">
  629. <div class="field">
  630. <label for="price" class="labeldiv">Final Price :</label>
  631. <input id="price" name="price" type="text"/>
  632. </div>
  633. </div>
  634. </div>-->
  635. </fieldset>
  636. </form>
  637. </div>
  638. <div style="display: block;height: 100%;width:90%;left:0em;" class="shopifine-ui-dialog ui-widget ui-widget-content ui-corner-all" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-dialog-form">
  639. <?php $this->load->view("common/message"); ?>
  640. <table id="product"><tr><td/></tr></table>
  641. <div id="pager"></div>
  642. </div>
  643. <!-- <button id="create-product">Create New Product</button>-->
  644. <!-- <div id="feedback_bar"></div>-->
  645. <?php $this->load->view("partial/footer"); ?>
  646. </body>
  647. </html>
  648. <script type="text/javascript">
  649. $("#packageOp").change(function(){
  650. var val = $(this).val();
  651. $.ajax({type:"post",
  652. url:"index.php/products/populateMeasurementDropDowns",
  653. data: {pkgId : val},
  654. success: function(uomHtml){
  655. $("#uomOp").children('option:not(:first)').remove();
  656. $("#uomOp").append(uomHtml);
  657. }
  658. });
  659. });
  660. $("#uomOp").change(function(){
  661. var val = $(this).val();
  662. $.ajax({type:"post",
  663. url:"index.php/products/populateDenomDropdown",
  664. data: {uom : val},
  665. success: function(uomHtml){
  666. if (uomHtml!=null && uomHtml!="") {
  667. if ($("#sizeOp").parent().is(':hidden')){
  668. $("#sizeOp").parent().slideDown(50);
  669. }
  670. $("#sizeOp").children('option:not(:first)').remove();
  671. $("#sizeOp").append(uomHtml);
  672. }
  673. else {
  674. if (!$("#sizeOp").parent().is(':hidden')){
  675. $("#sizeOp").parent().slideUp(50);
  676. }
  677. }
  678. }
  679. });
  680. });
  681. $(".reqBarcodeAC").change(function (){
  682. var checked = $(this).is(':checked');
  683. var element;
  684. console.log(this.id);
  685. // if (this.id =='reqBarcodeMfr'){
  686. // element ='mfrOp';
  687. // }
  688. if (checked){
  689. //$(this).parent().find('select').addClass("comboBoxrequired");
  690. console.log(element);
  691. $("#"+this.id).rules("remove","comboBoxrequired");
  692. }
  693. else {
  694. //$(this).parent().find('select').removeClass("comboBoxrequired");
  695. console.log("else "+element);
  696. if (this.id =='reqBarcodeMfr'){
  697. param ='mfrOp';
  698. }
  699. else if (this.id =='reqBarcodeModel'){
  700. param ='modelOp';
  701. }
  702. console.log("else "+this.id + " param " + param);
  703. $("#"+this.id).rules("add",{comboBoxrequired:param});
  704. }
  705. })
  706. // $("#reqBarcodeModel").change(function (){
  707. // var checked = $(this).is(':checked');
  708. // var element;
  709. // console.log(this.id);
  710. //// if (this.id =='reqBarcodeMfr'){
  711. //// element ='mfrOp';
  712. //// }
  713. // if (checked){
  714. // //$(this).parent().find('select').addClass("comboBoxrequired");
  715. // console.log(element);
  716. // $("#modelOp").removeClass("comboBoxrequired");
  717. //
  718. // }
  719. // else {
  720. // //$(this).parent().find('select').removeClass("comboBoxrequired");
  721. // console.log("else "+element);
  722. //
  723. // $("#modelOp").addClass("comboBoxrequired");
  724. // }
  725. // })
  726. //
  727. // $(".reqBarcodetree").change(function (){
  728. // var checked = $(this).is(':checked');
  729. // if (checked){
  730. // $(this).parent().find('select').addClass("comboBoxrequired");
  731. //
  732. // }
  733. // else {
  734. // $(this).parent().find('select').removeClass("comboBoxrequired");
  735. // }
  736. // })
  737. $("#hasBarcode").change(function (){
  738. var checked = $(this).is(':checked');
  739. if (checked){
  740. $("#productbarcode").attr('disabled',true);
  741. }
  742. else {
  743. $("#productbarcode").attr('disabled',false);
  744. }
  745. })
  746. $("#inv-management").click(function (){
  747. document.location.href="index.php/products/loadInventory";
  748. })
  749. </script>