1
1
<script setup lang="ts">
2
2
import type { CalendarDate } from ' @internationalized/date' ;
3
3
import { syncRef } from ' @vueuse/core' ;
4
- import { employmentTypeIds } from ' ~~/shared/employment-types' ;
4
+ import { employmentTypeIds , employmentTypes } from ' ~~/shared/employment-types' ;
5
5
import { createJobPostingSchema , updateJobPostingSchema } from ' ~~/shared/schemas/posting' ;
6
+ import type { SelectableOption } from ' ~~/shared/types/general' ;
6
7
7
8
const props = defineProps <{
8
9
id? : string ;
@@ -36,6 +37,7 @@ const [isPublished] = defineField('isPublished');
36
37
const [validTill] = defineField (' validTill' );
37
38
const [isRemote] = defineField (' isRemote' );
38
39
const [employmentType] = defineField (' employmentType' );
40
+ const [baseSalary] = defineField (' baseSalary' );
39
41
40
42
let onDelete = () => Promise .resolve ();
41
43
let onUpdate = () => Promise .resolve ();
@@ -80,6 +82,7 @@ if (isEditing) {
80
82
validTill .value = (data .value .validTill as string | null ) || undefined ;
81
83
isRemote .value = data .value .isRemote || false ;
82
84
employmentType .value = data .value .employmentType || employmentTypeIds [0 ];
85
+ baseSalary .value = data .value .baseSalary || {};
83
86
84
87
// Initialise Extra Refs
85
88
if (validTill .value ) {
@@ -101,6 +104,7 @@ if (isEditing) {
101
104
} else {
102
105
isRemote .value = false ;
103
106
employmentType .value = employmentTypeIds [0 ];
107
+ baseSalary .value = {};
104
108
}
105
109
106
110
const onSubmit = () => {
@@ -111,50 +115,31 @@ watch(validTillCalendarDate, (calendarDate) => {
111
115
if (! calendarDate ) return ;
112
116
validTill .value = calendarDateToDate (calendarDate ).toISOString ();
113
117
});
118
+
119
+ const employmentTypeOptions = employmentTypes .map <SelectableOption >((e ) => ({
120
+ id: e .id ,
121
+ title: e .title ,
122
+ description: e .description ,
123
+ }));
124
+
125
+ defineExpose ({
126
+ delete: onDelete ,
127
+ submit: onSubmit ,
128
+ isEditing: isEditing ,
129
+ });
114
130
</script >
115
131
116
132
<template >
117
- <div class =" w-full max-w-8xl mx-auto " >
133
+ <div class =" w-full h-full bg-zinc-100 " >
118
134
<div
119
135
class =" flex justify-center items-center border-b border-zinc-200 bg-red-200 text-red-600 text-sm py-1"
120
136
v-if =" isExpired"
121
137
>
122
138
Posting has expired. Editing is disabled.
123
139
</div >
124
140
<!-- Input Section -->
125
- <div class =" flex w-full justify-end space-x-3 mt-2" >
126
- <AbstractConfirmationBox
127
- title =" Delete Posting?"
128
- content =" You won't be able to undo this action. You will loose access to applicant list."
129
- @confirm =" onDelete"
130
- v-if =" isEditing"
131
- >
132
- <template #input =" { open } " >
133
- <InputButton class =" w-22" variant =" destructive" @click =" open" :disabled =" disableFields" >
134
- <div class =" flex items-center space-x-1 w-full" >
135
- <Icon name =" material-symbols:delete-outline" class =" h-4 w-4" />
136
- <span >Delete</span >
137
- </div >
138
- </InputButton >
139
- </template >
140
- </AbstractConfirmationBox >
141
- <AbstractConfirmationBox
142
- title =" Save Posting?"
143
- content =" Are you sure you want to save the changes?"
144
- @confirm =" onSubmit"
145
- >
146
- <template #input =" { open } " >
147
- <InputButton class =" w-22" :disabled =" disableFields" @click =" open" >
148
- <div class =" flex items-center space-x-1 w-full" >
149
- <Icon name =" lets-icons:save" class =" h-4 w-4" />
150
- <span >Save</span >
151
- </div >
152
- </InputButton >
153
- </template >
154
- </AbstractConfirmationBox >
155
- </div >
156
- <form @submit =" onSubmit" class =" w-full flex items-start py-2 space-x-6" >
157
- <section class =" flex flex-col w-2/3 space-y-3" >
141
+ <form @submit =" onSubmit" class =" w-full flex items-start space-x-6 h-full" >
142
+ <section class =" flex flex-col w-2/3 space-y-3 px-4 pt-4 h-full" >
158
143
<InputText
159
144
placeholder =" Senior Software Engineer"
160
145
label =" Title"
@@ -179,10 +164,48 @@ watch(validTillCalendarDate, (calendarDate) => {
179
164
</template >
180
165
</InputLabel >
181
166
</section >
182
- <div class =" flex flex-col items-start justify-start space-y-3 w-1/3" >
167
+ <section class =" flex flex-col items-start justify-start space-y-3 w-1/3 px-4 pt-4 border-l-2 h-full" >
168
+ <div class =" flex w-full justify-end space-x-3 px-4 pt-2" >
169
+ <AbstractConfirmationBox
170
+ title =" Delete Posting?"
171
+ content =" You won't be able to undo this action. You will loose access to applicant list."
172
+ @confirm =" onDelete"
173
+ v-if =" isEditing"
174
+ >
175
+ <template #input =" { open } " >
176
+ <InputButton class =" w-22" variant =" destructive" @click =" open" :disabled =" disableFields" >
177
+ <div class =" flex items-center space-x-1 w-full" >
178
+ <Icon name =" material-symbols:delete-outline" class =" h-4 w-4" />
179
+ <span >Delete</span >
180
+ </div >
181
+ </InputButton >
182
+ </template >
183
+ </AbstractConfirmationBox >
184
+ <AbstractConfirmationBox
185
+ title =" Save Posting?"
186
+ content =" Are you sure you want to save the changes?"
187
+ @confirm =" onSubmit"
188
+ >
189
+ <template #input =" { open } " >
190
+ <InputButton class =" w-22" :disabled =" disableFields" @click =" open" >
191
+ <div class =" flex items-center space-x-1 w-full" >
192
+ <Icon name =" lets-icons:save" class =" h-4 w-4" />
193
+ <span >Save</span >
194
+ </div >
195
+ </InputButton >
196
+ </template >
197
+ </AbstractConfirmationBox >
198
+ </div >
199
+ <InputLabel label =" Publish?" >
200
+ <template #input >
201
+ <div class =" border p-[7px] w-full rounded-lg bg-white" >
202
+ <InputSwitch v-model =" isPublished" :disabled =" disableFields" />
203
+ </div >
204
+ </template >
205
+ </InputLabel >
183
206
<InputLabel label =" Expiry Date" >
184
207
<template #input >
185
- <div class =" border p-0.5 w-full rounded-lg" >
208
+ <div class =" border p-0.5 w-full rounded-lg bg-white " >
186
209
<InputDatePicker
187
210
class =" w-full"
188
211
label =" Expiry Date"
@@ -192,14 +215,56 @@ watch(validTillCalendarDate, (calendarDate) => {
192
215
</div >
193
216
</template >
194
217
</InputLabel >
195
- <InputLabel label =" Publish ?" >
218
+ <InputLabel label =" Is Remote ?" >
196
219
<template #input >
197
- <div class =" border p-[7px] w-full rounded-lg" >
198
- <InputSwitch v-model =" isPublished " :disabled =" disableFields" />
220
+ <div class =" border p-[7px] w-full rounded-lg bg-white " >
221
+ <InputSwitch v-model =" isRemote " :disabled =" disableFields" />
199
222
</div >
200
223
</template >
201
224
</InputLabel >
202
- </div >
225
+ <InputLabel label =" Employment Type" >
226
+ <template #input >
227
+ <InputCombobox class =" bg-white rounded-lg" :options =" employmentTypeOptions" v-model =" employmentType" />
228
+ </template >
229
+ </InputLabel >
230
+ <InputLabel label =" Salary Details" >
231
+ <template #input >
232
+ <div class =" flex flex-col p-2 border rounded-lg space-y-2 bg-white" >
233
+ <div class =" flex w-full items-center space-x-2" >
234
+ <InputLabel label =" Unit" >
235
+ <template #input >
236
+ <PickerSalaryUnit v-model =" baseSalary!.unitText" />
237
+ </template >
238
+ </InputLabel >
239
+ <InputLabel label =" Currency" >
240
+ <template #input >
241
+ <PickerCurrency v-model =" baseSalary!.currency" />
242
+ </template >
243
+ </InputLabel >
244
+ </div >
245
+ <InputLabel label =" Range" >
246
+ <template #input >
247
+ <div class =" flex w-full items-center space-x-2" >
248
+ <InputText
249
+ class =" w-1/2"
250
+ type-override =" number"
251
+ v-model =" baseSalary!.minValue"
252
+ placeholder =" Minimum"
253
+ />
254
+ <span class =" text-xs text-zinc-600" >to</span >
255
+ <InputText
256
+ class =" w-1/2"
257
+ type-override =" number"
258
+ v-model =" baseSalary!.maxValue"
259
+ placeholder =" Maximum"
260
+ />
261
+ </div >
262
+ </template >
263
+ </InputLabel >
264
+ </div >
265
+ </template >
266
+ </InputLabel >
267
+ </section >
203
268
</form >
204
269
</div >
205
270
</template >
0 commit comments