Skip to content

Commit

Permalink
20929 - Update the involuntary dissolution job via PUT call (#2829)
Browse files Browse the repository at this point in the history
* 20929 - Update the involuntary dissolution job via PUT call

* setting the store configuration after put call

* Fixed in response to Travis' comment

* changed the type in the interface to use new enum
  • Loading branch information
JazzarKarim authored May 16, 2024
1 parent 07ae646 commit 074e0cb
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 22 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.11",
"version": "2.6.12",
"appName": "Auth Web",
"sbcName": "SBC Common Components",
"private": true,
Expand Down
16 changes: 8 additions & 8 deletions auth-web/src/components/auth/common/TermsOfUseDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default defineComponent({
isUserTOS: { type: Boolean, default: false },
isAlreadyAccepted: { type: Boolean, default: false }
},
setup(props, { emit }) {
setup (props, { emit }) {
const userStore = useUserStore()
const userHasToAcceptTOS = computed(() => userStore.userHasToAcceptTOS)
const termsDialog = ref(false)
Expand All @@ -127,38 +127,38 @@ export default defineComponent({
}
})
function updateTermsAccepted(val) {
function updateTermsAccepted (val) {
if (props.isUserTOS && val) {
agreeToTerms()
}
}
function updateIsAlreadyAccepted(val, oldVal) {
function updateIsAlreadyAccepted (val, oldVal) {
if (oldVal !== val) {
termsAccepted.value = canCheckTerms.value = val
}
}
function openDialog() {
function openDialog () {
termsDialog.value = true
}
function closeDialog() {
function closeDialog () {
termsDialog.value = false
}
function onScroll(e) {
function onScroll (e) {
atBottom.value = (e.target.scrollHeight - e.target.scrollTop) <= (e.target.offsetHeight + 25)
}
function agreeToTerms() {
function agreeToTerms () {
termsDialog.value = false
termsAccepted.value = true
canCheckTerms.value = true
emitTermsAcceptanceStatus()
}
function emitTermsAcceptanceStatus() {
function emitTermsAcceptanceStatus () {
emit('terms-acceptance-status', termsAccepted.value)
}
Expand Down
41 changes: 35 additions & 6 deletions auth-web/src/components/auth/staff/DissolutionSchedule.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<template>
<section id="dissolution-schedule">
<!-- Saving/Updating Job -->
<v-fade-transition>
<div
v-if="isSaving"
class="loading-container"
>
<v-progress-circular
size="50"
width="5"
color="primary"
:indeterminate="isSaving"
/>
</div>
</v-fade-transition>
<article class="section-container px-6 py-8">
<!-- Dissolution Batch Size -->
<template v-if="isEdit">
Expand Down Expand Up @@ -99,6 +113,7 @@

<script lang="ts">
import { computed, defineComponent, onMounted, reactive, toRefs } from '@vue/composition-api'
import { InvoluntaryDissolutionConfigNames } from '@/util/constants'
import { useStaffStore } from '@/stores/staff'
export default defineComponent({
Expand All @@ -109,7 +124,8 @@ export default defineComponent({
numberOfBusinessesEdit: 0,
numberOfBusinessesNonEdit: 0,
numberOfBusinessesRef: null,
isEdit: false
isEdit: false,
isSaving: false
})
const staffStore = useStaffStore()
Expand All @@ -134,14 +150,27 @@ export default defineComponent({
}
/**
* Save button is clicked. Update the dissolution batch size.
* Save button is clicked. Update the dissolution batch size job.
* Only save if the inputted number is valid.
* TODO: Implement logic (job) once the BE is done.
* Show spinner and block buttons.
*/
const saveBtnClicked = (): void => {
const saveBtnClicked = async (): Promise<void> => {
if (state.numberOfBusinessesRef.validate()) {
// staffStore.updateDissolutionBatchSize(state.numberOfBusinesses)
state.numberOfBusinessesNonEdit = state.numberOfBusinessesEdit
state.isSaving = true // show the spinner
// Update store configurations array with the new number of inputted batch size
staffStore.involuntaryDissolutionConfigurations.configurations.find((config, index) => {
if (config.name === InvoluntaryDissolutionConfigNames.NUM_DISSOLUTIONS_ALLOWED) {
staffStore.involuntaryDissolutionConfigurations.configurations[index].value = String(state.numberOfBusinessesEdit)
}
})
// Make the PUT call to update the database with the new configurations array (with new batch size number)
try {
await staffStore.updateDissolutionConfigurations(staffStore.involuntaryDissolutionConfigurations)
state.numberOfBusinessesNonEdit = state.numberOfBusinessesEdit
} catch (err) {
console.error(err)
}
state.isSaving = false // hide the spinner
triggerEditOnOff()
}
}
Expand Down
4 changes: 3 additions & 1 deletion auth-web/src/models/Staff.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { InvoluntaryDissolutionConfigNames } from '@/util/constants'

export interface ProductCode {
code: string
default: boolean
Expand Down Expand Up @@ -61,7 +63,7 @@ export interface FilingTypeResponse {

export interface InvoluntaryDissolutionConfigurationIF {
fullDescription: string
name: string
name: InvoluntaryDissolutionConfigNames
shortDescription: string
value: string
}
Expand Down
4 changes: 4 additions & 0 deletions auth-web/src/services/staff.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ export default class StaffService {
static async getInvoluntaryDissolutionConfigurations (): Promise<AxiosResponse<Configurations>> {
return axios.get(`${ConfigHelper.getLegalAPIV2Url()}/admin/configurations`)
}

static async updateInvoluntaryDissolutionConfigurations (configurations: Configurations): Promise<AxiosResponse<Configurations>> {
return axios.put(`${ConfigHelper.getLegalAPIV2Url()}/admin/configurations`, configurations)
}
}
13 changes: 9 additions & 4 deletions auth-web/src/stores/staff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,14 @@ export const useStaffStore = defineStore('staff', () => {
return response?.data || {}
}

/** TODO: Make the backend call to the number of businesses to be dissolved. */
// function updateDissolutionBatchSize (dissolutionBatchSize: number) {
// state.involuntaryDissolutionBatch.batchSize = dissolutionBatchSize
// }
/** Update the involuntary dissolution configurations array. */
async function updateDissolutionConfigurations (configurations: Configurations) {
const response = await StaffService.updateInvoluntaryDissolutionConfigurations(configurations)
if (response?.data && response.status === 200) {
state.involuntaryDissolutionConfigurations = response.data
return response.data
}
}

return {
accountNotaryContact,
Expand Down Expand Up @@ -322,6 +326,7 @@ export const useStaffStore = defineStore('staff', () => {
syncRejectedStaffOrgs,
syncSuspendedStaffOrgs,
syncPendingStaffOrgs,
updateDissolutionConfigurations,
updateGLCodeFiling,
$reset
}
Expand Down
7 changes: 7 additions & 0 deletions auth-web/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,10 @@ export enum CfsAccountStatus {
INACTIVE = 'INACTIVE',
FREEZE = 'FREEZE'
}

export enum InvoluntaryDissolutionConfigNames {
DISSOLUTIONS_ON_HOLD = 'DISSOLUTIONS_ON_HOLD',
MAX_DISSOLUTIONS_ALLOWED = 'MAX_DISSOLUTIONS_ALLOWED',
NUM_DISSOLUTIONS_ALLOWED = 'NUM_DISSOLUTIONS_ALLOWED',
NEW_DISSOLUTIONS_SCHEDULE = 'NEW_DISSOLUTIONS_SCHEDULE'
}

0 comments on commit 074e0cb

Please sign in to comment.