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
01ce3349
Commit
01ce3349
authored
Apr 19, 2019
by
Kittisak Maneewong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add api addr
parent
3a4a9153
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
162 additions
and
17 deletions
+162
-17
District.php
app/District.php
+10
-0
DistrictController.php
app/Http/Controllers/DistrictController.php
+42
-0
database.php
config/database.php
+1
-1
app.js
public/js/app.js
+0
-0
Addjob.vue
resources/js/views/Addjob.vue
+104
-16
api.php
routes/api.php
+5
-0
No files found.
app/District.php
0 → 100644
View file @
01ce3349
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
District
extends
Model
{
//
}
app/Http/Controllers/DistrictController.php
0 → 100644
View file @
01ce3349
<?php
namespace
App\Http\Controllers
;
use
App\District
;
use
Illuminate\Http\Request
;
class
DistrictController
extends
Controller
{
public
function
provinces
()
{
$provinces
=
District
::
groupBy
(
'province_code'
)
->
get
();
return
response
()
->
json
(
$provinces
);
}
public
function
amphoes
(
$province_code
)
{
$amphoes
=
District
::
where
(
'province_code'
,
$province_code
)
->
groupBy
(
'amphoe_code'
)
->
get
();
return
response
()
->
json
(
$amphoes
);
}
public
function
districts
(
$province_code
,
$amphoe_code
)
{
$districts
=
District
::
where
(
'province_code'
,
$province_code
)
->
where
(
'amphoe_code'
,
$amphoe_code
)
->
groupBy
(
'district_code'
)
->
get
();
return
response
()
->
json
(
$districts
);
}
public
function
detail
(
$province_code
,
$amphoe_code
,
$district_code
)
{
$districts
=
District
::
where
(
'province_code'
,
$province_code
)
->
where
(
'amphoe_code'
,
$amphoe_code
)
->
where
(
'district_code'
,
$district_code
)
->
get
();
return
response
()
->
json
(
$districts
);
}
}
config/database.php
View file @
01ce3349
...
...
@@ -52,7 +52,7 @@ return [
'collation'
=>
'utf8mb4_unicode_ci'
,
'prefix'
=>
''
,
'prefix_indexes'
=>
true
,
'strict'
=>
tru
e
,
'strict'
=>
fals
e
,
'engine'
=>
null
,
'options'
=>
extension_loaded
(
'pdo_mysql'
)
?
array_filter
([
PDO
::
MYSQL_ATTR_SSL_CA
=>
env
(
'MYSQL_ATTR_SSL_CA'
),
...
...
public/js/app.js
View file @
01ce3349
This source diff could not be displayed because it is too large. You can
view the blob
instead.
resources/js/views/Addjob.vue
View file @
01ce3349
...
...
@@ -72,40 +72,56 @@
outline
label=
"ที่อยู่"
:rules=
"[rules.required]"
rows
class=
"my-1"
></v-textarea>
<label
class=
"font-weight-bold"
>
จังหวัด
<span
class=
"red--text"
>
*
</span></label>
<VSelect
:items=
"items"
<v-select
:items=
"provinces"
item-text=
"province"
v-model=
"province"
label=
"เลือกจังหวัด"
:rules=
"[rules.required]"
></VSelect>
return-object
@
change=
"showAmphoes()"
></v-select>
<label
class=
"font-weight-bold"
>
เขต/อำเภอ
<span
class=
"red--text"
>
*
</span></label>
<VSelect
:items=
"items"
<v-select
:items=
"amphoes"
item-text=
"amphoe"
label=
"เลือกเขต/อำเภอ"
return-object
v-model=
"amphoe"
no-data-text=
"กรุณาเลือกจังหวัด"
:disabled=
"!openAmphoe"
:rules=
"[rules.required]"
></VSelect>
@
change=
"showTumbons()"
></v-select>
<label
class=
"font-weight-bold"
>
เกี่ยวกับบริษัท
</label>
<v-textarea
outline
label=
"เกี่ยวกับบริษัท"
rows=
"6"
class=
"my-1"
></v-textarea>
</v-flex>
<v-flex
sm6
xs12
class=
"px-3"
>
<label
class=
"font-weight-bold"
>
แขวง/ตำบล
<span
class=
"red--text"
>
*
</span></label>
<VSelect
:items=
"items"
<v-select
:items=
"tumbons"
item-text=
"tumbon"
return-object
v-model=
"tumbon"
no-data-text=
"กรุณาเลือกอำเภอ"
:rules=
"[rules.required]"
:disabled=
"!openTumbon"
label=
"เลือกแขวง/ตำบล"
></VSelect>
@
change =
"showDetail()"
></v-select>
<label
class=
"font-weight-bold"
>
รหัสไปรษณีย์
<span
class=
"red--text"
>
*
</span></label>
<v-text-field
:disabled=
"!openZipCode"
label=
"รหัสไปรษณีย์"
v-model=
"zip_code"
:rules=
"[rules.required]"
class=
"my-ip"
></v-text-field>
...
...
@@ -138,21 +154,18 @@
<v-flex
sm3
xs12
class=
"px-3"
>
<label
class=
"font-weight-bold my-2"
>
ใกล้ BTS
</label>
<VSelect
:items=
"items"
label=
"เลือก"
></VSelect>
</v-flex>
<v-flex
sm3
xs12
class=
"px-3"
>
<label
class=
"font-weight-bold"
>
ใกล้ MRT
</label>
<VSelect
:items=
"items"
label=
"เลือก"
></VSelect>
</v-flex>
<v-flex
sm3
xs12
class=
"px-3"
>
<label
class=
"font-weight-bold"
>
ใกล้ ARL
</label>
<VSelect
:items=
"items"
label=
"เลือก"
></VSelect>
</v-flex>
...
...
@@ -168,7 +181,6 @@
<v-textarea
outline
label=
""
rows
class=
"my-2"
></v-textarea>
</v-flex>
...
...
@@ -177,6 +189,7 @@
<span
>
เพื่อความสะดวกในการเดินทางของผู้สมัครงาน กรุณาระบุสถานีรถไฟฟ้าที่ใกล้กับสถานที่ปฏิบัติงาน (ถ้ามี) หรือระบุสายรถเมล์ที่ผ่านสถานที่ประกอบการ และระบุการเดินทางเพิ่มเติม เพื่อให้เข้าใจในการเดินทางมากยิ่งขึ้น
</span>
</v-flex>
</v-layout>
<v-btn
color=
"success"
type=
"submit"
>
text
</v-btn>
<!-- <v-layout row wrap class="borderbottom">
<v-flex sm6 xs12 class="pa-3">
<h2 class="font-weight-bold my-2"><span class="red--text"> รายละเอียดงาน</span></h2>
...
...
@@ -354,7 +367,17 @@ export default {
timeFrom
:
null
,
timeTo
:
null
,
showTimeFrom
:
false
,
showTimeTo
:
false
showTimeTo
:
false
,
provinces
:
[],
amphoes
:
[],
tumbons
:
[],
province
:
''
,
amphoe
:
''
,
tumbon
:
''
,
zip_code
:
''
,
openAmphoe
:
false
,
openTumbon
:
false
,
openZipCode
:
false
}
},
methods
:
{
...
...
@@ -370,12 +393,77 @@ export default {
}
},
createJob
()
{
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
.
$refs
.
create
.
validate
())
{
console
.
log
(
'create job'
)
}
else
{
this
.
$Loading
.
error
()
}
},
showProvinces
()
{
axios
.
get
(
'/api/province'
)
.
then
(
res
=>
{
res
.
data
.
forEach
(
data
=>
{
this
.
provinces
.
push
({
province
:
data
.
province
,
province_code
:
data
.
province_code
})
});
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
})
},
showAmphoes
()
{
this
.
amphoes
=
[]
this
.
zip_code
=
''
this
.
openAmphoe
=
true
this
.
openTumbon
=
false
this
.
openZipCode
=
false
axios
.
get
(
`/api/province/
${
this
.
province
.
province_code
}
/amphoe`
)
.
then
(
res
=>
{
res
.
data
.
forEach
(
data
=>
{
this
.
amphoes
.
push
({
amphoe
:
data
.
amphoe
,
amphoe_code
:
data
.
amphoe_code
})
})
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
})
},
showTumbons
()
{
this
.
tumbons
=
[]
this
.
openTumbon
=
true
this
.
openZipCode
=
false
axios
.
get
(
`/api/province/
${
this
.
province
.
province_code
}
/amphoe/
${
this
.
amphoe
.
amphoe_code
}
/district`
)
.
then
(
res
=>
{
res
.
data
.
forEach
(
data
=>
{
this
.
tumbons
.
push
({
tumbon
:
data
.
district
,
tumbon_code
:
data
.
district_code
})
})
})
.
catch
(
err
=>
{
console
.
log
(
err
.
response
)
})
},
showDetail
()
{
this
.
openZipCode
=
true
axios
.
get
(
`/api/province/
${
this
.
province
.
province_code
}
/amphoe/
${
this
.
amphoe
.
amphoe_code
}
/district/
${
this
.
tumbon
.
tumbon_code
}
`
)
.
then
(
res
=>
{
this
.
zip_code
=
res
.
data
[
0
].
zipcode
})
.
catch
(
err
=>
{
console
.
log
(
err
.
resonse
)
})
}
},
mounted
()
{
this
.
showProvinces
()
}
}
</
script
>
...
...
routes/api.php
View file @
01ce3349
...
...
@@ -18,3 +18,8 @@ Route::group(['prefix' => 'auth'], function ($router) {
Route
::
post
(
'login'
,
'AuthController@login'
);
Route
::
get
(
'current'
,
'AuthController@getAuthenticatedUser'
);
});
Route
::
get
(
'/province'
,
'DistrictController@provinces'
);
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/{district_code}'
,
'DistrictController@detail'
);
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