ow.matchMedia("(max-width: 767px)").matches) { $('#bookingBox').animate({ scrollTop: $('#booking_summary').offset().top }, 'slow'); } }); $('.ui-datepicker-div-in-menu').removeClass('ui-datepicker-div-in-menu'); $('#ui-datepicker-div').on('mouseenter', 'td', highlightBookingDates); $('.booking-tabs button[ data-tab-id="datepicker_booking_start"]').on('click', function() { $(this).siblings().removeClass( 'active' ); $(this).addClass( 'active' ); $pickerStart.datepicker('show'); }); $('.booking-tabs button[ data-tab-id="datepicker_booking_end"]').on('click', function() { $(this).siblings().removeClass( 'active' ); $(this).addClass( 'active' ); $pickerEnd.datepicker('show'); }); $('.form-quantity').each(function() { let $spinner = $(this); let $input = $spinner.find('input[type="number"]'); let $btnPlus = $spinner.find('.quantity-plus'); let $btnMinus = $spinner.find('.quantity-minus'); let min = +($input.attr('min') || 0); let max = +($input.attr('max') || 999); $spinner.on('click', '.quantity-plus, .quantity-minus', function(e) { let val = parseFloat($input.val()); if(e.currentTarget.classList.contains('quantity-plus')) { val++; } else { val--; } val = Math.min(Math.max(val, min), max); val === min ? $btnMinus.addClass('disabled') : $btnMinus.removeClass('disabled'); val === max ? $btnPlus.addClass('disabled') : $btnPlus.removeClass('disabled'); $input.val(val); updateDateCosts(); }); }); $qty.on('input', updateBookingOverview); $('input[type="number"][data-cost]', $MODAL).on('input', function() { updateExtrasCosts(); updateBookingOverview(); }); $form.on('submit', function(e) { e.preventDefault(); var $this = $(this); $this.addClass('ajax-form-loading'); var url = new URL(ROOT_URL); url.pathname = '/booking'; url.searchParams.append('edit_item_url', window.location.href.split('?')[0]); var editItemId = $('input[name="edit_item_id"]').val(); if(editItemId) { url.searchParams.append('edit_item_id', editItemId); } url.searchParams.append('prod_code', product.prod_code); url.searchParams.append('sku', product.sku); $.ajax({ type: $this.attr('method'), url: url, method: 'POST', data: $this.serialize(), xhrFields: { withCredentials: true }, success: function(response) { $this.removeClass('ajax-form-loading'); var $errorDisplay = $('#booking_errors'); $errorDisplay.addClass('d-none'); if(response.success) { $form.trigger('booking:basket-add', [getSelectedItems()]); } if(!response.success) { $errorDisplay.removeClass('d-none'); let error = response.errors ? response.errors.join('
') : DEFAULT_ERROR_MSG; $errorDisplay.text(error); } if(response.redirect) { setTimeout(function() { window.location.href = ROOT_URL + response.redirect; }, booking.redirectDelay) } } }); }); function getSelectedItems() { let items = [{ 'item_id': product.sku, 'item_name': product.name, 'price': product.bookedCost, 'quantity': +$qty.val() }] $('input[name^="extras"]').each(function(i, elem) { let qty = elem.type === 'checkbox' ? 1 : +elem.value; if(qty <= 0 || isNaN(qty)) return; let price = +elem.getAttribute('data-cost') * qty; if(elem.getAttribute('data-is-hired')) { price *= Math.ceil(getBookingDaysLength()/7); } items.push({ 'item_id': '', 'item_name': elem.getAttribute('data-name'), 'price': price, 'quantity': qty }); }); return items; } function openBookingBox() { $('#bookingBox').addClass('show'); $overlay.show(); // Only initialise the datepicker once if(!$('.ui-datepicker-div-in-menu').length) { $('#bookingBox .booking-calendar').append($('#ui-datepicker-div').addClass('ui-datepicker-div-in-menu')); $pickerStart.datepicker('show'); } } function closeBookingBox() { $overlay.hide(); $('#bookingBox').removeClass('show'); $('html, body').removeClass('is-reveal-open'); } function validateBookingDates() { if($pickerStart.attr('disabled') || $pickerEnd.attr('disabled')) { return false; } var startDate = $pickerStart.datepicker('getDate'); var endDate = $pickerEnd.datepicker('getDate'); var minimumEndDate = startDate; var daysAdjusted = 0; while(!isValidEndDate(minimumEndDate)[0] && daysAdjusted <= MAXIMUM_END_DATE_ADJUSTMENT) { minimumEndDate = new Date(minimumEndDate.getTime() + (24 * 60 * 60 * 1000)); daysAdjusted++; } if(startDate === null) { return; } $pickerEnd.datepicker('option', 'minDate', minimumEndDate); if(endDate === null) { return; } if(!isValidEndDate(endDate)[0] || !isValidEndDate(minimumEndDate)[0]) { // Validation has pushed the end date out of scope, reset it so the user can pick again $pickerEnd.datepicker('setDate', null); } $pickerEnd.datepicker('option', 'minDate', minimumEndDate); updateBookingOverview(); } /** * Per jQuery datepicker documentation: * A function that takes a date as a parameter and must return an array with: * [0]: true/false indicating whether or not this date is selectable * [1]: a CSS class name to add to the date's cell or "" for the default presentation * [2]: an optional popup tooltip for this date * The function is called for each day in the datepicker before it is displayed. */ function isValidEndDate(date) { var dateString = $.datepicker.formatDate('yy-mm-dd', date); var selectable = !!(dateCosts[dateString] && dateCosts[dateString]['cost']); var classes = ''; var startDate = $pickerStart.datepicker('getDate'); var endDate = $pickerEnd.datepicker('getDate'); if(date.toString() === startDate.toString()) { classes += ' datepicker-start-date'; } else if(date > startDate && date < endDate) { classes += ' datepicker-date-range'; } return [ selectable, classes, null ]; } /** * Validator for jQuery datepicker * @param date The date to be tested * @returns array [ * boolean , * string, * null * ] * */ function isValidStartDate(date) { var dateString = $.datepicker.formatDate('yy-mm-dd', date); // IE doesn't support array.includes() var selectable = VALID_START_DATES.indexOf(dateString) !== -1; return [ selectable, "", null ]; } function updateDateCosts(cb) { var data = { 'start_date': $.datepicker.formatDate(DATEPICKER_DEFAULTS.dateFormat, $pickerStart.datepicker('getDate')), 'booking_quantity': $qty.val(), 'json': true }; var editItemId = $('input[name="edit_item_id"]').val(); if(editItemId) { data['edit_item_id'] = editItemId } else { data['prod_code'] = product.prod_code; data['sku'] = product.sku } $.ajax({ url: ROOT_URL + '/booking/', datatype: 'jsonp', data: data, xhrFields: { withCredentials: true }, success: function(data) { if(typeof data === 'string') { data = JSON.parse(data); } if(data.success === true && data.costs) { for(var date in data.costs) { if(data.costs[date].cost > 0) { dateCosts = data.costs } } } if(!dateCosts) { showBookingError(); $pickerStart.attr('disabled', true); $pickerEnd.attr('disabled', true); } validateBookingDates(); if(cb && typeof cb === 'function') { cb(); } } }); } function showBookingError(text) { text = text || "Sorry, an unknown problem has been encountered. Please refresh the page and try again. If the problem persists, please contact us."; $('#booking_errors').text(text).removeClass('d-none'); } function getBookingDaysLength() { var startDate = $pickerStart.datepicker('getDate'); var endDate = $pickerEnd.datepicker('getDate'); if(!startDate || !endDate) { return null; } return Math.round((+endDate - +startDate) / 86400000); } function updateExtrasCosts() { $('input[data-cost]').each(function(i, elem) { var $elem = $(elem); var $priceDisplay = $('.price-display-variable[data-for="'+$elem.attr('name')+'"]'); var price = $elem.data('cost')*$elem.val(); if($elem.data('is-hired')) { price *= Math.ceil(getBookingDaysLength()/7); } $priceDisplay.text(CURRENCY + price.toFixed(2)); }); } function updateBookingOverview() { const $extendedSamedayAlert = $('#extended_sameday_alert'); const now = new Date(); var $saturdayAlert = $('#saturday_sameday_alert'); $extendedSamedayAlert.addClass('d-none'); $saturdayAlert.addClass('d-none'); updateExtrasCosts(); var days = getBookingDaysLength(); if(days === null) { $bookingSummary.addClass('d-none'); $bookingCost.text(CURRENCY + '0.00'); $numDays.text(''); return; } var startDate = $pickerStart.datepicker('getDate'); var endDate = $pickerEnd.datepicker('getDate'); var endDateString = $.datepicker.formatDate('yy-mm-dd', endDate); var cost = dateCosts[endDateString].cost*$qty.val(); const isSameDay = $.datepicker.formatDate('y-m-d', now) === $.datepicker.formatDate('y-m-d', startDate); product.bookedCost = +cost.toFixed(2); $bookingCost.text(CURRENCY + cost.toFixed(2)); // Just for display purposes days++; if(isSameDay && now.toLocaleTimeString('en-GB') >= DELIVERY_CUTOFF) { $extendedSamedayAlert.removeClass('d-none'); } if(days === 0) { days = '< 1 day'; if(startDate.getDay() === 6) { $saturdayAlert.removeClass('d-none'); } } else if(days === 1) { days += ' day'; } else { days += ' days'; } $numDays.html($qty.val() + 'x ' + product.name); $bookingTotal.text(CURRENCY + getTotalCost().toFixed(2)); $('.booking-stage-2', $MODAL).removeClass('d-none'); } function getTotalCost() { var cost = 0; for(var i=0; i<$priceSubTotals.length; i++) { var subTotal = +$($priceSubTotals[i]).text().replace(CURRENCY, ''); if(!isNaN(subTotal)) { cost += subTotal; } } $('input[type="checkbox"][data-cost]').each(function(i, elem) { let subtotal = +elem.getAttribute('data-cost'); if(elem.getAttribute('data-is-hired')) { subtotal *= Math.ceil(getBookingDaysLength()/7); } cost += subtotal; }); return cost; } function highlightBookingDates() { var $td = $(this); var $wrapper = $td.parents('#ui-datepicker-div'); var highlightClass = 'datepicker-date-range'; // Only highlight a trail of dates if this is the picker for booking_end_date and there isn't a date already selected if($('.booking-tabs button.active').attr('data-tab-id') !== $pickerEnd.attr('id') || $pickerEnd.datepicker('getDate')) { return; } $wrapper.find('.'+highlightClass).removeClass(highlightClass); $td.parent().prevAll().find('td:not(.ui-datepicker-current-day)').addClass(highlightClass); $td.prevAll().filter('td:not(.ui-datepicker-current-day)').addClass(highlightClass); let $start = $wrapper.find('.datepicker-start-date'); $start.prevAll().removeClass(highlightClass); $start.parent().prevAll().find('td').removeClass(highlightClass); } $('.extras-tooltip').on('click', function() { $(this).tooltip({ items: ".extras-tooltip", content: function () { return $(this).prop('title'); } }); $(this).tooltip("open"); }); $('.extras-tooltip').on('mouseout', function() { $(this).tooltip("destroy"); }); })();

From 1st April 2022, our suppliers will only fuel machines with white diesel. This is due to new government guidelines.

If you, as the hirer, refuel any equipment while it is in your possession, it must be with WHITE DIESEL.

YOU MUST NOT USE RED DIESEL IN HIRED MACHINES OR EQUIPMENT.

If you return a machine refuelled with rebated diesel, suppliers will have to remove and dispose of the fuel. They must also flush the tank and supply lines before they can refuel them. The process is chargeable, with no exceptions.

An insurance charge will be calculated at checkout. If you have proof of your own Hired-In Plant Insurance (HIPI) and wish to opt-out of the insurance charge, you can do so by booking via Live Chat.

×
PayPal Pay-in-3

PAYPAL PAY IN 3

Spread the cost of essential tool hire

When an unexpected expense crops up and you need to get hold of different equipment, the costs involved can become a struggle. National Tool Hire don't think that anyone should have to wait when essential work and building improvements are needed, or when there's a passion project that needs indulgence.

To help our customers and make tool hire even easier, we've worked with PayPal to provide a way to spread the cost with PayPal Pay in 3. You can use Pay in 3 for eligible shopping cart amounts between £30.00 to £2,000.00. Terms apply.

";s:8:"ls-cache";i:1763551519;s:6:"ls-ttl";i:1800;}
Payment Options
Range & Availability
Why Hire From Us?

-->


Trade Account Application

The simple and efficient way of managing your tool and plant hire spend with discounted hire rates. No matter what the job, a trade account makes managing your cash flow a whole lot easier.

Contact Us

Ask a question, request a call back or leave feedback.