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
85c0fafd
Commit
85c0fafd
authored
Jul 11, 2018
by
Angel MAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variables adicionales en la orden
parent
072c5667
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
335 additions
and
9 deletions
+335
-9
AdminProductController.php
src/controllers/AdminProductController.php
+36
-0
CartController.php
src/controllers/CartController.php
+9
-0
2018_07_11_174813_create_extra_sale_infos_table.php
...tions/2018_07_11_174813_create_extra_sale_infos_table.php
+45
-0
2018_07_11_185754_create_variable_extras_table.php
...ations/2018_07_11_185754_create_variable_extras_table.php
+43
-0
ExtraSaleInfo.php
src/models/ExtraSaleInfo.php
+28
-0
SaleShop.php
src/models/SaleShop.php
+5
-0
VariableExtra.php
src/models/VariableExtra.php
+23
-0
routes.php
src/routes.php
+6
-0
orden.blade.php
src/views/clients/orden.blade.php
+124
-6
shipping.blade.php
src/views/public/cart/shipping.blade.php
+13
-0
edit.blade.php
src/views/variable/edit.blade.php
+3
-3
No files found.
src/controllers/AdminProductController.php
View file @
85c0fafd
...
...
@@ -13,6 +13,7 @@ use Onestartup\Shop\Model\ExtraField as Extra;
use
Onestartup\Shop\Model\ProductShopInfo
as
ProductInfo
;
use
Onestartup\Shop\Model\CategoriaSat
;
use
Onestartup\Shop\Model\Billing
;
use
Onestartup\Shop\Model\VariableExtra
as
Variable
;
use
Onestartup\Shop\DataTables\ClientDataTable
;
use
Onestartup\Shop\DataTables\OrderDataTable
;
...
...
@@ -302,6 +303,9 @@ class AdminProductController extends Controller
$promo
=
null
;
$shipping
=
null
;
$shipping_price
=
null
;
$var
=
Variable
::
first
();
$variable
=
$var
!=
null
?
$var
:
new
Variable
();
if
(
$sale
->
coupon
!=
null
)
{
$promo
=
$this
->
util
->
getDiscount
(
$sale
,
$sale
->
coupon
);
...
...
@@ -341,6 +345,7 @@ class AdminProductController extends Controller
->
with
(
'estado'
,
$estado
)
->
with
(
'promo'
,
$promo
)
->
with
(
'shipping_price'
,
$shipping_price
)
->
with
(
'variable'
,
$variable
)
->
with
(
'shipping'
,
$shipping
);
}
...
...
@@ -660,4 +665,35 @@ class AdminProductController extends Controller
->
with
(
'message_success'
,
'Información actualizada'
);
}
public
function
showVars
()
{
$variable
=
Variable
::
first
();
if
(
$variable
==
null
)
{
$variable
=
new
Variable
();
}
return
view
(
'shop::variable.edit'
)
->
with
(
'variable'
,
$variable
);
}
public
function
postVars
(
Request
$request
)
{
$variable
=
Variable
::
first
();
if
(
$variable
==
null
)
{
$variable
=
new
Variable
();
}
$variable
->
fill
(
$request
->
all
());
$variable
->
save
();
return
redirect
()
->
back
()
->
with
(
'message_success'
,
'Información actualizada'
);
}
}
src/controllers/CartController.php
View file @
85c0fafd
...
...
@@ -37,6 +37,8 @@ use PayPal\Api\ItemList;
use
PayPal\Api\Details
;
use
Onestartup\Shop\Libs\Util
;
use
Onestartup\Shop\Model\VariableExtra
as
Variable
;
use
Onestartup\Shop\Model\ExtraSaleInfo
;
class
CartController
extends
Controller
...
...
@@ -251,6 +253,13 @@ public function shipping()
$sale
->
save
();
}
if
(
$request
->
additional
)
{
$additional
=
new
ExtraSaleInfo
(
$request
->
all
());
$sale
->
info_extra
()
->
save
(
$additional
);
}
\Session
::
put
(
'sale'
,
$sale
);
\Session
::
put
(
'client'
,
$client
);
...
...
src/migrations/2018_07_11_174813_create_extra_sale_infos_table.php
0 → 100644
View file @
85c0fafd
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateExtraSaleInfosTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'extra_sale_infos'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
string
(
'extra1'
,
455
)
->
nullable
();
$table
->
string
(
'extra2'
,
455
)
->
nullable
();
$table
->
string
(
'extra3'
,
455
)
->
nullable
();
$table
->
string
(
'extra4'
,
455
)
->
nullable
();
$table
->
string
(
'extra5'
,
455
)
->
nullable
();
$table
->
string
(
'extra6'
,
455
)
->
nullable
();
$table
->
string
(
'extra7'
,
455
)
->
nullable
();
$table
->
string
(
'extra8'
,
455
)
->
nullable
();
$table
->
string
(
'extra9'
,
455
)
->
nullable
();
$table
->
string
(
'extra10'
,
455
)
->
nullable
();
$table
->
integer
(
'sale_id'
)
->
unsigned
();
$table
->
foreign
(
'sale_id'
)
->
references
(
'id'
)
->
on
(
'sale_shops'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'extra_sale_infos'
);
}
}
src/migrations/2018_07_11_185754_create_variable_extras_table.php
0 → 100644
View file @
85c0fafd
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateVariableExtrasTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'variable_extras'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
string
(
'alias1'
,
455
)
->
nullable
();
$table
->
string
(
'alias2'
,
455
)
->
nullable
();
$table
->
string
(
'alias3'
,
455
)
->
nullable
();
$table
->
string
(
'alias4'
,
455
)
->
nullable
();
$table
->
string
(
'alias5'
,
455
)
->
nullable
();
$table
->
string
(
'alias6'
,
455
)
->
nullable
();
$table
->
string
(
'alias7'
,
455
)
->
nullable
();
$table
->
string
(
'alias8'
,
455
)
->
nullable
();
$table
->
string
(
'alias9'
,
455
)
->
nullable
();
$table
->
string
(
'alias10'
,
455
)
->
nullable
();
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'variable_extras'
);
}
}
src/models/ExtraSaleInfo.php
0 → 100644
View file @
85c0fafd
<?php
namespace
Onestartup\Shop\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
ExtraSaleInfo
extends
Model
{
protected
$table
=
'extra_sale_infos'
;
protected
$fillable
=
[
'extra1'
,
'extra2'
,
'extra3'
,
'extra4'
,
'extra5'
,
'extra6'
,
'extra7'
,
'extra8'
,
'extra9'
,
'extra10'
,
'sale_id'
];
public
function
sale
()
{
return
$this
->
belongsTo
(
SaleShop
::
class
,
'sale_id'
);
}
}
src/models/SaleShop.php
View file @
85c0fafd
...
...
@@ -50,4 +50,9 @@ class SaleShop extends Model
return
$this
->
hasOne
(
'Onestartup\Shop\Model\Billing'
,
'sale_id'
);
}
public
function
info_extra
()
{
return
$this
->
hasOne
(
ExtraSaleInfo
::
class
,
'sale_id'
);
}
}
src/models/VariableExtra.php
0 → 100644
View file @
85c0fafd
<?php
namespace
Onestartup\Shop\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
VariableExtra
extends
Model
{
protected
$table
=
'variable_extras'
;
protected
$fillable
=
[
'alias1'
,
'alias2'
,
'alias3'
,
'alias4'
,
'alias5'
,
'alias6'
,
'alias7'
,
'alias8'
,
'alias9'
,
'alias10'
,
'alias11'
];
}
src/routes.php
View file @
85c0fafd
...
...
@@ -103,6 +103,12 @@ Route::group(['middleware' => ['web', 'auth', 'is_admin']], function(){
'Onestartup\Shop\Controller\AdminProductController@postConfigs'
)
->
name
(
'admin.shop.config_factura.store'
);
Route
::
get
(
'admin/shop/variable'
,
'Onestartup\Shop\Controller\AdminProductController@showVars'
)
->
name
(
'admin.shop.variable'
);
Route
::
post
(
'admin/shop/variable'
,
'Onestartup\Shop\Controller\AdminProductController@postVars'
)
->
name
(
'admin.shop.variable.store'
);
});
...
...
src/views/clients/orden.blade.php
View file @
85c0fafd
@
extends
(
'crm-admin::main-layout'
)
@
section
(
'breadcrumb'
)
<
li
class
="
breadcrumb
-
item
">
<
li
class
="
breadcrumb
-
item
">
<a href="
{{
route
(
'home'
)}}
">Home</a>
</li>
<li class="
breadcrumb
-
item
">
</li>
<li class="
breadcrumb
-
item
">
<a href="
{{
route
(
'admin-shop-client.orders'
)}}
">Tienda</a>
</li>
<li class="
breadcrumb
-
item
active
">
</li>
<li class="
breadcrumb
-
item
active
">
Detalle orden #
{
{$sale->id}
}
</li>
</li>
@endsection
@section('content')
...
...
@@ -37,6 +37,13 @@ setlocale(LC_MONETARY, 'en_US');
<
h6
>
Envio
y
factura
</
h6
>
</
a
>
</
li
>
@
if
(
$variable
->
count
()
>
0
)
<
li
class
="
nav
-
item
">
<a class="
nav
-
link
block
" href="" data-toggle="
tab
" data-target="
#tab-4">
<
h6
>
Detalles
adicionales
</
h6
>
</
a
>
</
li
>
@
endif
</
ul
>
</
div
>
...
...
@@ -305,10 +312,121 @@ setlocale(LC_MONETARY, 'en_US');
</div>
</div><!-- end tab-3 -->
@if(
$variable->count
() > 0)
<div class="
tab
-
pane
" id="
tab
-
4
">
<div class="
p
-
a
-
md
dark
_600
">Detalles adicionales</div>
<div class="
box
">
<div class="
box
-
body
">
@if(
$sale->info_extra
!= null)
<div class="
row
">
<div class="
col
-
md
-
6
">
@if(
$variable->alias1
!= null)
<p>
{
{$variable->alias1}
}
:
<b>
{
{$sale->info_extra->extra1}
}
</b>
</p>
@endif
@if(
$variable->alias2
!= null)
<p>
{
{$variable->alias2}
}
:
<b>
{
{$sale->info_extra->extra2}
}
</b>
</p>
@endif
@if(
$variable->alias3
!= null)
<p>
{
{$variable->alias3}
}
:
<b>
{
{$sale->info_extra->extra3}
}
</b>
</p>
@endif
@if(
$variable->alias4
!= null)
<p>
{
{$variable->alias4}
}
:
<b>
{
{$sale->info_extra->extra4}
}
</b>
</p>
@endif
@if(
$variable->alias5
!= null)
<p>
{
{$variable->alias5}
}
:
<b>
{
{$sale->info_extra->extra5}
}
</b>
</p>
@endif
</div>
<div class="
col
-
md
-
6
">
@if(
$variable->alias6
!= null)
<p>
{
{$variable->alias6}
}
:
<b>
{
{$sale->info_extra->extra6}
}
</b>
</p>
@endif
@if(
$variable->alias7
!= null)
<p>
{
{$variable->alias7}
}
:
<b>
{
{$sale->info_extra->extra7}
}
</b>
</p>
@endif
@if(
$variable->alias8
!= null)
<p>
{
{$variable->alias8}
}
:
<b>
{
{$sale->info_extra->extra8}
}
</b>
</p>
@endif
@if(
$variable->alias9
!= null)
<p>
{
{$variable->alias9}
}
:
<b>
{
{$sale->info_extra->extra9}
}
</b>
</p>
@endif
@if(
$variable->alias10
!= null)
<p>
{
{$variable->alias10}
}
:
<b>
{
{$sale->info_extra->extra10}
}
</b>
</p>
@endif
</div>
</div>
@endif
</div>
</div>
</div><!-- end tab-4 -->
@endif
</div>
</div>
</div>
<div class="
modal
fade
animate
" data-backdrop="
true
" id="
m
-
a
-
a
">
...
...
src/views/public/cart/shipping.blade.php
View file @
85c0fafd
...
...
@@ -60,6 +60,19 @@ setlocale(LC_MONETARY, 'en_US');
<br>
</section>
<section>
<h4>Información adicional</h4>
{!! Form::hidden('additional', true) !!}
<div class="
form
-
group
">
{!! Form::label('extra1', 'Fecha de envío', ['class'=>'']) !!}
{!! Form::text('extra1', null, ['class'=>'form-control', 'required'=>'required']) !!}
</div>
<div>
{!! Form::label('extra2', 'Dedicatoria', ['class'=>'']) !!}
{!! Form::text('extra2', null, ['class'=>'form-control', 'required'=>'required']) !!}
</div>
</section>
{!! Form::submit('Enviar información', ['class'=>'']) !!}
{!! Form::close() !!}
...
...
src/views/variable/edit.blade.php
View file @
85c0fafd
...
...
@@ -5,12 +5,12 @@
<div class='
col
-
md
-
12
'>
<div class='
box
'>
<div class='
box
-
header
dark
'>
<h2>
Mapeo de variables extras
</h2>
<h2>
Variables extras de información adicional a una compra
</h2>
</div>
<div class='
box
-
body
'>
<div class='
col
-
md
-
12
'>
{!! Form::model($variable,['
route
'=> ['
admin
.
product
.
variable
.
store
'],"method"=>"POST"]) !!}
@include('
product
::
variable
.
fields
')
{!! Form::model($variable,['
route
'=> ['
admin
.
shop
.
variable
.
store
'],"method"=>"POST"]) !!}
@include('
shop
::
variable
.
fields
')
</div>
</div>
<div class='
dker
p
-
a
text
-
right
'>
...
...
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