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

Remove Actions and Last Transaction column from Organizations table #2580

Merged
merged 2 commits into from
Sep 5, 2023
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
13 changes: 8 additions & 5 deletions backend/api/services/SpreadSheetBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,18 @@ def add_credit_transfers(self, credit_trades, user):
worksheet.col(8).width = 3500
worksheet.col(9).width = 10000

def add_fuel_suppliers(self, fuel_suppliers):
def add_fuel_suppliers(self, fuel_suppliers, include_actions=False):
"""
Adds a spreadsheet for fuel suppliers
"""
worksheet = self.workbook.add_sheet("Organizations")
row_index = 0

columns = [
"ID", "Organization Name", "Compliance Units", "Registered", "Actions"
"ID", "Organization Name", "Compliance Units", "Registered"
]

if include_actions:
columns.append("Actions")
header_style = xlwt.easyxf('font: bold on')

# Build Column Headers
Expand All @@ -211,12 +212,14 @@ def add_fuel_suppliers(self, fuel_suppliers):
# Adjust the value for the 'Registered' column based on the status
registered_status = 'Yes' if fuel_supplier.status.status.lower() == 'active' else 'No'
worksheet.write(row_index, 3, registered_status)
worksheet.write(row_index, 4, fuel_supplier.actions_type.the_type)
if include_actions:
worksheet.write(row_index, 4, fuel_supplier.actions_type.the_type)

# set the widths for the columns that we expect to be longer
worksheet.col(1).width = 7500
worksheet.col(2).width = 3500
worksheet.col(4).width = 3500
if include_actions:
worksheet.col(4).width = 3500

def add_users(self, fuel_supplier_users):
"""
Expand Down
2 changes: 1 addition & 1 deletion backend/api/viewsets/CreditTrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def xls(self, request):
type="Part3FuelSupplier")) \
.order_by('lower_name')

workbook.add_fuel_suppliers(fuel_suppliers)
workbook.add_fuel_suppliers(fuel_suppliers, include_actions=True)

workbook.save(response)

Expand Down
2 changes: 1 addition & 1 deletion backend/api/viewsets/Organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def xls(self, request):
.order_by('lower_name')

workbook = SpreadSheetBuilder()
workbook.add_fuel_suppliers(fuel_suppliers)
workbook.add_fuel_suppliers(fuel_suppliers, include_actions=False)
workbook.save(response)

return response
25 changes: 2 additions & 23 deletions frontend/src/organizations/components/OrganizationsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,8 @@ const OrganizationsTable = (props) => {
}
return false
}
}, {
accessor: item => item.actionsTypeDisplay,
className: 'col-actions-type-display',
Header: 'Actions',
id: 'actions',
minWidth: 75
}, {
accessor: item => item.organizationBalance.creditTradeId,
Cell: (row) => {
const viewUrl = CREDIT_TRANSACTIONS.DETAILS.replace(':id', row.value)

return <Link to={viewUrl}>{row.value}</Link>
},
className: 'col-last-transaction',
Header: 'Last Transaction',
id: 'lastTransaction',
minWidth: 75
}, {
className: 'col-actions',
filterable: false,
id: 'actions',
width: 50
}]
}
]

const filterMethod = (filter, row, column) => {
const id = filter.pivotId || filter.id
Expand Down