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
1b75b354
Commit
1b75b354
authored
Apr 21, 2019
by
Kittisak Maneewong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add configemployer
parent
bc039636
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
150 additions
and
19 deletions
+150
-19
CompanyController.php
app/Http/Controllers/CompanyController.php
+21
-3
app.js
public/js/app.js
+0
-0
app.js
resources/js/app.js
+10
-0
AppLayout.vue
resources/js/layouts/AppLayout.vue
+1
-1
EmployerLayout.vue
resources/js/layouts/EmployerLayout.vue
+1
-1
route.js
resources/js/route.js
+52
-5
store.js
resources/js/store.js
+4
-0
ConfigCompany.vue
resources/js/views/ConfigCompany.vue
+0
-0
EditCompany.vue
resources/js/views/EditCompany.vue
+56
-6
app.blade.php
resources/views/app.blade.php
+1
-0
api.php
routes/api.php
+4
-0
web.php
routes/web.php
+0
-3
Company1555790173.png
storage/uploads/Company1555790173.png
+0
-0
Company1555815059.png
storage/uploads/Company1555815059.png
+0
-0
Company1555815588.png
storage/uploads/Company1555815588.png
+0
-0
Company1555815644.png
storage/uploads/Company1555815644.png
+0
-0
Company1555815895.png
storage/uploads/Company1555815895.png
+0
-0
Company1555816102.png
storage/uploads/Company1555816102.png
+0
-0
Map1555815060.png
storage/uploads/Map1555815060.png
+0
-0
No files found.
app/Http/Controllers/CompanyController.php
View file @
1b75b354
...
...
@@ -3,6 +3,7 @@
namespace
App\Http\Controllers
;
use
App\Company
;
use
App\User
;
use
Illuminate\Http\Request
;
class
CompanyController
extends
Controller
...
...
@@ -12,9 +13,21 @@ class CompanyController extends Controller
*
* @return \Illuminate\Http\Response
*/
public
function
check
(
$id
)
{
$exists
=
Company
::
where
(
'user_id'
,
$id
)
->
exists
();
return
response
()
->
json
([
'exists'
=>
$exists
]);
}
public
function
config
(
$id
)
{
$company
=
User
::
where
(
'id'
,
$id
)
->
get
();
return
response
()
->
json
([
'company'
=>
$company
]);
}
public
function
index
()
{
//
}
/**
...
...
@@ -83,7 +96,6 @@ class CompanyController extends Controller
*/
public
function
show
(
$id
)
{
//
}
/**
...
...
@@ -94,7 +106,13 @@ class CompanyController extends Controller
*/
public
function
edit
(
$id
)
{
//
$exists
=
Company
::
where
(
'user_id'
,
$id
)
->
exists
();
if
(
$exists
)
{
$data
=
Company
::
where
(
'user_id'
,
$id
)
->
get
();
}
else
{
$data
=
User
::
where
(
'id'
,
$id
)
->
get
();
}
return
response
()
->
json
([
'check'
=>
$exists
,
'data'
=>
$data
]);
}
/**
...
...
public/js/app.js
View file @
1b75b354
This diff is collapsed.
Click to expand it.
resources/js/app.js
View file @
1b75b354
...
...
@@ -3,6 +3,16 @@ window.Vue = require('vue');
window
.
_
=
require
(
'lodash'
);
window
.
axios
=
require
(
'axios'
);
window
.
axios
.
defaults
.
headers
.
common
[
'X-Requested-With'
]
=
'XMLHttpRequest'
;
let
token
=
document
.
head
.
querySelector
(
'meta[name="csrf-token"]'
);
if
(
token
)
{
window
.
axios
.
defaults
.
headers
.
common
[
'X-CSRF-TOKEN'
]
=
token
.
content
;
}
else
{
console
.
error
(
'CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'
);
}
window
.
axios
.
defaults
.
baseUrl
=
'http://localhost:8000/'
;
...
...
resources/js/layouts/AppLayout.vue
View file @
1b75b354
...
...
@@ -27,7 +27,7 @@ export default {
Footer
,
Snackbar
},
created
()
{
beforeMount
()
{
this
.
$store
.
dispatch
(
'checkUser'
)
}
}
...
...
resources/js/layouts/EmployerLayout.vue
View file @
1b75b354
...
...
@@ -27,7 +27,7 @@ export default {
Footer
,
Snackbar
},
created
()
{
beforeMount
()
{
this
.
$store
.
dispatch
(
'checkEmployer'
)
}
}
...
...
resources/js/route.js
View file @
1b75b354
...
...
@@ -14,8 +14,10 @@ import LoginEmployer from './views/LoginEmployer.vue';
import
PageNotFound
from
'./views/PageNotFound.vue'
;
import
EditCompany
from
'./views/EditCompany.vue'
;
import
RegisterEmployer
from
'./views/RegisterEmployer'
;
import
ManagejobEmployer
from
'./views/managejob.vue'
import
ManagejobEmployer
from
'./views/managejob.vue'
;
import
ConfigCompany
from
'./views/ConfigCompany.vue'
;
import
AddJob
from
'./views/AddJob.vue'
;
import
Axios
from
'axios'
;
const
router
=
new
VueRouter
({
mode
:
'history'
,
...
...
@@ -28,7 +30,11 @@ const router = new VueRouter({
{
path
:
''
,
name
:
'Employer'
,
component
:
Employer
component
:
Employer
,
meta
:
{
loginEmployer
:
true
,
configProfile
:
true
}
},
{
path
:
'login'
,
...
...
@@ -43,17 +49,34 @@ const router = new VueRouter({
{
path
:
'managejob'
,
name
:
'managejobEmployer'
,
component
:
ManagejobEmployer
component
:
ManagejobEmployer
,
meta
:
{
loginEmployer
:
true
,
configProfile
:
true
}
},
{
path
:
'editcompany'
,
name
:
'editcompany'
,
component
:
EditCompany
component
:
EditCompany
,
meta
:
{
loginEmployer
:
true
,
configProfile
:
true
}
},
{
path
:
'addjob'
,
name
:
'addjob'
,
component
:
AddJob
component
:
AddJob
,
meta
:
{
loginEmployer
:
true
,
configProfile
:
true
}
},
{
path
:
'configcompany'
,
name
:
'configcompany'
,
component
:
ConfigCompany
},
{
path
:
'*'
,
...
...
@@ -98,6 +121,30 @@ 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/store.js
View file @
1b75b354
...
...
@@ -196,6 +196,7 @@ export default new Vuex.Store({
}
},
checkEmployer
({
commit
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
!!
localStorage
.
getItem
(
'access_token_employer'
))
{
axios
.
get
(
'/api/auth/current'
,
{
headers
:
{
...
...
@@ -203,6 +204,7 @@ export default new Vuex.Store({
}
})
.
then
(
res
=>
{
resolve
(
res
.
data
.
user
)
commit
(
'setEmployer'
,
{
id
:
res
.
data
.
user
.
id
,
username
:
res
.
data
.
user
.
username
,
...
...
@@ -222,8 +224,10 @@ export default new Vuex.Store({
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
reject
(
err
.
response
)
})
}
})
}
},
getters
:
{
...
...
resources/js/views/ConfigCompany.vue
0 → 100644
View file @
1b75b354
This diff is collapsed.
Click to expand it.
resources/js/views/EditCompany.vue
View file @
1b75b354
...
...
@@ -25,6 +25,7 @@
<v-flex
sm4
xs12
class=
"px-3"
>
<label
class=
"font-weight-bold"
>
ชื่อบริษัท
<span
class=
"red--text"
>
*
</span></label>
<v-text-field
readonly
outline
label=
"ชื่อบริษัท"
:rules=
"[rules.required]"
...
...
@@ -51,6 +52,7 @@
<v-flex
sm4
xs12
class=
"px-3"
>
<label
class=
"font-weight-bold"
>
อีเมล
<span
class=
"red--text"
>
*
</span></label>
<v-text-field
readonly
outline
label=
"อีเมล"
v-model=
"company_data.email"
...
...
@@ -227,7 +229,7 @@
<span
>
เพื่อความสะดวกในการเดินทางของผู้สมัครงาน กรุณาระบุสถานีรถไฟฟ้าที่ใกล้กับสถานที่ปฏิบัติงาน (ถ้ามี) หรือระบุสายรถเมล์ที่ผ่านสถานที่ประกอบการ และระบุการเดินทางเพิ่มเติม เพื่อให้เข้าใจในการเดินทางมากยิ่งขึ้น
</span>
</v-flex>
<v-layout
row
wrap
justify-center
class=
"my-2"
>
<v-btn
color=
"red"
dark=
""
type=
"submit"
>
บันทึกข้อมูล
</v-btn>
<v-btn
color=
"red"
dark=
""
type=
"submit"
:loading=
"loading"
>
บันทึกข้อมูล
</v-btn>
</v-layout>
</v-layout>
</v-flex>
...
...
@@ -240,6 +242,7 @@
export
default
{
data
()
{
return
{
loading
:
false
,
status
:
'ยังไม่ได้เลือกไฟล์'
,
nameImage
:
null
,
company_data
:
{
...
...
@@ -264,7 +267,8 @@ export default {
mrt
:
''
,
arl
:
''
,
bus
:
''
,
another
:
''
another
:
''
,
check
:
false
},
rules
:
{
required
:
v
=>
!!
v
||
'จำเป็นต้องกรอก'
,
...
...
@@ -403,22 +407,25 @@ export default {
}
},
createJob
()
{
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
=
''
}
if
(
this
.
company_data
.
zip_code
===
' '
)
{
this
.
company_data
.
zip_code
=
''
}
if
(
this
.
$refs
.
create
.
validate
())
{
this
.
company_data
.
user_id
=
this
.
$store
.
getters
.
getEmployer
.
id
this
.
company_data
.
province
=
this
.
province
.
province
this
.
company_data
.
amphoe
=
this
.
amphoe
.
amphoe
this
.
company_data
.
tumbon
=
this
.
tumbon
.
tumbon
axios
.
post
(
'/companys'
,
this
.
company_data
)
axios
.
post
(
'/
api/
companys'
,
this
.
company_data
)
.
then
(
res
=>
{
console
.
log
(
res
)
this
.
loading
=
false
this
.
$router
.
push
(
'/employer'
)
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
this
.
loading
=
false
})
}
else
{
this
.
loading
=
false
this
.
$Loading
.
error
()
}
},
...
...
@@ -484,8 +491,51 @@ export default {
})
}
},
mounted
()
{
beforeMount
()
{
this
.
showProvinces
()
this
.
$store
.
dispatch
(
'checkEmployer'
)
.
then
(
res
=>
{
axios
.
get
(
`/api/companys/
${
res
.
id
}
/edit`
)
.
then
(
res
=>
{
if
(
res
.
data
.
check
)
{
console
.
log
(
res
.
data
)
this
.
company_data
=
{
user_id
:
res
.
data
.
data
[
0
].
user_id
,
imageCompany
:
res
.
data
.
data
[
0
].
imageCompany
,
company_name
:
res
.
data
.
data
[
0
].
company_name
,
company_owner
:
res
.
data
.
data
[
0
].
company_owner
,
phone_no
:
res
.
data
.
data
[
0
].
phone_no
,
email
:
res
.
data
.
data
[
0
].
email
,
fax
:
res
.
data
.
data
[
0
].
fax
,
website
:
res
.
data
.
data
[
0
].
website
,
addr
:
res
.
data
.
data
[
0
].
addr
,
province
:
res
.
data
.
data
[
0
].
province
,
amphoe
:
res
.
data
.
data
[
0
].
amphoe
,
tumbon
:
res
.
data
.
data
[
0
].
tambon
,
zip_code
:
res
.
data
.
data
[
0
].
zipcode
,
about
:
res
.
data
.
data
[
0
].
about
,
imageMap
:
res
.
data
.
data
[
0
].
imageMap
,
lat
:
res
.
data
.
data
[
0
].
lat
,
lng
:
res
.
data
.
data
[
0
].
lng
,
bts
:
res
.
data
.
data
[
0
].
bts
,
mrt
:
res
.
data
.
data
[
0
].
mrt
,
arl
:
res
.
data
.
data
[
0
].
arl
,
bus
:
res
.
data
.
data
[
0
].
bus
,
another
:
res
.
data
.
data
[
0
].
another
,
check
:
true
}
}
else
{
this
.
company_data
.
user_id
=
res
.
data
.
data
[
0
].
id
this
.
company_data
.
company_name
=
res
.
data
.
data
[
0
].
company_name
this
.
company_data
.
email
=
res
.
data
.
data
[
0
].
email_employers
this
.
company_data
.
phone_no
=
res
.
data
.
data
[
0
].
tel
this
.
company_data
.
check
=
false
}
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
})
})
}
}
</
script
>
...
...
resources/views/app.blade.php
View file @
1b75b354
...
...
@@ -4,6 +4,7 @@
<meta
charset=
"utf-8"
>
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
<!-- <meta name="csrf-token" content="{{ csrf_token() }}"> -->
<title>
CO-OP Search
</title>
...
...
routes/api.php
View file @
1b75b354
...
...
@@ -19,6 +19,10 @@ Route::group(['prefix' => 'auth'], function ($router) {
Route
::
get
(
'current'
,
'AuthController@getAuthenticatedUser'
);
});
Route
::
resource
(
'/companys'
,
'CompanyController'
);
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/{province_code}/amphoe'
,
'DistrictController@amphoes'
);
Route
::
get
(
'/province/{province_code}/amphoe/{amphoe_code}/district'
,
'DistrictController@districts'
);
...
...
routes/web.php
View file @
1b75b354
...
...
@@ -12,5 +12,3 @@
*/
Route
::
get
(
'/{any}'
,
'AppController@index'
)
->
where
(
'any'
,
'.*'
);
Route
::
resource
(
'/companys'
,
'CompanyController'
);
\ No newline at end of file
storage/uploads/Company1555790173.png
0 → 100644
View file @
1b75b354
22.6 KB
storage/uploads/Company1555815059.png
0 → 100644
View file @
1b75b354
23 KB
storage/uploads/Company1555815588.png
0 → 100644
View file @
1b75b354
18.9 KB
storage/uploads/Company1555815644.png
0 → 100644
View file @
1b75b354
18.9 KB
storage/uploads/Company1555815895.png
0 → 100644
View file @
1b75b354
18.9 KB
storage/uploads/Company1555816102.png
0 → 100644
View file @
1b75b354
22.8 KB
storage/uploads/Map1555815060.png
0 → 100644
View file @
1b75b354
22.8 KB
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