mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-28 15:09:40 -08:00
7 lines
8.8 KiB
JavaScript
7 lines
8.8 KiB
JavaScript
|
/*
|
||
|
* bootstrap-table - v1.9.1 - 2015-10-25
|
||
|
* https://github.com/wenzhixin/bootstrap-table
|
||
|
* Copyright (c) 2015 zhixin wen
|
||
|
* Licensed MIT License
|
||
|
*/
|
||
|
!function(a){"use strict";var b=!1,c={asc:"Ascending",desc:"Descending"},d=function(b){var c=b.$sortModal.selector,d=c.substr(1);if(!a(d).hasClass("modal")){var e=' <div class="modal fade" id="'+d+'" tabindex="-1" role="dialog" aria-labelledby="'+d+'Label" aria-hidden="true">';e+=' <div class="modal-dialog">',e+=' <div class="modal-content">',e+=' <div class="modal-header">',e+=' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>',e+=' <h4 class="modal-title" id="'+d+'Label">'+b.options.formatMultipleSort()+"</h4>",e+=" </div>",e+=' <div class="modal-body">',e+=' <div class="bootstrap-table">',e+=' <div class="fixed-table-toolbar">',e+=' <div class="bars">',e+=' <div id="toolbar">',e+=' <button id="add" type="button" class="btn btn-default"><i class="'+b.options.iconsPrefix+" "+b.options.icons.plus+'"></i> '+b.options.formatAddLevel()+"</button>",e+=' <button id="delete" type="button" class="btn btn-default" disabled><i class="'+b.options.iconsPrefix+" "+b.options.icons.minus+'"></i> '+b.options.formatDeleteLevel()+"</button>",e+=" </div>",e+=" </div>",e+=" </div>",e+=' <div class="fixed-table-container">',e+=' <table id="multi-sort" class="table">',e+=" <thead>",e+=" <tr>",e+=" <th></th>",e+=' <th><div class="th-inner">'+b.options.formatColumn()+"</div></th>",e+=' <th><div class="th-inner">'+b.options.formatOrder()+"</div></th>",e+=" </tr>",e+=" </thead>",e+=" <tbody></tbody>",e+=" </table>",e+=" </div>",e+=" </div>",e+=" </div>",e+=' <div class="modal-footer">',e+=' <button type="button" class="btn btn-default" data-dismiss="modal">'+b.options.formatCancel()+"</button>",e+=' <button type="button" class="btn btn-primary">'+b.options.formatSort()+"</button>",e+=" </div>",e+=" </div>",e+=" </div>",e+=" </div>",a("body").append(a(e)),b.$sortModal=a(c);var f=b.$sortModal.find("tbody > tr");if(b.$sortModal.off("click","#add").on("click","#add",function(){var a=b.$sortModal.find(".multi-sort-name:first option").length,c=b.$sortModal.find("tbody tr").length;a>c&&(c++,b.addLevel(),b.setButtonStates())}),b.$sortModal.off("click","#delete").on("click","#delete",function(){var a=b.$sortModal.find(".multi-sort-name:first option").length,c=b.$sortModal.find("tbody tr").length;c>1&&a>=c&&(c--,b.$sortModal.find("tbody tr:last").remove(),b.setButtonStates())}),b.$sortModal.off("click",".btn-primary").on("click",".btn-primary",function(){var c=b.$sortModal.find("tbody > tr"),d=b.$sortModal.find("div.alert"),e=[],f=[];b.options.sortPriority=a.map(c,function(b){var c=a(b),d=c.find(".multi-sort-name").val(),f=c.find(".multi-sort-order").val();return e.push(d),{sortName:d,sortOrder:f}});for(var g=e.sort(),h=0;h<e.length-1;h++)g[h+1]==g[h]&&f.push(g[h]);f.length>0?0===d.length&&(d='<div class="alert alert-danger" role="alert"><strong>'+b.options.formatDuplicateAlertTitle()+"</strong> "+b.options.formatDuplicateAlertDescription()+"</div>",a(d).insertBefore(b.$sortModal.find(".bars"))):(1===d.length&&a(d).remove(),b.options.sortName="",b.onMultipleSort(),b.$sortModal.modal("hide"))}),(null===b.options.sortPriority||0===b.options.sortPriority.length)&&b.options.sortName&&(b.options.sortPriority=
|