From abc15102849569a03f791881c44163f61db8ab68 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Sun, 14 Jun 2020 23:30:33 +0200 Subject: [PATCH] Change tag routines, articles saving is ok --- app/DataTables/Shop/TagsDataTable.php | 4 +- .../Botanic/Admin/VarietyController.php | 10 +- .../Shop/Admin/ArticleController.php | 46 +++-- .../Controllers/Shop/Admin/TagController.php | 60 +++++++ .../Controllers/Shop/Admin/TaxController.php | 58 ++++++ app/Models/Botanic/Variety.php | 1 + app/Models/Shop/Article.php | 9 +- app/Models/Shop/Category.php | 2 +- app/Models/Shop/Tag.php | 11 +- app/Models/Shop/TagGroup.php | 2 +- app/Models/Shop/Tax.php | 17 ++ app/Repositories/Botanic/Varieties.php | 12 +- app/Repositories/Shop/ArticleAttributes.php | 10 ++ app/Repositories/Shop/ArticlePrices.php | 85 +++++---- app/Repositories/Shop/Articles.php | 94 +++++++++- app/Repositories/Shop/Tags.php | 17 +- app/Repositories/Shop/Taxes.php | 58 ++++++ composer.json | 5 +- config/deploy.php | 165 ++++++++++++++++++ config/shopping_cart.php | 36 ++++ .../Botanic/Admin/Varieties/form.blade.php | 2 +- .../views/Shop/Admin/Articles/edit.blade.php | 2 +- .../partials/characteristics.blade.php | 29 +-- .../prices/block_attribute_new.blade.php | 2 +- .../partials/prices/block_price_new.blade.php | 6 +- .../views/Shop/Admin/Tags/create.blade.php | 8 +- .../views/Shop/Admin/Tags/edit.blade.php | 16 +- .../views/Shop/Admin/Tags/form.blade.php | 13 +- resources/views/components/money.blade.php | 2 +- .../components/options-multiple.blade.php | 5 + .../views/components/options-simple.blade.php | 5 + resources/views/components/options.blade.php | 14 +- resources/views/components/select.blade.php | 8 +- .../uploader/mini-gallery-items.blade.php | 28 +-- .../components/uploader/widget.blade.php | 2 +- 35 files changed, 703 insertions(+), 141 deletions(-) create mode 100644 app/Http/Controllers/Shop/Admin/TagController.php create mode 100644 app/Http/Controllers/Shop/Admin/TaxController.php create mode 100644 app/Models/Shop/Tax.php create mode 100644 app/Repositories/Shop/Taxes.php create mode 100644 config/deploy.php create mode 100644 config/shopping_cart.php create mode 100644 resources/views/components/options-multiple.blade.php create mode 100644 resources/views/components/options-simple.blade.php diff --git a/app/DataTables/Shop/TagsDataTable.php b/app/DataTables/Shop/TagsDataTable.php index 01a2cdb9..3ceaafbc 100644 --- a/app/DataTables/Shop/TagsDataTable.php +++ b/app/DataTables/Shop/TagsDataTable.php @@ -12,7 +12,7 @@ class TagsDataTable extends DataTable public function query(Tag $model) { - $model = $model::with('group')->select(['tagging_tags.*']); + $model = $model::with('group')->select(['tags.*']); return self::buildQuery($model); } @@ -20,7 +20,7 @@ class TagsDataTable extends DataTable { return [ Column::make('group.name')->title('Groupe'), - Column::make('order')->title('Ordre'), + Column::make('sort_order')->title('Ordre'), Column::make('name')->title('Nom'), self::makeColumnButtons(), ]; diff --git a/app/Http/Controllers/Botanic/Admin/VarietyController.php b/app/Http/Controllers/Botanic/Admin/VarietyController.php index 0a1d8da0..32ee5231 100644 --- a/app/Http/Controllers/Botanic/Admin/VarietyController.php +++ b/app/Http/Controllers/Botanic/Admin/VarietyController.php @@ -60,6 +60,11 @@ class VarietyController extends Controller return view('Botanic.Admin.Varieties.edit', $data); } + public function destroy($id) + { + return Varieties::destroy($id); + } + public function getImages(Request $request, $id = false) { $id = $id ? $id : $request->input('id'); @@ -67,11 +72,6 @@ class VarietyController extends Controller return view('components.uploader.mini-gallery-items', $data); } - public function destroy($id) - { - return Varieties::destroy($id); - } - public function deleteImage(Request $request) { $id = $request->input('id'); diff --git a/app/Http/Controllers/Shop/Admin/ArticleController.php b/app/Http/Controllers/Shop/Admin/ArticleController.php index c6ce259b..59622d9c 100644 --- a/app/Http/Controllers/Shop/Admin/ArticleController.php +++ b/app/Http/Controllers/Shop/Admin/ArticleController.php @@ -6,10 +6,6 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; 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; class ArticleController extends Controller @@ -26,19 +22,26 @@ class ArticleController extends Controller public function create() { - $data = []; - $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']; + $data = $this->getMeta(); return view('Shop.Admin.Articles.create', $data); } 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'); } @@ -50,12 +53,7 @@ class ArticleController extends Controller public function edit($id) { - $data = Articles::get($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']; + $data = Articles::getFull($id); return view('Shop.Admin.Articles.edit', $data); } @@ -69,6 +67,18 @@ class ArticleController extends Controller 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) { $id = $request->input('id'); diff --git a/app/Http/Controllers/Shop/Admin/TagController.php b/app/Http/Controllers/Shop/Admin/TagController.php new file mode 100644 index 00000000..e08201ec --- /dev/null +++ b/app/Http/Controllers/Shop/Admin/TagController.php @@ -0,0 +1,60 @@ +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); + } + +} diff --git a/app/Http/Controllers/Shop/Admin/TaxController.php b/app/Http/Controllers/Shop/Admin/TaxController.php new file mode 100644 index 00000000..2e315358 --- /dev/null +++ b/app/Http/Controllers/Shop/Admin/TaxController.php @@ -0,0 +1,58 @@ +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); + } + +} diff --git a/app/Models/Botanic/Variety.php b/app/Models/Botanic/Variety.php index 871bcdbe..54eb4ebb 100644 --- a/app/Models/Botanic/Variety.php +++ b/app/Models/Botanic/Variety.php @@ -5,6 +5,7 @@ namespace App\Models\Botanic; use Illuminate\Database\Eloquent\Model; use Spatie\MediaLibrary\HasMedia\HasMedia; use Spatie\MediaLibrary\HasMedia\HasMediaTrait; +use Rinvex\Tags\Traits\Taggable; class Variety extends Model implements HasMedia { diff --git a/app/Models/Shop/Article.php b/app/Models/Shop/Article.php index 674c03c7..cb6618d0 100644 --- a/app/Models/Shop/Article.php +++ b/app/Models/Shop/Article.php @@ -6,9 +6,9 @@ use Illuminate\Database\Eloquent\Model; use Spatie\MediaLibrary\HasMedia\HasMedia; use Spatie\MediaLibrary\HasMedia\HasMediaTrait; 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 Taggable; @@ -37,11 +37,6 @@ class Article extends Model return $this->hasManyThrough('App\Models\Shop\ArticleAttribute','App\Models\Shop\ArticlePrice'); } - public function Categories() - { - return $this->hasMany('App\Models\Shop\ArticleCategory'); - } - public function InvoiceItems() { return $this->hasMany('App\Models\Shop\InvoiceItem'); diff --git a/app/Models/Shop/Category.php b/app/Models/Shop/Category.php index f59de402..9250159f 100644 --- a/app/Models/Shop/Category.php +++ b/app/Models/Shop/Category.php @@ -5,7 +5,7 @@ namespace App\Models\Shop; use Illuminate\Database\Eloquent\Model; use Rinvex\Categories\Traits\Categorizable; -use Conner\Tagging\Taggable; +// use Conner\Tagging\Taggable; class Category extends Model { diff --git a/app/Models/Shop/Tag.php b/app/Models/Shop/Tag.php index 85ed3f6b..cc884350 100644 --- a/app/Models/Shop/Tag.php +++ b/app/Models/Shop/Tag.php @@ -7,11 +7,20 @@ use Illuminate\Database\Eloquent\Model; class Tag extends Model { protected $guarded = ['id']; - protected $table = 'tagging_tags'; public function group() { 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; + } + } diff --git a/app/Models/Shop/TagGroup.php b/app/Models/Shop/TagGroup.php index 3322b14d..01e07219 100644 --- a/app/Models/Shop/TagGroup.php +++ b/app/Models/Shop/TagGroup.php @@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model; class TagGroup extends Model { protected $guarded = ['id']; - protected $table = 'tagging_tag_groups'; + protected $table = 'tag_groups'; public function tags() { diff --git a/app/Models/Shop/Tax.php b/app/Models/Shop/Tax.php new file mode 100644 index 00000000..4f3a333a --- /dev/null +++ b/app/Models/Shop/Tax.php @@ -0,0 +1,17 @@ +hasMany('App\Models\Shop\ArticlePrice','id','tax_id'); + } + +} diff --git a/app/Repositories/Botanic/Varieties.php b/app/Repositories/Botanic/Varieties.php index 0d55eb53..10fc92c5 100644 --- a/app/Repositories/Botanic/Varieties.php +++ b/app/Repositories/Botanic/Varieties.php @@ -79,11 +79,15 @@ class Varieties public static function getImages($id) { $variety = self::get($id); - $variety->getMedia(); - foreach ($variety->media as $key => $media) { - $variety->media[$key]['url'] = $media->getUrl(); + if ($variety) { + $variety->getMedia(); + foreach ($variety->media as $key => $media) { + $variety->media[$key]['url'] = $media->getUrl(); + } + return $variety->media; + } else { + return false; } - return $variety->media; } public static function deleteImage($id, $index) diff --git a/app/Repositories/Shop/ArticleAttributes.php b/app/Repositories/Shop/ArticleAttributes.php index 27284730..f0983863 100644 --- a/app/Repositories/Shop/ArticleAttributes.php +++ b/app/Repositories/Shop/ArticleAttributes.php @@ -25,6 +25,16 @@ class ArticleAttributes 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) { $id = isset($data['id']) ? $data['id'] : false; diff --git a/app/Repositories/Shop/ArticlePrices.php b/app/Repositories/Shop/ArticlePrices.php index 8d916bf4..860f3faf 100644 --- a/app/Repositories/Shop/ArticlePrices.php +++ b/app/Repositories/Shop/ArticlePrices.php @@ -13,42 +13,65 @@ use App\Models\Shop\ArticlePrice; class ArticlePrices { - public static function getDatatable() - { - $model = ArticlePrice::orderBy('name'); - return Datatables::of($model)->make(true); - } + public static function getDatatable() + { + $model = ArticlePrice::orderBy('name'); + return Datatables::of($model)->make(true); + } - public static function getAll() - { - return ArticlePrice::orderBy('name','asc')->get(); - } + public static function getAll() + { + return ArticlePrice::orderBy('name','asc')->get(); + } - public static function get($id) - { - return ArticlePrice::find($id); - } + public static function get($id) + { + return ArticlePrice::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 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 create($data) - { - return ArticlePrice::create($data); - } + public static function storeAttributes($article_price_id,$attributes) + { + return ArticleAttributes::storeAttributes($article_price_id, $attributes); + } - public static function update($data) - { - return ArticlePrice::find($id)->update($data); - } + public static function store($data) + { + $attributes = isset($data['attributes']) ? $data['attributes'] : false; + unset($data['attributes']); + + $id = isset($data['id']) ? $data['id'] : false; + $price = $id ? self::update($data) : self::create($data); + + $ret = $attributes ? self::storeAttributes($price->id, $attributes) : false; + + return $price->id; + } - public static function destroy($id) - { - return ArticlePrice::destroy($id); - } + public static function create($data) + { + return ArticlePrice::create($data); + } + + public static function update($data) + { + return ArticlePrice::find($id)->update($data); + } + + public static function destroy($id) + { + return ArticlePrice::destroy($id); + } } diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index f254d110..5ec069b7 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -24,6 +24,37 @@ class Articles 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) { return Article::find($id); @@ -32,8 +63,7 @@ class Articles public static function store($data) { $id = isset($data['id']) ? $data['id'] : false; - $item = $id ? self::update($data) : self::create($data); - return $item->id; + return $id ? self::update($data) : self::create($data); } public static function create($data) @@ -41,9 +71,12 @@ class Articles 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) @@ -51,14 +84,57 @@ class Articles 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) { - $variety = self::get($id); - $variety->getMedia(); - foreach ($variety->media as $key => $media) { - $variety->media[$key]['url'] = $media->getUrl(); + $article = self::get($id); + if ($article) + { + $article->getMedia(); + foreach ($article->media as $key => $media) { + $article->media[$key]['url'] = $media->getUrl(); + } + return $article->media; + } else { + return false; } - return $variety->media; } diff --git a/app/Repositories/Shop/Tags.php b/app/Repositories/Shop/Tags.php index 77ab076f..190c6507 100644 --- a/app/Repositories/Shop/Tags.php +++ b/app/Repositories/Shop/Tags.php @@ -43,11 +43,19 @@ class Tags 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); } @@ -56,4 +64,9 @@ class Tags 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; + } } diff --git a/app/Repositories/Shop/Taxes.php b/app/Repositories/Shop/Taxes.php new file mode 100644 index 00000000..38eb48ab --- /dev/null +++ b/app/Repositories/Shop/Taxes.php @@ -0,0 +1,58 @@ +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); + } + +} diff --git a/composer.json b/composer.json index 99da0832..78216a17 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,9 @@ "coduo/php-humanizer": "^3.0", "consoletvs/charts": "^6.5", "cornford/googlmapper": "^2.3", + "darryldecode/cart": "^4.1", "datatables/datatables": "^1.10", + "deployer/deployer": "^6.8", "dompdf/dompdf": "^0.8.5", "eduardokum/laravel-mail-auto-embed": "^1.0", "erjanmx/laravel-migrate-check": "^1.3", @@ -44,6 +46,7 @@ "laravelcollective/html": "^6.0", "league/climate": "^3.5", "league/period": "^4.9", + "lorisleiva/laravel-deployer": "^0.3.2", "maatwebsite/excel": "^3.1", "mad-web/laravel-initializer": "^2.0", "mediactive-digital/migrations-generator": "^2.0", @@ -60,7 +63,7 @@ "rcrowe/twigbridge": "^0.11.3", "respect/validation": "^1.1", "rinvex/laravel-categories": "^3.0", - "rtconner/laravel-tagging": "^3.2", + "rinvex/laravel-tags": "^3.0", "rutorika/sortable": "^6.0", "santigarcor/laratrust": "^5.2", "sebastienheyd/boilerplate": "^7.1", diff --git a/config/deploy.php b/config/deploy.php new file mode 100644 index 00000000..c066d4fa --- /dev/null +++ b/config/deploy.php @@ -0,0 +1,165 @@ + '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, + +]; \ No newline at end of file diff --git a/config/shopping_cart.php b/config/shopping_cart.php new file mode 100644 index 00000000..985b2507 --- /dev/null +++ b/config/shopping_cart.php @@ -0,0 +1,36 @@ + 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, +]; \ No newline at end of file diff --git a/resources/views/Botanic/Admin/Varieties/form.blade.php b/resources/views/Botanic/Admin/Varieties/form.blade.php index cc9726b3..7d2a7085 100644 --- a/resources/views/Botanic/Admin/Varieties/form.blade.php +++ b/resources/views/Botanic/Admin/Varieties/form.blade.php @@ -24,7 +24,7 @@
- @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') ])
diff --git a/resources/views/Shop/Admin/Articles/edit.blade.php b/resources/views/Shop/Admin/Articles/edit.blade.php index b8d3ab40..934b6bf8 100644 --- a/resources/views/Shop/Admin/Articles/edit.blade.php +++ b/resources/views/Shop/Admin/Articles/edit.blade.php @@ -8,7 +8,7 @@ @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]) }}
diff --git a/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php b/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php index cf8e3077..4df79738 100644 --- a/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php +++ b/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php @@ -2,38 +2,42 @@
-
- {{ Form::label('model', 'Familles de produit') }} - @include('components.select', ['name' => 'model', 'id_name' => 'model', 'list' => $models, 'value' => isset($model) ? $model : null, 'class' => 'select2 form-control']) +
+ {{ Form::label('ref', 'Référence') }}
+ @include('components.input', ['name' => 'ref', 'value' => isset($ref) ? $ref : null]) +
+
+ {{ Form::label('model', 'Familles de produit') }}
+ @include('components.select', ['name' => 'model', 'id_name' => 'model', 'list' => $models_options, 'value' => isset($model) ? $model : null, 'class' => 'select2 form-control'])
- {{ Form::label('model_id', 'Produit') }} + {{ Form::label('model_id', 'Produit') }}
@include('components.select2', ['name' => 'model_id', 'id_name' => 'model_id', 'value' => isset($model_id) ? $model_id : null, 'class' => 'select2 form-control'])
- {{ Form::label('name', 'Nom') }} + {{ Form::label('name', 'Nom') }}
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
- {{ Form::label('family_id', 'Famille d\'articles') }} - @include('components.select', ['name' => 'family_id', 'list' => $families, 'value' => isset($family_id) ? $family_id : null, 'class' => 'select2 form-control']) + {{ Form::label('family_id', 'Famille d\'articles') }}
+ @include('components.select', ['name' => 'article_family_id', 'list' => $families_options, 'value' => isset($article_family_id) ? $article_family_id : null, 'class' => 'select2 form-control'])
- {{ Form::label('categories', 'Catégories') }} - @include('components.select', ['name' => 'categories', 'list' => $categories, 'value' => isset($category_id) ? $category_id : null, 'class' => 'select2 form-control', 'multiple' => true]) + {{ Form::label('categories', 'Catégories') }}
+ @include('components.select', ['name' => 'categories[]', 'list' => $categories_options, 'values' => isset($categories) ? $categories : null, 'class' => 'select2 form-control', 'multiple' => true])
- {{ Form::label('tags', 'Tags') }} - @include('components.select-tree', ['name' => 'tags', 'list' => $tags_list, 'value' => isset($tags) ? $tags : null, 'class' => 'select2 form-control', 'multiple' => true]) + {{ Form::label('tags', 'Tags') }}
+ @include('components.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => isset($tags) ? $tags : null, 'class' => 'select2 form-control', 'multiple' => true])
@@ -46,7 +50,7 @@
- @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') ])
@@ -70,6 +74,7 @@ data: {model: $('#model').val()}, success : function(data) { $("#model_id").select2({data: data}); + $("#model_id").val({{ $model_id }}).trigger('change'); } }); } diff --git a/resources/views/Shop/Admin/Articles/partials/prices/block_attribute_new.blade.php b/resources/views/Shop/Admin/Articles/partials/prices/block_attribute_new.blade.php index e386c3f3..13b51db0 100644 --- a/resources/views/Shop/Admin/Articles/partials/prices/block_attribute_new.blade.php +++ b/resources/views/Shop/Admin/Articles/partials/prices/block_attribute_new.blade.php @@ -2,7 +2,7 @@
{{ Form::label('attribute_family_id', 'Attributs') }}
- @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'])
diff --git a/resources/views/Shop/Admin/Articles/partials/prices/block_price_new.blade.php b/resources/views/Shop/Admin/Articles/partials/prices/block_price_new.blade.php index 5129f32b..3a2a6edb 100644 --- a/resources/views/Shop/Admin/Articles/partials/prices/block_price_new.blade.php +++ b/resources/views/Shop/Admin/Articles/partials/prices/block_price_new.blade.php @@ -18,17 +18,17 @@
{{ Form::label('tax_id', 'TVA') }}
- @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'])
{{ 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'])
{{ 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'])
diff --git a/resources/views/Shop/Admin/Tags/create.blade.php b/resources/views/Shop/Admin/Tags/create.blade.php index cca08777..2ef5304d 100644 --- a/resources/views/Shop/Admin/Tags/create.blade.php +++ b/resources/views/Shop/Admin/Tags/create.blade.php @@ -4,16 +4,14 @@ 'breadcrumb' => [__('tags.title'), __('tags.create.title')] ]) -@include('boilerplate::load.fileinput') - @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']) }} - @include('Shop.Admin.ArticleFamilies.form') + @include('Shop.Admin.Tags.form') @endsection diff --git a/resources/views/Shop/Admin/Tags/edit.blade.php b/resources/views/Shop/Admin/Tags/edit.blade.php index ab132b06..3978fcc8 100644 --- a/resources/views/Shop/Admin/Tags/edit.blade.php +++ b/resources/views/Shop/Admin/Tags/edit.blade.php @@ -1,19 +1,17 @@ @extends('layout.index', [ - 'title' => 'Famille d\'articles', - 'subtitle' => 'Edition d\'une famille d\'article', - 'breadcrumb' => ['Articles'] + 'title' => __('tags.title'), + 'subtitle' => __('tags.edit.title'), + 'breadcrumb' => [__('tags.title'), __('tags.create.title')] ]) -@include('boilerplate::load.fileinput') - @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']) }}
- @include('Shop.Admin.ArticleFamilies.form') + @include('Shop.Admin.Tags.form') @endsection diff --git a/resources/views/Shop/Admin/Tags/form.blade.php b/resources/views/Shop/Admin/Tags/form.blade.php index ed9a8cbe..4cc010a7 100644 --- a/resources/views/Shop/Admin/Tags/form.blade.php +++ b/resources/views/Shop/Admin/Tags/form.blade.php @@ -1,8 +1,17 @@
- {{ Form::label('name', 'Nom') }} - @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) +
+
+ {{ 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]) +
+ +
+ {{ Form::label('name', 'Nom') }} + @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) +
+
diff --git a/resources/views/components/money.blade.php b/resources/views/components/money.blade.php index 7f504d60..edebe294 100644 --- a/resources/views/components/money.blade.php +++ b/resources/views/components/money.blade.php @@ -1 +1 @@ -@include('components.input', ['type' => 'number']) \ No newline at end of file +@include('components.input', ['type' => 'number', 'meta' => "step = '.01'"]) \ No newline at end of file diff --git a/resources/views/components/options-multiple.blade.php b/resources/views/components/options-multiple.blade.php new file mode 100644 index 00000000..100a1a5d --- /dev/null +++ b/resources/views/components/options-multiple.blade.php @@ -0,0 +1,5 @@ +@if (isset($list) && count($list)) + @foreach($list as $key => $item) + + @endforeach +@endif diff --git a/resources/views/components/options-simple.blade.php b/resources/views/components/options-simple.blade.php new file mode 100644 index 00000000..96d5ab15 --- /dev/null +++ b/resources/views/components/options-simple.blade.php @@ -0,0 +1,5 @@ +@if (isset($list) && count($list)) + @foreach($list as $key => $item) + + @endforeach +@endif diff --git a/resources/views/components/options.blade.php b/resources/views/components/options.blade.php index 96d5ab15..d26417d5 100644 --- a/resources/views/components/options.blade.php +++ b/resources/views/components/options.blade.php @@ -1,5 +1,9 @@ -@if (isset($list) && count($list)) - @foreach($list as $key => $item) - - @endforeach -@endif +@if (isset($complex) && $complex) + @include('components.options-complex') +@else + @if (isset($multiple) && $multiple) + @include('components.options-multiple') + @else + @include('components.options-simple') + @endif +@endif \ No newline at end of file diff --git a/resources/views/components/select.blade.php b/resources/views/components/select.blade.php index d0f3fd75..bc6d0875 100644 --- a/resources/views/components/select.blade.php +++ b/resources/views/components/select.blade.php @@ -9,9 +9,7 @@ @if (isset($with_empty)) @endif - @if (isset($complex) && $complex) - @include('components.options-complex') - @else - @include('components.options') - @endif + + @include('components.options') + \ No newline at end of file diff --git a/resources/views/components/uploader/mini-gallery-items.blade.php b/resources/views/components/uploader/mini-gallery-items.blade.php index 889c1f1c..16dbcdd0 100644 --- a/resources/views/components/uploader/mini-gallery-items.blade.php +++ b/resources/views/components/uploader/mini-gallery-items.blade.php @@ -1,16 +1,18 @@ -@foreach($images as $key => $image) -
- -
- - -
-
-@endforeach +@if ($images) + @foreach($images as $key => $image) +
+ +
+ + +
+
+ @endforeach +@endif