Commit eebd9060 authored by Kittisak Maneewong's avatar Kittisak Maneewong

make edit employer

parent 1b75b354
...@@ -20,12 +20,6 @@ class CompanyController extends Controller ...@@ -20,12 +20,6 @@ class CompanyController extends Controller
return response()->json(['exists' => $exists]); return response()->json(['exists' => $exists]);
} }
public function config($id)
{
$company = User::where('id', $id)->get();
return response()->json(['company' => $company]);
}
public function index() public function index()
{ {
} }
...@@ -96,6 +90,8 @@ class CompanyController extends Controller ...@@ -96,6 +90,8 @@ class CompanyController extends Controller
*/ */
public function show($id) public function show($id)
{ {
$company = Company::where('user_id', $id)->first();
return response()->json(['company' => $company]);
} }
/** /**
...@@ -106,13 +102,8 @@ class CompanyController extends Controller ...@@ -106,13 +102,8 @@ class CompanyController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$exists = Company::where('user_id', $id)->exists(); $company = Company::where('user_id', $id)->first();
if ($exists) { return response()->json(['company' => $company]);
$data = Company::where('user_id', $id)->get();
} else {
$data = User::where('id', $id)->get();
}
return response()->json(['check' => $exists, 'data' => $data]);
} }
/** /**
......
...@@ -39,4 +39,14 @@ class DistrictController extends Controller ...@@ -39,4 +39,14 @@ class DistrictController extends Controller
->get(); ->get();
return response()->json($districts); return response()->json($districts);
} }
public function detailCheck($province, $amphoe, $district, $zipcode)
{
$addr = District::where('province', $province)
->where('amphoe', $amphoe)
->where('district', $district)
->where('zipcode', $zipcode)
->first();
return response()->json(['addr' => $addr]);
}
} }
This diff is collapsed.
...@@ -76,7 +76,10 @@ const router = new VueRouter({ ...@@ -76,7 +76,10 @@ const router = new VueRouter({
{ {
path: 'configcompany', path: 'configcompany',
name: 'configcompany', name: 'configcompany',
component: ConfigCompany component: ConfigCompany,
meta: {
loginEmployer: true
}
}, },
{ {
path: '*', path: '*',
......
...@@ -220,7 +220,6 @@ export default new Vuex.Store({ ...@@ -220,7 +220,6 @@ export default new Vuex.Store({
date: date, date: date,
time: time time: time
}) })
console.log(res)
}) })
.catch(err => { .catch(err => {
console.log(err.response) console.log(err.response)
......
...@@ -416,8 +416,8 @@ export default { ...@@ -416,8 +416,8 @@ export default {
this.company_data.tumbon = this.tumbon.tumbon this.company_data.tumbon = this.tumbon.tumbon
axios.post('/api/companys', this.company_data) axios.post('/api/companys', this.company_data)
.then(res => { .then(res => {
this.loading = false
this.$router.push('/employer') this.$router.push('/employer')
this.loading = false
console.log(res) console.log(res)
}) })
.catch(err => { .catch(err => {
......
This diff is collapsed.
...@@ -83,27 +83,27 @@ ...@@ -83,27 +83,27 @@
<v-divider ></v-divider> <v-divider ></v-divider>
</v-flex> </v-flex>
<v-layout row wrap class="pa-3"> <v-layout row wrap class="pa-3">
<v-flex sm2 xs12 class="text-sm-center text-xs-center"> <v-flex sm3 xs12 class="text-sm-center text-xs-center">
<img src="https://www.jobbkk.com/upload/employer/0A/86A/00786A/images/308262.png" alt="" height="160"> <img :src="companies.imageCompany" alt="" height="160">
</v-flex> </v-flex>
<v-flex xs12 sm10 class="px-3"> <v-flex xs12 sm9 class="px-3">
<v-flex xs12 sm12> <v-flex xs12 sm12>
<label class="font-weight-bold subheading green--text">บริษัท พีพี ออนไทม์ จำกัด</label> <label class="font-weight-bold subheading green--text">{{ companies.company_name }}</label>
</v-flex> </v-flex>
<v-flex xs12 sm12> <v-flex xs12 sm12>
<label class="body-2">1011 อาคารศุภาลัย แกรนด์ ทาวเวอร์ ชั้น 16 ถนนพระราม 3 แขวงช่องนนทรี เขตยานนาวา จังหวัดกรุงเทพมหานคร 10120</label> <label class="body-2">{{ companies.addr }} {{ companies.tambon }} {{ companies.amphoe }} {{ companies.province }} {{ companies.zipcode }}</label>
</v-flex> </v-flex>
<v-flex xs12 sm12 class="mt-1"> <v-flex xs12 sm12 class="mt-1">
<label class="caption"><v-icon small>email</v-icon> kittipong.ma.59@ubu.ac.th</label> <label class="caption"><v-icon small>email</v-icon> {{ companies.email }}</label>
</v-flex> </v-flex>
<v-flex xs12 sm12> <v-flex xs12 sm12>
<label class="caption"><v-icon small>desktop_mac</v-icon> http://www.pp-ontime.co.th/</label> <label class="caption"><v-icon small>desktop_mac</v-icon> {{ companies.website ? companies.website : ' - ' }}</label>
</v-flex> </v-flex>
<v-flex xs12 sm12> <v-flex xs12 sm12>
<label class="caption"><v-icon small>phone</v-icon> โทร. 02-056-2099</label> <label class="caption"><v-icon small>phone</v-icon> โทร. {{ companies.phone_no ? companies.phone_no : ' - ' }}</label>
</v-flex> </v-flex>
<v-flex xs12 sm12> <v-flex xs12 sm12>
<label class="caption"><v-icon small>print</v-icon> แฟกซ์. : 02-056-2088</label> <label class="caption"><v-icon small>print</v-icon> แฟกซ์. : {{ companies.fax ? companies.fax : ' - ' }}</label>
</v-flex> </v-flex>
<v-flex xs12 sm12> <v-flex xs12 sm12>
<v-btn small depressed dark color="red" @click="$router.push('/employer/editcompany')"> <v-btn small depressed dark color="red" @click="$router.push('/employer/editcompany')">
...@@ -119,6 +119,37 @@ ...@@ -119,6 +119,37 @@
<script> <script>
export default { export default {
data () {
return {
companies: {
about: null,
addr: null,
amphoe: null,
another: null,
arl: null,
bts: null,
bus: null,
company_name: null,
company_owner: null,
created_at: null,
email: null,
fax: null,
id: null,
imageCompany: null,
imageMap: null,
lat: null,
long: null,
mrt: null,
phone_no: null,
province: null,
tambon: null,
updated_at: null,
user_id: null,
website: null,
zipcode: null
}
}
},
computed: { computed: {
date () { date () {
return this.$store.getters.getTime.date return this.$store.getters.getTime.date
...@@ -126,6 +157,25 @@ export default { ...@@ -126,6 +157,25 @@ export default {
time () { time () {
return this.$store.getters.getTime.time return this.$store.getters.getTime.time
} }
},
beforeMount() {
this.$store.dispatch('checkEmployer')
.then(res => {
axios.get(`/api/companys/${res.id}`)
.then(res => {
this.companies = res.data.company
if (!this.companies.imageCompany) {
this.companies.imageCompany = 'https://asianinteriorservices.com/wp-content/uploads/2018/04/noImg.png'
} else {
// this.companies.imageCompany = '../../../storage/uploads/'+this.companies.imageCompany
this.companies.imageCompany = '../../../public/img/logologin.png'
console.log(this.companies.imageCompany)
}
})
.catch(err => {
console.log(err.response)
})
})
} }
} }
</script> </script>
......
...@@ -21,9 +21,9 @@ Route::group(['prefix' => 'auth'], function ($router) { ...@@ -21,9 +21,9 @@ Route::group(['prefix' => 'auth'], function ($router) {
Route::resource('/companys', 'CompanyController'); Route::resource('/companys', 'CompanyController');
Route::get('/companys/{company}/check', 'CompanyController@check')->name('companys.check'); Route::get('/companys/{company}/check', 'CompanyController@check')->name('companys.check');
Route::get('/companys/{company}/config', 'CompanyController@config')->name('companys.config');
Route::get('/province','DistrictController@provinces'); Route::get('/province','DistrictController@provinces');
Route::get('/province/{province_code}/amphoe','DistrictController@amphoes'); Route::get('/province/{province_code}/amphoe','DistrictController@amphoes');
Route::get('/province/{province_code}/amphoe/{amphoe_code}/district','DistrictController@districts'); Route::get('/province/{province_code}/amphoe/{amphoe_code}/district','DistrictController@districts');
Route::get('/province/{province_code}/amphoe/{amphoe_code}/district/{district_code}','DistrictController@detail'); Route::get('/province/{province_code}/amphoe/{amphoe_code}/district/{district_code}','DistrictController@detail');
Route::get('/{province}/{amphoe}/{district}/{zipcode}','DistrictController@detailCheck');
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