wad-lab 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +30 -3
- package/package.json +1 -1
- package/templates/vue-axios-basic/src/App.vue +405 -405
- package/templates/vue-axios-pinia/src/App.vue +427 -427
- package/templates/vue-axios-props-emits/src/App.vue +167 -167
- package/templates/vue-axios-props-emits/src/components/DepartmentForm.vue +98 -98
- package/templates/vue-axios-props-emits/src/components/DepartmentList.vue +91 -91
- package/templates/vue-axios-props-emits/src/components/EmployeeForm.vue +128 -128
- package/templates/vue-axios-props-emits/src/components/EmployeeList.vue +94 -94
- package/templates/vue-axios-router/src/App.vue +90 -90
- package/templates/vue-axios-router/src/views/AddEmployeeView.vue +247 -247
- package/templates/vue-axios-router/src/views/DepartmentView.vue +273 -273
- package/templates/vue-axios-router/src/views/EmployeeView.vue +196 -196
- package/templates/vue-axios-router/src/views/HomeDashboardView.vue +263 -263
- package/templates/vue-axios-router-props/src/App.vue +59 -59
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
</script>
|
|
3
|
-
|
|
4
|
-
<template>
|
|
5
|
-
<div class="app-layout">
|
|
6
|
-
<header class="app-header">
|
|
7
|
-
<div class="brand">
|
|
8
|
-
<h1>Company Portal</h1>
|
|
9
|
-
</div>
|
|
10
|
-
<nav class="nav-links">
|
|
11
|
-
<router-link to="/" class="nav-item">Dashboard</router-link>
|
|
12
|
-
<router-link to="/departments" class="nav-item">Departments</router-link>
|
|
13
|
-
<router-link to="/employees" class="nav-item">Employees</router-link>
|
|
14
|
-
<router-link to="/add-employee" class="nav-item">Add Employee</router-link>
|
|
15
|
-
</nav>
|
|
16
|
-
</header>
|
|
17
|
-
|
|
18
|
-
<main class="main-content">
|
|
19
|
-
<router-view />
|
|
20
|
-
</main>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<style>
|
|
25
|
-
* {
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
body {
|
|
30
|
-
margin: 0;
|
|
31
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
32
|
-
background-color: #f4f6f8;
|
|
33
|
-
color: #333333;
|
|
34
|
-
}
|
|
35
|
-
</style>
|
|
36
|
-
|
|
37
|
-
<style scoped>
|
|
38
|
-
.app-layout {
|
|
39
|
-
min-height: 100vh;
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.app-header {
|
|
45
|
-
background-color: #2c3e50;
|
|
46
|
-
color: #ffffff;
|
|
47
|
-
padding: 0 24px;
|
|
48
|
-
display: flex;
|
|
49
|
-
justify-content: space-between;
|
|
50
|
-
align-items: center;
|
|
51
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.brand h1 {
|
|
55
|
-
font-size: 20px;
|
|
56
|
-
margin: 16px 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.nav-links {
|
|
60
|
-
display: flex;
|
|
61
|
-
gap: 8px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.nav-item {
|
|
65
|
-
color: #ecf0f1;
|
|
66
|
-
text-decoration: none;
|
|
67
|
-
padding: 8px 14px;
|
|
68
|
-
border-radius: 4px;
|
|
69
|
-
font-size: 14px;
|
|
70
|
-
font-weight: 500;
|
|
71
|
-
transition: background-color 0.2s;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.nav-item:hover {
|
|
75
|
-
background-color: #34495e;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.nav-item.router-link-exact-active {
|
|
79
|
-
background-color: #1abc9c;
|
|
80
|
-
color: #ffffff;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.main-content {
|
|
84
|
-
flex: 1;
|
|
85
|
-
max-width: 1000px;
|
|
86
|
-
width: 100%;
|
|
87
|
-
margin: 24px auto;
|
|
88
|
-
padding: 0 20px;
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
1
|
+
<script setup>
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<template>
|
|
5
|
+
<div class="app-layout">
|
|
6
|
+
<header class="app-header">
|
|
7
|
+
<div class="brand">
|
|
8
|
+
<h1>Company Portal</h1>
|
|
9
|
+
</div>
|
|
10
|
+
<nav class="nav-links">
|
|
11
|
+
<router-link to="/" class="nav-item">Dashboard</router-link>
|
|
12
|
+
<router-link to="/departments" class="nav-item">Departments</router-link>
|
|
13
|
+
<router-link to="/employees" class="nav-item">Employees</router-link>
|
|
14
|
+
<router-link to="/add-employee" class="nav-item">Add Employee</router-link>
|
|
15
|
+
</nav>
|
|
16
|
+
</header>
|
|
17
|
+
|
|
18
|
+
<main class="main-content">
|
|
19
|
+
<router-view />
|
|
20
|
+
</main>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
* {
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
body {
|
|
30
|
+
margin: 0;
|
|
31
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
32
|
+
background-color: #f4f6f8;
|
|
33
|
+
color: #333333;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
|
|
37
|
+
<style scoped>
|
|
38
|
+
.app-layout {
|
|
39
|
+
min-height: 100vh;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.app-header {
|
|
45
|
+
background-color: #2c3e50;
|
|
46
|
+
color: #ffffff;
|
|
47
|
+
padding: 0 24px;
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
align-items: center;
|
|
51
|
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.brand h1 {
|
|
55
|
+
font-size: 20px;
|
|
56
|
+
margin: 16px 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.nav-links {
|
|
60
|
+
display: flex;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.nav-item {
|
|
65
|
+
color: #ecf0f1;
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
padding: 8px 14px;
|
|
68
|
+
border-radius: 4px;
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
transition: background-color 0.2s;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.nav-item:hover {
|
|
75
|
+
background-color: #34495e;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.nav-item.router-link-exact-active {
|
|
79
|
+
background-color: #1abc9c;
|
|
80
|
+
color: #ffffff;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.main-content {
|
|
84
|
+
flex: 1;
|
|
85
|
+
max-width: 1000px;
|
|
86
|
+
width: 100%;
|
|
87
|
+
margin: 24px auto;
|
|
88
|
+
padding: 0 20px;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -1,247 +1,247 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, reactive, onMounted } from 'vue'
|
|
3
|
-
import { useRouter } from 'vue-router'
|
|
4
|
-
import api from '../services/api'
|
|
5
|
-
|
|
6
|
-
const router = useRouter()
|
|
7
|
-
const departments = ref([])
|
|
8
|
-
const loading = ref(false)
|
|
9
|
-
const submitting = ref(false)
|
|
10
|
-
const errorMessage = ref('')
|
|
11
|
-
|
|
12
|
-
const form = reactive({
|
|
13
|
-
name: '',
|
|
14
|
-
email: '',
|
|
15
|
-
departmentId: '',
|
|
16
|
-
salary: ''
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
async function fetchDepartments() {
|
|
20
|
-
loading.value = true
|
|
21
|
-
try {
|
|
22
|
-
const res = await api.get('/departments')
|
|
23
|
-
departments.value = res.data
|
|
24
|
-
if (departments.value.length > 0) {
|
|
25
|
-
form.departmentId = departments.value[0].id
|
|
26
|
-
}
|
|
27
|
-
} catch (err) {
|
|
28
|
-
errorMessage.value = err.message || 'Failed to fetch departments'
|
|
29
|
-
} finally {
|
|
30
|
-
loading.value = false
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function handleAddEmployee() {
|
|
35
|
-
if (!form.name.trim() || !form.email.trim() || !form.salary) return
|
|
36
|
-
submitting.value = true
|
|
37
|
-
errorMessage.value = ''
|
|
38
|
-
try {
|
|
39
|
-
await api.post('/employees', {
|
|
40
|
-
name: form.name.trim(),
|
|
41
|
-
email: form.email.trim(),
|
|
42
|
-
departmentId: form.departmentId,
|
|
43
|
-
salary: Number(form.salary)
|
|
44
|
-
})
|
|
45
|
-
router.push('/employees')
|
|
46
|
-
} catch (err) {
|
|
47
|
-
errorMessage.value = err.message || 'Failed to add employee'
|
|
48
|
-
} finally {
|
|
49
|
-
submitting.value = false
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function handleCancel() {
|
|
54
|
-
router.push('/employees')
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
onMounted(() => {
|
|
58
|
-
fetchDepartments()
|
|
59
|
-
})
|
|
60
|
-
</script>
|
|
61
|
-
|
|
62
|
-
<template>
|
|
63
|
-
<div class="add-employee-view">
|
|
64
|
-
<h2>Add Employee</h2>
|
|
65
|
-
|
|
66
|
-
<div v-if="loading" class="state-msg">Loading department list...</div>
|
|
67
|
-
<div v-if="errorMessage" class="state-msg error">{{ errorMessage }}</div>
|
|
68
|
-
|
|
69
|
-
<div class="card">
|
|
70
|
-
<form @submit.prevent="handleAddEmployee" class="emp-form">
|
|
71
|
-
<div class="form-group">
|
|
72
|
-
<label for="emp-name">Full Name</label>
|
|
73
|
-
<input
|
|
74
|
-
id="emp-name"
|
|
75
|
-
v-model="form.name"
|
|
76
|
-
type="text"
|
|
77
|
-
placeholder="John Doe"
|
|
78
|
-
required
|
|
79
|
-
/>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div class="form-group">
|
|
83
|
-
<label for="emp-email">Email Address</label>
|
|
84
|
-
<input
|
|
85
|
-
id="emp-email"
|
|
86
|
-
v-model="form.email"
|
|
87
|
-
type="email"
|
|
88
|
-
placeholder="john.doe@example.com"
|
|
89
|
-
required
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
<div class="form-group">
|
|
94
|
-
<label for="emp-dept">Department</label>
|
|
95
|
-
<select
|
|
96
|
-
v-if="departments.length > 0"
|
|
97
|
-
id="emp-dept"
|
|
98
|
-
v-model="form.departmentId"
|
|
99
|
-
required
|
|
100
|
-
>
|
|
101
|
-
<option
|
|
102
|
-
v-for="dept in departments"
|
|
103
|
-
:key="dept.id"
|
|
104
|
-
:value="dept.id"
|
|
105
|
-
>
|
|
106
|
-
{{ dept.name }} ({{ dept.code }})
|
|
107
|
-
</option>
|
|
108
|
-
</select>
|
|
109
|
-
<input
|
|
110
|
-
v-else
|
|
111
|
-
id="emp-dept"
|
|
112
|
-
v-model="form.departmentId"
|
|
113
|
-
type="text"
|
|
114
|
-
placeholder="Department ID / Code"
|
|
115
|
-
required
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
|
|
119
|
-
<div class="form-group">
|
|
120
|
-
<label for="emp-salary">Annual Salary ($)</label>
|
|
121
|
-
<input
|
|
122
|
-
id="emp-salary"
|
|
123
|
-
v-model="form.salary"
|
|
124
|
-
type="number"
|
|
125
|
-
min="0"
|
|
126
|
-
step="100"
|
|
127
|
-
placeholder="75000"
|
|
128
|
-
required
|
|
129
|
-
/>
|
|
130
|
-
</div>
|
|
131
|
-
|
|
132
|
-
<div class="form-actions">
|
|
133
|
-
<button type="submit" class="btn primary" :disabled="submitting">
|
|
134
|
-
{{ submitting ? 'Saving...' : 'Save Employee' }}
|
|
135
|
-
</button>
|
|
136
|
-
<button type="button" class="btn secondary" @click="handleCancel">
|
|
137
|
-
Cancel
|
|
138
|
-
</button>
|
|
139
|
-
</div>
|
|
140
|
-
</form>
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
</template>
|
|
144
|
-
|
|
145
|
-
<style scoped>
|
|
146
|
-
.add-employee-view {
|
|
147
|
-
max-width: 600px;
|
|
148
|
-
display: flex;
|
|
149
|
-
flex-direction: column;
|
|
150
|
-
gap: 20px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
h2 {
|
|
154
|
-
margin: 0;
|
|
155
|
-
color: #2c3e50;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.card {
|
|
159
|
-
background: #ffffff;
|
|
160
|
-
border: 1px solid #ddd;
|
|
161
|
-
border-radius: 6px;
|
|
162
|
-
padding: 24px;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.emp-form {
|
|
166
|
-
display: flex;
|
|
167
|
-
flex-direction: column;
|
|
168
|
-
gap: 16px;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.form-group {
|
|
172
|
-
display: flex;
|
|
173
|
-
flex-direction: column;
|
|
174
|
-
gap: 6px;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
label {
|
|
178
|
-
font-size: 13px;
|
|
179
|
-
font-weight: bold;
|
|
180
|
-
color: #555;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
input,
|
|
184
|
-
select {
|
|
185
|
-
padding: 10px 12px;
|
|
186
|
-
border: 1px solid #ccc;
|
|
187
|
-
border-radius: 4px;
|
|
188
|
-
font-size: 14px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
input:focus,
|
|
192
|
-
select:focus {
|
|
193
|
-
outline: none;
|
|
194
|
-
border-color: #3498db;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.form-actions {
|
|
198
|
-
display: flex;
|
|
199
|
-
gap: 12px;
|
|
200
|
-
margin-top: 10px;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.btn {
|
|
204
|
-
padding: 10px 20px;
|
|
205
|
-
border: none;
|
|
206
|
-
border-radius: 4px;
|
|
207
|
-
font-size: 14px;
|
|
208
|
-
cursor: pointer;
|
|
209
|
-
font-weight: bold;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.btn:disabled {
|
|
213
|
-
opacity: 0.6;
|
|
214
|
-
cursor: not-allowed;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.btn.primary {
|
|
218
|
-
background: #27ae60;
|
|
219
|
-
color: #fff;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.btn.primary:hover:not(:disabled) {
|
|
223
|
-
background: #219150;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.btn.secondary {
|
|
227
|
-
background: #ecf0f1;
|
|
228
|
-
color: #2c3e50;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.btn.secondary:hover {
|
|
232
|
-
background: #bdc3c7;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.state-msg {
|
|
236
|
-
padding: 10px;
|
|
237
|
-
background-color: #f8f9fa;
|
|
238
|
-
border: 1px solid #ddd;
|
|
239
|
-
border-radius: 4px;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.state-msg.error {
|
|
243
|
-
background-color: #fde8e8;
|
|
244
|
-
color: #c0392b;
|
|
245
|
-
border-color: #f5c6cb;
|
|
246
|
-
}
|
|
247
|
-
</style>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, reactive, onMounted } from 'vue'
|
|
3
|
+
import { useRouter } from 'vue-router'
|
|
4
|
+
import api from '../services/api'
|
|
5
|
+
|
|
6
|
+
const router = useRouter()
|
|
7
|
+
const departments = ref([])
|
|
8
|
+
const loading = ref(false)
|
|
9
|
+
const submitting = ref(false)
|
|
10
|
+
const errorMessage = ref('')
|
|
11
|
+
|
|
12
|
+
const form = reactive({
|
|
13
|
+
name: '',
|
|
14
|
+
email: '',
|
|
15
|
+
departmentId: '',
|
|
16
|
+
salary: ''
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
async function fetchDepartments() {
|
|
20
|
+
loading.value = true
|
|
21
|
+
try {
|
|
22
|
+
const res = await api.get('/departments')
|
|
23
|
+
departments.value = res.data
|
|
24
|
+
if (departments.value.length > 0) {
|
|
25
|
+
form.departmentId = departments.value[0].id
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
errorMessage.value = err.message || 'Failed to fetch departments'
|
|
29
|
+
} finally {
|
|
30
|
+
loading.value = false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function handleAddEmployee() {
|
|
35
|
+
if (!form.name.trim() || !form.email.trim() || !form.salary) return
|
|
36
|
+
submitting.value = true
|
|
37
|
+
errorMessage.value = ''
|
|
38
|
+
try {
|
|
39
|
+
await api.post('/employees', {
|
|
40
|
+
name: form.name.trim(),
|
|
41
|
+
email: form.email.trim(),
|
|
42
|
+
departmentId: form.departmentId,
|
|
43
|
+
salary: Number(form.salary)
|
|
44
|
+
})
|
|
45
|
+
router.push('/employees')
|
|
46
|
+
} catch (err) {
|
|
47
|
+
errorMessage.value = err.message || 'Failed to add employee'
|
|
48
|
+
} finally {
|
|
49
|
+
submitting.value = false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function handleCancel() {
|
|
54
|
+
router.push('/employees')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
fetchDepartments()
|
|
59
|
+
})
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<div class="add-employee-view">
|
|
64
|
+
<h2>Add Employee</h2>
|
|
65
|
+
|
|
66
|
+
<div v-if="loading" class="state-msg">Loading department list...</div>
|
|
67
|
+
<div v-if="errorMessage" class="state-msg error">{{ errorMessage }}</div>
|
|
68
|
+
|
|
69
|
+
<div class="card">
|
|
70
|
+
<form @submit.prevent="handleAddEmployee" class="emp-form">
|
|
71
|
+
<div class="form-group">
|
|
72
|
+
<label for="emp-name">Full Name</label>
|
|
73
|
+
<input
|
|
74
|
+
id="emp-name"
|
|
75
|
+
v-model="form.name"
|
|
76
|
+
type="text"
|
|
77
|
+
placeholder="John Doe"
|
|
78
|
+
required
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div class="form-group">
|
|
83
|
+
<label for="emp-email">Email Address</label>
|
|
84
|
+
<input
|
|
85
|
+
id="emp-email"
|
|
86
|
+
v-model="form.email"
|
|
87
|
+
type="email"
|
|
88
|
+
placeholder="john.doe@example.com"
|
|
89
|
+
required
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div class="form-group">
|
|
94
|
+
<label for="emp-dept">Department</label>
|
|
95
|
+
<select
|
|
96
|
+
v-if="departments.length > 0"
|
|
97
|
+
id="emp-dept"
|
|
98
|
+
v-model="form.departmentId"
|
|
99
|
+
required
|
|
100
|
+
>
|
|
101
|
+
<option
|
|
102
|
+
v-for="dept in departments"
|
|
103
|
+
:key="dept.id"
|
|
104
|
+
:value="dept.id"
|
|
105
|
+
>
|
|
106
|
+
{{ dept.name }} ({{ dept.code }})
|
|
107
|
+
</option>
|
|
108
|
+
</select>
|
|
109
|
+
<input
|
|
110
|
+
v-else
|
|
111
|
+
id="emp-dept"
|
|
112
|
+
v-model="form.departmentId"
|
|
113
|
+
type="text"
|
|
114
|
+
placeholder="Department ID / Code"
|
|
115
|
+
required
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<div class="form-group">
|
|
120
|
+
<label for="emp-salary">Annual Salary ($)</label>
|
|
121
|
+
<input
|
|
122
|
+
id="emp-salary"
|
|
123
|
+
v-model="form.salary"
|
|
124
|
+
type="number"
|
|
125
|
+
min="0"
|
|
126
|
+
step="100"
|
|
127
|
+
placeholder="75000"
|
|
128
|
+
required
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<div class="form-actions">
|
|
133
|
+
<button type="submit" class="btn primary" :disabled="submitting">
|
|
134
|
+
{{ submitting ? 'Saving...' : 'Save Employee' }}
|
|
135
|
+
</button>
|
|
136
|
+
<button type="button" class="btn secondary" @click="handleCancel">
|
|
137
|
+
Cancel
|
|
138
|
+
</button>
|
|
139
|
+
</div>
|
|
140
|
+
</form>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<style scoped>
|
|
146
|
+
.add-employee-view {
|
|
147
|
+
max-width: 600px;
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-direction: column;
|
|
150
|
+
gap: 20px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
h2 {
|
|
154
|
+
margin: 0;
|
|
155
|
+
color: #2c3e50;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.card {
|
|
159
|
+
background: #ffffff;
|
|
160
|
+
border: 1px solid #ddd;
|
|
161
|
+
border-radius: 6px;
|
|
162
|
+
padding: 24px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.emp-form {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
gap: 16px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.form-group {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
gap: 6px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
label {
|
|
178
|
+
font-size: 13px;
|
|
179
|
+
font-weight: bold;
|
|
180
|
+
color: #555;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
input,
|
|
184
|
+
select {
|
|
185
|
+
padding: 10px 12px;
|
|
186
|
+
border: 1px solid #ccc;
|
|
187
|
+
border-radius: 4px;
|
|
188
|
+
font-size: 14px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
input:focus,
|
|
192
|
+
select:focus {
|
|
193
|
+
outline: none;
|
|
194
|
+
border-color: #3498db;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.form-actions {
|
|
198
|
+
display: flex;
|
|
199
|
+
gap: 12px;
|
|
200
|
+
margin-top: 10px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.btn {
|
|
204
|
+
padding: 10px 20px;
|
|
205
|
+
border: none;
|
|
206
|
+
border-radius: 4px;
|
|
207
|
+
font-size: 14px;
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
font-weight: bold;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.btn:disabled {
|
|
213
|
+
opacity: 0.6;
|
|
214
|
+
cursor: not-allowed;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.btn.primary {
|
|
218
|
+
background: #27ae60;
|
|
219
|
+
color: #fff;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.btn.primary:hover:not(:disabled) {
|
|
223
|
+
background: #219150;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.btn.secondary {
|
|
227
|
+
background: #ecf0f1;
|
|
228
|
+
color: #2c3e50;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.btn.secondary:hover {
|
|
232
|
+
background: #bdc3c7;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.state-msg {
|
|
236
|
+
padding: 10px;
|
|
237
|
+
background-color: #f8f9fa;
|
|
238
|
+
border: 1px solid #ddd;
|
|
239
|
+
border-radius: 4px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.state-msg.error {
|
|
243
|
+
background-color: #fde8e8;
|
|
244
|
+
color: #c0392b;
|
|
245
|
+
border-color: #f5c6cb;
|
|
246
|
+
}
|
|
247
|
+
</style>
|