-
+
@@ -167,6 +167,12 @@ const formData = ref
({
password: ''
});
+function openAddForm() {
+ console.log('Opening add form');
+ showAddForm.value = true;
+ console.log('showAddForm value:', showAddForm.value);
+}
+
// Сброс формы при закрытии
function resetForm() {
formData.value = {
@@ -178,8 +184,14 @@ function resetForm() {
};
}
+// Наблюдаем за изменением showAddForm
+watch(showAddForm, (newValue) => {
+ console.log('showAddForm changed:', newValue);
+});
+
// Наблюдаем за изменением editingEmployee
watch(editingEmployee, (newEmployee) => {
+ console.log('editingEmployee changed:', newEmployee);
if (newEmployee) {
formData.value = {
first_name: newEmployee.first_name,
@@ -198,17 +210,20 @@ function getDepartmentLabel(value: string) {
}
function editEmployee(employee: Employee) {
+ console.log('Editing employee:', employee);
editingEmployee.value = employee;
showAddForm.value = true;
}
function closeForm() {
+ console.log('Closing form');
showAddForm.value = false;
editingEmployee.value = null;
resetForm();
}
async function handleSubmit() {
+ console.log('Submitting form:', formData.value);
try {
const data = { ...formData.value };
if (editingEmployee.value && !data.password) {
@@ -260,6 +275,17 @@ async function fetchEmployees() {
}
onMounted(() => {
+ console.log('Component mounted');
fetchEmployees();
});
-
\ No newline at end of file
+
+
+
\ No newline at end of file