Commit 590108b0 authored by Kittisak Maneewong's avatar Kittisak Maneewong

successfully project

parent b61018cb
......@@ -55,7 +55,8 @@ class ApplicantController extends Controller
*/
public function show($id)
{
//
$applicants = Applicant::join('jobs', 'applicants.job_id', 'jobs.id')->where('jobs.user_id', $id)->get();
return response()->json(['applicants' => $applicants]);
}
/**
......
......@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Company;
use App\User;
use App\Job;
use App\Applicant;
use Illuminate\Http\Request;
class CompanyController extends Controller
......@@ -87,10 +88,11 @@ class CompanyController extends Controller
{
$exists = Company::where('user_id', $id)->exists();
$count = Job::where('user_id', $id)->count();
$acount = Applicant::join('jobs', 'applicants.job_id', 'jobs.id')->where('jobs.user_id', $id)->count();
if ($exists) {
return response()->json(['exists' => true, 'company' => Company::where('user_id', $id)->first(), 'count' => $count]);
return response()->json(['exists' => true, 'company' => Company::where('user_id', $id)->first(), 'count' => $count, 'acount' => $acount]);
} else {
return response()->json(['exists' => false, 'company' => User::where('id', $id)->first(), 'count' => $count]);
return response()->json(['exists' => false, 'company' => User::where('id', $id)->first(), 'count' => $count, 'acount' => $acount]);
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -66,7 +66,7 @@
ผู้ที่สมัครงาน
</v-flex>
<v-flex xs12 sm12 class="subheading font-weight-black" >
0 คน
{{ countA }} คน
</v-flex>
</v-flex>
<v-flex xs12 sm4 class="text-sm-center text-xs-center">
......@@ -74,7 +74,7 @@
<v-icon dark small>fas fa-cogs</v-icon>&nbsp;จัดการข้อมูลงาน
</v-btn>
<v-btn small depressed color="primary" dark>
<v-btn small depressed color="primary" dark @click="$router.push('/employer/showapplicant')">
<v-icon dark small>fas fa-users</v-icon>&nbsp;จัดการข้อมูลผู้สมัคร
</v-btn>
</v-flex>
......@@ -127,6 +127,7 @@ export default {
user: null,
exists: false,
countJob: 0,
countA: 0,
companies: {
about: null,
addr: null,
......@@ -172,6 +173,7 @@ export default {
.then(res => {
console.log(res)
this.exists = res.data.exists
this.countA = res.data.acount
this.countJob = res.data.count
if (res.data.exists) {
this.companies = res.data.company
......
......@@ -23,22 +23,14 @@
no-data-text="ไม่มีข้อมูล"
>
<template v-slot:items="props">
<td width="10%" class="text-sm-center">{{ props.item.id }}</td>
<td width="30%" class="text-sm-left">{{ props.item.topic }}</td>
<td width="15%" class="text-sm-center">{{ props.item.typejob }}</td>
<td width="20%" class="text-sm-center">{{ props.item.position }}</td>
<td width="5%" class="text-sm-center">{{ props.item.salary }}</td>
<td width="20%" class="text-sm-center">
<v-layout row wrap justify-center>
<v-btn depressed class="mx-1" fab outline small color="cyan" @click="$router.push(`/employer/editjob/${props.item.job_id}`)">
<v-icon>edit</v-icon>
</v-btn>
<v-btn depressed class="mx-1" fab outline small color="red" @click="deleteJob(props.item.job_id)">
<v-icon>delete</v-icon>
</v-btn>
</v-layout>
</td>
<td width="10%" class="text-sm-center">{{ props.item.name }}</td>
<td width="35%" class="text-sm-left">{{ props.item.job_title }}</td>
<td width="10%" class="text-sm-center">{{ props.item.email }}</td>
<td width="10%" class="text-sm-center">{{ props.item.degree }}</td>
<td width="10%" class="text-sm-center">{{ props.item.major }}</td>
<td width="10%" class="text-sm-center">{{ props.item.faculty }}</td>
<td width="10%" class="text-sm-center">{{ props.item.university }}</td>
<td width="5%" class="text-sm-center">{{ props.item.gpax }}</td>
</template>
</v-data-table>
<v-layout row wrap justify-center>
......@@ -53,18 +45,44 @@ export default {
return {
search: '',
headers: [
{ text: 'ชื่อผุ้สมัคร', value: 'id', align: 'center' },
{ text: 'หัวข้องาน', value: 'topic', align: 'center' },
{ text: 'อีเมล', value: 'typejob', align: 'center' },
{ text: 'ระดับการศึกษา', value: 'position', align: 'center' },
{ text: 'สาขา', value: 'salary', align: 'center' },
{ text: 'คณะ', value: 'salary', align: 'center' },
{ text: 'สถาบัน', value: 'salary', align: 'center' },
{ text: 'gpax', value: 'salary', align: 'center' }
{ text: 'ชื่อผุ้สมัคร', value: 'name', align: 'center' },
{ text: 'หัวข้องาน', value: 'job_title', align: 'center' },
{ text: 'อีเมล', value: 'email', align: 'center' },
{ text: 'ระดับการศึกษา', value: 'degree', align: 'center' },
{ text: 'สาขา', value: 'major', align: 'center' },
{ text: 'คณะ', value: 'faculty', align: 'center' },
{ text: 'สถาบัน', value: 'university', align: 'center' },
{ text: 'gpax', value: 'gpax', align: 'center' }
],
items: []
}
},
beforeMount () {
this.$store.dispatch('checkEmployer')
.then(res => {
axios.get(`/api/applicants/${res.id}`)
.then(res => {
console.log(res)
this.items = []
res.data.applicants.forEach(item => {
this.items.push({
name: item.name,
job_title: item.job_title,
email: item.email,
degree: item.degree,
major: item.major,
faculty: item.faculty,
university: item.university,
gpax: item.gpax
})
});
})
.catch(err => {console.log(err.response)})
})
.catch(err => {
console.log(err.response)
})
}
}
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment