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

/opensourcepos/application/views/products/products_grid_1.php

https://bitbucket.org/jit_bec/shopifine
PHP | 768 lines | 645 code | 100 blank | 23 comment | 34 complexity | 77902c15099db91be46f4dc6da65a29c 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. <!-- <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/ui-lightness/jquery-ui.css">-->
  7. <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url(); ?>css/ui.jqgrid.css" />
  8. <!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>-->
  9. <script src="<?php echo base_url(); ?>js/i18n/grid.locale-en.js" type="text/javascript"></script>
  10. <script src="<?php echo base_url(); ?>js/jquery.jqGrid.min.js" type="text/javascript" language="javascript" charset="UTF-8"></script>
  11. <style type="text/css">
  12. body { font-size: 62.5%; }
  13. label, input { display:inline; }
  14. input.text { margin-bottom:12px; width:95%; padding: .4em; }
  15. fieldset { padding:0; border:0; margin-top:25px; }
  16. h1 { font-size: 1.2em; margin: .6em 0; }
  17. div#users-contain { width: 350px; margin: 20px 0; }
  18. div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
  19. div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
  20. .ui-dialog .ui-state-error { padding: .3em; }
  21. .validateTips { border: 1px solid transparent; padding: 0.3em; }
  22. .reqBarcodeAC { position:absolute;left:230px;}
  23. * { font-family: Verdana; font-size: 96%; }
  24. label { width: 10em; float: left; }
  25. label.error { float: right; color: red; padding-left: .5em; vertical-align: top; position: relative;width:130px;}
  26. p , .column{ clear: both; padding: 1em; }
  27. .submit { margin-left: 12em; }
  28. em { font-weight: bold; padding-right: 1em; vertical-align: top; }
  29. .ui-combobox {
  30. position: relative;
  31. display: inline-block;
  32. }
  33. .ui-combobox-toggle {
  34. position: absolute;
  35. top: 0;
  36. bottom: 0;
  37. margin-left: -1px;
  38. padding: 0;
  39. }
  40. .ui-combobox-input {
  41. margin: 0;
  42. padding: 0.3em;
  43. }
  44. </style>
  45. <script>
  46. (function( $ ) {
  47. $.widget( "ui.combobox", {
  48. options: {
  49. strict: false,
  50. customChange:null
  51. },
  52. _create: function() {
  53. var input,
  54. self = this,
  55. id = this.element[0].id + "-input",
  56. select = this.element.hide(),
  57. selected = select.children( ":selected" ),
  58. value = selected.val() ? selected.text() : "",
  59. strict = this.options.strict,
  60. wrapper = this.wrapper = $( "<span>" )
  61. .addClass( "ui-combobox" )
  62. .insertAfter( select );
  63. input = $( "<input>" ).attr("id",id)
  64. .appendTo( wrapper )
  65. .val( value )
  66. .addClass( "ui-state-default ui-combobox-input" )
  67. .autocomplete({
  68. delay: 0,
  69. minLength: 0,
  70. source: function( request, response ) {
  71. var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
  72. response( select.children( "option" ).map(function() {
  73. var text = $( this ).text();
  74. if ( this.value && ( !request.term || matcher.test(text) ) )
  75. return {
  76. label: text.replace(
  77. new RegExp(
  78. "(?![^&;]+;)(?!<[^<>]*)(" +
  79. $.ui.autocomplete.escapeRegex(request.term) +
  80. ")(?![^<>]*>)(?![^&;]+;)", "gi"
  81. ), "<strong>$1</strong>" ),
  82. value: text,
  83. option: this
  84. };
  85. }) );
  86. },
  87. select: function( event, ui ) {
  88. ui.item.option.selected = true;
  89. self._trigger( "selected", event, {
  90. item: ui.item.option
  91. });
  92. },
  93. change: function( event, ui ) {
  94. //self.off();
  95. if ( !ui.item ) {
  96. var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
  97. valid = false;
  98. select.children( "option" ).each(function() {
  99. if ( $( this ).text().match( matcher ) ) {
  100. this.selected = valid = true;
  101. return false;
  102. }
  103. });
  104. if ( !valid ) {
  105. // remove invalid value, as it didn't match anything
  106. select.val( "" );
  107. if (!strict) {
  108. callback = self.options.customChange;
  109. if ($.isFunction(callback)){
  110. callback();
  111. }
  112. return;
  113. }
  114. $( this ).val( "" );
  115. input.data( "autocomplete" ).term = "";
  116. return false;
  117. }
  118. }
  119. callback = self.options.customChange;
  120. if ($.isFunction(callback)){
  121. callback();
  122. }
  123. }
  124. })
  125. .addClass( "ui-widget ui-widget-content ui-corner-left" ).keypress(function (e){
  126. console.log(e.which);
  127. if (e.which== 13){
  128. this._trigger("autocompletechange");
  129. }
  130. });
  131. input.data( "autocomplete" )._renderItem = function( ul, item ) {
  132. return $( "<li></li>" )
  133. .data( "item.autocomplete", item )
  134. .append( "<a style>" + item.label + "</a>" )
  135. .appendTo( ul );
  136. };
  137. $( "<a>" )
  138. .css("left", "100px")
  139. .attr( "tabIndex", -1 )
  140. .attr( "title", "Show All Items" )
  141. .appendTo( wrapper )
  142. .button({
  143. icons: {
  144. primary: "ui-icon-triangle-1-s"
  145. },
  146. text: false
  147. })
  148. .removeClass( "ui-corner-all" )
  149. .addClass( "ui-corner-right ui-combobox-toggle" )
  150. .click(function() {
  151. // close if already visible
  152. if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
  153. input.autocomplete( "close" );
  154. return;
  155. }
  156. // work around a bug (likely same cause as #5265)
  157. $( this ).blur();
  158. // pass empty string as value to search for, displaying all results
  159. input.autocomplete( "search", "" );
  160. input.focus();
  161. });
  162. },
  163. keypress: function (e){
  164. console.log(e.which)
  165. },
  166. destroy: function() {
  167. this.wrapper.remove();
  168. this.element.show();
  169. $.Widget.prototype.destroy.call( this );
  170. }
  171. });
  172. })( jQuery );
  173. </script>
  174. <script type="text/javascript">
  175. $(function(){
  176. $.validator.addMethod('comboBoxrequired', function(value, element) {
  177. var selectId = element.id;
  178. var inputIdSelector = "#" + selectId + "-input";
  179. if (value == ""){
  180. inputVal = $(inputIdSelector).val();
  181. if (inputVal == "" || inputVal == null){
  182. return false;
  183. }
  184. }
  185. return true;
  186. }, 'Please select from the dropdown or add new element in box');
  187. $( "#dialog:ui-dialog" ).dialog( "destroy" );
  188. $( "#productForm" ).validate({
  189. errorPlacement: function(error, element) {
  190. error.appendTo( element.parent());
  191. }//,
  192. // rules: {
  193. // mfrOp: {
  194. // comboBoxrequired: true
  195. // }
  196. // }
  197. }
  198. );
  199. $( "#dialog-form" ).dialog({
  200. autoOpen: false,
  201. height: 'auto',
  202. width: 400,
  203. position:[400,25],
  204. modal: true,
  205. buttons: {
  206. "Create the Product": function() {
  207. bValid = $("#productForm").valid();
  208. if (bValid ){
  209. $.ajax({
  210. url:"index.php/products/createBarcodeAndProduct",
  211. data: {barcodeData :{
  212. scannedBarcode : $("#productbarcode").val(),
  213. mfrOp : $("#mfrOp").val(),
  214. mfrIp: $("#mfrOp-input").val(),
  215. modelOp: $("#modelOp").val(),
  216. modelIp: $("#modelOp-input").val(),
  217. newModelIp: $("#newModelIp").val(),
  218. name: $("#name").val(),
  219. desc: $("#desc").val(),
  220. categoryOp: $("#categoryOp").val(),
  221. categoryIp: $("#categoryOp-input").val(),
  222. supplierOp: $("#supplierOp").val(),
  223. uomOp: $("#uomOp").val(),
  224. sizeOp: $("#sizeOp").val(),
  225. packageOp: $("#packageOp").val() }},
  226. type:"POST",
  227. success:function(response)
  228. {
  229. $("#product").trigger("reloadGrid");
  230. }
  231. });
  232. $( this ).dialog( "close" );
  233. }
  234. },
  235. Cancel: function() {
  236. $( this ).dialog( "close" );
  237. }
  238. },
  239. close: function() {
  240. //allFields.val( "" ).removeClass( "ui-state-error" );
  241. $("#productForm").data('validator').resetForm();
  242. $('#productForm')[0].reset();
  243. }
  244. });
  245. $( "#create-product" )
  246. .button()
  247. .click(function() {
  248. //if (!$("#newModelCtnr").parent().is(':hidden')){
  249. $("#newModelCtnr").parent().css("display","none");
  250. //}
  251. //if (!$("#modelCtnr").parent().is(':hidden')){
  252. $("#modelCtnr").parent().css("display","none");
  253. //}
  254. $( "#dialog-form" ).dialog( "open" );
  255. });
  256. $("#mfrOp").combobox({
  257. customChange: function () {
  258. if ($("#mfrOp").val()!="") {
  259. $.ajax({
  260. type:"post",
  261. data:{mfrName:$("#mfrOp-input").val(),mfr: $("#mfrOp").val()},
  262. url:"index.php/products/populateModel",
  263. success: function(data){
  264. $("#modelOp").children('option:not(:first)').remove();
  265. $("#modelOp").append(data);
  266. $("#modelOp").combobox();
  267. $("#modelCtnr").parent().slideDown(50);
  268. if (!$("#newModelCtnr").parent().is(':hidden')){
  269. $("#newModelCtnr").parent().slideUp(50);
  270. }
  271. }
  272. });
  273. }
  274. else {
  275. $("#newModelCtnr").parent().slideDown(50);
  276. if (!$("#modelCtnr").parent().is(':hidden')){
  277. $("#modelCtnr").parent().slideUp(50);
  278. }
  279. }
  280. }
  281. });
  282. $("#categoryOp").combobox();
  283. var myGrid = $("#product"),lastsel2,isModelPop;
  284. var editparameters = {
  285. "keys" : false,
  286. "oneditfunc" : null,
  287. "successfunc" : null,
  288. "url" : 'edittest',
  289. "extraparam" : {},
  290. "aftersavefunc" : null,
  291. "errorfunc": null,
  292. "afterrestorefunc" : null,
  293. "restoreAfterError" : true,
  294. "mtype" : "POST"
  295. };
  296. myGrid.jqGrid({
  297. url:'index.php/products/populateProductsInGrid',
  298. datatype: 'json',
  299. mtype: 'GET',
  300. colNames:['Barcode','System Name','Product','Description','mfr_id','model_id','Manufacturer','Model','Supplier','Package Type','Package Description','Unit','Size/Quantity'],
  301. colModel :[
  302. //{name:'id', index:'id', width:55},
  303. {name:'barcode ', index:'barcode ',width:90,align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  304. {name:'system_name ', index:'system_name ',width:90,align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  305. {name:'product_name', index:'product_name', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  306. {name:'description', index:'description', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  307. {name:'mfr_id', index:'mfr_id', hidden:true},
  308. {name:'model_id', index:'model_id', hidden:true},
  309. {name:'manufacturer', index:'manufacturer', width:80, align:'right',editable:true,edittype:"select",editoptions:{dataEvents: [
  310. { type: 'change',
  311. fn: function(e) {
  312. var val = $("#manufacturer").val();
  313. isModelPop = true;
  314. $.ajax({type:'post',
  315. data:{mfr:val},
  316. url:'index.php/products/populateModel',
  317. success: function(modelHtml){
  318. $("#model").children('option:not(:first)').remove();
  319. $("#model").append(modelHtml);
  320. }
  321. });
  322. }
  323. }
  324. ],dataUrl:"index.php/products/populateMfrs",buildSelect:function(response)
  325. {
  326. var select = "<select name=" + "mfrOpEdit" + "id =" +"mfrOpEdit" +">" +
  327. "<option value=" + ">Select one..." + response + "</select>";
  328. isModelPop = false;
  329. return select;
  330. }}},
  331. {name:'model', index:'model', width:80, align:'right',editable:true,edittype:"select",editoptions:{dataEvents: [
  332. { type: 'click',
  333. fn: function(e) {
  334. if (!isModelPop){
  335. var val = $("#manufacturer").val();
  336. $.ajax({type:'post',
  337. data:{mfr:val},
  338. url:'index.php/products/populateModel',
  339. success: function(modelHtml){
  340. $("#model").children('option:not(:first)').remove();
  341. $("#model").append(modelHtml);
  342. }
  343. });
  344. isModelPop = true;
  345. }
  346. }
  347. }
  348. ],dataUrl:"index.php/products/populateModel",buildSelect:function(response)
  349. {
  350. //var id = $("#manufacturer").val();
  351. //alert ('hi' + id);
  352. //var id = $("#mfr_id").val();
  353. var cell = myGrid.jqGrid("getCell",lastsel2,"mfr_id");
  354. console.log("cell test = " + cell);
  355. var select = "<select name=" + "modelOpEdit" + "id =" +"modelOpEdit" +">" +
  356. "<option value=" + ">Select one..." + "</select>";
  357. return select;
  358. }}},
  359. {name:'supplier', index:'supplier', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  360. {name:'package_name', index:'package_name', width:80, align:'right',editable:true,edittype:"select",editoptions:{dataEvents: [
  361. { type: 'change',
  362. fn: function(e) {
  363. }
  364. }
  365. ],dataUrl:"index.php/products/populatePackages",buildSelect:function(response)
  366. {
  367. var select = "<select name=" + "mfrOpEdit" + "id =" +"mfrOpEdit" +">" +
  368. "<option value=" + ">Select one..." + response + "</select>";
  369. //isModelPop = false;
  370. return select;
  371. }}},
  372. {name:'package_description', index:'package_description', width:80, align:'right',editable:false,editoptions:{size:"20",maxlength:"30"}},
  373. {name:'uom', index:'uom', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}},
  374. {name:'measurement_denomination', index:'measurement_denomination', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}}
  375. ],
  376. pager: '#pager',
  377. rowNum:10,
  378. rowList:[5,10,20],
  379. sortname: 'id',
  380. sortorder: 'desc',
  381. viewrecords: true,
  382. gridview: true,
  383. ignoreCase:true,
  384. rownumbers:true,
  385. caption: 'Products',
  386. height: '100%',
  387. jsonReader : {
  388. root:"productdata",
  389. page: "page",
  390. total: "total",
  391. records: "records",
  392. cell: "dprow",
  393. id: "id"
  394. },
  395. onSelectRow: function(id){
  396. lastsel2 = id;
  397. },
  398. editurl:'index.php/products/editProduct'
  399. }).navGrid("#pager",{edit:true,add:false,del:false,search:false},{height:280,reloadAfterSubmit:false,closeAfterEdit:true,onClose: function (){$("#model").children('option:not(:first)').remove();isModelPop=false;}},{},{},{},{});
  400. myGrid.jqGrid('navButtonAdd','#pager',{
  401. caption:"",
  402. title:"Export as csv",
  403. onClickButton : function () {
  404. myGrid.jqGrid('excelExport',{tag:"csv","url":"index.php/products/exportProductsInGrid"});
  405. }
  406. });
  407. myGrid.jqGrid('navButtonAdd','#pager',{
  408. caption:"",
  409. title:"Mark as inactive",
  410. buttonicon:"ui-icon-locked",
  411. onClickButton : function (id) {
  412. var rowid = myGrid.jqGrid('getGridParam', 'selrow');
  413. alert(rowid);
  414. //myGrid.jqGrid('excelExport',{tag:"csv","url":"index.php/products/exportProductsInGrid"});
  415. }
  416. });
  417. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  418. });
  419. </script>
  420. <!-- <script type="text/javascript">
  421. $(function(){
  422. var myGrid = $("#product"),lastsel2;
  423. var editparameters = {
  424. "keys" : false,
  425. "oneditfunc" : null,
  426. "successfunc" : null,
  427. "url" : 'edittest',
  428. "extraparam" : {},
  429. "aftersavefunc" : null,
  430. "errorfunc": null,
  431. "afterrestorefunc" : null,
  432. "restoreAfterError" : true,
  433. "mtype" : "POST"
  434. };
  435. myGrid.jqGrid({
  436. url:'index.php/utilities/populateDeliveryPoint',
  437. datatype: 'json',
  438. mtype: 'GET',
  439. colNames:['Name','Address'],
  440. colModel :[
  441. // {name:'id', index:'id', width:55},
  442. {name:'name', index:'name',width:90,editable:true,editoptions:{size:"20",maxlength:"30"}},
  443. {name:'address', index:'address', width:80, align:'right',editable:true,editoptions:{size:"20",maxlength:"30"}}
  444. ],
  445. pager: '#pager',
  446. rowNum:10,
  447. rowList:[5,10,20],
  448. sortname: 'id',
  449. sortorder: 'desc',
  450. viewrecords: true,
  451. gridview: true,
  452. ignoreCase:true,
  453. rownumbers:true,
  454. caption: 'My first grid',
  455. height: '100%',
  456. jsonReader : {
  457. root:"deliverypointdata",
  458. page: "page",
  459. total: "total",
  460. records: "records",
  461. cell: "dprow",
  462. id: "id"
  463. },
  464. onSelectRow: function(id){
  465. if(id && id!==lastsel2){
  466. myGrid.restoreRow(lastsel2);
  467. //myGrid.editRow(id,true);
  468. lastsel2=id;
  469. myGrid.jqGrid('editRow',id, {
  470. keys : true,
  471. oneditfunc: function() {
  472. alert ("edited");
  473. },
  474. url:'edittest'
  475. });
  476. }
  477. }
  478. ,editurl:'edittest'
  479. }).navGrid("#pager",{edit:true,add:true,del:false,search:false},{height:280,reloadAfterSubmit:false},{height:280,reloadAfterSubmit:false},{},{},{});
  480. myGrid.jqGrid('navButtonAdd','#pager',{
  481. caption:"",
  482. onClickButton : function () {
  483. myGrid.jqGrid('excelExport',{tag:"csv","url":"edittest"});
  484. }
  485. });
  486. myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch : "cn"});
  487. });
  488. </script>-->
  489. </head>
  490. <body>
  491. <?php $this->load->view("common/menubar"); ?>
  492. <div id ="dialog-form">
  493. <h1 id="formHeader">Add New Product Entity</h1>
  494. <form id="productForm">
  495. <fieldset>
  496. <div class="row">
  497. <div class="column">
  498. <div class="field">
  499. <label for="hasBarcode">Product Do Not Have Barcode</label>
  500. <input id="hasBarcode" name ="hasBarcode" type="checkbox"/>
  501. </div>
  502. </div>
  503. <div class="column">
  504. <div class="field">
  505. <label for="productbarcode" >Scan/ Type Barcode:</label>
  506. <input id="productbarcode" name ="productbarcode" type="text" class="required"/>
  507. </div>
  508. </div>
  509. </div>
  510. <div class="row">
  511. <div class="column">
  512. <div class="field">
  513. <label for="name">Name of Product Entity:</label>
  514. <input id="name" name ="name" type="text" class="required"/>
  515. </div>
  516. </div>
  517. <div class="column">
  518. <div class="field">
  519. <label for="desc">Description:</label>
  520. <input id="desc" name ="desc" type="text"/>
  521. </div>
  522. </div>
  523. </div>
  524. <div class="row">
  525. <div class="column">
  526. <div id="mfrCtnr">
  527. <div class="ui-widget field">
  528. <label for="mfrOp">Manufacturer:</label>
  529. <select name="mfrOp" id ="mfrOp">
  530. <option value="">Select one...
  531. <?= $mfrOptions?>
  532. </select>
  533. <input id="reqBarcodeMfr" name ="reqBarcodeMfr" type="checkbox" class="reqBarcode reqBarcodeAC"/>
  534. </div>
  535. </div>
  536. </div>
  537. <div class="column" style="display:none">
  538. <div id="modelCtnr">
  539. <div class="ui-widget field">
  540. <label for="modelOp">Model :</label>
  541. <select name="modelOp" id ="modelOp" >
  542. <option value="">Select one...
  543. <?= $modelOptions?>
  544. </select>
  545. <input id="reqBarcodeModel" name ="reqBarcodeModel" type="checkbox" class="reqBarcode reqBarcodeAC"/>
  546. </div>
  547. </div>
  548. </div>
  549. <div class="column" style="display:none">
  550. <div id="newModelCtnr">
  551. <div class="field">
  552. <label for="newModelIp">Specify New Model Type :</label>
  553. <input id="newModelIp" name ="newModelIp" type="text"/>
  554. </div>
  555. </div>
  556. </div>
  557. </div>
  558. <div class="row">
  559. <div class="column">
  560. <div class="field">
  561. <label for="categoryOp">Category:</label>
  562. <select name="categoryOp" id ="categoryOp" >
  563. <option value="">Choose
  564. <?= $categoryOptions ?>
  565. </select>
  566. <input id="categoryReq" name ="reqBarcodeCat" type="checkbox" class="reqBarcodeAC "/>
  567. </div>
  568. </div>
  569. <div class="column">
  570. <div class="field">
  571. <label for="supplierOp">Supplier:</label>
  572. <select name="supplierOp" id ="supplierOp" class="opt required">
  573. <option value=0>Choose
  574. <?= $supplierOptions ?>
  575. </select>
  576. <input id="reqBarcodeSupp" name ="reqBarcodeSupp" type="checkbox" class="reqBarcode"/>
  577. </div>
  578. </div>
  579. </div>
  580. <div class="row">
  581. <div class="column">
  582. <div class="field">
  583. <label for="packageOp">Package:</label>
  584. <select name="packageOp" id ="packageOp" class="required">
  585. <option value="">Choose
  586. <?= $pkgOptions ?>
  587. </select>
  588. </div>
  589. </div>
  590. </div>
  591. <div class="row">
  592. <div class="column">
  593. <div class="field">
  594. <label for="uomOp">Unit Of Measurement:</label>
  595. <select name="uomOp" id ="uomOp" class="required">
  596. <option value="">Choose
  597. </select>
  598. </div>
  599. </div>
  600. <div class="column">
  601. <div class="field" style="display:none">
  602. <label for="sizeOp">Measurement Denomination:</label>
  603. <select name="sizeOp" id ="sizeOp" class="required">
  604. <option value="">Choose
  605. </select>
  606. </div>
  607. </div>
  608. </div>
  609. </fieldset>
  610. </form>
  611. </div>
  612. <table id="product"><tr><td/></tr></table>
  613. <div id="pager"></div>
  614. <button id="create-product">Create New Product</button>
  615. </body>
  616. </html>
  617. <script type="text/javascript">
  618. $("#packageOp").change(function(){
  619. var val = $(this).val();
  620. $.ajax({type:"post",
  621. url:"index.php/products/populateMeasurementDropDowns",
  622. data: {pkgId : val},
  623. success: function(uomHtml){
  624. $("#uomOp").children('option:not(:first)').remove();
  625. $("#uomOp").append(uomHtml);
  626. }
  627. });
  628. });
  629. $("#uomOp").change(function(){
  630. var val = $(this).val();
  631. $.ajax({type:"post",
  632. url:"index.php/products/populateDenomDropdown",
  633. data: {uom : val},
  634. success: function(uomHtml){
  635. if (uomHtml!=null && uomHtml!="") {
  636. if ($("#sizeOp").parent().is(':hidden')){
  637. $("#sizeOp").parent().slideDown(50);
  638. }
  639. $("#sizeOp").children('option:not(:first)').remove();
  640. $("#sizeOp").append(uomHtml);
  641. }
  642. else {
  643. if (!$("#sizeOp").parent().is(':hidden')){
  644. $("#sizeOp").parent().slideUp(50);
  645. }
  646. }
  647. }
  648. });
  649. });
  650. $(",reqBarcodeAC").change(function (){
  651. var checked = $(this).is(':checked');
  652. if (checked){
  653. $(this).parent().find('select').addClass("comboBoxrequired");
  654. }
  655. else {
  656. $(this).parent().find('select').removeClass("comboBoxrequired");
  657. }
  658. })
  659. $("#hasBarcode").change(function (){
  660. var checked = $(this).is(':checked');
  661. if (checked){
  662. $("#productbarcode").attr('disabled',true)
  663. }
  664. else {
  665. $("#productbarcode").attr('disabled',false)
  666. }
  667. })
  668. </script>