[NEW] Addons creation - product_rental_bookings
This commit is contained in:
4
product_rental_bookings/static/src/css/backend.css
Executable file
4
product_rental_bookings/static/src/css/backend.css
Executable file
@@ -0,0 +1,4 @@
|
||||
.model-body-sign .canvas-container{
|
||||
border: 2px dotted #999999;
|
||||
margin: 0 auto;
|
||||
}
|
1403
product_rental_bookings/static/src/css/fullcalendar.css
Executable file
1403
product_rental_bookings/static/src/css/fullcalendar.css
Executable file
File diff suppressed because it is too large
Load Diff
463
product_rental_bookings/static/src/css/scheduler.css
Executable file
463
product_rental_bookings/static/src/css/scheduler.css
Executable file
@@ -0,0 +1,463 @@
|
||||
/*!
|
||||
* FullCalendar Scheduler v1.9.4
|
||||
* Docs & License: https://fullcalendar.io/scheduler/
|
||||
* (c) 2018 Adam Shaw
|
||||
*/
|
||||
/* TODO: break this file up */
|
||||
/* Scroller
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-scroller-clip {
|
||||
overflow: hidden;
|
||||
/* for clipping scrollbars */
|
||||
position: relative;
|
||||
/* so things like scrollfollowers can attach to this */ }
|
||||
|
||||
/* supresses rendering of native scrollbars */
|
||||
/* on .fc-scroller */
|
||||
.fc-no-scrollbars {
|
||||
background: rgba(255, 255, 255, 0);
|
||||
/* hack for dynamic DOM nodes (in Chrome OSX at least) */ }
|
||||
|
||||
.fc-no-scrollbars::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0; }
|
||||
|
||||
.fc-scroller-canvas {
|
||||
position: relative;
|
||||
/* origin for bg */
|
||||
box-sizing: border-box;
|
||||
/* so that padding (for gutter) will be part of height */
|
||||
min-height: 100%; }
|
||||
|
||||
.fc-scroller-canvas > .fc-bg {
|
||||
z-index: 1;
|
||||
/* make default? */ }
|
||||
|
||||
.fc-scroller-canvas > .fc-content {
|
||||
z-index: 2;
|
||||
/* make default? */
|
||||
position: relative;
|
||||
/* origin for inner content */
|
||||
border-style: solid;
|
||||
border-width: 0; }
|
||||
|
||||
/* for themed, hard to get the border-color, so just forget it (REVISIT) */
|
||||
.ui-widget .fc-scroller-canvas > .fc-content {
|
||||
border-color: transparent; }
|
||||
|
||||
.fc-scroller-canvas.fc-gutter-left > .fc-content {
|
||||
border-left-width: 1px;
|
||||
margin-left: -1px; }
|
||||
|
||||
.fc-scroller-canvas.fc-gutter-right > .fc-content {
|
||||
border-right-width: 1px;
|
||||
margin-right: -1px; }
|
||||
|
||||
.fc-scroller-canvas.fc-gutter-top > .fc-content {
|
||||
border-top-width: 1px;
|
||||
margin-top: -1px; }
|
||||
|
||||
/* content is responsible for bottom border */
|
||||
/* View Structure
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-rtl .fc-timeline {
|
||||
direction: rtl; }
|
||||
|
||||
.fc-timeline .fc-divider {
|
||||
width: 3px;
|
||||
border-style: double;
|
||||
/* overcome neighboring borders */ }
|
||||
|
||||
.fc-timeline .fc-head > tr > .fc-divider {
|
||||
border-bottom: 0; }
|
||||
|
||||
.fc-timeline .fc-body > tr > .fc-divider {
|
||||
border-top: 0; }
|
||||
|
||||
.fc-timeline .fc-body .fc-divider.ui-widget-header {
|
||||
background-image: none; }
|
||||
|
||||
.fc-scrolled .fc-head .fc-scroller {
|
||||
z-index: 2;
|
||||
/* so drop shadow will go above body panes */ }
|
||||
|
||||
.fc-timeline.fc-scrolled .fc-head .fc-scroller {
|
||||
box-shadow: 0 3px 4px rgba(0, 0, 0, 0.075); }
|
||||
|
||||
.fc-timeline .fc-body .fc-scroller {
|
||||
z-index: 1; }
|
||||
|
||||
/*
|
||||
on most tables that expand to the edges, kill the outer border,
|
||||
because the container elements take care of it.
|
||||
example tables:
|
||||
.fc-scroller-canvas .fc-content table
|
||||
.fc-scroller-canvas .fc-bg .fc-slats table
|
||||
*/
|
||||
.fc-timeline .fc-scroller-canvas > div > table,
|
||||
.fc-timeline .fc-scroller-canvas > div > div > table {
|
||||
border-style: hidden; }
|
||||
|
||||
/*
|
||||
for resource rows (in both the spreadsheet and timeline areas),
|
||||
undo previous rule in order to always show last border.
|
||||
*/
|
||||
.fc-timeline .fc-scroller-canvas > .fc-content > .fc-rows > table {
|
||||
border-bottom-style: none; }
|
||||
|
||||
/* Table Cell Common
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-timeline th,
|
||||
.fc-timeline td {
|
||||
white-space: nowrap; }
|
||||
|
||||
.fc-timeline .fc-cell-content {
|
||||
overflow: hidden; }
|
||||
|
||||
.fc-timeline .fc-cell-text {
|
||||
padding-left: 4px;
|
||||
padding-right: 4px; }
|
||||
|
||||
.fc-timeline .fc-col-resizer {
|
||||
cursor: col-resize; }
|
||||
|
||||
/*
|
||||
Cells at the start of a week
|
||||
TODO: figure out better styling
|
||||
|
||||
.fc-ltr .fc-timeline .fc-em-cell div {
|
||||
border-left: 3px solid #eee;
|
||||
height: 100%;
|
||||
}
|
||||
.fc-rtl .fc-timeline .fc-em-cell {
|
||||
border-right-width: 3px;
|
||||
}
|
||||
*/
|
||||
/* head */
|
||||
.fc-timeline th {
|
||||
vertical-align: middle; }
|
||||
|
||||
.fc-timeline .fc-head .fc-cell-content {
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px; }
|
||||
|
||||
/* body */
|
||||
.fc-timeline .fc-body .ui-widget-content {
|
||||
background-image: none; }
|
||||
|
||||
/* Resource Area
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-resource-area {
|
||||
width: 30%; }
|
||||
|
||||
.fc-resource-area col {
|
||||
width: 40%;
|
||||
min-width: 70px;
|
||||
/* will be read by JS */ }
|
||||
|
||||
.fc-resource-area col.fc-main-col {
|
||||
width: 60%;
|
||||
/* make the first column in a nested setup bigger */ }
|
||||
|
||||
.fc-flat .fc-expander-space {
|
||||
/* fc-flat is opposite of fc-nested */
|
||||
display: none; }
|
||||
|
||||
.fc-ltr .fc-resource-area tr > * {
|
||||
text-align: left; }
|
||||
|
||||
.fc-rtl .fc-resource-area tr > * {
|
||||
text-align: right; }
|
||||
|
||||
.fc-resource-area .fc-cell-content {
|
||||
padding-left: 4px;
|
||||
padding-right: 4px; }
|
||||
|
||||
/* head */
|
||||
.fc-resource-area .fc-super th {
|
||||
text-align: center; }
|
||||
|
||||
.fc-resource-area th > div {
|
||||
position: relative; }
|
||||
|
||||
.fc-resource-area th .fc-cell-content {
|
||||
position: relative;
|
||||
z-index: 1; }
|
||||
|
||||
.fc-resource-area th .fc-col-resizer {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 5px; }
|
||||
|
||||
.fc-ltr .fc-resource-area th .fc-col-resizer {
|
||||
right: -3px; }
|
||||
|
||||
.fc-rtl .fc-resource-area th .fc-col-resizer {
|
||||
left: -3px; }
|
||||
|
||||
/* body */
|
||||
tr.fc-collapsed > td,
|
||||
tr.fc-transitioning > td {
|
||||
/* during the transition */
|
||||
overflow: hidden;
|
||||
/* prevents absolutely-positioned events from bleeding out */ }
|
||||
|
||||
tr.fc-transitioning > td > div {
|
||||
transition: margin-top 0.2s; }
|
||||
|
||||
tr.fc-collapsed > td > div {
|
||||
margin-top: -10px; }
|
||||
|
||||
.fc-body .fc-resource-area .fc-cell-content {
|
||||
/* might BE the cell */
|
||||
position: relative;
|
||||
/* optimization for ScrollFollower */
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px; }
|
||||
|
||||
.fc-no-overlap .fc-body .fc-resource-area .fc-cell-content {
|
||||
/* might BE the cell */
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px; }
|
||||
|
||||
.fc-resource-area .fc-icon {
|
||||
/* the expander and spacers before the expander */
|
||||
width: 1em;
|
||||
/* ensure constant width, esp for empty icons */
|
||||
font-size: .9em;
|
||||
vertical-align: middle;
|
||||
margin-top: -1%; }
|
||||
|
||||
.fc-resource-area .fc-expander {
|
||||
cursor: pointer;
|
||||
color: #666;
|
||||
/* for the icon within */ }
|
||||
|
||||
/* Time Area
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-time-area col {
|
||||
min-width: 2.2em;
|
||||
/* detected by JS */ }
|
||||
|
||||
/* head */
|
||||
.fc-ltr .fc-time-area .fc-chrono th {
|
||||
text-align: left; }
|
||||
|
||||
.fc-rtl .fc-time-area .fc-chrono th {
|
||||
text-align: right; }
|
||||
|
||||
/* body slats (vertical lines) */
|
||||
.fc-time-area .fc-slats {
|
||||
/* fc-bg is responsible for a lot of this now! */
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0; }
|
||||
|
||||
.fc-time-area .fc-slats table {
|
||||
height: 100%; }
|
||||
|
||||
.fc-time-area .fc-slats .fc-minor {
|
||||
border-style: dotted; }
|
||||
|
||||
.fc-time-area .fc-slats td {
|
||||
border-width: 0 1px;
|
||||
/* need to do this. sometimes -1 margin wouldn't hide the dotted */ }
|
||||
|
||||
.fc-ltr .fc-time-area .fc-slats td {
|
||||
border-right-width: 0; }
|
||||
|
||||
.fc-rtl .fc-time-area .fc-slats td {
|
||||
border-left-width: 0; }
|
||||
|
||||
/* body content containers
|
||||
can be within rows or directly within the pane's content
|
||||
*/
|
||||
.fc-time-area .fc-bgevent-container,
|
||||
.fc-time-area .fc-highlight-container {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
/* only for directly within pane. not for row. overridden later */
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 0; }
|
||||
|
||||
.fc-ltr .fc-time-area .fc-helper-container,
|
||||
.fc-ltr .fc-time-area .fc-bgevent-container,
|
||||
.fc-ltr .fc-time-area .fc-highlight-container {
|
||||
left: 0; }
|
||||
|
||||
.fc-rtl .fc-time-area .fc-helper-container,
|
||||
.fc-rtl .fc-time-area .fc-bgevent-container,
|
||||
.fc-rtl .fc-time-area .fc-highlight-container {
|
||||
right: 0; }
|
||||
|
||||
.fc-time-area .fc-bgevent,
|
||||
.fc-time-area .fc-highlight {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0; }
|
||||
|
||||
/* body resource rows */
|
||||
.fc-time-area .fc-rows {
|
||||
position: relative;
|
||||
z-index: 3; }
|
||||
|
||||
.fc-time-area .fc-rows .ui-widget-content {
|
||||
background: none; }
|
||||
|
||||
.fc-time-area .fc-rows td > div {
|
||||
position: relative; }
|
||||
|
||||
.fc-time-area .fc-rows .fc-bgevent-container,
|
||||
.fc-time-area .fc-rows .fc-highlight-container {
|
||||
z-index: 1; }
|
||||
|
||||
.fc-time-area .fc-event-container {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
/* above bgevent and highlight */
|
||||
width: 0;
|
||||
/* for event positioning. will end up on correct side based on dir */ }
|
||||
|
||||
.fc-time-area .fc-helper-container {
|
||||
/* also an fc-event-container */
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
top: 0; }
|
||||
|
||||
.fc-time-area .fc-event-container {
|
||||
padding-bottom: 8px;
|
||||
top: -1px; }
|
||||
|
||||
.fc-time-area tr:first-child .fc-event-container {
|
||||
top: 0; }
|
||||
|
||||
.fc-no-overlap .fc-time-area .fc-event-container {
|
||||
padding-bottom: 0;
|
||||
top: 0; }
|
||||
|
||||
/* Now Indicator
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-timeline .fc-now-indicator {
|
||||
/* both the arrow and the line */
|
||||
z-index: 3;
|
||||
/* one above scroller's fc-content */
|
||||
top: 0; }
|
||||
|
||||
.fc-time-area .fc-now-indicator-arrow {
|
||||
margin: 0 -6px;
|
||||
/* 5, then one more to counteract scroller's negative margins */
|
||||
/* triangle pointing down... */
|
||||
border-width: 6px 5px 0 5px;
|
||||
border-left-color: transparent;
|
||||
border-right-color: transparent; }
|
||||
|
||||
.fc-time-area .fc-now-indicator-line {
|
||||
margin: 0 -1px;
|
||||
/* counteract scroller's negative margins */
|
||||
bottom: 0;
|
||||
border-left-width: 1px; }
|
||||
|
||||
/* Time Grid Events
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-timeline-event {
|
||||
position: absolute;
|
||||
border-radius: 0;
|
||||
padding: 2px 0;
|
||||
margin-bottom: 1px; }
|
||||
|
||||
.fc-no-overlap .fc-timeline-event {
|
||||
padding: 5px 0;
|
||||
margin-bottom: 0; }
|
||||
|
||||
/* don't overlap grid lines at the event's end */
|
||||
.fc-ltr .fc-timeline-event {
|
||||
margin-right: 1px; }
|
||||
|
||||
.fc-rtl .fc-timeline-event {
|
||||
margin-left: 1px; }
|
||||
|
||||
.fc-timeline-event .fc-content {
|
||||
padding: 0 1px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden; }
|
||||
|
||||
.fc-timeline-event .fc-time {
|
||||
font-weight: bold;
|
||||
padding: 0 1px; }
|
||||
|
||||
.fc-rtl .fc-timeline-event .fc-time {
|
||||
display: inline-block;
|
||||
/* will force it on the other side */ }
|
||||
|
||||
.fc-timeline-event .fc-title {
|
||||
position: relative;
|
||||
/* optimization for ScrollFollower */
|
||||
padding: 0 1px; }
|
||||
|
||||
.fc-timeline-event.fc-selected .fc-bg {
|
||||
display: none;
|
||||
/* hide semi-white background, to appear darker */ }
|
||||
|
||||
/* follower logic */
|
||||
.fc-ltr .fc-timeline-event .fc-title {
|
||||
padding-left: 10px;
|
||||
margin-left: -8px; }
|
||||
|
||||
.fc-rtl .fc-timeline-event .fc-title {
|
||||
padding-right: 10px;
|
||||
margin-right: -8px; }
|
||||
|
||||
.fc-ltr .fc-timeline-event.fc-not-start .fc-title {
|
||||
margin-left: -2px; }
|
||||
|
||||
.fc-rtl .fc-timeline-event.fc-not-start .fc-title {
|
||||
margin-right: -2px; }
|
||||
|
||||
.fc-timeline-event.fc-not-start .fc-title,
|
||||
.fc-body .fc-time-area .fc-following {
|
||||
position: relative; }
|
||||
|
||||
.fc-timeline-event.fc-not-start .fc-title:before,
|
||||
.fc-body .fc-time-area .fc-following:before {
|
||||
/* generic arrow */
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -5px;
|
||||
border: 5px solid #000;
|
||||
border-top-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
opacity: .5; }
|
||||
|
||||
.fc-ltr .fc-timeline-event.fc-not-start .fc-title:before,
|
||||
.fc-ltr .fc-body .fc-time-area .fc-following:before {
|
||||
/* LTR. left pointing arrow */
|
||||
border-left: 0;
|
||||
left: 2px; }
|
||||
|
||||
.fc-rtl .fc-timeline-event.fc-not-start .fc-title:before,
|
||||
.fc-rtl .fc-body .fc-time-area .fc-following:before {
|
||||
/* RTL. right pointing arrow */
|
||||
border-right: 0;
|
||||
right: 2px; }
|
||||
|
||||
/* License Message
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
.fc-license-message {
|
||||
position: absolute;
|
||||
z-index: 99999;
|
||||
bottom: 1px;
|
||||
left: 1px;
|
||||
background: #eee;
|
||||
border-color: #ddd;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 0 0;
|
||||
padding: 2px 4px;
|
||||
font-size: 12px;
|
||||
border-top-right-radius: 3px; }
|
5
product_rental_bookings/static/src/css/scheduler.min.css
vendored
Executable file
5
product_rental_bookings/static/src/css/scheduler.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
9
product_rental_bookings/static/src/js/fabric.min.js
vendored
Executable file
9
product_rental_bookings/static/src/js/fabric.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
23
product_rental_bookings/static/src/js/lib/fullcalendar.js
Executable file
23
product_rental_bookings/static/src/js/lib/fullcalendar.js
Executable file
File diff suppressed because one or more lines are too long
184
product_rental_bookings/static/src/js/lib/popper.min.js
vendored
Executable file
184
product_rental_bookings/static/src/js/lib/popper.min.js
vendored
Executable file
@@ -0,0 +1,184 @@
|
||||
function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global.Popper = factory());
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
Object.assign||Object.defineProperty(Object,'assign',{enumerable:!1,configurable:!0,writable:!0,value:function value(a){if(a===void 0||null===a)throw new TypeError('Cannot convert first argument to object');var b=Object(a);for(var c=1;c<arguments.length;c++){var d=arguments[c];if(void 0!==d&&null!==d){d=Object(d);var e=Object.keys(d);for(var f=0,g=e.length;f<g;f++){var h=e[f],j=Object.getOwnPropertyDescriptor(d,h);void 0!==j&&j.enumerable&&(b[h]=d[h]);}}}return b}});
|
||||
|
||||
if(!window.requestAnimationFrame){var lastTime=0,vendors=['ms','moz','webkit','o'];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x)window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'],window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame'];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=new Date().getTime(),c=Math.max(0,16-(b-lastTime)),d=window.setTimeout(function(){a(b+c);},c);return lastTime=b+c,d}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a);});}
|
||||
|
||||
function findIndex(a,b,c){var d=a.filter(function(e){return e[b]===c})[0];return a.indexOf(d)}
|
||||
|
||||
function getOffsetParent(a){var b=a.offsetParent;return b&&'BODY'!==b.nodeName?b:window.document.documentElement}
|
||||
|
||||
function getStyleComputedProperty(a,b){if(1!==a.nodeType)return[];var c=window.getComputedStyle(a,null);return c[b]}
|
||||
|
||||
function getParentNode(a){return a.parentNode||a.host}
|
||||
|
||||
function getScrollParent(a){return a===window.document?window.document.body.scrollTop?window.document.body:window.document.documentElement:-1!==['scroll','auto'].indexOf(getStyleComputedProperty(a,'overflow'))||-1!==['scroll','auto'].indexOf(getStyleComputedProperty(a,'overflow-x'))||-1!==['scroll','auto'].indexOf(getStyleComputedProperty(a,'overflow-y'))?a===window.document.body?getScrollParent(getParentNode(a)):a:getParentNode(a)?getScrollParent(getParentNode(a)):a}
|
||||
|
||||
function getOffsetRect(a){var b=window.document.documentElement,c=void 0;return c=a===b?{width:Math.max(b.clientWidth,window.innerWidth||0),height:Math.max(b.clientHeight,window.innerHeight||0),left:0,top:0}:{width:a.offsetWidth,height:a.offsetHeight,left:a.offsetLeft,top:a.offsetTop},c.right=c.left+c.width,c.bottom=c.top+c.height,c}
|
||||
|
||||
function isFixed(a){return a!==window.document.body&&(!('fixed'!==getStyleComputedProperty(a,'position'))||(getParentNode(a)?isFixed(getParentNode(a)):a))}
|
||||
|
||||
function getPosition(a){var b=getOffsetParent(a),c=isFixed(b);return c?'fixed':'absolute'}
|
||||
|
||||
function getBoundingClientRect(a){var b=a.getBoundingClientRect();return{left:b.left,top:b.top,right:b.right,bottom:b.bottom,width:b.right-b.left,height:b.bottom-b.top}}
|
||||
|
||||
function getOffsetRectRelativeToCustomParent(a,b){var c=2<arguments.length&&void 0!==arguments[2]&&arguments[2],d=3<arguments.length&&void 0!==arguments[3]&&arguments[3],e=getBoundingClientRect(a),f=getBoundingClientRect(b);if(c&&!d){var j=getScrollParent(b);f.top+=j.scrollTop,f.bottom+=j.scrollTop,f.left+=j.scrollLeft,f.right+=j.scrollLeft;}var g={top:e.top-f.top,left:e.left-f.left,bottom:e.top-f.top+e.height,right:e.left-f.left+e.width,width:e.width,height:e.height},h=b.scrollTop,i=b.scrollLeft;return g.top+=h,g.bottom+=h,g.left+=i,g.right+=i,g}
|
||||
|
||||
function getBoundaries(a,b,c){var d={},e=getOffsetParent(a),f=getScrollParent(a);if('window'===c){var g=window.document.body,h=window.document.documentElement,i=Math.max(g.scrollHeight,g.offsetHeight,h.clientHeight,h.scrollHeight,h.offsetHeight),j=Math.max(g.scrollWidth,g.offsetWidth,h.clientWidth,h.scrollWidth,h.offsetWidth);d={top:0,right:j,bottom:i,left:0};}else if('viewport'===c){var _g=getOffsetRect(e),_h=getPosition(a);d='fixed'===_h?{top:0,right:window.document.documentElement.clientWidth,bottom:window.document.documentElement.clientHeight,left:0}:{top:0-_g.top,right:window.document.documentElement.clientWidth-_g.left,bottom:window.document.documentElement.clientHeight-_g.top,left:0-_g.left};}else d=f===c||'scrollParent'===c?getOffsetRectRelativeToCustomParent(f,e):getOffsetRectRelativeToCustomParent(c,e);if(e.contains(f)){var _g2=f.scrollLeft,_h2=f.scrollTop;d.right+=_g2,d.bottom+=_h2;}return d.left+=b,d.top+=b,d.right-=b,d.bottom-=b,d}
|
||||
|
||||
function getOuterSizes(a){var b=a.style.display,c=a.style.visibility;a.style.display='block',a.style.visibility='hidden';var d=window.getComputedStyle(a),e=parseFloat(d.marginTop)+parseFloat(d.marginBottom),f=parseFloat(d.marginLeft)+parseFloat(d.marginRight),g={width:a.offsetWidth+f,height:a.offsetHeight+e};return a.style.display=b,a.style.visibility=c,g}
|
||||
|
||||
function getPopperClientRect(a){return Object.assign({},a,{right:a.left+a.width,bottom:a.top+a.height})}
|
||||
|
||||
function getSupportedPropertyName(a){var b=['','ms','webkit','moz','o'];for(var c=0;c<b.length;c++){var d=b[c]?b[c]+a.charAt(0).toUpperCase()+a.slice(1):a;if('undefined'!=typeof window.document.body.style[d])return d}return null}
|
||||
|
||||
function isFunction(a){return a&&'[object Function]'==={}.toString.call(a)}
|
||||
|
||||
function isModifierRequired(a,b,c){return!!a.filter(function(d){if(d.name===c)return!0;return d.name!==b&&!1}).length}
|
||||
|
||||
function isNumeric(a){return''!==a&&!isNaN(parseFloat(a))&&isFinite(a)}
|
||||
|
||||
function isTransformed(a){return a!==window.document.body&&('none'!==getStyleComputedProperty(a,'transform')||(getParentNode(a)?isTransformed(getParentNode(a)):a))}
|
||||
|
||||
function runModifiers(a,b,c){var d=void 0===c?a:a.slice(0,findIndex(a,'name',c));return d.forEach(function(e){e.enabled&&isFunction(e.function)&&(b=e.function(b,e));}),b}
|
||||
|
||||
function setStyle(a,b){Object.keys(b).forEach(function(c){var d='';-1!==['width','height','top','right','bottom','left'].indexOf(c)&&isNumeric(b[c])&&(d='px'),a.style[c]=b[c]+d;});}
|
||||
|
||||
var Utils = {findIndex:findIndex,getBoundaries:getBoundaries,getBoundingClientRect:getBoundingClientRect,getOffsetParent:getOffsetParent,getOffsetRectRelativeToCustomParent:getOffsetRectRelativeToCustomParent,getOuterSizes:getOuterSizes,getPopperClientRect:getPopperClientRect,getPosition:getPosition,getScrollParent:getScrollParent,getStyleComputedProperty:getStyleComputedProperty,getSupportedPropertyName:getSupportedPropertyName,isFixed:isFixed,isFunction:isFunction,isModifierRequired:isModifierRequired,isNumeric:isNumeric,isTransformed:isTransformed,runModifiers:runModifiers,setStyle:setStyle};
|
||||
|
||||
var nativeHints=['native code','[object MutationObserverConstructor]'];var isNative = (function(a){return nativeHints.some(function(b){return-1<(a||'').toString().indexOf(b)})});
|
||||
|
||||
var longerTimeoutBrowsers=['Edge','Trident','Firefox']; var timeoutDuration=0;for(var a=0;a<longerTimeoutBrowsers.length;a+=1)if(0<=navigator.userAgent.indexOf(longerTimeoutBrowsers[a])){timeoutDuration=1;break}function microtaskDebounce(a){var b=!1,c=0,d=document.createElement('span'),e=new MutationObserver(function(){a(),b=!1;});return e.observe(d,{childList:!0}),function(){b||(b=!0,d.textContent=''+c,c+=1);}}function taskDebounce(a){var b=!1;return function(){b||(b=!0,setTimeout(function(){b=!1,a();},timeoutDuration));}}var supportsNativeMutationObserver=isNative(window.MutationObserver);var debounce = supportsNativeMutationObserver?microtaskDebounce:taskDebounce;
|
||||
|
||||
function getOffsets(a,b,c,d){d=d.split('-')[0];var e={};e.position=a.position;var f='fixed'===e.position,g=a.isParentTransformed,h=getOffsetParent(f&&g?c:b),i=getOffsetRectRelativeToCustomParent(c,h,f,g),j=getOuterSizes(b);return-1===['right','left'].indexOf(d)?(e.left=i.left+i.width/2-j.width/2,e.top='top'===d?i.top-j.height:i.bottom):(e.top=i.top+i.height/2-j.height/2,e.left='left'===d?i.left-j.width:i.right),e.width=j.width,e.height=j.height,{popper:e,reference:i}}
|
||||
|
||||
function setupEventListeners(a,b,c,d){if(c.updateBound=d,window.addEventListener('resize',c.updateBound,{passive:!0}),'window'!==b.boundariesElement){var e=getScrollParent(a);(e===window.document.body||e===window.document.documentElement)&&(e=window),e.addEventListener('scroll',c.updateBound,{passive:!0}),c.scrollElement=e;}}
|
||||
|
||||
function removeEventListeners(a,b){return window.removeEventListener('resize',b.updateBound),b.scrollElement&&b.scrollElement.removeEventListener('scroll',b.updateBound),b.updateBound=null,b.scrollElement=null,b}
|
||||
|
||||
function sortModifiers(c,d){if(c.order<d.order)return-1;return c.order>d.order?1:0}
|
||||
|
||||
function applyStyle(a){var b={position:a.offsets.popper.position},c=Math.round(a.offsets.popper.left),d=Math.round(a.offsets.popper.top),e=getSupportedPropertyName('transform');return a.instance.options.gpuAcceleration&&e?(b[e]='translate3d('+c+'px, '+d+'px, 0)',b.top=0,b.left=0):(b.left=c,b.top=d),Object.assign(b,a.styles),setStyle(a.instance.popper,b),a.instance.popper.setAttribute('x-placement',a.placement),a.offsets.arrow&&setStyle(a.arrowElement,a.offsets.arrow),a}function applyStyleOnLoad(a,b,c){return b.setAttribute('x-placement',c.placement),c}
|
||||
|
||||
function arrow(a,b){var c=b.element;if('string'==typeof c&&(c=a.instance.popper.querySelector(c)),!c)return a;if(!a.instance.popper.contains(c))return console.warn('WARNING: `arrowElement` must be child of its popper element!'),a;if(!isModifierRequired(a.instance.modifiers,'arrow','keepTogether'))return console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'),a;var d={},e=a.placement.split('-')[0],f=getPopperClientRect(a.offsets.popper),g=a.offsets.reference,h=-1!==['left','right'].indexOf(e),i=h?'height':'width',j=h?'top':'left',k=h?'left':'top',l=h?'bottom':'right',m=getOuterSizes(c)[i];g[l]-m<f[j]&&(a.offsets.popper[j]-=f[j]-(g[l]-m)),g[j]+m>f[l]&&(a.offsets.popper[j]+=g[j]+m-f[l]);var n=g[j]+g[i]/2-m/2,o=n-getPopperClientRect(a.offsets.popper)[j];return o=Math.max(Math.min(f[i]-m,o),0),d[j]=o,d[k]='',a.offsets.arrow=d,a.arrowElement=c,a}
|
||||
|
||||
function getOppositePlacement(a){var b={left:'right',right:'left',bottom:'top',top:'bottom'};return a.replace(/left|right|bottom|top/g,function(c){return b[c]})}
|
||||
|
||||
function getOppositeVariation(a){if('end'===a)return'start';return'start'===a?'end':a}
|
||||
|
||||
function flip(a,b){if(a.flipped&&a.placement===a.originalPlacement)return a;var c=getBoundaries(a.instance.popper,b.padding,b.boundariesElement),d=a.placement.split('-')[0],e=getOppositePlacement(d),f=a.placement.split('-')[1]||'',g=[];return g='flip'===b.behavior?[d,e]:b.behavior,g.forEach(function(h,i){if(d!==h||g.length===i+1)return a;d=a.placement.split('-')[0],e=getOppositePlacement(d);var j=getPopperClientRect(a.offsets.popper),k='left'===d&&Math.floor(j.left)<Math.floor(c.left)||'right'===d&&Math.floor(j.right)>Math.floor(c.right)||'top'===d&&Math.floor(j.top)<Math.floor(c.top)||'bottom'===d&&Math.floor(j.bottom)>Math.floor(c.bottom),l=-1!==['top','bottom'].indexOf(d),m=!!b.flipVariations&&(l&&'start'===f&&Math.floor(j.left)<Math.floor(c.left)||l&&'end'===f&&Math.floor(j.right)>Math.floor(c.right)||!l&&'start'===f&&Math.floor(j.top)<Math.floor(c.top)||!l&&'end'===f&&Math.floor(j.bottom)>Math.floor(c.bottom));(k||m)&&(a.flipped=!0,k&&(d=g[i+1]),m&&(f=getOppositeVariation(f)),a.placement=d+(f?'-'+f:''),a.offsets.popper=getOffsets(a.instance.state,a.instance.popper,a.instance.reference,a.placement).popper,a=runModifiers(a.instance.modifiers,a,'flip'));}),a}
|
||||
|
||||
function keepTogether(a){var b=getPopperClientRect(a.offsets.popper),c=a.offsets.reference,d=Math.floor,e=a.placement.split('-')[0];return-1===['top','bottom'].indexOf(e)?(b.bottom<d(c.top)&&(a.offsets.popper.top=d(c.top)-b.height),b.top>d(c.bottom)&&(a.offsets.popper.top=d(c.bottom))):(b.right<d(c.left)&&(a.offsets.popper.left=d(c.left)-b.width),b.left>d(c.right)&&(a.offsets.popper.left=d(c.right))),a}
|
||||
|
||||
function offset(a,b){var c=a.placement,d=a.offsets.popper,e=void 0;return isNumeric(b.offset)?e=[b.offset,0]:(e=b.offset.split(' '),e=e.map(function(f,g){var h=f.match(/(\d*\.?\d*)(.*)/),i=+h[1],j=h[2],k=-1!==c.indexOf('right')||-1!==c.indexOf('left');if(1===g&&(k=!k),'%'===j||'%r'===j){var l=getPopperClientRect(a.offsets.reference),m=void 0;return m=k?l.height:l.width,m/100*i}if('%p'===j){var _l=getPopperClientRect(a.offsets.popper),_m=void 0;return _m=k?_l.height:_l.width,_m/100*i}if('vh'===j||'vw'===j){var _l2=void 0;return _l2='vh'===j?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0),_l2/100*i}return'px'===j?+i:+f})),-1===a.placement.indexOf('left')?-1===a.placement.indexOf('right')?-1===a.placement.indexOf('top')?-1!==a.placement.indexOf('bottom')&&(d.left+=e[0],d.top+=e[1]||0):(d.left+=e[0],d.top-=e[1]||0):(d.top+=e[0],d.left+=e[1]||0):(d.top+=e[0],d.left-=e[1]||0),a}
|
||||
|
||||
function preventOverflow(c,d){var e=d.boundariesElement||getOffsetParent(c.instance.popper),f=getBoundaries(c.instance.popper,d.padding,e);d.boundaries=f;var g=d.priority,h=getPopperClientRect(c.offsets.popper),i={left:function left(){var j=h.left;return h.left<f.left&&!shouldOverflowBoundary(c,d,'left')&&(j=Math.max(h.left,f.left)),{left:j}},right:function right(){var j=h.left;return h.right>f.right&&!shouldOverflowBoundary(c,d,'right')&&(j=Math.min(h.left,f.right-h.width)),{left:j}},top:function top(){var j=h.top;return h.top<f.top&&!shouldOverflowBoundary(c,d,'top')&&(j=Math.max(h.top,f.top)),{top:j}},bottom:function bottom(){var j=h.top;return h.bottom>f.bottom&&!shouldOverflowBoundary(c,d,'bottom')&&(j=Math.min(h.top,f.bottom-h.height)),{top:j}}};return g.forEach(function(j){c.offsets.popper=Object.assign(h,i[j]());}),c}function shouldOverflowBoundary(c,d,e){return!!d.escapeWithReference&&(c.flipped&&isSameAxis(c.originalPlacement,e)||!!isSameAxis(c.originalPlacement,e)||!0)}function isSameAxis(c,d){var e=c.split('-')[0],f=d.split('-')[0];return e===f||e===getOppositePlacement(d)}
|
||||
|
||||
function shift(a){var b=a.placement,c=b.split('-')[0],d=b.split('-')[1];if(d){var e=a.offsets.reference,f=getPopperClientRect(a.offsets.popper),g={y:{start:{top:e.top},end:{top:e.top+e.height-f.height}},x:{start:{left:e.left},end:{left:e.left+e.width-f.width}}},h=-1===['bottom','top'].indexOf(c)?'y':'x';a.offsets.popper=Object.assign(f,g[h][d]);}return a}
|
||||
|
||||
function hide(a){if(!isModifierRequired(a.instance.modifiers,'hide','preventOverflow'))return console.warn('WARNING: preventOverflow modifier is required by hide modifier in order to work, be sure to include it before hide!'),a;var b=a.offsets.reference,c=a.instance.modifiers.filter(function(d){return'preventOverflow'===d.name})[0].boundaries;if(b.bottom<c.top||b.left>c.right||b.top>c.bottom||b.right<c.left){if(!0===a.hide)return a;a.hide=!0,a.instance.popper.setAttribute('x-out-of-boundaries','');}else{if(!1===a.hide)return a;a.hide=!1,a.instance.popper.removeAttribute('x-out-of-boundaries');}return a}
|
||||
|
||||
var modifiersFunctions = {applyStyle:applyStyle,arrow:arrow,flip:flip,keepTogether:keepTogether,offset:offset,preventOverflow:preventOverflow,shift:shift,hide:hide};var modifiersOnLoad={applyStyleOnLoad:applyStyleOnLoad};
|
||||
|
||||
var classCallCheck = function (instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
};
|
||||
|
||||
var createClass = function () {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var get = function get(object, property, receiver) {
|
||||
if (object === null) object = Function.prototype;
|
||||
var desc = Object.getOwnPropertyDescriptor(object, property);
|
||||
|
||||
if (desc === undefined) {
|
||||
var parent = Object.getPrototypeOf(object);
|
||||
|
||||
if (parent === null) {
|
||||
return undefined;
|
||||
} else {
|
||||
return get(parent, property, receiver);
|
||||
}
|
||||
} else if ("value" in desc) {
|
||||
return desc.value;
|
||||
} else {
|
||||
var getter = desc.get;
|
||||
|
||||
if (getter === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getter.call(receiver);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var set = function set(object, property, value, receiver) {
|
||||
var desc = Object.getOwnPropertyDescriptor(object, property);
|
||||
|
||||
if (desc === undefined) {
|
||||
var parent = Object.getPrototypeOf(object);
|
||||
|
||||
if (parent !== null) {
|
||||
set(parent, property, value, receiver);
|
||||
}
|
||||
} else if ("value" in desc && desc.writable) {
|
||||
desc.value = value;
|
||||
} else {
|
||||
var setter = desc.set;
|
||||
|
||||
if (setter !== undefined) {
|
||||
setter.call(receiver, value);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
var DEFAULTS={placement:'bottom',gpuAcceleration:!0,modifiers:{shift:{order:100,enabled:!0,function:modifiersFunctions.shift},offset:{order:200,enabled:!0,function:modifiersFunctions.offset,offset:0},preventOverflow:{order:300,enabled:!0,function:modifiersFunctions.preventOverflow,priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,function:modifiersFunctions.keepTogether},arrow:{order:500,enabled:!0,function:modifiersFunctions.arrow,element:'[x-arrow]'},flip:{order:600,enabled:!0,function:modifiersFunctions.flip,behavior:'flip',padding:5,boundariesElement:'viewport'},hide:{order:700,enabled:!0,function:modifiersFunctions.hide},applyStyle:{order:800,enabled:!0,function:modifiersFunctions.applyStyle,onLoad:modifiersOnLoad.applyStyleOnLoad}}};var Popper=function(){function Popper(a,b){var _this=this,c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return classCallCheck(this,Popper),this.Defaults=DEFAULTS,this.update=debounce(this.update.bind(this)),this.scheduleUpdate=function(){return requestAnimationFrame(_this.update)},this.state={isDestroyed:!1,isCreated:!1},this.reference=a.jquery?a[0]:a,this.popper=b.jquery?b[0]:b,this.options=Object.assign({},DEFAULTS,c),this.modifiers=Object.keys(DEFAULTS.modifiers).map(function(d){return Object.assign({name:d},DEFAULTS.modifiers[d])}),this.modifiers=this.modifiers.map(function(d){var e=c.modifiers&&c.modifiers[d.name]||{},f=Object.assign({},d,e);return f}),c.modifiers&&(this.options.modifiers=Object.assign({},DEFAULTS.modifiers,c.modifiers),Object.keys(c.modifiers).forEach(function(d){if(void 0===DEFAULTS.modifiers[d]){var e=c.modifiers[d];e.name=d,_this.modifiers.push(e);}})),this.modifiers=this.modifiers.sort(sortModifiers),this.modifiers.forEach(function(d){d.enabled&&isFunction(d.onLoad)&&d.onLoad(_this.reference,_this.popper,_this.options,d);}),this.state.position=getPosition(this.reference),this.state.isParentTransformed=isTransformed(this.popper.parentNode),this.update(),setupEventListeners(this.reference,this.options,this.state,this.scheduleUpdate),this}return createClass(Popper,[{key:'update',value:function update(){var a={instance:this,styles:{},flipped:!1};this.state.position=getPosition(this.reference),setStyle(this.popper,{position:this.state.position}),this.state.isDestroyed||(a.placement=this.options.placement,a.originalPlacement=this.options.placement,a.offsets=getOffsets(this.state,this.popper,this.reference,a.placement),a=runModifiers(this.modifiers,a),this.state.isCreated?isFunction(this.state.updateCallback)&&this.state.updateCallback(a):(this.state.isCreated=!0,isFunction(this.state.createCallback)&&this.state.createCallback(a)));}},{key:'onCreate',value:function onCreate(a){return this.state.createCallback=a,this}},{key:'onUpdate',value:function onUpdate(a){return this.state.updateCallback=a,this}},{key:'destroy',value:function destroy(){return this.state.isDestroyed=!0,this.popper.removeAttribute('x-placement'),this.popper.style.left='',this.popper.style.position='',this.popper.style.top='',this.popper.style[getSupportedPropertyName('transform')]='',this.state=removeEventListeners(this.reference,this.state),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}}]),Popper}();Popper.Utils=Utils;
|
||||
|
||||
return Popper;
|
||||
|
||||
})));
|
9
product_rental_bookings/static/src/js/lib/scheduler.js
Executable file
9
product_rental_bookings/static/src/js/lib/scheduler.js
Executable file
File diff suppressed because one or more lines are too long
287
product_rental_bookings/static/src/js/lib/tooltip.min.js
vendored
Executable file
287
product_rental_bookings/static/src/js/lib/tooltip.min.js
vendored
Executable file
@@ -0,0 +1,287 @@
|
||||
/* ===========================================================
|
||||
* bootstrap-tooltip.js v2.2.2
|
||||
* http://twitter.github.com/bootstrap/javascript.html#tooltips
|
||||
* Inspired by the original jQuery.tipsy by Jason Frame
|
||||
* ===========================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ========================================================== */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* TOOLTIP PUBLIC CLASS DEFINITION
|
||||
* =============================== */
|
||||
|
||||
var Tooltip = function (element, options) {
|
||||
this.init('tooltip', element, options)
|
||||
}
|
||||
|
||||
Tooltip.prototype = {
|
||||
|
||||
constructor: Tooltip
|
||||
|
||||
, init: function (type, element, options) {
|
||||
var eventIn
|
||||
, eventOut
|
||||
|
||||
this.type = type
|
||||
this.$element = $(element)
|
||||
this.options = this.getOptions(options)
|
||||
this.enabled = true
|
||||
|
||||
if (this.options.trigger == 'click') {
|
||||
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
||||
} else if (this.options.trigger != 'manual') {
|
||||
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
||||
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
||||
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
||||
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
||||
}
|
||||
|
||||
this.options.selector ?
|
||||
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
||||
this.fixTitle()
|
||||
}
|
||||
|
||||
, getOptions: function (options) {
|
||||
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
|
||||
|
||||
if (options.delay && typeof options.delay == 'number') {
|
||||
options.delay = {
|
||||
show: options.delay
|
||||
, hide: options.delay
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
, enter: function (e) {
|
||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||
|
||||
clearTimeout(this.timeout)
|
||||
self.hoverState = 'in'
|
||||
this.timeout = setTimeout(function() {
|
||||
if (self.hoverState == 'in') self.show()
|
||||
}, self.options.delay.show)
|
||||
}
|
||||
|
||||
, leave: function (e) {
|
||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
||||
|
||||
if (this.timeout) clearTimeout(this.timeout)
|
||||
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
||||
|
||||
self.hoverState = 'out'
|
||||
this.timeout = setTimeout(function() {
|
||||
if (self.hoverState == 'out') self.hide()
|
||||
}, self.options.delay.hide)
|
||||
}
|
||||
|
||||
, show: function () {
|
||||
var $tip
|
||||
, inside
|
||||
, pos
|
||||
, actualWidth
|
||||
, actualHeight
|
||||
, placement
|
||||
, tp
|
||||
|
||||
if (this.hasContent() && this.enabled) {
|
||||
$tip = this.tip()
|
||||
this.setContent()
|
||||
|
||||
if (this.options.animation) {
|
||||
$tip.addClass('fade')
|
||||
}
|
||||
|
||||
placement = typeof this.options.placement == 'function' ?
|
||||
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
||||
this.options.placement
|
||||
|
||||
inside = /in/.test(placement)
|
||||
|
||||
$tip
|
||||
.detach()
|
||||
.css({ top: 0, left: 0, display: 'block' })
|
||||
.insertAfter(this.$element)
|
||||
|
||||
pos = this.getPosition(inside)
|
||||
|
||||
actualWidth = $tip[0].offsetWidth
|
||||
actualHeight = $tip[0].offsetHeight
|
||||
|
||||
switch (inside ? placement.split(' ')[1] : placement) {
|
||||
case 'bottom':
|
||||
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'top':
|
||||
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'left':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
||||
break
|
||||
case 'right':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
||||
break
|
||||
}
|
||||
|
||||
$tip
|
||||
.offset(tp)
|
||||
.addClass(placement)
|
||||
.addClass('in')
|
||||
}
|
||||
}
|
||||
|
||||
, setContent: function () {
|
||||
var $tip = this.tip()
|
||||
, title = this.getTitle()
|
||||
|
||||
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
||||
$tip.removeClass('fade in top bottom left right')
|
||||
}
|
||||
|
||||
, hide: function () {
|
||||
var that = this
|
||||
, $tip = this.tip()
|
||||
|
||||
$tip.removeClass('in')
|
||||
|
||||
function removeWithAnimation() {
|
||||
var timeout = setTimeout(function () {
|
||||
$tip.off($.support.transition.end).detach()
|
||||
}, 500)
|
||||
|
||||
$tip.one($.support.transition.end, function () {
|
||||
clearTimeout(timeout)
|
||||
$tip.detach()
|
||||
})
|
||||
}
|
||||
|
||||
$.support.transition && this.$tip.hasClass('fade') ?
|
||||
removeWithAnimation() :
|
||||
$tip.detach()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
, fixTitle: function () {
|
||||
var $e = this.$element
|
||||
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
||||
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
||||
}
|
||||
}
|
||||
|
||||
, hasContent: function () {
|
||||
return this.getTitle()
|
||||
}
|
||||
|
||||
, getPosition: function (inside) {
|
||||
return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
|
||||
width: this.$element[0].offsetWidth
|
||||
, height: this.$element[0].offsetHeight
|
||||
})
|
||||
}
|
||||
|
||||
, getTitle: function () {
|
||||
var title
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
title = $e.attr('data-original-title')
|
||||
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
||||
|
||||
return title
|
||||
}
|
||||
|
||||
, tip: function () {
|
||||
return this.$tip = this.$tip || $(this.options.template)
|
||||
}
|
||||
|
||||
, validate: function () {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide()
|
||||
this.$element = null
|
||||
this.options = null
|
||||
}
|
||||
}
|
||||
|
||||
, enable: function () {
|
||||
this.enabled = true
|
||||
}
|
||||
|
||||
, disable: function () {
|
||||
this.enabled = false
|
||||
}
|
||||
|
||||
, toggleEnabled: function () {
|
||||
this.enabled = !this.enabled
|
||||
}
|
||||
|
||||
, toggle: function (e) {
|
||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
||||
self[self.tip().hasClass('in') ? 'hide' : 'show']()
|
||||
}
|
||||
|
||||
, destroy: function () {
|
||||
this.hide().$element.off('.' + this.type).removeData(this.type)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* TOOLTIP PLUGIN DEFINITION
|
||||
* ========================= */
|
||||
|
||||
var old = $.fn.tooltip
|
||||
|
||||
$.fn.tooltip = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('tooltip')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.tooltip.Constructor = Tooltip
|
||||
|
||||
$.fn.tooltip.defaults = {
|
||||
animation: true
|
||||
, placement: 'top'
|
||||
, selector: false
|
||||
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
, trigger: 'hover'
|
||||
, title: ''
|
||||
, delay: 0
|
||||
, html: false
|
||||
}
|
||||
|
||||
|
||||
/* TOOLTIP NO CONFLICT
|
||||
* =================== */
|
||||
|
||||
$.fn.tooltip.noConflict = function () {
|
||||
$.fn.tooltip = old
|
||||
return this
|
||||
}
|
||||
|
||||
}(window.jQuery);
|
451
product_rental_bookings/static/src/js/product_booking_calender.js
Executable file
451
product_rental_bookings/static/src/js/product_booking_calender.js
Executable file
@@ -0,0 +1,451 @@
|
||||
odoo.define('product_rental_bookings.product_booking_calender', function (require) {
|
||||
"use strict";
|
||||
|
||||
var AbstractAction = require('web.AbstractAction');
|
||||
var Widget = require('web.Widget');
|
||||
var rpc = require('web.rpc');
|
||||
var core = require('web.core');
|
||||
var QWeb = core.qweb;
|
||||
var _t = core._t;
|
||||
var ajax = require('web.ajax');
|
||||
var session = require('web.session');
|
||||
var dialogs = require('web.view_dialogs');
|
||||
var field_utils = require('web.field_utils');
|
||||
var _lt = core._lt;
|
||||
var datepicker = require('web.datepicker');
|
||||
var config = require('web.config');
|
||||
var Domain = require('web.Domain');
|
||||
var DropdownMenu = require('web.DropdownMenu');
|
||||
|
||||
var ResourceView = AbstractAction.extend({
|
||||
title: core._t('Product Rental Booking'),
|
||||
template: 'ResourceViewTemplate',
|
||||
|
||||
init: function (parent, params) {
|
||||
this._super.apply(this, arguments);
|
||||
var self = this;
|
||||
this.action_manager = parent;
|
||||
this.params = params;
|
||||
this.filtersMapping = [];
|
||||
this.items = [];
|
||||
this.propositions = [];
|
||||
this.fields = _(fields).chain()
|
||||
.map(function (val, key) { return _.extend({}, val, { 'name': key }); })
|
||||
.filter(function (field) { return !field.deprecated && field.searchable; })
|
||||
.sortBy(function (field) { return field.string; })
|
||||
.value();
|
||||
this.attrs = { _: _, fields: this.fields, selected: null };
|
||||
this.value = null;
|
||||
this.items = []
|
||||
self.get_title = false;
|
||||
self.resource_obj = false;
|
||||
self.event_obj = false;
|
||||
self.first_start = false;
|
||||
self.first_end = false;
|
||||
self.second_start = false;
|
||||
self.second_end = false;
|
||||
self.final_date = false,
|
||||
self.cust_list = [];
|
||||
self.color_dict = false;
|
||||
self.calendar_cust_search_string = '';
|
||||
self.highlight_dates = [];
|
||||
self.beautician_lst = [];
|
||||
self.event_date_list = []
|
||||
var fields = {}
|
||||
},
|
||||
|
||||
start: function () {
|
||||
this._super.apply(this, arguments);
|
||||
this.set("title", this.title);
|
||||
var self = this;
|
||||
this.items = [];
|
||||
return this._super(); //.done(this.proxy('changed'))
|
||||
},
|
||||
custom_events: {
|
||||
},
|
||||
events: {
|
||||
'change #model_type_ids': 'my_method',
|
||||
},
|
||||
|
||||
my_method: function (e) {
|
||||
var self = this;
|
||||
setTimeout(function () {
|
||||
var model_id = $('#model_type_ids').val()
|
||||
var moment_date = false;
|
||||
rpc.query({
|
||||
model: 'rental.product.order',
|
||||
method: 'get_booking_data',
|
||||
args: [model_id]
|
||||
}).then(function (data) {
|
||||
$('#backend_resource_view').fullCalendar('destroy');
|
||||
self.prepareResourceView(false, data)
|
||||
})
|
||||
}, 200)
|
||||
},
|
||||
|
||||
prepareResourceView: function (moment_date, data) {
|
||||
var self = this;
|
||||
var resourceList = false;
|
||||
var eventList = false;
|
||||
var color_dict = false;
|
||||
var counter = -1;
|
||||
if (data) {
|
||||
resourceList = data[0];
|
||||
if (data[1]) {
|
||||
eventList = data[1]
|
||||
}
|
||||
}
|
||||
self.event_obj = eventList;
|
||||
self.event_date_list = eventList;
|
||||
self.$el.find('#backend_resource_view').fullCalendar({
|
||||
defaultView: 'timelineWeek',
|
||||
defaultDate: moment_date ? moment(moment_date).format('YYYY-MM-DD') : moment(),
|
||||
aspectRatio: 5,
|
||||
editable: true,
|
||||
allDaySlot: false,
|
||||
eventOverlap: false,
|
||||
selectable: true,
|
||||
height: 550,
|
||||
resourceAreaWidth: "17%",
|
||||
slotDuration: '00:00',
|
||||
eventLimit: true, // allow "more" link when too many eventsfullcalendar
|
||||
slotEventOverlap: true,
|
||||
//
|
||||
customButtons: {
|
||||
},
|
||||
header: {
|
||||
left: 'prev, today, next',
|
||||
center: 'title',
|
||||
right: 'month, timelineWeek',
|
||||
},
|
||||
buttonText: {
|
||||
month: 'Month',
|
||||
today: 'Today',
|
||||
},
|
||||
buttonIcons: {
|
||||
prev: 'left-double-arrow',
|
||||
next: 'right-double-arrow',
|
||||
},
|
||||
resourceColumns: [{
|
||||
labelText: 'Products',
|
||||
field: 'title'
|
||||
}],
|
||||
resourceGroupField: 'building',
|
||||
resources: resourceList,
|
||||
|
||||
|
||||
eventRender: function (event, element) {
|
||||
$(element).css({
|
||||
"font-weight": "bold",
|
||||
'font-size': '12px',
|
||||
'color': 'white',
|
||||
});
|
||||
if (event['rendering'] === 'background') { } else {
|
||||
var id = event.resourceId;
|
||||
var line_id = event.line_id;
|
||||
var product_type = event.type
|
||||
var product_id = event.product_id
|
||||
element.prepend("<div data-id=" + id + " data-type=" + product_type + " data-product-id=" + product_id + " class='ibox-tools' style='cursor:pointer;float:right;position:relative;height:20px;width: auto;z-index: 1000;'><a style='position:relative;background-color: transparent; margin-right: 12px;height: auto;' class='testing pull-left'><i class='fa fa-times remove_booking' data-id=" + id + " data-line-id=" + line_id + " style='position:absolute;height:auto;margin-left: 2px;'></i></a></div>");
|
||||
}
|
||||
element.find(".remove_booking").click(function (e) {
|
||||
if (confirm('Are you sure you want to delete ?')) {
|
||||
$('#backend_resource_view').fullCalendar('removeEvents', $(e.currentTarget).attr('data-id'));
|
||||
rpc.query({
|
||||
model: 'rental.product.order',
|
||||
method: 'cancel',
|
||||
args: [$(e.currentTarget).attr('data-line-id')]
|
||||
}, {
|
||||
async: false
|
||||
}).then(function (res) {
|
||||
$('#backend_resource_view').fullCalendar('removeEvents', event._id);
|
||||
return true;
|
||||
});
|
||||
} else { }
|
||||
});
|
||||
},
|
||||
|
||||
events: eventList,
|
||||
|
||||
/*EVENT RESIZE*/
|
||||
|
||||
/*SELECT EVENT ON VIEW CLICK*/
|
||||
select: function (start, end, jsEvent, view, resource) {
|
||||
var current_time = moment().format('YYYY-MM-DD HH:mm:ss')
|
||||
var start_date = moment(start).format('YYYY-MM-DD HH:mm:ss')
|
||||
var end_date = moment(end).format('YYYY-MM-DD HH:mm:ss')
|
||||
var context = false
|
||||
context = rpc.query({
|
||||
model: 'rental.product.order',
|
||||
method: 'start_and_end_date_global',
|
||||
args: [start_date, end_date],
|
||||
}).then(function (sdate) {
|
||||
if (sdate) {
|
||||
context = {
|
||||
'default_from_date': sdate[0],
|
||||
'default_to_date': sdate[1],
|
||||
'default_is_true': true,
|
||||
}
|
||||
}
|
||||
if (resource) {
|
||||
var id = resource.id
|
||||
var product_type = resource.type
|
||||
var product_id = resource.product_id
|
||||
var list = [[0, 0, { 'product_id': product_id }]]
|
||||
context['default_product_type_id'] = 1
|
||||
context['default_product_order_lines_ids'] = list
|
||||
context['default_is_true'] = true
|
||||
}
|
||||
var dialog = new dialogs.FormViewDialog(self, {
|
||||
res_model: 'rental.product.order',
|
||||
res_id: false,
|
||||
title: _t("Rental Order"),
|
||||
readonly: false,
|
||||
context: context,
|
||||
on_saved: function (record, changed) {
|
||||
$('#backend_resource_view').fullCalendar('destroy');
|
||||
self.renderElement()
|
||||
$('.fc-divider').find('.fc-cell-content').addClass('fc-expander');
|
||||
},
|
||||
}).open();
|
||||
});
|
||||
},
|
||||
|
||||
selectAllow: function (selectInfo) {
|
||||
if (selectInfo.start.isBefore(moment().subtract(1, 'days').toDate()))
|
||||
return false;
|
||||
return true;
|
||||
},
|
||||
viewRender: function (view, element) {
|
||||
if (view.type && view.type == "customWeek") {
|
||||
$('.fc-divider').find('.fc-cell-content').addClass('fc-expander');
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
next_prev_today_BtnClick: function () {
|
||||
var self = this;
|
||||
var date = moment($('#backend_resource_view').fullCalendar('getDate')).format('YYYY-MM-DD');
|
||||
$('#backend_resource_view').fullCalendar('destroy');
|
||||
self.prepareResourceView(date);
|
||||
$('.fc-divider').find('.fc-cell-content').addClass('fc-expander');
|
||||
},
|
||||
|
||||
changed: function (e) {
|
||||
var nval = this.$(".o_searchview_extended_prop_field").val();
|
||||
if (this.attrs.selected === null || this.attrs.selected === undefined || nval != this.attrs.selected.name) {
|
||||
this.select_field(_.detect(this.fields, function (x) { return x.name == nval; }));
|
||||
}
|
||||
},
|
||||
|
||||
operator_changed: function (e) {
|
||||
this.value.show_inputs($(e.target));
|
||||
},
|
||||
/**
|
||||
* Selects the provided field object
|
||||
*
|
||||
* @param field a field descriptor object (as returned by fields_get, augmented by the field name)
|
||||
*/
|
||||
select_field: function (field) {
|
||||
var self = this;
|
||||
if (this.attrs.selected !== null && this.attrs.selected !== undefined) {
|
||||
this.value.destroy();
|
||||
this.value = null;
|
||||
this.$('.o_searchview_extended_prop_op').html('');
|
||||
}
|
||||
this.attrs.selected = field;
|
||||
if (field === null || field === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var type = field.type;
|
||||
var Field = core.search_filters_registry.getAny([type, "char"]);
|
||||
|
||||
this.value = new Field(this, field);
|
||||
_.each(this.value.operators, function (operator) {
|
||||
$('<option>', { value: operator.value })
|
||||
.text(String(operator.text))
|
||||
.appendTo(self.$('.o_searchview_extended_prop_op'));
|
||||
});
|
||||
var $value_loc = this.$('.o_searchview_extended_prop_value').show().empty();
|
||||
this.value.appendTo($value_loc);
|
||||
},
|
||||
|
||||
renderElement: function () {
|
||||
var self = this;
|
||||
this._super.apply(this, arguments);
|
||||
// var r = new r();
|
||||
var user_ids = [];
|
||||
rpc.query({
|
||||
model: 'product.category',
|
||||
method: 'search_read',
|
||||
fields: ['id', 'name'],
|
||||
}, {
|
||||
async: false
|
||||
}).then(function (model_name) {
|
||||
var model_type_html = QWeb.render('model_template', {
|
||||
model_name: model_name,
|
||||
widget: self,
|
||||
});
|
||||
self.$el.find('#model_selection').empty();
|
||||
self.$el.find('#model_selection').append(model_type_html);
|
||||
});
|
||||
setTimeout(function () {
|
||||
this.$('#cal_cust_search').autocomplete({
|
||||
source: function (request, response) {
|
||||
var query = request.term;
|
||||
var search_timeout = null;
|
||||
self.loaded_partners = [];
|
||||
if (query) {
|
||||
search_timeout = setTimeout(function () {
|
||||
var partners_list = [];
|
||||
self.loaded_partners = self.load_partners(query);
|
||||
_.each(self.loaded_partners, function (partner) {
|
||||
partners_list.push({
|
||||
'id': partner.id,
|
||||
'value': partner.name,
|
||||
'label': partner.name
|
||||
});
|
||||
});
|
||||
response(partners_list);
|
||||
}, 70);
|
||||
}
|
||||
},
|
||||
|
||||
select: function (event, partner) {
|
||||
event.stopImmediatePropagation();
|
||||
// event.preventDefault();
|
||||
if (partner.item && partner.item.id) {
|
||||
var selected_partner = _.find(self.loaded_partners, function (customer) {
|
||||
return customer.id == partner.item.id;
|
||||
});
|
||||
|
||||
var highlight_dates = [];
|
||||
_.find(self.event_obj, function (customer) {
|
||||
if (customer.partner_id === selected_partner.id) {
|
||||
highlight_dates.push(moment(customer.start, 'YYYY-MM_DD').format('D-M-YYYY'));
|
||||
}
|
||||
});
|
||||
self.highlight_dates = highlight_dates;
|
||||
if (highlight_dates && highlight_dates.length > 0) {
|
||||
$(".ui-datepicker-trigger").trigger("click");
|
||||
} else {
|
||||
self.highlight_dates = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
focus: function (event, ui) {
|
||||
event.preventDefault(); // Prevent the default focus behavior.
|
||||
},
|
||||
close: function (event) {
|
||||
// it is necessary to prevent ESC key from propagating to field
|
||||
// root, to prevent unwanted discard operations.
|
||||
if (event.which === $.ui.keyCode.ESCAPE) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
autoFocus: true,
|
||||
html: true,
|
||||
minLength: 1,
|
||||
delay: 200
|
||||
});
|
||||
self.my_method();
|
||||
self.prepareResourceView();
|
||||
|
||||
var input = document.createElement("input");
|
||||
input.type = "text";
|
||||
input.name = "";
|
||||
input.setAttribute("id", "select_date");
|
||||
input.setAttribute("class", 'datepicker');
|
||||
input.setAttribute("style", "display:none;");
|
||||
|
||||
var span_tag = document.createElement("SPAN");
|
||||
span_tag.name = "";
|
||||
span_tag.setAttribute('class', 'title-display');
|
||||
$('.fc-left').find('.fc-next-button').after(input);
|
||||
$('.fc-left').find('.fc-next-button').after(span_tag);
|
||||
$('.title-display').html(self.get_title)
|
||||
$("#select_date").datepicker({
|
||||
showOn: "button",
|
||||
buttonText: "<i class='fa fa-calendar'></i>",
|
||||
beforeShowDay: function (date) {
|
||||
if (self.highlight_dates) {
|
||||
var month = date.getMonth() + 1;
|
||||
var year = date.getFullYear();
|
||||
var day = date.getDate();
|
||||
var newdate = day + "-" + month + '-' + year;
|
||||
var tooltip_text = "New event on " + newdate;
|
||||
if ($.inArray(newdate, self.highlight_dates) != -1) {
|
||||
return [true, "highlight", tooltip_text];
|
||||
}
|
||||
return [true];
|
||||
}
|
||||
},
|
||||
onSelect: function (dateText) {
|
||||
$('#backend_resource_view').fullCalendar('gotoDate', moment(dateText).format('YYYY-MM-DD'));
|
||||
$('.title-display').html(self.get_title)
|
||||
}
|
||||
});
|
||||
$('button.o_dropdown_toggler_btn').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation();
|
||||
this.generatorMenuIsOpen = !this.generatorMenuIsOpen;
|
||||
var def;
|
||||
if (!this.generatorMenuIsOpen) {
|
||||
_.invoke(this.propositions, 'destroy');
|
||||
this.propositions = [];
|
||||
}
|
||||
$('.o_filters_menu').toggle()
|
||||
self.changed()
|
||||
});
|
||||
|
||||
$("#room_type_ids").select2({
|
||||
placeholder: "Room Type",
|
||||
allowClear: true,
|
||||
});
|
||||
|
||||
$("#select_filter").select2({
|
||||
placeholder: "Filter",
|
||||
allowClear: true,
|
||||
});
|
||||
|
||||
$('#select_filter').change(function (e) {
|
||||
});
|
||||
|
||||
|
||||
$('.autocomplete_li').mouseover(function (e) {
|
||||
$(e.currentTarget).addClass('o-selection-focus');
|
||||
});
|
||||
$('.autocomplete_li').mouseout(function (e) {
|
||||
$(e.currentTarget).removeClass('o-selection-focus');
|
||||
});
|
||||
}, 0);
|
||||
},
|
||||
|
||||
load_partners: function (query) {
|
||||
var self = this;
|
||||
var loaded_partners = [];
|
||||
rpc.query({
|
||||
model: 'res.partner',
|
||||
method: 'search_read',
|
||||
fields: ['name'],
|
||||
domain: ['|', '|', ['name', 'ilike', query],
|
||||
['mobile', 'ilike', query],
|
||||
['email', 'ilike', query]
|
||||
],
|
||||
limit: 7,
|
||||
}, {
|
||||
async: false
|
||||
}).then(function (partners) {
|
||||
loaded_partners = partners
|
||||
});
|
||||
return loaded_partners;
|
||||
},
|
||||
});
|
||||
|
||||
core.action_registry.add('resource_view_new', ResourceView);
|
||||
|
||||
return {
|
||||
ResourceView: ResourceView,
|
||||
};
|
||||
});
|
124
product_rental_bookings/static/src/js/product_contract_sign.js
Executable file
124
product_rental_bookings/static/src/js/product_contract_sign.js
Executable file
@@ -0,0 +1,124 @@
|
||||
odoo.define('product_rental_bookings.contract_sign', function (require) {
|
||||
"use strict";
|
||||
|
||||
var BasicController = require('web.BasicController');
|
||||
var rpc = require('web.rpc');
|
||||
var FormRenderer = require('web.FormRenderer');
|
||||
var FormController = require('web.FormController');
|
||||
var core = require('web.core');
|
||||
|
||||
var _t = core._t;
|
||||
var sign;
|
||||
|
||||
FormRenderer.include({
|
||||
_addOnClickAction: function ($el, node) {
|
||||
var self = this;
|
||||
$el.click(function () {
|
||||
if (node.attrs.name == 'signature_customer' || node.attrs.name == 'signature_contractor') {
|
||||
self.trigger_up('sign_button_clicked', {
|
||||
attrs: node.attrs,
|
||||
record: self.state,
|
||||
});
|
||||
} else {
|
||||
self.trigger_up('button_clicked', {
|
||||
attrs: node.attrs,
|
||||
record: self.state,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
FormController.include({
|
||||
custom_events: _.extend({}, FormController.prototype.custom_events, {
|
||||
sign_button_clicked: '_onSignButtonClicked',
|
||||
}),
|
||||
_onSignButtonClicked: function (event) {
|
||||
var self = this;
|
||||
self.saveRecord(self.handle, {
|
||||
stayInEdit: true,
|
||||
}).then(function () {
|
||||
var record = self.model.get(event.data.record.id);
|
||||
self._callSignButtonAction(event.data.attrs, record)
|
||||
});
|
||||
},
|
||||
|
||||
_callSignButtonAction: function (attrs, record) {
|
||||
if (attrs.name == 'signature_customer' || attrs.name == 'signature_contractor' && record.model == 'rental.product.contract') {
|
||||
this.open_signature_popup(attrs, record);
|
||||
}
|
||||
},
|
||||
|
||||
open_signature_popup: function (attrs, record) {
|
||||
var self = this;
|
||||
$('.model-body-sign').empty();
|
||||
$('.model-body-sign').html('<canvas id="canvas" width="600px" height="200px"></canvas>');
|
||||
var canvas = new fabric.Canvas('canvas');
|
||||
if (record.res_id) {
|
||||
rpc.query({
|
||||
model: 'rental.product.contract',
|
||||
method: 'search_read',
|
||||
args: [[['id', '=', parseInt(record.res_id)]]],
|
||||
}, {
|
||||
async: false
|
||||
}).then(function (result) {
|
||||
if (result && result[0]) {
|
||||
$('#customerModal').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
canvas.observe('mouse:move', function (o) {
|
||||
canvas.isDrawingMode = 1;
|
||||
canvas.freeDrawingBrush.width = 3;
|
||||
canvas.freeDrawingBrush.color = '#4c4c4c';
|
||||
});
|
||||
canvas.on('mouse:up', function (o) {
|
||||
canvas.isDrawingMode = 0;
|
||||
});
|
||||
sign = attrs.name
|
||||
$('.modal-footer').delegate('.save_sign', 'click', { 'canvas': canvas, 'active_id': record.res_id, 'self': self, 'attrs': sign }, self.save_sign);
|
||||
$('.modal-footer').delegate('.reset_sign', 'click', { 'canvas': canvas }, self.reset_sign);
|
||||
},
|
||||
|
||||
save_sign: function (event) {
|
||||
var self = this;
|
||||
var signature = {}
|
||||
var signature_img = event.data.canvas.toDataURL().split('data:image/png;base64,')[1]
|
||||
event.stopImmediatePropagation()
|
||||
var id = event.data.active_id;
|
||||
var blank = document.createElement('canvas');
|
||||
blank.width = event.data.canvas.width;
|
||||
blank.height = event.data.canvas.height;
|
||||
if (blank.toDataURL() == event.data.canvas.toDataURL()) {
|
||||
event.data.self.do_warn(_t('Please add signature and try again.'));
|
||||
} else {
|
||||
if (id) {
|
||||
rpc.query({
|
||||
model: 'rental.product.contract',
|
||||
method: 'write',
|
||||
args: [parseInt(id),
|
||||
{ 'signature': signature_img, 'button_name': sign, }],
|
||||
}, {
|
||||
async: false
|
||||
}).then(function (result) {
|
||||
if (result) {
|
||||
event.data.self.do_notify(_t('Information'), _t("Signature stored successfully."));
|
||||
event.data.canvas.clear();
|
||||
event.data.canvas.renderAll();
|
||||
$('#customerModal').modal('hide');
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
alert("Signature not save.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("Record id not found, Please refresh page and try again.");
|
||||
}
|
||||
}
|
||||
// render form view
|
||||
event.data.self.update({});
|
||||
},
|
||||
});
|
||||
});
|
27
product_rental_bookings/static/src/xml/delivery_sign.xml
Executable file
27
product_rental_bookings/static/src/xml/delivery_sign.xml
Executable file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-extend="FormView.buttons">
|
||||
<t t-jquery="div.o_form_buttons_edit" t-operation="after">
|
||||
<div class="modal fade" id="customerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">
|
||||
Add Signature
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body model-body-sign"/>
|
||||
<div class="modal-footer">
|
||||
<button type="dummy" name="close" class="btn btn-primary" data-dismiss="modal">Close</button>
|
||||
<button type="dummy" name="close" class="btn btn-primary reset_sign" data-dismiss="modal" style="display:none;">Reset</button>
|
||||
or
|
||||
<button type="dummy" name="close" class="btn btn-primary save_sign">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
</templates>
|
68
product_rental_bookings/static/src/xml/product_booking_calender.xml
Executable file
68
product_rental_bookings/static/src/xml/product_booking_calender.xml
Executable file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="tag_resource_view">
|
||||
<div t-name="ResourceViewTemplate" style="width:100%">
|
||||
<div class="container-fluid" style="margin-top:5px">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div style="width: 50%;float: left;">
|
||||
<div style="width: 28%;float: left;line-height: 30px;">Category:</div>
|
||||
<div id="model_selection" style="width:60%;float: left;line-height: 30px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="btn-group o_dropdown" style="display:none;">
|
||||
<div class="dropdown-menu o_dropdown_menu o_filters_menu" role="menu"
|
||||
x-placement="bottom-start"
|
||||
style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 30px, 0px); width: 170px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 20px;">
|
||||
<div class="col-md-12" style="padding:0">
|
||||
<div id='backend_resource_view'></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<t t-name="model_template">
|
||||
<select id="model_type_ids" class="form-control" placeholder="Model">
|
||||
<t t-if="model_name and model_name.length > 0">
|
||||
<t t-foreach="model_name" t-as="each_model">
|
||||
<t t-if="each_model">
|
||||
<option t-att-value="each_model.id">
|
||||
<t t-esc="each_model.name"/>
|
||||
</option>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
</t>
|
||||
|
||||
<t t-name="fuel_template">
|
||||
<select id="fuel_type_ids" class="form-control" placeholder="Model">
|
||||
<t t-if="model_name and model_name.length > 0">
|
||||
<t t-foreach="model_name" t-as="each_model">
|
||||
<t t-if="each_model">
|
||||
<option t-att-value="each_model.id">
|
||||
<t t-esc="each_model.name"/>
|
||||
</option>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
</t>
|
||||
</templates>
|
Reference in New Issue
Block a user