Add exports & fix on edition
This commit is contained in:
@@ -8,7 +8,7 @@ use App\Models\Botanic\Family;
|
|||||||
|
|
||||||
class FamiliesDataTable extends DataTable
|
class FamiliesDataTable extends DataTable
|
||||||
{
|
{
|
||||||
public $model_name = 'Families';
|
public $model_name = 'families';
|
||||||
|
|
||||||
public function query(Family $model)
|
public function query(Family $model)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use App\Models\Botanic\Genre;
|
|||||||
|
|
||||||
class GenresDataTable extends DataTable
|
class GenresDataTable extends DataTable
|
||||||
{
|
{
|
||||||
public $model_name = 'Genres';
|
public $model_name = 'genres';
|
||||||
|
|
||||||
public function query(Genre $model)
|
public function query(Genre $model)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use App\Models\Botanic\Specie;
|
|||||||
|
|
||||||
class SpeciesDataTable extends DataTable
|
class SpeciesDataTable extends DataTable
|
||||||
{
|
{
|
||||||
public $model_name = 'Species';
|
public $model_name = 'species';
|
||||||
|
|
||||||
public function query(Specie $model)
|
public function query(Specie $model)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use App\Models\Botanic\Variety;
|
|||||||
|
|
||||||
class VarietiesDataTable extends DataTable
|
class VarietiesDataTable extends DataTable
|
||||||
{
|
{
|
||||||
public $model_name = 'Varieties';
|
public $model_name = 'varieties';
|
||||||
|
|
||||||
public function query(Variety $model)
|
public function query(Variety $model)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ class CustomersDataTable extends DataTable
|
|||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('name'),
|
Column::make('name')->title('Nom'),
|
||||||
|
Column::make('address')->title('Adresse'),
|
||||||
|
Column::make('zipcode')->title('Code postal'),
|
||||||
|
Column::make('city')->title('Ville'),
|
||||||
self::makeColumnButtons(),
|
self::makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ class InvoicesDataTable extends DataTable
|
|||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('name'),
|
Column::make('status.name'),
|
||||||
|
Column::make('customer.name'),
|
||||||
|
Column::make('total'),
|
||||||
self::makeColumnButtons(),
|
self::makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,4 +49,10 @@ class FamilyController extends Controller
|
|||||||
{
|
{
|
||||||
return Families::destroy($id);
|
return Families::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportExcel()
|
||||||
|
{
|
||||||
|
return Families::exportExcel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,4 +49,10 @@ class GenreController extends Controller
|
|||||||
{
|
{
|
||||||
return Genres::destroy($id);
|
return Genres::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportExcel()
|
||||||
|
{
|
||||||
|
return Genres::exportExcel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,4 +50,8 @@ class SpecieController extends Controller
|
|||||||
return Species::destroy($id);
|
return Species::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportExcel()
|
||||||
|
{
|
||||||
|
return Species::exportExcel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,4 +74,8 @@ class VarietyController extends Controller
|
|||||||
return Varieties::deleteImage($id, $index);
|
return Varieties::deleteImage($id, $index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportExcel()
|
||||||
|
{
|
||||||
|
return Varieties::exportExcel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
use Yajra\DataTables\DataTables;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
use App\Models\Botanic\Family;
|
use App\Models\Botanic\Family;
|
||||||
|
use App\Exports\Botanic\FamiliesExport;
|
||||||
|
|
||||||
class Families
|
class Families
|
||||||
{
|
{
|
||||||
@@ -56,4 +58,9 @@ class Families
|
|||||||
return Family::destroy($id);
|
return Family::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function exportExcel()
|
||||||
|
{
|
||||||
|
return Excel::download(new FamiliesExport, 'families.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
use Yajra\DataTables\DataTables;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
use App\Models\Botanic\Genre;
|
use App\Models\Botanic\Genre;
|
||||||
|
use App\Exports\Botanic\GenresExport;
|
||||||
|
|
||||||
class Genres
|
class Genres
|
||||||
{
|
{
|
||||||
@@ -56,4 +58,8 @@ class Genres
|
|||||||
return Genre::destroy($id);
|
return Genre::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function exportExcel()
|
||||||
|
{
|
||||||
|
return Excel::download(new GenresExport, 'genres.xlsx');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
use Yajra\DataTables\DataTables;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
use App\Models\Botanic\Specie;
|
use App\Models\Botanic\Specie;
|
||||||
|
use App\Exports\Botanic\SpeciesExport;
|
||||||
|
|
||||||
class Species
|
class Species
|
||||||
{
|
{
|
||||||
@@ -56,4 +58,8 @@ class Species
|
|||||||
return Specie::destroy($id);
|
return Specie::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function exportExcel()
|
||||||
|
{
|
||||||
|
return Excel::download(new SpeciesExport, 'species.xlsx');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ use Illuminate\Support\Facades\DB;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
use Yajra\DataTables\DataTables;
|
||||||
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
use App\Models\Botanic\Variety;
|
use App\Models\Botanic\Variety;
|
||||||
|
use App\Exports\Botanic\VarietiesExport;
|
||||||
|
|
||||||
class Varieties
|
class Varieties
|
||||||
{
|
{
|
||||||
@@ -136,4 +138,9 @@ class Varieties
|
|||||||
return "1";
|
return "1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function exportExcel()
|
||||||
|
{
|
||||||
|
return Excel::download(new VarietiesExport, 'varieties.xlsx');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,10 @@ class ArticleAttributes
|
|||||||
|
|
||||||
public static function update($data, $id = false)
|
public static function update($data, $id = false)
|
||||||
{
|
{
|
||||||
$id = isset($data['id']) ? $id : $data['id'];
|
$id = isset($data['id']) ? $data['id'] : $id;
|
||||||
return ArticleAttribute::find($id)->update($data);
|
$item = ArticleAttribute::find($id);
|
||||||
|
$item->update($data);
|
||||||
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function destroy($id)
|
public static function destroy($id)
|
||||||
|
|||||||
@@ -39,11 +39,15 @@ class ArticlePrices
|
|||||||
return ArticlePrice::find($id);
|
return ArticlePrice::find($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function storePrices($article_attribute_id, $prices)
|
public static function storePrices($article_id, $prices)
|
||||||
{
|
{
|
||||||
if ($prices) {
|
if ($prices) {
|
||||||
foreach ($prices as $key => $price) {
|
foreach ($prices as $key => $price) {
|
||||||
$prices[$key]['article_attribute_id'] = $article_attribute_id;
|
$price['article_attribute']['article_attribute_value_id'] = $price['attribute']['attribute_value_id'];
|
||||||
|
$prices[$key]['article_attribute_id'] = ArticleAttributes::storeAttribute($article_id, $price['article_attribute']);
|
||||||
|
|
||||||
|
unset($prices[$key]['article_attribute']);
|
||||||
|
unset($prices[$key]['attribute']);
|
||||||
self::store($prices[$key]);
|
self::store($prices[$key]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Articles
|
|||||||
self::storeCategories($article, $categories);
|
self::storeCategories($article, $categories);
|
||||||
self::storeTags($article, $tags);
|
self::storeTags($article, $tags);
|
||||||
self::storePrices($article, $prices);
|
self::storePrices($article, $prices);
|
||||||
return $article;
|
return $article_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function store($data)
|
public static function store($data)
|
||||||
|
|||||||
@@ -6,6 +6,6 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@component('components.card')
|
@component('components.card')
|
||||||
@include('components.datatable', ['route' => route('Botanic.Admin.Families.index'), 'model' => 'Families'])
|
@include('components.datatable', ['route' => route('Botanic.Admin.Families.index'), 'model' => 'families'])
|
||||||
@endcomponent
|
@endcomponent
|
||||||
@endsection
|
@endsection
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@component('components.card')
|
@component('components.card')
|
||||||
@include('components.datatable', ['route' => route('Botanic.Admin.Genres.index'), 'model' => 'BotanicGenres'])
|
@include('components.datatable', ['route' => route('Botanic.Admin.Genres.index'), 'model' => 'genres'])
|
||||||
@endcomponent
|
@endcomponent
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@component('components.card')
|
@component('components.card')
|
||||||
@include('components.datatable', ['route' => route('Botanic.Admin.Species.index'), 'model' => 'BotanicSpecies'])
|
@include('components.datatable', ['route' => route('Botanic.Admin.Species.index'), 'model' => 'species'])
|
||||||
@endcomponent
|
@endcomponent
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@component('components.card')
|
@component('components.card')
|
||||||
@include('components.datatable', ['route' => route('Botanic.Admin.Varieties.index'), 'model' => 'BotanicVarieties'])
|
@include('components.datatable', ['route' => route('Botanic.Admin.Varieties.index'), 'model' => 'varieties'])
|
||||||
@endcomponent
|
@endcomponent
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|||||||
@@ -11,18 +11,6 @@
|
|||||||
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
<input type="hidden" name="id" id="id" value="{{ $id }}">
|
<input type="hidden" name="id" id="id" value="{{ $id }}">
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 mbl">
|
|
||||||
<a href="{{ route("Shop.Admin.Articles.index") }}" class="btn btn-default">
|
|
||||||
{{ __('Shop.articles.title') }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<span class="btn-group pull-right">
|
|
||||||
@include('components.button-save')
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@include('Shop.Admin.Articles.form')
|
@include('Shop.Admin.Articles.form')
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
{{ Form::label('generic_price_id', 'Générique') }}<br/>
|
{{ Form::label('price_generic_id', 'Générique') }}<br/>
|
||||||
@include('components.select', ['name' => "prices[$key][article_generic_price_id]", 'value' => $price['article_generic_price_id'] ?? null, 'list' => ['Tarif barquette','Tarif semences'], 'required' => false, 'class' => 'form-control-sm'])
|
@include('components.select', ['name' => "prices[$key][article_price_generic_id]", 'value' => $price['article_price_generic_id'] ?? null, 'list' => $price_generics ?? null, 'required' => false, 'class' => 'form-control-sm'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
{{ Form::label('generic_price_id', 'Générique') }}<br/>
|
{{ Form::label('price_generic_id', 'Générique') }}<br/>
|
||||||
@include('components.select', ['name' => "prices[0][article_generic_price_id]", 'value' => $price['article_generic_price_id'] ?? null, 'list' => ['Tarif barquette','Tarif semences'], 'required' => false, 'class' => 'form-control-sm'])
|
@include('components.select', ['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>
|
||||||
|
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ Route::prefix('Families')->name('Families.')->group(function () {
|
|||||||
Route::post('store', 'FamilyController@store')->name('store');
|
Route::post('store', 'FamilyController@store')->name('store');
|
||||||
Route::get('edit/{id}', 'FamilyController@edit')->name('edit');
|
Route::get('edit/{id}', 'FamilyController@edit')->name('edit');
|
||||||
|
|
||||||
|
Route::any('exportExcel', 'FamilyController@exportExcel')->name('exportExcel');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ Route::prefix('Genres')->name('Genres.')->group(function () {
|
|||||||
Route::post('store', 'GenreController@store')->name('store');
|
Route::post('store', 'GenreController@store')->name('store');
|
||||||
Route::get('edit/{id}', 'GenreController@edit')->name('edit');
|
Route::get('edit/{id}', 'GenreController@edit')->name('edit');
|
||||||
|
|
||||||
|
Route::any('exportExcel', 'GenreController@exportExcel')->name('exportExcel');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ Route::prefix('Species')->name('Species.')->group(function () {
|
|||||||
Route::post('store', 'SpecieController@store')->name('store');
|
Route::post('store', 'SpecieController@store')->name('store');
|
||||||
Route::get('edit/{id}', 'SpecieController@edit')->name('edit');
|
Route::get('edit/{id}', 'SpecieController@edit')->name('edit');
|
||||||
|
|
||||||
|
Route::any('exportExcel', 'SpecieController@exportExcel')->name('exportExcel');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,5 +11,8 @@ Route::prefix('Varieties')->name('Varieties.')->group(function () {
|
|||||||
Route::post('getSelect', 'VarietyController@getOptionsWithSpecie')->name('getSelect');
|
Route::post('getSelect', 'VarietyController@getOptionsWithSpecie')->name('getSelect');
|
||||||
Route::post('deleteImage', 'VarietyController@deleteImage')->name('deleteImage');
|
Route::post('deleteImage', 'VarietyController@deleteImage')->name('deleteImage');
|
||||||
Route::any('getImages/{id?}', 'VarietyController@getImages')->name('getImages');
|
Route::any('getImages/{id?}', 'VarietyController@getImages')->name('getImages');
|
||||||
|
|
||||||
|
Route::any('exportExcel', 'VarietyController@exportExcel')->name('exportExcel');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user