Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function changeStatus(detail){
- var target = null;
- if (jQuery('#nm_detail_wrapper').length > 0) target = jQuery('#nm_detail_wrapper');
- else target = jQuery('#detail_wrapper' + detail);
- target.find('.detailItemsTableRow').each(function(i) {jQuery(this).attr('rownum',i)});
- if (target.find(".detailItems").length > 0)
- {
- var obj = jQuery(target.find(".detailItems")).clone().off();
- obj.removeClass("detailItems");
- obj.addClass("detailItemsClone");
- obj.find('.detailItemsTableRow').each(function(i) {
- jQuery(this).removeClass("detailItemsTableRow").addClass('detailCloneRow' + i);
- });
- obj.appendTo(target.find('.detail_main'));
- }
- jQuery(target).find('tr.detailItemsTableRow').unbind();
- jQuery(target).find('tr.detailItemsTableRow').bind("DOMSubtreeModified",updateStatus);
- }
- function updateStatus() {
- var row = jQuery(this);
- row.unbind();
- var rownum = row.attr('rownum');
- var cloneRow = row.closest('.detailCloneRow' + rownum);
- var lib = row.find(".detailItemsTable_LIBRARY div:first").text().trim();
- var homeLoc = row.find(".detailItemsTable_LOCATION").text().trim();
- var statusRow = cloneRow.find(".detailItemsTable_SD_ITEM_STATUS div:first");
- var status = statusRow.text().trim();
- if (homeLoc == '' || lib == '' | status == '') return false;
- console.log('homeLoc: ' + homeLoc);
- console.log('lib: ' + lib);
- console.log('status: ' + status);
- prefixes(lib, homeLoc, row);
- if ((homeLoc == status) && (lib != "State library Orders") && (lib != "State library")){
- statusRow.text('On shelf');
- }
- else if ((homeLoc == status) && (lib == "State library")){
- statusRow.text('Online');
- }
- else if ((homeLoc == status) && (lib == "State library Orders")){
- statusRow.text('On Order');
- }
- row.bind("DOMSubtreeModified",updateStatus);
- }
- function shelfNumberPrepend(tr, text) {
- var rownum = tr.attr('rownum');
- var cloneRow = tr.closest('.detailCloneRow' + rownum);
- cloneRow.find('td:nth-child(3)').prepend(text);
- }
- function ShelfLocationUpdate(tr, text) {
- var rownum = tr.attr('rownum');
- var cloneRow = tr.closest('.detailCloneRow' + rownum);
- cloneRow.find('td:nth-child(2)').text(text);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement