PageRenderTime 58ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/magehelp/application/views/products/products_grid_bkup.php

https://bitbucket.org/jit_bec/shopifine
PHP | 906 lines | 735 code | 103 blank | 68 comment | 44 complexity | bdce7d976909f0160442273b35250bb6 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. }
  76. );
  77. $( "#dialog-form" ).dialog({
  78. autoOpen: false,
  79. height: 'auto',
  80. width: '70%',
  81. position:[200,25],
  82. modal: true,
  83. buttons: {
  84. "Create the Product": {
  85. id:"create_product",
  86. text:"Create the Product",
  87. click:function() {
  88. var bValid = $("#productForm").valid();
  89. console.log(bValid);
  90. if (bValid ){
  91. var selectedIds = [];
  92. $('#treeViewDiv').jstree('get_selected').each(function(){
  93. selectedIds.push($(this).attr('id'));
  94. });
  95. $.ajax({
  96. url:"index.php/products/createBarcodeAndProduct",
  97. data: {barcodeData :{
  98. scannedBarcode : $("#productbarcode").val(),
  99. mfrOp : $("#mfrOp").val(),
  100. mfrIp: $("#mfrOp-input").val(),
  101. modelOp: $("#modelOp").val(),
  102. modelIp: $("#modelOp-input").val(),
  103. newModelIp: $("#newModelIp").val(),
  104. name: $("#name").val(),
  105. desc: $("#desc").val(),
  106. category:JSON.stringify(selectedIds),
  107. supplierOp: $("#supplierOp").val(),
  108. uomOp: $("#uomOp").val(),
  109. sizeOp: $("#sizeOp").val(),
  110. reorderLevel: $("#reorderLevel").val(),
  111. // costPrice: $("#costPrice").val(),
  112. // price: $("#price").val(),
  113. attributeSet:$("#attributeSetOp").val(),
  114. packageOp: $("#packageOp").val(),override:$("#createOverride").val() }
  115. },
  116. type:"POST",
  117. success:function(serverresponse)
  118. {
  119. var response = JSON.parse(serverresponse);
  120. emptyMessages();
  121. if (response.status=='error'){
  122. //showErrorMessage(response.message)
  123. $("#status_warning_text").text(response.message);
  124. $( "#modal-warning-general" ).dialog("open");
  125. }
  126. else if (response.status=='exists'){
  127. emptyMessagesGen('status-message-product')
  128. showErrorMessageGen(response.message, 'status-message-product');
  129. $("#possibleProductCntnr").show();
  130. $("#create_product >span").text("Still Create A New Product")
  131. $("#createOverride").val("1");
  132. //$("#status_warning_text").text(response.message);
  133. //$( "#modal-warning-general" ).dialog("open");
  134. // $( this ).dialog( "close" );
  135. }
  136. else {
  137. $( this ).dialog( "close" );
  138. showSuccessMessage(response.message)
  139. $("#product").trigger("reloadGrid");
  140. }
  141. }
  142. });
  143. }
  144. }
  145. }
  146. ,
  147. Cancel: function() {
  148. $( this ).dialog( "close" );
  149. }
  150. },
  151. close: function() {
  152. //allFields.val( "" ).removeClass( "ui-state-error" );
  153. $("#productbarcode").attr('disabled',false);
  154. $("#productForm").data('validator').resetForm();
  155. $('#productForm')[0].reset();
  156. $('.inithide').hide();
  157. $("#createOverride").val("0");
  158. $("#create_product >span").text("Create A New Product")
  159. },
  160. open :function(){
  161. $('.inithide').hide();
  162. }
  163. });
  164. $("#mfrOp").combobox({
  165. customChange: function () {
  166. if ($("#mfrOp").val()!="") {
  167. $.ajax({
  168. type:"post",
  169. data:{mfrName:$("#mfrOp-input").val(),mfr: $("#mfrOp").val()},
  170. url:"index.php/products/populateModel",
  171. success: function(data){
  172. $("#modelOp").children('option:not(:first)').remove();
  173. $("#modelOp").append(data);
  174. $("#modelOp").combobox();
  175. $("#modelCtnr").parent().slideDown(50);
  176. if (!$("#newModelCtnr").parent().is(':hidden')){
  177. $("#newModelCtnr").parent().slideUp(50);
  178. }
  179. }
  180. });
  181. }
  182. else {
  183. $("#newModelCtnr").parent().slideDown(50);
  184. if (!$("#modelCtnr").parent().is(':hidden')){
  185. $("#modelCtnr").parent().slideUp(50);
  186. }
  187. }
  188. }
  189. });
  190. $("#categoryOp").combobox();
  191. var myGrid = $("#product"),lastsel2,selectedMfrId,selectedModelId,selectedPkgId,selectUom,selectedDenom;
  192. myGrid.jqGrid({
  193. url:'index.php/products/populateProductsInGrid',
  194. datatype: 'json',
  195. mtype: 'GET',
  196. colNames:['Barcode',/*'System Name',*/'Product','Description','manufacturer_id','model_id','Manufacturer','Model',/*'Supplier',*/'package_id','Package Type',/*'Category',*/'Unit','Size/Quantity','Action'],
  197. colModel :[
  198. //{name:'id', index:'id', width:55},
  199. {name:'barcode',index:'barcode',width:120,align:'right',editable:false},
  200. // {name:'system_name',index:'system_name',width:90,align:'right',editable:false},
  201. {name:'product_name', index:'product_name', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  202. {name:'description', index:'description', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  203. {name:'manufacturer_id', index:'manufacturer_id', hidden:true},
  204. {name:'model_id', index:'model_id', hidden:true},
  205. {name:'manufacturer', index:'manufacturer', width:80, align:'right',editable:true,edittype:"select",editoptions:{dataEvents: [
  206. { type: 'change',
  207. fn: function(e) {
  208. var val = $("#manufacturer").val();
  209. $.ajax({type:'post',
  210. data:{mfr:val},
  211. url:'index.php/products/populateModel',
  212. success: function(modelHtml){
  213. //console.log ("change mfr");
  214. $("#model").children('option:not(:first)').remove();
  215. $("#model").append(modelHtml);
  216. }
  217. });
  218. }
  219. }
  220. ],dataUrl:"index.php/products/populateMfrs",buildSelect:function(response)
  221. {
  222. var select = "<select name=" + "mfrOpEdit" + "id =" +"mfrOpEdit" +">" +
  223. "<option value=" + ">Select one..." + response + "</select>";
  224. $.ajax({type:'post',
  225. data:{mfr:selectedMfrId},
  226. url:'index.php/products/populateModel',
  227. success: function(modelHtml){
  228. //console.log("ajax mfr" + selectedModelId );
  229. $("#model").children('option:not(:first)').remove();
  230. $("#model").append(modelHtml);
  231. $("#model").val(selectedModelId);
  232. }
  233. });
  234. return select;
  235. }}},
  236. {name:'model', index:'model', width:80, align:'right',editable:true,edittype:"select",editoptions:{dataUrl:"index.php/products/doNothing",buildSelect:function(response)
  237. {
  238. //console.log("build select");
  239. var select = "<select name=" + "modelOpEdit" + "id =" +"modelOpEdit" +">" +
  240. "<option value=" + ">Select one..." + "</select>";
  241. return select;
  242. }}},
  243. // {name:'supplier', index:'supplier', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  244. {name:'package_id', index:'package_id', hidden:true},
  245. {name:'package_name', index:'package_name', width:80, align:'right',editable:true,edittype:"select",editoptions:{dataEvents: [
  246. { type: 'change',
  247. fn: function(e) {
  248. var val = $("#package_name").val();
  249. //console.log ("while changing" + val)
  250. $.ajax({type:"post",
  251. url:"index.php/products/populateMeasurementDropDowns",
  252. data: {pkgId : val},
  253. success: function(uomHtml){
  254. //console.log ("in success " + val);
  255. //console.log ("in success uomHtml " + uomHtml);
  256. $("#uom").children('option:not(:first)').remove();
  257. $("#uom").append(uomHtml);
  258. }
  259. });
  260. }
  261. }
  262. ],dataUrl:"index.php/products/populatePackages",buildSelect:function(response)
  263. {
  264. var select = "<select name=" + "mfrPkEdit" + "id =" +"mfrPkEdit" +">" +
  265. "<option value=" + ">Select one..." + response + "</select>";
  266. //console.log ("package type val " + selectedPkgId);
  267. $.ajax({type:"post",
  268. url:"index.php/products/populateMeasurementDropDowns",
  269. data: {pkgId : selectedPkgId},
  270. success: function(uomHtml){
  271. $("#uom").children('option:not(:first)').remove();
  272. $("#uom").append(uomHtml);
  273. //console.log ("before setting uom val " + selectUom);
  274. $("#uom").val(selectUom);
  275. }
  276. });
  277. return select;
  278. }}},
  279. // {name:'category', index:'category', width:100, align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  280. {name:'uom', index:'uom', width:40, align:'right',editable:true,edittype:"select",editoptions:{dataEvents: [
  281. { type: 'change',
  282. fn: function(e) {
  283. var val = $("#uom").val();
  284. //console.log ("while changing uom" + val)
  285. $.ajax({type:"post",
  286. url:"index.php/products/populateDenomDropdown",
  287. data: {uom : val},
  288. success: function(sizeHtml){
  289. if (sizeHtml!=null && sizeHtml!="") {
  290. if ($("#measurement_denomination").is(':disabled')){
  291. $("#measurement_denomination").attr('disabled','false');
  292. }
  293. $("#measurement_denomination").children('option:not(:first)').remove();
  294. $("#measurement_denomination").append(sizeHtml);
  295. }
  296. else {
  297. if (!$("#measurement_denomination").is(':disabled')){
  298. $("#measurement_denomination").attr('disabled','true');
  299. }
  300. }
  301. }
  302. });
  303. }
  304. }
  305. ],dataUrl:"index.php/products/populateMeasurementDropDowns",buildSelect:function(response)
  306. {
  307. var val = selectUom;
  308. //console.log("build uom" + val);
  309. var select = "<select name=" + "modelOpEdit" + "id =" +"modelOpEdit" +">" +
  310. "<option value=" + ">Select one..." + "</select>";
  311. return select;
  312. }}},
  313. {name:'measurement_denomination', index:'measurement_denomination', width:60, align:'right',editable:true,edittype:"select",editoptions:{dataUrl:"index.php/products/doNothing",buildSelect:function(response)
  314. {
  315. var val = selectUom;
  316. //console.log("build size" + val);
  317. var select = "<select name=" + "modelOpEdit" + "id =" +"modelOpEdit" +">" +
  318. "<option value=" + ">Select one..." + "</select>";
  319. $.ajax({type:"post",
  320. url:"index.php/products/populateDenomDropdown",
  321. data: {uom : val},
  322. success: function(sizeHtml){
  323. if (sizeHtml!=null && sizeHtml!="") {
  324. if ($("#measurement_denomination").is(':disabled')){
  325. $("#measurement_denomination").attr('disabled','false');
  326. }
  327. //console.log ("measurement denom " + sizeHtml);
  328. //console.log ("measurement denom sel " + selectedDenom);
  329. $("#measurement_denomination").children('option:not(:first)').remove();
  330. $("#measurement_denomination").append(sizeHtml);
  331. $("#measurement_denomination").val(selectedDenom);
  332. }
  333. else {
  334. if (!$("#measurement_denomination").is(':disabled')){
  335. $("#measurement_denomination").attr('disabled','true');
  336. }
  337. }
  338. }
  339. });
  340. return select;
  341. }}},
  342. //{name:'isactive', index:'isactive', width:30, align:'right',editable:true,edittype:"select", formatter:'select', editoptions:{value:"1:Yes;0:No"}}
  343. {name:'generate', index:'generate', width:80, align:'right',editable:false,search:false,formatter:'showlink', formatoptions:{baseLinkUrl:'index.php/products/printBarcode'},cellattr: function (rowId, val, rawObject, cm, rdata)
  344. {
  345. //console.log(rawObject[0]);
  346. return 'title="' + rawObject[0]+'"';
  347. }}
  348. ],
  349. pager: '#pager',
  350. rowNum:10,
  351. rowList:[5,10,20],
  352. sortname: 'id',
  353. sortorder: 'desc',
  354. viewrecords: true,
  355. gridview: true,
  356. ignoreCase:true,
  357. rownumbers:true,
  358. caption: 'Products',
  359. multiselect:true,
  360. height: '100%',
  361. width:'90%',
  362. jsonReader : {
  363. root:"productdata",
  364. page: "page",
  365. total: "total",
  366. records: "records",
  367. cell: "dprow",
  368. id: "id"
  369. },
  370. onSelectRow: function(id){
  371. lastsel2 = id;
  372. selectedMfrId = myGrid.jqGrid("getCell",id,"manufacturer_id");
  373. selectedModelId = myGrid.jqGrid("getCell",id,"model_id");
  374. selectedPkgId = myGrid.jqGrid("getCell",id,"package_id");
  375. selectUom = myGrid.jqGrid("getCell",id,"uom");
  376. selectedDenom = myGrid.jqGrid("getCell",id,"measurement_denomination");
  377. },
  378. editurl:'index.php/products/editProduct',
  379. postData:{"test":"val"}
  380. }).navGrid("#pager",{edit:true,add:false,del:false,search:false},{height:280,reloadAfterSubmit:false,closeAfterEdit:true,recreateForm:true,checkOnSubmit:true},{},{},{},{});
  381. myGrid.jqGrid('navButtonAdd','#pager',{
  382. caption:"",
  383. title:"Export as csv",
  384. id:"export_product",
  385. onClickButton : function () {
  386. myGrid.jqGrid('excelExport',{tag:"csv","url":"index.php/products/exportProductsInGrid"});
  387. }
  388. });
  389. myGrid.jqGrid('navButtonAdd','#pager',{
  390. caption:"",
  391. title:"Create Product",
  392. buttonicon:"ui-icon-plus",
  393. id:"add_product",
  394. onClickButton : function () {
  395. $("#newModelCtnr").parent().css("display","none");
  396. $("#modelCtnr").parent().css("display","none");
  397. $( "#dialog-form" ).dialog( "open" );
  398. }
  399. });
  400. myGrid.jqGrid('navButtonAdd','#pager',{
  401. caption:"",
  402. title:"Mark as inactive",
  403. id:"inactive_product",
  404. buttonicon:"ui-icon-locked",
  405. onClickButton : function (id) {
  406. var rowid = myGrid.jqGrid('getGridParam', 'selarrrow');
  407. $.ajax({type:"post",
  408. url:"index.php/products/deactivate",
  409. data: {ids : rowid},
  410. success: function(){
  411. $("#product").trigger("reloadGrid");
  412. }
  413. });
  414. }
  415. });
  416. myGrid.jqGrid('navButtonAdd','#pager',{
  417. caption:"",
  418. title:"Mark as active",
  419. id:"active_product",
  420. buttonicon:"ui-icon-unlocked",
  421. onClickButton : function (id) {
  422. var rowid = myGrid.jqGrid('getGridParam', 'selarrrow');
  423. $.ajax({type:"post",
  424. url:"index.php/products/activate",
  425. data: {ids : rowid},
  426. success: function(){
  427. $("#product").trigger("reloadGrid");
  428. }
  429. });
  430. }
  431. });
  432. myGrid.jqGrid('navButtonAdd','#pager',{
  433. caption:"",
  434. title:"Load all ",
  435. id:"load_product",
  436. buttonicon:"ui-icon-arrow-4-diag",
  437. onClickButton : function (id) {
  438. var rowid = myGrid.jqGrid('getGridParam', 'selarrrow');
  439. $.ajax({type:"post",
  440. url:"index.php/products/populateProductsInGrid",
  441. data: {loadall : true},
  442. success: function(response){
  443. //$("#product").trigger("reloadGrid");
  444. var grid = jQuery("#product")[0];
  445. var myjsongrid = eval("("+response+")");
  446. grid.addJSONData(myjsongrid);
  447. }
  448. });
  449. }
  450. });
  451. myGrid.jqGrid ('navButtonAdd', '#pager',
  452. { caption: "", buttonicon: "ui-icon-calculator",
  453. title: "Choose Columns",
  454. onClickButton: function() {
  455. myGrid.jqGrid('columnChooser');
  456. }
  457. });
  458. $("#add_product").insertBefore("#edit_product");
  459. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  460. $(".chzn-select").chosen();
  461. $("#treeViewDiv")
  462. .jstree({
  463. "plugins" : ["themes", "json_data", "ui"],
  464. "json_data" : {
  465. "ajax" : {
  466. "type": 'GET',
  467. "url": function (node) {
  468. var nodeId = "";
  469. var url = ""
  470. if (node == -1)
  471. {
  472. url = "index.php/utilities/renderParents";
  473. }
  474. else
  475. {
  476. nodeId = node.attr('id');
  477. url = "index.php/utilities/renderChildren";
  478. }
  479. return url;
  480. },
  481. data : function(node) {
  482. if (node != -1){
  483. return {
  484. "nodeid":$.trim(node.attr('id'))
  485. }
  486. }
  487. },
  488. "success": function (new_data) {
  489. return new_data;
  490. }
  491. }
  492. }})
  493. });
  494. $(window).load(function(){
  495. var warningDialogs={one:true,none:true,status:true,exactlyone:true,morethanone:true};
  496. initDialogs(warningDialogs);
  497. initPaymentDialog();
  498. initCommentsForQuote();
  499. initAssignmentCommon();
  500. //initErrorDialogs({total:true,advance:true});
  501. //this is from payment dialog.The Select Inout is in dialogs.php
  502. });
  503. </script>
  504. </head>
  505. <body>
  506. <?php $this->load->view("common/menubar"); ?>
  507. <?php $this->load->view("common/dialogs"); ?>
  508. <!-- <button id="create-product">Create New Product</button> -->
  509. <!--<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>-->
  510. <div id ="dialog-form" title="Add New Product Entity">
  511. <!-- <h1 id="formHeader">Add New Product Entity</h1> -->
  512. <form id="productForm">
  513. <fieldset>
  514. <div class="row">
  515. <div class="column">
  516. <div class="field">
  517. <label for="hasBarcode" class="labeldiv">Product Do Not Have Barcode</label>
  518. <input id="hasBarcode" name ="hasBarcode" type="checkbox"/>
  519. </div>
  520. </div>
  521. <div class="column">
  522. <div class="field">
  523. <label for="productbarcode" class="labeldiv">Scan/ Type Barcode:</label>
  524. <input id="productbarcode" name ="productbarcode" type="text" class="required"/>
  525. </div>
  526. </div>
  527. </div>
  528. <div class="row">
  529. <div class="column">
  530. <div class="field">
  531. <label for="name" class="labeldiv">Name of Product Entity:</label>
  532. <input id="name" name ="name" type="text" class="required"/>
  533. </div>
  534. </div>
  535. <div class="column">
  536. <div class="field">
  537. <label for="attributeSetOp" class="labeldiv">Attribute Set:</label>
  538. <select name="attributeSetOp" id ="attributeSetOp" class="required">
  539. <option value="">Choose
  540. <?= $attributeSetOptions ?>
  541. </select>
  542. </div>
  543. </div>
  544. </div>
  545. <div class="row inithide">
  546. <div class="column">
  547. <div class="field">
  548. <label for="desc" class="labeldiv">Description:</label>
  549. <textarea id="desc" name ="desc" rows="3" cols="30" class="required"></textarea>
  550. </div>
  551. </div>
  552. <div class="column">
  553. <div class="field">
  554. <label for="metadesc" class="labeldiv">Meta Description:</label>
  555. <textarea id="metadesc" name ="metadesc" rows="3" cols="30"></textarea>
  556. </div>
  557. </div>
  558. </div>
  559. <div class="row">
  560. <div class="column">
  561. <div id="mfrCtnr">
  562. <div class="ui-widget field">
  563. <label for="mfrOp" class="labeldiv">Manufacturer :</label>
  564. <select name="mfrOp" id ="mfrOp" >
  565. <option value="">Select one...
  566. <?= $mfrOptions?>
  567. </select>
  568. </div>
  569. </div>
  570. <div class="row" style="padding-top:5px;">
  571. <input id="reqBarcodeMfr" name ="reqBarcodeMfr" type="checkbox" class="reqBarcode reqBarcodeAC" style="left:26%"/>
  572. <div class="help-message">Caution:Mark As Not Required Only In Exception Circumstances</div>
  573. </div>
  574. </div>
  575. <div class="column" style="display:none">
  576. <div id="modelCtnr">
  577. <div class="ui-widget field">
  578. <label for="modelOp" class="labeldiv">Model :</label>
  579. <select name="modelOp" id ="modelOp">
  580. <option value="">Select one...
  581. <?= $modelOptions?>
  582. </select>
  583. </div>
  584. </div>
  585. <div class="row" style="padding-top:5px;">
  586. <input id="reqBarcodeModel" name ="reqBarcodeModel" type="checkbox" class="reqBarcode reqBarcodeAC" style="left:26%"/>
  587. <div class="help-message">Caution:Mark As Not Required Only In Exception Circumstances</div>
  588. </div>
  589. </div>
  590. <div class="column" style="display:none">
  591. <div id="newModelCtnr">
  592. <div class="field">
  593. <label for="newModelIp" class="labeldiv">Specify New Model Type :</label>
  594. <input id="newModelIp" name ="newModelIp" type="text"/>
  595. </div>
  596. </div>
  597. </div>
  598. </div>
  599. <div class="row">
  600. <div class="column">
  601. <div class="field">
  602. <label for="categoryOp" class="labeldiv">Category:</label>
  603. <!-- <select name="categoryOp" id ="categoryOp" >
  604. <option value="">Choose
  605. <?= $categoryOptions ?>
  606. </select>-->
  607. <div id="treeViewDiv" style="display:inline-block">
  608. </div>
  609. <!--<input id="categoryReq" name ="reqBarcodeCat" type="checkbox" class="reqBarcodeAC "/>-->
  610. </div>
  611. </div>
  612. <div class="column">
  613. <div class="field">
  614. <label for="supplierOp" class="labeldiv">Supplier:</label>
  615. <select name="supplierOp[]" id ="supplierOp" class="chzn-select" multiple="multiple" style="width:15em;;height:1em;">
  616. <?= $supplierOptions ?>
  617. </select>
  618. </div>
  619. </div>
  620. </div>
  621. <div class="row">
  622. <div class="column">
  623. <div class="field">
  624. <label for="packageOp" class="labeldiv">Package:</label>
  625. <select name="packageOp" id ="packageOp" class="required">
  626. <option value="">Choose
  627. <?= $pkgOptions ?>
  628. </select>
  629. </div>
  630. </div>
  631. <div class="column inithide">
  632. <div class="field">
  633. <label for="reorderLevel" class="labeldiv">Reorder Level :</label>
  634. <input id="reorderLevel" name="reorderLevel" type="text"/>
  635. </div>
  636. </div>
  637. </div>
  638. <div class="row">
  639. <div class="column">
  640. <div class="field">
  641. <label for="uomOp" class="labeldiv">Unit Of Measurement:</label>
  642. <select name="uomOp" id ="uomOp" class="required">
  643. <option value="">Choose
  644. </select>
  645. </div>
  646. </div>
  647. <div class="column">
  648. <div class="field" style="display:none">
  649. <label for="sizeOp" class="labeldiv">Measurement Denomination:</label>
  650. <select name="sizeOp" id ="sizeOp" class="required">
  651. <option value="">Choose
  652. </select>
  653. </div>
  654. </div>
  655. </div>
  656. <div id="possibleProductCntnr" class="inithide" style="margin-top:5em">
  657. <div class="ui-widget">
  658. <div id ="status-message-product" class="ui-corner-all" style="margin: 0 auto; padding: 0 .7em;">
  659. <p><span style="float: left; margin-right: .3em;"></span>
  660. </p>
  661. </div>
  662. </div>
  663. <div class="table-grid" style="padding-top:2em;">
  664. <h1 id="pkdheader_product">Matching Products</h1>
  665. <table id="matchingproduct"><tr><td/></tr></table>
  666. <div id="pagerMatchingProduct"></div>
  667. </div>
  668. <!-- <div class="table-grid" style="padding-top:2em;">
  669. <h1 id="pkdheader_attribute">Attributes Used In Barcode </h1>
  670. <table id="barcodeAttributes"><tr><td/></tr></table>
  671. <div id="pagerBarcodeAttributes"></div>
  672. </div>-->
  673. </div>
  674. <input id="createOverride" name="createOverride" type="hidden" value="0"/>
  675. <!-- <div class="row">
  676. <div class="column">
  677. <div class="field">
  678. <label for="costPrice" class="labeldiv">Cost Price :</label>
  679. <input id="costPrice" name="costPrice" type="text"/>
  680. </div>
  681. </div>
  682. <div class="column">
  683. <div class="field">
  684. <label for="price" class="labeldiv">Final Price :</label>
  685. <input id="price" name="price" type="text"/>
  686. </div>
  687. </div>
  688. </div>-->
  689. </fieldset>
  690. </form>
  691. </div>
  692. <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">
  693. <?php $this->load->view("common/message"); ?>
  694. <table id="product"><tr><td/></tr></table>
  695. <div id="pager"></div>
  696. </div>
  697. <!-- <button id="create-product">Create New Product</button>-->
  698. <!-- <div id="feedback_bar"></div>-->
  699. <?php $this->load->view("partial/footer"); ?>
  700. </body>
  701. </html>
  702. <script type="text/javascript">
  703. $("#packageOp").change(function(){
  704. var val = $(this).val();
  705. $.ajax({type:"post",
  706. url:"index.php/products/populateMeasurementDropDowns",
  707. data: {pkgId : val},
  708. success: function(uomHtml){
  709. $("#uomOp").children('option:not(:first)').remove();
  710. $("#uomOp").append(uomHtml);
  711. }
  712. });
  713. });
  714. $("#uomOp").change(function(){
  715. var val = $(this).val();
  716. $.ajax({type:"post",
  717. url:"index.php/products/populateDenomDropdown",
  718. data: {uom : val},
  719. success: function(uomHtml){
  720. if (uomHtml!=null && uomHtml!="") {
  721. if ($("#sizeOp").parent().is(':hidden')){
  722. $("#sizeOp").parent().slideDown(50);
  723. }
  724. $("#sizeOp").children('option:not(:first)').remove();
  725. $("#sizeOp").append(uomHtml);
  726. }
  727. else {
  728. if (!$("#sizeOp").parent().is(':hidden')){
  729. $("#sizeOp").parent().slideUp(50);
  730. }
  731. }
  732. }
  733. });
  734. });
  735. $(".reqBarcodeAC").change(function (){
  736. var checked = $(this).is(':checked');
  737. var element;
  738. console.log(this.id);
  739. // if (this.id =='reqBarcodeMfr'){
  740. // element ='mfrOp';
  741. // }
  742. if (checked){
  743. //$(this).parent().find('select').addClass("comboBoxrequired");
  744. console.log(element);
  745. $("#"+this.id).rules("remove","comboBoxrequired");
  746. }
  747. else {
  748. //$(this).parent().find('select').removeClass("comboBoxrequired");
  749. console.log("else "+element);
  750. if (this.id =='reqBarcodeMfr'){
  751. param ='mfrOp';
  752. }
  753. else if (this.id =='reqBarcodeModel'){
  754. param ='modelOp';
  755. }
  756. console.log("else "+this.id + " param " + param);
  757. $("#"+this.id).rules("add",{comboBoxrequired:param});
  758. }
  759. })
  760. // $("#reqBarcodeModel").change(function (){
  761. // var checked = $(this).is(':checked');
  762. // var element;
  763. // console.log(this.id);
  764. //// if (this.id =='reqBarcodeMfr'){
  765. //// element ='mfrOp';
  766. //// }
  767. // if (checked){
  768. // //$(this).parent().find('select').addClass("comboBoxrequired");
  769. // console.log(element);
  770. // $("#modelOp").removeClass("comboBoxrequired");
  771. //
  772. // }
  773. // else {
  774. // //$(this).parent().find('select').removeClass("comboBoxrequired");
  775. // console.log("else "+element);
  776. //
  777. // $("#modelOp").addClass("comboBoxrequired");
  778. // }
  779. // })
  780. //
  781. // $(".reqBarcodetree").change(function (){
  782. // var checked = $(this).is(':checked');
  783. // if (checked){
  784. // $(this).parent().find('select').addClass("comboBoxrequired");
  785. //
  786. // }
  787. // else {
  788. // $(this).parent().find('select').removeClass("comboBoxrequired");
  789. // }
  790. // })
  791. $("#hasBarcode").change(function (){
  792. var checked = $(this).is(':checked');
  793. if (checked){
  794. $("#productbarcode").attr('disabled',true);
  795. }
  796. else {
  797. $("#productbarcode").attr('disabled',false);
  798. }
  799. })
  800. $("#inv-management").click(function (){
  801. document.location.href="index.php/products/loadInventory";
  802. })
  803. </script>