Commit a9e92971 by Francisco Salazar

recuperar venta en shipping

parent 27d7511f
......@@ -158,25 +158,31 @@ public function trash()
return redirect()->route('cart.show');
}
public function shipping()
{
public function shipping(){
$client = new Client();
$addres = new Addres();
$sale = new Sale();
if(count(\Session::get('cart')) <= 0) {return redirect()->route('cart.show');}
if(\Session::has('client')) {
$client = \Session::get('client');
$addres = $client->shipping;
}
if(\Session::has('sale')){
$sale = Sale::find(\Session::get('sale')->id);
}
$cart = \Session::get('cart');
$total = $this->total();
$shipping = Shipping::pluck('name', 'id');
return view('shop-public::cart.shipping')
->with("sale", $sale)
->with('cart', $cart)
->with('total', $total)
->with('client', $client)
......@@ -250,6 +256,7 @@ public function shipping()
$sale = Sale::find(\Session::get('sale')->id);
$sale->total = ($this->total() + $costoEnvio);
$sale->facturacion = $request->facturacion;
$sale->home_delivery = $request->home_delivery;
$sale->save();
}
......
......@@ -59,6 +59,7 @@ setlocale(LC_MONETARY, 'en_US');
@include('shop-public::forms.fields-shipping')
<br>
</section>
{{$sale}}
<section>
<h4>Información adicional</h4>
......
......@@ -20,10 +20,10 @@
<div class="form-group">
{!! Form::label('home_delivery', '¿Requieres envio a domicilio?', ['class'=>'']) !!}
{!! Form::select('home_delivery',[false=>'No, pasare por el paquete a la tienda', true=>'SI'], null, ['class'=>'form-control', 'required'=>'required', 'id'=>'home_delivery']) !!}
{!! Form::select('home_delivery',[false=>'No, pasare por el paquete a la tienda', true=>'SI'], isset($sale->home_delivery) ? $sale->home_delivery : null, ['class'=>'form-control', 'required'=>'required', 'id'=>'home_delivery']) !!}
</div>
<div class="form-group">
{!! Form::label('facturacion', '¿Necesitaras factura?', ['class'=>'']) !!}
{!! Form::select('facturacion',['No'=>'No', 'Si'=>'Si'], null, ['class'=>'form-control']) !!}
{!! Form::select('facturacion',['No'=>'No', 'Si'=>'Si'], isset($sale->facturacion) ? $sale->facturacion : null, ['class'=>'form-control']) !!}
</div>
\ No newline at end of file
<div class="form-group">
{!! Form::label('cp', 'Codigo postal', ['class'=>'']) !!}
{!! Form::text('cp', isset($address) ? $addres->cp : null, ['class'=>'form-control']) !!}
{!! Form::text('cp', isset($addres->cp) ? $addres->cp : null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('calle', 'Calle', ['class'=>'']) !!}
{!! Form::text('calle', isset($address) ? $addres->calle : null, ['class'=>'form-control']) !!}
{!! Form::text('calle', isset($addres->calle) ? $addres->calle : null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('numero', 'Numero', ['class'=>'']) !!}
{!! Form::text('numero', isset($address) ? $addres->numero : null, ['class'=>'form-control']) !!}
{!! Form::text('numero', isset($addres->numero) ? $addres->numero : null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('colonia', 'Colonia', ['class'=>'']) !!}
{!! Form::text('colonia', isset($address) ? $addres->colonia : null, ['class'=>'form-control']) !!}
{!! Form::text('colonia', isset($addres->colonia) ? $addres->colonia : null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('ciudad', 'Ciudad o delegación', ['class'=>'']) !!}
{!! Form::text('ciudad', isset($address) ? $addres->ciudad : null, ['class'=>'form-control']) !!}
{!! Form::text('ciudad', isset($addres->ciudad) ? $addres->ciudad : null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('estado', 'Estado', ['class'=>'']) !!}
{!! Form::text('estado', isset($address) ? $addres->estado : null, ['class'=>'form-control']) !!}
{!! Form::text('estado', isset($addres->estado) ? $addres->estado : null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('referencias', 'Referencias', ['class'=>'']) !!}
{!! Form::text('referencias', isset($address) ? $addres->referencias : null, ['class'=>'form-control']) !!}
{!! Form::text('referencias', isset($addres->referencias) ? $addres->referencias : null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('shipping_price_id', 'Tipo de envio', ['class'=>'']) !!}
{!! Form::select('shipping_price_id', $shipping, isset($address) && $addres->shipping_price_id != null ? $addres->shipping_price_id : null,['class'=>'form-control']) !!}
{!! Form::select('shipping_price_id', $shipping, isset($addres->shipping_price_id) && $addres->shipping_price_id != null ? $addres->shipping_price_id : null,['class'=>'form-control']) !!}
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment