add averias

This commit is contained in:
John Galt 2024-11-10 20:32:26 +01:00
parent 42f5e89241
commit 48c7b0fe56
6 changed files with 41 additions and 41 deletions

View File

@ -1,7 +1,7 @@
<script setup>
import MainSideNav from '@/components/SideBar/MainSideNav.vue';
import Header from '@/components/Header/Header.vue';
import Employees from './Employee/Employees/Employees.vue'
// import Employees from './Employee/Employees/Employees.vue'
import { RouterView,useRouter } from 'vue-router';
import Authenticate from '@/Store/Authenticate';

View File

@ -1,11 +1,11 @@
<script setup>
import BreadCrumb from "../../../components/BreadCrumb/BreadCrumb.vue";
import EmployeeService from "../../../Services/Employee/EmployeeService";
import BreadCrumb from "../../../../components/BreadCrumb/BreadCrumb.vue";
import EmployeeService from "../../../../Services/Employee/EmployeeService";
import { useToast } from "vue-toastification";
import { useRouter } from "vue-router";
import { ref } from "vue";
import { Form, Field } from "vee-validate";
import EmpYup from "../../../Validation/EmpYup/EmpYup";
import EmpYup from "../../../../Validation/EmpYup/EmpYup";
const router = useRouter();
const loading = ref(false);

View File

@ -1,9 +1,9 @@
<script setup>
import BreadCrumb from '../../../components/BreadCrumb/BreadCrumb.vue'
import EmployeeItem from './EmployeeItem/EmployeeItem.vue';
import Paginator from '../../../components/Paginator/Paginator.vue'
import BreadCrumb from '../../../../components/BreadCrumb/BreadCrumb.vue'
import AveriaItem from '../Averias/AveriasItem/AveriaItem.vue';
import Paginator from '../../../../components/Paginator/Paginator.vue'
import { useRouter } from 'vue-router';
import EmployeeService from '@/Services/Employee/EmployeeService';
import AveriaService from '@/Services/Averia/AveriaService';
import { computed, onBeforeMount, onMounted, ref } from 'vue';
import { useToast } from 'vue-toastification';
@ -17,7 +17,7 @@ const searchQuery = ref('')
const fetchData = async () => {
try {
loading.value = true
const response = await EmployeeService.getAllEmp()
const response = await AveriaService.getAllEmp()
if (response.data.page) {
empCount.value = response.data.totalItems
empList.value = response.data.items
@ -33,7 +33,7 @@ const fetchData = async () => {
const handleEmpDelete = async (empId) => {
try {
loading.value = true
const response = await EmployeeService.deleteEmp(empId)
const response = await AveriaService.deleteEmp(empId)
toast.success('Deleted')
} catch (error) {
if (error.response.data.code === 400) {
@ -67,7 +67,7 @@ onMounted(() => {
<template>
<main class="main-content-wrapper pt-14">
<div class="container">
<BreadCrumb :iconName="'fa-user-nurse'" :title="'Employees'" />
<BreadCrumb :iconName="'fa-user-nurse'" :title="'Averias'" />
<div class="row">
<div class="col-xl-12 col-12 mb-5">
<div class="card h-100 card">
@ -79,12 +79,12 @@ onMounted(() => {
placeholder="Search Seller" aria-label="Search" />
</div>
<div class="d-flex justify-content-start align-items-center" role="search">
<h4>Employee List</h4>
<h4>Averia List</h4>
</div>
</div>
<div class="col-md-6 text-end">
<button @click="router.push('/app/addEmployee')" class='btn btn-dark'>Add
Employee</button>
<button @click="router.push('/app/addAveria')" class='btn btn-dark'>Add
Averia</button>
</div>
</div>
</div>
@ -96,7 +96,7 @@ onMounted(() => {
<table class="table table-centered table-hover text-nowrap table-borderless mb-0">
<thead class="bg-light">
<tr>
<th>Employee Id</th>
<th>Averia Id</th>
<th>Name</th>
<th>Email</th>
<th>Store Code</th>
@ -104,7 +104,7 @@ onMounted(() => {
<th></th>
</tr>
</thead>
<EmployeeItem @deleteEmployee="handleEmpDelete" :empList="empList" />
<AveriaItem @deleteAveria="handleEmpDelete" :empList="empList" />
</table>
</div>
<Paginator :total="+empCount" />

View File

@ -7,10 +7,10 @@ const props = defineProps({
}
})
const emit = defineEmits([
'deleteEmployee'
'deleteAveria'
])
const deleteEmp = (id) => {
emit('deleteEmployee',id)
emit('deleteAveria',id)
}
const router = useRouter()
</script>
@ -24,7 +24,7 @@ const router = useRouter()
<td>{{ emp.storecode }}</td>
<td>{{ emp.country }}</td>
<td>
<i class="fa-solid fa-pencil text-warning fs-5 mx-10" @click="router.push(`/app/editEmployee/${emp.id}`)"
<i class="fa-solid fa-pencil text-warning fs-5 mx-10" @click="router.push(`/app/editAveria/${emp.id}`)"
style="cursor: pointer;" />
<i @click="deleteEmp(emp.id)" class="fa-solid fa-trash text-danger fs-5" style="cursor: pointer;" />
</td>

View File

@ -1,7 +1,7 @@
<script setup>
import BreadCrumb from '../../../components/BreadCrumb/BreadCrumb.vue';
import BreadCrumb from '../../../../components/BreadCrumb/BreadCrumb.vue';
import { useRoute, useRouter } from 'vue-router';
import EmployeeService from '@/Services/Employee/EmployeeService';
import AveriaService from '@/Services/Averia/AveriaService';
import { useToast } from 'vue-toastification';
import { onMounted, ref } from 'vue';
import { Form, Field } from 'vee-validate';
@ -22,7 +22,7 @@ const empInit = ref({
const fetchEmpById = async (id) => {
try {
loading.value = true
const response = await EmployeeService.getEmpById(id)
const response = await AveriaService.getEmpById(id)
if (response.data.id) {
empInit.value.email = response.data.email
empInit.value.name = response.data.name
@ -46,11 +46,11 @@ const editEmp = async () => {
storecode: empInit.value.storecode,
country: empInit.value.country,
};
const response = await EmployeeService.updateEmp(data,id)
const response = await AveriaService.updateEmp(data,id)
if (response.data.id) {
loading.value=false
toast.success("Succesfully Updated");
router.push("/app/employees");
router.push("/app/Averias");
}
} catch (error) {
if (error.response.data.code === 400) {
@ -74,7 +74,7 @@ onMounted(() => {
<template>
<main className="main-content-wrapper pb-6 px-0 px-md-4 pt-14">
<div className="container">
<BreadCrumb :title="'Edit Employee'" :iconName="'fa-user-nurse'" />
<BreadCrumb :title="'Edit Averia'" :iconName="'fa-user-nurse'" />
<div className="row">
<div className="col-md-8 offset-md-2 col-12 mb-5">
<h4 v-if="loading" class="text-center my-4 mb-10" >Fetching Data ....</h4>
@ -106,7 +106,7 @@ onMounted(() => {
</div>
<div class="col-12 text-end">
<button :disabled="loading" type="submit" class="btn btn-primary">
Edit Employee
Edit Averia
</button>
</div>
</div>

View File

@ -10,9 +10,9 @@ import AddEmployee from '../Pages/AppStack/Employee/AddEmp/AddEmp.vue'
import EditEmployee from '../Pages/AppStack/Employee/EditEmp/EditEmpl.vue'
// import Averias from '@/Pages/AppStack/Averias/Averias.vue'
// import AddAveria from '../Pages/AppStack/AddAveria/AddAveria.vue'
// import EditAveria from '../Pages/AppStack/EditAveria/EditAveria.vue'
import Averias from '@/Pages/AppStack/Averia/Averias/Averias.vue'
import AddAveria from '../Pages/AppStack/Averia/AddAveria/AddAveria.vue'
import EditAveria from '../Pages/AppStack/Averia/EditAveria/EditAveria.vue'
@ -57,20 +57,20 @@ const router = createRouter({
component:EditEmployee
},
// {
// path: 'averias',
// component: Averias
// },
// {
// path: 'addAveria',
// component:AddAveria
{
path: 'averias',
component: Averias
},
{
path: 'addAveria',
component:AddAveria
// },
// {
// path: 'editAveria/:id',
// component:EditAveria
},
{
path: 'editAveria/:id',
component:EditAveria
// },
},
{
path: 'dashboard',
component: ''