Update with new price management
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticleAttributeValue;
|
||||
|
||||
class ArticleAttributeValuesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'ArticleAttributeValues';
|
||||
|
||||
public function query(ArticleAttributeValue $model)
|
||||
{
|
||||
$model = $model::with(['article_attribute_family']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('value')->title('Attributs'),
|
||||
Column::make('article_attribute_family.name')->title('Famille d\'attributs')->sortable(false),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
28
app/DataTables/Shop/UnitiesDataTable.php
Normal file
28
app/DataTables/Shop/UnitiesDataTable.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Unity;
|
||||
|
||||
class UnitiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Unity';
|
||||
|
||||
public function query(Unity $model)
|
||||
{
|
||||
$model = $model::with(['price_family']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('value')->title('Attributs'),
|
||||
Column::make('price_family.name')->title('Famille')->orderable(false),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\Model\Shop\ArticleAttribute;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ArticleAttributeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\ArticleAttributeFamilies;
|
||||
use App\Repositories\Shop\ArticleAttributeValues;
|
||||
use App\DataTables\Shop\ArticleAttributeValuesDataTable;
|
||||
|
||||
class ArticleAttributeValueController extends Controller
|
||||
{
|
||||
public function index(ArticleAttributeValuesDataTable $dataTable)
|
||||
{
|
||||
$data['families'] = ArticleAttributeFamilies::getOptions();
|
||||
return $dataTable->render('Shop.Admin.ArticleAttributeValues.list', $data);
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return ArticleAttributeValues::getTables($request->all());
|
||||
}
|
||||
|
||||
public function getOptionsByFamily(Request $request)
|
||||
{
|
||||
$id = $request->input('family_id');
|
||||
return response()->json(ArticleAttributeValues::getSelectByFamily($id));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.ArticleAttributeValues.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = ArticleAttributeValues::store($request->all());
|
||||
return redirect()->route('Shop.Admin.ArticleAttributeValues.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = ArticleAttributeValues::get($id);
|
||||
return view('Shop.Admin.ArticleAttributeValues.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = ArticleAttributeValues::get($id);
|
||||
return view('Shop.Admin.ArticleAttributeValues.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return ArticleAttributeValues::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\PriceFamilies;
|
||||
use App\DataTables\Shop\PriceFamiliesDataTable;
|
||||
|
||||
class PriceFamilyController extends Controller
|
||||
{
|
||||
public function index(PriceFamiliesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.PriceFamilies.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return PriceFamilies::getTables($request->all());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.PriceFamilies.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = PriceFamilies::store($request->all());
|
||||
return redirect()->route('Shop.Admin.PriceFamilies.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = PriceFamilies::get($id);
|
||||
return view('Shop.Admin.PriceFamilies.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = PriceFamilies::get($id);
|
||||
return view('Shop.Admin.PriceFamilies.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return PriceFamilies::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\PriceFamilies;
|
||||
use App\Repositories\Shop\PriceFamilyValues;
|
||||
use App\DataTables\Shop\PriceFamilyValuesDataTable;
|
||||
|
||||
class PriceFamilyValueController extends Controller
|
||||
{
|
||||
public function index(PriceFamilyValuesDataTable $dataTable)
|
||||
{
|
||||
$data['families'] = PriceFamilies::getOptions();
|
||||
return $dataTable->render('Shop.Admin.PriceFamilyValues.list', $data);
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return PriceFamilyValues::getTables($request->all());
|
||||
}
|
||||
|
||||
public function getOptionsByFamily(Request $request)
|
||||
{
|
||||
$id = $request->input('family_id');
|
||||
return response()->json(PriceFamilyValues::getSelectByFamily($id));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.PriceFamilyValues.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = PriceFamilyValues::store($request->all());
|
||||
return redirect()->route('Shop.Admin.PriceFamilyValues.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = PriceFamilyValues::get($id);
|
||||
return view('Shop.Admin.PriceFamilyValues.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = PriceFamilyValues::get($id);
|
||||
return view('Shop.Admin.PriceFamilyValues.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return PriceFamilyValues::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,50 +5,50 @@ namespace App\Http\Controllers\Shop\Admin;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\PriceFamilies;
|
||||
use App\Repositories\Shop\UnityValues;
|
||||
use App\DataTables\Shop\UnityValuesDataTable;
|
||||
use App\Repositories\Shop\ArticleFamilies;
|
||||
use App\Repositories\Shop\Unities;
|
||||
use App\DataTables\Shop\UnitiesDataTable;
|
||||
|
||||
class UnityValueController extends Controller
|
||||
{
|
||||
public function index(UnityValuesDataTable $dataTable)
|
||||
public function index(UnitiesDataTable $dataTable)
|
||||
{
|
||||
$data['families'] = PriceFamilies::getOptions();
|
||||
return $dataTable->render('Shop.Admin.UnityValues.list', $data);
|
||||
$data['families'] = ArticleFamilies::getOptions();
|
||||
return $dataTable->render('Shop.Admin.Unities.list', $data);
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return UnityValues::getTables($request->all());
|
||||
return Unities::getTables($request->all());
|
||||
}
|
||||
|
||||
public function getOptionsByFamily(Request $request)
|
||||
{
|
||||
$id = $request->input('family_id');
|
||||
return response()->json(UnityValues::getSelectByFamily($id));
|
||||
return response()->json(Unities::getSelectByFamily($id));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.UnityValues.create');
|
||||
return view('Shop.Admin.Unities.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = UnityValues::store($request->all());
|
||||
return redirect()->route('Shop.Admin.UnityValues.index');
|
||||
$ret = Unities::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Unities.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = UnityValues::get($id);
|
||||
return view('Shop.Admin.UnityValues.view', $data);
|
||||
$data = Unities::get($id);
|
||||
return view('Shop.Admin.Unities.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = UnityValues::get($id);
|
||||
return view('Shop.Admin.UnityValues.edit', $data);
|
||||
$data = Unities::get($id);
|
||||
return view('Shop.Admin.Unities.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
@@ -58,7 +58,7 @@ class UnityValueController extends Controller
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return UnityValues::destroy($id);
|
||||
return Unities::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class ArticleFamily extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_families';
|
||||
|
||||
@@ -13,4 +16,14 @@ class ArticleFamily extends Model
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function unities()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Unity');
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,9 @@ class ArticlePrice extends Model
|
||||
return $this->hasOne('App\Models\Price');
|
||||
}
|
||||
|
||||
public function priceFamilyValue()
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\PriceFamilyValue');
|
||||
return $this->belongsTo('App\Models\ArticleFamily');
|
||||
}
|
||||
|
||||
public function scopeByQuantity($query, $quantity)
|
||||
@@ -27,8 +27,8 @@ class ArticlePrice extends Model
|
||||
return $query->orderBy('quantity', 'desc')->where('quantity', '<', $quantity)->first();
|
||||
}
|
||||
|
||||
public function scopeByPriceFamilyValue($query, $id)
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('price_family_value_id', $id);
|
||||
return $query->where('article_family_value_id', $id);
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,9 @@ class Price extends Model
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function price_family()
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\PriceFamily');
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
|
||||
public function generic()
|
||||
@@ -37,9 +37,9 @@ class Price extends Model
|
||||
return $query->where('article_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByPriceFamily($query, $id)
|
||||
public function scopeByArticleFamily($query, $id)
|
||||
{
|
||||
return $query->where('price_family_id', $id);
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
|
||||
public function scopeGeneric($query)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class PriceFamily extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_families';
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function values()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceFamilyValue');
|
||||
}
|
||||
|
||||
public function articles()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\Shop\Article','App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PriceFamilyValue extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_family_values';
|
||||
|
||||
public function price_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\PriceFamily');
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('price_family_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,5 +9,13 @@ class Unity extends Model
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_unities';
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class Articles
|
||||
$data['price_generics'] = PriceGenericCategories::getOptionsWithChildrens();
|
||||
$data['families_options'] = ArticleFamilies::getOptions();
|
||||
$data['taxes_options'] = Taxes::getOptions();
|
||||
$data['attribute_families_options'] = PriceFamilies::getOptions();
|
||||
$data['unities'] = Unities::getSelectByFamily($data['article_family_id']);
|
||||
$data['tags_list'] = TagGroups::getTreeTags();
|
||||
$data['models_options'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||
return $data;
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\PriceFamily;
|
||||
|
||||
class PriceFamilies
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = PriceFamily::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return PriceFamily::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return PriceFamily::find($id);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return PriceFamily::get()->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
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 PriceFamily::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return PriceFamily::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return PriceFamily::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\PriceFamilyValue;
|
||||
|
||||
class PriceFamilyValues
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = PriceFamilyValue::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return PriceFamilyValue::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return PriceFamilyValue::find($id);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return PriceFamilyValue::get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getSelectByFamily($family_id)
|
||||
{
|
||||
// return PriceFamilyValue::byFamily($attribute_family_id)->get()->pluck('value','id')->toArray();
|
||||
$values = PriceFamilyValue::byFamily($family_id)->get();
|
||||
$data = [];
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$data[] = ['id' => $value->id, 'text' => $value->value];
|
||||
}
|
||||
return collect($data)->sortBy('text')->values()->all();
|
||||
}
|
||||
|
||||
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 PriceFamilyValue::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return PriceFamilyValue::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return PriceFamilyValue::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,17 @@ class Unities
|
||||
return Unity::orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getSelectByFamily($family_id)
|
||||
{
|
||||
$values = Unity::byFamily($family_id)->get();
|
||||
$data = [];
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$data[] = ['id' => $value->id, 'text' => $value->value];
|
||||
}
|
||||
return collect($data)->sortBy('text')->values()->all();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Unity::orderBy('value','asc')->get();
|
||||
|
||||
@@ -52,8 +52,7 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="prices">
|
||||
@include('Shop.Admin.Articles.partials.prices', ['prices' => $prices['prices'] ?? null])
|
||||
@include('Shop.Admin.Articles.partials.generic_prices', ['generics' => $prices['generics'] ?? null])
|
||||
@include('Shop.Admin.Articles.partials.prices')
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="shipping">
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
@include('Shop.Admin.Articles.partials.generic_prices.block_generic_price_new')
|
||||
|
||||
<div id="append_generic_price" class="row">
|
||||
@include('Shop.Admin.Articles.partials.generic_prices.list-generic_prices')
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-primary add-new-generic_price">Associer un tarif générique<i class="fa fa-plus"></i></button>
|
||||
|
||||
|
||||
@include('components.select-tree', ['name' => "article_price_generic_id", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm w-100'])
|
||||
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
function append_generic_price() {
|
||||
// handle_append_attribute();
|
||||
$('.select2').select2();
|
||||
handle_change_attribute();
|
||||
load_attribute_values($('.attributes-value'), $('.attributes-family').val());
|
||||
}
|
||||
|
||||
$("#append_generic_price").appender({
|
||||
rowSection: '.row-new-generic_price',
|
||||
type: '.row-generic_price',
|
||||
addBtn: '.add-new-generic_price',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-generic_price-number',
|
||||
deleteBtn: '.delete-new-generic_price-btn',
|
||||
callback: append_generic_price,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
|
||||
function append_attribute() {
|
||||
}
|
||||
|
||||
function handle_append_attribute(selector) {
|
||||
console.log('handle_append_attribute');
|
||||
$(".append_attribute").appender({
|
||||
rowSection: '.row-new-attribute',
|
||||
type: '.row-attribute',
|
||||
addBtn: '.add-new-attribute',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-attribute-number',
|
||||
deleteBtn: '.delete-new-attribute-btn',
|
||||
callback: append_attribute,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
}
|
||||
|
||||
function handle_change_attribute() {
|
||||
$('.attributes-family').change( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
var $selector = $parent.find('.attributes-value');
|
||||
load_attribute_values($selector, family_id);
|
||||
});
|
||||
}
|
||||
|
||||
function init_attribute_values() {
|
||||
$('.attributes-family').each( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
var $selector = $parent.find('.attributes-value');
|
||||
load_attribute_values($selector, family_id);
|
||||
value_id = $selector.data('id');
|
||||
$selector.val(value_id).trigger('change');
|
||||
});
|
||||
}
|
||||
|
||||
function load_attribute_values($selector, family_id) {
|
||||
$.ajax({
|
||||
url : "{{ route('Shop.Admin.PriceFamilyValues.getOptionsByFamily') }}",
|
||||
method : 'POST',
|
||||
data: { family_id: family_id },
|
||||
success : function(data) {
|
||||
$selector.empty().select2({data: data});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handle_delete_generic_price() {
|
||||
$('.delete-generic_price-btn').click(function() {
|
||||
var $selector = $(this).parents('.row-generic_price');
|
||||
var id = $selector.find('.generic_price_id').val();
|
||||
|
||||
confirm_delete(id, laroute.route('Shop.Admin.ArticlePrices.destroy', {id : id}), function() {
|
||||
$selector.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handle_generic_prices() {
|
||||
$('.generic_price-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
generic_price_taxed = $(this).val() * (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.generic_price-taxed-item').val(generic_price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_generic_prices_taxed() {
|
||||
$('.generic_price-taxed-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
console.log($(this).parent().prev());
|
||||
generic_price = $(this).val() / (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.generic_price-item').val(generic_price);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,54 +1,9 @@
|
||||
<div class="col-12 row-new-price row-price">
|
||||
<div class="col-12 row-new-generic row-generic">
|
||||
|
||||
<input type="hidden" name="prices[][id]" value="">
|
||||
|
||||
<div class="card card-light">
|
||||
<div class="card-body pt-2">
|
||||
@include('Shop.Admin.PriceGenerics.partials.table-prices', ['generic' => $generic['generic'] ?? null ])
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-3">
|
||||
{{ Form::label('price_generic_id', 'Générique') }}<br/>
|
||||
@include('components.select-tree', ['name' => "prices[0][article_price_generic_id]", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1">
|
||||
{{ Form::label('quantity', 'Quantité') }}<br/>
|
||||
@include('components.number', ['name' => 'prices[0][quantity]', 'value' => $quantity ?? 1, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
@include('Shop.Admin.Articles.partials.prices.block_attribute_new')
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
|
||||
<div class="col-2">
|
||||
{{ Form::label('tax_id', 'TVA') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[0][tax_id]', 'value' => $tax_id ?? null, 'list' => $taxes_options ?? null, 'required' => true, 'class' => 'form-control form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
{{ Form::label('price', 'Prix HT') }}
|
||||
@include('components.money', ['name' => 'prices[0][price]', 'value' => $price ?? 0, 'required' => true, 'class' => 'form-control-sm price-item'])
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
{{ Form::label('price_taxed', 'Prix TTC') }}
|
||||
@include('components.money', ['name' => 'prices[0][price_taxed]', 'value' => $price_taxed ?? 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 text-right">
|
||||
<br/>
|
||||
<button type="button" class="btn btn-xs btn-danger delete-new-price-btn mt-2" data-card-widget="collapse" data-toggle="tooltip" title="supprimer">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,52 @@
|
||||
@include('Shop.Admin.Articles.partials.generic_prices.block_generic_price_new')
|
||||
|
||||
<div id="append_generic_price" class="row">
|
||||
@include('Shop.Admin.Articles.partials.generic_prices.list-generic_prices')
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-primary add-new-generic_price">Associer un tarif générique<i class="fa fa-plus"></i></button>
|
||||
|
||||
|
||||
@include('components.select-tree', ['name' => "article_price_generic_id", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm w-100'])
|
||||
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
function append_generic_price() {
|
||||
// handle_append_attribute();
|
||||
$('.select2').select2();
|
||||
// handle_change_attribute();
|
||||
// load_attribute_values($('.attributes-value'), $('.attributes-family').val());
|
||||
}
|
||||
|
||||
$("#append_generic_price").appender({
|
||||
rowSection: '.row-new-generic_price',
|
||||
type: '.row-generic_price',
|
||||
addBtn: '.add-new-generic_price',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-generic_price-number',
|
||||
deleteBtn: '.delete-new-generic_price-btn',
|
||||
callback: append_generic_price,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
|
||||
|
||||
function handle_delete_generic_price() {
|
||||
$('.delete-generic_price-btn').click(function() {
|
||||
var $selector = $(this).parents('.row-generic_price');
|
||||
var id = $selector.find('.generic_price_id').val();
|
||||
|
||||
/*
|
||||
confirm_delete(id, "{## route('Shop.Admin.ArticlePrices.destroy') }}", function() {
|
||||
$selector.remove();
|
||||
});
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,115 +1,2 @@
|
||||
@include('Shop.Admin.Articles.partials.prices.block_price_new')
|
||||
|
||||
<div id="append_price" class="row">
|
||||
@include('Shop.Admin.Articles.partials.prices.list-prices')
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-primary add-new-price">Ajouter un tarif <i class="fa fa-plus"></i></button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
function append_price() {
|
||||
// handle_append_attribute();
|
||||
$('.select2').select2();
|
||||
handle_change_attribute();
|
||||
load_attribute_values($('.attributes-value'), $('.attributes-family').val());
|
||||
}
|
||||
|
||||
$("#append_price").appender({
|
||||
rowSection: '.row-new-price',
|
||||
type: '.row-price',
|
||||
addBtn: '.add-new-price',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-price-number',
|
||||
deleteBtn: '.delete-new-price-btn',
|
||||
callback: append_price,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
|
||||
function append_attribute() {
|
||||
}
|
||||
|
||||
function handle_append_attribute(selector) {
|
||||
console.log('handle_append_attribute');
|
||||
$(".append_attribute").appender({
|
||||
rowSection: '.row-new-attribute',
|
||||
type: '.row-attribute',
|
||||
addBtn: '.add-new-attribute',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-attribute-number',
|
||||
deleteBtn: '.delete-new-attribute-btn',
|
||||
callback: append_attribute,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
}
|
||||
|
||||
function handle_change_attribute() {
|
||||
$('.attributes-family').change( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
var $selector = $parent.find('.attributes-value');
|
||||
load_attribute_values($selector, family_id);
|
||||
});
|
||||
}
|
||||
|
||||
function init_attribute_values() {
|
||||
$('.attributes-family').each( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
var $selector = $parent.find('.attributes-value');
|
||||
load_attribute_values($selector, family_id);
|
||||
value_id = $selector.data('id');
|
||||
$selector.val(value_id).trigger('change');
|
||||
});
|
||||
}
|
||||
|
||||
function load_attribute_values($selector, family_id) {
|
||||
$.ajax({
|
||||
url : "{{ route('Shop.Admin.PriceFamilyValues.getOptionsByFamily') }}",
|
||||
method : 'POST',
|
||||
data: { family_id: family_id },
|
||||
success : function(data) {
|
||||
$selector.empty().select2({data: data});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handle_delete_price() {
|
||||
$('.delete-price-btn').click(function() {
|
||||
var $selector = $(this).parents('.row-price');
|
||||
var id = $selector.find('.price_id').val();
|
||||
|
||||
confirm_delete(id, laroute.route('Shop.Admin.ArticlePrices.destroy', {id : id}), function() {
|
||||
$selector.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handle_prices() {
|
||||
$('.price-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
price_taxed = $(this).val() * (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.price-taxed-item').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_prices_taxed() {
|
||||
$('.price-taxed-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
console.log($(this).parent().prev());
|
||||
price = $(this).val() / (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.price-item').val(price);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@include('Shop.Admin.Articles.partials.prices.prices', ['prices' => $prices['prices'] ?? null])
|
||||
@include('Shop.Admin.Articles.partials.generic_prices.generic_prices', ['generics' => $prices['generics'] ?? null])
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<div class="row row-attribute">
|
||||
|
||||
<div class="col-12 col-lg-7">
|
||||
{{ Form::label('attribute_family_id', 'Type') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => "prices[$key][price_family_id]",
|
||||
'value' => $price['price_family_id'] ?? null,
|
||||
'list' => $attribute_families_options,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm attributes-family'
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-5">
|
||||
{{ Form::label('attribute_value_id', 'Unité') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => "prices[$key][unity_id]",
|
||||
'value' => $price['unity_id'] ?? null,
|
||||
'list' => $unities ?? null,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm attributes-value w-100',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,24 +0,0 @@
|
||||
<div class="row row-new-attribute row-attribute">
|
||||
<input type="hidden" name="prices[][attribute][quantity]" value="1">
|
||||
<div class="col-12 col-lg-6 1">
|
||||
{{ Form::label('attribute_family_id', 'Attributs') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => 'prices[][attribute][attribute_family_id]',
|
||||
'value' => $attribute_value['article_attribute_family_id'] ?? null,
|
||||
'list' => $attribute_families_options,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm attributes-family'
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 2">
|
||||
{{ Form::label('attribute_value_id', 'Valeur') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => 'prices[][attribute][attribute_value_id]',
|
||||
'value' => $attribute_value['id'] ?? null,
|
||||
'list' => $attribute_values ?? null,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm attributes-value'
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
@@ -5,17 +5,21 @@
|
||||
<div class="card card-light">
|
||||
<div class="card-body pt-2">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-11">
|
||||
<div class="row">
|
||||
<div class="col-lg-1">
|
||||
{{ Form::label('quantity', 'Qté.') }}<br/>
|
||||
@include('components.number', ['name' => "prices[$key][quantity]", 'value' => $price['quantity'] ?? 1, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
@include('Shop.Admin.Articles.partials.prices.block_attribute')
|
||||
<div class="col-lg-5">
|
||||
{{ Form::label('unity_id', 'Unité') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => "prices[$key][unity_id]",
|
||||
'value' => $price['unity_id'] ?? null,
|
||||
'list' => $unities ?? null,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm unities w-100',
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5">
|
||||
@@ -36,8 +40,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 text-right">
|
||||
<br/>
|
||||
@@ -45,10 +47,7 @@
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -7,37 +7,41 @@
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-3">
|
||||
{{ Form::label('price_generic_id', 'Générique') }}<br/>
|
||||
@include('components.select-tree', ['name' => "prices[0][article_price_generic_id]", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1">
|
||||
{{ Form::label('quantity', 'Quantité') }}<br/>
|
||||
@include('components.number', ['name' => 'prices[0][quantity]', 'value' => $quantity ?? 1, 'required' => true, 'class' => 'form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
@include('Shop.Admin.Articles.partials.prices.block_attribute_new')
|
||||
<div class="col-lg-5">
|
||||
{{ Form::label('unity_id', 'Unité') }}<br/>
|
||||
@include('components.select', [
|
||||
'name' => "prices[0][unity_id]",
|
||||
'value' => $price['unity_id'] ?? null,
|
||||
'list' => $unities ?? null,
|
||||
'required' => true,
|
||||
'class' => 'select2 form-control-sm unities w-100',
|
||||
])
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-5">
|
||||
|
||||
<div class="col-2">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
{{ Form::label('tax_id', 'TVA') }}<br/>
|
||||
@include('components.select', ['name' => 'prices[0][tax_id]', 'value' => $tax_id ?? null, 'list' => $taxes_options ?? null, 'required' => true, 'class' => 'form-control form-control-sm'])
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
<div class="col-4">
|
||||
{{ Form::label('price', 'Prix HT') }}
|
||||
@include('components.money', ['name' => 'prices[0][price]', 'value' => $price ?? 0, 'required' => true, 'class' => 'form-control-sm price-item'])
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
<div class="col-4">
|
||||
{{ Form::label('price_taxed', 'Prix TTC') }}
|
||||
@include('components.money', ['name' => 'prices[0][price_taxed]', 'value' => $price_taxed ?? 0, 'required' => true, 'class' => 'form-control-sm price-taxed-item'])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-1 text-right">
|
||||
<br/>
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
@include('Shop.Admin.Articles.partials.prices.block_price_new')
|
||||
|
||||
<div id="append_price" class="row">
|
||||
@include('Shop.Admin.Articles.partials.prices.list-prices')
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-primary add-new-price">Ajouter un tarif <i class="fa fa-plus"></i></button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
function append_price() {
|
||||
// handle_append_attribute();
|
||||
$('.select2').select2();
|
||||
handle_change_attribute();
|
||||
load_attribute_values($('.unities'), $('.price-family').val());
|
||||
}
|
||||
|
||||
$("#append_price").appender({
|
||||
rowSection: '.row-new-price',
|
||||
type: '.row-price',
|
||||
addBtn: '.add-new-price',
|
||||
appendEffect: 'slide',
|
||||
addClass: 'animated bounceInLeft',
|
||||
rowNumber: '.row-price-number',
|
||||
deleteBtn: '.delete-new-price-btn',
|
||||
callback: append_price,
|
||||
rowNumberStart: 2,
|
||||
hideSection: true
|
||||
});
|
||||
|
||||
function handle_change_attribute() {
|
||||
$('.price-family').change( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
var $selector = $parent.find('.unities');
|
||||
load_attribute_values($selector, family_id);
|
||||
});
|
||||
}
|
||||
|
||||
function init_attribute_values() {
|
||||
$('.price-family').each( function() {
|
||||
var family_id = $(this).val();
|
||||
var $family = $(this);
|
||||
var $parent = $family.parent().parent();
|
||||
var $selector = $parent.find('.unities');
|
||||
load_attribute_values($selector, family_id);
|
||||
value_id = $selector.data('id');
|
||||
$selector.val(value_id).trigger('change');
|
||||
});
|
||||
}
|
||||
|
||||
function load_attribute_values($selector, family_id) {
|
||||
$.ajax({
|
||||
url : "{{ route('Shop.Admin.Unities.getOptionsByFamily') }}",
|
||||
method : 'POST',
|
||||
data: { family_id: family_id },
|
||||
success : function(data) {
|
||||
$selector.empty().select2({data: data});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handle_delete_price() {
|
||||
$('.delete-price-btn').click(function() {
|
||||
var $selector = $(this).parents('.row-price');
|
||||
var id = $selector.find('.price_id').val();
|
||||
|
||||
confirm_delete(id, laroute.route('Shop.Admin.ArticlePrices.destroy', {id : id}), function() {
|
||||
$selector.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function handle_prices() {
|
||||
$('.price-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
price_taxed = $(this).val() * (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.price-taxed-item').val(price_taxed);
|
||||
})
|
||||
}
|
||||
|
||||
function handle_prices_taxed() {
|
||||
$('.price-taxed-item').change(function() {
|
||||
tax_selected = $(this).parent().prev().find('select option:selected').text();
|
||||
console.log($(this).parent().prev());
|
||||
price = $(this).val() / (1 + (tax_selected / 100));
|
||||
$(this).parent().parent().find('.price-item').val(price);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,4 +1,5 @@
|
||||
<table class="table table-bordered table-hover table-striped w-100 mb-0 dataTable">
|
||||
@if (count($generic['prices'] ?? []))
|
||||
<table class="table table-bordered table-hover table-striped w-100 mb-0 dataTable">
|
||||
|
||||
<thead>
|
||||
<th>
|
||||
@@ -20,4 +21,5 @@
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
@@ -1 +1 @@
|
||||
<button @if (isset($type))type="{{ $type }}"@else type="button"@endif class="btn btn-success @if (isset($class)){{ $class }}@endif" @if (isset($id)) id="{{ $id }}"@endif><i class="fa fa-plus"></i></button>
|
||||
@include('components.button', ['class' => 'btn-success ' . ($class ?? ''), 'icon' => 'fa-plus' ])
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<button @if (isset($type))type="{{ $type }}"@else type="button"@endif class="btn btn-secondary cancel @if (isset($class)){{ $class }}@endif" @if (isset($id_name)) id="{{ $id_name }}"@endif>
|
||||
<i class="fa fa-fw fa-ban"></i> {{ __('cancel') }}
|
||||
</button>
|
||||
@include('components.button', ['class' => 'btn-secondary cancel ' . ($class ?? ''), 'icon' => 'fa-ban', 'txt' => __('cancel')])
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('.form-buttons .cancel').click(function() {
|
||||
@if (isset($url))
|
||||
window.location = "{{ $url }}";
|
||||
@else
|
||||
window.history.back();
|
||||
@endif
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
@@ -1,3 +1 @@
|
||||
<button @if (isset($type))type="{{ $type }}"@else type="button"@endif class="btn btn-danger @if (isset($class)){{ $class }}@endif" @if (isset($id)) id="{{ $id }}"@endif>
|
||||
<i class="fa @if (isset($icon)){{ $icon }}@else fa-trash @endif"></i>
|
||||
</button>
|
||||
@include('components.button', ['class' => 'btn-danger ' . ($class ?? ''), 'icon' => ($icon ?? 'fa-trash)'])
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
<button @if (isset($type))type="{{ $type }}"@else type="submit"@endif class="btn btn-success save @if (isset($class)){{ $class }}@endif" @if (isset($id_name)) id="{{ $id_name }}"@endif>
|
||||
<i class="fa fa-fw fa-save"></i> Enregistrer
|
||||
</button>
|
||||
@include('components.button', ['class' => 'btn-success save ' . ($class ?? ''), 'icon' => 'fa-save', 'txt' => __('save')])
|
||||
|
||||
3
resources/views/components/button-submit.blade.php
Normal file
3
resources/views/components/button-submit.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<button type="{{ $type_button ?? 'submit' }}" class="btn btn-success submit {{ $class ?? ''}}" @if (isset($id_name)) id="{{ $id_name }}"@endif>
|
||||
<i class="fa fa-fw fa-save"></i> Envoyer
|
||||
</button>
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
<div id="{{ $model }}-datatable-content">
|
||||
@include('components.datatables.header')
|
||||
{{$dataTable->table(['class'=>'table table-bordered table-hover table-striped w-100 mb-0'])}}
|
||||
@if ($dataTable)
|
||||
{{ $dataTable->table(['class'=>'table table-bordered table-hover table-striped w-100 mb-0']) }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
@include('components.js.datatable', ['route' => $route, 'model' => $model])
|
||||
@include('components.datatables.js.datatable')
|
||||
@endpush
|
||||
|
||||
|
||||
27
resources/views/components/datatables/buttons.blade.php
Normal file
27
resources/views/components/datatables/buttons.blade.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<div class="datatable-export-buttons float-left mr-3">
|
||||
|
||||
@if (!isset($with_print) || $with_print)
|
||||
@include('components.datatables.buttons.print')
|
||||
@endif
|
||||
|
||||
@if (isset($with_exports) && $with_exports)
|
||||
@include('components.datatables.buttons.excel')
|
||||
@endif
|
||||
|
||||
@if (isset($with_mailing) && $with_mailing)
|
||||
@include('components.datatables.buttons.mail')
|
||||
@endif
|
||||
|
||||
@if (isset($with_buttons))
|
||||
@foreach ($with_buttons as $button)
|
||||
@include($button)
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if (isset($left_buttons))
|
||||
@foreach ($left_buttons as $button)
|
||||
@include('components.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@@ -1,11 +1,15 @@
|
||||
<button type="button" class="btn bg-primary btn-add"><i class="fa fa-plus-circle"></i></button>
|
||||
<button type="button" class="btn bg-primary btn-add"><i class="fa fa-fw fa-plus-circle"></i></button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('#{{ $model }}-table-header .btn-add').click(function() {
|
||||
@if (isset($create_callback))
|
||||
{{ $create_callback }};
|
||||
@else
|
||||
url = '{{ $route }}' + '/create/';
|
||||
window.location = url;
|
||||
// openUrl(url);
|
||||
@endif
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<button type="button" class="btn bg-gradient-secondary btn-colvis" style="border-left: 1px solid rgba(0,0,0,0.1);">
|
||||
<i class="fa fa-columns"></i>
|
||||
<i class="fa fa-fw fa-columns"></i>
|
||||
</button>
|
||||
|
||||
@push('js')
|
||||
@@ -7,14 +7,14 @@
|
||||
var $colvis = $('#{{ $model }}-table-header .btn-colvis');
|
||||
|
||||
$colvis.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
console.log(table);
|
||||
var table = getDatatable("{{ $model }}");
|
||||
// console.log(table);
|
||||
|
||||
console.log(table.column(1).dataSrc());
|
||||
// console.log(table.column(1).dataSrc());
|
||||
var header = table.column(1).header();
|
||||
console.log($(header).html());
|
||||
// console.log($(header).html());
|
||||
var visible = table.column(1).visible();
|
||||
console.log(visible);
|
||||
// console.log(visible);
|
||||
|
||||
/*
|
||||
// var names = table.columns().names();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<span>
|
||||
<button type="button" class="btn bg-gradient-secondary dropdown-toggle btn-excel" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-download"></i>
|
||||
<i class="fa fa-fw fa-download"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<button type="button" class="btn bg-gradient-secondary dropdown-toggle btn-excel" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-file-excel"></i>
|
||||
<button type="button" class="btn bg-gradient-secondary {{ $model }}-excel">
|
||||
<i class="fa fa-fw fa-file-excel"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item"><a href="#">Exporter la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/export">Exporter la liste complète</a></li>
|
||||
</ul>
|
||||
@push('js')
|
||||
|
||||
<script>
|
||||
$('.{{ $model }}-excel').click(function() {
|
||||
var data = $('#{{ $model }}-filters').serialize();
|
||||
var url = "{{ $route }}/exportExcel?" + data;
|
||||
window.location = url;
|
||||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
<button type="button" class="btn bg-gradient-secondary btn-filter" data-toggle="modal" data-target="#modal-filters">
|
||||
<i class="fa fa-filter"></i>
|
||||
<button id="btn-{{ $model ?? null }}-filters" type="button" class="btn bg-gradient-secondary btn-filter" data-toggle="modal" data-target="#modal-{{ $model ?? null }}-filters">
|
||||
<i class="fa fa-fw fa-filter"></i>
|
||||
</button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
var $filter = $('#{{ $model }}-table-header .btn-filter');
|
||||
var $filter = $('#{{ $model ?? null }}-table-header .btn-filter');
|
||||
|
||||
$('#modal-filters').on('shown.bs.modal', function () {
|
||||
$('#modal-{{ $model ?? null }}-filters').on('shown.bs.modal', function () {
|
||||
initSelect2();
|
||||
});
|
||||
|
||||
$('#modal-filters .apply').click(function() {
|
||||
$('#modal-filters').modal('hide');
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
$('#modal-{{ $model ?? null }}-filters .apply').click(function() {
|
||||
$('#modal-{{ $model ?? null }}-filters').modal('hide');
|
||||
var table = window.LaravelDataTables["{{ $model ?? null }}-table"];
|
||||
table.draw();
|
||||
})
|
||||
|
||||
$('#modal-filters .reset').click(function() {
|
||||
$('#filters').trigger("reset");
|
||||
$('#filters .select2').val(null).trigger("change");
|
||||
$('#modal-{{ $model ?? null }}-filters .reset').click(function() {
|
||||
// $('#{{ $model ?? null }}-filters').trigger("reset");
|
||||
$('#{{ $model ?? null }}-filters').closest('form').find("input[type=text], select").val("");
|
||||
$('#{{ $model ?? null }}-filters .select2').val(null).trigger("change");
|
||||
})
|
||||
|
||||
|
||||
/*
|
||||
$filter.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
var table = window.LaravelDataTables["{{ $model ?? null }}-table"];
|
||||
// table.search($search.val()).draw();
|
||||
openModal('{{ __('Filters') }}', '{{ $route }}/getFiltersHtml', {
|
||||
onApply: function() {
|
||||
|
||||
10
resources/views/components/datatables/buttons/mail.blade.php
Normal file
10
resources/views/components/datatables/buttons/mail.blade.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<span>
|
||||
<button type="button" class="btn bg-gradient-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-fw fa-envelope-open-text"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item"><a href="{{ $route }}/mailSelection">{{ __('admin.mail_the_selection') }}</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/mailAll">{{ __('admin.mail_the_complete_list') }}</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
@@ -4,10 +4,17 @@
|
||||
@push('js')
|
||||
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
var table = getDatatable("{{ $model }}");
|
||||
var state = getDatatableState("{{ $model }}");
|
||||
|
||||
if (state && (typeof(state.length) != 'undefined')) {
|
||||
$('#{{ $model }}_pager').val(state.length);
|
||||
}
|
||||
|
||||
$('#{{ $model }}_pager').change(function() {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
var len = $(this).val();
|
||||
table.page.len(len).draw();
|
||||
table.page.len($(this).val()).draw();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
<button type="button" class="btn bg-gradient-secondary btn-pdf">
|
||||
<i class="fa fa-file-pdf"></i>
|
||||
</button>
|
||||
<span>
|
||||
<button type="button" class="btn bg-gradient-secondary btn-pdf">
|
||||
<i class="fa fa-fw fa-file-pdf"></i>
|
||||
</button>
|
||||
</span>
|
||||
@@ -1,27 +1,15 @@
|
||||
<span>
|
||||
<button type="button" class="btn bg-gradient-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-print"></i>
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item printWithFilter"><a href="#" target="_BLANK">Imprimer la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/print" target="_BLANK">Imprimer la liste complète</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
<button type="button" class="btn bg-gradient-secondary {{ $model }}-print">
|
||||
<i class="fa fa-fw fa-print"></i>
|
||||
</button>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
var $print = $('#{{ $model }}-table-header .btn-print');
|
||||
$print.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
table.button(1).trigger();
|
||||
});
|
||||
|
||||
$('.printWithFilter').click(function() {
|
||||
var data = $('#filters').serialize();
|
||||
$('.{{ $model }}-print').click(function() {
|
||||
var data = $('#{{ $model }}-filters').serialize();
|
||||
var url = "{{ $route }}/print?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
// window.location = url;
|
||||
var print = window.open(url, 'print');
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -3,9 +3,19 @@
|
||||
@include('components.datatables.search')
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-3 col-6">
|
||||
@include('components.datatables.buttons.exports')
|
||||
@include('components.datatables.buttons')
|
||||
@if (isset($add_buttons))
|
||||
@include($add_buttons)
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-1 col-6 text-right">
|
||||
@if (isset($right_buttons))
|
||||
@foreach ($right_buttons as $button)
|
||||
@include('components.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
|
||||
@endforeach
|
||||
@endif
|
||||
@if (!(isset($with_add) && (!$with_add)))
|
||||
@include('components.datatables.buttons.add')
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
70
resources/views/components/datatables/js/datatable.blade.php
Normal file
70
resources/views/components/datatables/js/datatable.blade.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<script>
|
||||
|
||||
$('#{{ $model }}-table').on( 'draw.dt', function () {
|
||||
|
||||
var table = getDatatable("{{ $model }}");
|
||||
|
||||
$('#{{ $model }}-table .btn-edit').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
@if (isset($edit_callback))
|
||||
{{ $edit_callback }}
|
||||
@else
|
||||
url = '{{ $route }}' + '/edit/' + id;
|
||||
openURL(url);
|
||||
@endif
|
||||
});
|
||||
|
||||
$('#{{ $model }}-table .btn-show').off('click').click(function(e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
url = '{{ $route }}' + '/show/' + id;
|
||||
openURL(url);
|
||||
});
|
||||
|
||||
$('#{{ $model }}-table .btn-del').off('click').click(function (e) {
|
||||
e.preventDefault();
|
||||
// var id = table.row(this).id();
|
||||
var id = $(this).data('id');
|
||||
|
||||
bootbox.confirm("{{ __('admin.confirmdelete') }}", function (result) {
|
||||
if (result === false) return;
|
||||
|
||||
$.ajax({
|
||||
url: '{{ $route }}' + '/destroy/' + id,
|
||||
method: 'delete',
|
||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||
success: function(){
|
||||
// line.remove();
|
||||
table.draw();
|
||||
growl("{{ __('admin.deletesuccess') }}", 'success');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
{{ $callback ?? '' }}
|
||||
|
||||
var state = table.state.loaded();
|
||||
// console.log('state');
|
||||
// console.log(state);
|
||||
if ( state ) {
|
||||
/*
|
||||
table.columns().eq( 0 ).each( function ( colIdx ) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
if ( colSearch.search ) {
|
||||
$('.search-input-text').eq(colIdx).val( colSearch.search );
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
// datatablesHelper.getDatatableLength('{{ $model }}', 34);
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
<div class="input-group">
|
||||
|
||||
<div class="input-group-prepend">
|
||||
@include('components.datatables.buttons.pageLength')
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control search-btn" placeholder="Rechercher..." value="">
|
||||
|
||||
<input type="text" class="form-control search-btn" placeholder="{{ __('search') }}" value="">
|
||||
|
||||
@if ((isset($with_filters) and $with_filters) || (isset($with_colvis) and $with_colvis))
|
||||
<div class="input-group-append">
|
||||
@if (isset($with_filters) && $with_filters)
|
||||
@@ -14,14 +17,26 @@
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
@include('load.functions')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
var table = getDatatable("{{ $model }}");
|
||||
|
||||
var $search = $('#{{ $model }}-table-header .search-btn');
|
||||
$search.on( 'keyup click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
var state = getDatatableState("{{ $model }}");
|
||||
|
||||
if (state && (typeof(state.search.search) != 'undefined')) {
|
||||
$search.val(state.search.search);
|
||||
}
|
||||
|
||||
$search.on('keyup', delay(function () {
|
||||
table.search($search.val()).draw();
|
||||
} );
|
||||
}, 500));
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
77
resources/views/load/appender.blade.php
Normal file
77
resources/views/load/appender.blade.php
Normal file
@@ -0,0 +1,77 @@
|
||||
@if(!defined('LOAD_APPENDER'))
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
(function ($) {
|
||||
$.fn.appender = function (settings) {
|
||||
let appendArea = this;
|
||||
let rowHtml = $(settings.rowSection)[0].outerHTML;
|
||||
|
||||
settings.hideSection ? $(settings.rowSection).remove() : "";
|
||||
|
||||
let rowCounter = 1;
|
||||
|
||||
if (settings.rowNumberStart) {
|
||||
rowCounter = Number(settings.rowNumberStart);
|
||||
}
|
||||
|
||||
$(document).on('click', settings.addBtn, function (event) {
|
||||
$(appendArea).append(rowHtml);
|
||||
|
||||
if (settings.appendEffect === 'fade') {
|
||||
$(settings.rowSection).last().hide().fadeIn();
|
||||
} else if (settings.appendEffect === 'slide') {
|
||||
$(settings.rowSection).last().hide().slideDown(200);
|
||||
}
|
||||
|
||||
$(settings.rowSection).last().addClass(settings.addClass);
|
||||
|
||||
$(settings.rowNumber).last().text(rowCounter);
|
||||
|
||||
type = (settings.type) ? settings.type : settings.rowSection;
|
||||
|
||||
$(type).each(function(rowIndex) {
|
||||
$(this).find('input[name]').each(function() {
|
||||
var name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('select[name]').each(function() {
|
||||
var name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('textarea[name]').each(function() {
|
||||
var name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('.appender').each(function() {
|
||||
$(this).data('id',rowIndex);
|
||||
});
|
||||
});
|
||||
|
||||
rowCounter++;
|
||||
|
||||
if (settings.callback) {
|
||||
settings.callback();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
if (settings.deleteBtn) {
|
||||
$(document).on('click', settings.deleteBtn, function (e) {
|
||||
$(e.target).closest(settings.rowSection).remove();
|
||||
if (settings.callback) {
|
||||
settings.callback();
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_APPENDER', true))
|
||||
@endif
|
||||
18
resources/views/load/autocomplete.blade.php
Normal file
18
resources/views/load/autocomplete.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
@if(!defined('LOAD_AUTOCOMPLETE'))
|
||||
@push('js')
|
||||
<script src="{{ asset('/assets/plugins/autocomplete/bootstrap-autocomplete.min.js') }}"></script>
|
||||
<script>
|
||||
function initAutocomplete(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.autocomplete' : sel;
|
||||
$(selector).autoComplete();
|
||||
|
||||
$(selector).on('autocomplete.select', function(evt, item) {
|
||||
var field = $(this).data('field');
|
||||
var id = item.value;
|
||||
$('#'+field).val(id);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_AUTOCOMPLETE', true))
|
||||
@endif
|
||||
16
resources/views/load/chevron.blade.php
Normal file
16
resources/views/load/chevron.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
@if(!defined('LOAD_CHEVRON'))
|
||||
@push('scripts')
|
||||
|
||||
<script>
|
||||
function initChevron(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.card-header .btn-link' : sel;
|
||||
$(selector).click(function() {
|
||||
$(this).find('i').toggleClass('fa-chevron-right fa-chevron-down')
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_CHEVRON', true))
|
||||
@endif
|
||||
@@ -1,23 +1,45 @@
|
||||
@if(!defined('LOAD_DATATABLES'))
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('css/datatables.min.css') }}">
|
||||
<link rel="stylesheet" href="{!! mix('/js/datatables/datatables.min.css', '/assets/vendor/boilerplate') !!}">
|
||||
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables.min.css') }}">
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('js/datatables.min.js') }}"></script>
|
||||
@include('boilerplate::load.moment')
|
||||
<script src="{{ asset('assets/plugins/datatables.min.js') }}"></script>
|
||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$.extend( true, $.fn.dataTable.defaults, {
|
||||
language: {
|
||||
url: "/assets/vendor/boilerplate/js/datatables/i18n/French.json"
|
||||
}
|
||||
url: "/assets/plugins/datatables_lang/{{ \App::getLocale() }}.json"
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
function reloadDatatable(name) {
|
||||
getDatatable(name).ajax.reload(null,false);
|
||||
}
|
||||
|
||||
function getDatatable(name) {
|
||||
if (typeof(window.LaravelDataTables) !== 'undefined') {
|
||||
return window.LaravelDataTables[name + "-table"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getDatatableState(name) {
|
||||
var table = getDatatable("{{ $model }}");
|
||||
return table ? table.state.loaded() : false;
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_DATATABLES', true))
|
||||
|
||||
@endif
|
||||
|
||||
@push('scripts')
|
||||
@if ($dataTable)
|
||||
{{ $dataTable->scripts() }}
|
||||
@endif
|
||||
@endpush
|
||||
30
resources/views/load/datepicker.blade.php
Normal file
30
resources/views/load/datepicker.blade.php
Normal file
@@ -0,0 +1,30 @@
|
||||
@if(!defined('LOAD_DATEPICKER'))
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{!! mix('/js/datepicker/datepicker.min.css', '/assets/vendor/boilerplate') !!}">
|
||||
@endpush
|
||||
@push('js')
|
||||
@include('load.moment')
|
||||
<script src="{!! mix('/js/datepicker/datepicker.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
<script>
|
||||
$.fn.datetimepicker.Constructor.Default = $.extend({}, $.fn.datetimepicker.Constructor.Default, {
|
||||
locale: '{{ (App::getLocale() == 'en' ? 'en-GB' : App::getLocale()) }}',
|
||||
icons: $.extend({}, $.fn.datetimepicker.Constructor.Default.icons, {
|
||||
time: 'far fa-clock',
|
||||
date: 'far fa-calendar-alt',
|
||||
up: 'fa fa-chevron-up',
|
||||
down: 'fa fa-chevron-down',
|
||||
})
|
||||
});
|
||||
|
||||
function initDatepicker(sel, format, date) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.datepicker' : sel;
|
||||
var format = (typeof(format) == 'undefined') ? 'L' : format;
|
||||
// var date = (typeof(date) == 'undefined') ? new Date() : date;
|
||||
$(selector).datetimepicker({
|
||||
format: format
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_DATEPICKER', true))
|
||||
@endif
|
||||
15
resources/views/load/editor.blade.php
Normal file
15
resources/views/load/editor.blade.php
Normal file
@@ -0,0 +1,15 @@
|
||||
@if(!defined('LOAD_EDITOR'))
|
||||
|
||||
@include('load.editor.tinymce')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
function initEditor(selector) {
|
||||
var selector = '.editor';
|
||||
$(selector).tinymce({});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_EDITOR', true))
|
||||
@endif
|
||||
39
resources/views/load/editor/tinymce.blade.php
Normal file
39
resources/views/load/editor/tinymce.blade.php
Normal file
@@ -0,0 +1,39 @@
|
||||
@if(!defined('LOAD_TINYMCE'))
|
||||
@push('js')
|
||||
<script src="{!! mix('/js/tinymce/tinymce.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
<script>
|
||||
tinymce.defaultSettings = {
|
||||
plugins: "autoresize fullscreen codemirror link lists table media image imagetools paste customalign stickytoolbar",
|
||||
toolbar: "undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen",
|
||||
contextmenu: "link image imagetools table spellchecker bold italic underline",
|
||||
sticky_toolbar_container: '.tox-editor-header',
|
||||
toolbar_drawer: "sliding",
|
||||
sticky_offset: $('nav.main-header').outerHeight(),
|
||||
codemirror: { config: { theme: 'storm' } },
|
||||
menubar: false,
|
||||
removed_menuitems: 'newdocument',
|
||||
remove_linebreaks: false,
|
||||
forced_root_block: false,
|
||||
force_p_newlines: true,
|
||||
relative_urls: false,
|
||||
verify_html: false,
|
||||
branding: false,
|
||||
statusbar: false,
|
||||
browser_spellcheck: true,
|
||||
encoding: 'UTF-8',
|
||||
image_uploadtab: false,
|
||||
paste_preprocess: function(plugin, args) {
|
||||
args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
|
||||
args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes
|
||||
args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s| |<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
|
||||
},
|
||||
skin : "boilerplate",
|
||||
@if(config('boilerplate.app.locale') !== 'en')
|
||||
language: '{{ config('boilerplate.app.locale') }}'
|
||||
@endif
|
||||
};
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_TINYMCE', true))
|
||||
@endif
|
||||
25
resources/views/load/fileinput.blade.php
Normal file
25
resources/views/load/fileinput.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@if(!defined('LOAD_FILEINPUT'))
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{!! mix('/js/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}">
|
||||
@endpush
|
||||
@push('js')
|
||||
<script src="{!! mix('/js/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
@if(App::getLocale() !== 'en')
|
||||
<script src="{!! asset('/assets/vendor/boilerplate/js/fileinput/locales/'.config('boilerplate.app.locale').'.js') !!}"></script>
|
||||
<script>
|
||||
$.fn.fileinput.defaults.language = '{{ config('boilerplate.app.locale') }}';
|
||||
</script>
|
||||
@endif
|
||||
@endpush
|
||||
<script>
|
||||
function initUpload(selector) {
|
||||
var selector = '.file';
|
||||
$(selector).fileinput({
|
||||
showCaption: false,
|
||||
dropZoneEnabled: false,
|
||||
showUpload: false,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@php(define('LOAD_FILEINPUT', true))
|
||||
@endif
|
||||
74
resources/views/load/handlebars.blade.php
Normal file
74
resources/views/load/handlebars.blade.php
Normal file
@@ -0,0 +1,74 @@
|
||||
@if(!defined('LOAD_HANDLEBARS'))
|
||||
@push('scripts')
|
||||
<script>
|
||||
function renderContractDriveTPL(filename, data, selector) {
|
||||
data.translate = translate;
|
||||
var path = '/assets/apps/ContractDrive/templates/';
|
||||
var content = getTemplate(path + filename, data);
|
||||
if (typeof(selector) == 'undefined')
|
||||
{
|
||||
return content;
|
||||
} else {
|
||||
$(selector).html(content);
|
||||
}
|
||||
}
|
||||
|
||||
function getTemplate(file, data) {
|
||||
var source = getSource(file);
|
||||
var template = Handlebars.compile(source);
|
||||
return template(data);
|
||||
}
|
||||
|
||||
function getSource(file) {
|
||||
var source = null;
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'html',
|
||||
type: 'GET',
|
||||
url: file + '?' + Date.now(),
|
||||
success: function(data) {
|
||||
source = data;
|
||||
}
|
||||
});
|
||||
return source;
|
||||
}
|
||||
|
||||
function view(template_id, data) {
|
||||
// console.log(template_id);
|
||||
// console.log(data);
|
||||
var source = document.getElementById(template_id).innerHTML;
|
||||
var template = Handlebars.compile(source);
|
||||
return template(data);
|
||||
}
|
||||
|
||||
function helperSelect(name, items, selected, options) {
|
||||
|
||||
// If the selected value is an array, then convert the
|
||||
// select to a multiple select
|
||||
if (selected instanceof Array) {
|
||||
options.hash.multiple = 'multiple';
|
||||
}
|
||||
|
||||
// Generate the list of options
|
||||
var optionsHtml = '';
|
||||
for (var i = 0, j = items.length; i < j; i++) {
|
||||
|
||||
// <option> attributes
|
||||
var attr = {
|
||||
value: items[i].value
|
||||
};
|
||||
|
||||
// We can specify which options are selected by using either:
|
||||
// * an array of selected values or
|
||||
// * a single selected value
|
||||
if ((selected instanceof Array && indexOf(selected, items[i].value) !== -1) || (selected === items[i].value)) {
|
||||
attr.selected = 'selected';
|
||||
}
|
||||
|
||||
optionsHtml += createElement('option', true, attr, items[i].text);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_HANDLEBARS', true))
|
||||
@endif
|
||||
114
resources/views/load/modal.blade.php
Normal file
114
resources/views/load/modal.blade.php
Normal file
@@ -0,0 +1,114 @@
|
||||
@if(!defined('LOAD_MODAL'))
|
||||
|
||||
@push('js')
|
||||
|
||||
<script>
|
||||
function openModal(title, form_id, url_open, url_save, callback, size, no_confirm) {
|
||||
var status = 0;
|
||||
var dialog = bootbox.dialog({
|
||||
title: title,
|
||||
message: '<p><i class="fa fa-spin fa-spinner"></i> {{ __('loading') }} ...</p>',
|
||||
size: size ? size : 'large',
|
||||
scrollable: true,
|
||||
onHide: function(e) {
|
||||
console.log(status);
|
||||
},
|
||||
buttons: buildModalButtons(form_id, no_confirm)
|
||||
});
|
||||
|
||||
/*
|
||||
changeModalContent(dialog, url_open);
|
||||
var callback = handlePostModal(form_id,url_save, callback);
|
||||
handlePostModal(form_id,url_save, callback);
|
||||
*/
|
||||
|
||||
dialog.init(function() {
|
||||
$.get(url_open, function(data) {
|
||||
dialog.find('.bootbox-body').html(data);
|
||||
handlePostModal(form_id,url_save, callback);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function changeModalContent(dialog, url, callback) {
|
||||
dialog.init(function() {
|
||||
$.get(url, function(data) {
|
||||
dialog.find('.bootbox-body').html(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function viewModal(url, size, title) {
|
||||
var dialog = bootbox.dialog({
|
||||
title: title ? title : 'Web viewer',
|
||||
message: '<iframe style="border:0;" src="' + url + '" height="400" width="100%"></iframe>',
|
||||
size: size ? size : 'xl',
|
||||
scrollable: true,
|
||||
});
|
||||
}
|
||||
|
||||
function buildModalButtons(form_id, no_confirm) {
|
||||
if (!no_confirm) {
|
||||
var buttons = {
|
||||
cancel: {
|
||||
label: '{{ __('cancel') }}',
|
||||
className: 'btn-secondary'
|
||||
},
|
||||
confirm: {
|
||||
label: '{{ __('save') }}',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
submitModal(form_id);
|
||||
}
|
||||
},
|
||||
};
|
||||
} else {
|
||||
buttons = '';
|
||||
}
|
||||
return buttons;
|
||||
}
|
||||
|
||||
function submitModal(form_id) {
|
||||
/*
|
||||
var data = $(form_id).serialize();
|
||||
$.post(url_save, data)
|
||||
.done(function(data) {
|
||||
if (callback) {
|
||||
eval(callback);
|
||||
}
|
||||
});
|
||||
*/
|
||||
if (typeof(tinyMCE) != 'undefined') {
|
||||
tinyMCE.triggerSave();
|
||||
}
|
||||
var oForm = 'form' + form_id;
|
||||
$(oForm).submit();
|
||||
status = 1;
|
||||
}
|
||||
|
||||
function handlePostModal(form_id,url_save, callback) {
|
||||
var oForm = 'form'+form_id;
|
||||
$(oForm).submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: url_save,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
success: function (data) {
|
||||
if (callback) {
|
||||
eval(callback);
|
||||
}
|
||||
},
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@php(define('LOAD_MODAL', true))
|
||||
@endif
|
||||
7
resources/views/load/moment.blade.php
Normal file
7
resources/views/load/moment.blade.php
Normal file
@@ -0,0 +1,7 @@
|
||||
@if(!defined('LOAD_MOMENT'))
|
||||
<script src="{!! mix('/js/moment/moment-with-locales.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
<script>
|
||||
moment.locale('{{ App::getLocale() }}');
|
||||
</script>
|
||||
@php(define('LOAD_MOMENT', true))
|
||||
@endif
|
||||
53
resources/views/load/nestable.blade.php
Normal file
53
resources/views/load/nestable.blade.php
Normal file
@@ -0,0 +1,53 @@
|
||||
@if(!defined('LOAD_NESTABLE'))
|
||||
@push('scripts')
|
||||
<script src="{{ asset('/assets/plugins/nestable2/jquery.nestable.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
|
||||
function getPrevious(id, tree)
|
||||
{
|
||||
var next = _.find(tree, {'id': id}).right + 1;
|
||||
var before = _.find(tree, {'left': next});
|
||||
return (typeof(before) != 'undefined') ? before.id : false;
|
||||
}
|
||||
|
||||
function getAfter(id, tree)
|
||||
{
|
||||
var previous = _.find(tree, {'id': id}).left - 1;
|
||||
var after = _.find(tree, {'right': previous});
|
||||
return (typeof(after) != 'undefined') ? after.id : false;
|
||||
}
|
||||
|
||||
function nestable_move(id, l, moveBefore, moveAfter, callback) {
|
||||
var target_id = getPrevious(id, l.nestable('toArray'));
|
||||
if (target_id) {
|
||||
var url = moveBefore;
|
||||
} else {
|
||||
var target_id = getAfter(id, l.nestable('toArray'));
|
||||
var url = moveAfter;
|
||||
}
|
||||
|
||||
if (target_id) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: {
|
||||
id : id,
|
||||
target_id : target_id,
|
||||
}
|
||||
}).done(function() {
|
||||
growl("admin.movesuccess", 'success');
|
||||
if (callback != 'undefined') {
|
||||
eval(callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('/assets/plugins/nestable2/jquery.nestable.min.css') }}">
|
||||
@endpush
|
||||
@php(define('LOAD_NESTABLE', true))
|
||||
@endif
|
||||
18
resources/views/load/select2.blade.php
Normal file
18
resources/views/load/select2.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
@if(!defined('LOAD_SELECT2'))
|
||||
@push('scripts')
|
||||
<script src="{!! mix('/js/select2/select2.full.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||
<script src="{!! asset('/assets/vendor/boilerplate/js/select2/i18n/'.config('boilerplate.app.locale').'.js') !!}"></script>
|
||||
<script>
|
||||
function initSelect2() {
|
||||
$(".select2").select2({
|
||||
placeholder: "Select a value",
|
||||
allowClear: false,
|
||||
width: {
|
||||
value: '100%'
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_SELECT2', true))
|
||||
@endif
|
||||
25
resources/views/load/set_options.blade.php
Normal file
25
resources/views/load/set_options.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@if(!defined('LOAD_SET_OPTIONS'))
|
||||
@push('js')
|
||||
<script>
|
||||
function setOptions(selector,data,selected,all) {
|
||||
// console.log(data);
|
||||
var $el = $(selector);
|
||||
$el.empty(); // remove old options
|
||||
if (all) {
|
||||
$el.append($("<option></option>").attr("value",'').text('{{ __("all") }}'));
|
||||
}
|
||||
$.each(data, function(key, name) {
|
||||
console.log(name);
|
||||
if (key != null) {
|
||||
if (key == selected) {
|
||||
$el.append($("<option selected='selected'></option>").attr("value", key).text(name));
|
||||
} else {
|
||||
$el.append($("<option></option>").attr("value", key).text(name));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('LOAD_SET_OPTIONS', true))
|
||||
@endif
|
||||
34
resources/views/load/toggle.blade.php
Normal file
34
resources/views/load/toggle.blade.php
Normal file
@@ -0,0 +1,34 @@
|
||||
@if(!defined('LOAD_TOGGLE'))
|
||||
@push('scripts')
|
||||
<script src="{{ asset('/assets/plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
function initToggle(url, sel, data, callback) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.toggle' : sel;
|
||||
if (typeof(data) == 'undefined') {
|
||||
var data = {};
|
||||
}
|
||||
$(selector).bootstrapToggle();
|
||||
|
||||
$('input' + selector).change(function() {
|
||||
console.log($(this));
|
||||
data['id'] = $(this).data('id');
|
||||
data['active'] = $(this).is(':checked');
|
||||
if (data['id'] && (typeof(url) != 'undefined') && (url != '')) {
|
||||
var dataJson = Object.assign({}, data);
|
||||
$.post(url, dataJson);
|
||||
}
|
||||
if (typeof(callback) != 'undefined') {
|
||||
eval(callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
@push('css')
|
||||
<link rel="stylesheet" href="{{ asset('/assets/plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css') }}">
|
||||
@endpush
|
||||
@php(define('LOAD_TOGGLE', true))
|
||||
@endif
|
||||
7
routes/Shop/Admin/Unities.php
Normal file
7
routes/Shop/Admin/Unities.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
Route::prefix('Unities')->name('Unities.')->group(function () {
|
||||
Route::any('getOptionsByFamily', 'UnityController@getOptionsByFamily')->name('getOptionsByFamily');
|
||||
});
|
||||
|
||||
Route::resource('Unities', 'UnityController');
|
||||
@@ -14,8 +14,8 @@ Route::middleware('auth')->prefix('Admin')->namespace('Admin')->name('Admin.')->
|
||||
include __DIR__ . '/OrderPayments.php';
|
||||
include __DIR__ . '/Orders.php';
|
||||
include __DIR__ . '/PriceFamilies.php';
|
||||
include __DIR__ . '/PriceFamilyValues.php';
|
||||
include __DIR__ . '/PriceGenerics.php';
|
||||
include __DIR__ . '/Tags.php';
|
||||
include __DIR__ . '/TagGroups.php';
|
||||
include __DIR__ . '/Unities.php';
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user