-
Notifications
You must be signed in to change notification settings - Fork 69
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
20929 - Implemented GET involuntary dissolution configurations endpoint #2819
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
> | ||
<v-text-field | ||
ref="numberOfBusinessesRef" | ||
v-model="numberOfBusinesses" | ||
v-model="numberOfBusinessesEdit" | ||
filled | ||
type="number" | ||
label="Dissolution Batch Size" | ||
|
@@ -79,7 +79,7 @@ | |
large | ||
outlined | ||
class="mr-3" | ||
@click="cancelBtnClicked()" | ||
@click="triggerEditOnOff()" | ||
> | ||
Cancel | ||
</v-btn> | ||
|
@@ -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( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
config => config.name === 'NUM_DISSOLUTIONS_ALLOWED').value | ||
state.numberOfBusinessesNonEdit = parseInt(numDissolutions) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what I mentioned above. Basically, after making the call which will be made ONCE on mount, I'm storing that value here. |
||
}) | ||
/** 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FUTURE: When I work on the PUT. |
||
state.numberOfBusinessesNonEdit = state.numberOfBusinessesEdit | ||
triggerEditOnOff() | ||
} | ||
} | ||
|
@@ -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, | ||
|
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' | ||
|
@@ -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[], | ||
|
@@ -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[] | ||
|
@@ -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[]> { | ||
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented this out for now. Will uncomment next PR. |
||
// state.involuntaryDissolutionBatch.batchSize = dissolutionBatchSize | ||
// } | ||
|
||
return { | ||
accountNotaryContact, | ||
accountNotaryName, | ||
approveAccountUnderReview, | ||
deleteOrg, | ||
getAccountTypes, | ||
getDissolutionBatchSize, | ||
isDissolutionBatchOnHold, | ||
getDissolutionConfigurations, | ||
getGLCode, | ||
getGLCodeList, | ||
getGLCodeFiling, | ||
|
@@ -330,8 +323,6 @@ export const useStaffStore = defineStore('staff', () => { | |
syncSuspendedStaffOrgs, | ||
syncPendingStaffOrgs, | ||
updateGLCodeFiling, | ||
updateDissolutionBatchSize, | ||
updateDissolutionBatchOnHold, | ||
$reset | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,11 +45,8 @@ | |
badgeText="Paused" | ||
icon="mdi-calendar-clock" | ||
label="Automated Dissolution Schedule" | ||
:showBadge="isOnHold" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed all badge logic here as designs have changed. No more badge. |
||
/> | ||
<DissolutionSchedule | ||
@update:onHold="isOnHold=$event" | ||
/> | ||
<DissolutionSchedule /> | ||
</v-card> | ||
</v-col> | ||
</v-row> | ||
|
@@ -58,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', | ||
|
@@ -70,12 +66,7 @@ export default defineComponent({ | |
DissolutionSchedule | ||
}, | ||
setup () { | ||
const isOnHold = ref<boolean>(false) | ||
const staffStore = useStaffStore() | ||
|
||
onMounted(() => { | ||
isOnHold.value = staffStore.isDissolutionBatchOnHold() | ||
}) | ||
onMounted(() => {}) | ||
|
||
/** | ||
* The number of B.C. businesses that are ready for D1 Dissolution. | ||
|
@@ -84,8 +75,7 @@ export default defineComponent({ | |
const businessesReadyforDissolutionNumber = computed(() => 0) | ||
|
||
return { | ||
businessesReadyforDissolutionNumber, | ||
isOnHold | ||
businessesReadyforDissolutionNumber | ||
} | ||
} | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, this looks weird (having two properties that look similar). I have an explanation though 😆
The idea is, when the edit panel is open, the schedule summary is going to be reactive to what's being typed in the text field. However, when it is not open, it's going to be what the DB is returning of the current job batch size.
So, I decided to separate those fields. One of the biggest reasons is that, in doing so, I can store the current batch size from the GET call into the nonEdit field. This way, I only need to use the GET call once on mount. Otherwise, I have to do the GET call each time cancel or save is clicked which is really not good haha
Also, this provides so much flexibility and it separates of when the edit panel is open or not.