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

successfully project

parent b61018cb
...@@ -55,7 +55,8 @@ class ApplicantController extends Controller ...@@ -55,7 +55,8 @@ class ApplicantController extends Controller
*/ */
public function show($id) 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; ...@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\Company; use App\Company;
use App\User; use App\User;
use App\Job; use App\Job;
use App\Applicant;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class CompanyController extends Controller class CompanyController extends Controller
...@@ -87,10 +88,11 @@ class CompanyController extends Controller ...@@ -87,10 +88,11 @@ class CompanyController extends Controller
{ {
$exists = Company::where('user_id', $id)->exists(); $exists = Company::where('user_id', $id)->exists();
$count = Job::where('user_id', $id)->count(); $count = Job::where('user_id', $id)->count();
$acount = Applicant::join('jobs', 'applicants.job_id', 'jobs.id')->where('jobs.user_id', $id)->count();
if ($exists) { 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 { } 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 @@ ...@@ -66,7 +66,7 @@
ผู้ที่สมัครงาน ผู้ที่สมัครงาน
</v-flex> </v-flex>
<v-flex xs12 sm12 class="subheading font-weight-black" > <v-flex xs12 sm12 class="subheading font-weight-black" >
0 คน {{ countA }} คน
</v-flex> </v-flex>
</v-flex> </v-flex>
<v-flex xs12 sm4 class="text-sm-center text-xs-center"> <v-flex xs12 sm4 class="text-sm-center text-xs-center">
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<v-icon dark small>fas fa-cogs</v-icon>&nbsp;จัดการข้อมูลงาน <v-icon dark small>fas fa-cogs</v-icon>&nbsp;จัดการข้อมูลงาน
</v-btn> </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-icon dark small>fas fa-users</v-icon>&nbsp;จัดการข้อมูลผู้สมัคร
</v-btn> </v-btn>
</v-flex> </v-flex>
...@@ -127,6 +127,7 @@ export default { ...@@ -127,6 +127,7 @@ export default {
user: null, user: null,
exists: false, exists: false,
countJob: 0, countJob: 0,
countA: 0,
companies: { companies: {
about: null, about: null,
addr: null, addr: null,
...@@ -172,6 +173,7 @@ export default { ...@@ -172,6 +173,7 @@ export default {
.then(res => { .then(res => {
console.log(res) console.log(res)
this.exists = res.data.exists this.exists = res.data.exists
this.countA = res.data.acount
this.countJob = res.data.count this.countJob = res.data.count
if (res.data.exists) { if (res.data.exists) {
this.companies = res.data.company this.companies = res.data.company
......
...@@ -23,22 +23,14 @@ ...@@ -23,22 +23,14 @@
no-data-text="ไม่มีข้อมูล" no-data-text="ไม่มีข้อมูล"
> >
<template v-slot:items="props"> <template v-slot:items="props">
<td width="10%" class="text-sm-center">{{ props.item.id }}</td> <td width="10%" class="text-sm-center">{{ props.item.name }}</td>
<td width="30%" class="text-sm-left">{{ props.item.topic }}</td> <td width="35%" class="text-sm-left">{{ props.item.job_title }}</td>
<td width="15%" class="text-sm-center">{{ props.item.typejob }}</td> <td width="10%" class="text-sm-center">{{ props.item.email }}</td>
<td width="20%" class="text-sm-center">{{ props.item.position }}</td> <td width="10%" class="text-sm-center">{{ props.item.degree }}</td>
<td width="5%" class="text-sm-center">{{ props.item.salary }}</td> <td width="10%" class="text-sm-center">{{ props.item.major }}</td>
<td width="20%" class="text-sm-center"> <td width="10%" class="text-sm-center">{{ props.item.faculty }}</td>
<v-layout row wrap justify-center> <td width="10%" class="text-sm-center">{{ props.item.university }}</td>
<v-btn depressed class="mx-1" fab outline small color="cyan" @click="$router.push(`/employer/editjob/${props.item.job_id}`)"> <td width="5%" class="text-sm-center">{{ props.item.gpax }}</td>
<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>
</template> </template>
</v-data-table> </v-data-table>
<v-layout row wrap justify-center> <v-layout row wrap justify-center>
...@@ -53,18 +45,44 @@ export default { ...@@ -53,18 +45,44 @@ export default {
return { return {
search: '', search: '',
headers: [ headers: [
{ text: 'ชื่อผุ้สมัคร', value: 'id', align: 'center' }, { text: 'ชื่อผุ้สมัคร', value: 'name', align: 'center' },
{ text: 'หัวข้องาน', value: 'topic', align: 'center' }, { text: 'หัวข้องาน', value: 'job_title', align: 'center' },
{ text: 'อีเมล', value: 'typejob', align: 'center' }, { text: 'อีเมล', value: 'email', align: 'center' },
{ text: 'ระดับการศึกษา', value: 'position', align: 'center' }, { text: 'ระดับการศึกษา', value: 'degree', align: 'center' },
{ text: 'สาขา', value: 'salary', align: 'center' }, { text: 'สาขา', value: 'major', align: 'center' },
{ text: 'คณะ', value: 'salary', align: 'center' }, { text: 'คณะ', value: 'faculty', align: 'center' },
{ text: 'สถาบัน', value: 'salary', align: 'center' }, { text: 'สถาบัน', value: 'university', align: 'center' },
{ text: 'gpax', value: 'salary', align: 'center' } { text: 'gpax', value: 'gpax', align: 'center' }
], ],
items: [] 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> </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