Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
CO-OP Search
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kittisak Maneewong
CO-OP Search
Commits
3ee5840a
Commit
3ee5840a
authored
Apr 22, 2019
by
Kittisak Maneewong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
eed7fd8e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
42 deletions
+83
-42
CompanyController.php
app/Http/Controllers/CompanyController.php
+6
-2
Company1555931638.jpeg
public/uploads/Company1555931638.jpeg
+0
-0
Company1555933028.jpeg
public/uploads/Company1555933028.jpeg
+0
-0
route.js
resources/js/route.js
+0
-24
ConfigCompany.vue
resources/js/views/ConfigCompany.vue
+77
-16
No files found.
app/Http/Controllers/CompanyController.php
View file @
3ee5840a
...
...
@@ -102,8 +102,12 @@ class CompanyController extends Controller
*/
public
function
edit
(
$id
)
{
$company
=
Company
::
where
(
'user_id'
,
$id
)
->
first
();
return
response
()
->
json
([
'company'
=>
$company
]);
$exists
=
Company
::
where
(
'user_id'
,
$id
)
->
exists
();
if
(
$exists
)
{
return
response
()
->
json
([
'exists'
=>
true
,
'company'
=>
Company
::
where
(
'user_id'
,
$id
)
->
first
()]);
}
else
{
return
response
()
->
json
([
'exists'
=>
false
,
'company'
=>
User
::
where
(
'id'
,
$id
)
->
first
()]);
}
}
/**
...
...
public/uploads/Company1555931638.jpeg
0 → 100644
View file @
3ee5840a
37.1 KB
public/uploads/Company1555933028.jpeg
0 → 100644
View file @
3ee5840a
This diff is collapsed.
Click to expand it.
resources/js/route.js
View file @
3ee5840a
...
...
@@ -124,30 +124,6 @@ router.beforeEach((to, from, next) => {
}
else
{
next
()
}
}
else
if
(
to
.
matched
.
some
(
record
=>
record
.
meta
.
loginEmployer
))
{
if
(
!
localStorage
.
getItem
(
'access_token_employer'
))
{
next
(
'/employer/login'
)
}
else
if
(
to
.
matched
.
some
(
record
=>
record
.
meta
.
configProfile
))
{
axios
.
get
(
'/api/auth/current'
,
{
headers
:
{
Authorization
:
`Bearer
${
localStorage
.
getItem
(
'access_token_employer'
)}
`
}
})
.
then
(
res
=>
{
axios
.
get
(
`/api/companys/
${
res
.
data
.
user
.
id
}
/check`
)
.
then
(
res
=>
{
if
(
res
.
data
.
exists
)
{
next
()
}
else
{
next
(
'/employer/configcompany'
)
}
})
.
catch
(
err
=>
{
next
()})
})
.
catch
(
err
=>
{
next
()})
}
else
{
next
()
}
}
else
{
next
()
}
...
...
resources/js/views/ConfigCompany.vue
View file @
3ee5840a
...
...
@@ -5,7 +5,7 @@
<v-icon
color=
"black"
>
business
</v-icon>
ข้อมูลบริษัท
<v-divider></v-divider>
</v-flex>
<v-form
enctype=
"multipart/form-data"
@
submit
.
prevent=
"c
reateJob
()"
ref=
"create"
>
<v-form
enctype=
"multipart/form-data"
@
submit
.
prevent=
"c
onfigCompany
()"
ref=
"create"
>
<v-flex
sm12
xs12
>
<v-layout
row
wrap
class=
"ป pa-3"
>
<v-flex
sm4
xs12
class=
"px-3"
>
...
...
@@ -246,6 +246,9 @@ export default {
status
:
'ยังไม่ได้เลือกไฟล์'
,
nameImage
:
null
,
company_data
:
{
currentImageCompany
:
null
,
currentImageMap
:
null
,
exists
:
false
,
user_id
:
null
,
imageCompany
:
'https://asianinteriorservices.com/wp-content/uploads/2018/04/noImg.png'
,
company_name
:
''
,
...
...
@@ -405,7 +408,7 @@ export default {
this
.
company_data
.
imageMap
=
e
.
target
.
result
}
},
c
reateJob
()
{
c
onfigCompany
()
{
this
.
loading
=
true
if
(
this
.
amphoes
.
findIndex
(
x
=>
x
.
amphoe_code
===
this
.
amphoe
.
amphoe_code
)
===
-
1
)
{
this
.
amphoe
=
''
}
if
(
this
.
tumbons
.
findIndex
(
x
=>
x
.
tumbon_code
===
this
.
tumbon
.
tumbon_code
)
===
-
1
)
{
this
.
tumbon
=
''
}
...
...
@@ -414,16 +417,21 @@ export default {
this
.
company_data
.
province
=
this
.
province
.
province
this
.
company_data
.
amphoe
=
this
.
amphoe
.
amphoe
this
.
company_data
.
tumbon
=
this
.
tumbon
.
tumbon
axios
.
post
(
'/api/companys'
,
this
.
company_data
)
.
then
(
res
=>
{
this
.
$router
.
push
(
'/employer'
)
this
.
loading
=
false
console
.
log
(
res
)
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
this
.
loading
=
false
})
if
(
this
.
company_data
.
exists
)
{
console
.
log
(
'true'
)
}
else
{
console
.
log
(
false
)
axios
.
post
(
'/api/companys'
,
this
.
company_data
)
.
then
(
res
=>
{
this
.
$router
.
push
(
'/employer'
)
this
.
loading
=
false
console
.
log
(
res
)
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
this
.
loading
=
false
})
}
}
else
{
this
.
$Loading
.
error
()
this
.
loading
=
false
...
...
@@ -497,10 +505,63 @@ export default {
beforeMount
()
{
this
.
$store
.
dispatch
(
'checkEmployer'
)
.
then
(
res
=>
{
this
.
company_data
.
company_name
=
res
.
company_name
this
.
company_data
.
email
=
res
.
email_employers
this
.
company_data
.
phone_no
=
res
.
tel
this
.
company_data
.
user_id
=
res
.
id
axios
.
get
(
`/api/companys/
${
res
.
id
}
/edit`
)
.
then
(
res
=>
{
console
.
log
(
res
)
const
data
=
res
.
data
.
company
if
(
res
.
data
.
exists
)
{
this
.
company_data
.
currentImageCompany
=
res
.
data
.
imageCompany
this
.
company_data
.
currentImageMap
=
res
.
data
.
imageMap
this
.
company_data
.
exists
=
res
.
data
.
exists
this
.
company_data
.
about
=
data
.
about
this
.
company_data
.
addr
=
data
.
addr
this
.
company_data
.
another
=
data
.
another
this
.
company_data
.
arl
=
data
.
arl
this
.
company_data
.
bts
=
data
.
bts
this
.
company_data
.
bus
=
data
.
bus
this
.
company_data
.
company_name
=
data
.
company_name
this
.
company_data
.
company_owner
=
data
.
company_owner
this
.
company_data
.
email
=
data
.
email
this
.
company_data
.
fax
=
data
.
fax
this
.
company_data
.
imageCompany
=
data
.
imageCompany
this
.
company_data
.
imageMap
=
data
.
imageMap
this
.
company_data
.
lat
=
data
.
lat
*
1
this
.
company_data
.
lng
=
data
.
long
*
1
this
.
company_data
.
mrt
=
data
.
mrt
this
.
company_data
.
phone_no
=
data
.
phone_no
this
.
company_data
.
website
=
data
.
website
this
.
company_data
.
user_id
=
data
.
user_id
if
(
this
.
company_data
.
lat
)
{
this
.
place
=
'_'
;
}
axios
.
get
(
`/api/
${
data
.
province
}
/
${
data
.
amphoe
}
/
${
data
.
tambon
}
/
${
data
.
zipcode
}
`
)
.
then
(
res
=>
{
this
.
province
=
{
province
:
res
.
data
.
addr
.
province
,
province_code
:
res
.
data
.
addr
.
province_code
}
this
.
amphoe
=
{
amphoe
:
res
.
data
.
addr
.
amphoe
,
amphoe_code
:
res
.
data
.
addr
.
amphoe_code
}
this
.
tumbon
=
{
tumbon
:
res
.
data
.
addr
.
district
,
tumbon_code
:
res
.
data
.
addr
.
district_code
}
this
.
showAmphoes
()
this
.
showTumbons
()
this
.
company_data
.
zip_code
=
data
.
zipcode
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)})
}
else
{
this
.
company_data
.
company_name
=
data
.
company_name
this
.
company_data
.
email
=
data
.
email_employers
this
.
company_data
.
phone_no
=
data
.
tel
this
.
company_data
.
user_id
=
data
.
id
this
.
company_data
.
exists
=
res
.
data
.
exists
}
})
.
catch
(
err
=>
{
console
.
log
(
err
)})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment