Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Client phone number and company name in generate invoice api #238

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/models/company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def client_details(time_frame = "week")
end

def client_list
clients.kept.map { |client| { id: client.id, name: client.name, email: client.email, address: client.address } }
clients.kept.map do |client|
{ id: client.id, name: client.name, email: client.email, phone: client.phone, address: client.address }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
json.company_details do
json.id current_company.id
json.logo current_company.logo.attached? ? polymorphic_url(current_company.logo) : ""
json.name current_company.name
json.phone_number current_company.business_phone
json.address current_company.address
json.country current_company.country
Expand Down
5 changes: 4 additions & 1 deletion spec/models/company_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@
let(:client) { create(:client, company:) }

it "returns list of all the clients of a company" do
result = [{ id: client.id, name: client.name, email: client.email, address: client.address }]
result = [{
id: client.id, name: client.name, email: client.email, phone: client.phone,
address: client.address
}]
expect(company.client_list).to eq(result)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
company_details = {
id: user.current_workspace.id,
logo: polymorphic_url(user.current_workspace.logo),
name: user.current_workspace.name,
phone_number: user.current_workspace.business_phone,
address: user.current_workspace.address,
country: user.current_workspace.country
Expand Down