Skip to content

Commit

Permalink
20929 - Implemented GET involuntary dissolution configurations endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
JazzarKarim committed May 13, 2024
1 parent b5e1f01 commit 412cb99
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 79 deletions.
4 changes: 2 additions & 2 deletions auth-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auth-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth-web",
"version": "2.6.8",
"version": "2.6.9",
"appName": "Auth Web",
"sbcName": "SBC Common Components",
"private": true,
Expand Down
65 changes: 20 additions & 45 deletions auth-web/src/components/auth/staff/DissolutionSchedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
>
<v-text-field
ref="numberOfBusinessesRef"
v-model="numberOfBusinesses"
v-model="numberOfBusinessesEdit"
filled
type="number"
label="Dissolution Batch Size"
Expand Down Expand Up @@ -79,7 +79,7 @@
large
outlined
class="mr-3"
@click="cancelBtnClicked()"
@click="triggerEditOnOff()"
>
Cancel
</v-btn>
Expand All @@ -103,62 +103,45 @@ import { useStaffStore } from '@/stores/staff'
export default defineComponent({
name: 'DissolutionSchedule',
emits: ['update:onHold'],
setup (_, { emit }) {
setup () {
const state = reactive({
menu: false,
numberOfBusinesses: 0,
numberOfBusinessesEdit: 0,
numberOfBusinessesNonEdit: 0,
numberOfBusinessesRef: null,
isEdit: false,
isOnHold: false
isEdit: false
})
const staffStore = useStaffStore()
/**
* Set local properties to values from the store.
* TODO: Update once BE work is done.
*/
onMounted(() => {
state.numberOfBusinesses = staffStore.getDissolutionBatchSize()
state.isOnHold = staffStore.isDissolutionBatchOnHold()
})
/** Set local properties to values from the store. */
onMounted(async () => {
// Make the call to get the involuntary dissolution configurations array and set it in store.
await staffStore.getDissolutionConfigurations()
/**
* Update whether the dissolution batch is paused or running.
* Emit the status to the parent to know whether the "Paused" badge is going to be shown.
* TODO: Modify/Update this once the BE is done.
*/
const actionBtnClicked = (): void => {
state.isOnHold = !staffStore.isDissolutionBatchOnHold()
// Emit whether on hold or not to the parent.
emit('update:onHold', state.isOnHold)
staffStore.updateDissolutionBatchOnHold(!staffStore.isDissolutionBatchOnHold())
}
// Get the batch size current value (number of businesses to be dissolved per job run)
const numDissolutions = staffStore.involuntaryDissolutionConfigurations.configurations.find(
config => config.name === 'NUM_DISSOLUTIONS_ALLOWED').value
state.numberOfBusinessesNonEdit = parseInt(numDissolutions)
})
/** Edit, Cancel, or Save (successful) button is clicked. */
const triggerEditOnOff = (): void => {
// set text field value
state.numberOfBusinessesEdit = state.numberOfBusinessesNonEdit
state.isEdit = !state.isEdit
// closing the menu
state.menu = false
}
/**
* Cancel button clicked.
* Revert numberOfBusinesses to store value. Hide the edit components.
*/
const cancelBtnClicked = (): void => {
state.numberOfBusinesses = staffStore.getDissolutionBatchSize()
triggerEditOnOff()
}
/**
* Save button is clicked. Update the dissolution batch size.
* Only save if the inputted number is valid.
* TODO: Implement logic (job) once the BE is done.
*/
const saveBtnClicked = (): void => {
if (state.numberOfBusinessesRef.validate()) {
staffStore.updateDissolutionBatchSize(state.numberOfBusinesses)
// staffStore.updateDissolutionBatchSize(state.numberOfBusinesses)
state.numberOfBusinessesNonEdit = state.numberOfBusinessesEdit
triggerEditOnOff()
}
}
Expand All @@ -173,24 +156,16 @@ export default defineComponent({
]
})
/** The action button text depending on whether the dissolution job is paused or running. */
const actionBtnText = computed(() => {
return state.isOnHold ? 'Resume' : 'Pause'
})
/**
* If non-edit, show the number of businesses into D1 from the store.
* Otherwise, it'll be reactive to whatever is being typed in the text field.
*/
const scheduleSummaryNumber = computed(() => {
return state.isEdit ? state.numberOfBusinesses : staffStore.getDissolutionBatchSize()
return state.isEdit ? state.numberOfBusinessesEdit : state.numberOfBusinessesNonEdit
})
return {
...toRefs(state),
actionBtnClicked,
actionBtnText,
cancelBtnClicked,
dissolutionBatchSizeRules,
triggerEditOnOff,
saveBtnClicked,
Expand Down
12 changes: 9 additions & 3 deletions auth-web/src/models/Staff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ export interface FilingTypeResponse {
items: FilingType[]
}

export interface InvoluntaryDissolutionIF {
batchSize: number
onHold: boolean
export interface InvoluntaryDissolutionConfigurationIF {
fullDescription: string
name: string
shortDescription: string
value: string
}

export interface Configurations {
configurations: InvoluntaryDissolutionConfigurationIF[]
}
6 changes: 5 additions & 1 deletion auth-web/src/services/staff.services.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AccountType, ProductCode, Products, ProductsRequestBody } from '@/models/Staff'
import { AccountType, Configurations, ProductCode, Products, ProductsRequestBody } from '@/models/Staff'
import { OrgFilterParams, OrgList, Organizations } from '@/models/Organization'
import { AxiosResponse } from 'axios'
import ConfigHelper from '@/util/config-helper'
Expand Down Expand Up @@ -48,4 +48,8 @@ export default class StaffService {
static async getSafeEmails (): Promise<AxiosResponse<SafeEmail[]>> {
return axios.get(`${ConfigHelper.getNotifiyAPIUrl()}/safe_list`)
}

static async getInvoluntaryDissolutionConfigurations (): Promise<AxiosResponse<Configurations>> {
return axios.get(`${ConfigHelper.getLegalAPIV2Url()}/admin/configurations`)
}
}
37 changes: 14 additions & 23 deletions auth-web/src/stores/staff.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AccountStatus, AffidavitStatus, TaskAction, TaskRelationshipStatus, TaskRelationshipType, TaskType } from '@/util/constants'
import { AccountType, GLCode, InvoluntaryDissolutionIF, ProductCode } from '@/models/Staff'
import { AccountType, Configurations, GLCode, ProductCode } from '@/models/Staff'
import { MembershipType, OrgFilterParams, Organization } from '@/models/Organization'
import { SyncAccountPayload, Task } from '@/models/Task'
import { computed, reactive, toRefs } from '@vue/composition-api'
Expand All @@ -25,7 +25,7 @@ export const useStaffStore = defineStore('staff', () => {
accountUnderReviewAdminContact: {} as Contact,
accountUnderReviewAffidavitInfo: {} as AffidavitInformation,
activeStaffOrgs: [] as Organization[],
involuntaryDissolutionBatch: {} as InvoluntaryDissolutionIF,
involuntaryDissolutionConfigurations: {} as Configurations,
pendingInvitationOrgs: [] as Organization[],
pendingStaffOrgs: [] as Organization[],
products: [] as ProductCode[],
Expand All @@ -42,7 +42,7 @@ export const useStaffStore = defineStore('staff', () => {
state.accountUnderReviewAdminContact = {} as Contact
state.accountUnderReviewAffidavitInfo = {} as AffidavitInformation
state.activeStaffOrgs = [] as Organization[]
state.involuntaryDissolutionBatch = {} as InvoluntaryDissolutionIF
state.involuntaryDissolutionConfigurations = {} as Configurations
state.pendingInvitationOrgs = [] as Organization[]
state.pendingStaffOrgs = [] as Organization[]
state.products = [] as ProductCode[]
Expand Down Expand Up @@ -80,14 +80,13 @@ export const useStaffStore = defineStore('staff', () => {
}
}

/** TODO: Implement the call from BE to grab this number. */
function getDissolutionBatchSize (): number {
return state.involuntaryDissolutionBatch.batchSize || 0
}

/** TODO: Implement the call from BE to grab the status. */
function isDissolutionBatchOnHold (): boolean {
return state.involuntaryDissolutionBatch.onHold || false
/** Get the involuntary dissolution configurations array from Legal API. */
async function getDissolutionConfigurations (): Promise<Configurations> {
const response = await StaffService.getInvoluntaryDissolutionConfigurations()
if (response?.data && response.status === 200) {
state.involuntaryDissolutionConfigurations = response.data
return response.data
}
}

async function getAccountTypes (): Promise<AccountType[]> {
Expand Down Expand Up @@ -293,23 +292,17 @@ export const useStaffStore = defineStore('staff', () => {
}

/** TODO: Make the backend call to the number of businesses to be dissolved. */
function updateDissolutionBatchSize (dissolutionBatchSize: number) {
state.involuntaryDissolutionBatch.batchSize = dissolutionBatchSize
}

/** TODO: Make the backend call to the number of businesses to be dissolved. */
function updateDissolutionBatchOnHold (onHold: boolean) {
state.involuntaryDissolutionBatch.onHold = onHold
}
// function updateDissolutionBatchSize (dissolutionBatchSize: number) {
// state.involuntaryDissolutionBatch.batchSize = dissolutionBatchSize
// }

return {
accountNotaryContact,
accountNotaryName,
approveAccountUnderReview,
deleteOrg,
getAccountTypes,
getDissolutionBatchSize,
isDissolutionBatchOnHold,
getDissolutionConfigurations,
getGLCode,
getGLCodeList,
getGLCodeFiling,
Expand All @@ -330,8 +323,6 @@ export const useStaffStore = defineStore('staff', () => {
syncSuspendedStaffOrgs,
syncPendingStaffOrgs,
updateGLCodeFiling,
updateDissolutionBatchSize,
updateDissolutionBatchOnHold,
$reset
}
})
5 changes: 1 addition & 4 deletions auth-web/src/views/auth/staff/InvoluntaryDissolution.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@
</template>

<script lang="ts">
import { computed, defineComponent, onMounted, ref } from '@vue/composition-api'
import { computed, defineComponent, onMounted } from '@vue/composition-api'
import { CardHeader } from '@/components'
import DissolutionSchedule from '@/components/auth/staff/DissolutionSchedule.vue'
import { useStaffStore } from '@/stores/staff'
export default defineComponent({
name: 'InvoluntaryDissolution',
Expand All @@ -67,8 +66,6 @@ export default defineComponent({
DissolutionSchedule
},
setup () {
const staffStore = useStaffStore()
onMounted(() => {})
/**
Expand Down

0 comments on commit 412cb99

Please sign in to comment.