Change tag routines, articles saving is ok
This commit is contained in:
@@ -12,7 +12,7 @@ class TagsDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Tag $model)
|
public function query(Tag $model)
|
||||||
{
|
{
|
||||||
$model = $model::with('group')->select(['tagging_tags.*']);
|
$model = $model::with('group')->select(['tags.*']);
|
||||||
return self::buildQuery($model);
|
return self::buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ class TagsDataTable extends DataTable
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('group.name')->title('Groupe'),
|
Column::make('group.name')->title('Groupe'),
|
||||||
Column::make('order')->title('Ordre'),
|
Column::make('sort_order')->title('Ordre'),
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
self::makeColumnButtons(),
|
self::makeColumnButtons(),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ class VarietyController extends Controller
|
|||||||
return view('Botanic.Admin.Varieties.edit', $data);
|
return view('Botanic.Admin.Varieties.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
return Varieties::destroy($id);
|
||||||
|
}
|
||||||
|
|
||||||
public function getImages(Request $request, $id = false)
|
public function getImages(Request $request, $id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : $request->input('id');
|
$id = $id ? $id : $request->input('id');
|
||||||
@@ -67,11 +72,6 @@ class VarietyController extends Controller
|
|||||||
return view('components.uploader.mini-gallery-items', $data);
|
return view('components.uploader.mini-gallery-items', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
|
||||||
{
|
|
||||||
return Varieties::destroy($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deleteImage(Request $request)
|
public function deleteImage(Request $request)
|
||||||
{
|
{
|
||||||
$id = $request->input('id');
|
$id = $request->input('id');
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ use Illuminate\Http\Request;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
use App\Repositories\Shop\Articles;
|
use App\Repositories\Shop\Articles;
|
||||||
use App\Repositories\Shop\ArticleAttributeFamilies;
|
|
||||||
use App\Repositories\Shop\ArticleFamilies;
|
|
||||||
use App\Repositories\Shop\Categories;
|
|
||||||
use App\Repositories\Shop\TagGroups;
|
|
||||||
use App\DataTables\Shop\ArticlesDataTable;
|
use App\DataTables\Shop\ArticlesDataTable;
|
||||||
|
|
||||||
class ArticleController extends Controller
|
class ArticleController extends Controller
|
||||||
@@ -26,19 +22,26 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = $this->getMeta();
|
||||||
$data['categories'] = Categories::getOptions();
|
|
||||||
$data['families'] = ArticleFamilies::getOptions();
|
|
||||||
$data['attribute_families'] = ArticleAttributeFamilies::getOptions();
|
|
||||||
$data['tags_list'] = TagGroups::getTreeTags();
|
|
||||||
// $data['models'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
|
||||||
$data['models'] = ['App\Models\Botanic\Variety' => 'Variétés'];
|
|
||||||
return view('Shop.Admin.Articles.create', $data);
|
return view('Shop.Admin.Articles.create', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$ret = Articles::store($request->all());
|
$data = $request->all();
|
||||||
|
$images = isset($data['images']) ? $data['images'] : false;
|
||||||
|
$categories = isset($data['categories']) ? $data['categories'] : false;
|
||||||
|
$tags = isset($data['tags']) ? $data['tags'] : false;
|
||||||
|
$prices = isset($data['prices']) ? $data['prices'] : false;
|
||||||
|
unset($data['images']);
|
||||||
|
unset($data['categories']);
|
||||||
|
unset($data['tags']);
|
||||||
|
unset($data['prices']);
|
||||||
|
$article = Articles::store($data);
|
||||||
|
Articles::storeImages($article, $images);
|
||||||
|
Articles::storeCategories($article, $categories);
|
||||||
|
Articles::storeTags($article, $categories);
|
||||||
|
Articles::storePrices($article, $prices);
|
||||||
return redirect()->route('Shop.Admin.Articles.index');
|
return redirect()->route('Shop.Admin.Articles.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,12 +53,7 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data = Articles::get($id);
|
$data = Articles::getFull($id);
|
||||||
$data['categories'] = Articles::getOptions();
|
|
||||||
$data['families'] = ArticleFamilies::getOptions();
|
|
||||||
$data['attribute_families'] = ArticleAttributeFamilies::getOptions();
|
|
||||||
$data['tags_list'] = TagGroups::getTreeTags();
|
|
||||||
$data['models'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
|
||||||
return view('Shop.Admin.Articles.edit', $data);
|
return view('Shop.Admin.Articles.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +67,18 @@ class ArticleController extends Controller
|
|||||||
return Articles::destroy($id);
|
return Articles::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMeta($data = [])
|
||||||
|
{
|
||||||
|
return Articles::getMeta($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImages(Request $request, $id = false)
|
||||||
|
{
|
||||||
|
$id = $id ? $id : $request->input('id');
|
||||||
|
$data['images'] = Articles::getImages($id);
|
||||||
|
return view('components.uploader.mini-gallery-items', $data);
|
||||||
|
}
|
||||||
|
|
||||||
public function deleteImage(Request $request)
|
public function deleteImage(Request $request)
|
||||||
{
|
{
|
||||||
$id = $request->input('id');
|
$id = $request->input('id');
|
||||||
|
|||||||
60
app/Http/Controllers/Shop/Admin/TagController.php
Normal file
60
app/Http/Controllers/Shop/Admin/TagController.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Shop\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
use App\Repositories\Shop\Tags;
|
||||||
|
use App\Repositories\Shop\TagGroups;
|
||||||
|
use App\DataTables\Shop\TagsDataTable;
|
||||||
|
|
||||||
|
class TagController extends Controller
|
||||||
|
{
|
||||||
|
public function index(TagsDataTable $dataTable)
|
||||||
|
{
|
||||||
|
return $dataTable->render('Shop.Admin.Tags.list');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDatatable(Request $request)
|
||||||
|
{
|
||||||
|
return Tags::getTables($request->all());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
$data['tag_groups'] = TagGroups::getOptions();
|
||||||
|
return view('Shop.Admin.Tags.create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$ret = Tags::store($request->all());
|
||||||
|
return redirect()->route('Shop.Admin.Tags.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Tags::get($id);
|
||||||
|
return view('Shop.Admin.Tags.view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data = Tags::get($id);
|
||||||
|
$data['tag_groups'] = TagGroups::getOptions();
|
||||||
|
return view('Shop.Admin.Tags.edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
return Tags::destroy($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
58
app/Http/Controllers/Shop/Admin/TaxController.php
Normal file
58
app/Http/Controllers/Shop/Admin/TaxController.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Shop\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
use App\Repositories\Shop\Taxes;
|
||||||
|
|
||||||
|
class TaxController extends Controller
|
||||||
|
{
|
||||||
|
public function index(TaxesDataTable $dataTable)
|
||||||
|
{
|
||||||
|
return $dataTable->render('Shop.Admin.Taxes.list');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDatatable(Request $request)
|
||||||
|
{
|
||||||
|
return Taxes::getTables($request->all());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
$data['groups'] = TagGroups::getOptions();
|
||||||
|
return view('Shop.Admin.Taxes.create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$ret = Taxes::store($request->all());
|
||||||
|
return redirect()->route('Shop.Admin.Taxes.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Taxes::get($id);
|
||||||
|
return view('Shop.Admin.Taxes.view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data = Taxes::get($id);
|
||||||
|
$data['groups'] = TagGroups::getOptions();
|
||||||
|
return view('Shop.Admin.Taxes.edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
return Taxes::destroy($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ namespace App\Models\Botanic;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||||
|
use Rinvex\Tags\Traits\Taggable;
|
||||||
|
|
||||||
class Variety extends Model implements HasMedia
|
class Variety extends Model implements HasMedia
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||||
use Rinvex\Categories\Traits\Categorizable;
|
use Rinvex\Categories\Traits\Categorizable;
|
||||||
use Conner\Tagging\Taggable;
|
use Rinvex\Tags\Traits\Taggable;
|
||||||
|
|
||||||
class Article extends Model
|
class Article extends Model implements HasMedia
|
||||||
{
|
{
|
||||||
use Categorizable;
|
use Categorizable;
|
||||||
use Taggable;
|
use Taggable;
|
||||||
@@ -37,11 +37,6 @@ class Article extends Model
|
|||||||
return $this->hasManyThrough('App\Models\Shop\ArticleAttribute','App\Models\Shop\ArticlePrice');
|
return $this->hasManyThrough('App\Models\Shop\ArticleAttribute','App\Models\Shop\ArticlePrice');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Categories()
|
|
||||||
{
|
|
||||||
return $this->hasMany('App\Models\Shop\ArticleCategory');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function InvoiceItems()
|
public function InvoiceItems()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace App\Models\Shop;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
use Rinvex\Categories\Traits\Categorizable;
|
use Rinvex\Categories\Traits\Categorizable;
|
||||||
use Conner\Tagging\Taggable;
|
// use Conner\Tagging\Taggable;
|
||||||
|
|
||||||
class Category extends Model
|
class Category extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,11 +7,20 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class Tag extends Model
|
class Tag extends Model
|
||||||
{
|
{
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
protected $table = 'tagging_tags';
|
|
||||||
|
|
||||||
public function group()
|
public function group()
|
||||||
{
|
{
|
||||||
return $this->hasOne('App\Models\Shop\TagGroup','id','tag_group_id');
|
return $this->hasOne('App\Models\Shop\TagGroup','id','tag_group_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeByGroup($query, $id)
|
||||||
|
{
|
||||||
|
return $query->where('tag_group_id', $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNameAttribute($value)
|
||||||
|
{
|
||||||
|
return json_decode($value)->fr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class TagGroup extends Model
|
class TagGroup extends Model
|
||||||
{
|
{
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
protected $table = 'tagging_tag_groups';
|
protected $table = 'tag_groups';
|
||||||
|
|
||||||
public function tags()
|
public function tags()
|
||||||
{
|
{
|
||||||
|
|||||||
17
app/Models/Shop/Tax.php
Normal file
17
app/Models/Shop/Tax.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Shop;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Tax extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
protected $table = 'shop_taxes';
|
||||||
|
|
||||||
|
public function price()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\Shop\ArticlePrice','id','tax_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -79,11 +79,15 @@ class Varieties
|
|||||||
public static function getImages($id)
|
public static function getImages($id)
|
||||||
{
|
{
|
||||||
$variety = self::get($id);
|
$variety = self::get($id);
|
||||||
|
if ($variety) {
|
||||||
$variety->getMedia();
|
$variety->getMedia();
|
||||||
foreach ($variety->media as $key => $media) {
|
foreach ($variety->media as $key => $media) {
|
||||||
$variety->media[$key]['url'] = $media->getUrl();
|
$variety->media[$key]['url'] = $media->getUrl();
|
||||||
}
|
}
|
||||||
return $variety->media;
|
return $variety->media;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteImage($id, $index)
|
public static function deleteImage($id, $index)
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ class ArticleAttributes
|
|||||||
return ArticleAttribute::find($id);
|
return ArticleAttribute::find($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function storeAttributes($article_price_id, $attributes)
|
||||||
|
{
|
||||||
|
foreach ($attributes as $key => $attribute)
|
||||||
|
{
|
||||||
|
$attributes[$key]['article_price_id'] = $article_price_id;
|
||||||
|
unset($attributes[$key]['attribute_family_id']);
|
||||||
|
self::store($attributes[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function store($data)
|
public static function store($data)
|
||||||
{
|
{
|
||||||
$id = isset($data['id']) ? $data['id'] : false;
|
$id = isset($data['id']) ? $data['id'] : false;
|
||||||
|
|||||||
@@ -29,11 +29,34 @@ class ArticlePrices
|
|||||||
return ArticlePrice::find($id);
|
return ArticlePrice::find($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function storePrices($article_id, $prices)
|
||||||
|
{
|
||||||
|
if ($prices) {
|
||||||
|
foreach ($prices as $$key => $price) {
|
||||||
|
$prices[$key]['article_id'] = $article_id;
|
||||||
|
self::store($prices[$key]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeAttributes($article_price_id,$attributes)
|
||||||
|
{
|
||||||
|
return ArticleAttributes::storeAttributes($article_price_id, $attributes);
|
||||||
|
}
|
||||||
|
|
||||||
public static function store($data)
|
public static function store($data)
|
||||||
{
|
{
|
||||||
|
$attributes = isset($data['attributes']) ? $data['attributes'] : false;
|
||||||
|
unset($data['attributes']);
|
||||||
|
|
||||||
$id = isset($data['id']) ? $data['id'] : false;
|
$id = isset($data['id']) ? $data['id'] : false;
|
||||||
$item = $id ? self::update($data) : self::create($data);
|
$price = $id ? self::update($data) : self::create($data);
|
||||||
return $item->id;
|
|
||||||
|
$ret = $attributes ? self::storeAttributes($price->id, $attributes) : false;
|
||||||
|
|
||||||
|
return $price->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function create($data)
|
public static function create($data)
|
||||||
|
|||||||
@@ -24,6 +24,37 @@ class Articles
|
|||||||
return Article::orderBy('name','asc')->get();
|
return Article::orderBy('name','asc')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getFull($id)
|
||||||
|
{
|
||||||
|
$article = Articles::get($id);
|
||||||
|
$data = $article->toArray();
|
||||||
|
$data['categories'] = self::getCategoriesByArticle($article);
|
||||||
|
$data['tags'] = self::getTagsByArticle($article);
|
||||||
|
$data = self::getMeta($data);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getMeta($data = [])
|
||||||
|
{
|
||||||
|
$data['categories_options'] = Categories::getOptions();
|
||||||
|
$data['families_options'] = ArticleFamilies::getOptions();
|
||||||
|
$data['taxes_options'] = Taxes::getOptions();
|
||||||
|
$data['attribute_families_options'] = ArticleAttributeFamilies::getOptions();
|
||||||
|
$data['tags_list'] = TagGroups::getTreeTags();
|
||||||
|
$data['models_options'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCategoriesByArticle($article)
|
||||||
|
{
|
||||||
|
return $article->categories->pluck('id')->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getTagsByArticle($article)
|
||||||
|
{
|
||||||
|
return $article->tags->pluck('id')->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
public static function get($id)
|
public static function get($id)
|
||||||
{
|
{
|
||||||
return Article::find($id);
|
return Article::find($id);
|
||||||
@@ -32,8 +63,7 @@ class Articles
|
|||||||
public static function store($data)
|
public static function store($data)
|
||||||
{
|
{
|
||||||
$id = isset($data['id']) ? $data['id'] : false;
|
$id = isset($data['id']) ? $data['id'] : false;
|
||||||
$item = $id ? self::update($data) : self::create($data);
|
return $id ? self::update($data) : self::create($data);
|
||||||
return $item->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function create($data)
|
public static function create($data)
|
||||||
@@ -41,9 +71,12 @@ class Articles
|
|||||||
return Article::create($data);
|
return Article::create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function update($data)
|
public static function update($data, $id = false)
|
||||||
{
|
{
|
||||||
return Article::find($id)->update($data);
|
$id = $id ? $id : $data['id'];
|
||||||
|
$article = Article::find($id);
|
||||||
|
$ret = $article->update($data);
|
||||||
|
return $article;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function destroy($id)
|
public static function destroy($id)
|
||||||
@@ -51,14 +84,57 @@ class Articles
|
|||||||
return Article::destroy($id);
|
return Article::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function storeCategories($article, $categories)
|
||||||
|
{
|
||||||
|
if ($categories)
|
||||||
|
{
|
||||||
|
$categories = collect($categories)->transform(function ($item, $key) {
|
||||||
|
return (int) $item;
|
||||||
|
})->toArray();
|
||||||
|
return $article->attachCategories($categories);
|
||||||
|
} else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeTags($article, $tags)
|
||||||
|
{
|
||||||
|
if ($tags)
|
||||||
|
{
|
||||||
|
return $article->attachTags($tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storePrices($article, $prices)
|
||||||
|
{
|
||||||
|
return ArticlePrices::storePrices($article->id, $prices);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeImages($article, $files)
|
||||||
|
{
|
||||||
|
if ($files) {
|
||||||
|
foreach ($files as $file) {
|
||||||
|
self::storeImage($article, $file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function storeImage($article, $file)
|
||||||
|
{
|
||||||
|
return $article->addMedia($file)->withResponsiveImages()->toMediaCollection('images');
|
||||||
|
}
|
||||||
|
|
||||||
public static function getImages($id)
|
public static function getImages($id)
|
||||||
{
|
{
|
||||||
$variety = self::get($id);
|
$article = self::get($id);
|
||||||
$variety->getMedia();
|
if ($article)
|
||||||
foreach ($variety->media as $key => $media) {
|
{
|
||||||
$variety->media[$key]['url'] = $media->getUrl();
|
$article->getMedia();
|
||||||
|
foreach ($article->media as $key => $media) {
|
||||||
|
$article->media[$key]['url'] = $media->getUrl();
|
||||||
|
}
|
||||||
|
return $article->media;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return $variety->media;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,19 @@ class Tags
|
|||||||
|
|
||||||
public static function create($data)
|
public static function create($data)
|
||||||
{
|
{
|
||||||
return Tag::create($data);
|
$tag = app('rinvex.tags.tag')->create(['name' => ['fr' => $data['name']]]);
|
||||||
|
$tag2 = Tag::find($tag->id);
|
||||||
|
$tag2->tag_group_id = $data['tag_group_id'];
|
||||||
|
$tag2->sort_order = self::getNewOrder($data['tag_group_id']);
|
||||||
|
$tag2->save();
|
||||||
|
// return app('rinvex.tags.tag')->createByName($data['name']);
|
||||||
|
// return Tag::create($data);
|
||||||
|
return $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function update($data)
|
public static function update($data, $id = false)
|
||||||
{
|
{
|
||||||
|
$id = $id ? $id : $data['id'];
|
||||||
return Tag::find($id)->update($data);
|
return Tag::find($id)->update($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,4 +64,9 @@ class Tags
|
|||||||
return Tag::destroy($id);
|
return Tag::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getNewOrder($tag_group_id)
|
||||||
|
{
|
||||||
|
$tag = Tag::byGroup($tag_group_id)->orderBy('sort_order', 'desc')->first();
|
||||||
|
return $tag ? (int) $tag->sort_order + 1 : 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
58
app/Repositories/Shop/Taxes.php
Normal file
58
app/Repositories/Shop/Taxes.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
use Yajra\DataTables\DataTables;
|
||||||
|
|
||||||
|
use App\Models\Shop\Tax;
|
||||||
|
|
||||||
|
class Taxes
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function getDatatable()
|
||||||
|
{
|
||||||
|
return Datatables::of($model)->make(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getOptions()
|
||||||
|
{
|
||||||
|
return Tax::orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAll()
|
||||||
|
{
|
||||||
|
return Tax::orderBy('value','asc')->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get($id)
|
||||||
|
{
|
||||||
|
return Tax::find($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function store($data)
|
||||||
|
{
|
||||||
|
$id = isset($data['id']) ? $data['id'] : false;
|
||||||
|
$item = $id ? self::update($data) : self::create($data);
|
||||||
|
return $item->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create($data)
|
||||||
|
{
|
||||||
|
return Tax::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function update($data)
|
||||||
|
{
|
||||||
|
return Tax::find($id)->update($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function destroy($id)
|
||||||
|
{
|
||||||
|
return Tax::destroy($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,7 +20,9 @@
|
|||||||
"coduo/php-humanizer": "^3.0",
|
"coduo/php-humanizer": "^3.0",
|
||||||
"consoletvs/charts": "^6.5",
|
"consoletvs/charts": "^6.5",
|
||||||
"cornford/googlmapper": "^2.3",
|
"cornford/googlmapper": "^2.3",
|
||||||
|
"darryldecode/cart": "^4.1",
|
||||||
"datatables/datatables": "^1.10",
|
"datatables/datatables": "^1.10",
|
||||||
|
"deployer/deployer": "^6.8",
|
||||||
"dompdf/dompdf": "^0.8.5",
|
"dompdf/dompdf": "^0.8.5",
|
||||||
"eduardokum/laravel-mail-auto-embed": "^1.0",
|
"eduardokum/laravel-mail-auto-embed": "^1.0",
|
||||||
"erjanmx/laravel-migrate-check": "^1.3",
|
"erjanmx/laravel-migrate-check": "^1.3",
|
||||||
@@ -44,6 +46,7 @@
|
|||||||
"laravelcollective/html": "^6.0",
|
"laravelcollective/html": "^6.0",
|
||||||
"league/climate": "^3.5",
|
"league/climate": "^3.5",
|
||||||
"league/period": "^4.9",
|
"league/period": "^4.9",
|
||||||
|
"lorisleiva/laravel-deployer": "^0.3.2",
|
||||||
"maatwebsite/excel": "^3.1",
|
"maatwebsite/excel": "^3.1",
|
||||||
"mad-web/laravel-initializer": "^2.0",
|
"mad-web/laravel-initializer": "^2.0",
|
||||||
"mediactive-digital/migrations-generator": "^2.0",
|
"mediactive-digital/migrations-generator": "^2.0",
|
||||||
@@ -60,7 +63,7 @@
|
|||||||
"rcrowe/twigbridge": "^0.11.3",
|
"rcrowe/twigbridge": "^0.11.3",
|
||||||
"respect/validation": "^1.1",
|
"respect/validation": "^1.1",
|
||||||
"rinvex/laravel-categories": "^3.0",
|
"rinvex/laravel-categories": "^3.0",
|
||||||
"rtconner/laravel-tagging": "^3.2",
|
"rinvex/laravel-tags": "^3.0",
|
||||||
"rutorika/sortable": "^6.0",
|
"rutorika/sortable": "^6.0",
|
||||||
"santigarcor/laratrust": "^5.2",
|
"santigarcor/laratrust": "^5.2",
|
||||||
"sebastienheyd/boilerplate": "^7.1",
|
"sebastienheyd/boilerplate": "^7.1",
|
||||||
|
|||||||
165
config/deploy.php
Normal file
165
config/deploy.php
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default deployment strategy
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option defines which deployment strategy to use by default on all
|
||||||
|
| of your hosts. Laravel Deployer provides some strategies out-of-box
|
||||||
|
| for you to choose from explained in detail in the documentation.
|
||||||
|
|
|
||||||
|
| Supported: 'basic', 'firstdeploy', 'local', 'pull'.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => 'basic',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Custom deployment strategies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here, you can easily set up new custom strategies as a list of tasks.
|
||||||
|
| Any key of this array are supported in the `default` option above.
|
||||||
|
| Any key matching Laravel Deployer's strategies overrides them.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'strategies' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Hooks
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Hooks let you customize your deployments conveniently by pushing tasks
|
||||||
|
| into strategic places of your deployment flow. Each of the official
|
||||||
|
| strategies invoke hooks in different ways to implement their logic.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'hooks' => [
|
||||||
|
// Right before we start deploying.
|
||||||
|
'start' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
// Code and composer vendors are ready but nothing is built.
|
||||||
|
'build' => [
|
||||||
|
'yarn:install',
|
||||||
|
'yarn:production',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Deployment is done but not live yet (before symlink)
|
||||||
|
'ready' => [
|
||||||
|
'artisan:storage:link',
|
||||||
|
'artisan:view:clear',
|
||||||
|
'artisan:cache:clear',
|
||||||
|
'artisan:config:cache',
|
||||||
|
'artisan:migrate',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Deployment is done and live
|
||||||
|
'done' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
// Deployment succeeded.
|
||||||
|
'success' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
// Deployment failed.
|
||||||
|
'fail' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
// After a deployment has been rolled back.
|
||||||
|
'rollback' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Deployment options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Options follow a simple key/value structure and are used within tasks
|
||||||
|
| to make them more configurable and reusable. You can use options to
|
||||||
|
| configure existing tasks or to use within your own custom tasks.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'options' => [
|
||||||
|
'application' => env('APP_NAME', 'Laravel'),
|
||||||
|
'repository' => 'https://gitlab.huma.net/ludo/opensem.git',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Hosts
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here, you can define any domain or subdomain you want to deploy to.
|
||||||
|
| You can provide them with roles and stages to filter them during
|
||||||
|
| deployment. Read more about how to configure them in the docs.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'hosts' => [
|
||||||
|
'jardinenvie.monbiz.net' => [
|
||||||
|
'deploy_path' => '/var/www/jardinenvie.monbiz.net/web',
|
||||||
|
'user' => 'web32',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Localhost
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This localhost option give you the ability to deploy directly on your
|
||||||
|
| local machine, without needing any SSH connection. You can use the
|
||||||
|
| same configurations used by hosts to configure your localhost.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'localhost' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Include additional Deployer recipes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here, you can add any third party recipes to provide additional tasks,
|
||||||
|
| options and strategies. Therefore, it also allows you to create and
|
||||||
|
| include your own recipes to define more complex deployment flows.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'include' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Use a custom Deployer file
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you know what you are doing and want to take complete control over
|
||||||
|
| Deployer's file, you can provide its path here. Note that, without
|
||||||
|
| this configuration file, the root's deployer file will be used.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'custom_deployer_file' => false,
|
||||||
|
|
||||||
|
];
|
||||||
36
config/shopping_cart.php
Normal file
36
config/shopping_cart.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
/*
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* formatting
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* the formatting of shopping cart values
|
||||||
|
*/
|
||||||
|
'format_numbers' => env('SHOPPING_FORMAT_VALUES', false),
|
||||||
|
|
||||||
|
'decimals' => env('SHOPPING_DECIMALS', 0),
|
||||||
|
|
||||||
|
'dec_point' => env('SHOPPING_DEC_POINT', '.'),
|
||||||
|
|
||||||
|
'thousands_sep' => env('SHOPPING_THOUSANDS_SEP', ','),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* persistence
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* the configuration for persisting cart
|
||||||
|
*/
|
||||||
|
'storage' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* events
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* the configuration for cart events
|
||||||
|
*/
|
||||||
|
'events' => null,
|
||||||
|
];
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@include('components.uploader.widget', ['delete_url' => route('Botanic.Admin.Varieties.deleteImage') ])
|
@include('components.uploader.widget', ['load_url' => route('Botanic.Admin.Varieties.getImages', ['id' => (isset($id)) ? $id : false]), 'delete_url' => route('Botanic.Admin.Varieties.deleteImage') ])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Shop.Admin.Articles.update', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 mbl">
|
<div class="col-sm-12 mbl">
|
||||||
|
|||||||
@@ -2,38 +2,42 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-2">
|
||||||
{{ Form::label('model', 'Familles de produit') }}
|
{{ Form::label('ref', 'Référence') }}<br>
|
||||||
@include('components.select', ['name' => 'model', 'id_name' => 'model', 'list' => $models, 'value' => isset($model) ? $model : null, 'class' => 'select2 form-control'])
|
@include('components.input', ['name' => 'ref', 'value' => isset($ref) ? $ref : null])
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
{{ Form::label('model', 'Familles de produit') }}<br>
|
||||||
|
@include('components.select', ['name' => 'model', 'id_name' => 'model', 'list' => $models_options, 'value' => isset($model) ? $model : null, 'class' => 'select2 form-control'])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
{{ Form::label('model_id', 'Produit') }}
|
{{ Form::label('model_id', 'Produit') }}<br>
|
||||||
@include('components.select2', ['name' => 'model_id', 'id_name' => 'model_id', 'value' => isset($model_id) ? $model_id : null, 'class' => 'select2 form-control'])
|
@include('components.select2', ['name' => 'model_id', 'id_name' => 'model_id', 'value' => isset($model_id) ? $model_id : null, 'class' => 'select2 form-control'])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
{{ Form::label('name', 'Nom') }}
|
{{ Form::label('name', 'Nom') }}<br>
|
||||||
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
{{ Form::label('family_id', 'Famille d\'articles') }}
|
{{ Form::label('family_id', 'Famille d\'articles') }}<br>
|
||||||
@include('components.select', ['name' => 'family_id', 'list' => $families, 'value' => isset($family_id) ? $family_id : null, 'class' => 'select2 form-control'])
|
@include('components.select', ['name' => 'article_family_id', 'list' => $families_options, 'value' => isset($article_family_id) ? $article_family_id : null, 'class' => 'select2 form-control'])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ Form::label('categories', 'Catégories') }}
|
{{ Form::label('categories', 'Catégories') }}<br>
|
||||||
@include('components.select', ['name' => 'categories', 'list' => $categories, 'value' => isset($category_id) ? $category_id : null, 'class' => 'select2 form-control', 'multiple' => true])
|
@include('components.select', ['name' => 'categories[]', 'list' => $categories_options, 'values' => isset($categories) ? $categories : null, 'class' => 'select2 form-control', 'multiple' => true])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ Form::label('tags', 'Tags') }}
|
{{ Form::label('tags', 'Tags') }}<br>
|
||||||
@include('components.select-tree', ['name' => 'tags', 'list' => $tags_list, 'value' => isset($tags) ? $tags : null, 'class' => 'select2 form-control', 'multiple' => true])
|
@include('components.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => isset($tags) ? $tags : null, 'class' => 'select2 form-control', 'multiple' => true])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -46,7 +50,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@include('components.uploader.widget', ['delete_url' => route('Shop.Admin.Articles.deleteImage') ])
|
@include('components.uploader.widget', ['load_url' => route('Shop.Admin.Articles.getImages', ['id' => (isset($id)) ? $id : false]), 'delete_url' => route('Shop.Admin.Articles.deleteImage') ])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -70,6 +74,7 @@
|
|||||||
data: {model: $('#model').val()},
|
data: {model: $('#model').val()},
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
$("#model_id").select2({data: data});
|
$("#model_id").select2({data: data});
|
||||||
|
$("#model_id").val({{ $model_id }}).trigger('change');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<input type="hidden" name="prices[][attributes][quantity]" value="1">
|
<input type="hidden" name="prices[][attributes][quantity]" value="1">
|
||||||
<div class="col-12 col-lg-6 1">
|
<div class="col-12 col-lg-6 1">
|
||||||
{{ Form::label('attribute_family_id', 'Attributs') }}<br/>
|
{{ Form::label('attribute_family_id', 'Attributs') }}<br/>
|
||||||
@include('components.select', ['name' => 'prices[][attributes][attribute_family_id]', 'value' => (isset($attribute_value['attribute_family_id'])) ? $attribute_value['attribute_family_id'] : null, 'list' => $attribute_families, 'required' => true, 'class' => 'select2 form-control form-control-sm attributes-family'])
|
@include('components.select', ['name' => 'prices[][attributes][attribute_family_id]', 'value' => (isset($attribute_value['attribute_family_id'])) ? $attribute_value['attribute_family_id'] : null, 'list' => $attribute_families_options, 'required' => true, 'class' => 'select2 form-control form-control-sm attributes-family'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-lg-6 2">
|
<div class="col-12 col-lg-6 2">
|
||||||
|
|||||||
@@ -18,17 +18,17 @@
|
|||||||
|
|
||||||
<div class="col-lg-1">
|
<div class="col-lg-1">
|
||||||
{{ Form::label('tax_id', 'TVA') }}<br/>
|
{{ Form::label('tax_id', 'TVA') }}<br/>
|
||||||
@include('components.select', ['name' => 'prices[0][tax_id]', 'value' => (isset($tax_id)) ? $tax_id : null, 'list' => isset($taxes) ? $taxes : null, 'required' => true, 'class' => 'form-control form-control-sm'])
|
@include('components.select', ['name' => 'prices[0][tax_id]', 'value' => (isset($tax_id)) ? $tax_id : null, 'list' => isset($taxes_options) ? $taxes_options : null, 'required' => true, 'class' => 'form-control form-control-sm'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-2">
|
<div class="col-lg-2">
|
||||||
{{ Form::label('price', 'Prix HT') }}
|
{{ Form::label('price', 'Prix HT') }}
|
||||||
@include('components.money', ['name' => 'prices[0][price]', 'value' => (isset($price)) ? $price : 0, 'required' => true, 'class' => 'form-control-sm'])
|
@include('components.money', ['name' => 'prices[0][price]', 'value' => (isset($price)) ? $price : 0, 'required' => true, 'class' => 'form-control-sm price-item'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-2">
|
<div class="col-lg-2">
|
||||||
{{ Form::label('price_taxed', 'Prix TTC') }}
|
{{ Form::label('price_taxed', 'Prix TTC') }}
|
||||||
@include('components.money', ['name' => 'prices[0][price_taxed]', 'value' => (isset($price_ht)) ? $price_ht : 0, 'required' => true, 'class' => 'form-control-sm'])
|
@include('components.money', ['name' => 'prices[0][price_taxed]', 'value' => (isset($price_taxed)) ? $price_taxed : 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-1 text-right">
|
<div class="col-lg-1 text-right">
|
||||||
|
|||||||
@@ -4,16 +4,14 @@
|
|||||||
'breadcrumb' => [__('tags.title'), __('tags.create.title')]
|
'breadcrumb' => [__('tags.title'), __('tags.create.title')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Shop.Admin.ArticleFamilies.store', 'id' => 'tag-form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Shop.Admin.Tags.store', 'id' => 'tag-form', 'autocomplete' => 'off']) }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 mbl">
|
<div class="col-sm-12 mbl">
|
||||||
<a href="{{ route("Shop.Admin.Articles.index") }}" class="btn btn-default">
|
<a href="{{ route("Shop.Admin.Articles.index") }}" class="btn btn-default">
|
||||||
{{ __('article_families.list.title') }}
|
{{ __('tags.list.title') }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<span class="btn-group pull-right">
|
<span class="btn-group pull-right">
|
||||||
@@ -22,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@include('Shop.Admin.ArticleFamilies.form')
|
@include('Shop.Admin.Tags.form')
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => 'Famille d\'articles',
|
'title' => __('tags.title'),
|
||||||
'subtitle' => 'Edition d\'une famille d\'article',
|
'subtitle' => __('tags.edit.title'),
|
||||||
'breadcrumb' => ['Articles']
|
'breadcrumb' => [__('tags.title'), __('tags.create.title')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Shop.Admin.ArticleFamilies.update', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Shop.Admin.Tags.store', 'id' => 'tag-form', 'autocomplete' => 'off']) }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 mbl">
|
<div class="col-sm-12 mbl">
|
||||||
<a href="{{ route("Shop.Admin.ArticleFamilies.index") }}" class="btn btn-default">
|
<a href="{{ route("Shop.Admin.Tags.index") }}" class="btn btn-default">
|
||||||
{{ __('article_families.list.title') }}
|
{{ __('tags.title') }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<span class="btn-group pull-right">
|
<span class="btn-group pull-right">
|
||||||
@@ -23,7 +21,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="id" value="{{ $id }}">
|
<input type="hidden" name="id" value="{{ $id }}">
|
||||||
@include('Shop.Admin.ArticleFamilies.form')
|
@include('Shop.Admin.Tags.form')
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
{{ Form::label('name', 'Groupe') }}
|
||||||
|
@include('components.select', ['name' => 'tag_group_id', 'list' => $tag_groups, 'value' => isset($tag_group_id) ? $tag_group_id : null, 'required' => true])
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
{{ Form::label('name', 'Nom') }}
|
{{ Form::label('name', 'Nom') }}
|
||||||
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
@include('components.input', ['type' => 'number'])
|
@include('components.input', ['type' => 'number', 'meta' => "step = '.01'"])
|
||||||
5
resources/views/components/options-multiple.blade.php
Normal file
5
resources/views/components/options-multiple.blade.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
@if (isset($list) && count($list))
|
||||||
|
@foreach($list as $key => $item)
|
||||||
|
<option @if (isset($values) && in_array($key, $values)) selected @endif value="{{$key}}">{{ $item }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
5
resources/views/components/options-simple.blade.php
Normal file
5
resources/views/components/options-simple.blade.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
@if (isset($list) && count($list))
|
||||||
|
@foreach($list as $key => $item)
|
||||||
|
<option @if (isset($value) && ($key == $value)) selected @endif value="{{$key}}">{{ $item }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
@if (isset($list) && count($list))
|
@if (isset($complex) && $complex)
|
||||||
@foreach($list as $key => $item)
|
@include('components.options-complex')
|
||||||
<option @if (isset($value) && ($key == $value)) selected @endif value="{{$key}}">{{ $item }}</option>
|
@else
|
||||||
@endforeach
|
@if (isset($multiple) && $multiple)
|
||||||
|
@include('components.options-multiple')
|
||||||
|
@else
|
||||||
|
@include('components.options-simple')
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
@@ -9,9 +9,7 @@
|
|||||||
@if (isset($with_empty))
|
@if (isset($with_empty))
|
||||||
<option>{{ $with_empty }}</option>
|
<option>{{ $with_empty }}</option>
|
||||||
@endif
|
@endif
|
||||||
@if (isset($complex) && $complex)
|
|
||||||
@include('components.options-complex')
|
|
||||||
@else
|
|
||||||
@include('components.options')
|
@include('components.options')
|
||||||
@endif
|
|
||||||
</select>
|
</select>
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@if ($images)
|
||||||
@foreach($images as $key => $image)
|
@foreach($images as $key => $image)
|
||||||
<figure class="mr-2">
|
<figure class="mr-2">
|
||||||
<img src="{{ $image['url'] }}" class="img-thumbnail img-caption" style="max-height:92px;">
|
<img src="{{ $image['url'] }}" class="img-thumbnail img-caption" style="max-height:92px;">
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@endif
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
handleDeleteImages();
|
handleDeleteImages();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
{
|
{
|
||||||
$gallery = $("#uploader-mini-gallery");
|
$gallery = $("#uploader-mini-gallery");
|
||||||
if ($gallery) {
|
if ($gallery) {
|
||||||
$gallery.load("{{ route('Botanic.Admin.Varieties.getImages', ['id' => (isset($id)) ? $id : false]) }}");
|
$gallery.load("{{ $load_url }}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user