Skip to content

Commit 13b9fa1

Browse files
authored
Merge pull request #116 from Worxstr/HF/refactor_again
Refactor again
2 parents 17105f4 + 909beb0 commit 13b9fa1

File tree

13 files changed

+28
-28
lines changed

13 files changed

+28
-28
lines changed

src/components/ContactForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ v-form.flex-grow-1.d-flex.flex-column(
7979
label="Number of managers",
8080
type="number",
8181
min="1",
82-
:items='employeeCountOptions'
82+
:items='contractorCountOptions'
8383
outlined,
8484
dense,
8585
:color="color",
@@ -90,7 +90,7 @@ v-form.flex-grow-1.d-flex.flex-column(
9090
label="Number of contractors",
9191
type="number",
9292
min="1",
93-
:items='employeeCountOptions'
93+
:items='contractorCountOptions'
9494
outlined,
9595
dense,
9696
:color="color",
@@ -136,7 +136,7 @@ export default class ContactForm extends Vue {
136136
email: emailRules,
137137
}
138138
139-
employeeCountOptions = [{
139+
contractorCountOptions = [{
140140
text: '0-25',
141141
value: 0
142142
},{

src/definitions/Clock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ export type ClockEvent = {
33
action: number;
44
time: string;
55
timecard_id: number;
6-
employee_id: number;
6+
contractor_id: number;
77
}
88

99
export type Timecard = {
1010
approved: boolean;
1111
denied: boolean;
12-
employee_id: number;
12+
contractor_id: number;
1313
fees_payment: string;
1414
first_name: string;
1515
last_name: string;

src/definitions/Job.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ export type Job = {
1818
longitude: number;
1919
organization_id: number;
2020
organization_manager: number;
21-
employee_manager_id: number;
21+
contractor_manager_id: number;
2222
shifts: Shift[];
23-
employees: User[];
23+
contractors: User[];
2424
managers: User[];
2525
}
2626

2727
export type Shift = {
2828
id: number;
29-
employee: User;
30-
employee_id: number;
29+
contractor: User;
30+
contractor_id: number;
3131
site_location: string;
3232
time_begin: string;
3333
time_end: string;

src/definitions/Schedule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ClockEvent } from "./Clock";
33
export type CalendarEvent = {
44
id: number;
55
job_id: number;
6-
employee_id: number;
6+
contractor_id: number;
77
site_location: string;
88
time_begin: string;
99
time_end: string;

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function initDarkMode() {
7474
function promptSSN() {
7575
// If SSN isn't set, need_info flag will be true. Prompt user to enter SSN
7676
const user = store.state.authenticatedUser
77-
if (user && user.employee_info?.need_info) {
77+
if (user && user.contractor_info?.need_info) {
7878
store.dispatch("showSnackbar", {
7979
text: `You haven't set your Social Security number.`,
8080
action: () => {

src/store/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ const storeConfig: StoreOptions<RootState> = {
477477
manager_id: state.authenticatedUser?.manager_id
478478
}
479479
})
480-
data.employee_managers.forEach((m: User) => {
480+
data.contractor_managers.forEach((m: User) => {
481481
commit('ADD_MANAGER', { type: 'contractor', manager: m })
482482
})
483483
data.organization_managers.forEach((m: User) => {
@@ -568,7 +568,7 @@ const storeConfig: StoreOptions<RootState> = {
568568
async loadWorkforce({ commit }) {
569569
const { data } = await axios({
570570
method: 'GET',
571-
url: `${baseUrl}/users/employees`
571+
url: `${baseUrl}/users/contractors`
572572
})
573573
data.users.forEach((u: User) => {
574574
commit('ADD_USER', u)
@@ -587,7 +587,7 @@ const storeConfig: StoreOptions<RootState> = {
587587
async addContractor({ commit }, contractor) {
588588
const { data } = await axios({
589589
method: 'POST',
590-
url: `${baseUrl}/users/add-employee`,
590+
url: `${baseUrl}/users/add-contractor`,
591591
data: contractor
592592
})
593593
},

src/views/jobs/CloseJobDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default class CloseJobDialog extends Vue {
3232
3333
@Prop({ default: false }) readonly opened!: boolean
3434
@Prop(Object) readonly job: Job | undefined
35-
@Prop(String) readonly employeeName: string | undefined
35+
@Prop(String) readonly contractorName: string | undefined
3636
3737
closeDialog() {
3838
this.$emit('update:opened', false);

src/views/jobs/DeleteShiftDialog.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ v-dialog(
77
)
88
v-card.d-flex.flex-column
99
v-card-title.headline Delete shift {{shift.id}}?
10-
v-card-text {{ employeeName }} will no longer work this shift.
10+
v-card-text {{ contractorName }} will no longer work this shift.
1111

1212
v-spacer
1313

@@ -32,7 +32,7 @@ export default class DeleteShiftDialog extends Vue {
3232
3333
@Prop({ default: false }) readonly opened!: boolean
3434
@Prop(Object) readonly shift: Shift | undefined
35-
@Prop(String) readonly employeeName: string | undefined
35+
@Prop(String) readonly contractorName: string | undefined
3636
3737
closeDialog() {
3838
this.$emit("update:opened", false);

src/views/jobs/EditShiftDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ v-dialog(
2828
v-select(
2929
autofocus
3030
v-model="editedShift.contractor_ids",
31-
:items="employees",
31+
:items="contractors",
3232
:item-text="(e) => (e.id > 0 ? `${e.first_name} ${e.last_name}` : `Unassigned ${-e.id}`)",
3333
:item-value="'id'",
3434
outlined,

src/views/jobs/Job.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ div(v-else)
1616
edit-shift-dialog(
1717
:create="true",
1818
:opened.sync="addShiftDialog",
19-
:contractors="job.employees"
19+
:contractors="job.contractors"
2020
)
2121
edit-shift-dialog(
2222
:opened.sync="editShiftDialog",
2323
:shift.sync="selectedShift",
24-
:contractors="job.employees"
24+
:contractors="job.contractors"
2525
)
2626
delete-shift-dialog(
2727
v-if="selectedShift",
@@ -67,7 +67,7 @@ div(v-else)
6767

6868
.flex-grow-1.px-5
6969
p.text-subtitle-2.mb-1 Contractor manager
70-
p {{ job.employee_manager | fullName }}
70+
p {{ job.contractor_manager | fullName }}
7171

7272
.flex-grow-1.px-5
7373
p.text-subtitle-2.mb-1 Consultant
@@ -197,8 +197,8 @@ export default class JobView extends Vue {
197197
}
198198
199199
contractorName(contractorId: number) {
200-
if (!this.job.employees) return ''
201-
const contractor = this.job.employees.find((e) => e.id == contractorId)
200+
if (!this.job.contractors) return ''
201+
const contractor = this.job.contractors.find((e) => e.id == contractorId)
202202
if (!contractor) return 'Unknown contractor'
203203
return `${contractor.first_name} ${contractor.last_name}`
204204
}

0 commit comments

Comments
 (0)