Skip to content

Commit

Permalink
Fixed an issue with the alerts changes I made (#360)
Browse files Browse the repository at this point in the history
* Fixed an issue with the alerts changes I made. Committed the migration that the system was complainiing about

* Removed the unnecessary migration
  • Loading branch information
amichard authored Oct 19, 2020
1 parent 49c9f4e commit d55a005
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 51 deletions.
21 changes: 10 additions & 11 deletions backend/api/models/sales_submission_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@
from enumfields import EnumField

from auditable.models import Auditable
from api.models.sales_submission import SalesSubmission
from api.models.sales_submission_statuses import SalesSubmissionStatuses


class SalesSubmissionHistory(Auditable):
submission = models.ForeignKey(
submission = models.ForeignKey(
'SalesSubmission',
related_name='history',
on_delete=models.PROTECT
)
validation_status = EnumField(
SalesSubmissionStatuses,
max_length=20,
null=False,
default=SalesSubmissionStatuses.DRAFT,
db_comment="The validation status of this sales submission. "
"Valid statuses: {statuses}".format(
statuses=[c.name for c in SalesSubmissionStatuses]
)
)
SalesSubmissionStatuses,
max_length=20,
null=False,
default=SalesSubmissionStatuses.DRAFT,
db_comment="The validation status of this sales submission. "
"Valid statuses: {statuses}".format(
statuses=[c.name for c in SalesSubmissionStatuses]
)
)

class Meta:
db_table = "sales_submission_history"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/components/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Alert = (props) => {
} = submission;
const statusFilter = (status) => history.filter((each) => each.validationStatus === status)[0];

if (!history.some((each) => ['DRAFT', 'SUBMITTED', 'VALIDATED', 'RECOMMEND_APPROVAL', 'CHECKED'].includes(each))) {
if (!history.some((each) => ['DRAFT', 'SUBMITTED', 'VALIDATED', 'RECOMMEND_APPROVAL', 'CHECKED'].includes(each.validationStatus))) {
return false;
}
// later we might put in a flag to check if submission has gone back and forth between
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/app/css/Credits.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@
.credit-summary-table {
border-bottom: none;
border-right: none;
display: inline-table;
}

#credit-request-details {
.status-alert {
margin: 0;
}

.table {
border: 1px solid $border-grey;
padding: 0.5rem;
Expand Down
33 changes: 17 additions & 16 deletions frontend/src/credits/components/CreditRequestDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const CreditRequestDetailsPage = (props) => {
{submission && submission.history.length > 0 && (
<div className="row mb-1">
<div className="col-sm-12">
<div className="p-2 m-0">
<div className="m-0">
<Alert
isGovernment={user.isGovernment}
alertType="credit"
Expand All @@ -149,25 +149,26 @@ const CreditRequestDetailsPage = (props) => {
</div>
</div>
)}
<div className="row m-2 p-3 address-summary-table">
<div>
<h3 className="mt-2">
{submission.organization && `${submission.organization.name} `}
</h3>
<div>
<h4 className="d-inline-block sales-upload-grey my-2">Service address: </h4>
{serviceAddress && <h4 className="d-inline-block sales-upload-blue">{serviceAddress.addressLine1} {serviceAddress.city} {serviceAddress.state} {serviceAddress.postalCode}</h4>}
<br />
<h4 className="d-inline-block sales-upload-grey mb-3">Records address: </h4>
{recordsAddress && <h4 className="d-inline-block sales-upload-blue">{recordsAddress.addressLine1} {recordsAddress.city} {recordsAddress.state} {recordsAddress.postalCode}</h4>}
</div>
<div>
<div className="row">
<div className="col-sm-12">
<div className="my-2 px-2 pb-2 address-summary-table">
<h3 className="mt-2">
{submission.organization && `${submission.organization.name} `}
</h3>
<div>
<h4 className="d-inline-block sales-upload-grey my-2">Service address: </h4>
{serviceAddress && <h4 className="d-inline-block sales-upload-blue">{serviceAddress.addressLine1} {serviceAddress.city} {serviceAddress.state} {serviceAddress.postalCode}</h4>}
<br />
<h4 className="d-inline-block sales-upload-grey mb-3">Records address: </h4>
{recordsAddress && <h4 className="d-inline-block sales-upload-blue">{recordsAddress.addressLine1} {recordsAddress.city} {recordsAddress.state} {recordsAddress.postalCode}</h4>}
</div>

<CreditRequestSummaryTable items={submission.content} user={user} validationStatus={submission.validationStatus} />
</div>
</div>
</div>
<div className="row m-2">
<div className="col-sm-12 p-0">
<div className="row mb-2">
<div className="col-sm-12">
<ModelListTable
items={submission.content}
user={user}
Expand Down
40 changes: 17 additions & 23 deletions frontend/src/credits/components/ModelListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,23 @@ const ModelListTable = (props) => {
});

return (
<>

<div className="table">
<ReactTable
columns={columns}
data={data}
defaultSorted={[{
id: 'make',
}]}
getTrProps={(state, row) => {
if (row && row.original && row.original.invalidModel) {
return {
className: 'background-danger',
};
}

return {};
}}
key="table"
/>

</div>
</>
<ReactTable
columns={columns}
data={data}
defaultSorted={[{
id: 'make',
}]}
getTrProps={(state, row) => {
if (row && row.original && row.original.invalidModel) {
return {
className: 'background-danger',
};
}

return {};
}}
key="table"
/>
);
};

Expand Down

0 comments on commit d55a005

Please sign in to comment.