Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onestartup-product
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-product
Commits
5a224789
Commit
5a224789
authored
May 02, 2018
by
Angel MAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mapeo de variables
parent
e135c567
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
325 additions
and
39 deletions
+325
-39
AdminProductController.php
src/controllers/AdminProductController.php
+38
-2
2018_05_02_161227_add_extras_fields_to_products_table.php
...2018_05_02_161227_add_extras_fields_to_products_table.php
+35
-0
2018_05_02_162410_create_variables_table.php
src/migrations/2018_05_02_162410_create_variables_table.php
+43
-0
Variable.php
src/models/Variable.php
+23
-0
routes.php
src/routes.php
+6
-0
fields.blade.php
src/views/product/fields.blade.php
+88
-37
edit.blade.php
src/views/variable/edit.blade.php
+26
-0
fields.blade.php
src/views/variable/fields.blade.php
+66
-0
No files found.
src/controllers/AdminProductController.php
View file @
5a224789
...
@@ -9,6 +9,7 @@ use Yajra\Datatables\Datatables;
...
@@ -9,6 +9,7 @@ use Yajra\Datatables\Datatables;
use
Onestartup\Product\Model\ProductCategory
as
Category
;
use
Onestartup\Product\Model\ProductCategory
as
Category
;
use
Onestartup\Product\Model\ProductImage
as
Gallery
;
use
Onestartup\Product\Model\ProductImage
as
Gallery
;
use
Onestartup\Product\Model\Product
;
use
Onestartup\Product\Model\Product
;
use
Onestartup\Product\Model\Variable
;
class
AdminProductController
extends
Controller
class
AdminProductController
extends
Controller
{
{
...
@@ -24,9 +25,11 @@ class AdminProductController extends Controller
...
@@ -24,9 +25,11 @@ class AdminProductController extends Controller
public
function
create
()
public
function
create
()
{
{
$categories
=
Category
::
pluck
(
'name'
,
'id'
);
$categories
=
Category
::
pluck
(
'name'
,
'id'
);
$variable
=
Variable
::
first
();
return
view
(
'product::product.create'
)
return
view
(
'product::product.create'
)
->
with
(
'categories'
,
$categories
);
->
with
(
'categories'
,
$categories
)
->
with
(
'variable'
,
$variable
);
}
}
/**
/**
...
@@ -66,10 +69,12 @@ class AdminProductController extends Controller
...
@@ -66,10 +69,12 @@ class AdminProductController extends Controller
{
{
$product
=
Product
::
find
(
$id
);
$product
=
Product
::
find
(
$id
);
$categories
=
Category
::
pluck
(
'name'
,
'id'
);
$categories
=
Category
::
pluck
(
'name'
,
'id'
);
$variable
=
Variable
::
first
();
return
view
(
'product::product.edit'
)
return
view
(
'product::product.edit'
)
->
with
(
'categories'
,
$categories
)
->
with
(
'categories'
,
$categories
)
->
with
(
'product'
,
$product
);
->
with
(
'product'
,
$product
)
->
with
(
'variable'
,
$variable
);
}
}
/**
/**
...
@@ -204,4 +209,35 @@ class AdminProductController extends Controller
...
@@ -204,4 +209,35 @@ class AdminProductController extends Controller
}
}
public
function
showVars
()
{
$variable
=
Variable
::
first
();
if
(
$variable
==
null
)
{
$variable
=
new
Variable
();
}
return
view
(
'product::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/migrations/2018_05_02_161227_add_extras_fields_to_products_table.php
0 → 100644
View file @
5a224789
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
AddExtrasFieldsToProductsTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'products'
,
function
(
Blueprint
$table
)
{
$table
->
string
(
'extra7'
,
455
)
->
nullable
();
$table
->
string
(
'extra8'
,
455
)
->
nullable
();
$table
->
string
(
'extra9'
,
455
)
->
nullable
();
$table
->
string
(
'extra10'
,
455
)
->
nullable
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
table
(
'products'
,
function
(
Blueprint
$table
)
{
$table
->
dropColumn
([
'extra7'
,
'extra8'
,
'extra9'
,
'extra10'
]);
});
}
}
src/migrations/2018_05_02_162410_create_variables_table.php
0 → 100644
View file @
5a224789
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateVariablesTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'variables'
,
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
(
'variables'
);
}
}
src/models/Variable.php
0 → 100644
View file @
5a224789
<?php
namespace
Onestartup\Product\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
Variable
extends
Model
{
protected
$table
=
'variables'
;
protected
$fillable
=
[
'alias1'
,
'alias2'
,
'alias3'
,
'alias4'
,
'alias5'
,
'alias6'
,
'alias7'
,
'alias8'
,
'alias9'
,
'alias10'
];
}
src/routes.php
View file @
5a224789
...
@@ -16,6 +16,12 @@ Route::group(['middleware' => ['web', 'auth', 'is_admin']], function(){
...
@@ -16,6 +16,12 @@ Route::group(['middleware' => ['web', 'auth', 'is_admin']], function(){
Route
::
delete
(
'delete/cover/product/{id}'
,
'Onestartup\Product\Controller\AdminProductController@deleteCover'
)
Route
::
delete
(
'delete/cover/product/{id}'
,
'Onestartup\Product\Controller\AdminProductController@deleteCover'
)
->
name
(
'delete.cover.product'
);
->
name
(
'delete.cover.product'
);
Route
::
get
(
'admin/product/variable'
,
'Onestartup\Product\Controller\AdminProductController@showVars'
)
->
name
(
'admin.product.variable'
);
Route
::
post
(
'admin/product/variable'
,
'Onestartup\Product\Controller\AdminProductController@postVars'
)
->
name
(
'admin.product.variable.store'
);
});
});
Route
::
group
([
'middleware'
=>
[
'web'
]],
function
(){
Route
::
group
([
'middleware'
=>
[
'web'
]],
function
(){
...
...
src/views/product/fields.blade.php
View file @
5a224789
...
@@ -57,49 +57,100 @@
...
@@ -57,49 +57,100 @@
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-4"
>
@if($variable != null)
<div
class=
"form-group"
>
{!! Form::label('extra1', 'Ciudad', ['class'=>'control-label'])!!}
@if($variable->alias1 != null)
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
{!! Form::label('extra1', $variable->alias1, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
</div>
</div>
@endif
<div
class=
"col-md-4"
>
@if($variable->alias2 != null)
<div
class=
"form-group"
>
<div
class=
"col-md-4"
>
{!! Form::label('extra2', 'Latitud', ['class'=>'control-label'])!!}
<div
class=
"form-group"
>
{!! Form::text('extra2', null, ["class"=>"form-control"]) !!}
{!! Form::label('extra1', $variable->alias2, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
</div>
</div>
@endif
<div
class=
"col-md-4"
>
@if($variable->alias3 != null)
<div
class=
"form-group"
>
<div
class=
"col-md-4"
>
{!! Form::label('extra3', 'Longitud', ['class'=>'control-label'])!!}
<div
class=
"form-group"
>
{!! Form::text('extra3', null, ["class"=>"form-control"]) !!}
{!! Form::label('extra1', $variable->alias3, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
</div>
</div>
@endif
</div>
@if($variable->alias4 != null)
<div
class=
"row
"
>
<div
class=
"col-md-4
"
>
<div
class=
"col-md-4
"
>
<div
class=
"form-group
"
>
<div
class=
"form-group"
>
{!! Form::label('extra1', $variable->alias4, ['class'=>'control-label'])!!}
{!! Form::label('extra4', 'Extra 4', ['class'=>'control-label'])
!!}
{!! Form::text('extra1', null, ["class"=>"form-control"])
!!}
{!! Form::text('extra4', null, ["class"=>"form-control"]) !!}
</div>
</div>
</div>
</div>
@endif
<div
class=
"col-md-4"
>
@if($variable->alias5 != null)
<div
class=
"form-group"
>
<div
class=
"col-md-4"
>
{!! Form::label('extra5', 'Extra 5', ['class'=>'control-label'])!!}
<div
class=
"form-group"
>
{!! Form::text('extra5', null, ["class"=>"form-control"]) !!}
{!! Form::label('extra1', $variable->alias5, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
</div>
</div>
@endif
<div
class=
"col-md-4"
>
@if($variable->alias6 != null)
<div
class=
"form-group"
>
<div
class=
"col-md-4"
>
{!! Form::label('extra6', 'Extra 6', ['class'=>'control-label'])!!}
<div
class=
"form-group"
>
{!! Form::text('extra6', null, ["class"=>"form-control"]) !!}
{!! Form::label('extra1', $variable->alias6, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
</div>
</div>
@endif
@if($variable->alias7 != null)
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
{!! Form::label('extra1', $variable->alias7, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
@endif
@if($variable->alias8 != null)
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
{!! Form::label('extra1', $variable->alias8, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
@endif
@if($variable->alias9 != null)
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
{!! Form::label('extra1', $variable->alias9, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
@endif
@if($variable->alias10 != null)
<div
class=
"col-md-4"
>
<div
class=
"form-group"
>
{!! Form::label('extra1', $variable->alias10, ['class'=>'control-label'])!!}
{!! Form::text('extra1', null, ["class"=>"form-control"]) !!}
</div>
</div>
@endif
@endif
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
...
...
src/views/variable/edit.blade.php
0 → 100644
View file @
5a224789
@
extends
(
'crm-admin::main-layout'
)
@
section
(
'content'
)
<
div
class
='
row
'>
<div class='
col
-
md
-
12
'>
<div class='
box
'>
<div class='
box
-
header
dark
'>
<h2>Mapeo de variables extras</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
')
</div>
</div>
<div class='
dker
p
-
a
text
-
right
'>
<div class='
col
-
md
-
12
'>
{!! Form::submit('
Actualizar
información
', ['
class
'=>'
btn
dark
'
])
!!
}
{
!!
Form
::
close
()
!!
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
@
endsection
src/views/variable/fields.blade.php
0 → 100644
View file @
5a224789
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<div
class=
"form-group"
>
{!! Form::label('alias1', 'Alias para el campo extra 1') !!}
{!! Form::text('alias1', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias2', 'Alias para el campo extra 2') !!}
{!! Form::text('alias2', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias3', 'Alias para el campo extra 3') !!}
{!! Form::text('alias3', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias4', 'Alias para el campo extra 4') !!}
{!! Form::text('alias4', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias5', 'Alias para el campo extra 5') !!}
{!! Form::text('alias5', null, ["class"=>"form-control"]) !!}
</div>
</div>
<div
class=
"col-md-6"
>
<div
class=
"form-group"
>
{!! Form::label('alias6', 'Alias para el campo extra 6') !!}
{!! Form::text('alias6', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias7', 'Alias para el campo extra 7') !!}
{!! Form::text('alias7', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias8', 'Alias para el campo extra 8') !!}
{!! Form::text('alias8', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias9', 'Alias para el campo extra 9') !!}
{!! Form::text('alias9', null, ["class"=>"form-control"]) !!}
</div>
<div
class=
"form-group"
>
{!! Form::label('alias10', 'Alias para el campo extra 10') !!}
{!! Form::text('alias10', null, ["class"=>"form-control"]) !!}
</div>
</div>
</div>
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