mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 05:31:10 -04:00 
			
		
		
		
	build version 400
This commit is contained in:
		| @ -11,7 +11,7 @@ Vue.directive('click-outside', { | ||||
|   }, | ||||
|   unbind: function (el) { | ||||
|     document.body.removeEventListener('click', el.event) | ||||
|   } | ||||
|   }, | ||||
| }) | ||||
|  | ||||
| Vue.directive('autoresize', { | ||||
| @ -19,12 +19,12 @@ Vue.directive('autoresize', { | ||||
|     el.style.height = el.scrollHeight + 'px' | ||||
|     el.style.overflow.y = 'hidden' | ||||
|     el.style.resize = 'none' | ||||
|     function OnInput () { | ||||
|     function OnInput() { | ||||
|       this.style.height = 'auto' | ||||
|       this.style.height = (this.scrollHeight) + 'px' | ||||
|       this.style.height = this.scrollHeight + 'px' | ||||
|       this.scrollTop = this.scrollHeight | ||||
|       window.scrollTo(window.scrollLeft, (this.scrollTop + this.scrollHeight)) | ||||
|       window.scrollTo(window.scrollLeft, this.scrollTop + this.scrollHeight) | ||||
|     } | ||||
|     el.addEventListener('input', OnInput, false) | ||||
|   } | ||||
|   }, | ||||
| }) | ||||
|  | ||||
| @ -1,16 +0,0 @@ | ||||
| export default { | ||||
|   toggleSidebar () { | ||||
|     var icon = $('.hamburger').first() | ||||
|     $('body').toggleClass('sidebar-open') | ||||
|     icon.toggleClass('is-active') | ||||
|   }, | ||||
|   reset () { | ||||
|     $('body').removeClass(function (index, css) { | ||||
|       return (css.match(/(^|\s)layout-\S+/g) || []).join(' ') | ||||
|     }) | ||||
|   }, | ||||
|   set (layoutName) { | ||||
|     this.reset() | ||||
|     $('body').addClass(layoutName) | ||||
|   } | ||||
| } | ||||
| @ -1,40 +0,0 @@ | ||||
| export default { | ||||
|   // EasyPieChart () { | ||||
|   //   var elems = $('.easy-pie-chart') | ||||
|   //   elems.each(function (index, element) { | ||||
|   //     var color = $(this).data('color') ? $(this).data('color') : '#ffde00' | ||||
|  | ||||
|   //     let myBarChart = new EasyPieChart(element, { | ||||
|   //       scaleColor: false, | ||||
|   //       barColor: color, | ||||
|   //       trackColor: '#f8f8f8', | ||||
|   //       size: 80, | ||||
|   //       onStep: function (from, to, percent) { | ||||
|   //         $(this.el).find('.percent').text(Math.round(percent)) | ||||
|   //       } | ||||
|   //     }) | ||||
|   //   }) | ||||
|   // }, | ||||
|  | ||||
|   Editors () { | ||||
|     $('.ls-summernote').summernote() | ||||
|  | ||||
|     var editor = $('.ls-simplemde')[0] | ||||
|  | ||||
|     if (editor) { | ||||
|       var simplemde = new SimpleMDE({ element: editor }) | ||||
|     } | ||||
|   }, | ||||
|   initPlugins (plugins) { | ||||
|     plugins.forEach((plugin) => { | ||||
|       if (this.isFunction(this[plugin])) { | ||||
|         this[plugin]() | ||||
|       } | ||||
|     }) | ||||
|   }, | ||||
|  | ||||
|   isFunction (functionToCheck) { | ||||
|     var getType = {} | ||||
|     return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]' | ||||
|   } | ||||
| } | ||||
| @ -1,15 +1,8 @@ | ||||
| export default { | ||||
|   toggleSidebar() { | ||||
|     let icon = document.getElementsByClassName('hamburger')[0] | ||||
|     document.body.classList.toggle('sidebar-open') | ||||
|     icon.classList.toggle('is-active') | ||||
|   }, | ||||
|  | ||||
|   addClass(el, className) { | ||||
|     if (el.classList) el.classList.add(className) | ||||
|     else el.className += ' ' + className | ||||
|   }, | ||||
|  | ||||
|   hasClass(el, className) { | ||||
|     const hasClass = el.classList | ||||
|       ? el.classList.contains(className) | ||||
| @ -18,25 +11,6 @@ export default { | ||||
|     return hasClass | ||||
|   }, | ||||
|  | ||||
|   reset(prefix) { | ||||
|     let regx = new RegExp('\\b' + prefix + '(.*)?\\b', 'g') | ||||
|     document.body.className = document.body.className.replace(regx, '') | ||||
|   }, | ||||
|  | ||||
|   setLayout(layoutName) { | ||||
|     this.reset('layout-') | ||||
|     document.body.classList.add('layout-' + layoutName) | ||||
|   }, | ||||
|  | ||||
|   setSkin(skinName) { | ||||
|     this.reset('skin-') | ||||
|     document.body.classList.add('skin-' + skinName) | ||||
|   }, | ||||
|  | ||||
|   setLogo(logoSrc) { | ||||
|     document.getElementById('logo-desk').src = logoSrc | ||||
|   }, | ||||
|  | ||||
|   formatMoney(amount, currency = 0) { | ||||
|     if (!currency) { | ||||
|       currency = { | ||||
| @ -138,10 +112,10 @@ export default { | ||||
|     } | ||||
|     let pattern = new RegExp( | ||||
|       '^(https?:\\/\\/)?' + // protocol | ||||
|       '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name | ||||
|       '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address | ||||
|       '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path | ||||
|       '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string | ||||
|         '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name | ||||
|         '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address | ||||
|         '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path | ||||
|         '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string | ||||
|         '(\\#[-a-z\\d_]*)?$', | ||||
|       'i' | ||||
|     ) // fragment locator | ||||
| @ -149,6 +123,16 @@ export default { | ||||
|     return !!pattern.test(url) | ||||
|   }, | ||||
|  | ||||
|   checkValidDomainUrl(url) { | ||||
|     if (url.includes('localhost')) { | ||||
|       return true | ||||
|     } | ||||
|     let pattern = new RegExp( | ||||
|       '^([0-9A-Za-z-\\.@:%_+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?' | ||||
|     ) | ||||
|     return !!pattern.test(url) | ||||
|   }, | ||||
|  | ||||
|   fallbackCopyTextToClipboard(text) { | ||||
|     var textArea = document.createElement('textarea') | ||||
|     textArea.value = text | ||||
| @ -182,6 +166,85 @@ export default { | ||||
|       } | ||||
|     ) | ||||
|   }, | ||||
|   arrayDifference(array1, array2) { | ||||
|     return array1.filter((i) => { | ||||
|       return array2.indexOf(i) < 0 | ||||
|     }) | ||||
|   }, | ||||
|   getBadgeStatusColor(status) { | ||||
|     switch (status) { | ||||
|       case 'DRAFT': | ||||
|         return { | ||||
|           bgColor: '#F8EDCB', | ||||
|           color: '#744210', | ||||
|         } | ||||
|       case 'PAID': | ||||
|         return { | ||||
|           bgColor: '#D5EED0', | ||||
|           color: '#276749', | ||||
|         } | ||||
|       case 'UNPAID': | ||||
|         return { | ||||
|           bgColor: '#F8EDC', | ||||
|           color: '#744210', | ||||
|         } | ||||
|       case 'SENT': | ||||
|         return { | ||||
|           bgColor: 'rgba(246, 208, 154, 0.4)', | ||||
|           color: '#975a16', | ||||
|         } | ||||
|       case 'REJECTED': | ||||
|         return { | ||||
|           bgColor: '#E1E0EA', | ||||
|           color: '#1A1841', | ||||
|         } | ||||
|       case 'ACCEPTED': | ||||
|         return { | ||||
|           bgColor: '#D5EED0', | ||||
|           color: '#276749', | ||||
|         } | ||||
|       case 'VIEWED': | ||||
|         return { | ||||
|           bgColor: '#C9E3EC', | ||||
|           color: '#2c5282', | ||||
|         } | ||||
|       case 'EXPIRED': | ||||
|         return { | ||||
|           bgColor: '#FED7D7', | ||||
|           color: '#c53030', | ||||
|         } | ||||
|       case 'PARTIALLY PAID': | ||||
|         return { | ||||
|           bgColor: '#C9E3EC', | ||||
|           color: '#2c5282', | ||||
|         } | ||||
|       case 'OVERDUE': | ||||
|         return { | ||||
|           bgColor: '#FED7D7', | ||||
|           color: '#c53030', | ||||
|         } | ||||
|       case 'COMPLETED': | ||||
|         return { | ||||
|           bgColor: '#D5EED0', | ||||
|           color: '#276749', | ||||
|         } | ||||
|       case 'DUE': | ||||
|         return { | ||||
|           bgColor: '#F8EDCB', | ||||
|           color: '#744210', | ||||
|         } | ||||
|       case 'YES': | ||||
|         return { | ||||
|           bgColor: '#D5EED0', | ||||
|           color: '#276749', | ||||
|         } | ||||
|       case 'NO': | ||||
|         return { | ||||
|           bgColor: '#FED7D7', | ||||
|           color: '#c53030', | ||||
|         } | ||||
|     } | ||||
|   }, | ||||
|   compareVersion(v1, v2, options) { | ||||
|     const lexicographical = options && options.lexicographical | ||||
|     const zeroExtend = options && options.zeroExtend | ||||
| @ -217,5 +280,5 @@ export default { | ||||
|       return -1 | ||||
|     } | ||||
|     return 0 | ||||
|   }, | ||||
|   } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user