Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onestartup-shop
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Angel Martin
onestartup-shop
Commits
f68b67a4
Commit
f68b67a4
authored
May 29, 2018
by
Angel MAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
medio acordar con el vendedor
parent
3e82a44a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
143 additions
and
18 deletions
+143
-18
CartController.php
src/controllers/CartController.php
+52
-18
PaymentAcordarClient.php
src/notifications/PaymentAcordarClient.php
+71
-0
routes.php
src/routes.php
+1
-0
finish.blade.php
src/views/public/cart/finish.blade.php
+4
-0
form-acordar.blade.php
src/views/public/forms/form-acordar.blade.php
+9
-0
layout.blade.php
src/views/public/layout.blade.php
+6
-0
No files found.
src/controllers/CartController.php
View file @
f68b67a4
...
@@ -16,6 +16,7 @@ use Onestartup\Shop\Model\DetailShop as Item;
...
@@ -16,6 +16,7 @@ use Onestartup\Shop\Model\DetailShop as Item;
use
Onestartup\Shop\Payment\MP
;
use
Onestartup\Shop\Payment\MP
;
use
Onestartup\Shop\Notifications\PaymentClient
;
use
Onestartup\Shop\Notifications\PaymentClient
;
use
Onestartup\Shop\Notifications\PaymentAcordarClient
;
use
Onestartup\Shop\Notifications\PaymentClientCard
;
use
Onestartup\Shop\Notifications\PaymentClientCard
;
use
PayPal\Rest\ApiContext
;
use
PayPal\Rest\ApiContext
;
...
@@ -48,10 +49,10 @@ class CartController extends Controller
...
@@ -48,10 +49,10 @@ class CartController extends Controller
return
view
(
'shop-public::cart.show-cart'
)
return
view
(
'shop-public::cart.show-cart'
)
->
with
(
'cart'
,
$cart
)
->
with
(
'cart'
,
$cart
)
->
with
(
'total'
,
$total
);
->
with
(
'total'
,
$total
);
}
}
public
function
add
(
Product
$product
)
public
function
add
(
Product
$product
)
{
{
if
(
\Session
::
has
(
'sale'
))
{
if
(
\Session
::
has
(
'sale'
))
{
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
$sale
->
status
=
0
;
$sale
->
status
=
0
;
...
@@ -72,11 +73,11 @@ class CartController extends Controller
...
@@ -72,11 +73,11 @@ class CartController extends Controller
\Session
::
put
(
'cart'
,
$cart
);
\Session
::
put
(
'cart'
,
$cart
);
return
redirect
()
->
route
(
'cart.show'
);
return
redirect
()
->
route
(
'cart.show'
);
}
}
public
function
remove
(
Product
$product
)
public
function
remove
(
Product
$product
)
{
{
$cart
=
\Session
::
get
(
'cart'
);
$cart
=
\Session
::
get
(
'cart'
);
if
(
!
isset
(
$cart
[
$product
->
slug
]))
{
if
(
!
isset
(
$cart
[
$product
->
slug
]))
{
...
@@ -86,10 +87,10 @@ class CartController extends Controller
...
@@ -86,10 +87,10 @@ class CartController extends Controller
unset
(
$cart
[
$product
->
slug
]);
unset
(
$cart
[
$product
->
slug
]);
\Session
::
put
(
'cart'
,
$cart
);
\Session
::
put
(
'cart'
,
$cart
);
return
redirect
()
->
route
(
'cart.show'
);
return
redirect
()
->
route
(
'cart.show'
);
}
}
public
function
update
(
Product
$product
,
$quantity
)
public
function
update
(
Product
$product
,
$quantity
)
{
{
if
(
\Session
::
has
(
'sale'
))
{
if
(
\Session
::
has
(
'sale'
))
{
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
$sale
->
status
=
0
;
$sale
->
status
=
0
;
...
@@ -107,10 +108,10 @@ class CartController extends Controller
...
@@ -107,10 +108,10 @@ class CartController extends Controller
$cart
[
$product
->
slug
]
->
quantity
=
$quantity
;
$cart
[
$product
->
slug
]
->
quantity
=
$quantity
;
\Session
::
put
(
'cart'
,
$cart
);
\Session
::
put
(
'cart'
,
$cart
);
return
redirect
()
->
route
(
'cart.show'
);
return
redirect
()
->
route
(
'cart.show'
);
}
}
public
function
trash
()
public
function
trash
()
{
{
if
(
\Session
::
has
(
'sale'
))
{
if
(
\Session
::
has
(
'sale'
))
{
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
...
@@ -123,13 +124,11 @@ class CartController extends Controller
...
@@ -123,13 +124,11 @@ class CartController extends Controller
\Session
::
forget
(
'client'
);
\Session
::
forget
(
'client'
);
return
redirect
()
->
route
(
'cart.show'
);
return
redirect
()
->
route
(
'cart.show'
);
}
}
public
function
shipping
()
{
public
function
shipping
()
{
/*\Session::forget('client');
\Session::forget('cart');
\Session::forget('sale');*/
$client
=
new
Client
();
$client
=
new
Client
();
$addres
=
new
Addres
();
$addres
=
new
Addres
();
...
@@ -608,5 +607,40 @@ class CartController extends Controller
...
@@ -608,5 +607,40 @@ class CartController extends Controller
}
}
}
}
public
function
acordar
(
Request
$request
)
{
if
(
!
\Session
::
has
(
'client'
))
{
return
redirect
()
->
route
(
'cart.shipping'
);
}
if
(
!
\Session
::
has
(
'sale'
))
{
return
redirect
()
->
route
(
'cart.shipping'
);
}
$sale
=
Sale
::
find
(
\Session
::
get
(
'sale'
)
->
id
);
$client
=
$sale
->
client
;
$items
=
$sale
->
items
;
$addres
=
$client
->
shipping
;
$detail
=
''
;
$sale
->
status
=
3
;
$sale
->
transaction_id
=
null
;
$sale
->
payment_type
=
'Acordar con vendedor'
;
$sale
->
save
();
\Session
::
forget
(
'client'
);
\Session
::
forget
(
'cart'
);
\Session
::
forget
(
'sale'
);
$user
=
\App\User
::
first
();
$user
->
notify
(
new
PaymentAcordarClient
(
'Acordar con el vendedor'
,
$client
));
return
redirect
()
->
route
(
'main.shop'
)
->
with
(
'acordar'
,
'acordar'
);
}
}
}
src/notifications/PaymentAcordarClient.php
0 → 100644
View file @
f68b67a4
<?php
namespace
Onestartup\Shop\Notifications
;
use
Illuminate\Bus\Queueable
;
use
Illuminate\Notifications\Notification
;
use
Illuminate\Contracts\Queue\ShouldQueue
;
use
Illuminate\Notifications\Messages\MailMessage
;
use
Onestartup\Shop\Model\ClientShop
as
Client
;
class
PaymentAcordarClient
extends
Notification
{
use
Queueable
;
protected
$tipo
;
protected
$client
;
/**
* Create a new notification instance.
*
* @return void
*/
public
function
__construct
(
$tipo
,
Client
$client
)
{
$this
->
tipo
=
$tipo
;
$this
->
client
=
$client
;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public
function
via
(
$notifiable
)
{
return
[
'mail'
];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public
function
toMail
(
$notifiable
)
{
return
(
new
MailMessage
)
->
greeting
(
'¡Hola!'
)
->
subject
(
'Orden: Acordar con el vendedor '
.
env
(
'APP_NAME'
))
//->replyTo($this->interested->email, $this->interested->name)
->
line
(
'Un cliente elijió la opcion de acordar con el vendedor'
)
->
line
(
'Datos del cliente:'
)
->
line
(
'Nombre: '
.
$this
->
client
->
name
.
' '
.
$this
->
client
->
lastname
)
->
line
(
'Telefono: '
.
$this
->
client
->
phone
)
->
line
(
'Correo: '
.
$this
->
client
->
email
);
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public
function
toArray
(
$notifiable
)
{
return
[
//
];
}
}
src/routes.php
View file @
f68b67a4
...
@@ -86,6 +86,7 @@ Route::group(['middleware' => ['web']], function(){
...
@@ -86,6 +86,7 @@ Route::group(['middleware' => ['web']], function(){
Route
::
post
(
'cart/payment'
,
'Onestartup\Shop\Controller\CartController@payment'
)
->
name
(
'cart.payment'
);
Route
::
post
(
'cart/payment'
,
'Onestartup\Shop\Controller\CartController@payment'
)
->
name
(
'cart.payment'
);
Route
::
post
(
'cart/paymentCash'
,
'Onestartup\Shop\Controller\CartController@paymentCash'
)
->
name
(
'cart.paymentCash'
);
Route
::
post
(
'cart/paymentCash'
,
'Onestartup\Shop\Controller\CartController@paymentCash'
)
->
name
(
'cart.paymentCash'
);
Route
::
post
(
'cart/acordar'
,
'Onestartup\Shop\Controller\CartController@acordar'
)
->
name
(
'cart.acordar'
);
Route
::
get
(
'cart/update/{product_slug}/{quantity}'
,
'Onestartup\Shop\Controller\CartController@update'
)
Route
::
get
(
'cart/update/{product_slug}/{quantity}'
,
'Onestartup\Shop\Controller\CartController@update'
)
->
where
(
'quantity'
,
'[0-9]+'
)
->
where
(
'quantity'
,
'[0-9]+'
)
...
...
src/views/public/cart/finish.blade.php
View file @
f68b67a4
...
@@ -67,6 +67,10 @@ setlocale(LC_MONETARY, 'en_US');
...
@@ -67,6 +67,10 @@ setlocale(LC_MONETARY, 'en_US');
@include('shop-public::forms.form-paypal')
@include('shop-public::forms.form-paypal')
<br>
<br>
<br>
@include('shop-public::forms.form-acordar')
<br>
</section>
</section>
...
...
src/views/public/forms/form-acordar.blade.php
0 → 100644
View file @
f68b67a4
<form
action=
"{{route('cart.acordar')}}"
method=
"POST"
>
{{ csrf_field() }}
<button
type=
"submit"
>
Acordar con el vendedor: {{ money_format('%(#10n', ($total + $addres->shipping_price->cost)) }}
</button>
</form>
\ No newline at end of file
src/views/public/layout.blade.php
View file @
f68b67a4
...
@@ -64,6 +64,12 @@ $util = new Onestartup\Shop\Libs\Util();
...
@@ -64,6 +64,12 @@ $util = new Onestartup\Shop\Libs\Util();
</script>
</script>
@endif
@endif
@if(Session::has('acordar'))
<script
type=
"text/javascript"
>
swal
(
"Compra registrada"
,
"Gracias! En breve nos comunicaremos contigo para cerrar la venta"
,
"success"
)
</script>
@endif
@if(Session::has('url_ficha'))
@if(Session::has('url_ficha'))
<script>
<script>
...
...
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