Skip to content

Commit

Permalink
Merge pull request #753 from bcgov/development
Browse files Browse the repository at this point in the history
dev to test
  • Loading branch information
sumesh-aot authored Jun 5, 2020
2 parents 1be438b + e9884bf commit ef12a77
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 92 deletions.
15 changes: 12 additions & 3 deletions auth-api/src/auth_api/services/affiliation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from auth_api.services.entity import Entity as EntityService
from auth_api.services.org import Org as OrgService
from auth_api.utils.enums import CorpType
from auth_api.utils.enums import NRNameStatus, NRStatus
from auth_api.utils.passcode import validate_passcode
from auth_api.utils.roles import ALL_ALLOWED_ROLES, CLIENT_AUTH_ROLES, STAFF
from .rest_service import RestService
Expand Down Expand Up @@ -182,7 +183,11 @@ def create_new_business_affiliation(org_id, business_identifier=None, # pylint:
nr_phone = nr_json.get('applicants').get('phoneNumber')
nr_email = nr_json.get('applicants').get('emailAddress')

if status not in ('APPROVED', 'CONDITIONAL'):
if status not in (NRStatus.APPROVED.value, NRStatus.CONDITIONAL.value):
raise BusinessException(Error.NR_NOT_APPROVED, None)

# If consentFlag is not R, N or Null for a CONDITIONAL NR throw error
if status == NRStatus.CONDITIONAL.value and nr_json.get('consentFlag', None) not in (None, 'R', 'N'):
raise BusinessException(Error.NR_NOT_APPROVED, None)

if (phone and phone != nr_phone) or (email and email != nr_email):
Expand All @@ -191,8 +196,12 @@ def create_new_business_affiliation(org_id, business_identifier=None, # pylint:
# Create an entity with the Name from NR if entity doesn't exist
if not entity:
# Filter the names from NR response and get the name which has status APPROVED as the name.
name = next(
(name.get('name') for name in nr_json.get('names') if name.get('state', None) == 'APPROVED'), None)
# Filter the names from NR response and get the name which has status CONDITION as the name.
nr_name_state = NRNameStatus.APPROVED.value if status == NRStatus.APPROVED.value \
else NRNameStatus.CONDITION.value
name = next((name.get('name') for name in nr_json.get('names') if
name.get('state', None) == nr_name_state), None)

entity = EntityService.save_entity({
'businessIdentifier': business_identifier,
'name': name,
Expand Down
14 changes: 14 additions & 0 deletions auth-api/src/auth_api/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,17 @@ class DocumentType(Enum):

TERMS_OF_USE = 'termsofuse'
TERMS_OF_USE_DIRECTOR_SEARCH = 'termsofuse_directorsearch'


class NRStatus(Enum):
"""NR statuses."""

APPROVED = 'APPROVED'
CONDITIONAL = 'CONDITIONAL'


class NRNameStatus(Enum):
"""NR name statuses."""

APPROVED = 'APPROVED'
CONDITION = 'CONDITION'
196 changes: 107 additions & 89 deletions auth-web/src/components/auth/Transactions.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<v-container>
<header class="view-header mb-6">
<header class="view-header mb-8">
<h2 class="view-header__title">Transactions</h2>
</header>
<div class="d-flex mb-7">
<div class="filter-bar d-flex mb-8">
<v-menu
v-model="showDateFilter"
:close-on-content-click="false"
Expand All @@ -12,97 +12,90 @@
<v-btn
depressed
large
class="mr-2"
color="grey lighten-2"
class="mr-3 px-3"
color="default"
v-on="on"
@click="openDateFilter"
>
<v-icon class="mr-2">mdi-calendar</v-icon>
<v-icon class="mr-2">mdi-calendar-range</v-icon>
Date Range
<v-icon class="ml-1">mdi-menu-down</v-icon>
</v-btn>
</template>
<v-card
min-width="640"
class="date-filter-container">
<v-row>
<v-col
cols="4"
class="date-range-list">
<v-list
class="mb-4"
<v-card class="date-range-container d-flex">
<div class="date-range-options d-flex flex-column justify-space-between flex-grow-0 pb-6 pt-2">
<v-list dense class="py-0"
>
<v-list-item-group
v-model="dateFilterSelectedIndex"
color="primary"
@change="dateFilterChange"
>
<v-list-item-group
v-model="dateFilterSelectedIndex"
color="primary"
@change="dateFilterChange"
>
<v-list-item
v-for="(filterRange, i) in dateFilterRanges"
:key="i"
>
<v-list-item-content>
<v-list-item-title
class="font-weight-bold px-1"
v-text="filterRange.label"
></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-item-group>
</v-list>
<div class="d-flex px-5 py-3">
<v-btn
color="primary"
class="font-weight-bold"
depressed
:disabled="!isApplyFilterBtnValid"
@click="applyDateFilter"
<v-list-item class="py-2 px-6"
v-for="(filterRange, i) in dateFilterRanges"
:key="i"
>
Apply
</v-btn>
<v-spacer></v-spacer>
<v-btn
color="primary"
outlined
@click="showDateFilter=false"
>
Cancel
</v-btn>
</div>
</v-col>
<v-col class="pb-8">
<h3 class="mt-4 mb-6">
{{showDateRangeSelected}}
</h3>
<v-date-picker
class="text-center"
<v-list-item-content>
<v-list-item-title
class="font-weight-bold px-1"
v-text="filterRange.label"
></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-item-group>
</v-list>
<div class="date-filter-btns px-6 d-flex flex-end">
<v-btn large
color="primary"
class="font-weight-bold flex-grow-1"
:disabled="!isApplyFilterBtnValid"
@click="applyDateFilter"
>
Apply
</v-btn>
<v-btn large
outlined
color="primary"
v-model="dateRangeSelected"
no-title
range
:show-current="false"
:class="{'date-picker-disable': disableDatePicker}"
first-day-of-week="1"
></v-date-picker>
</v-col>
</v-row>
class="flex-grow-1 ml-2"
@click="showDateFilter=false"
>
Cancel
</v-btn>
</div>
</div>
<div class="pa-6">
<div class="date-range-label mb-6">
{{showDateRangeSelected}}
</div>
<v-date-picker
color="primary"
width="400"
class="text-center"
v-model="dateRangeSelected"
no-title
range
:show-current="false"
:class="{'date-picker-disable': disableDatePicker}"
first-day-of-week="1"
></v-date-picker>
</div>
</v-card>
</v-menu>
<div class="d-inline-flex search-input-with-btn">
<div class="folio-number-filter d-inline-flex search-input-with-btn">
<v-text-field
dense
outlined
label="Folio #"
prepend-inner-icon="mdi-magnify"
single-line
dense
v-model="folioNumberSearch"
hide-details
height="44"
class="search-text-field"
class="folio-number-field"
label="Folio #"
prepend-inner-icon="mdi-magnify"
v-model="folioNumberSearch"
></v-text-field>
<v-btn
color="primary"
class="font-weight-bold search-button"
class="folio-number-apply-btn"
depressed
large
:disabled="!folioNumberSearch"
Expand All @@ -118,13 +111,13 @@
@click="exportCSV"
>Export CSV</v-btn>
</div>
<div class="d-inline-flex align-center mb-3">
<h4>{{totalTransactionsCount}} Records found</h4>
<div class="filter-results d-inline-flex align-center mb-5">
<div class="filter-results-label py-2 mr-5">{{totalTransactionsCount}} Records found</div>
<v-chip
class="mx-2 filter-chip"
class="mr-2 filter-chip"
close
close-icon="mdi-window-close"
color="primary"
color="info"
label
v-for="filter in filterArray"
:key="filter.type"
Expand Down Expand Up @@ -370,16 +363,15 @@ export default class Transactions extends Vue {
justify-content: space-between;
}
.search-input-with-btn {
.search-text-field {
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
max-width: 180px;
}
.search-button {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
}
.folio-number-field {
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
max-width: 180px;
}
.folio-number-apply-btn {
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
}
.date-filter-container {
Expand All @@ -397,8 +389,34 @@ export default class Transactions extends Vue {
}
}
.filter-chip {
font-size: .9rem;
.date-range-options {
width: 16rem;
border-radius: 0 !important;
border-right: 1px solid var(--v-grey-lighten1);
}
.date-range-label {
font-weight: 700;
font-size: 1.125rem;
}
.v-picker.v-card {
border: 1px solid var(--v-grey-lighten1);
box-shadow: none !important;
}
.filter-results-label {
font-weight: 700;
}
::v-deep {
.v-text-field--outlined.v-input--dense .v-label {
top: 12px;
}
.v-input__prepend-inner {
margin-top: 10px !important;
margin-right: 5px !important;
}
}
</style>

0 comments on commit ef12a77

Please sign in to comment.