Advertisement
Guest User

cheddle eats nutella off dudes

a guest
Jul 25th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. function changeStatus(detail){
  2. var target = null;
  3. if (jQuery('#nm_detail_wrapper').length > 0) target = jQuery('#nm_detail_wrapper');
  4. else target = jQuery('#detail_wrapper' + detail);
  5.  
  6. target.find('.detailItemsTableRow').each(function(i) {jQuery(this).attr('rownum',i)});
  7.  
  8. if (target.find(".detailItems").length > 0)
  9. {
  10. var obj = jQuery(target.find(".detailItems")).clone().off();
  11. obj.removeClass("detailItems");
  12. obj.addClass("detailItemsClone");
  13. obj.find('.detailItemsTableRow').each(function(i) {
  14. jQuery(this).removeClass("detailItemsTableRow").addClass('detailCloneRow' + i);
  15. });
  16. obj.appendTo(target.find('.detail_main'));
  17. }
  18.  
  19. jQuery(target).find('tr.detailItemsTableRow').unbind();
  20. jQuery(target).find('tr.detailItemsTableRow').bind("DOMSubtreeModified",updateStatus);
  21. }
  22.  
  23. function updateStatus() {
  24. var row = jQuery(this);
  25. row.unbind();
  26. var rownum = row.attr('rownum');
  27. var cloneRow = row.closest('.detailCloneRow' + rownum);
  28. var lib = row.find(".detailItemsTable_LIBRARY div:first").text().trim();
  29. var homeLoc = row.find(".detailItemsTable_LOCATION").text().trim();
  30. var statusRow = cloneRow.find(".detailItemsTable_SD_ITEM_STATUS div:first");
  31. var status = statusRow.text().trim();
  32.  
  33. if (homeLoc == '' || lib == '' | status == '') return false;
  34.  
  35. console.log('homeLoc: ' + homeLoc);
  36. console.log('lib: ' + lib);
  37. console.log('status: ' + status);
  38.  
  39. prefixes(lib, homeLoc, row);
  40.  
  41. if ((homeLoc == status) && (lib != "State library Orders") && (lib != "State library")){
  42. statusRow.text('On shelf');
  43. }
  44. else if ((homeLoc == status) && (lib == "State library")){
  45. statusRow.text('Online');
  46. }
  47. else if ((homeLoc == status) && (lib == "State library Orders")){
  48. statusRow.text('On Order');
  49. }
  50. row.bind("DOMSubtreeModified",updateStatus);
  51. }
  52.  
  53. function shelfNumberPrepend(tr, text) {
  54. var rownum = tr.attr('rownum');
  55. var cloneRow = tr.closest('.detailCloneRow' + rownum);
  56. cloneRow.find('td:nth-child(3)').prepend(text);
  57. }
  58.  
  59. function ShelfLocationUpdate(tr, text) {
  60. var rownum = tr.attr('rownum');
  61. var cloneRow = tr.closest('.detailCloneRow' + rownum);
  62. cloneRow.find('td:nth-child(2)').text(text);
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement