Add "refresh results" for QB exportable invoices
This commit is contained in:
		
							parent
							
								
									dda03fd655
								
							
						
					
					
						commit
						5738830aed
					
				
					 2 changed files with 92 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -3,9 +3,20 @@
 | 
			
		|||
 | 
			
		||||
<%def name="grid_tools()">
 | 
			
		||||
  ${parent.grid_tools()}
 | 
			
		||||
 | 
			
		||||
  % if master.has_perm('export'):
 | 
			
		||||
      ${h.form(url('{}.export'.format(route_prefix)), **{'@submit': 'exportingInvoices = true'})}
 | 
			
		||||
 | 
			
		||||
      ${h.form(url('{}.refresh_results'.format(route_prefix)), class_='control', ref='refreshResultsForm', **{'@submit': 'refreshingResults = true'})}
 | 
			
		||||
      ${h.csrf_token(request)}
 | 
			
		||||
      <b-button type="is-primary"
 | 
			
		||||
                @click="refreshResults()"
 | 
			
		||||
                icon-pack="fas"
 | 
			
		||||
                icon-left="redo"
 | 
			
		||||
                :disabled="refreshingResults">
 | 
			
		||||
        {{ refreshingResults ? "Working, please wait..." : "Refresh Results" }}
 | 
			
		||||
      </b-button>
 | 
			
		||||
      ${h.end_form()}
 | 
			
		||||
 | 
			
		||||
      ${h.form(url('{}.export'.format(route_prefix)), class_='control', **{'@submit': 'exportingInvoices = true'})}
 | 
			
		||||
      ${h.csrf_token(request)}
 | 
			
		||||
      <b-button type="is-primary"
 | 
			
		||||
                native-type="submit"
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +26,7 @@
 | 
			
		|||
        {{ exportingInvoices ? "Working, please wait..." : `Export ${'$'}{this.exportingInvoicesCount} Invoices` }}
 | 
			
		||||
      </b-button>
 | 
			
		||||
      ${h.end_form()}
 | 
			
		||||
 | 
			
		||||
  % endif
 | 
			
		||||
</%def>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -23,9 +35,17 @@
 | 
			
		|||
  % if master.has_perm('export'):
 | 
			
		||||
      <script type="text/javascript">
 | 
			
		||||
 | 
			
		||||
        ${grid.component_studly}Data.refreshingResults = false
 | 
			
		||||
        ${grid.component_studly}Data.exportingInvoices = false
 | 
			
		||||
        ${grid.component_studly}Data.exportingInvoicesCount = ${json.dumps(len(selected))|n}
 | 
			
		||||
 | 
			
		||||
        ${grid.component_studly}.methods.refreshResults = function() {
 | 
			
		||||
            if (confirm("Refresh data for all search results?")) {
 | 
			
		||||
                this.refreshingResults = true
 | 
			
		||||
                this.$refs.refreshResultsForm.submit()
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ${grid.component_studly}.methods.toggleRows = function(uuids, checked) {
 | 
			
		||||
            this.loading = true
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue