mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-02-13 09:13:58 -05:00
Compare commits
5 Commits
0647b7708f
...
20d9f0a84e
| Author | SHA1 | Date | |
|---|---|---|---|
| 20d9f0a84e | |||
| f741ce5dc9 | |||
| 72ec89292f | |||
| b54eb86b7f | |||
| f74f3ad72e |
@@ -92,8 +92,6 @@ To enable automatic Time Activity entries for an Issue, you simply need to assig
|
||||
|
||||
## TODO
|
||||
|
||||
* Add Setting for Sandbox Mode
|
||||
|
||||
* Separate Vehicles into a separate plugin (I use Redmine for my automotive shop management 😉)
|
||||
|
||||
* MORE Stuff as I make it up...
|
||||
|
||||
@@ -26,10 +26,10 @@ class InvoiceController < ApplicationController
|
||||
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||
|
||||
# If multiple id's then pull each pdf & combine them
|
||||
if params[:item_ids]
|
||||
logger.info("Grabbing pdfs for " + params[:item_ids].join(', '))
|
||||
if params[:invoice_ids]
|
||||
logger.info("Grabbing pdfs for " + params[:invoice_ids].join(', '))
|
||||
ref = ""
|
||||
params[:item_ids].each do |i|
|
||||
params[:invoice_ids].each do |i|
|
||||
logger.info("processing " + i)
|
||||
invoice = service.fetch_by_id(i)
|
||||
ref += " #{invoice.doc_number}"
|
||||
|
||||
@@ -38,8 +38,19 @@
|
||||
|
||||
<tr>
|
||||
<th><%=t(:field_notes)%></th>
|
||||
<td><%= customer.notes %></td>
|
||||
<td>
|
||||
<pre id="note-display" style="text-align: left; white-space: pre-wrap; font-family: inherit;">
|
||||
<%= customer.notes %>
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<script>
|
||||
const preElement = document.getElementById('note-display');
|
||||
// This takes the text, trims the edges, and puts it back
|
||||
preElement.textContent = preElement.textContent.trim();
|
||||
</script>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
<%=t(:field_notes)%>:
|
||||
<div class="input">
|
||||
<p>
|
||||
<%= link_to_function content_tag(:span, l(:button_edit), :class => 'icon icon-edit'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @customer.new_record? %>
|
||||
<%= content_tag 'span', :id => "issue_description_and_toolbar", :style => (@customer.new_record? ? nil : 'display:none') do %>
|
||||
<%= content_tag 'span', :id => "issue_description_and_toolbar" do %>
|
||||
<%= f.text_area :notes,
|
||||
:cols => 60,
|
||||
:rows => 10,
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
<%= form_with(url: invoice_path, method: :get) do |form| %>
|
||||
|
||||
<div class="form-check">
|
||||
<%= check_box_tag "select_all", "1", false, id: "select-all-batches" %>
|
||||
<%= label_tag "select-all-batches", "Select All Items" %>
|
||||
<%= check_box_tag "select-all-invoices", "1", false, id: "select-all-invoices" %>
|
||||
<%= label_tag "select-all-invoices", "Select All Invioces" %>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<% @customer.invoices.order(id: :desc).each do |invoice| %>
|
||||
<div class="row">
|
||||
<%= check_box_tag "item_ids[]", invoice.id, false,data: { checkbox_select_all_target: "checkbox", class: "item-checkbox" } %>
|
||||
<%= check_box_tag "invoice_ids[]", invoice.id, false, class: "invoice-checkbox" %>
|
||||
<b><%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %></b> <%= invoice.txn_date %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<label for="issue_customer"><%= t(:customer) %></label>
|
||||
<%= search_customer %>
|
||||
<%= customer_id %>
|
||||
<%= link_to_function(t(:label_load_customer), "updateIssueFrom('/issues/#{context[:issue].id}/edit.js', this)") %>
|
||||
<%= link_to t(:label_load_customer), '#', onclick: "updateIssueFrom('/issues/#{context[:issue].id}/edit.js', this); return false;" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -29,7 +29,11 @@
|
||||
|
||||
<div class="vehicle_notes attribute">
|
||||
<div class="label"><span><%=t(:field_notes)%></span>:</div>
|
||||
<div class="value"><%=notes%></div>
|
||||
<div class="value">
|
||||
<pre id="note-display" style="text-align: left; white-space: pre-wrap; font-family: inherit; ">
|
||||
<%=notes%>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -32,9 +32,17 @@
|
||||
<div class="splitcontentleft">
|
||||
|
||||
<h4><%=t(:field_notes)%>:</h4>
|
||||
<pre id="note-display" style="text-align: left; white-space: pre-wrap; font-family: inherit; ">
|
||||
<td><%= vehicle.notes %></td>
|
||||
</pre>
|
||||
</tr>
|
||||
|
||||
<script>
|
||||
const preElement = document.getElementById('note-display');
|
||||
// This takes the text, trims the edges, and puts it back
|
||||
preElement.textContent = preElement.textContent.trim();
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,17 @@
|
||||
document.addEventListener("turbo:load", () => {
|
||||
const selectAllBox = document.getElementById("select-all-batches");
|
||||
const checkboxes = document.querySelectorAll(".item-checkbox");
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const select_all_invoice = document.getElementById('select-all-invoices');
|
||||
const invoices = document.querySelectorAll('.invoice-checkbox');
|
||||
|
||||
if (selectAllBox) {
|
||||
selectAllBox.addEventListener("change", function() {
|
||||
checkboxes.forEach((checkbox) => {
|
||||
checkbox.checked = this.checked;
|
||||
});
|
||||
});
|
||||
|
||||
// Optional: Uncheck "Select All" if an individual box is unchecked
|
||||
checkboxes.forEach((checkbox) => {
|
||||
checkbox.addEventListener("change", () => {
|
||||
if (!checkbox.checked) {
|
||||
selectAllBox.checked = false;
|
||||
} else if (Array.from(checkboxes).every(c => c.checked)) {
|
||||
selectAllBox.checked = true;
|
||||
}
|
||||
});
|
||||
if (select_all_invoice) {
|
||||
select_all_invoice.addEventListener('change', (e) => {
|
||||
invoices.forEach(item => item.checked = e.target.checked);
|
||||
});
|
||||
}
|
||||
|
||||
invoices.forEach(item => {
|
||||
item.addEventListener('change', () => {
|
||||
const allChecked = Array.from(invoices).every(i => i.checked);
|
||||
select_all_invoice.checked = allChecked;
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -10,14 +10,6 @@
|
||||
|
||||
class IssuesFormHookListener < Redmine::Hook::ViewListener
|
||||
|
||||
# Load the javascript to support the autocomplete forms
|
||||
def view_layouts_base_html_head(context = {})
|
||||
js = javascript_include_tag 'application.js', :plugin => 'redmine_qbo'
|
||||
js += javascript_include_tag 'autocomplete-rails.js', :plugin => 'redmine_qbo'
|
||||
js += javascript_include_tag 'checkbox_controller.js', :plugin => 'redmine_qbo'
|
||||
return js
|
||||
end
|
||||
|
||||
# Edit Issue Form
|
||||
# Here we build the required form components before passing them to a partial view formatting.
|
||||
def view_issues_form_details_bottom(context={})
|
||||
|
||||
21
lib/view_layouts_hook_listener.rb
Normal file
21
lib/view_layouts_hook_listener.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
#The MIT License (MIT)
|
||||
#
|
||||
#Copyright (c) 2026 rick barrette
|
||||
#
|
||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
#
|
||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
class ViewLayoutsHookListener < Redmine::Hook::ViewListener
|
||||
|
||||
# Load the javascript to support the autocomplete forms
|
||||
def view_layouts_base_html_head(context = {})
|
||||
js = javascript_include_tag 'application.js', :plugin => 'redmine_qbo'
|
||||
js += javascript_include_tag 'autocomplete-rails.js', :plugin => 'redmine_qbo'
|
||||
js += javascript_include_tag 'checkbox_controller.js', :plugin => 'redmine_qbo'
|
||||
return js
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user