code refactoring for send to button development
This commit is contained in:
		
							
								
								
									
										18
									
								
								resources/assets/js/views/common/documents.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								resources/assets/js/views/common/documents.js
									
									
									
									
										vendored
									
									
								
							@@ -953,6 +953,7 @@ const app = new Vue({
 | 
			
		||||
 | 
			
		||||
               form_html.querySelectorAll('[type="submit"]').forEach((submit) => {
 | 
			
		||||
                   submit.addEventListener('click', () => {
 | 
			
		||||
                        this.minor_form_loading = false;
 | 
			
		||||
                        window.onbeforeunload = null;
 | 
			
		||||
                   });
 | 
			
		||||
               });
 | 
			
		||||
@@ -967,13 +968,26 @@ const app = new Vue({
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        onSubmitViaSendEmail() {
 | 
			
		||||
            let type_submit_icon = document.querySelector('[type="submit"]').querySelector('i');
 | 
			
		||||
            let type_submit_span = document.querySelector('[type="submit"]').querySelector('span');
 | 
			
		||||
 | 
			
		||||
            this.form['senddocument'] = true;
 | 
			
		||||
 | 
			
		||||
            this.minor_form_loading = true;
 | 
			
		||||
 | 
			
		||||
            this.onSubmit();
 | 
			
		||||
            if (this.form.loading) {
 | 
			
		||||
                type_submit_icon.classList.add('hidden');
 | 
			
		||||
                type_submit_span.classList.add('opacity-100');
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.form.loading = false;
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
                if (type_submit_icon && type_submit_span) {
 | 
			
		||||
                    type_submit_icon.classList.remove('hidden');
 | 
			
		||||
                    type_submit_span.classList.remove('opacity-100');
 | 
			
		||||
                }
 | 
			
		||||
            }, 5000);
 | 
			
		||||
 | 
			
		||||
            this.onSubmit();
 | 
			
		||||
 | 
			
		||||
            setTimeout(() => {
 | 
			
		||||
                if (Object.keys(this.form.errors.errors.length > 0)) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user