Skip to content

Commit

Permalink
Merge branch 'release/1.6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorv1316 committed Jun 19, 2024
2 parents 04ca222 + c5c3f99 commit 4925022
Show file tree
Hide file tree
Showing 60 changed files with 1,524 additions and 429 deletions.
118 changes: 59 additions & 59 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,76 +25,76 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
actioncable (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionmailbox (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.3.2)
actionpack (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionmailer (7.1.3.4)
actionpack (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.3.2)
actionview (= 7.1.3.2)
activesupport (= 7.1.3.2)
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.2)
actionpack (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
actiontext (7.1.3.4)
actionpack (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.2)
activesupport (= 7.1.3.2)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_interaction (5.2.0)
activemodel (>= 5.2, < 8)
activesupport (>= 5.2, < 8)
activejob (7.1.3.2)
activesupport (= 7.1.3.2)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.3.6)
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activerecord (7.1.3.2)
activemodel (= 7.1.3.2)
activesupport (= 7.1.3.2)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
timeout (>= 0.4.0)
activerecord-import (1.4.1)
activerecord (>= 4.2)
activestorage (7.1.3.2)
actionpack (= 7.1.3.2)
activejob (= 7.1.3.2)
activerecord (= 7.1.3.2)
activesupport (= 7.1.3.2)
activestorage (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activesupport (= 7.1.3.4)
marcel (~> 1.0)
activesupport (7.1.3.2)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down Expand Up @@ -151,7 +151,7 @@ GEM
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.7)
bigdecimal (3.1.8)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
Expand All @@ -174,7 +174,7 @@ GEM
combine_pdf (1.0.22)
matrix
ruby-rc4 (>= 0.1.5)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.1)
connection_pool (2.4.1)
countries (5.3.1)
unaccent (~> 0.3)
Expand Down Expand Up @@ -300,7 +300,7 @@ GEM
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
httpclient (2.8.3)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
Expand Down Expand Up @@ -353,7 +353,7 @@ GEM
memoist (0.16.2)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.22.3)
minitest (5.23.1)
money (6.16.0)
i18n (>= 0.6.4, <= 2)
msgpack (1.6.0)
Expand Down Expand Up @@ -418,8 +418,8 @@ GEM
pundit (2.3.0)
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.7.3)
rack (3.0.10)
racc (1.8.0)
rack (3.0.11)
rack-cors (2.0.0)
rack (>= 2.0.0)
rack-mini-profiler (3.0.0)
Expand All @@ -435,20 +435,20 @@ GEM
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3.2)
actioncable (= 7.1.3.2)
actionmailbox (= 7.1.3.2)
actionmailer (= 7.1.3.2)
actionpack (= 7.1.3.2)
actiontext (= 7.1.3.2)
actionview (= 7.1.3.2)
activejob (= 7.1.3.2)
activemodel (= 7.1.3.2)
activerecord (= 7.1.3.2)
activestorage (= 7.1.3.2)
activesupport (= 7.1.3.2)
rails (7.1.3.4)
actioncable (= 7.1.3.4)
actionmailbox (= 7.1.3.4)
actionmailer (= 7.1.3.4)
actionpack (= 7.1.3.4)
actiontext (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activemodel (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
bundler (>= 1.15.0)
railties (= 7.1.3.2)
railties (= 7.1.3.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -460,9 +460,9 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.3.2)
actionpack (= 7.1.3.2)
activesupport (= 7.1.3.2)
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/internal_api/v1/custom_leaves_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ class InternalApi::V1::CustomLeavesController < InternalApi::V1::ApplicationCont

def update
authorize current_user, policy_class: LeaveWithLeaveTypesPolicy
CustomLeavesService.new(leave, update_params).process
render json: { notice: "Leaves updated successfully" }, status: :ok
CustomLeavesService.new(@leave, update_params).process
render json: { notice: "Custom Leaves updated successfully" }, status: :ok
end

private

def set_leave
@_leave ||= current_company.leaves.find_or_create_by(year: params[:year])
@leave ||= current_company.leaves.find_or_create_by(year: params[:year])
end

def update_params
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/internal_api/v1/expenses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def destroy

def expense_params
params.require(:expense).permit(
:amount, :date, :description, :expense_type, :expense_category_id, :vendor_id, :receipts
:amount, :date, :description, :expense_type, :expense_category_id, :vendor_id, receipts: []
)
end

Expand Down
5 changes: 0 additions & 5 deletions app/controllers/internal_api/v1/invoices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class InternalApi::V1::InvoicesController < InternalApi::V1::ApplicationController
before_action :load_client, only: [:create, :update]
after_action :ensure_time_entries_billed, only: [:send_invoice]
after_action :track_event, only: [:create, :update, :destroy, :send_invoice, :download]

def index
Expand Down Expand Up @@ -122,10 +121,6 @@ def invoice_email_params
params.require(:invoice_email).permit(:subject, :message, recipients: [])
end

def ensure_time_entries_billed
invoice.update_timesheet_entry_status!
end

def track_event
Invoices::EventTrackerService.new(params[:action], @invoice || invoice, params).process
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ def index
status: :ok
end

def download
authorize :report

send_data Reports::ClientRevenues::DownloadService.new(params, current_company).process
end

def new
authorize :report

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@
class InternalApi::V1::Reports::OutstandingOverdueInvoicesController < InternalApi::V1::ApplicationController
def index
authorize :report
render :index,
locals: {
clients:,
summary: OutstandingOverdueInvoicesReportPresenter.new(clients).summary
},
status: :ok

report_data = Reports::OutstandingOverdueInvoices::IndexService.new(current_company).process

render :index, locals: report_data, status: :ok
end

private
def download
authorize :report

def clients
@_clients ||= current_company.clients.order("name asc").includes(:invoices).map do |client|
client
.outstanding_and_overdue_invoices
.merge({ name: client.name, logo: client.logo_url })
end
end
send_data Reports::OutstandingOverdueInvoices::DownloadService.new(params, current_company).process
end
end
1 change: 0 additions & 1 deletion app/javascript/src/StyledComponents/Pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ const Pagination = ({
<div className="flex items-center justify-end">
<select
className="p-2 text-xs font-bold text-miru-han-purple-1000"
defaultValue={itemsPerPage}
value={itemsPerPage}
onChange={handleClickOnPerPage}
>
Expand Down
22 changes: 15 additions & 7 deletions app/javascript/src/apis/expenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ import axios from "./api";

const path = "/expenses";

const index = async () => await axios.get(path);
const index = (query = "") => axios.get(query ? `${path}?${query}` : path);

const create = async payload => await axios.post(path, payload);
const create = payload =>
axios.post(path, payload, {
headers: {
"Content-Type": "multipart/form-data",
},
});

const show = async id => await axios.get(`${path}/${id}`);
const show = id => axios.get(`${path}/${id}`);

const update = async (id, payload) => axios.patch(`${path}/${id}`, payload);
const update = (id, payload, config) =>
axios.patch(`${path}/${id}`, payload, config);

const destroy = async id => axios.delete(`${path}/${id}`);
const destroy = id => axios.delete(`${path}/${id}`);

const createCategory = async payload =>
axios.post("/expense_categories", payload);
const createCategory = payload => axios.post("/expense_categories", payload);

const createVendors = payload => axios.post("/vendors", payload);

const expensesApi = {
index,
Expand All @@ -22,6 +29,7 @@ const expensesApi = {
update,
destroy,
createCategory,
createVendors,
};

export default expensesApi;
4 changes: 4 additions & 0 deletions app/javascript/src/apis/leaves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import axios from "./api";

const allLeaves = () => axios.get("/leaves");

const customLeaves = (year, payload) =>
axios.patch(`/custom_leaves/${year}`, payload);

const updateLeaveWithLeaveTypes = (year, payload) =>
axios.patch(`/leave_with_leave_type/${year}`, payload);

const leavesApi = {
allLeaves,
customLeaves,
updateLeaveWithLeaveTypes,
};

Expand Down
9 changes: 8 additions & 1 deletion app/javascript/src/apis/reports/clientRevenue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ const get = (from, to, clientIds) =>

const newReport = async () => axios.get(`${path}new`);

const clientRevenueApi = { get, newReport };
const download = (type, queryParams) =>
axios({
method: "GET",
url: `${path}/download.${type}${queryParams}`,
responseType: "blob",
});

const clientRevenueApi = { get, newReport, download };

export default clientRevenueApi;
9 changes: 8 additions & 1 deletion app/javascript/src/apis/reports/outstandingOverdueInvoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ const path = "/reports/outstanding_overdue_invoices/";

const get = () => axios.get(path);

const reports = { get };
const download = type =>
axios({
method: "GET",
url: `${path}/download.${type}`,
responseType: "blob",
});

const reports = { get, download };

export default reports;
Loading

0 comments on commit 4925022

Please sign in to comment.