Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fazo
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shahzod
fazo
Commits
35699f41
Commit
35699f41
authored
Oct 22, 2019
by
Khumoyunmirzo Sodiqov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10/12/2019//22:31
parent
0b68d616
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
290 additions
and
15 deletions
+290
-15
OrderController.php
app/Http/Controllers/OrderController.php
+37
-0
order_create.blade.php
resources/views/pages/parcels/order_create.blade.php
+251
-15
web.php
routes/web.php
+2
-0
No files found.
app/Http/Controllers/OrderController.php
View file @
35699f41
...
...
@@ -260,4 +260,41 @@ class OrderController extends Controller
return
redirect
(
route
(
'package'
));
}
public
function
getAddressAjaxS
()
{
$senderAddresses
=
Address
::
select
([
'id'
,
'user_id'
,
'country'
,
'firstname'
,
'secondname'
,
'city'
,
'street'
,
'house'
,
'apartment'
,
'zip'
,
'passport'
,
'type'
,
DB
::
raw
(
'(SELECT title_ru FROM country WHERE id=address_info.country) as country_name'
),
DB
::
raw
(
'(SELECT title_ru FROM city WHERE id=address_info.city) as city_name'
),
])
->
where
([
[
'user_id'
,
'='
,
Auth
::
id
()],
[
'type'
,
'='
,
'sender'
],
])
->
get
();
// $senderAddresses->where('user_id', '=', $id)->get();
return
json_decode
(
$senderAddresses
);
}
public
function
getAddressAjaxR
()
{
$recAddresses
=
Address
::
select
([
'id'
,
'user_id'
,
'country'
,
'firstname'
,
'secondname'
,
'city'
,
'street'
,
'house'
,
'apartment'
,
'zip'
,
'passport'
,
'type'
,
DB
::
raw
(
'(SELECT title_ru FROM country WHERE id=address_info.country) as country_name'
),
DB
::
raw
(
'(SELECT title_ru FROM city WHERE id=address_info.city) as city_name'
),
])
->
where
([
[
'user_id'
,
'='
,
Auth
::
id
()],
[
'type'
,
'='
,
'recipient'
],
])
->
get
();
return
json_decode
(
$recAddresses
);
}
}
resources/views/pages/parcels/order_create.blade.php
View file @
35699f41
...
...
@@ -29,7 +29,7 @@
#progressbar li {
list
-
style
-
type
:
none
;
width
:
33.33
%
;
width
:
25
%
;
float
:
left
;
position
:
relative
;
text
-
align
:
center
;
...
...
@@ -124,6 +124,7 @@
<ul id="
progressbar
" class="
needs
-
validation
border
border
-
1
bg
-
white
">
<li class="
active
">СБОР ПОСЫЛКИ</li>
<li>АДРЕСА</li>
<li>ВЫБЕРИТЕ ТИП ОТПРАВКИ</li>
<li>ПОДТВЕРЖДЕНИЕ</li>
</ul>
<hr>
...
...
@@ -256,19 +257,25 @@
</div>
<hr>
<div class="
row
">
<div class="
col
-
md
-
12
" style="
display
:
inline
-
flex
">
@foreach(
$senderAddresses
as
$item
)
@if(
$item->type
== 'sender')
<div class="
custom
-
control
custom
-
radio
"
style="
width
:
300
px
;
height
:
120
px
;
border
:
1
px
solid
#e9ecef;padding: 10px 10px 10px 40px;margin: 6px;">
<
input
type
=
"radio"
class
="
custom
-
control
-
input
"
name="
from_address
" value="
{{
$item
->
id
}}
"
id="
from_address
{{
$item
->
id
}}
">
<label class="
custom
-
control
-
label
"
for="
from_address
{{
$item
->
id
}}
">{{
$item->country
.', '.
$item->city
.', '.
$item->street
.', '.
$item->house
.', '.
$item->apartment
.', '.
$item->zip
}}</label>
</div>
@endif
@endforeach
<div id="
senderAddresses
" style="
display
:
inline
-
flex
;
overflow
-
y
:
scroll
;
" class="
col
-
md
-
10
">
{{-- @foreach(
$senderAddresses
as
$item
)--}}
{{-- @if(
$item->type
== 'sender')--}}
{{-- <div class="
custom
-
control
custom
-
radio
"--}}
{{-- style="
width
:
300
px
;
height
:
120
px
;
border
:
1
px
solid
#e9ecef;padding: 10px 10px 10px 40px;margin: 6px;">--}}
{{
--
<
input
type
=
"radio"
class
="
custom
-
control
-
input
"--}}
{{-- name="
from_address
" value="
{{
$item
->
id
}}
"--}}
{{-- id="
from_address
{{
$item
->
id
}}
">--}}
{{-- <label class="
custom
-
control
-
label
"--}}
{{-- for="
from_address
{{
$item
->
id
}}
">{{
$item->country
.', '.
$item->city
.', '.
$item->street
.', '.
$item->house
.', '.
$item->apartment
.', '.
$item->zip
}}</label>--}}
{{-- </div>--}}
{{-- @endif--}}
{{-- @endforeach--}}
</div>
<div class="
col
-
md
-
2
">
<input type="
button
" name="
add_sender
" class="
btn
btn
-
primary
btn
-
lg
btn
-
block
mt
-
4
"
style="
font
-
size
:
16
px
;
" value="
Добавить
адрес
" data-toggle="
modal
"
data-target="
#addSenderAddressAddModal"/>
</
div
>
</
div
>
<
br
>
...
...
@@ -279,7 +286,7 @@
адрес :</label>
</div>
<div class="
row
">
<div class="
col
-
md
-
1
2
" style="
display
:
inline
-
flex
">
<div class="
col
-
md
-
1
0
" style="
display
:
inline
-
flex
">
@foreach(
$senderAddresses
as
$item
)
@if(
$item->type
== 'recipient')
<div class="
custom
-
control
custom
-
radio
"
...
...
@@ -293,6 +300,11 @@
@endif
@endforeach
</div>
<div class="
col
-
md
-
2
">
<input type="
button
" name="
add_sender
" class="
btn
btn
-
primary
btn
-
lg
btn
-
block
mt
-
4
"
style="
font
-
size
:
16
px
;
" value="
Добавить
адрес
" data-toggle="
modal
"
data-target="
#addSenderAddressAddModal"/>
</
div
>
</
div
>
<
br
/><
br
/>
...
...
@@ -383,6 +395,153 @@
</form>
</div>
</section>
<div class="
modal
fade
" id="
addSenderAddressAddModal
" tabindex="
-
1
" role="
dialog
"
aria-labelledby="
addSenderAddressAddModalLabel
" aria-hidden="
true
">
<div class="
modal
-
dialog
modal
-
lg
" role="
document
">
<div class="
modal
-
content
">
<div class="
modal
-
header
">
<h5 class="
modal
-
title
" id="
addSenderAddressAddModalLabel
">Добавление адреса отправителя</h5>
<button type="
button
" class="
close
" data-dismiss="
modal
" aria-label="
Close
">
<span aria-hidden="
true
">×</span>
</button>
</div>
<form id="
addSenderForm
" method="
post
" action="
{{
route
(
'address.store'
)
}}
"
class="
needs
-
validation
border
border
-
1
bg
-
white
p
-
5
">
<div class="
modal
-
body
">
@csrf
<div class="
row
">
<div class="
col
-
xs
-
12
col
-
sm
-
4
">
<div class="
form
-
group
">
<label class="
form
-
label
" for="
forms
-
check
-
name1
">Имя <span
style="
color
:
#ff0912">*</span></label>
<
input
class
="
form
-
control
" id="
forms
-
check
-
name1
" type="
text
" name="
firstname
"
data-constraints="
@
Required
" placeholder="
Имя
" required>
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
4
">
<div class="
form
-
group
">
<label class="
form
-
label
" for="
forms
-
check
-
last
-
name1
">Фамилия <span
style="
color
:
#ff0912">*</span></label>
<
input
class
="
form
-
control
" id="
forms
-
check
-
last
-
name1
" type="
text
"
name="
secondname
"
data-constraints="
@
Required
" placeholder="
Фамилия
" required>
</div>
</div>
<div class="
col
-
xs
-
12
col
-
sm
-
4
">
<div class="
form
-
group
">
<label class="
form
-
label
" for="
forms
-
check
-
last
-
name1
">Отчество <span
style="
color
:
#ff0912">*</span></label>
<
input
class
="
form
-
control
" id="
forms
-
check
-
last
-
name1
" type="
text
"
name="
fathername
"
data-constraints="
@
Required
" placeholder="
Отчество
" required>
</div>
</div>
</div>
<div class="
row
">
<div class="
col
-
md
-
12
">
<!-- RD SelectMenu-->
<div class="
form
-
group
">
<label class="
form
-
label
" for="
involve
-
form
-
country1
">Страна <span
style="
color
:
#ff0912">*</span></label>
<
select
class
="
form
-
control
" id="
involve
-
form
-
country1
" id="
country
" name="
country
"
data-placeholder="
Select
Your
Country
" required>
@foreach(\App\Models\Country::all() as
$value
)
<option value="
{{
$value
->
id
}}
">{{
$value->title_ru
}}</option>
@endforeach
</select>
</div>
</div>
</div>
<div class="
col
-
xs
-
12
select
">
<!-- RD SelectMenu-->
<div class="
form
-
group
form
-
wrap
-
validation
">
<label class="
form
-
label
" for="
involve
-
form
-
country1
">Область <span
style="
color
:
#ff0912">*</span></label>
<
select
class
="
form
-
control
" id="
involve
-
form
-
country1
" name="
city
"
data-placeholder="
Select
Your
Area
" required>
@foreach(\App\Models\City::all() as
$value
)
<option value="
{{
$value
->
id
}}
">{{
$value->title_ru
}}</option>
@endforeach
</select>
</div>
</div>
<div class="
row
">
<div class="
col
-
md
-
6
">
<div class="
form
-
group
">
<label class="
form
-
label
" for="
forms
-
check
-
street
">Улица <span
style="
color
:
#ff0912">*</span></label>
<
input
type
=
"text"
class
="
form
-
control
" id="
forms
-
check
-
street
" name="
street
"
placeholder="
Улица
" required>
</div>
</div>
<div class="
col
-
md
-
6
">
<div class="
form
-
group
">
<label class="
form
-
label
" for="
forms
-
check
-
house
">Дом <span
style="
color
:
#ff0912">*</span></label>
<
input
type
=
"text"
class
="
form
-
control
" id="
forms
-
check
-
house
" name="
house
"
placeholder="
Дом
" required>
</div>
</div>
</div>
<div class="
row
">
<div class="
col
-
md
-
6
">
<div class="
form
-
group
">
<label class="
form
-
label
" for="
forms
-
check
-
appartment
">Квартира <span
style="
color
:
#ff0912">*</span></label>
<
input
type
=
"text"
class
="
form
-
control
" id="
forms
-
check
-
appartment
" name="
apartment
"
placeholder="
Квартира
" required>
</div>
</div>
<div class="
col
-
md
-
6
">
<div class="
form
-
group
">
<label class="
form
-
label
" for="
forms
-
check
-
postcode1
">ZIP код <span
style="
color
:
#ff0912">*</span></label>
<
input
class
="
form
-
control
" id="
forms
-
check
-
postcode1
" type="
text
" name="
zip
"
data-constraints="
@
Required
" placeholder="
ZIP
код
" required>
</div>
</div>
</div>
<div class="
row
">
<div class="
col
-
md
-
6
">
<div class="
form
-
wrap
">
<label class="
form
-
label
" for="
forms
-
check
-
phone
">Номер телефона <span
style="
color
:
#ff0912">*</span></label>
<
input
class
="
form
-
control
" id="
forms
-
check
-
phone
" type="
text
" name="
phone
"
data-constraints="
@
Required
" placeholder="
Номер
телефона
" required>
</div>
</div>
<div class="
col
-
md
-
6
select
">
<input type="
hidden
" name="
type
" value="
sender
">
{{-- <div class="
form
-
group
form
-
wrap
-
validation
">--}}
{{-- <label class="
form
-
label
" for="
involve
-
form
-
country1
">Выберите тип адреса <span--}}
{{-- style="
color
:
#ff0912">*</span></label>--}}
{{
--
<
select
class
="
form
-
control
" id="
involve
-
form
-
country1
" name="
type
"--}}
{{-- data-placeholder="
Выберите
тип
адреса
" required disabled>--}}
{{-- <option value="
sender
" selected>Отправитель</option>--}}
{{-- <option value="
recipient
">Получатель</option>--}}
{{-- </select>--}}
{{-- </div>--}}
</div>
</div>
{{-- <button class="
btn
btn
-
primary
btn
-
sm
mt
-
4
shadow
" type="
submit
">Добавить Адрес</button>--}}
</div>
<div class="
modal
-
footer
">
<button type="
button
" class="
btn
btn
-
secondary
" data-dismiss="
modal
">Закрыть</button>
<button type="
submit
" class="
btn
btn
-
primary
">Сохранить</button>
</div>
</form>
</div>
</div>
</div>
<script>
'use strict'
//jQuery time
...
...
@@ -501,6 +660,83 @@
@
section
(
'custom_script'
)
<
script
>
$
(
"#addSenderForm"
)
.
submit
(
function
(
e
)
{
e
.
preventDefault
();
// avoid to execute the actual submit of the form.
var
form
=
$
(
this
);
var
url
=
form
.
attr
(
'action'
);
$
.
ajax
({
type
:
"POST"
,
url
:
url
,
data
:
form
.
serialize
(),
// serializes the form's elements.
success
:
function
(
data
)
{
$
.
ajax
({
type
:
"GET"
,
url
:
'{{ route('
package
.
getAddressAjaxS
') }}'
,
success
:
function
(
data1
)
{
// console.log(data[0].city_name)
var
htmlData
=
""
;
$
.
each
(
data1
,
function
(
key
,
value
)
{
// console.log(key);
// console.log(value.id);
htmlData
+=
"<div class='col-md-5'><div class=
\"
custom-control custom-radio
\"\n
"
+
" style=
\"
width: 300px;height: 120px;border: 1px solid #e9ecef;padding: 10px 10px 10px 40px;margin: 6px;
\"
>
\n
"
+
" <input type=
\"
radio
\"
class=
\"
custom-control-input
\"\n
"
+
" name=
\"
to_address_id
\"
value=
\"
"
+
value
.
id
+
"
\"\n
"
+
" id=
\"
to_address_id"
+
value
.
id
+
"
\"
>
\n
"
+
" <label class=
\"
custom-control-label
\"\n
"
+
" for=
\"
to_address_id"
+
value
.
id
+
"
\"
>"
+
value
.
country_name
+
", "
+
value
.
city_name
+
", "
+
value
.
street
+
", "
+
value
.
house
+
", "
+
value
.
apartment
+
", "
+
value
.
zip
+
" | "
+
value
.
firstname
+
" "
+
value
.
secondname
+
"</label>
\n
"
+
" </div></div>"
});
$
(
'#senderAddresses'
)
.
empty
();
$
(
'#senderAddresses'
)
.
append
(
htmlData
);
}
});
$
(
'#addSenderAddressAddModal'
)
.
modal
(
'hide'
);
}
});
});
$
.
ajax
({
type
:
"GET"
,
url
:
'{{ route('
package
.
getAddressAjaxS
') }}'
,
success
:
function
(
data
)
{
// console.log(data[0].city_name)
var
htmlData
=
""
;
$
.
each
(
data
,
function
(
key
,
value
)
{
// console.log(key);
// console.log(value.id);
htmlData
+=
"<div class='col-md-5'><div class=
\"
custom-control custom-radio
\"\n
"
+
" style=
\"
width: 300px;height: 120px;border: 1px solid #e9ecef;padding: 10px 10px 10px 40px;margin: 6px;
\"
>
\n
"
+
" <input type=
\"
radio
\"
class=
\"
custom-control-input
\"\n
"
+
" name=
\"
to_address_id
\"
value=
\"
"
+
value
.
id
+
"
\"\n
"
+
" id=
\"
to_address_id"
+
value
.
id
+
"
\"
>
\n
"
+
" <label class=
\"
custom-control-label
\"\n
"
+
" for=
\"
to_address_id"
+
value
.
id
+
"
\"
>"
+
value
.
country_name
+
", "
+
value
.
city_name
+
", "
+
value
.
street
+
", "
+
value
.
house
+
", "
+
value
.
apartment
+
", "
+
value
.
zip
+
" | "
+
value
.
firstname
+
" "
+
value
.
secondname
+
"</label>
\n
"
+
" </div></div>"
});
$
(
'#senderAddresses'
)
.
empty
();
$
(
'#senderAddresses'
)
.
append
(
htmlData
);
}
});
// $("addSenderBtn").click(function(){
// $.ajax({url: "demo_test.txt", success: function(result){
// $("#div1").html(result);
// }});
// });
</
script
>
<
script
>
var
counter
=
1
;
...
...
routes/web.php
View file @
35699f41
...
...
@@ -67,6 +67,8 @@ Route::post('/feedback/add', 'FeedbackController@addGuest');
Route
::
get
(
'/packages'
,
'OrderController@index'
)
->
name
(
'package'
)
->
middleware
(
'auth'
);
Route
::
get
(
'/packages/create/{id}'
,
'OrderController@create'
)
->
name
(
'package.create'
)
->
middleware
(
'auth'
);
Route
::
post
(
'/packages/order-store'
,
'OrderController@orderStore'
)
->
name
(
'package.store'
)
->
middleware
(
'auth'
);
Route
::
get
(
'/packages/get-address-ajax-s'
,
'OrderController@getAddressAjaxS'
)
->
name
(
'package.getAddressAjaxS'
)
->
middleware
(
'auth'
);
Route
::
get
(
'/packages/get-address-ajax-r'
,
'OrderController@getAddressAjaxR'
)
->
name
(
'package.getAddressAjaxR'
)
->
middleware
(
'auth'
);
Route
::
get
(
'/declaration/{package_id}'
,
'Postman\DeclarationController@generatePDF'
)
->
where
([
'package_id'
=>
'[0-9]+'
])
->
middleware
(
'auth'
);
Route
::
get
(
'/profile/address'
,
'ProfileController@address'
)
->
name
(
'address'
)
->
middleware
(
'auth'
);
Route
::
get
(
'/profile/addaddress'
,
'ProfileController@addaddress'
)
->
name
(
'address.add'
)
->
middleware
(
'auth'
);
...
...
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