Skip to content

A free open source IT asset/license management system

Added footer style for nicer number cell padding

snipe083cf7830518
diff --git a/app/Presenters/AccessoryPresenter.php b/app/Presenters/AccessoryPresenter.php
index 5e79cb4a20..6d423bed78 100644
--- a/app/Presenters/AccessoryPresenter.php
+++ b/app/Presenters/AccessoryPresenter.php
@@ -84,13 +84,14 @@ class AccessoryPresenter extends Presenter
'sortable' => true,
'title' => trans('general.min_amt'),
'formatter' => 'minAmtFormatter',
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
], [
'field' => 'qty',
'searchable' => false,
'sortable' => true,
'title' => trans('admin/accessories/general.total'),
'footerFormatter' => 'qtySumFormatter',
+ 'class' => 'text-right text-padding-number-cell',
], [
'field' => 'remaining',
'searchable' => false,
@@ -98,6 +99,7 @@ class AccessoryPresenter extends Presenter
'visible' => false,
'title' => trans('admin/accessories/general.remaining'),
'footerFormatter' => 'qtySumFormatter',
+ 'class' => 'text-right text-padding-number-cell',
],[
'field' => 'checkouts_count',
'searchable' => false,
@@ -105,6 +107,7 @@ class AccessoryPresenter extends Presenter
'visible' => true,
'title' => trans('general.checked_out'),
'footerFormatter' => 'qtySumFormatter',
+ 'class' => 'text-right text-padding-number-cell',
], [
'field' => 'purchase_date',
'searchable' => true,
@@ -118,7 +121,7 @@ class AccessoryPresenter extends Presenter
'sortable' => true,
'title' => trans('general.purchase_cost'),
'footerFormatter' => 'sumFormatterQuantity',
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
], [
'field' => 'order_number',
'searchable' => true,
diff --git a/app/Presenters/AssetModelPresenter.php b/app/Presenters/AssetModelPresenter.php
index 5eaf7dc448..2ed019eaea 100644
--- a/app/Presenters/AssetModelPresenter.php
+++ b/app/Presenters/AssetModelPresenter.php
@@ -75,7 +75,7 @@ class AssetModelPresenter extends Presenter
'title' => trans('mail.min_QTY'),
'visible' => true,
'formatter' => 'minAmtFormatter',
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
],
[
@@ -85,7 +85,7 @@ class AssetModelPresenter extends Presenter
'switchable' => true,
'title' => trans('admin/models/table.numassets'),
'visible' => true,
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
],
@@ -96,7 +96,7 @@ class AssetModelPresenter extends Presenter
'switchable' => true,
'title' => trans('general.remaining'),
'visible' => true,
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
],
[
diff --git a/app/Presenters/ComponentPresenter.php b/app/Presenters/ComponentPresenter.php
index 3bdc7728f9..61f7a0ef4b 100644
--- a/app/Presenters/ComponentPresenter.php
+++ b/app/Presenters/ComponentPresenter.php
@@ -85,7 +85,7 @@ class ComponentPresenter extends Presenter
'sortable' => true,
'title' => trans('general.min_amt'),
'visible' => true,
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'formatter' => 'minAmtFormatter',
], [
'field' => 'qty',
@@ -93,7 +93,7 @@ class ComponentPresenter extends Presenter
'sortable' => true,
'title' => trans('admin/components/general.total'),
'visible' => true,
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
], [
'field' => 'remaining',
@@ -101,7 +101,7 @@ class ComponentPresenter extends Presenter
'sortable' => false,
'title' => trans('admin/components/general.remaining'),
'visible' => true,
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
], [
'field' => 'location',
diff --git a/app/Presenters/ConsumablePresenter.php b/app/Presenters/ConsumablePresenter.php
index db982cac6f..fd4cee272c 100644
--- a/app/Presenters/ConsumablePresenter.php
+++ b/app/Presenters/ConsumablePresenter.php
@@ -79,14 +79,14 @@ class ConsumablePresenter extends Presenter
'title' => trans('general.min_amt'),
'visible' => true,
'formatter' => 'minAmtFormatter',
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
], [
'field' => 'qty',
'searchable' => false,
'sortable' => true,
'title' => trans('admin/components/general.total'),
'visible' => true,
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
], [
'field' => 'remaining',
@@ -94,6 +94,7 @@ class ConsumablePresenter extends Presenter
'sortable' => true,
'title' => trans('admin/components/general.remaining'),
'visible' => true,
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
], [
'field' => 'location',
@@ -128,7 +129,7 @@ class ConsumablePresenter extends Presenter
'title' => trans('general.purchase_cost'),
'visible' => true,
'footerFormatter' => 'sumFormatterQuantity',
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
], [
'field' => 'notes',
'searchable' => true,
diff --git a/app/Presenters/LicensePresenter.php b/app/Presenters/LicensePresenter.php
index a54431a87e..f6ccafa8ac 100644
--- a/app/Presenters/LicensePresenter.php
+++ b/app/Presenters/LicensePresenter.php
@@ -86,20 +86,20 @@ class LicensePresenter extends Presenter
'sortable' => true,
'title' => trans('mail.min_QTY'),
'formatter' => 'minAmtFormatter',
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
], [
'field' => 'seats',
'searchable' => false,
'sortable' => true,
'title' => trans('admin/accessories/general.total'),
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
], [
'field' => 'free_seats_count',
'searchable' => false,
'sortable' => true,
'title' => trans('admin/accessories/general.remaining'),
- 'class' => 'text-right',
+ 'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
], [
'field' => 'purchase_date',
diff --git a/public/css/build/app.css b/public/css/build/app.css
index 7ea8f083b9..eb8a1db230 100644
--- a/public/css/build/app.css
+++ b/public/css/build/app.css
@@ -1418,4 +1418,12 @@ input[type="radio"]:checked::before {
.bootstrap-table .fixed-table-container .table tbody tr .card-view {
display: table-row !important;
}
+td.text-right.text-padding-number-cell {
+ padding-right: 30px !important;
+ white-space: nowrap;
+}
+th.text-right.text-padding-number-footer-cell {
+ padding-right: 20px !important;
+ white-space: nowrap;
+}
diff --git a/public/css/build/overrides.css b/public/css/build/overrides.css
index 1074758f2b..edf9a25d82 100644
--- a/public/css/build/overrides.css
+++ b/public/css/build/overrides.css
@@ -1049,4 +1049,12 @@ input[type="radio"]:checked::before {
.bootstrap-table .fixed-table-container .table tbody tr .card-view {
display: table-row !important;
}
+td.text-right.text-padding-number-cell {
+ padding-right: 30px !important;
+ white-space: nowrap;
+}
+th.text-right.text-padding-number-footer-cell {
+ padding-right: 20px !important;
+ white-space: nowrap;
+}
diff --git a/public/css/dist/all.css b/public/css/dist/all.css
index 848587ae70..7f8f7a5717 100644
--- a/public/css/dist/all.css
+++ b/public/css/dist/all.css
@@ -22753,6 +22753,14 @@ input[type="radio"]:checked::before {
.bootstrap-table .fixed-table-container .table tbody tr .card-view {
display: table-row !important;
}
+td.text-right.text-padding-number-cell {
+ padding-right: 30px !important;
+ white-space: nowrap;
+}
+th.text-right.text-padding-number-footer-cell {
+ padding-right: 20px !important;
+ white-space: nowrap;
+}
.select2-container {
@@ -24288,4 +24296,12 @@ input[type="radio"]:checked::before {
.bootstrap-table .fixed-table-container .table tbody tr .card-view {
display: table-row !important;
}
+td.text-right.text-padding-number-cell {
+ padding-right: 30px !important;
+ white-space: nowrap;
+}
+th.text-right.text-padding-number-footer-cell {
+ padding-right: 20px !important;
+ white-space: nowrap;
+}
diff --git a/public/js/build/app.js b/public/js/build/app.js
index 9bd78d354e..1f061aabd1 100644
--- a/public/js/build/app.js
+++ b/public/js/build/app.js
@@ -1,833 +1,322 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
-/***/ "./resources/assets/js/bootstrap.js":
-/*!******************************************!*\
- !*** ./resources/assets/js/bootstrap.js ***!
- \******************************************/
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+/***/ "./node_modules/admin-lte/build/less/AdminLTE.less":
+/*!*********************************************************!*\
+ !*** ./node_modules/admin-lte/build/less/AdminLTE.less ***!
+ \*********************************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
-/**
- * We'll load jQuery and the Bootstrap jQuery plugin which provides support
- * for JavaScript based Bootstrap features such as modals and tabs. This
- * code may be modified to fit the specific needs of your application.
- */
-//window.$ = window.jQuery = require('jquery');
-/**
- * jQuery UI is loaded here and then the tooltip is assigned another funtion name
- * This resolves the issue of jquery-ui & bootstrap tooltip conflict
- */
-__webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui/ui/widget.js");
-jQuery.fn.uitooltip = jQuery.fn.tooltip;
+/***/ }),
-/**
- * Load boostrap
+/***/ "./node_modules/bootstrap-less/js/bootstrap.js":
+/*!*****************************************************!*\
+ !*** ./node_modules/bootstrap-less/js/bootstrap.js ***!
+ \*****************************************************/
+/***/ (() => {
+
+/* */
+"format global";
+"deps jquery";
+"exports $";
+/*!
+ * Bootstrap v3.3.4 (http://getbootstrap.com)
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
-__webpack_require__(/*! bootstrap-less */ "./node_modules/bootstrap-less/js/bootstrap.js");
-// require('admin-lte');
+if (typeof jQuery === 'undefined') {
+ throw new Error('Bootstrap\'s JavaScript requires jQuery')
+}
-// require('chart.js');
++function ($) {
+ 'use strict';
+ var version = $.fn.jquery.split(' ')[0].split('.')
+ if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
+ throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
+ }
+}(jQuery);
-// require('jquery-form-validator'); //says something about dependency
-/**
- * Echo exposes an expressive API for subscribing to channels and listening
- * for events that are broadcast by Laravel. Echo and event broadcasting
- * allows your team to easily build robust real-time web applications.
- */
+/* ========================================================================
+ * Bootstrap: transition.js v3.3.4
+ * http://getbootstrap.com/javascript/#transitions
+ * ========================================================================
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
-// import Echo from "laravel-echo"
-// window.Echo = new Echo({
-// broadcaster: 'pusher',
-// key: 'your-pusher-key'
-// });
++function ($) {
+ 'use strict';
-/***/ }),
+ // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
+ // ============================================================
-/***/ "./resources/assets/js/snipeit.js":
-/*!****************************************!*\
- !*** ./resources/assets/js/snipeit.js ***!
- \****************************************/
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+ function transitionEnd() {
+ var el = document.createElement('bootstrap')
-// var jQuery = require('jquery');
-// window.jQuery = jQuery
-// window.$ = jQuery
+ var transEndEventNames = {
+ WebkitTransition : 'webkitTransitionEnd',
+ MozTransition : 'transitionend',
+ OTransition : 'oTransitionEnd otransitionend',
+ transition : 'transitionend'
+ }
-__webpack_require__(/*! ./bootstrap */ "./resources/assets/js/bootstrap.js");
+ for (var name in transEndEventNames) {
+ if (el.style[name] !== undefined) {
+ return { end: transEndEventNames[name] }
+ }
+ }
-/**
- * Module containing core application logic.
- * @param {jQuery} $ Insulated jQuery object
- * @param {JSON} settings Insulated `window.snipeit.settings` object.
- * @return {IIFE} Immediately invoked. Returns self.
- */
+ return false // explicit for ie8 ( ._.)
+ }
-lineOptions = {
- legend: {
- position: "bottom"
- },
- scales: {
- yAxes: [{
- ticks: {
- fontColor: "rgba(0,0,0,0.5)",
- fontStyle: "bold",
- beginAtZero: true,
- maxTicksLimit: 5,
- padding: 20
- },
- gridLines: {
- drawTicks: false,
- display: false
- }
- }],
- xAxes: [{
- gridLines: {
- zeroLineColor: "transparent"
- },
- ticks: {
- padding: 20,
- fontColor: "rgba(0,0,0,0.5)",
- fontStyle: "bold"
- }
- }]
+ // http://blog.alexmaccaw.com/css-transitions
+ $.fn.emulateTransitionEnd = function (duration) {
+ var called = false
+ var $el = this
+ $(this).one('bsTransitionEnd', function () { called = true })
+ var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
+ setTimeout(callback, duration)
+ return this
}
-};
-pieOptions = {
- //Boolean - Whether we should show a stroke on each segment
- segmentShowStroke: true,
- //String - The colour of each segment stroke
- segmentStrokeColor: "#fff",
- //Number - The width of each segment stroke
- segmentStrokeWidth: 1,
- //Number - The percentage of the chart that we cut out of the middle
- percentageInnerCutout: 50,
- // This is 0 for Pie charts
- //Number - Amount of animation steps
- animationSteps: 100,
- //String - Animation easing effect
- animationEasing: "easeOutBounce",
- //Boolean - Whether we animate the rotation of the Doughnut
- animateRotate: true,
- //Boolean - Whether we animate scaling the Doughnut from the centre
- animateScale: false,
- //Boolean - whether to make the chart responsive to window resizing
- responsive: true,
- // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
- maintainAspectRatio: false,
- //String - A legend template
- legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li>" + "<i class='fas fa-circle-o' style='color: <%=segments[i].fillColor%>'></i>" + "<%if(segments[i].label){%><%=segments[i].label%><%}%> foo</li><%}%></ul>",
- //String - A tooltip template
- tooltipTemplate: "<%=value %> <%=label%> "
-};
-//-----------------
-//- END PIE CHART -
-//-----------------
+ $(function () {
+ $.support.transition = transitionEnd()
-var baseUrl = $('meta[name="baseUrl"]').attr('content');
-$(function () {
- var $el = $('table');
+ if (!$.support.transition) return
- // confirm restore modal
+ $.event.special.bsTransitionEnd = {
+ bindType: $.support.transition.end,
+ delegateType: $.support.transition.end,
+ handle: function (e) {
+ if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
+ }
+ }
+ })
- $el.on('click', '.restore-asset', function (evnt) {
- var $context = $(this);
- var $restoreConfirmModal = $('#restoreConfirmModal');
- var href = $context.attr('href');
- var message = $context.attr('data-content');
- var title = $context.attr('data-title');
- $('#confirmModalLabel').text(title);
- $restoreConfirmModal.find('.modal-body').text(message);
- $('#restoreForm').attr('action', href);
- $restoreConfirmModal.modal({
- show: true
- });
- return false;
- });
+}(jQuery);
- // confirm delete modal
+/* ========================================================================
+ * Bootstrap: alert.js v3.3.4
+ * http://getbootstrap.com/javascript/#alerts
+ * ========================================================================
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
- $el.on('click', '.delete-asset', function (evnt) {
- var $context = $(this);
- var $dataConfirmModal = $('#dataConfirmModal');
- var href = $context.attr('href');
- var message = $context.attr('data-content');
- var title = $context.attr('data-title');
- $('#myModalLabel').text(title);
- $dataConfirmModal.find('.modal-body').text(message);
- $('#deleteForm').attr('action', href);
- $dataConfirmModal.modal({
- show: true
- });
- return false;
- });
- /*
- * Slideout help menu
- */
- $('.slideout-menu-toggle').on('click', function (event) {
- event.preventDefault();
- // create menu variables
- var slideoutMenu = $('.slideout-menu');
- var slideoutMenuWidth = $('.slideout-menu').width();
++function ($) {
+ 'use strict';
- // toggle open class
- slideoutMenu.toggleClass("open");
+ // ALERT CLASS DEFINITION
+ // ======================
- // slide menu
- if (slideoutMenu.hasClass("open")) {
- slideoutMenu.show();
- slideoutMenu.animate({
- right: "0px"
- });
- } else {
- slideoutMenu.animate({
- right: -slideoutMenuWidth
- }, "-350px");
- slideoutMenu.fadeOut();
- }
- });
+ var dismiss = '[data-dismiss="alert"]'
+ var Alert = function (el) {
+ $(el).on('click', dismiss, this.close)
+ }
- /*
- * Select2
- */
+ Alert.VERSION = '3.3.4'
- $('select.select2:not(".select2-hidden-accessible")').each(function (i, obj) {
- {
- $(obj).select2();
- }
- });
+ Alert.TRANSITION_DURATION = 150
- // $('.datepicker').datepicker();
- // var datepicker = $.fn.datepicker.noConflict(); // return $.fn.datepicker to previously assigned value
- // $.fn.bootstrapDP = datepicker;
- // $('.datepicker').datepicker();
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ var selector = $this.attr('data-target')
- // Crazy select2 rich dropdowns with images!
- $('.js-data-ajax').each(function (i, item) {
- var link = $(item);
- var endpoint = link.data("endpoint");
- var select = link.data("select");
- link.select2({
- /**
- * Adds an empty placeholder, allowing every select2 instance to be cleared.
- * This placeholder can be overridden with the "data-placeholder" attribute.
- */
- placeholder: '',
- allowClear: true,
- language: $('meta[name="language"]').attr('content'),
- dir: $('meta[name="language-direction"]').attr('content'),
- ajax: {
- // the baseUrl includes a trailing slash
- url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
- dataType: 'json',
- delay: 250,
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: function data(params) {
- var data = {
- search: params.term,
- page: params.page || 1,
- assetStatusType: link.data("asset-status-type")
- };
- return data;
- },
- /* processResults: function (data, params) {
- params.page = params.page || 1;
- var answer = {
- results: data.items,
- pagination: {
- more: data.pagination.more
- }
- };
- return answer;
- }, */
- cache: true
- },
- //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
- templateResult: formatDatalistSafe
- //templateSelection: formatDataSelection
- });
- });
- function getSelect2Value(element) {
- // if the passed object is not a jquery object, assuming 'element' is a selector
- if (!(element instanceof jQuery)) element = $(element);
- var select = element.data("select2");
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
+ }
- // There's two different locations where the select2-generated input element can be.
- searchElement = select.dropdown.$search || select.$container.find(".select2-search__field");
- var value = searchElement.val();
- return value;
- }
- $(".select2-hidden-accessible").on('select2:selecting', function (e) {
- var data = e.params.args.data;
- var isMouseUp = false;
- var element = $(this);
- var value = getSelect2Value(element);
- if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
+ var $parent = $(selector)
- // if selected item does not match typed text, do not allow it to pass - force close for ajax.
- if (!isMouseUp) {
- if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) < 0) {
- e.preventDefault();
- element.select2('close');
+ if (e) e.preventDefault()
- // if it does match, we set a flag in the event (which gets passed to subsequent events), telling it not to worry about the ajax
- } else if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) > -1) {
- e.params.args.noForceAjax = true;
- }
+ if (!$parent.length) {
+ $parent = $this.closest('.alert')
}
- });
- $(".select2-hidden-accessible").on('select2:closing', function (e) {
- var element = $(this);
- var value = getSelect2Value(element);
- var noForceAjax = false;
- var isMouseUp = false;
- if (e.params.args.originalSelect2Event) noForceAjax = e.params.args.originalSelect2Event.noForceAjax;
- if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
- if (value && !noForceAjax && !isMouseUp) {
- var endpoint = element.data("endpoint");
- var assetStatusType = element.data("asset-status-type");
- $.ajax({
- url: baseUrl + 'api/v1/' + endpoint + '/selectlist?search=' + value + '&page=1' + (assetStatusType ? '&assetStatusType=' + assetStatusType : ''),
- dataType: 'json',
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- }
- }).done(function (response) {
- var currentlySelected = element.select2('data').map(function (x) {
- return +x.id;
- }).filter(function (x) {
- return x !== 0;
- });
- // makes sure we're not selecting the same thing twice for multiples
- var filteredResponse = response.results.filter(function (item) {
- return currentlySelected.indexOf(+item.id) < 0;
- });
- var first = currentlySelected.length > 0 ? filteredResponse[0] : response.results[0];
- if (first && first.id) {
- first.selected = true;
- if ($("option[value='" + first.id + "']", element).length < 1) {
- var option = new Option(first.text, first.id, true, true);
- element.append(option);
- } else {
- var isMultiple = element.attr("multiple") == "multiple";
- element.val(isMultiple ? element.val().concat(first.id) : element.val(first.id));
- }
- element.trigger('change');
- element.trigger({
- type: 'select2:select',
- params: {
- data: first
- }
- });
- }
- });
- }
- });
- function formatDatalist(datalist) {
- var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
- if (datalist.loading) {
- return loading_markup;
- }
- var markup = '<div class="clearfix">';
- markup += '<div class="pull-left" style="padding-right: 10px;">';
- if (datalist.image) {
- markup += "<div style='width: 30px;'><img src='" + datalist.image + "' style='max-height: 20px; max-width: 30px;' alt='" + datalist.text + "'></div>";
- } else {
- markup += '<div style="height: 20px; width: 30px;"></div>';
- }
- markup += "</div><div>" + datalist.text + "</div>";
- markup += "</div>";
- return markup;
- }
- function formatDatalistSafe(datalist) {
- // console.warn("What in the hell is going on with Select2?!?!!?!?");
- // console.warn($.select2);
- if (datalist.loading) {
- return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
- }
- var root_div = $("<div class='clearfix'>");
- var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
- if (datalist.image) {
- var inner_div = $("<div style='width: 30px;'>");
- /******************************************************************
- *
- * We are specifically chosing empty alt-text below, because this
- * image conveys no additional information, relative to the text
- * that will *always* be there in any select2 list that is in use
- * in Snipe-IT. If that changes, we would probably want to change
- * some signatures of some functions, but right now, we don't want
- * screen readers to say "HP SuperJet 5000, .... picture of HP
- * SuperJet 5000..." and so on, for every single row in a list of
- * assets or models or whatever.
- *
- *******************************************************************/
- var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
- // console.warn("Img is: ");
- // console.dir(img);
- // console.warn("Strigularly, that's: ");
- // console.log(img);
- img.attr("src", datalist.image);
- inner_div.append(img);
- } else {
- var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
- }
- left_pull.append(inner_div);
- root_div.append(left_pull);
- var name_div = $("<div>");
- name_div.text(datalist.text);
- root_div.append(name_div);
- var safe_html = root_div.get(0).outerHTML;
- var old_html = formatDatalist(datalist);
- if (safe_html != old_html) {
- //console.log("HTML MISMATCH: ");
- //console.log("FormatDatalistSafe: ");
- // console.dir(root_div.get(0));
- //console.log(safe_html);
- //console.log("FormatDataList: ");
- //console.log(old_html);
+ $parent.trigger(e = $.Event('close.bs.alert'))
+
+ if (e.isDefaultPrevented()) return
+
+ $parent.removeClass('in')
+
+ function removeElement() {
+ // detach from parent, fire event then clean up data
+ $parent.detach().trigger('closed.bs.alert').remove()
}
- return root_div;
+
+ $.support.transition && $parent.hasClass('fade') ?
+ $parent
+ .one('bsTransitionEnd', removeElement)
+ .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
+ removeElement()
}
- function formatDataSelection(datalist) {
- // This a heinous workaround for a known bug in Select2.
- // Without this, the rich selectlists are vulnerable to XSS.
- // Many thanks to @uberbrady for this fix. It ain't pretty,
- // but it resolves the issue until Select2 addresses it on their end.
- //
- // Bug was reported in 2016 :{
- // https://github.com/select2/select2/issues/4587
- return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
+
+ // ALERT PLUGIN DEFINITION
+ // =======================
+
+ function Plugin(option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.alert')
+
+ if (!data) $this.data('bs.alert', (data = new Alert(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
}
- // This handles the radio button selectors for the checkout-to-foo options
- // on asset checkout and also on asset edit
- $(function () {
- $('input[name=checkout_to_type]').on("change", function () {
- var assignto_type = $('input[name=checkout_to_type]:checked').val();
- var userid = $('#assigned_user option:selected').val();
- if (assignto_type == 'asset') {
- $('#current_assets_box').fadeOut();
- $('#assigned_asset').show();
- $('#assigned_user').hide();
- $('#assigned_location').hide();
- $('.notification-callout').fadeOut();
- $('[name="assigned_location"]').val('').trigger('change.select2');
- $('[name="assigned_user"]').val('').trigger('change.select2');
- } else if (assignto_type == 'location') {
- $('#current_assets_box').fadeOut();
- $('#assigned_asset').hide();
- $('#assigned_user').hide();
- $('#assigned_location').show();
- $('.notification-callout').fadeOut();
- $('[name="assigned_asset"]').val('').trigger('change.select2');
- $('[name="assigned_user"]').val('').trigger('change.select2');
- } else {
- $('#assigned_asset').hide();
- $('#assigned_user').show();
- $('#assigned_location').hide();
- if (userid) {
- $('#current_assets_box').fadeIn();
- }
- $('.notification-callout').fadeIn();
- $('[name="assigned_asset"]').val('').trigger('change.select2');
- $('[name="assigned_location"]').val('').trigger('change.select2');
- }
- });
- });
-
- // ------------------------------------------------
- // Deep linking for Bootstrap tabs
- // ------------------------------------------------
- var taburl = document.location.toString();
+ var old = $.fn.alert
- // Allow full page URL to activate a tab's ID
- // ------------------------------------------------
- // This allows linking to a tab on page load via the address bar.
- // So a URL such as, http://snipe-it.local/hardware/2/#my_tab will
- // cause the tab on that page with an ID of “my_tab” to be active.
- if (taburl.match('#')) {
- $('.nav-tabs a[href="#' + taburl.split('#')[1] + '"]').tab('show');
- }
+ $.fn.alert = Plugin
+ $.fn.alert.Constructor = Alert
- // Allow internal page links to activate a tab's ID.
- // ------------------------------------------------
- // This allows you to link to a tab from anywhere on the page
- // including from within another tab. Also note that internal page
- // links either inside or out of the tabs need to include data-toggle="tab"
- // Ex: <a href="#my_tab" data-toggle="tab">Click me</a>
- $('a[data-toggle="tab"]').click(function (e) {
- var href = $(this).attr("href");
- history.pushState(null, null, href);
- e.preventDefault();
- $('a[href="' + $(this).attr('href') + '"]').tab('show');
- });
- // ------------------------------------------------
- // End Deep Linking for Bootstrap tabs
- // ------------------------------------------------
+ // ALERT NO CONFLICT
+ // =================
- // Image preview
- function readURL(input, $preview) {
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- reader.onload = function (e) {
- $preview.attr('src', e.target.result);
- };
- reader.readAsDataURL(input.files[0]);
- }
- }
- function formatBytes(bytes) {
- if (bytes < 1024) return bytes + " Bytes";else if (bytes < 1048576) return (bytes / 1024).toFixed(2) + " KB";else if (bytes < 1073741824) return (bytes / 1048576).toFixed(2) + " MB";else return (bytes / 1073741824).toFixed(2) + " GB";
+ $.fn.alert.noConflict = function () {
+ $.fn.alert = old
+ return this
}
- // File size validation
- $('.js-uploadFile').bind('change', function () {
- var $this = $(this);
- var id = '#' + $this.attr('id');
- var status = id + '-status';
- var $status = $(status);
- var delete_id = $(id + '-deleteCheckbox');
- var preview_container = $(id + '-previewContainer');
- $status.removeClass('text-success').removeClass('text-danger');
- $(status + ' .goodfile').remove();
- $(status + ' .badfile').remove();
- $(status + ' .previewSize').hide();
- preview_container.hide();
- $(id + '-info').html('');
- var max_size = $this.data('maxsize');
- var total_size = 0;
- for (var i = 0; i < this.files.length; i++) {
- total_size += this.files[i].size;
- $(id + '-info').append('<span class="label label-default">' + htmlEntities(this.files[i].name) + ' (' + formatBytes(this.files[i].size) + ')</span> ');
- }
- if (total_size > max_size) {
- $status.addClass('text-danger').removeClass('help-block').prepend('<i class="badfile fas fa-times"></i> ').append('<span class="previewSize"> Upload is ' + formatBytes(total_size) + '.</span>');
- } else {
- $status.addClass('text-success').removeClass('help-block').prepend('<i class="goodfile fas fa-check"></i> ');
- var $preview = $(id + '-imagePreview');
- readURL(this, $preview);
- $preview.fadeIn();
- preview_container.fadeIn();
- delete_id.hide();
- }
- });
-});
-function htmlEntities(str) {
- return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
-}
-/**
- * Toggle disabled
- */
-(function ($) {
- $.fn.toggleDisabled = function (callback) {
- return this.each(function () {
- var disabled,
- $this = $(this);
- if ($this.attr('disabled')) {
- $this.removeAttr('disabled');
- disabled = false;
- } else {
- $this.attr('disabled', 'disabled');
- disabled = true;
- }
- if (callback && typeof callback === 'function') {
- callback(this, disabled);
- }
- });
- };
-})(jQuery);
+ // ALERT DATA-API
+ // ==============
-/**
- * Universal Livewire Select2 integration
- *
- * How to use:
- *
- * 1. Set the class of your select2 elements to 'livewire-select2').
- * 2. Name your element to match a property in your Livewire component
- * 3. Add an attribute called 'data-livewire-component' that points to $this->getId() (via `{{ }}` if you're in a blade,
- * or just $this->getId() if not).
- */
-document.addEventListener('livewire:init', function () {
- $('.livewire-select2').select2();
- $(document).on('select2:select', '.livewire-select2', function (event) {
- var target = $(event.target);
- if (!event.target.name || !target.data('livewire-component')) {
- console.error("You need to set both name (which should match a Livewire property) and data-livewire-component on your Livewire-ed select2 elements!");
- console.error("For data-livewire-component, you probably want to use $this->getId() or {{ $this->getId() }}, as appropriate");
- return false;
- }
- Livewire.find(target.data('livewire-component')).set(event.target.name, this.options[this.selectedIndex].value);
- });
- Livewire.hook('request', function (_ref) {
- var succeed = _ref.succeed;
- succeed(function () {
- queueMicrotask(function () {
- $('.livewire-select2').select2();
- });
- });
- });
-});
+ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
-/***/ }),
+}(jQuery);
-/***/ "./resources/assets/js/snipeit_modals.js":
-/*!***********************************************!*\
- !*** ./resources/assets/js/snipeit_modals.js ***!
- \***********************************************/
-/***/ (() => {
+/* ========================================================================
+ * Bootstrap: button.js v3.3.4
+ * http://getbootstrap.com/javascript/#buttons
+ * ========================================================================
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
-/*
- *
- * Snipe-IT Universal Modal support
- *
- * Enables modal dialogs to create sub-resources throughout Snipe-IT
- *
- */
-/*
-HOW TO USE
- Create a Button looking like this:
- <a href='{{ route('modal.show', 'user') }}' data-toggle="modal" data-target="#createModal" data-select='assigned_to' class="btn btn-sm btn-primary">New</a>
- If you don't have access to Blade commands (like {{ and }}, etc), you can hard-code a URL as the 'href'
- data-toggle="modal" - required for Bootstrap Modals
-data-target="#createModal" - fixed ID for the modal, do not change
-data-select="assigned_to" - What is the *ID* of the select-dropdown that you're going to be adding to, if the modal-create was a success? Be on the lookout for duplicate ID's, it will confuse this library!
-class="btn btn-sm btn-primary" - makes it look button-ey, feel free to change :)
++function ($) {
+ 'use strict';
-If you want to pass additional variables to the modal (In the Category Create one, for example, you can pass category_id), you can encode them as URL variables in the href
+ // BUTTON PUBLIC CLASS DEFINITION
+ // ==============================
-*/
+ var Button = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, Button.DEFAULTS, options)
+ this.isLoading = false
+ }
-$(function () {
- var baseUrl = $('meta[name="baseUrl"]').attr('content');
- //handle modal-add-interstitial calls
- var model, select, refreshSelector;
- if ($('#createModal').length == 0) {
- $('body').append('<div class="modal fade" id="createModal"></div><!-- /.modal -->');
+ Button.VERSION = '3.3.4'
+
+ Button.DEFAULTS = {
+ loadingText: 'loading...'
}
- $('#createModal').on("show.bs.modal", function (event) {
- var link = $(event.relatedTarget);
- model = link.data("dependency");
- select = link.data("select");
- refreshSelector = link.data("refresh");
- $('#createModal').load(link.attr('href'), function () {
- // this sets the focus to be the name field
- $('#modal-name').focus();
- //do we need to re-select2 this, after load? Probably.
- $('#createModal').find('select.select2').select2();
- // Initialize the ajaxy select2 with images.
- // This is a copy/paste of the code from snipeit.js, would be great to only have this in one place.
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ var $el = this.$element
+ var val = $el.is('input') ? 'val' : 'html'
+ var data = $el.data()
- $('.js-data-ajax').each(function (i, item) {
- var link = $(item);
- var endpoint = link.data("endpoint");
- var select = link.data("select");
- link.select2({
- ajax: {
- // the baseUrl includes a trailing slash
- url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
- //WARNING - we're hoping that's defined on the page somewhere...
- dataType: 'json',
- delay: 250,
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: function data(params) {
- var data = {
- search: params.term,
- page: params.page || 1,
- assetStatusType: link.data("asset-status-type")
- };
- return data;
- },
- /*processResults: function (data, params) {
- params.page = params.page || 1;
- var answer = {
- results: data.items,
- pagination: {
- more: data.pagination.more
- }
- };
- return answer;
- },*/
- cache: true
- },
- //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
- templateResult: formatDatalistSafe
- //templateSelection: formatDataSelection
- });
- });
- });
- });
- $('#createModal').on('click', '#modal-save', function () {
- $.ajax({
- type: 'POST',
- url: $('.modal-body form').attr('action'),
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: $('.modal-body form').serialize(),
- success: function success(result) {
- if (result.status == "error") {
- var error_message = "";
- for (var field in result.messages) {
- error_message += "<li>Problem(s) with field <i><strong>" + field + "</strong></i>: " + result.messages[field];
- }
- $('#modal_error_msg').html(error_message).show();
- return false;
- }
- var id = result.payload.id;
- var name = result.payload.name || result.payload.first_name + " " + result.payload.last_name;
- if (!id || !name) {
- console.error("Could not find resulting name or ID from modal-create. Name: " + name + ", id: " + id);
- return false;
- }
- $('#createModal').modal('hide');
- $('#createModal').html("");
- var refreshTable = $('#' + refreshSelector);
- if (refreshTable.length > 0) {
- refreshTable.bootstrapTable('refresh');
- }
+ state = state + 'Text'
- // "select" is the original drop-down menu that someone
- // clicked 'add' on to add a new 'thing'
- // this code adds the newly created object to that select
- var selector = document.getElementById(select);
- if (!selector) {
- return false;
- }
- selector.options[selector.length] = new Option(name, id);
- selector.selectedIndex = selector.length - 1;
- $(selector).trigger("change");
- if (window.fetchCustomFields) {
- fetchCustomFields();
- }
- },
- error: function error(result) {
- msg = result.responseJSON.messages || result.responseJSON.error;
- $('#modal_error_msg').html("Server Error: " + msg).show();
+ if (data.resetText == null) $el.data('resetText', $el[val]())
+
+ // push to event loop to allow forms to submit
+ setTimeout($.proxy(function () {
+ $el[val](data[state] == null ? this.options[state] : data[state])
+
+ if (state == 'loadingText') {
+ this.isLoading = true
+ $el.addClass(d).attr(d, d)
+ } else if (this.isLoading) {
+ this.isLoading = false
+ $el.removeClass(d).removeAttr(d)
}
- });
- });
-});
-function formatDatalistSafe(datalist) {
- // console.warn("What in the hell is going on with Select2?!?!!?!?");
- // console.warn($.select2);
- if (datalist.loading) {
- return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
- }
- var root_div = $("<div class='clearfix'>");
- var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
- if (datalist.image) {
- var inner_div = $("<div style='width: 30px;'>");
- /******************************************************************
- *
- * We are specifically chosing empty alt-text below, because this
- * image conveys no additional information, relative to the text
- * that will *always* be there in any select2 list that is in use
- * in Snipe-IT. If that changes, we would probably want to change
- * some signatures of some functions, but right now, we don't want
- * screen readers to say "HP SuperJet 5000, .... picture of HP
- * SuperJet 5000..." and so on, for every single row in a list of
- * assets or models or whatever.
- *
- *******************************************************************/
- var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
- // console.warn("Img is: ");
- // console.dir(img);
- // console.warn("Strigularly, that's: ");
- // console.log(img);
- img.attr("src", datalist.image);
- inner_div.append(img);
- } else {
- var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
- }
- left_pull.append(inner_div);
- root_div.append(left_pull);
- var name_div = $("<div>");
- name_div.text(datalist.text);
- root_div.append(name_div);
- var safe_html = root_div.get(0).outerHTML;
- var old_html = formatDatalist(datalist);
- if (safe_html != old_html) {
- // console.log("HTML MISMATCH: ");
- // console.log("FormatDatalistSafe: ");
- // console.dir(root_div.get(0));
- // console.log(safe_html);
- // console.log("FormatDataList: ");
- // console.log(old_html);
+ }, this), 0)
}
- return root_div;
-}
-function formatDatalist(datalist) {
- var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
- if (datalist.loading) {
- return loading_markup;
+
+ Button.prototype.toggle = function () {
+ var changed = true
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
+
+ if ($parent.length) {
+ var $input = this.$element.find('input')
+ if ($input.prop('type') == 'radio') {
+ if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
+ else $parent.find('.active').removeClass('active')
+ }
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
+ } else {
+ this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
+ }
+
+ if (changed) this.$element.toggleClass('active')
}
- var markup = "<div class='clearfix'>";
- markup += "<div class='pull-left' style='padding-right: 10px;'>";
- if (datalist.image) {
- markup += "<div style='width: 30px;'><img src='" + datalist.image + "' alt='" + datalist.tex + "' style='max-height: 20px; max-width: 30px;'></div>";
- } else {
- markup += "<div style='height: 20px; width: 30px;'></div>";
+
+
+ // BUTTON PLUGIN DEFINITION
+ // ========================
+
+ function Plugin(option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.button')
+ var options = typeof option == 'object' && option
+
+ if (!data) $this.data('bs.button', (data = new Button(this, options)))
+
+ if (option == 'toggle') data.toggle()
+ else if (option) data.setState(option)
+ })
}
- markup += "</div><div>" + datalist.text + "</div>";
- markup += "</div>";
- return markup;
-}
-function formatDataSelection(datalist) {
- return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
-}
-/***/ }),
+ var old = $.fn.button
-/***/ "./node_modules/bootstrap-less/js/bootstrap.js":
-/*!*****************************************************!*\
- !*** ./node_modules/bootstrap-less/js/bootstrap.js ***!
- \*****************************************************/
-/***/ (() => {
+ $.fn.button = Plugin
+ $.fn.button.Constructor = Button
-/* */
-"format global";
-"deps jquery";
-"exports $";
-/*!
- * Bootstrap v3.3.4 (http://getbootstrap.com)
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- */
-if (typeof jQuery === 'undefined') {
- throw new Error('Bootstrap\'s JavaScript requires jQuery')
-}
+ // BUTTON NO CONFLICT
+ // ==================
-+function ($) {
- 'use strict';
- var version = $.fn.jquery.split(' ')[0].split('.')
- if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
- throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
+ $.fn.button.noConflict = function () {
+ $.fn.button = old
+ return this
}
+
+
+ // BUTTON DATA-API
+ // ===============
+
+ $(document)
+ .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
+ var $btn = $(e.target)
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
+ Plugin.call($btn, 'toggle')
+ e.preventDefault()
+ })
+ .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
+ $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
+ })
+
}(jQuery);
/* ========================================================================
- * Bootstrap: transition.js v3.3.4
- * http://getbootstrap.com/javascript/#transitions
+ * Bootstrap: carousel.js v3.3.4
+ * http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
@@ -837,292 +326,20 @@ if (typeof jQuery === 'undefined') {
+function ($) {
'use strict';
- // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
- // ============================================================
+ // CAROUSEL CLASS DEFINITION
+ // =========================
- function transitionEnd() {
- var el = document.createElement('bootstrap')
+ var Carousel = function (element, options) {
+ this.$element = $(element)
+ this.$indicators = this.$element.find('.carousel-indicators')
+ this.options = options
+ this.paused = null
+ this.sliding = null
+ this.interval = null
+ this.$active = null
+ this.$items = null
- var transEndEventNames = {
- WebkitTransition : 'webkitTransitionEnd',
- MozTransition : 'transitionend',
- OTransition : 'oTransitionEnd otransitionend',
- transition : 'transitionend'
- }
-
- for (var name in transEndEventNames) {
- if (el.style[name] !== undefined) {
- return { end: transEndEventNames[name] }
- }
- }
-
- return false // explicit for ie8 ( ._.)
- }
-
- // http://blog.alexmaccaw.com/css-transitions
- $.fn.emulateTransitionEnd = function (duration) {
- var called = false
- var $el = this
- $(this).one('bsTransitionEnd', function () { called = true })
- var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
- setTimeout(callback, duration)
- return this
- }
-
- $(function () {
- $.support.transition = transitionEnd()
-
- if (!$.support.transition) return
-
- $.event.special.bsTransitionEnd = {
- bindType: $.support.transition.end,
- delegateType: $.support.transition.end,
- handle: function (e) {
- if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
- }
- }
- })
-
-}(jQuery);
-
-/* ========================================================================
- * Bootstrap: alert.js v3.3.4
- * http://getbootstrap.com/javascript/#alerts
- * ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
- 'use strict';
-
- // ALERT CLASS DEFINITION
- // ======================
-
- var dismiss = '[data-dismiss="alert"]'
- var Alert = function (el) {
- $(el).on('click', dismiss, this.close)
- }
-
- Alert.VERSION = '3.3.4'
-
- Alert.TRANSITION_DURATION = 150
-
- Alert.prototype.close = function (e) {
- var $this = $(this)
- var selector = $this.attr('data-target')
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
- }
-
- var $parent = $(selector)
-
- if (e) e.preventDefault()
-
- if (!$parent.length) {
- $parent = $this.closest('.alert')
- }
-
- $parent.trigger(e = $.Event('close.bs.alert'))
-
- if (e.isDefaultPrevented()) return
-
- $parent.removeClass('in')
-
- function removeElement() {
- // detach from parent, fire event then clean up data
- $parent.detach().trigger('closed.bs.alert').remove()
- }
-
- $.support.transition && $parent.hasClass('fade') ?
- $parent
- .one('bsTransitionEnd', removeElement)
- .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
- removeElement()
- }
-
-
- // ALERT PLUGIN DEFINITION
- // =======================
-
- function Plugin(option) {
- return this.each(function () {
- var $this = $(this)
- var data = $this.data('bs.alert')
-
- if (!data) $this.data('bs.alert', (data = new Alert(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- var old = $.fn.alert
-
- $.fn.alert = Plugin
- $.fn.alert.Constructor = Alert
-
-
- // ALERT NO CONFLICT
- // =================
-
- $.fn.alert.noConflict = function () {
- $.fn.alert = old
- return this
- }
-
-
- // ALERT DATA-API
- // ==============
-
- $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
-
-}(jQuery);
-
-/* ========================================================================
- * Bootstrap: button.js v3.3.4
- * http://getbootstrap.com/javascript/#buttons
- * ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
- 'use strict';
-
- // BUTTON PUBLIC CLASS DEFINITION
- // ==============================
-
- var Button = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, Button.DEFAULTS, options)
- this.isLoading = false
- }
-
- Button.VERSION = '3.3.4'
-
- Button.DEFAULTS = {
- loadingText: 'loading...'
- }
-
- Button.prototype.setState = function (state) {
- var d = 'disabled'
- var $el = this.$element
- var val = $el.is('input') ? 'val' : 'html'
- var data = $el.data()
-
- state = state + 'Text'
-
- if (data.resetText == null) $el.data('resetText', $el[val]())
-
- // push to event loop to allow forms to submit
- setTimeout($.proxy(function () {
- $el[val](data[state] == null ? this.options[state] : data[state])
-
- if (state == 'loadingText') {
- this.isLoading = true
- $el.addClass(d).attr(d, d)
- } else if (this.isLoading) {
- this.isLoading = false
- $el.removeClass(d).removeAttr(d)
- }
- }, this), 0)
- }
-
- Button.prototype.toggle = function () {
- var changed = true
- var $parent = this.$element.closest('[data-toggle="buttons"]')
-
- if ($parent.length) {
- var $input = this.$element.find('input')
- if ($input.prop('type') == 'radio') {
- if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
- else $parent.find('.active').removeClass('active')
- }
- if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
- } else {
- this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
- }
-
- if (changed) this.$element.toggleClass('active')
- }
-
-
- // BUTTON PLUGIN DEFINITION
- // ========================
-
- function Plugin(option) {
- return this.each(function () {
- var $this = $(this)
- var data = $this.data('bs.button')
- var options = typeof option == 'object' && option
-
- if (!data) $this.data('bs.button', (data = new Button(this, options)))
-
- if (option == 'toggle') data.toggle()
- else if (option) data.setState(option)
- })
- }
-
- var old = $.fn.button
-
- $.fn.button = Plugin
- $.fn.button.Constructor = Button
-
-
- // BUTTON NO CONFLICT
- // ==================
-
- $.fn.button.noConflict = function () {
- $.fn.button = old
- return this
- }
-
-
- // BUTTON DATA-API
- // ===============
-
- $(document)
- .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
- var $btn = $(e.target)
- if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
- Plugin.call($btn, 'toggle')
- e.preventDefault()
- })
- .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
- $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
- })
-
-}(jQuery);
-
-/* ========================================================================
- * Bootstrap: carousel.js v3.3.4
- * http://getbootstrap.com/javascript/#carousel
- * ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
- 'use strict';
-
- // CAROUSEL CLASS DEFINITION
- // =========================
-
- var Carousel = function (element, options) {
- this.$element = $(element)
- this.$indicators = this.$element.find('.carousel-indicators')
- this.options = options
- this.paused = null
- this.sliding = null
- this.interval = null
- this.$active = null
- this.$items = null
-
- this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
+ this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
@@ -32730,189 +31947,1037 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/**
arrayEach(['initial', 'tail'], function(methodName, index) {
var dropName = 'drop' + (index ? '' : 'Right');
- LazyWrapper.prototype[methodName] = function() {
- return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
- };
+ LazyWrapper.prototype[methodName] = function() {
+ return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
+ };
+ });
+
+ LazyWrapper.prototype.compact = function() {
+ return this.filter(identity);
+ };
+
+ LazyWrapper.prototype.find = function(predicate) {
+ return this.filter(predicate).head();
+ };
+
+ LazyWrapper.prototype.findLast = function(predicate) {
+ return this.reverse().find(predicate);
+ };
+
+ LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
+ if (typeof path == 'function') {
+ return new LazyWrapper(this);
+ }
+ return this.map(function(value) {
+ return baseInvoke(value, path, args);
+ });
+ });
+
+ LazyWrapper.prototype.reject = function(predicate) {
+ return this.filter(negate(getIteratee(predicate)));
+ };
+
+ LazyWrapper.prototype.slice = function(start, end) {
+ start = toInteger(start);
+
+ var result = this;
+ if (result.__filtered__ && (start > 0 || end < 0)) {
+ return new LazyWrapper(result);
+ }
+ if (start < 0) {
+ result = result.takeRight(-start);
+ } else if (start) {
+ result = result.drop(start);
+ }
+ if (end !== undefined) {
+ end = toInteger(end);
+ result = end < 0 ? result.dropRight(-end) : result.take(end - start);
+ }
+ return result;
+ };
+
+ LazyWrapper.prototype.takeRightWhile = function(predicate) {
+ return this.reverse().takeWhile(predicate).reverse();
+ };
+
+ LazyWrapper.prototype.toArray = function() {
+ return this.take(MAX_ARRAY_LENGTH);
+ };
+
+ // Add `LazyWrapper` methods to `lodash.prototype`.
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+ var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
+ isTaker = /^(?:head|last)$/.test(methodName),
+ lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
+ retUnwrapped = isTaker || /^find/.test(methodName);
+
+ if (!lodashFunc) {
+ return;
+ }
+ lodash.prototype[methodName] = function() {
+ var value = this.__wrapped__,
+ args = isTaker ? [1] : arguments,
+ isLazy = value instanceof LazyWrapper,
+ iteratee = args[0],
+ useLazy = isLazy || isArray(value);
+
+ var interceptor = function(value) {
+ var result = lodashFunc.apply(lodash, arrayPush([value], args));
+ return (isTaker && chainAll) ? result[0] : result;
+ };
+
+ if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
+ // Avoid lazy use if the iteratee has a "length" value other than `1`.
+ isLazy = useLazy = false;
+ }
+ var chainAll = this.__chain__,
+ isHybrid = !!this.__actions__.length,
+ isUnwrapped = retUnwrapped && !chainAll,
+ onlyLazy = isLazy && !isHybrid;
+
+ if (!retUnwrapped && useLazy) {
+ value = onlyLazy ? value : new LazyWrapper(this);
+ var result = func.apply(value, args);
+ result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
+ return new LodashWrapper(result, chainAll);
+ }
+ if (isUnwrapped && onlyLazy) {
+ return func.apply(this, args);
+ }
+ result = this.thru(interceptor);
+ return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
+ };
+ });
+
+ // Add `Array` methods to `lodash.prototype`.
+ arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
+ var func = arrayProto[methodName],
+ chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
+ retUnwrapped = /^(?:pop|shift)$/.test(methodName);
+
+ lodash.prototype[methodName] = function() {
+ var args = arguments;
+ if (retUnwrapped && !this.__chain__) {
+ var value = this.value();
+ return func.apply(isArray(value) ? value : [], args);
+ }
+ return this[chainName](function(value) {
+ return func.apply(isArray(value) ? value : [], args);
+ });
+ };
+ });
+
+ // Map minified method names to their real names.
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+ var lodashFunc = lodash[methodName];
+ if (lodashFunc) {
+ var key = lodashFunc.name + '';
+ if (!hasOwnProperty.call(realNames, key)) {
+ realNames[key] = [];
+ }
+ realNames[key].push({ 'name': methodName, 'func': lodashFunc });
+ }
+ });
+
+ realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
+ 'name': 'wrapper',
+ 'func': undefined
+ }];
+
+ // Add methods to `LazyWrapper`.
+ LazyWrapper.prototype.clone = lazyClone;
+ LazyWrapper.prototype.reverse = lazyReverse;
+ LazyWrapper.prototype.value = lazyValue;
+
+ // Add chain sequence methods to the `lodash` wrapper.
+ lodash.prototype.at = wrapperAt;
+ lodash.prototype.chain = wrapperChain;
+ lodash.prototype.commit = wrapperCommit;
+ lodash.prototype.next = wrapperNext;
+ lodash.prototype.plant = wrapperPlant;
+ lodash.prototype.reverse = wrapperReverse;
+ lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+
+ // Add lazy aliases.
+ lodash.prototype.first = lodash.prototype.head;
+
+ if (symIterator) {
+ lodash.prototype[symIterator] = wrapperToIterator;
+ }
+ return lodash;
+ });
+
+ /*--------------------------------------------------------------------------*/
+
+ // Export lodash.
+ var _ = runInContext();
+
+ // Some AMD build optimizers, like r.js, check for condition patterns like:
+ if (true) {
+ // Expose Lodash on the global object to prevent errors when Lodash is
+ // loaded by a script tag in the presence of an AMD loader.
+ // See http://requirejs.org/docs/errors.html#mismatch for more details.
+ // Use `_.noConflict` to remove Lodash from the global object.
+ root._ = _;
+
+ // Define as an anonymous module so, through path mapping, it can be
+ // referenced as the "underscore" module.
+ !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
+ return _;
+ }).call(exports, __webpack_require__, exports, module),
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ }
+ // Check for `exports` after `define` in case a build optimizer adds it.
+ else {}
+}.call(this));
+
+
+/***/ }),
+
+/***/ "./resources/assets/js/bootstrap.js":
+/*!******************************************!*\
+ !*** ./resources/assets/js/bootstrap.js ***!
+ \******************************************/
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+
+window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
+
+/**
+ * We'll load jQuery and the Bootstrap jQuery plugin which provides support
+ * for JavaScript based Bootstrap features such as modals and tabs. This
+ * code may be modified to fit the specific needs of your application.
+ */
+//window.$ = window.jQuery = require('jquery');
+
+/**
+ * jQuery UI is loaded here and then the tooltip is assigned another funtion name
+ * This resolves the issue of jquery-ui & bootstrap tooltip conflict
+ */
+__webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui/ui/widget.js");
+jQuery.fn.uitooltip = jQuery.fn.tooltip;
+
+/**
+ * Load boostrap
+ */
+__webpack_require__(/*! bootstrap-less */ "./node_modules/bootstrap-less/js/bootstrap.js");
+
+// require('admin-lte');
+
+// require('chart.js');
+
+// require('jquery-form-validator'); //says something about dependency
+/**
+ * Echo exposes an expressive API for subscribing to channels and listening
+ * for events that are broadcast by Laravel. Echo and event broadcasting
+ * allows your team to easily build robust real-time web applications.
+ */
+
+// import Echo from "laravel-echo"
+
+// window.Echo = new Echo({
+// broadcaster: 'pusher',
+// key: 'your-pusher-key'
+// });
+
+/***/ }),
+
+/***/ "./resources/assets/js/snipeit.js":
+/*!****************************************!*\
+ !*** ./resources/assets/js/snipeit.js ***!
+ \****************************************/
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+
+// var jQuery = require('jquery');
+// window.jQuery = jQuery
+// window.$ = jQuery
+
+__webpack_require__(/*! ./bootstrap */ "./resources/assets/js/bootstrap.js");
+
+/**
+ * Module containing core application logic.
+ * @param {jQuery} $ Insulated jQuery object
+ * @param {JSON} settings Insulated `window.snipeit.settings` object.
+ * @return {IIFE} Immediately invoked. Returns self.
+ */
+
+lineOptions = {
+ legend: {
+ position: "bottom"
+ },
+ scales: {
+ yAxes: [{
+ ticks: {
+ fontColor: "rgba(0,0,0,0.5)",
+ fontStyle: "bold",
+ beginAtZero: true,
+ maxTicksLimit: 5,
+ padding: 20
+ },
+ gridLines: {
+ drawTicks: false,
+ display: false
+ }
+ }],
+ xAxes: [{
+ gridLines: {
+ zeroLineColor: "transparent"
+ },
+ ticks: {
+ padding: 20,
+ fontColor: "rgba(0,0,0,0.5)",
+ fontStyle: "bold"
+ }
+ }]
+ }
+};
+pieOptions = {
+ //Boolean - Whether we should show a stroke on each segment
+ segmentShowStroke: true,
+ //String - The colour of each segment stroke
+ segmentStrokeColor: "#fff",
+ //Number - The width of each segment stroke
+ segmentStrokeWidth: 1,
+ //Number - The percentage of the chart that we cut out of the middle
+ percentageInnerCutout: 50,
+ // This is 0 for Pie charts
+ //Number - Amount of animation steps
+ animationSteps: 100,
+ //String - Animation easing effect
+ animationEasing: "easeOutBounce",
+ //Boolean - Whether we animate the rotation of the Doughnut
+ animateRotate: true,
+ //Boolean - Whether we animate scaling the Doughnut from the centre
+ animateScale: false,
+ //Boolean - whether to make the chart responsive to window resizing
+ responsive: true,
+ // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
+ maintainAspectRatio: false,
+ //String - A legend template
+ legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li>" + "<i class='fas fa-circle-o' style='color: <%=segments[i].fillColor%>'></i>" + "<%if(segments[i].label){%><%=segments[i].label%><%}%> foo</li><%}%></ul>",
+ //String - A tooltip template
+ tooltipTemplate: "<%=value %> <%=label%> "
+};
+
+//-----------------
+//- END PIE CHART -
+//-----------------
+
+var baseUrl = $('meta[name="baseUrl"]').attr('content');
+$(function () {
+ var $el = $('table');
+
+ // confirm restore modal
+
+ $el.on('click', '.restore-asset', function (evnt) {
+ var $context = $(this);
+ var $restoreConfirmModal = $('#restoreConfirmModal');
+ var href = $context.attr('href');
+ var message = $context.attr('data-content');
+ var title = $context.attr('data-title');
+ $('#confirmModalLabel').text(title);
+ $restoreConfirmModal.find('.modal-body').text(message);
+ $('#restoreForm').attr('action', href);
+ $restoreConfirmModal.modal({
+ show: true
+ });
+ return false;
+ });
+
+ // confirm delete modal
+
+ $el.on('click', '.delete-asset', function (evnt) {
+ var $context = $(this);
+ var $dataConfirmModal = $('#dataConfirmModal');
+ var href = $context.attr('href');
+ var message = $context.attr('data-content');
+ var title = $context.attr('data-title');
+ $('#myModalLabel').text(title);
+ $dataConfirmModal.find('.modal-body').text(message);
+ $('#deleteForm').attr('action', href);
+ $dataConfirmModal.modal({
+ show: true
+ });
+ return false;
+ });
+
+ /*
+ * Slideout help menu
+ */
+ $('.slideout-menu-toggle').on('click', function (event) {
+ event.preventDefault();
+ // create menu variables
+ var slideoutMenu = $('.slideout-menu');
+ var slideoutMenuWidth = $('.slideout-menu').width();
+
+ // toggle open class
+ slideoutMenu.toggleClass("open");
+
+ // slide menu
+ if (slideoutMenu.hasClass("open")) {
+ slideoutMenu.show();
+ slideoutMenu.animate({
+ right: "0px"
+ });
+ } else {
+ slideoutMenu.animate({
+ right: -slideoutMenuWidth
+ }, "-350px");
+ slideoutMenu.fadeOut();
+ }
+ });
+
+ /*
+ * Select2
+ */
+
+ $('select.select2:not(".select2-hidden-accessible")').each(function (i, obj) {
+ {
+ $(obj).select2();
+ }
+ });
+
+ // $('.datepicker').datepicker();
+ // var datepicker = $.fn.datepicker.noConflict(); // return $.fn.datepicker to previously assigned value
+ // $.fn.bootstrapDP = datepicker;
+ // $('.datepicker').datepicker();
+
+ // Crazy select2 rich dropdowns with images!
+ $('.js-data-ajax').each(function (i, item) {
+ var link = $(item);
+ var endpoint = link.data("endpoint");
+ var select = link.data("select");
+ link.select2({
+ /**
+ * Adds an empty placeholder, allowing every select2 instance to be cleared.
+ * This placeholder can be overridden with the "data-placeholder" attribute.
+ */
+ placeholder: '',
+ allowClear: true,
+ language: $('meta[name="language"]').attr('content'),
+ dir: $('meta[name="language-direction"]').attr('content'),
+ ajax: {
+ // the baseUrl includes a trailing slash
+ url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
+ dataType: 'json',
+ delay: 250,
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ data: function data(params) {
+ var data = {
+ search: params.term,
+ page: params.page || 1,
+ assetStatusType: link.data("asset-status-type")
+ };
+ return data;
+ },
+ /* processResults: function (data, params) {
+ params.page = params.page || 1;
+ var answer = {
+ results: data.items,
+ pagination: {
+ more: data.pagination.more
+ }
+ };
+ return answer;
+ }, */
+ cache: true
+ },
+ //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
+ templateResult: formatDatalistSafe
+ //templateSelection: formatDataSelection
+ });
+ });
+ function getSelect2Value(element) {
+ // if the passed object is not a jquery object, assuming 'element' is a selector
+ if (!(element instanceof jQuery)) element = $(element);
+ var select = element.data("select2");
+
+ // There's two different locations where the select2-generated input element can be.
+ searchElement = select.dropdown.$search || select.$container.find(".select2-search__field");
+ var value = searchElement.val();
+ return value;
+ }
+ $(".select2-hidden-accessible").on('select2:selecting', function (e) {
+ var data = e.params.args.data;
+ var isMouseUp = false;
+ var element = $(this);
+ var value = getSelect2Value(element);
+ if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
+
+ // if selected item does not match typed text, do not allow it to pass - force close for ajax.
+ if (!isMouseUp) {
+ if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) < 0) {
+ e.preventDefault();
+ element.select2('close');
+
+ // if it does match, we set a flag in the event (which gets passed to subsequent events), telling it not to worry about the ajax
+ } else if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) > -1) {
+ e.params.args.noForceAjax = true;
+ }
+ }
+ });
+ $(".select2-hidden-accessible").on('select2:closing', function (e) {
+ var element = $(this);
+ var value = getSelect2Value(element);
+ var noForceAjax = false;
+ var isMouseUp = false;
+ if (e.params.args.originalSelect2Event) noForceAjax = e.params.args.originalSelect2Event.noForceAjax;
+ if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
+ if (value && !noForceAjax && !isMouseUp) {
+ var endpoint = element.data("endpoint");
+ var assetStatusType = element.data("asset-status-type");
+ $.ajax({
+ url: baseUrl + 'api/v1/' + endpoint + '/selectlist?search=' + value + '&page=1' + (assetStatusType ? '&assetStatusType=' + assetStatusType : ''),
+ dataType: 'json',
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ }
+ }).done(function (response) {
+ var currentlySelected = element.select2('data').map(function (x) {
+ return +x.id;
+ }).filter(function (x) {
+ return x !== 0;
+ });
+
+ // makes sure we're not selecting the same thing twice for multiples
+ var filteredResponse = response.results.filter(function (item) {
+ return currentlySelected.indexOf(+item.id) < 0;
+ });
+ var first = currentlySelected.length > 0 ? filteredResponse[0] : response.results[0];
+ if (first && first.id) {
+ first.selected = true;
+ if ($("option[value='" + first.id + "']", element).length < 1) {
+ var option = new Option(first.text, first.id, true, true);
+ element.append(option);
+ } else {
+ var isMultiple = element.attr("multiple") == "multiple";
+ element.val(isMultiple ? element.val().concat(first.id) : element.val(first.id));
+ }
+ element.trigger('change');
+ element.trigger({
+ type: 'select2:select',
+ params: {
+ data: first
+ }
+ });
+ }
+ });
+ }
+ });
+ function formatDatalist(datalist) {
+ var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
+ if (datalist.loading) {
+ return loading_markup;
+ }
+ var markup = '<div class="clearfix">';
+ markup += '<div class="pull-left" style="padding-right: 10px;">';
+ if (datalist.image) {
+ markup += "<div style='width: 30px;'><img src='" + datalist.image + "' style='max-height: 20px; max-width: 30px;' alt='" + datalist.text + "'></div>";
+ } else {
+ markup += '<div style="height: 20px; width: 30px;"></div>';
+ }
+ markup += "</div><div>" + datalist.text + "</div>";
+ markup += "</div>";
+ return markup;
+ }
+ function formatDatalistSafe(datalist) {
+ // console.warn("What in the hell is going on with Select2?!?!!?!?");
+ // console.warn($.select2);
+ if (datalist.loading) {
+ return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
+ }
+ var root_div = $("<div class='clearfix'>");
+ var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
+ if (datalist.image) {
+ var inner_div = $("<div style='width: 30px;'>");
+ /******************************************************************
+ *
+ * We are specifically chosing empty alt-text below, because this
+ * image conveys no additional information, relative to the text
+ * that will *always* be there in any select2 list that is in use
+ * in Snipe-IT. If that changes, we would probably want to change
+ * some signatures of some functions, but right now, we don't want
+ * screen readers to say "HP SuperJet 5000, .... picture of HP
+ * SuperJet 5000..." and so on, for every single row in a list of
+ * assets or models or whatever.
+ *
+ *******************************************************************/
+ var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
+ // console.warn("Img is: ");
+ // console.dir(img);
+ // console.warn("Strigularly, that's: ");
+ // console.log(img);
+ img.attr("src", datalist.image);
+ inner_div.append(img);
+ } else {
+ var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
+ }
+ left_pull.append(inner_div);
+ root_div.append(left_pull);
+ var name_div = $("<div>");
+ name_div.text(datalist.text);
+ root_div.append(name_div);
+ var safe_html = root_div.get(0).outerHTML;
+ var old_html = formatDatalist(datalist);
+ if (safe_html != old_html) {
+ //console.log("HTML MISMATCH: ");
+ //console.log("FormatDatalistSafe: ");
+ // console.dir(root_div.get(0));
+ //console.log(safe_html);
+ //console.log("FormatDataList: ");
+ //console.log(old_html);
+ }
+ return root_div;
+ }
+ function formatDataSelection(datalist) {
+ // This a heinous workaround for a known bug in Select2.
+ // Without this, the rich selectlists are vulnerable to XSS.
+ // Many thanks to @uberbrady for this fix. It ain't pretty,
+ // but it resolves the issue until Select2 addresses it on their end.
+ //
+ // Bug was reported in 2016 :{
+ // https://github.com/select2/select2/issues/4587
+
+ return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
+ }
+
+ // This handles the radio button selectors for the checkout-to-foo options
+ // on asset checkout and also on asset edit
+ $(function () {
+ $('input[name=checkout_to_type]').on("change", function () {
+ var assignto_type = $('input[name=checkout_to_type]:checked').val();
+ var userid = $('#assigned_user option:selected').val();
+ if (assignto_type == 'asset') {
+ $('#current_assets_box').fadeOut();
+ $('#assigned_asset').show();
+ $('#assigned_user').hide();
+ $('#assigned_location').hide();
+ $('.notification-callout').fadeOut();
+ $('[name="assigned_location"]').val('').trigger('change.select2');
+ $('[name="assigned_user"]').val('').trigger('change.select2');
+ } else if (assignto_type == 'location') {
+ $('#current_assets_box').fadeOut();
+ $('#assigned_asset').hide();
+ $('#assigned_user').hide();
+ $('#assigned_location').show();
+ $('.notification-callout').fadeOut();
+ $('[name="assigned_asset"]').val('').trigger('change.select2');
+ $('[name="assigned_user"]').val('').trigger('change.select2');
+ } else {
+ $('#assigned_asset').hide();
+ $('#assigned_user').show();
+ $('#assigned_location').hide();
+ if (userid) {
+ $('#current_assets_box').fadeIn();
+ }
+ $('.notification-callout').fadeIn();
+ $('[name="assigned_asset"]').val('').trigger('change.select2');
+ $('[name="assigned_location"]').val('').trigger('change.select2');
+ }
+ });
+ });
+
+ // ------------------------------------------------
+ // Deep linking for Bootstrap tabs
+ // ------------------------------------------------
+ var taburl = document.location.toString();
+
+ // Allow full page URL to activate a tab's ID
+ // ------------------------------------------------
+ // This allows linking to a tab on page load via the address bar.
+ // So a URL such as, http://snipe-it.local/hardware/2/#my_tab will
+ // cause the tab on that page with an ID of “my_tab” to be active.
+ if (taburl.match('#')) {
+ $('.nav-tabs a[href="#' + taburl.split('#')[1] + '"]').tab('show');
+ }
+
+ // Allow internal page links to activate a tab's ID.
+ // ------------------------------------------------
+ // This allows you to link to a tab from anywhere on the page
+ // including from within another tab. Also note that internal page
+ // links either inside or out of the tabs need to include data-toggle="tab"
+ // Ex: <a href="#my_tab" data-toggle="tab">Click me</a>
+ $('a[data-toggle="tab"]').click(function (e) {
+ var href = $(this).attr("href");
+ history.pushState(null, null, href);
+ e.preventDefault();
+ $('a[href="' + $(this).attr('href') + '"]').tab('show');
+ });
+
+ // ------------------------------------------------
+ // End Deep Linking for Bootstrap tabs
+ // ------------------------------------------------
+
+ // Image preview
+ function readURL(input, $preview) {
+ if (input.files && input.files[0]) {
+ var reader = new FileReader();
+ reader.onload = function (e) {
+ $preview.attr('src', e.target.result);
+ };
+ reader.readAsDataURL(input.files[0]);
+ }
+ }
+ function formatBytes(bytes) {
+ if (bytes < 1024) return bytes + " Bytes";else if (bytes < 1048576) return (bytes / 1024).toFixed(2) + " KB";else if (bytes < 1073741824) return (bytes / 1048576).toFixed(2) + " MB";else return (bytes / 1073741824).toFixed(2) + " GB";
+ }
+
+ // File size validation
+ $('.js-uploadFile').bind('change', function () {
+ var $this = $(this);
+ var id = '#' + $this.attr('id');
+ var status = id + '-status';
+ var $status = $(status);
+ var delete_id = $(id + '-deleteCheckbox');
+ var preview_container = $(id + '-previewContainer');
+ $status.removeClass('text-success').removeClass('text-danger');
+ $(status + ' .goodfile').remove();
+ $(status + ' .badfile').remove();
+ $(status + ' .previewSize').hide();
+ preview_container.hide();
+ $(id + '-info').html('');
+ var max_size = $this.data('maxsize');
+ var total_size = 0;
+ for (var i = 0; i < this.files.length; i++) {
+ total_size += this.files[i].size;
+ $(id + '-info').append('<span class="label label-default">' + htmlEntities(this.files[i].name) + ' (' + formatBytes(this.files[i].size) + ')</span> ');
+ }
+ if (total_size > max_size) {
+ $status.addClass('text-danger').removeClass('help-block').prepend('<i class="badfile fas fa-times"></i> ').append('<span class="previewSize"> Upload is ' + formatBytes(total_size) + '.</span>');
+ } else {
+ $status.addClass('text-success').removeClass('help-block').prepend('<i class="goodfile fas fa-check"></i> ');
+ var $preview = $(id + '-imagePreview');
+ readURL(this, $preview);
+ $preview.fadeIn();
+ preview_container.fadeIn();
+ delete_id.hide();
+ }
+ });
+});
+function htmlEntities(str) {
+ return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
+}
+
+/**
+ * Toggle disabled
+ */
+(function ($) {
+ $.fn.toggleDisabled = function (callback) {
+ return this.each(function () {
+ var disabled,
+ $this = $(this);
+ if ($this.attr('disabled')) {
+ $this.removeAttr('disabled');
+ disabled = false;
+ } else {
+ $this.attr('disabled', 'disabled');
+ disabled = true;
+ }
+ if (callback && typeof callback === 'function') {
+ callback(this, disabled);
+ }
});
+ };
+})(jQuery);
- LazyWrapper.prototype.compact = function() {
- return this.filter(identity);
- };
-
- LazyWrapper.prototype.find = function(predicate) {
- return this.filter(predicate).head();
- };
-
- LazyWrapper.prototype.findLast = function(predicate) {
- return this.reverse().find(predicate);
- };
-
- LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
- if (typeof path == 'function') {
- return new LazyWrapper(this);
- }
- return this.map(function(value) {
- return baseInvoke(value, path, args);
+/**
+ * Universal Livewire Select2 integration
+ *
+ * How to use:
+ *
+ * 1. Set the class of your select2 elements to 'livewire-select2').
+ * 2. Name your element to match a property in your Livewire component
+ * 3. Add an attribute called 'data-livewire-component' that points to $this->getId() (via `{{ }}` if you're in a blade,
+ * or just $this->getId() if not).
+ */
+document.addEventListener('livewire:init', function () {
+ $('.livewire-select2').select2();
+ $(document).on('select2:select', '.livewire-select2', function (event) {
+ var target = $(event.target);
+ if (!event.target.name || !target.data('livewire-component')) {
+ console.error("You need to set both name (which should match a Livewire property) and data-livewire-component on your Livewire-ed select2 elements!");
+ console.error("For data-livewire-component, you probably want to use $this->getId() or {{ $this->getId() }}, as appropriate");
+ return false;
+ }
+ Livewire.find(target.data('livewire-component')).set(event.target.name, this.options[this.selectedIndex].value);
+ });
+ Livewire.hook('request', function (_ref) {
+ var succeed = _ref.succeed;
+ succeed(function () {
+ queueMicrotask(function () {
+ $('.livewire-select2').select2();
});
});
+ });
+});
- LazyWrapper.prototype.reject = function(predicate) {
- return this.filter(negate(getIteratee(predicate)));
- };
+/***/ }),
- LazyWrapper.prototype.slice = function(start, end) {
- start = toInteger(start);
+/***/ "./resources/assets/js/snipeit_modals.js":
+/*!***********************************************!*\
+ !*** ./resources/assets/js/snipeit_modals.js ***!
+ \***********************************************/
+/***/ (() => {
- var result = this;
- if (result.__filtered__ && (start > 0 || end < 0)) {
- return new LazyWrapper(result);
- }
- if (start < 0) {
- result = result.takeRight(-start);
- } else if (start) {
- result = result.drop(start);
- }
- if (end !== undefined) {
- end = toInteger(end);
- result = end < 0 ? result.dropRight(-end) : result.take(end - start);
- }
- return result;
- };
+/*
+ *
+ * Snipe-IT Universal Modal support
+ *
+ * Enables modal dialogs to create sub-resources throughout Snipe-IT
+ *
+ */
- LazyWrapper.prototype.takeRightWhile = function(predicate) {
- return this.reverse().takeWhile(predicate).reverse();
- };
+/*
+HOW TO USE
+ Create a Button looking like this:
+ <a href='{{ route('modal.show', 'user') }}' data-toggle="modal" data-target="#createModal" data-select='assigned_to' class="btn btn-sm btn-primary">New</a>
+ If you don't have access to Blade commands (like {{ and }}, etc), you can hard-code a URL as the 'href'
+ data-toggle="modal" - required for Bootstrap Modals
+data-target="#createModal" - fixed ID for the modal, do not change
+data-select="assigned_to" - What is the *ID* of the select-dropdown that you're going to be adding to, if the modal-create was a success? Be on the lookout for duplicate ID's, it will confuse this library!
+class="btn btn-sm btn-primary" - makes it look button-ey, feel free to change :)
- LazyWrapper.prototype.toArray = function() {
- return this.take(MAX_ARRAY_LENGTH);
- };
+If you want to pass additional variables to the modal (In the Category Create one, for example, you can pass category_id), you can encode them as URL variables in the href
- // Add `LazyWrapper` methods to `lodash.prototype`.
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
- var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
- isTaker = /^(?:head|last)$/.test(methodName),
- lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
- retUnwrapped = isTaker || /^find/.test(methodName);
+*/
- if (!lodashFunc) {
- return;
- }
- lodash.prototype[methodName] = function() {
- var value = this.__wrapped__,
- args = isTaker ? [1] : arguments,
- isLazy = value instanceof LazyWrapper,
- iteratee = args[0],
- useLazy = isLazy || isArray(value);
+$(function () {
+ var baseUrl = $('meta[name="baseUrl"]').attr('content');
+ //handle modal-add-interstitial calls
+ var model, select, refreshSelector;
+ if ($('#createModal').length == 0) {
+ $('body').append('<div class="modal fade" id="createModal"></div><!-- /.modal -->');
+ }
+ $('#createModal').on("show.bs.modal", function (event) {
+ var link = $(event.relatedTarget);
+ model = link.data("dependency");
+ select = link.data("select");
+ refreshSelector = link.data("refresh");
+ $('#createModal').load(link.attr('href'), function () {
+ // this sets the focus to be the name field
+ $('#modal-name').focus();
- var interceptor = function(value) {
- var result = lodashFunc.apply(lodash, arrayPush([value], args));
- return (isTaker && chainAll) ? result[0] : result;
- };
+ //do we need to re-select2 this, after load? Probably.
+ $('#createModal').find('select.select2').select2();
+ // Initialize the ajaxy select2 with images.
+ // This is a copy/paste of the code from snipeit.js, would be great to only have this in one place.
- if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
- // Avoid lazy use if the iteratee has a "length" value other than `1`.
- isLazy = useLazy = false;
+ $('.js-data-ajax').each(function (i, item) {
+ var link = $(item);
+ var endpoint = link.data("endpoint");
+ var select = link.data("select");
+ link.select2({
+ ajax: {
+ // the baseUrl includes a trailing slash
+ url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
+ //WARNING - we're hoping that's defined on the page somewhere...
+ dataType: 'json',
+ delay: 250,
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ data: function data(params) {
+ var data = {
+ search: params.term,
+ page: params.page || 1,
+ assetStatusType: link.data("asset-status-type")
+ };
+ return data;
+ },
+ /*processResults: function (data, params) {
+ params.page = params.page || 1;
+ var answer = {
+ results: data.items,
+ pagination: {
+ more: data.pagination.more
+ }
+ };
+ return answer;
+ },*/
+ cache: true
+ },
+ //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
+ templateResult: formatDatalistSafe
+ //templateSelection: formatDataSelection
+ });
+ });
+ });
+ });
+ $('#createModal').on('click', '#modal-save', function () {
+ $.ajax({
+ type: 'POST',
+ url: $('.modal-body form').attr('action'),
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ data: $('.modal-body form').serialize(),
+ success: function success(result) {
+ if (result.status == "error") {
+ var error_message = "";
+ for (var field in result.messages) {
+ error_message += "<li>Problem(s) with field <i><strong>" + field + "</strong></i>: " + result.messages[field];
+ }
+ $('#modal_error_msg').html(error_message).show();
+ return false;
}
- var chainAll = this.__chain__,
- isHybrid = !!this.__actions__.length,
- isUnwrapped = retUnwrapped && !chainAll,
- onlyLazy = isLazy && !isHybrid;
-
- if (!retUnwrapped && useLazy) {
- value = onlyLazy ? value : new LazyWrapper(this);
- var result = func.apply(value, args);
- result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
- return new LodashWrapper(result, chainAll);
+ var id = result.payload.id;
+ var name = result.payload.name || result.payload.first_name + " " + result.payload.last_name;
+ if (!id || !name) {
+ console.error("Could not find resulting name or ID from modal-create. Name: " + name + ", id: " + id);
+ return false;
}
- if (isUnwrapped && onlyLazy) {
- return func.apply(this, args);
+ $('#createModal').modal('hide');
+ $('#createModal').html("");
+ var refreshTable = $('#' + refreshSelector);
+ if (refreshTable.length > 0) {
+ refreshTable.bootstrapTable('refresh');
}
- result = this.thru(interceptor);
- return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
- };
- });
-
- // Add `Array` methods to `lodash.prototype`.
- arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
- var func = arrayProto[methodName],
- chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
- retUnwrapped = /^(?:pop|shift)$/.test(methodName);
- lodash.prototype[methodName] = function() {
- var args = arguments;
- if (retUnwrapped && !this.__chain__) {
- var value = this.value();
- return func.apply(isArray(value) ? value : [], args);
+ // "select" is the original drop-down menu that someone
+ // clicked 'add' on to add a new 'thing'
+ // this code adds the newly created object to that select
+ var selector = document.getElementById(select);
+ if (!selector) {
+ return false;
}
- return this[chainName](function(value) {
- return func.apply(isArray(value) ? value : [], args);
- });
- };
- });
-
- // Map minified method names to their real names.
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
- var lodashFunc = lodash[methodName];
- if (lodashFunc) {
- var key = lodashFunc.name + '';
- if (!hasOwnProperty.call(realNames, key)) {
- realNames[key] = [];
+ selector.options[selector.length] = new Option(name, id);
+ selector.selectedIndex = selector.length - 1;
+ $(selector).trigger("change");
+ if (window.fetchCustomFields) {
+ fetchCustomFields();
}
- realNames[key].push({ 'name': methodName, 'func': lodashFunc });
+ },
+ error: function error(result) {
+ msg = result.responseJSON.messages || result.responseJSON.error;
+ $('#modal_error_msg').html("Server Error: " + msg).show();
}
});
+ });
+});
+function formatDatalistSafe(datalist) {
+ // console.warn("What in the hell is going on with Select2?!?!!?!?");
+ // console.warn($.select2);
+ if (datalist.loading) {
+ return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
+ }
+ var root_div = $("<div class='clearfix'>");
+ var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
+ if (datalist.image) {
+ var inner_div = $("<div style='width: 30px;'>");
+ /******************************************************************
+ *
+ * We are specifically chosing empty alt-text below, because this
+ * image conveys no additional information, relative to the text
+ * that will *always* be there in any select2 list that is in use
+ * in Snipe-IT. If that changes, we would probably want to change
+ * some signatures of some functions, but right now, we don't want
+ * screen readers to say "HP SuperJet 5000, .... picture of HP
+ * SuperJet 5000..." and so on, for every single row in a list of
+ * assets or models or whatever.
+ *
+ *******************************************************************/
+ var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
+ // console.warn("Img is: ");
+ // console.dir(img);
+ // console.warn("Strigularly, that's: ");
+ // console.log(img);
+ img.attr("src", datalist.image);
+ inner_div.append(img);
+ } else {
+ var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
+ }
+ left_pull.append(inner_div);
+ root_div.append(left_pull);
+ var name_div = $("<div>");
+ name_div.text(datalist.text);
+ root_div.append(name_div);
+ var safe_html = root_div.get(0).outerHTML;
+ var old_html = formatDatalist(datalist);
+ if (safe_html != old_html) {
+ // console.log("HTML MISMATCH: ");
+ // console.log("FormatDatalistSafe: ");
+ // console.dir(root_div.get(0));
+ // console.log(safe_html);
+ // console.log("FormatDataList: ");
+ // console.log(old_html);
+ }
+ return root_div;
+}
+function formatDatalist(datalist) {
+ var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
+ if (datalist.loading) {
+ return loading_markup;
+ }
+ var markup = "<div class='clearfix'>";
+ markup += "<div class='pull-left' style='padding-right: 10px;'>";
+ if (datalist.image) {
+ markup += "<div style='width: 30px;'><img src='" + datalist.image + "' alt='" + datalist.tex + "' style='max-height: 20px; max-width: 30px;'></div>";
+ } else {
+ markup += "<div style='height: 20px; width: 30px;'></div>";
+ }
+ markup += "</div><div>" + datalist.text + "</div>";
+ markup += "</div>";
+ return markup;
+}
+function formatDataSelection(datalist) {
+ return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
+}
- realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
- 'name': 'wrapper',
- 'func': undefined
- }];
+/***/ }),
- // Add methods to `LazyWrapper`.
- LazyWrapper.prototype.clone = lazyClone;
- LazyWrapper.prototype.reverse = lazyReverse;
- LazyWrapper.prototype.value = lazyValue;
+/***/ "./resources/assets/less/app.less":
+/*!****************************************!*\
+ !*** ./resources/assets/less/app.less ***!
+ \****************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- // Add chain sequence methods to the `lodash` wrapper.
- lodash.prototype.at = wrapperAt;
- lodash.prototype.chain = wrapperChain;
- lodash.prototype.commit = wrapperCommit;
- lodash.prototype.next = wrapperNext;
- lodash.prototype.plant = wrapperPlant;
- lodash.prototype.reverse = wrapperReverse;
- lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
- // Add lazy aliases.
- lodash.prototype.first = lodash.prototype.head;
- if (symIterator) {
- lodash.prototype[symIterator] = wrapperToIterator;
- }
- return lodash;
- });
+/***/ }),
- /*--------------------------------------------------------------------------*/
+/***/ "./resources/assets/less/overrides.less":
+/*!**********************************************!*\
+ !*** ./resources/assets/less/overrides.less ***!
+ \**********************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- // Export lodash.
- var _ = runInContext();
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
- // Some AMD build optimizers, like r.js, check for condition patterns like:
- if (true) {
- // Expose Lodash on the global object to prevent errors when Lodash is
- // loaded by a script tag in the presence of an AMD loader.
- // See http://requirejs.org/docs/errors.html#mismatch for more details.
- // Use `_.noConflict` to remove Lodash from the global object.
- root._ = _;
- // Define as an anonymous module so, through path mapping, it can be
- // referenced as the "underscore" module.
- !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
- return _;
- }).call(exports, __webpack_require__, exports, module),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- }
- // Check for `exports` after `define` in case a build optimizer adds it.
- else {}
-}.call(this));
+/***/ }),
+
+/***/ "./resources/assets/less/skins/_all-skins.less":
+/*!*****************************************************!*\
+ !*** ./resources/assets/less/skins/_all-skins.less ***!
+ \*****************************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
+
+
+/***/ }),
+
+/***/ "./resources/assets/less/skins/skin-black-dark.less":
+/*!**********************************************************!*\
+ !*** ./resources/assets/less/skins/skin-black-dark.less ***!
+ \**********************************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
/***/ }),
@@ -33097,71 +33162,6 @@ __webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
-/***/ }),
-
-/***/ "./node_modules/admin-lte/build/less/AdminLTE.less":
-/*!*********************************************************!*\
- !*** ./node_modules/admin-lte/build/less/AdminLTE.less ***!
- \*********************************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/app.less":
-/*!****************************************!*\
- !*** ./resources/assets/less/app.less ***!
- \****************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/overrides.less":
-/*!**********************************************!*\
- !*** ./resources/assets/less/overrides.less ***!
- \**********************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/skins/_all-skins.less":
-/*!*****************************************************!*\
- !*** ./resources/assets/less/skins/_all-skins.less ***!
- \*****************************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/skins/skin-black-dark.less":
-/*!**********************************************************!*\
- !*** ./resources/assets/less/skins/skin-black-dark.less ***!
- \**********************************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
/***/ })
/******/ });
diff --git a/public/js/dist/all.js b/public/js/dist/all.js
index f69d193940..b31634ca30 100644
--- a/public/js/dist/all.js
+++ b/public/js/dist/all.js
@@ -58934,833 +58934,322 @@ module.exports.TinyEmitter = E;
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
-/***/ "./resources/assets/js/bootstrap.js":
-/*!******************************************!*\
- !*** ./resources/assets/js/bootstrap.js ***!
- \******************************************/
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+/***/ "./node_modules/admin-lte/build/less/AdminLTE.less":
+/*!*********************************************************!*\
+ !*** ./node_modules/admin-lte/build/less/AdminLTE.less ***!
+ \*********************************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
-/**
- * We'll load jQuery and the Bootstrap jQuery plugin which provides support
- * for JavaScript based Bootstrap features such as modals and tabs. This
- * code may be modified to fit the specific needs of your application.
- */
-//window.$ = window.jQuery = require('jquery');
-/**
- * jQuery UI is loaded here and then the tooltip is assigned another funtion name
- * This resolves the issue of jquery-ui & bootstrap tooltip conflict
- */
-__webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui/ui/widget.js");
-jQuery.fn.uitooltip = jQuery.fn.tooltip;
+/***/ }),
-/**
- * Load boostrap
+/***/ "./node_modules/bootstrap-less/js/bootstrap.js":
+/*!*****************************************************!*\
+ !*** ./node_modules/bootstrap-less/js/bootstrap.js ***!
+ \*****************************************************/
+/***/ (() => {
+
+/* */
+"format global";
+"deps jquery";
+"exports $";
+/*!
+ * Bootstrap v3.3.4 (http://getbootstrap.com)
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
-__webpack_require__(/*! bootstrap-less */ "./node_modules/bootstrap-less/js/bootstrap.js");
-// require('admin-lte');
+if (typeof jQuery === 'undefined') {
+ throw new Error('Bootstrap\'s JavaScript requires jQuery')
+}
-// require('chart.js');
++function ($) {
+ 'use strict';
+ var version = $.fn.jquery.split(' ')[0].split('.')
+ if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
+ throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
+ }
+}(jQuery);
-// require('jquery-form-validator'); //says something about dependency
-/**
- * Echo exposes an expressive API for subscribing to channels and listening
- * for events that are broadcast by Laravel. Echo and event broadcasting
- * allows your team to easily build robust real-time web applications.
- */
+/* ========================================================================
+ * Bootstrap: transition.js v3.3.4
+ * http://getbootstrap.com/javascript/#transitions
+ * ========================================================================
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
-// import Echo from "laravel-echo"
-// window.Echo = new Echo({
-// broadcaster: 'pusher',
-// key: 'your-pusher-key'
-// });
++function ($) {
+ 'use strict';
-/***/ }),
+ // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
+ // ============================================================
-/***/ "./resources/assets/js/snipeit.js":
-/*!****************************************!*\
- !*** ./resources/assets/js/snipeit.js ***!
- \****************************************/
-/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+ function transitionEnd() {
+ var el = document.createElement('bootstrap')
-// var jQuery = require('jquery');
-// window.jQuery = jQuery
-// window.$ = jQuery
+ var transEndEventNames = {
+ WebkitTransition : 'webkitTransitionEnd',
+ MozTransition : 'transitionend',
+ OTransition : 'oTransitionEnd otransitionend',
+ transition : 'transitionend'
+ }
-__webpack_require__(/*! ./bootstrap */ "./resources/assets/js/bootstrap.js");
+ for (var name in transEndEventNames) {
+ if (el.style[name] !== undefined) {
+ return { end: transEndEventNames[name] }
+ }
+ }
-/**
- * Module containing core application logic.
- * @param {jQuery} $ Insulated jQuery object
- * @param {JSON} settings Insulated `window.snipeit.settings` object.
- * @return {IIFE} Immediately invoked. Returns self.
- */
+ return false // explicit for ie8 ( ._.)
+ }
-lineOptions = {
- legend: {
- position: "bottom"
- },
- scales: {
- yAxes: [{
- ticks: {
- fontColor: "rgba(0,0,0,0.5)",
- fontStyle: "bold",
- beginAtZero: true,
- maxTicksLimit: 5,
- padding: 20
- },
- gridLines: {
- drawTicks: false,
- display: false
- }
- }],
- xAxes: [{
- gridLines: {
- zeroLineColor: "transparent"
- },
- ticks: {
- padding: 20,
- fontColor: "rgba(0,0,0,0.5)",
- fontStyle: "bold"
- }
- }]
+ // http://blog.alexmaccaw.com/css-transitions
+ $.fn.emulateTransitionEnd = function (duration) {
+ var called = false
+ var $el = this
+ $(this).one('bsTransitionEnd', function () { called = true })
+ var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
+ setTimeout(callback, duration)
+ return this
}
-};
-pieOptions = {
- //Boolean - Whether we should show a stroke on each segment
- segmentShowStroke: true,
- //String - The colour of each segment stroke
- segmentStrokeColor: "#fff",
- //Number - The width of each segment stroke
- segmentStrokeWidth: 1,
- //Number - The percentage of the chart that we cut out of the middle
- percentageInnerCutout: 50,
- // This is 0 for Pie charts
- //Number - Amount of animation steps
- animationSteps: 100,
- //String - Animation easing effect
- animationEasing: "easeOutBounce",
- //Boolean - Whether we animate the rotation of the Doughnut
- animateRotate: true,
- //Boolean - Whether we animate scaling the Doughnut from the centre
- animateScale: false,
- //Boolean - whether to make the chart responsive to window resizing
- responsive: true,
- // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
- maintainAspectRatio: false,
- //String - A legend template
- legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li>" + "<i class='fas fa-circle-o' style='color: <%=segments[i].fillColor%>'></i>" + "<%if(segments[i].label){%><%=segments[i].label%><%}%> foo</li><%}%></ul>",
- //String - A tooltip template
- tooltipTemplate: "<%=value %> <%=label%> "
-};
-//-----------------
-//- END PIE CHART -
-//-----------------
+ $(function () {
+ $.support.transition = transitionEnd()
-var baseUrl = $('meta[name="baseUrl"]').attr('content');
-$(function () {
- var $el = $('table');
+ if (!$.support.transition) return
- // confirm restore modal
+ $.event.special.bsTransitionEnd = {
+ bindType: $.support.transition.end,
+ delegateType: $.support.transition.end,
+ handle: function (e) {
+ if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
+ }
+ }
+ })
- $el.on('click', '.restore-asset', function (evnt) {
- var $context = $(this);
- var $restoreConfirmModal = $('#restoreConfirmModal');
- var href = $context.attr('href');
- var message = $context.attr('data-content');
- var title = $context.attr('data-title');
- $('#confirmModalLabel').text(title);
- $restoreConfirmModal.find('.modal-body').text(message);
- $('#restoreForm').attr('action', href);
- $restoreConfirmModal.modal({
- show: true
- });
- return false;
- });
+}(jQuery);
- // confirm delete modal
+/* ========================================================================
+ * Bootstrap: alert.js v3.3.4
+ * http://getbootstrap.com/javascript/#alerts
+ * ========================================================================
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
- $el.on('click', '.delete-asset', function (evnt) {
- var $context = $(this);
- var $dataConfirmModal = $('#dataConfirmModal');
- var href = $context.attr('href');
- var message = $context.attr('data-content');
- var title = $context.attr('data-title');
- $('#myModalLabel').text(title);
- $dataConfirmModal.find('.modal-body').text(message);
- $('#deleteForm').attr('action', href);
- $dataConfirmModal.modal({
- show: true
- });
- return false;
- });
- /*
- * Slideout help menu
- */
- $('.slideout-menu-toggle').on('click', function (event) {
- event.preventDefault();
- // create menu variables
- var slideoutMenu = $('.slideout-menu');
- var slideoutMenuWidth = $('.slideout-menu').width();
++function ($) {
+ 'use strict';
- // toggle open class
- slideoutMenu.toggleClass("open");
+ // ALERT CLASS DEFINITION
+ // ======================
- // slide menu
- if (slideoutMenu.hasClass("open")) {
- slideoutMenu.show();
- slideoutMenu.animate({
- right: "0px"
- });
- } else {
- slideoutMenu.animate({
- right: -slideoutMenuWidth
- }, "-350px");
- slideoutMenu.fadeOut();
- }
- });
+ var dismiss = '[data-dismiss="alert"]'
+ var Alert = function (el) {
+ $(el).on('click', dismiss, this.close)
+ }
- /*
- * Select2
- */
+ Alert.VERSION = '3.3.4'
- $('select.select2:not(".select2-hidden-accessible")').each(function (i, obj) {
- {
- $(obj).select2();
- }
- });
+ Alert.TRANSITION_DURATION = 150
- // $('.datepicker').datepicker();
- // var datepicker = $.fn.datepicker.noConflict(); // return $.fn.datepicker to previously assigned value
- // $.fn.bootstrapDP = datepicker;
- // $('.datepicker').datepicker();
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ var selector = $this.attr('data-target')
- // Crazy select2 rich dropdowns with images!
- $('.js-data-ajax').each(function (i, item) {
- var link = $(item);
- var endpoint = link.data("endpoint");
- var select = link.data("select");
- link.select2({
- /**
- * Adds an empty placeholder, allowing every select2 instance to be cleared.
- * This placeholder can be overridden with the "data-placeholder" attribute.
- */
- placeholder: '',
- allowClear: true,
- language: $('meta[name="language"]').attr('content'),
- dir: $('meta[name="language-direction"]').attr('content'),
- ajax: {
- // the baseUrl includes a trailing slash
- url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
- dataType: 'json',
- delay: 250,
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: function data(params) {
- var data = {
- search: params.term,
- page: params.page || 1,
- assetStatusType: link.data("asset-status-type")
- };
- return data;
- },
- /* processResults: function (data, params) {
- params.page = params.page || 1;
- var answer = {
- results: data.items,
- pagination: {
- more: data.pagination.more
- }
- };
- return answer;
- }, */
- cache: true
- },
- //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
- templateResult: formatDatalistSafe
- //templateSelection: formatDataSelection
- });
- });
- function getSelect2Value(element) {
- // if the passed object is not a jquery object, assuming 'element' is a selector
- if (!(element instanceof jQuery)) element = $(element);
- var select = element.data("select2");
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
+ }
- // There's two different locations where the select2-generated input element can be.
- searchElement = select.dropdown.$search || select.$container.find(".select2-search__field");
- var value = searchElement.val();
- return value;
- }
- $(".select2-hidden-accessible").on('select2:selecting', function (e) {
- var data = e.params.args.data;
- var isMouseUp = false;
- var element = $(this);
- var value = getSelect2Value(element);
- if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
+ var $parent = $(selector)
- // if selected item does not match typed text, do not allow it to pass - force close for ajax.
- if (!isMouseUp) {
- if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) < 0) {
- e.preventDefault();
- element.select2('close');
+ if (e) e.preventDefault()
- // if it does match, we set a flag in the event (which gets passed to subsequent events), telling it not to worry about the ajax
- } else if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) > -1) {
- e.params.args.noForceAjax = true;
- }
+ if (!$parent.length) {
+ $parent = $this.closest('.alert')
}
- });
- $(".select2-hidden-accessible").on('select2:closing', function (e) {
- var element = $(this);
- var value = getSelect2Value(element);
- var noForceAjax = false;
- var isMouseUp = false;
- if (e.params.args.originalSelect2Event) noForceAjax = e.params.args.originalSelect2Event.noForceAjax;
- if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
- if (value && !noForceAjax && !isMouseUp) {
- var endpoint = element.data("endpoint");
- var assetStatusType = element.data("asset-status-type");
- $.ajax({
- url: baseUrl + 'api/v1/' + endpoint + '/selectlist?search=' + value + '&page=1' + (assetStatusType ? '&assetStatusType=' + assetStatusType : ''),
- dataType: 'json',
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- }
- }).done(function (response) {
- var currentlySelected = element.select2('data').map(function (x) {
- return +x.id;
- }).filter(function (x) {
- return x !== 0;
- });
- // makes sure we're not selecting the same thing twice for multiples
- var filteredResponse = response.results.filter(function (item) {
- return currentlySelected.indexOf(+item.id) < 0;
- });
- var first = currentlySelected.length > 0 ? filteredResponse[0] : response.results[0];
- if (first && first.id) {
- first.selected = true;
- if ($("option[value='" + first.id + "']", element).length < 1) {
- var option = new Option(first.text, first.id, true, true);
- element.append(option);
- } else {
- var isMultiple = element.attr("multiple") == "multiple";
- element.val(isMultiple ? element.val().concat(first.id) : element.val(first.id));
- }
- element.trigger('change');
- element.trigger({
- type: 'select2:select',
- params: {
- data: first
- }
- });
- }
- });
- }
- });
- function formatDatalist(datalist) {
- var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
- if (datalist.loading) {
- return loading_markup;
- }
- var markup = '<div class="clearfix">';
- markup += '<div class="pull-left" style="padding-right: 10px;">';
- if (datalist.image) {
- markup += "<div style='width: 30px;'><img src='" + datalist.image + "' style='max-height: 20px; max-width: 30px;' alt='" + datalist.text + "'></div>";
- } else {
- markup += '<div style="height: 20px; width: 30px;"></div>';
- }
- markup += "</div><div>" + datalist.text + "</div>";
- markup += "</div>";
- return markup;
- }
- function formatDatalistSafe(datalist) {
- // console.warn("What in the hell is going on with Select2?!?!!?!?");
- // console.warn($.select2);
- if (datalist.loading) {
- return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
- }
- var root_div = $("<div class='clearfix'>");
- var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
- if (datalist.image) {
- var inner_div = $("<div style='width: 30px;'>");
- /******************************************************************
- *
- * We are specifically chosing empty alt-text below, because this
- * image conveys no additional information, relative to the text
- * that will *always* be there in any select2 list that is in use
- * in Snipe-IT. If that changes, we would probably want to change
- * some signatures of some functions, but right now, we don't want
- * screen readers to say "HP SuperJet 5000, .... picture of HP
- * SuperJet 5000..." and so on, for every single row in a list of
- * assets or models or whatever.
- *
- *******************************************************************/
- var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
- // console.warn("Img is: ");
- // console.dir(img);
- // console.warn("Strigularly, that's: ");
- // console.log(img);
- img.attr("src", datalist.image);
- inner_div.append(img);
- } else {
- var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
- }
- left_pull.append(inner_div);
- root_div.append(left_pull);
- var name_div = $("<div>");
- name_div.text(datalist.text);
- root_div.append(name_div);
- var safe_html = root_div.get(0).outerHTML;
- var old_html = formatDatalist(datalist);
- if (safe_html != old_html) {
- //console.log("HTML MISMATCH: ");
- //console.log("FormatDatalistSafe: ");
- // console.dir(root_div.get(0));
- //console.log(safe_html);
- //console.log("FormatDataList: ");
- //console.log(old_html);
+ $parent.trigger(e = $.Event('close.bs.alert'))
+
+ if (e.isDefaultPrevented()) return
+
+ $parent.removeClass('in')
+
+ function removeElement() {
+ // detach from parent, fire event then clean up data
+ $parent.detach().trigger('closed.bs.alert').remove()
}
- return root_div;
+
+ $.support.transition && $parent.hasClass('fade') ?
+ $parent
+ .one('bsTransitionEnd', removeElement)
+ .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
+ removeElement()
}
- function formatDataSelection(datalist) {
- // This a heinous workaround for a known bug in Select2.
- // Without this, the rich selectlists are vulnerable to XSS.
- // Many thanks to @uberbrady for this fix. It ain't pretty,
- // but it resolves the issue until Select2 addresses it on their end.
- //
- // Bug was reported in 2016 :{
- // https://github.com/select2/select2/issues/4587
- return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
+
+ // ALERT PLUGIN DEFINITION
+ // =======================
+
+ function Plugin(option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.alert')
+
+ if (!data) $this.data('bs.alert', (data = new Alert(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
}
- // This handles the radio button selectors for the checkout-to-foo options
- // on asset checkout and also on asset edit
- $(function () {
- $('input[name=checkout_to_type]').on("change", function () {
- var assignto_type = $('input[name=checkout_to_type]:checked').val();
- var userid = $('#assigned_user option:selected').val();
- if (assignto_type == 'asset') {
- $('#current_assets_box').fadeOut();
- $('#assigned_asset').show();
- $('#assigned_user').hide();
- $('#assigned_location').hide();
- $('.notification-callout').fadeOut();
- $('[name="assigned_location"]').val('').trigger('change.select2');
- $('[name="assigned_user"]').val('').trigger('change.select2');
- } else if (assignto_type == 'location') {
- $('#current_assets_box').fadeOut();
- $('#assigned_asset').hide();
- $('#assigned_user').hide();
- $('#assigned_location').show();
- $('.notification-callout').fadeOut();
- $('[name="assigned_asset"]').val('').trigger('change.select2');
- $('[name="assigned_user"]').val('').trigger('change.select2');
- } else {
- $('#assigned_asset').hide();
- $('#assigned_user').show();
- $('#assigned_location').hide();
- if (userid) {
- $('#current_assets_box').fadeIn();
- }
- $('.notification-callout').fadeIn();
- $('[name="assigned_asset"]').val('').trigger('change.select2');
- $('[name="assigned_location"]').val('').trigger('change.select2');
- }
- });
- });
-
- // ------------------------------------------------
- // Deep linking for Bootstrap tabs
- // ------------------------------------------------
- var taburl = document.location.toString();
+ var old = $.fn.alert
- // Allow full page URL to activate a tab's ID
- // ------------------------------------------------
- // This allows linking to a tab on page load via the address bar.
- // So a URL such as, http://snipe-it.local/hardware/2/#my_tab will
- // cause the tab on that page with an ID of “my_tab” to be active.
- if (taburl.match('#')) {
- $('.nav-tabs a[href="#' + taburl.split('#')[1] + '"]').tab('show');
- }
+ $.fn.alert = Plugin
+ $.fn.alert.Constructor = Alert
- // Allow internal page links to activate a tab's ID.
- // ------------------------------------------------
- // This allows you to link to a tab from anywhere on the page
- // including from within another tab. Also note that internal page
- // links either inside or out of the tabs need to include data-toggle="tab"
- // Ex: <a href="#my_tab" data-toggle="tab">Click me</a>
- $('a[data-toggle="tab"]').click(function (e) {
- var href = $(this).attr("href");
- history.pushState(null, null, href);
- e.preventDefault();
- $('a[href="' + $(this).attr('href') + '"]').tab('show');
- });
- // ------------------------------------------------
- // End Deep Linking for Bootstrap tabs
- // ------------------------------------------------
+ // ALERT NO CONFLICT
+ // =================
- // Image preview
- function readURL(input, $preview) {
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- reader.onload = function (e) {
- $preview.attr('src', e.target.result);
- };
- reader.readAsDataURL(input.files[0]);
- }
- }
- function formatBytes(bytes) {
- if (bytes < 1024) return bytes + " Bytes";else if (bytes < 1048576) return (bytes / 1024).toFixed(2) + " KB";else if (bytes < 1073741824) return (bytes / 1048576).toFixed(2) + " MB";else return (bytes / 1073741824).toFixed(2) + " GB";
+ $.fn.alert.noConflict = function () {
+ $.fn.alert = old
+ return this
}
- // File size validation
- $('.js-uploadFile').bind('change', function () {
- var $this = $(this);
- var id = '#' + $this.attr('id');
- var status = id + '-status';
- var $status = $(status);
- var delete_id = $(id + '-deleteCheckbox');
- var preview_container = $(id + '-previewContainer');
- $status.removeClass('text-success').removeClass('text-danger');
- $(status + ' .goodfile').remove();
- $(status + ' .badfile').remove();
- $(status + ' .previewSize').hide();
- preview_container.hide();
- $(id + '-info').html('');
- var max_size = $this.data('maxsize');
- var total_size = 0;
- for (var i = 0; i < this.files.length; i++) {
- total_size += this.files[i].size;
- $(id + '-info').append('<span class="label label-default">' + htmlEntities(this.files[i].name) + ' (' + formatBytes(this.files[i].size) + ')</span> ');
- }
- if (total_size > max_size) {
- $status.addClass('text-danger').removeClass('help-block').prepend('<i class="badfile fas fa-times"></i> ').append('<span class="previewSize"> Upload is ' + formatBytes(total_size) + '.</span>');
- } else {
- $status.addClass('text-success').removeClass('help-block').prepend('<i class="goodfile fas fa-check"></i> ');
- var $preview = $(id + '-imagePreview');
- readURL(this, $preview);
- $preview.fadeIn();
- preview_container.fadeIn();
- delete_id.hide();
- }
- });
-});
-function htmlEntities(str) {
- return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
-}
-/**
- * Toggle disabled
- */
-(function ($) {
- $.fn.toggleDisabled = function (callback) {
- return this.each(function () {
- var disabled,
- $this = $(this);
- if ($this.attr('disabled')) {
- $this.removeAttr('disabled');
- disabled = false;
- } else {
- $this.attr('disabled', 'disabled');
- disabled = true;
- }
- if (callback && typeof callback === 'function') {
- callback(this, disabled);
- }
- });
- };
-})(jQuery);
+ // ALERT DATA-API
+ // ==============
-/**
- * Universal Livewire Select2 integration
- *
- * How to use:
- *
- * 1. Set the class of your select2 elements to 'livewire-select2').
- * 2. Name your element to match a property in your Livewire component
- * 3. Add an attribute called 'data-livewire-component' that points to $this->getId() (via `{{ }}` if you're in a blade,
- * or just $this->getId() if not).
- */
-document.addEventListener('livewire:init', function () {
- $('.livewire-select2').select2();
- $(document).on('select2:select', '.livewire-select2', function (event) {
- var target = $(event.target);
- if (!event.target.name || !target.data('livewire-component')) {
- console.error("You need to set both name (which should match a Livewire property) and data-livewire-component on your Livewire-ed select2 elements!");
- console.error("For data-livewire-component, you probably want to use $this->getId() or {{ $this->getId() }}, as appropriate");
- return false;
- }
- Livewire.find(target.data('livewire-component')).set(event.target.name, this.options[this.selectedIndex].value);
- });
- Livewire.hook('request', function (_ref) {
- var succeed = _ref.succeed;
- succeed(function () {
- queueMicrotask(function () {
- $('.livewire-select2').select2();
- });
- });
- });
-});
+ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
-/***/ }),
+}(jQuery);
-/***/ "./resources/assets/js/snipeit_modals.js":
-/*!***********************************************!*\
- !*** ./resources/assets/js/snipeit_modals.js ***!
- \***********************************************/
-/***/ (() => {
+/* ========================================================================
+ * Bootstrap: button.js v3.3.4
+ * http://getbootstrap.com/javascript/#buttons
+ * ========================================================================
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ * ======================================================================== */
-/*
- *
- * Snipe-IT Universal Modal support
- *
- * Enables modal dialogs to create sub-resources throughout Snipe-IT
- *
- */
-/*
-HOW TO USE
- Create a Button looking like this:
- <a href='{{ route('modal.show', 'user') }}' data-toggle="modal" data-target="#createModal" data-select='assigned_to' class="btn btn-sm btn-primary">New</a>
- If you don't have access to Blade commands (like {{ and }}, etc), you can hard-code a URL as the 'href'
- data-toggle="modal" - required for Bootstrap Modals
-data-target="#createModal" - fixed ID for the modal, do not change
-data-select="assigned_to" - What is the *ID* of the select-dropdown that you're going to be adding to, if the modal-create was a success? Be on the lookout for duplicate ID's, it will confuse this library!
-class="btn btn-sm btn-primary" - makes it look button-ey, feel free to change :)
++function ($) {
+ 'use strict';
-If you want to pass additional variables to the modal (In the Category Create one, for example, you can pass category_id), you can encode them as URL variables in the href
+ // BUTTON PUBLIC CLASS DEFINITION
+ // ==============================
-*/
+ var Button = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, Button.DEFAULTS, options)
+ this.isLoading = false
+ }
-$(function () {
- var baseUrl = $('meta[name="baseUrl"]').attr('content');
- //handle modal-add-interstitial calls
- var model, select, refreshSelector;
- if ($('#createModal').length == 0) {
- $('body').append('<div class="modal fade" id="createModal"></div><!-- /.modal -->');
+ Button.VERSION = '3.3.4'
+
+ Button.DEFAULTS = {
+ loadingText: 'loading...'
}
- $('#createModal').on("show.bs.modal", function (event) {
- var link = $(event.relatedTarget);
- model = link.data("dependency");
- select = link.data("select");
- refreshSelector = link.data("refresh");
- $('#createModal').load(link.attr('href'), function () {
- // this sets the focus to be the name field
- $('#modal-name').focus();
- //do we need to re-select2 this, after load? Probably.
- $('#createModal').find('select.select2').select2();
- // Initialize the ajaxy select2 with images.
- // This is a copy/paste of the code from snipeit.js, would be great to only have this in one place.
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ var $el = this.$element
+ var val = $el.is('input') ? 'val' : 'html'
+ var data = $el.data()
- $('.js-data-ajax').each(function (i, item) {
- var link = $(item);
- var endpoint = link.data("endpoint");
- var select = link.data("select");
- link.select2({
- ajax: {
- // the baseUrl includes a trailing slash
- url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
- //WARNING - we're hoping that's defined on the page somewhere...
- dataType: 'json',
- delay: 250,
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: function data(params) {
- var data = {
- search: params.term,
- page: params.page || 1,
- assetStatusType: link.data("asset-status-type")
- };
- return data;
- },
- /*processResults: function (data, params) {
- params.page = params.page || 1;
- var answer = {
- results: data.items,
- pagination: {
- more: data.pagination.more
- }
- };
- return answer;
- },*/
- cache: true
- },
- //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
- templateResult: formatDatalistSafe
- //templateSelection: formatDataSelection
- });
- });
- });
- });
- $('#createModal').on('click', '#modal-save', function () {
- $.ajax({
- type: 'POST',
- url: $('.modal-body form').attr('action'),
- headers: {
- "X-Requested-With": 'XMLHttpRequest',
- "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
- },
- data: $('.modal-body form').serialize(),
- success: function success(result) {
- if (result.status == "error") {
- var error_message = "";
- for (var field in result.messages) {
- error_message += "<li>Problem(s) with field <i><strong>" + field + "</strong></i>: " + result.messages[field];
- }
- $('#modal_error_msg').html(error_message).show();
- return false;
- }
- var id = result.payload.id;
- var name = result.payload.name || result.payload.first_name + " " + result.payload.last_name;
- if (!id || !name) {
- console.error("Could not find resulting name or ID from modal-create. Name: " + name + ", id: " + id);
- return false;
- }
- $('#createModal').modal('hide');
- $('#createModal').html("");
- var refreshTable = $('#' + refreshSelector);
- if (refreshTable.length > 0) {
- refreshTable.bootstrapTable('refresh');
- }
+ state = state + 'Text'
- // "select" is the original drop-down menu that someone
- // clicked 'add' on to add a new 'thing'
- // this code adds the newly created object to that select
- var selector = document.getElementById(select);
- if (!selector) {
- return false;
- }
- selector.options[selector.length] = new Option(name, id);
- selector.selectedIndex = selector.length - 1;
- $(selector).trigger("change");
- if (window.fetchCustomFields) {
- fetchCustomFields();
- }
- },
- error: function error(result) {
- msg = result.responseJSON.messages || result.responseJSON.error;
- $('#modal_error_msg').html("Server Error: " + msg).show();
+ if (data.resetText == null) $el.data('resetText', $el[val]())
+
+ // push to event loop to allow forms to submit
+ setTimeout($.proxy(function () {
+ $el[val](data[state] == null ? this.options[state] : data[state])
+
+ if (state == 'loadingText') {
+ this.isLoading = true
+ $el.addClass(d).attr(d, d)
+ } else if (this.isLoading) {
+ this.isLoading = false
+ $el.removeClass(d).removeAttr(d)
}
- });
- });
-});
-function formatDatalistSafe(datalist) {
- // console.warn("What in the hell is going on with Select2?!?!!?!?");
- // console.warn($.select2);
- if (datalist.loading) {
- return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
- }
- var root_div = $("<div class='clearfix'>");
- var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
- if (datalist.image) {
- var inner_div = $("<div style='width: 30px;'>");
- /******************************************************************
- *
- * We are specifically chosing empty alt-text below, because this
- * image conveys no additional information, relative to the text
- * that will *always* be there in any select2 list that is in use
- * in Snipe-IT. If that changes, we would probably want to change
- * some signatures of some functions, but right now, we don't want
- * screen readers to say "HP SuperJet 5000, .... picture of HP
- * SuperJet 5000..." and so on, for every single row in a list of
- * assets or models or whatever.
- *
- *******************************************************************/
- var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
- // console.warn("Img is: ");
- // console.dir(img);
- // console.warn("Strigularly, that's: ");
- // console.log(img);
- img.attr("src", datalist.image);
- inner_div.append(img);
- } else {
- var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
- }
- left_pull.append(inner_div);
- root_div.append(left_pull);
- var name_div = $("<div>");
- name_div.text(datalist.text);
- root_div.append(name_div);
- var safe_html = root_div.get(0).outerHTML;
- var old_html = formatDatalist(datalist);
- if (safe_html != old_html) {
- // console.log("HTML MISMATCH: ");
- // console.log("FormatDatalistSafe: ");
- // console.dir(root_div.get(0));
- // console.log(safe_html);
- // console.log("FormatDataList: ");
- // console.log(old_html);
+ }, this), 0)
}
- return root_div;
-}
-function formatDatalist(datalist) {
- var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
- if (datalist.loading) {
- return loading_markup;
+
+ Button.prototype.toggle = function () {
+ var changed = true
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
+
+ if ($parent.length) {
+ var $input = this.$element.find('input')
+ if ($input.prop('type') == 'radio') {
+ if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
+ else $parent.find('.active').removeClass('active')
+ }
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
+ } else {
+ this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
+ }
+
+ if (changed) this.$element.toggleClass('active')
}
- var markup = "<div class='clearfix'>";
- markup += "<div class='pull-left' style='padding-right: 10px;'>";
- if (datalist.image) {
- markup += "<div style='width: 30px;'><img src='" + datalist.image + "' alt='" + datalist.tex + "' style='max-height: 20px; max-width: 30px;'></div>";
- } else {
- markup += "<div style='height: 20px; width: 30px;'></div>";
+
+
+ // BUTTON PLUGIN DEFINITION
+ // ========================
+
+ function Plugin(option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.button')
+ var options = typeof option == 'object' && option
+
+ if (!data) $this.data('bs.button', (data = new Button(this, options)))
+
+ if (option == 'toggle') data.toggle()
+ else if (option) data.setState(option)
+ })
}
- markup += "</div><div>" + datalist.text + "</div>";
- markup += "</div>";
- return markup;
-}
-function formatDataSelection(datalist) {
- return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
-}
-/***/ }),
+ var old = $.fn.button
-/***/ "./node_modules/bootstrap-less/js/bootstrap.js":
-/*!*****************************************************!*\
- !*** ./node_modules/bootstrap-less/js/bootstrap.js ***!
- \*****************************************************/
-/***/ (() => {
+ $.fn.button = Plugin
+ $.fn.button.Constructor = Button
-/* */
-"format global";
-"deps jquery";
-"exports $";
-/*!
- * Bootstrap v3.3.4 (http://getbootstrap.com)
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- */
-if (typeof jQuery === 'undefined') {
- throw new Error('Bootstrap\'s JavaScript requires jQuery')
-}
+ // BUTTON NO CONFLICT
+ // ==================
-+function ($) {
- 'use strict';
- var version = $.fn.jquery.split(' ')[0].split('.')
- if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
- throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
+ $.fn.button.noConflict = function () {
+ $.fn.button = old
+ return this
}
+
+
+ // BUTTON DATA-API
+ // ===============
+
+ $(document)
+ .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
+ var $btn = $(e.target)
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
+ Plugin.call($btn, 'toggle')
+ e.preventDefault()
+ })
+ .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
+ $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
+ })
+
}(jQuery);
/* ========================================================================
- * Bootstrap: transition.js v3.3.4
- * http://getbootstrap.com/javascript/#transitions
+ * Bootstrap: carousel.js v3.3.4
+ * http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
@@ -59770,292 +59259,20 @@ if (typeof jQuery === 'undefined') {
+function ($) {
'use strict';
- // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
- // ============================================================
+ // CAROUSEL CLASS DEFINITION
+ // =========================
- function transitionEnd() {
- var el = document.createElement('bootstrap')
+ var Carousel = function (element, options) {
+ this.$element = $(element)
+ this.$indicators = this.$element.find('.carousel-indicators')
+ this.options = options
+ this.paused = null
+ this.sliding = null
+ this.interval = null
+ this.$active = null
+ this.$items = null
- var transEndEventNames = {
- WebkitTransition : 'webkitTransitionEnd',
- MozTransition : 'transitionend',
- OTransition : 'oTransitionEnd otransitionend',
- transition : 'transitionend'
- }
-
- for (var name in transEndEventNames) {
- if (el.style[name] !== undefined) {
- return { end: transEndEventNames[name] }
- }
- }
-
- return false // explicit for ie8 ( ._.)
- }
-
- // http://blog.alexmaccaw.com/css-transitions
- $.fn.emulateTransitionEnd = function (duration) {
- var called = false
- var $el = this
- $(this).one('bsTransitionEnd', function () { called = true })
- var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
- setTimeout(callback, duration)
- return this
- }
-
- $(function () {
- $.support.transition = transitionEnd()
-
- if (!$.support.transition) return
-
- $.event.special.bsTransitionEnd = {
- bindType: $.support.transition.end,
- delegateType: $.support.transition.end,
- handle: function (e) {
- if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
- }
- }
- })
-
-}(jQuery);
-
-/* ========================================================================
- * Bootstrap: alert.js v3.3.4
- * http://getbootstrap.com/javascript/#alerts
- * ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
- 'use strict';
-
- // ALERT CLASS DEFINITION
- // ======================
-
- var dismiss = '[data-dismiss="alert"]'
- var Alert = function (el) {
- $(el).on('click', dismiss, this.close)
- }
-
- Alert.VERSION = '3.3.4'
-
- Alert.TRANSITION_DURATION = 150
-
- Alert.prototype.close = function (e) {
- var $this = $(this)
- var selector = $this.attr('data-target')
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
- }
-
- var $parent = $(selector)
-
- if (e) e.preventDefault()
-
- if (!$parent.length) {
- $parent = $this.closest('.alert')
- }
-
- $parent.trigger(e = $.Event('close.bs.alert'))
-
- if (e.isDefaultPrevented()) return
-
- $parent.removeClass('in')
-
- function removeElement() {
- // detach from parent, fire event then clean up data
- $parent.detach().trigger('closed.bs.alert').remove()
- }
-
- $.support.transition && $parent.hasClass('fade') ?
- $parent
- .one('bsTransitionEnd', removeElement)
- .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
- removeElement()
- }
-
-
- // ALERT PLUGIN DEFINITION
- // =======================
-
- function Plugin(option) {
- return this.each(function () {
- var $this = $(this)
- var data = $this.data('bs.alert')
-
- if (!data) $this.data('bs.alert', (data = new Alert(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- var old = $.fn.alert
-
- $.fn.alert = Plugin
- $.fn.alert.Constructor = Alert
-
-
- // ALERT NO CONFLICT
- // =================
-
- $.fn.alert.noConflict = function () {
- $.fn.alert = old
- return this
- }
-
-
- // ALERT DATA-API
- // ==============
-
- $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
-
-}(jQuery);
-
-/* ========================================================================
- * Bootstrap: button.js v3.3.4
- * http://getbootstrap.com/javascript/#buttons
- * ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
- 'use strict';
-
- // BUTTON PUBLIC CLASS DEFINITION
- // ==============================
-
- var Button = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, Button.DEFAULTS, options)
- this.isLoading = false
- }
-
- Button.VERSION = '3.3.4'
-
- Button.DEFAULTS = {
- loadingText: 'loading...'
- }
-
- Button.prototype.setState = function (state) {
- var d = 'disabled'
- var $el = this.$element
- var val = $el.is('input') ? 'val' : 'html'
- var data = $el.data()
-
- state = state + 'Text'
-
- if (data.resetText == null) $el.data('resetText', $el[val]())
-
- // push to event loop to allow forms to submit
- setTimeout($.proxy(function () {
- $el[val](data[state] == null ? this.options[state] : data[state])
-
- if (state == 'loadingText') {
- this.isLoading = true
- $el.addClass(d).attr(d, d)
- } else if (this.isLoading) {
- this.isLoading = false
- $el.removeClass(d).removeAttr(d)
- }
- }, this), 0)
- }
-
- Button.prototype.toggle = function () {
- var changed = true
- var $parent = this.$element.closest('[data-toggle="buttons"]')
-
- if ($parent.length) {
- var $input = this.$element.find('input')
- if ($input.prop('type') == 'radio') {
- if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
- else $parent.find('.active').removeClass('active')
- }
- if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
- } else {
- this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
- }
-
- if (changed) this.$element.toggleClass('active')
- }
-
-
- // BUTTON PLUGIN DEFINITION
- // ========================
-
- function Plugin(option) {
- return this.each(function () {
- var $this = $(this)
- var data = $this.data('bs.button')
- var options = typeof option == 'object' && option
-
- if (!data) $this.data('bs.button', (data = new Button(this, options)))
-
- if (option == 'toggle') data.toggle()
- else if (option) data.setState(option)
- })
- }
-
- var old = $.fn.button
-
- $.fn.button = Plugin
- $.fn.button.Constructor = Button
-
-
- // BUTTON NO CONFLICT
- // ==================
-
- $.fn.button.noConflict = function () {
- $.fn.button = old
- return this
- }
-
-
- // BUTTON DATA-API
- // ===============
-
- $(document)
- .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
- var $btn = $(e.target)
- if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
- Plugin.call($btn, 'toggle')
- e.preventDefault()
- })
- .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
- $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
- })
-
-}(jQuery);
-
-/* ========================================================================
- * Bootstrap: carousel.js v3.3.4
- * http://getbootstrap.com/javascript/#carousel
- * ========================================================================
- * Copyright 2011-2015 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
- 'use strict';
-
- // CAROUSEL CLASS DEFINITION
- // =========================
-
- var Carousel = function (element, options) {
- this.$element = $(element)
- this.$indicators = this.$element.find('.carousel-indicators')
- this.options = options
- this.paused = null
- this.sliding = null
- this.interval = null
- this.$active = null
- this.$items = null
-
- this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
+ this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
@@ -91663,189 +90880,1037 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/**
arrayEach(['initial', 'tail'], function(methodName, index) {
var dropName = 'drop' + (index ? '' : 'Right');
- LazyWrapper.prototype[methodName] = function() {
- return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
- };
+ LazyWrapper.prototype[methodName] = function() {
+ return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
+ };
+ });
+
+ LazyWrapper.prototype.compact = function() {
+ return this.filter(identity);
+ };
+
+ LazyWrapper.prototype.find = function(predicate) {
+ return this.filter(predicate).head();
+ };
+
+ LazyWrapper.prototype.findLast = function(predicate) {
+ return this.reverse().find(predicate);
+ };
+
+ LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
+ if (typeof path == 'function') {
+ return new LazyWrapper(this);
+ }
+ return this.map(function(value) {
+ return baseInvoke(value, path, args);
+ });
+ });
+
+ LazyWrapper.prototype.reject = function(predicate) {
+ return this.filter(negate(getIteratee(predicate)));
+ };
+
+ LazyWrapper.prototype.slice = function(start, end) {
+ start = toInteger(start);
+
+ var result = this;
+ if (result.__filtered__ && (start > 0 || end < 0)) {
+ return new LazyWrapper(result);
+ }
+ if (start < 0) {
+ result = result.takeRight(-start);
+ } else if (start) {
+ result = result.drop(start);
+ }
+ if (end !== undefined) {
+ end = toInteger(end);
+ result = end < 0 ? result.dropRight(-end) : result.take(end - start);
+ }
+ return result;
+ };
+
+ LazyWrapper.prototype.takeRightWhile = function(predicate) {
+ return this.reverse().takeWhile(predicate).reverse();
+ };
+
+ LazyWrapper.prototype.toArray = function() {
+ return this.take(MAX_ARRAY_LENGTH);
+ };
+
+ // Add `LazyWrapper` methods to `lodash.prototype`.
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+ var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
+ isTaker = /^(?:head|last)$/.test(methodName),
+ lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
+ retUnwrapped = isTaker || /^find/.test(methodName);
+
+ if (!lodashFunc) {
+ return;
+ }
+ lodash.prototype[methodName] = function() {
+ var value = this.__wrapped__,
+ args = isTaker ? [1] : arguments,
+ isLazy = value instanceof LazyWrapper,
+ iteratee = args[0],
+ useLazy = isLazy || isArray(value);
+
+ var interceptor = function(value) {
+ var result = lodashFunc.apply(lodash, arrayPush([value], args));
+ return (isTaker && chainAll) ? result[0] : result;
+ };
+
+ if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
+ // Avoid lazy use if the iteratee has a "length" value other than `1`.
+ isLazy = useLazy = false;
+ }
+ var chainAll = this.__chain__,
+ isHybrid = !!this.__actions__.length,
+ isUnwrapped = retUnwrapped && !chainAll,
+ onlyLazy = isLazy && !isHybrid;
+
+ if (!retUnwrapped && useLazy) {
+ value = onlyLazy ? value : new LazyWrapper(this);
+ var result = func.apply(value, args);
+ result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
+ return new LodashWrapper(result, chainAll);
+ }
+ if (isUnwrapped && onlyLazy) {
+ return func.apply(this, args);
+ }
+ result = this.thru(interceptor);
+ return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
+ };
+ });
+
+ // Add `Array` methods to `lodash.prototype`.
+ arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
+ var func = arrayProto[methodName],
+ chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
+ retUnwrapped = /^(?:pop|shift)$/.test(methodName);
+
+ lodash.prototype[methodName] = function() {
+ var args = arguments;
+ if (retUnwrapped && !this.__chain__) {
+ var value = this.value();
+ return func.apply(isArray(value) ? value : [], args);
+ }
+ return this[chainName](function(value) {
+ return func.apply(isArray(value) ? value : [], args);
+ });
+ };
+ });
+
+ // Map minified method names to their real names.
+ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
+ var lodashFunc = lodash[methodName];
+ if (lodashFunc) {
+ var key = lodashFunc.name + '';
+ if (!hasOwnProperty.call(realNames, key)) {
+ realNames[key] = [];
+ }
+ realNames[key].push({ 'name': methodName, 'func': lodashFunc });
+ }
+ });
+
+ realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
+ 'name': 'wrapper',
+ 'func': undefined
+ }];
+
+ // Add methods to `LazyWrapper`.
+ LazyWrapper.prototype.clone = lazyClone;
+ LazyWrapper.prototype.reverse = lazyReverse;
+ LazyWrapper.prototype.value = lazyValue;
+
+ // Add chain sequence methods to the `lodash` wrapper.
+ lodash.prototype.at = wrapperAt;
+ lodash.prototype.chain = wrapperChain;
+ lodash.prototype.commit = wrapperCommit;
+ lodash.prototype.next = wrapperNext;
+ lodash.prototype.plant = wrapperPlant;
+ lodash.prototype.reverse = wrapperReverse;
+ lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+
+ // Add lazy aliases.
+ lodash.prototype.first = lodash.prototype.head;
+
+ if (symIterator) {
+ lodash.prototype[symIterator] = wrapperToIterator;
+ }
+ return lodash;
+ });
+
+ /*--------------------------------------------------------------------------*/
+
+ // Export lodash.
+ var _ = runInContext();
+
+ // Some AMD build optimizers, like r.js, check for condition patterns like:
+ if (true) {
+ // Expose Lodash on the global object to prevent errors when Lodash is
+ // loaded by a script tag in the presence of an AMD loader.
+ // See http://requirejs.org/docs/errors.html#mismatch for more details.
+ // Use `_.noConflict` to remove Lodash from the global object.
+ root._ = _;
+
+ // Define as an anonymous module so, through path mapping, it can be
+ // referenced as the "underscore" module.
+ !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
+ return _;
+ }).call(exports, __webpack_require__, exports, module),
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ }
+ // Check for `exports` after `define` in case a build optimizer adds it.
+ else {}
+}.call(this));
+
+
+/***/ }),
+
+/***/ "./resources/assets/js/bootstrap.js":
+/*!******************************************!*\
+ !*** ./resources/assets/js/bootstrap.js ***!
+ \******************************************/
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+
+window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
+
+/**
+ * We'll load jQuery and the Bootstrap jQuery plugin which provides support
+ * for JavaScript based Bootstrap features such as modals and tabs. This
+ * code may be modified to fit the specific needs of your application.
+ */
+//window.$ = window.jQuery = require('jquery');
+
+/**
+ * jQuery UI is loaded here and then the tooltip is assigned another funtion name
+ * This resolves the issue of jquery-ui & bootstrap tooltip conflict
+ */
+__webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui/ui/widget.js");
+jQuery.fn.uitooltip = jQuery.fn.tooltip;
+
+/**
+ * Load boostrap
+ */
+__webpack_require__(/*! bootstrap-less */ "./node_modules/bootstrap-less/js/bootstrap.js");
+
+// require('admin-lte');
+
+// require('chart.js');
+
+// require('jquery-form-validator'); //says something about dependency
+/**
+ * Echo exposes an expressive API for subscribing to channels and listening
+ * for events that are broadcast by Laravel. Echo and event broadcasting
+ * allows your team to easily build robust real-time web applications.
+ */
+
+// import Echo from "laravel-echo"
+
+// window.Echo = new Echo({
+// broadcaster: 'pusher',
+// key: 'your-pusher-key'
+// });
+
+/***/ }),
+
+/***/ "./resources/assets/js/snipeit.js":
+/*!****************************************!*\
+ !*** ./resources/assets/js/snipeit.js ***!
+ \****************************************/
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+
+// var jQuery = require('jquery');
+// window.jQuery = jQuery
+// window.$ = jQuery
+
+__webpack_require__(/*! ./bootstrap */ "./resources/assets/js/bootstrap.js");
+
+/**
+ * Module containing core application logic.
+ * @param {jQuery} $ Insulated jQuery object
+ * @param {JSON} settings Insulated `window.snipeit.settings` object.
+ * @return {IIFE} Immediately invoked. Returns self.
+ */
+
+lineOptions = {
+ legend: {
+ position: "bottom"
+ },
+ scales: {
+ yAxes: [{
+ ticks: {
+ fontColor: "rgba(0,0,0,0.5)",
+ fontStyle: "bold",
+ beginAtZero: true,
+ maxTicksLimit: 5,
+ padding: 20
+ },
+ gridLines: {
+ drawTicks: false,
+ display: false
+ }
+ }],
+ xAxes: [{
+ gridLines: {
+ zeroLineColor: "transparent"
+ },
+ ticks: {
+ padding: 20,
+ fontColor: "rgba(0,0,0,0.5)",
+ fontStyle: "bold"
+ }
+ }]
+ }
+};
+pieOptions = {
+ //Boolean - Whether we should show a stroke on each segment
+ segmentShowStroke: true,
+ //String - The colour of each segment stroke
+ segmentStrokeColor: "#fff",
+ //Number - The width of each segment stroke
+ segmentStrokeWidth: 1,
+ //Number - The percentage of the chart that we cut out of the middle
+ percentageInnerCutout: 50,
+ // This is 0 for Pie charts
+ //Number - Amount of animation steps
+ animationSteps: 100,
+ //String - Animation easing effect
+ animationEasing: "easeOutBounce",
+ //Boolean - Whether we animate the rotation of the Doughnut
+ animateRotate: true,
+ //Boolean - Whether we animate scaling the Doughnut from the centre
+ animateScale: false,
+ //Boolean - whether to make the chart responsive to window resizing
+ responsive: true,
+ // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
+ maintainAspectRatio: false,
+ //String - A legend template
+ legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li>" + "<i class='fas fa-circle-o' style='color: <%=segments[i].fillColor%>'></i>" + "<%if(segments[i].label){%><%=segments[i].label%><%}%> foo</li><%}%></ul>",
+ //String - A tooltip template
+ tooltipTemplate: "<%=value %> <%=label%> "
+};
+
+//-----------------
+//- END PIE CHART -
+//-----------------
+
+var baseUrl = $('meta[name="baseUrl"]').attr('content');
+$(function () {
+ var $el = $('table');
+
+ // confirm restore modal
+
+ $el.on('click', '.restore-asset', function (evnt) {
+ var $context = $(this);
+ var $restoreConfirmModal = $('#restoreConfirmModal');
+ var href = $context.attr('href');
+ var message = $context.attr('data-content');
+ var title = $context.attr('data-title');
+ $('#confirmModalLabel').text(title);
+ $restoreConfirmModal.find('.modal-body').text(message);
+ $('#restoreForm').attr('action', href);
+ $restoreConfirmModal.modal({
+ show: true
+ });
+ return false;
+ });
+
+ // confirm delete modal
+
+ $el.on('click', '.delete-asset', function (evnt) {
+ var $context = $(this);
+ var $dataConfirmModal = $('#dataConfirmModal');
+ var href = $context.attr('href');
+ var message = $context.attr('data-content');
+ var title = $context.attr('data-title');
+ $('#myModalLabel').text(title);
+ $dataConfirmModal.find('.modal-body').text(message);
+ $('#deleteForm').attr('action', href);
+ $dataConfirmModal.modal({
+ show: true
+ });
+ return false;
+ });
+
+ /*
+ * Slideout help menu
+ */
+ $('.slideout-menu-toggle').on('click', function (event) {
+ event.preventDefault();
+ // create menu variables
+ var slideoutMenu = $('.slideout-menu');
+ var slideoutMenuWidth = $('.slideout-menu').width();
+
+ // toggle open class
+ slideoutMenu.toggleClass("open");
+
+ // slide menu
+ if (slideoutMenu.hasClass("open")) {
+ slideoutMenu.show();
+ slideoutMenu.animate({
+ right: "0px"
+ });
+ } else {
+ slideoutMenu.animate({
+ right: -slideoutMenuWidth
+ }, "-350px");
+ slideoutMenu.fadeOut();
+ }
+ });
+
+ /*
+ * Select2
+ */
+
+ $('select.select2:not(".select2-hidden-accessible")').each(function (i, obj) {
+ {
+ $(obj).select2();
+ }
+ });
+
+ // $('.datepicker').datepicker();
+ // var datepicker = $.fn.datepicker.noConflict(); // return $.fn.datepicker to previously assigned value
+ // $.fn.bootstrapDP = datepicker;
+ // $('.datepicker').datepicker();
+
+ // Crazy select2 rich dropdowns with images!
+ $('.js-data-ajax').each(function (i, item) {
+ var link = $(item);
+ var endpoint = link.data("endpoint");
+ var select = link.data("select");
+ link.select2({
+ /**
+ * Adds an empty placeholder, allowing every select2 instance to be cleared.
+ * This placeholder can be overridden with the "data-placeholder" attribute.
+ */
+ placeholder: '',
+ allowClear: true,
+ language: $('meta[name="language"]').attr('content'),
+ dir: $('meta[name="language-direction"]').attr('content'),
+ ajax: {
+ // the baseUrl includes a trailing slash
+ url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
+ dataType: 'json',
+ delay: 250,
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ data: function data(params) {
+ var data = {
+ search: params.term,
+ page: params.page || 1,
+ assetStatusType: link.data("asset-status-type")
+ };
+ return data;
+ },
+ /* processResults: function (data, params) {
+ params.page = params.page || 1;
+ var answer = {
+ results: data.items,
+ pagination: {
+ more: data.pagination.more
+ }
+ };
+ return answer;
+ }, */
+ cache: true
+ },
+ //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
+ templateResult: formatDatalistSafe
+ //templateSelection: formatDataSelection
+ });
+ });
+ function getSelect2Value(element) {
+ // if the passed object is not a jquery object, assuming 'element' is a selector
+ if (!(element instanceof jQuery)) element = $(element);
+ var select = element.data("select2");
+
+ // There's two different locations where the select2-generated input element can be.
+ searchElement = select.dropdown.$search || select.$container.find(".select2-search__field");
+ var value = searchElement.val();
+ return value;
+ }
+ $(".select2-hidden-accessible").on('select2:selecting', function (e) {
+ var data = e.params.args.data;
+ var isMouseUp = false;
+ var element = $(this);
+ var value = getSelect2Value(element);
+ if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
+
+ // if selected item does not match typed text, do not allow it to pass - force close for ajax.
+ if (!isMouseUp) {
+ if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) < 0) {
+ e.preventDefault();
+ element.select2('close');
+
+ // if it does match, we set a flag in the event (which gets passed to subsequent events), telling it not to worry about the ajax
+ } else if (value.toLowerCase() && data.text.toLowerCase().indexOf(value) > -1) {
+ e.params.args.noForceAjax = true;
+ }
+ }
+ });
+ $(".select2-hidden-accessible").on('select2:closing', function (e) {
+ var element = $(this);
+ var value = getSelect2Value(element);
+ var noForceAjax = false;
+ var isMouseUp = false;
+ if (e.params.args.originalSelect2Event) noForceAjax = e.params.args.originalSelect2Event.noForceAjax;
+ if (e.params.args.originalEvent) isMouseUp = e.params.args.originalEvent.type == "mouseup";
+ if (value && !noForceAjax && !isMouseUp) {
+ var endpoint = element.data("endpoint");
+ var assetStatusType = element.data("asset-status-type");
+ $.ajax({
+ url: baseUrl + 'api/v1/' + endpoint + '/selectlist?search=' + value + '&page=1' + (assetStatusType ? '&assetStatusType=' + assetStatusType : ''),
+ dataType: 'json',
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ }
+ }).done(function (response) {
+ var currentlySelected = element.select2('data').map(function (x) {
+ return +x.id;
+ }).filter(function (x) {
+ return x !== 0;
+ });
+
+ // makes sure we're not selecting the same thing twice for multiples
+ var filteredResponse = response.results.filter(function (item) {
+ return currentlySelected.indexOf(+item.id) < 0;
+ });
+ var first = currentlySelected.length > 0 ? filteredResponse[0] : response.results[0];
+ if (first && first.id) {
+ first.selected = true;
+ if ($("option[value='" + first.id + "']", element).length < 1) {
+ var option = new Option(first.text, first.id, true, true);
+ element.append(option);
+ } else {
+ var isMultiple = element.attr("multiple") == "multiple";
+ element.val(isMultiple ? element.val().concat(first.id) : element.val(first.id));
+ }
+ element.trigger('change');
+ element.trigger({
+ type: 'select2:select',
+ params: {
+ data: first
+ }
+ });
+ }
+ });
+ }
+ });
+ function formatDatalist(datalist) {
+ var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
+ if (datalist.loading) {
+ return loading_markup;
+ }
+ var markup = '<div class="clearfix">';
+ markup += '<div class="pull-left" style="padding-right: 10px;">';
+ if (datalist.image) {
+ markup += "<div style='width: 30px;'><img src='" + datalist.image + "' style='max-height: 20px; max-width: 30px;' alt='" + datalist.text + "'></div>";
+ } else {
+ markup += '<div style="height: 20px; width: 30px;"></div>';
+ }
+ markup += "</div><div>" + datalist.text + "</div>";
+ markup += "</div>";
+ return markup;
+ }
+ function formatDatalistSafe(datalist) {
+ // console.warn("What in the hell is going on with Select2?!?!!?!?");
+ // console.warn($.select2);
+ if (datalist.loading) {
+ return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
+ }
+ var root_div = $("<div class='clearfix'>");
+ var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
+ if (datalist.image) {
+ var inner_div = $("<div style='width: 30px;'>");
+ /******************************************************************
+ *
+ * We are specifically chosing empty alt-text below, because this
+ * image conveys no additional information, relative to the text
+ * that will *always* be there in any select2 list that is in use
+ * in Snipe-IT. If that changes, we would probably want to change
+ * some signatures of some functions, but right now, we don't want
+ * screen readers to say "HP SuperJet 5000, .... picture of HP
+ * SuperJet 5000..." and so on, for every single row in a list of
+ * assets or models or whatever.
+ *
+ *******************************************************************/
+ var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
+ // console.warn("Img is: ");
+ // console.dir(img);
+ // console.warn("Strigularly, that's: ");
+ // console.log(img);
+ img.attr("src", datalist.image);
+ inner_div.append(img);
+ } else {
+ var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
+ }
+ left_pull.append(inner_div);
+ root_div.append(left_pull);
+ var name_div = $("<div>");
+ name_div.text(datalist.text);
+ root_div.append(name_div);
+ var safe_html = root_div.get(0).outerHTML;
+ var old_html = formatDatalist(datalist);
+ if (safe_html != old_html) {
+ //console.log("HTML MISMATCH: ");
+ //console.log("FormatDatalistSafe: ");
+ // console.dir(root_div.get(0));
+ //console.log(safe_html);
+ //console.log("FormatDataList: ");
+ //console.log(old_html);
+ }
+ return root_div;
+ }
+ function formatDataSelection(datalist) {
+ // This a heinous workaround for a known bug in Select2.
+ // Without this, the rich selectlists are vulnerable to XSS.
+ // Many thanks to @uberbrady for this fix. It ain't pretty,
+ // but it resolves the issue until Select2 addresses it on their end.
+ //
+ // Bug was reported in 2016 :{
+ // https://github.com/select2/select2/issues/4587
+
+ return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
+ }
+
+ // This handles the radio button selectors for the checkout-to-foo options
+ // on asset checkout and also on asset edit
+ $(function () {
+ $('input[name=checkout_to_type]').on("change", function () {
+ var assignto_type = $('input[name=checkout_to_type]:checked').val();
+ var userid = $('#assigned_user option:selected').val();
+ if (assignto_type == 'asset') {
+ $('#current_assets_box').fadeOut();
+ $('#assigned_asset').show();
+ $('#assigned_user').hide();
+ $('#assigned_location').hide();
+ $('.notification-callout').fadeOut();
+ $('[name="assigned_location"]').val('').trigger('change.select2');
+ $('[name="assigned_user"]').val('').trigger('change.select2');
+ } else if (assignto_type == 'location') {
+ $('#current_assets_box').fadeOut();
+ $('#assigned_asset').hide();
+ $('#assigned_user').hide();
+ $('#assigned_location').show();
+ $('.notification-callout').fadeOut();
+ $('[name="assigned_asset"]').val('').trigger('change.select2');
+ $('[name="assigned_user"]').val('').trigger('change.select2');
+ } else {
+ $('#assigned_asset').hide();
+ $('#assigned_user').show();
+ $('#assigned_location').hide();
+ if (userid) {
+ $('#current_assets_box').fadeIn();
+ }
+ $('.notification-callout').fadeIn();
+ $('[name="assigned_asset"]').val('').trigger('change.select2');
+ $('[name="assigned_location"]').val('').trigger('change.select2');
+ }
+ });
+ });
+
+ // ------------------------------------------------
+ // Deep linking for Bootstrap tabs
+ // ------------------------------------------------
+ var taburl = document.location.toString();
+
+ // Allow full page URL to activate a tab's ID
+ // ------------------------------------------------
+ // This allows linking to a tab on page load via the address bar.
+ // So a URL such as, http://snipe-it.local/hardware/2/#my_tab will
+ // cause the tab on that page with an ID of “my_tab” to be active.
+ if (taburl.match('#')) {
+ $('.nav-tabs a[href="#' + taburl.split('#')[1] + '"]').tab('show');
+ }
+
+ // Allow internal page links to activate a tab's ID.
+ // ------------------------------------------------
+ // This allows you to link to a tab from anywhere on the page
+ // including from within another tab. Also note that internal page
+ // links either inside or out of the tabs need to include data-toggle="tab"
+ // Ex: <a href="#my_tab" data-toggle="tab">Click me</a>
+ $('a[data-toggle="tab"]').click(function (e) {
+ var href = $(this).attr("href");
+ history.pushState(null, null, href);
+ e.preventDefault();
+ $('a[href="' + $(this).attr('href') + '"]').tab('show');
+ });
+
+ // ------------------------------------------------
+ // End Deep Linking for Bootstrap tabs
+ // ------------------------------------------------
+
+ // Image preview
+ function readURL(input, $preview) {
+ if (input.files && input.files[0]) {
+ var reader = new FileReader();
+ reader.onload = function (e) {
+ $preview.attr('src', e.target.result);
+ };
+ reader.readAsDataURL(input.files[0]);
+ }
+ }
+ function formatBytes(bytes) {
+ if (bytes < 1024) return bytes + " Bytes";else if (bytes < 1048576) return (bytes / 1024).toFixed(2) + " KB";else if (bytes < 1073741824) return (bytes / 1048576).toFixed(2) + " MB";else return (bytes / 1073741824).toFixed(2) + " GB";
+ }
+
+ // File size validation
+ $('.js-uploadFile').bind('change', function () {
+ var $this = $(this);
+ var id = '#' + $this.attr('id');
+ var status = id + '-status';
+ var $status = $(status);
+ var delete_id = $(id + '-deleteCheckbox');
+ var preview_container = $(id + '-previewContainer');
+ $status.removeClass('text-success').removeClass('text-danger');
+ $(status + ' .goodfile').remove();
+ $(status + ' .badfile').remove();
+ $(status + ' .previewSize').hide();
+ preview_container.hide();
+ $(id + '-info').html('');
+ var max_size = $this.data('maxsize');
+ var total_size = 0;
+ for (var i = 0; i < this.files.length; i++) {
+ total_size += this.files[i].size;
+ $(id + '-info').append('<span class="label label-default">' + htmlEntities(this.files[i].name) + ' (' + formatBytes(this.files[i].size) + ')</span> ');
+ }
+ if (total_size > max_size) {
+ $status.addClass('text-danger').removeClass('help-block').prepend('<i class="badfile fas fa-times"></i> ').append('<span class="previewSize"> Upload is ' + formatBytes(total_size) + '.</span>');
+ } else {
+ $status.addClass('text-success').removeClass('help-block').prepend('<i class="goodfile fas fa-check"></i> ');
+ var $preview = $(id + '-imagePreview');
+ readURL(this, $preview);
+ $preview.fadeIn();
+ preview_container.fadeIn();
+ delete_id.hide();
+ }
+ });
+});
+function htmlEntities(str) {
+ return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
+}
+
+/**
+ * Toggle disabled
+ */
+(function ($) {
+ $.fn.toggleDisabled = function (callback) {
+ return this.each(function () {
+ var disabled,
+ $this = $(this);
+ if ($this.attr('disabled')) {
+ $this.removeAttr('disabled');
+ disabled = false;
+ } else {
+ $this.attr('disabled', 'disabled');
+ disabled = true;
+ }
+ if (callback && typeof callback === 'function') {
+ callback(this, disabled);
+ }
});
+ };
+})(jQuery);
- LazyWrapper.prototype.compact = function() {
- return this.filter(identity);
- };
-
- LazyWrapper.prototype.find = function(predicate) {
- return this.filter(predicate).head();
- };
-
- LazyWrapper.prototype.findLast = function(predicate) {
- return this.reverse().find(predicate);
- };
-
- LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
- if (typeof path == 'function') {
- return new LazyWrapper(this);
- }
- return this.map(function(value) {
- return baseInvoke(value, path, args);
+/**
+ * Universal Livewire Select2 integration
+ *
+ * How to use:
+ *
+ * 1. Set the class of your select2 elements to 'livewire-select2').
+ * 2. Name your element to match a property in your Livewire component
+ * 3. Add an attribute called 'data-livewire-component' that points to $this->getId() (via `{{ }}` if you're in a blade,
+ * or just $this->getId() if not).
+ */
+document.addEventListener('livewire:init', function () {
+ $('.livewire-select2').select2();
+ $(document).on('select2:select', '.livewire-select2', function (event) {
+ var target = $(event.target);
+ if (!event.target.name || !target.data('livewire-component')) {
+ console.error("You need to set both name (which should match a Livewire property) and data-livewire-component on your Livewire-ed select2 elements!");
+ console.error("For data-livewire-component, you probably want to use $this->getId() or {{ $this->getId() }}, as appropriate");
+ return false;
+ }
+ Livewire.find(target.data('livewire-component')).set(event.target.name, this.options[this.selectedIndex].value);
+ });
+ Livewire.hook('request', function (_ref) {
+ var succeed = _ref.succeed;
+ succeed(function () {
+ queueMicrotask(function () {
+ $('.livewire-select2').select2();
});
});
+ });
+});
- LazyWrapper.prototype.reject = function(predicate) {
- return this.filter(negate(getIteratee(predicate)));
- };
+/***/ }),
- LazyWrapper.prototype.slice = function(start, end) {
- start = toInteger(start);
+/***/ "./resources/assets/js/snipeit_modals.js":
+/*!***********************************************!*\
+ !*** ./resources/assets/js/snipeit_modals.js ***!
+ \***********************************************/
+/***/ (() => {
- var result = this;
- if (result.__filtered__ && (start > 0 || end < 0)) {
- return new LazyWrapper(result);
- }
- if (start < 0) {
- result = result.takeRight(-start);
- } else if (start) {
- result = result.drop(start);
- }
- if (end !== undefined) {
- end = toInteger(end);
- result = end < 0 ? result.dropRight(-end) : result.take(end - start);
- }
- return result;
- };
+/*
+ *
+ * Snipe-IT Universal Modal support
+ *
+ * Enables modal dialogs to create sub-resources throughout Snipe-IT
+ *
+ */
- LazyWrapper.prototype.takeRightWhile = function(predicate) {
- return this.reverse().takeWhile(predicate).reverse();
- };
+/*
+HOW TO USE
+ Create a Button looking like this:
+ <a href='{{ route('modal.show', 'user') }}' data-toggle="modal" data-target="#createModal" data-select='assigned_to' class="btn btn-sm btn-primary">New</a>
+ If you don't have access to Blade commands (like {{ and }}, etc), you can hard-code a URL as the 'href'
+ data-toggle="modal" - required for Bootstrap Modals
+data-target="#createModal" - fixed ID for the modal, do not change
+data-select="assigned_to" - What is the *ID* of the select-dropdown that you're going to be adding to, if the modal-create was a success? Be on the lookout for duplicate ID's, it will confuse this library!
+class="btn btn-sm btn-primary" - makes it look button-ey, feel free to change :)
- LazyWrapper.prototype.toArray = function() {
- return this.take(MAX_ARRAY_LENGTH);
- };
+If you want to pass additional variables to the modal (In the Category Create one, for example, you can pass category_id), you can encode them as URL variables in the href
- // Add `LazyWrapper` methods to `lodash.prototype`.
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
- var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
- isTaker = /^(?:head|last)$/.test(methodName),
- lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
- retUnwrapped = isTaker || /^find/.test(methodName);
+*/
- if (!lodashFunc) {
- return;
- }
- lodash.prototype[methodName] = function() {
- var value = this.__wrapped__,
- args = isTaker ? [1] : arguments,
- isLazy = value instanceof LazyWrapper,
- iteratee = args[0],
- useLazy = isLazy || isArray(value);
+$(function () {
+ var baseUrl = $('meta[name="baseUrl"]').attr('content');
+ //handle modal-add-interstitial calls
+ var model, select, refreshSelector;
+ if ($('#createModal').length == 0) {
+ $('body').append('<div class="modal fade" id="createModal"></div><!-- /.modal -->');
+ }
+ $('#createModal').on("show.bs.modal", function (event) {
+ var link = $(event.relatedTarget);
+ model = link.data("dependency");
+ select = link.data("select");
+ refreshSelector = link.data("refresh");
+ $('#createModal').load(link.attr('href'), function () {
+ // this sets the focus to be the name field
+ $('#modal-name').focus();
- var interceptor = function(value) {
- var result = lodashFunc.apply(lodash, arrayPush([value], args));
- return (isTaker && chainAll) ? result[0] : result;
- };
+ //do we need to re-select2 this, after load? Probably.
+ $('#createModal').find('select.select2').select2();
+ // Initialize the ajaxy select2 with images.
+ // This is a copy/paste of the code from snipeit.js, would be great to only have this in one place.
- if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
- // Avoid lazy use if the iteratee has a "length" value other than `1`.
- isLazy = useLazy = false;
+ $('.js-data-ajax').each(function (i, item) {
+ var link = $(item);
+ var endpoint = link.data("endpoint");
+ var select = link.data("select");
+ link.select2({
+ ajax: {
+ // the baseUrl includes a trailing slash
+ url: baseUrl + 'api/v1/' + endpoint + '/selectlist',
+ //WARNING - we're hoping that's defined on the page somewhere...
+ dataType: 'json',
+ delay: 250,
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ data: function data(params) {
+ var data = {
+ search: params.term,
+ page: params.page || 1,
+ assetStatusType: link.data("asset-status-type")
+ };
+ return data;
+ },
+ /*processResults: function (data, params) {
+ params.page = params.page || 1;
+ var answer = {
+ results: data.items,
+ pagination: {
+ more: data.pagination.more
+ }
+ };
+ return answer;
+ },*/
+ cache: true
+ },
+ //escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
+ templateResult: formatDatalistSafe
+ //templateSelection: formatDataSelection
+ });
+ });
+ });
+ });
+ $('#createModal').on('click', '#modal-save', function () {
+ $.ajax({
+ type: 'POST',
+ url: $('.modal-body form').attr('action'),
+ headers: {
+ "X-Requested-With": 'XMLHttpRequest',
+ "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
+ },
+ data: $('.modal-body form').serialize(),
+ success: function success(result) {
+ if (result.status == "error") {
+ var error_message = "";
+ for (var field in result.messages) {
+ error_message += "<li>Problem(s) with field <i><strong>" + field + "</strong></i>: " + result.messages[field];
+ }
+ $('#modal_error_msg').html(error_message).show();
+ return false;
}
- var chainAll = this.__chain__,
- isHybrid = !!this.__actions__.length,
- isUnwrapped = retUnwrapped && !chainAll,
- onlyLazy = isLazy && !isHybrid;
-
- if (!retUnwrapped && useLazy) {
- value = onlyLazy ? value : new LazyWrapper(this);
- var result = func.apply(value, args);
- result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
- return new LodashWrapper(result, chainAll);
+ var id = result.payload.id;
+ var name = result.payload.name || result.payload.first_name + " " + result.payload.last_name;
+ if (!id || !name) {
+ console.error("Could not find resulting name or ID from modal-create. Name: " + name + ", id: " + id);
+ return false;
}
- if (isUnwrapped && onlyLazy) {
- return func.apply(this, args);
+ $('#createModal').modal('hide');
+ $('#createModal').html("");
+ var refreshTable = $('#' + refreshSelector);
+ if (refreshTable.length > 0) {
+ refreshTable.bootstrapTable('refresh');
}
- result = this.thru(interceptor);
- return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
- };
- });
-
- // Add `Array` methods to `lodash.prototype`.
- arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
- var func = arrayProto[methodName],
- chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
- retUnwrapped = /^(?:pop|shift)$/.test(methodName);
- lodash.prototype[methodName] = function() {
- var args = arguments;
- if (retUnwrapped && !this.__chain__) {
- var value = this.value();
- return func.apply(isArray(value) ? value : [], args);
+ // "select" is the original drop-down menu that someone
+ // clicked 'add' on to add a new 'thing'
+ // this code adds the newly created object to that select
+ var selector = document.getElementById(select);
+ if (!selector) {
+ return false;
}
- return this[chainName](function(value) {
- return func.apply(isArray(value) ? value : [], args);
- });
- };
- });
-
- // Map minified method names to their real names.
- baseForOwn(LazyWrapper.prototype, function(func, methodName) {
- var lodashFunc = lodash[methodName];
- if (lodashFunc) {
- var key = lodashFunc.name + '';
- if (!hasOwnProperty.call(realNames, key)) {
- realNames[key] = [];
+ selector.options[selector.length] = new Option(name, id);
+ selector.selectedIndex = selector.length - 1;
+ $(selector).trigger("change");
+ if (window.fetchCustomFields) {
+ fetchCustomFields();
}
- realNames[key].push({ 'name': methodName, 'func': lodashFunc });
+ },
+ error: function error(result) {
+ msg = result.responseJSON.messages || result.responseJSON.error;
+ $('#modal_error_msg').html("Server Error: " + msg).show();
}
});
+ });
+});
+function formatDatalistSafe(datalist) {
+ // console.warn("What in the hell is going on with Select2?!?!!?!?");
+ // console.warn($.select2);
+ if (datalist.loading) {
+ return $('<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...');
+ }
+ var root_div = $("<div class='clearfix'>");
+ var left_pull = $("<div class='pull-left' style='padding-right: 10px;'>");
+ if (datalist.image) {
+ var inner_div = $("<div style='width: 30px;'>");
+ /******************************************************************
+ *
+ * We are specifically chosing empty alt-text below, because this
+ * image conveys no additional information, relative to the text
+ * that will *always* be there in any select2 list that is in use
+ * in Snipe-IT. If that changes, we would probably want to change
+ * some signatures of some functions, but right now, we don't want
+ * screen readers to say "HP SuperJet 5000, .... picture of HP
+ * SuperJet 5000..." and so on, for every single row in a list of
+ * assets or models or whatever.
+ *
+ *******************************************************************/
+ var img = $("<img src='' style='max-height: 20px; max-width: 30px;' alt=''>");
+ // console.warn("Img is: ");
+ // console.dir(img);
+ // console.warn("Strigularly, that's: ");
+ // console.log(img);
+ img.attr("src", datalist.image);
+ inner_div.append(img);
+ } else {
+ var inner_div = $("<div style='height: 20px; width: 30px;'></div>");
+ }
+ left_pull.append(inner_div);
+ root_div.append(left_pull);
+ var name_div = $("<div>");
+ name_div.text(datalist.text);
+ root_div.append(name_div);
+ var safe_html = root_div.get(0).outerHTML;
+ var old_html = formatDatalist(datalist);
+ if (safe_html != old_html) {
+ // console.log("HTML MISMATCH: ");
+ // console.log("FormatDatalistSafe: ");
+ // console.dir(root_div.get(0));
+ // console.log(safe_html);
+ // console.log("FormatDataList: ");
+ // console.log(old_html);
+ }
+ return root_div;
+}
+function formatDatalist(datalist) {
+ var loading_markup = '<i class="fas fa-spinner fa-spin" aria-hidden="true"></i> Loading...';
+ if (datalist.loading) {
+ return loading_markup;
+ }
+ var markup = "<div class='clearfix'>";
+ markup += "<div class='pull-left' style='padding-right: 10px;'>";
+ if (datalist.image) {
+ markup += "<div style='width: 30px;'><img src='" + datalist.image + "' alt='" + datalist.tex + "' style='max-height: 20px; max-width: 30px;'></div>";
+ } else {
+ markup += "<div style='height: 20px; width: 30px;'></div>";
+ }
+ markup += "</div><div>" + datalist.text + "</div>";
+ markup += "</div>";
+ return markup;
+}
+function formatDataSelection(datalist) {
+ return datalist.text.replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
+}
- realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
- 'name': 'wrapper',
- 'func': undefined
- }];
+/***/ }),
- // Add methods to `LazyWrapper`.
- LazyWrapper.prototype.clone = lazyClone;
- LazyWrapper.prototype.reverse = lazyReverse;
- LazyWrapper.prototype.value = lazyValue;
+/***/ "./resources/assets/less/app.less":
+/*!****************************************!*\
+ !*** ./resources/assets/less/app.less ***!
+ \****************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- // Add chain sequence methods to the `lodash` wrapper.
- lodash.prototype.at = wrapperAt;
- lodash.prototype.chain = wrapperChain;
- lodash.prototype.commit = wrapperCommit;
- lodash.prototype.next = wrapperNext;
- lodash.prototype.plant = wrapperPlant;
- lodash.prototype.reverse = wrapperReverse;
- lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
- // Add lazy aliases.
- lodash.prototype.first = lodash.prototype.head;
- if (symIterator) {
- lodash.prototype[symIterator] = wrapperToIterator;
- }
- return lodash;
- });
+/***/ }),
- /*--------------------------------------------------------------------------*/
+/***/ "./resources/assets/less/overrides.less":
+/*!**********************************************!*\
+ !*** ./resources/assets/less/overrides.less ***!
+ \**********************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- // Export lodash.
- var _ = runInContext();
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
- // Some AMD build optimizers, like r.js, check for condition patterns like:
- if (true) {
- // Expose Lodash on the global object to prevent errors when Lodash is
- // loaded by a script tag in the presence of an AMD loader.
- // See http://requirejs.org/docs/errors.html#mismatch for more details.
- // Use `_.noConflict` to remove Lodash from the global object.
- root._ = _;
- // Define as an anonymous module so, through path mapping, it can be
- // referenced as the "underscore" module.
- !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
- return _;
- }).call(exports, __webpack_require__, exports, module),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- }
- // Check for `exports` after `define` in case a build optimizer adds it.
- else {}
-}.call(this));
+/***/ }),
+
+/***/ "./resources/assets/less/skins/_all-skins.less":
+/*!*****************************************************!*\
+ !*** ./resources/assets/less/skins/_all-skins.less ***!
+ \*****************************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
+
+
+/***/ }),
+
+/***/ "./resources/assets/less/skins/skin-black-dark.less":
+/*!**********************************************************!*\
+ !*** ./resources/assets/less/skins/skin-black-dark.less ***!
+ \**********************************************************/
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+// extracted by mini-css-extract-plugin
/***/ }),
@@ -92030,71 +92095,6 @@ __webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
-/***/ }),
-
-/***/ "./node_modules/admin-lte/build/less/AdminLTE.less":
-/*!*********************************************************!*\
- !*** ./node_modules/admin-lte/build/less/AdminLTE.less ***!
- \*********************************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/app.less":
-/*!****************************************!*\
- !*** ./resources/assets/less/app.less ***!
- \****************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/overrides.less":
-/*!**********************************************!*\
- !*** ./resources/assets/less/overrides.less ***!
- \**********************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/skins/_all-skins.less":
-/*!*****************************************************!*\
- !*** ./resources/assets/less/skins/_all-skins.less ***!
- \*****************************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
-/***/ }),
-
-/***/ "./resources/assets/less/skins/skin-black-dark.less":
-/*!**********************************************************!*\
- !*** ./resources/assets/less/skins/skin-black-dark.less ***!
- \**********************************************************/
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-// extracted by mini-css-extract-plugin
-
-
/***/ })
/******/ });
diff --git a/public/mix-manifest.json b/public/mix-manifest.json
index 84f3b91e8d..8b34c64378 100644
--- a/public/mix-manifest.json
+++ b/public/mix-manifest.json
@@ -1,9 +1,9 @@
{
- "/js/build/app.js": "/js/build/app.js?id=65d7af7b9fa7fd0e05737526a0d1d282",
+ "/js/build/app.js": "/js/build/app.js?id=607de09b70b83ef82a427e4b36341682",
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=06c13e817cc022028b3f4a33c0ca303a",
"/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=79aa889a1a6691013be6c342ca7391cd",
- "/css/build/overrides.css": "/css/build/overrides.css?id=6528155ed5ed8fddf4047de7f0d0298d",
- "/css/build/app.css": "/css/build/app.css?id=3422f2ca2056b952c3c361adf00c10b8",
+ "/css/build/overrides.css": "/css/build/overrides.css?id=f188c07f91348503bc38f4b6683993aa",
+ "/css/build/app.css": "/css/build/app.css?id=7f6827b6d2149b8eab327d00e2dd66f0",
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=4ea0068716c1bb2434d87a16d51b98c9",
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=7b315b9612b8fde8f9c5b0ddb6bba690",
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=ea22079836a432d7f46a5d390c445e13",
@@ -19,7 +19,7 @@
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=a82b065847bf3cd5d713c04ee8dc86c6",
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=6ea836d8126de101081c49abbdb89417",
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=76482123f6c70e866d6b971ba91de7bb",
- "/css/dist/all.css": "/css/dist/all.css?id=18ebb9c284b49dcf6c8e4fdb923ad923",
+ "/css/dist/all.css": "/css/dist/all.css?id=fe65a4b6cd3acaf2737dec72b98b650b",
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",
@@ -111,5 +111,5 @@
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=ceded08e0cc745a83c13647035b03406",
"/js/build/vendor.js": "/js/build/vendor.js?id=89dffa552c6e3abe3a2aac6c9c7b466b",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=61285c8ac5ea7b46002ea8c451c94e60",
- "/js/dist/all.js": "/js/dist/all.js?id=21e041dec60e0785db6d64961b13a9b0"
+ "/js/dist/all.js": "/js/dist/all.js?id=cae553daff19b328b3ba51a62f891442"
}
diff --git a/resources/assets/less/overrides.less b/resources/assets/less/overrides.less
index 67ee7030e1..bbbb74ec88 100644
--- a/resources/assets/less/overrides.less
+++ b/resources/assets/less/overrides.less
@@ -1163,4 +1163,15 @@ input[type="radio"]:checked::before {
/** this is needed to override ekko-lightboxes card view styles **/
.bootstrap-table .fixed-table-container .table tbody tr .card-view {
display: table-row !important;
-}
\ No newline at end of file
+}
+
+td.text-right.text-padding-number-cell {
+ padding-right: 30px !important;
+ white-space: nowrap;
+}
+
+th.text-right.text-padding-number-footer-cell {
+ padding-right: 20px !important;
+ white-space: nowrap;
+}
+
diff --git a/resources/views/accessories/index.blade.php b/resources/views/accessories/index.blade.php
index a3ea41db27..1c82d782fa 100755
--- a/resources/views/accessories/index.blade.php
+++ b/resources/views/accessories/index.blade.php
@@ -34,6 +34,7 @@
data-show-refresh="true"
data-show-footer="true"
data-sort-order="asc"
+ data-footer-style="footerStyle"
id="accessoriesTable"
class="table table-striped snipe-table"
data-url="{{route('api.accessories.index') }}"
diff --git a/resources/views/components/index.blade.php b/resources/views/components/index.blade.php
index 418852095b..34f4c9babb 100644
--- a/resources/views/components/index.blade.php
+++ b/resources/views/components/index.blade.php
@@ -25,6 +25,7 @@
data-id-table="componentsTable"
data-search="true"
data-side-pagination="server"
+ data-footer-style="footerStyle"
data-show-columns="true"
data-show-fullscreen="true"
data-show-export="true"
diff --git a/resources/views/consumables/index.blade.php b/resources/views/consumables/index.blade.php
index e2235e86e3..08582e557c 100644
--- a/resources/views/consumables/index.blade.php
+++ b/resources/views/consumables/index.blade.php
@@ -27,6 +27,7 @@
data-id-table="consumablesTable"
data-search="true"
data-side-pagination="server"
+ data-footer-style="footerStyle"
data-show-columns="true"
data-show-export="true"
data-show-fullscreen="true"
diff --git a/resources/views/licenses/index.blade.php b/resources/views/licenses/index.blade.php
index 82e34b1909..94d94d1d45 100755
--- a/resources/views/licenses/index.blade.php
+++ b/resources/views/licenses/index.blade.php
@@ -33,6 +33,7 @@
data-pagination="true"
data-search="true"
data-side-pagination="server"
+ data-footer-style="footerStyle"
data-show-columns="true"
data-show-fullscreen="true"
data-show-export="true"
diff --git a/resources/views/models/index.blade.php b/resources/views/models/index.blade.php
index 6f3f5e78df..5ae3fb9450 100755
--- a/resources/views/models/index.blade.php
+++ b/resources/views/models/index.blade.php
@@ -45,6 +45,7 @@
data-search="true"
data-show-footer="true"
data-side-pagination="server"
+ data-footer-style="footerStyle"
data-show-columns="true"
data-toolbar="#modelsBulkEditToolbar"
data-bulk-button-id="#bulkModelsEditButton"
diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php
index 2da7b63b1d..b9e02bbbda 100644
--- a/resources/views/partials/bootstrap-table.blade.php
+++ b/resources/views/partials/bootstrap-table.blade.php
@@ -13,6 +13,7 @@
<script nonce="{{ csrf_token() }}">
$(function () {
+
var blockedFields = "searchable,sortable,switchable,title,visible,formatter,class".split(",");
var keyBlocked = function(key) {
@@ -241,7 +242,35 @@
});
-
+
+ // This specifies the footer columns that should have special styles associated
+ // (usually numbers)
+ window.footerStyle = column => ({
+ remaining: {
+ classes: 'text-padding-number-footer-cell'
+ },
+ qty: {
+ classes: 'text-padding-number-footer-cell',
+ },
+ purchase_cost: {
+ classes: 'text-padding-number-footer-cell'
+ },
+ checkouts_count: {
+ classes: 'text-padding-number-footer-cell'
+ },
+ assets_count: {
+ classes: 'text-padding-number-footer-cell'
+ },
+ seats: {
+ classes: 'text-padding-number-footer-cell'
+ },
+ free_seats_count: {
+ classes: 'text-padding-number-footer-cell'
+ },
+ }[column.field]);
+
+
+
// This only works for model index pages because it uses the row's model ID
function genericRowLinkFormatter(destination) {
@@ -673,6 +702,7 @@
return '--';
}
+
// Create a linked phone number in the table list
function phoneFormatter(value) {