rename models and associates, isolate botanic with shop
241
Gruntfile.js
Normal file
@@ -0,0 +1,241 @@
|
||||
var jsCompatibilty = [
|
||||
'node_modules/promise-polyfill/dist/polyfill.min.js',
|
||||
'node_modules/es6-promise/dist/es6-promise.min.js'
|
||||
]
|
||||
|
||||
var jsMain = [
|
||||
'node_modules/sweetalert2/dist/sweetalert2.all.min.js',
|
||||
'node_modules/inputmask/dist/min/jquery.inputmask.bundle.min.js',
|
||||
/* 'node_modules/summernote/dist/summernote.min.js',
|
||||
'node_modules/summernote/dist/lang/summernote-fr-FR.min.js',
|
||||
*/
|
||||
'node_modules/@activix/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js',
|
||||
'node_modules/@activix/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.fr.js',
|
||||
'node_modules/bootstrap-fileinput/js/plugins/piexif.min.js',
|
||||
'node_modules/bootstrap-slider/dist/bootstrap-slider.min.js',
|
||||
'node_modules/bootstrap-validate/dist/bootstrap-validate.js',
|
||||
'node_modules/jQuery-QueryBuilder/dist/js/jquery-builder.standalone.min.js',
|
||||
/* 'node_modules/jQuery-QueryBuilder/dist/i18n/query-builder.fr.js', */
|
||||
/* 'node_modules/isotope-layout/dist/isotope.pkgd.min.js', */
|
||||
'node_modules/wew.js/dist/wew.min.js',
|
||||
'node_modules/jquery.are-you-sure/jquery.are-you-sure.js',
|
||||
/* 'node_modules/letteringjs/jquery.lettering.js', */
|
||||
/* 'node_modules/textillate/jquery.textillate.js', */
|
||||
'node_modules/numeral/min/numeral.min.js',
|
||||
'node_modules/numeral/min/locales/fr.min.js',
|
||||
'build/js/url_on_tab.js',
|
||||
'build/js/set_options.js',
|
||||
'build/js/confirm.js',
|
||||
'build/js/appender.js',
|
||||
'build/js/app.js',
|
||||
]
|
||||
|
||||
var cssMain = [
|
||||
'node_modules/sweetalert2/dist/sweetalert2.min.css',
|
||||
'node_modules/inputmask/css/inputmask.css',
|
||||
'node_modules/summernote/dist/summernote.css',
|
||||
'node_modules/@activix/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css',
|
||||
'node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css',
|
||||
'node_modules/jQuery-QueryBuilder/dist/css/query-builder.default.min.css',
|
||||
'node_modules/animate.css/animate.min.css',
|
||||
'build/css/modal-option.css',
|
||||
'build/css/shadow.css',
|
||||
'build/css/utility.css',
|
||||
'build/css/site.css',
|
||||
'build/css/admin.css'
|
||||
]
|
||||
|
||||
var jsDataTables = [
|
||||
'node_modules/jszip/dist/jszip.min.js',
|
||||
'node_modules/pdfmake/build/pdfmake.min.js',
|
||||
'node_modules/pdfmake/build/vfs_fonts.js',
|
||||
'node_modules/datatables/media/js/jquery.dataTables.min.js',
|
||||
'node_modules/datatables.net-bs4/js/dataTables.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-autofill/js/autoFill.min.js',
|
||||
'node_modules/datatables.net-autofill/js/autoFill.bootstrap.min.js',
|
||||
'node_modules/datatables.net-buttons/js/dataTables.buttons.min.js',
|
||||
'node_modules/datatables.net-buttons-bs4/js/buttons.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-buttons/js/buttons.html5.min.js',
|
||||
'node_modules/datatables.net-buttons/js/buttons.print.min.js',
|
||||
'node_modules/datatables.net-buttons/js/buttons.colVis.min.js',
|
||||
'node_modules/datatables.net-colreorder/js/dataTables.colReorder.min.js',
|
||||
'node_modules/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js',
|
||||
'node_modules/datatables.net-fixedheader-bs4/js/fixedHeader.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-fixedcolumns/js/dataTables.fixedColumns.min.js',
|
||||
'node_modules/datatables.net-fixedcolumns-bs4/js/fixedColumns.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-keytable/js/dataTables.keyTable.min.js',
|
||||
'node_modules/datatables.net-keytable-bs4/js/keyTable.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-responsive/js/dataTables.responsive.min.js',
|
||||
'node_modules/datatables.net-scroller/js/dataTables.scroller.min.js',
|
||||
'node_modules/datatables.net-scroller-bs4/js/scroller.bootstrap4.min.js',
|
||||
'node_modules/datatables.net-select/js/dataTables.select.min.js',
|
||||
'node_modules/datatables.net-select-bs4/js/select.bootstrap4.min.js',
|
||||
'node_modules/yadcf/jquery.dataTables.yadcf.js',
|
||||
'build/js/modal.js',
|
||||
'build/js/datatables.js',
|
||||
];
|
||||
|
||||
var cssDataTables = [
|
||||
// 'node_modules/datatables/media/css/jquery.dataTables.min.css',
|
||||
'node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css',
|
||||
'node_modules/dataTables.net-buttons-bs4/css/buttons.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-autofill/css/autoFill.bootstrap.min.css',
|
||||
'node_modules/datatables.net-colreorder-bs4/css/colReorder.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-fixedheader-bs4/css/fixedHeader.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-fixedcolumns-bs4/css/fixedColumns.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-keytable-bs4/css/keyTable.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-scroller-bs4/css/scroller.bootstrap4.min.css',
|
||||
'node_modules/datatables.net-select-bs4/css/select.bootstrap4.min.css',
|
||||
'node_modules/yadcf/jquery.dataTables.yadcf.css',
|
||||
'build/dataTables.bootstrap.min.css',
|
||||
];
|
||||
|
||||
var jsCalendar = [
|
||||
'node_modules/fullcalendar/dist/fullcalendar.min.js',
|
||||
'node_modules/fullcalendar/dist/locale/fr.js'
|
||||
]
|
||||
|
||||
var cssCalendar = [
|
||||
'node_modules/fullcalendar/dist/fullcalendar.min.css',
|
||||
]
|
||||
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
|
||||
nameCache: 'built/<%= pkg.name %>.json'
|
||||
},
|
||||
build: {
|
||||
files: [
|
||||
{
|
||||
'public/js/main.min.js': jsMain,
|
||||
'public/js/datatables.min.js': jsDataTables,
|
||||
'public/js/calendar.min.js': jsCalendar
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'build/js/modules',
|
||||
src: '**/*.js',
|
||||
dest: 'public/js',
|
||||
rename: function (dest, src) {
|
||||
return dest + '/' + src.replace('.js', '.min.js');
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
eslint: {
|
||||
target: ['build/js/*']
|
||||
},
|
||||
webstandards: {
|
||||
'src': ['build/js/*']
|
||||
},
|
||||
concat: {
|
||||
options: {
|
||||
separator: '\n'
|
||||
},
|
||||
mainjs: {
|
||||
src: jsMain,
|
||||
dest: 'public/js/main.min.js'
|
||||
},
|
||||
maincss: {
|
||||
src: cssMain,
|
||||
dest: 'public/css/main.min.css'
|
||||
},
|
||||
datatablesjs: {
|
||||
src: jsDataTables,
|
||||
dest: 'public/js/datatables.min.js'
|
||||
},
|
||||
datatablescss: {
|
||||
src: cssDataTables,
|
||||
dest: 'public/css/datatables.min.css'
|
||||
},
|
||||
calendarjs: {
|
||||
src: jsCalendar,
|
||||
dest: 'public/js/calendar.min.js'
|
||||
},
|
||||
calendarcss: {
|
||||
src: cssCalendar,
|
||||
dest: 'public/css/calendar.min.css'
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
options: {
|
||||
shorthandCompacting: false,
|
||||
roundingPrecision: -1
|
||||
},
|
||||
target: {
|
||||
files: [
|
||||
{
|
||||
'public/css/main.min.css': cssMain
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
main: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap/dist/fonts/',
|
||||
src: ['**'],
|
||||
dest: 'public/fonts/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/font-awesome/fonts/',
|
||||
src: ['**'],
|
||||
dest: 'public/fonts/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/summernote/dist/font/',
|
||||
src: ['**'],
|
||||
dest: 'public/css/font/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/datatables/media/images/',
|
||||
src: ['**'],
|
||||
dest: 'public/images/'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'build/img/',
|
||||
src: ['**'],
|
||||
dest: 'public/img/'
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dist: {
|
||||
files: [
|
||||
'build/*',
|
||||
],
|
||||
tasks: ['concat', 'copy']
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Load the plugin that provides the "uglify" task.
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
grunt.loadNpmTasks('grunt-contrib-handlebars');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-eslint');
|
||||
grunt.loadNpmTasks('grunt-webstandards');
|
||||
|
||||
// Default task(s).
|
||||
grunt.registerTask('default', ['uglify', 'concat', 'cssmin', 'copy']);
|
||||
grunt.registerTask('js', ['uglify']);
|
||||
grunt.registerTask('css', ['cssmin', 'copy']);
|
||||
grunt.registerTask('dev', ['concat', 'copy']);
|
||||
grunt.registerTask('lint', ['eslint']);
|
||||
grunt.registerTask('webstandards', ['webstandards']);
|
||||
};
|
||||
@@ -4,13 +4,13 @@ namespace App\DataTables;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Product;
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class ProductsDataTable extends DataTable
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Products';
|
||||
public $model_name = 'Articles';
|
||||
|
||||
public function query(Product $model)
|
||||
public function query(Article $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
30
app/Datatables/CategoriesDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Category;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Categories';
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,16 +12,18 @@ class SpeciesDataTable extends DataTable
|
||||
|
||||
public function query(Specie $model)
|
||||
{
|
||||
$model = $model::withCount('varieties')->with('genre');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('genre_name'),
|
||||
Column::make('latin'),
|
||||
Column::make('genre'),
|
||||
Column::make('varieties_count')->title('Nb variétés'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Families;
|
||||
use App\Repositories\Botanic\Families;
|
||||
use App\DataTables\FamiliesDataTable;
|
||||
|
||||
class FamilyController extends Controller
|
||||
@@ -13,7 +13,7 @@ class FamilyController extends Controller
|
||||
|
||||
public function index(FamiliesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Families.list');
|
||||
return $dataTable->render('Botanic.Admin.Families.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -24,25 +24,25 @@ class FamilyController extends Controller
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
return view('Shop.Admin.Families.create', $data);
|
||||
return view('Botanic.Admin.Families.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Families::store($request);
|
||||
return redirect()->route('Shop.Admin.Families.index');
|
||||
return redirect()->route('Botanic.Admin.Families.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Families::get($id);
|
||||
return view('Shop.Admin.Families.view', $data);
|
||||
return view('Botanic.Admin.Families.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['family'] = Families::get($id)->toArray();
|
||||
return view('Shop.Admin.Families.edit', $data);
|
||||
return view('Botanic.Admin.Families.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Genres;
|
||||
use App\Repositories\Shop\Families;
|
||||
use App\Repositories\Botanic\Genres;
|
||||
use App\Repositories\Botanic\Families;
|
||||
use App\DataTables\GenresDataTable;
|
||||
|
||||
class GenreController extends Controller
|
||||
{
|
||||
public function index(GenresDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Genres.list');
|
||||
return $dataTable->render('Botanic.Admin.Genres.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -23,26 +23,26 @@ class GenreController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Genres.create');
|
||||
return view('Botanic.Admin.Genres.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Genres::store($request);
|
||||
return redirect()->route('Shop.Admin.Genres.index');
|
||||
return redirect()->route('Botanic.Admin.Genres.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Genres::get($id);
|
||||
return view('Shop.Admin.Genres.view', $data);
|
||||
return view('Botanic.Admin.Genres.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Genres::get($id);
|
||||
$data['families'] = Families::getOptions();
|
||||
return view('Shop.Admin.Genres.edit', $data);
|
||||
return view('Botanic.Admin.Genres.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Species;
|
||||
use App\Repositories\Shop\Genres;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\Repositories\Botanic\Genres;
|
||||
use App\DataTables\SpeciesDataTable;
|
||||
|
||||
class SpecieController extends Controller
|
||||
{
|
||||
public function index(SpeciesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Species.list');
|
||||
return $dataTable->render('Botanic.Admin.Species.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -23,26 +23,26 @@ class SpecieController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Species.create');
|
||||
return view('Botanic.Admin.Species.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Species::store($request);
|
||||
return redirect()->route('Shop.Admin.Species.index');
|
||||
return redirect()->route('Botanic.Admin.Species.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Species::get($id);
|
||||
return view('Shop.Admin.Species.view', $data);
|
||||
return view('Botanic.Admin.Species.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Species::get($id);
|
||||
$data['genres'] = Genres::getOptions();
|
||||
return view('Shop.Admin.Species.edit', $data);
|
||||
return view('Botanic.Admin.Species.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
namespace App\Http\Controllers\Botanic\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Varieties;
|
||||
use App\Repositories\Shop\Species;
|
||||
use App\Repositories\Botanic\Varieties;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\DataTables\VarietiesDataTable;
|
||||
|
||||
class VarietyController extends Controller
|
||||
{
|
||||
public function index(VarietiesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Varieties.list');
|
||||
return $dataTable->render('Botanic.Admin.Varieties.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
@@ -23,26 +23,26 @@ class VarietyController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Varieties.create');
|
||||
return view('Botanic.Admin.Varieties.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Varieties::store($request);
|
||||
return redirect()->route('Shop.Admin.Varieties.index');
|
||||
return redirect()->route('Botanic.Admin.Varieties.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Varieties::get($id);
|
||||
return view('Shop.Admin.Varieties.view', $data);
|
||||
return view('Botanic.Admin.Varieties.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Varieties::get($id);
|
||||
$data['species'] = Species::getOptions();
|
||||
return view('Shop.Admin.Varieties.edit', $data);
|
||||
return view('Botanic.Admin.Varieties.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\ProductAttribute;
|
||||
use App\Model\Shop\ArticleAttribute;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ProductAttributeController extends Controller
|
||||
class ArticleAttributeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -42,10 +42,10 @@ class ProductAttributeController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ProductAttribute $productAttribute)
|
||||
public function show(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -53,10 +53,10 @@ class ProductAttributeController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ProductAttribute $productAttribute)
|
||||
public function edit(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -65,10 +65,10 @@ class ProductAttributeController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ProductAttribute $productAttribute)
|
||||
public function update(Request $request, ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -76,10 +76,10 @@ class ProductAttributeController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\ProductAttribute $productAttribute
|
||||
* @param \App\ArticleAttribute $ArticleAttribute
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ProductAttribute $productAttribute)
|
||||
public function destroy(ArticleAttribute $ArticleAttribute)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ProductController extends Controller
|
||||
use App\Models\Shop\Article;
|
||||
use App\Repositories\Shop\Articles;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -42,10 +44,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Product $product)
|
||||
public function show(Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -53,10 +55,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Product $product)
|
||||
public function edit(Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -65,10 +67,10 @@ class ProductController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Product $product)
|
||||
public function update(Request $request, Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -76,10 +78,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Product $product)
|
||||
public function destroy(Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\ProductPrice;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ProductPriceController extends Controller
|
||||
use App\Models\Shop\ArticlePrice;
|
||||
use App\Repositories\Shop\ArticlePrices;
|
||||
|
||||
class ArticlePriceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -42,10 +44,10 @@ class ProductPriceController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ProductPrice $productPrice)
|
||||
public function show(ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -53,10 +55,10 @@ class ProductPriceController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ProductPrice $productPrice)
|
||||
public function edit(ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -65,10 +67,10 @@ class ProductPriceController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ProductPrice $productPrice)
|
||||
public function update(Request $request, ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -76,10 +78,10 @@ class ProductPriceController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\ProductPrice $productPrice
|
||||
* @param \App\ArticlePrice $ArticlePrice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ProductPrice $productPrice)
|
||||
public function destroy(ArticlePrice $ArticlePrice)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -5,28 +5,20 @@ namespace App\Http\Controllers\Shop\Admin;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Sections;
|
||||
use App\Repositories\Shop\Categories;
|
||||
use App\DataTables\CategoriesDataTable;
|
||||
|
||||
class SectionController extends Controller
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
|
||||
public function index(CategoriesDataTable $dataTable)
|
||||
{
|
||||
if ($request->ajax()) {
|
||||
return self::getDatatable($request);
|
||||
} else {
|
||||
$data = [];
|
||||
return view('Shop.Admin.Sections.list', $data);
|
||||
}
|
||||
return $dataTable->render('Shop.Admin.Categories.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Sections::getTables($request->all());
|
||||
return Categories::getTables($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +29,7 @@ class SectionController extends Controller
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
return view('Shop.Admin.Sections.create', $data);
|
||||
return view('Shop.Admin.Categories.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,8 +40,8 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Sections::store($request);
|
||||
return redirect()->route('Shop.Admin.Sections.index');
|
||||
$ret = Categories::store($request);
|
||||
return redirect()->route('Shop.Admin.Categories.index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,8 +52,8 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data = Sections::get($id);
|
||||
return view('Shop.Admin.Sections.view', $data);
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.view', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,8 +64,8 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Sections::get($id);
|
||||
return view('Shop.Admin.Sections.edit', $data);
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,6 +88,6 @@ class SectionController extends Controller
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
return Sections::destroy($id);
|
||||
return Categories::destroy($id);
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,9 @@ namespace App\Http\Controllers\Shop;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Products;
|
||||
use App\Repositories\Shop\Articles;
|
||||
|
||||
class ProductController extends Controller
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -43,10 +43,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Product $product)
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -54,10 +54,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Product $product)
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -66,10 +66,10 @@ class ProductController extends Controller
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Product $product)
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -77,10 +77,10 @@ class ProductController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Product $product
|
||||
* @param \App\Article $article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Product $product)
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -5,9 +5,9 @@ namespace App\Http\Controllers\Shop;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Sections;
|
||||
use App\Repositories\Shop\Categorys;
|
||||
|
||||
class SectionController extends Controller
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@@ -20,13 +20,13 @@ class SectionController extends Controller
|
||||
return self::getDatatable($request);
|
||||
} else {
|
||||
$data = [];
|
||||
return view('Shop.Sections.list', $data);
|
||||
return view('Shop.Categories.list', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Sections::getTables($request->all());
|
||||
return Categories::getDatatable($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,10 +35,10 @@ class SectionController extends Controller
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Customer $customer)
|
||||
public function show($id)
|
||||
{
|
||||
$data = Sections::get($id);
|
||||
return view('Shop.Admin.Sections.view', $data);
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.view', $data);
|
||||
}
|
||||
|
||||
}
|
||||
27
app/Menu/Botanic.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Menu;
|
||||
|
||||
use Sebastienheyd\Boilerplate\Menu\Builder;
|
||||
use App\Repositories\Users;
|
||||
|
||||
class Botanic
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Botanique', [ 'permission' => 'backend', 'icon' => 'envira' ])
|
||||
->id('botanic')
|
||||
->activeIfRoute('botanic')
|
||||
->order(2);
|
||||
|
||||
$menu->addTo('Botanic', 'Familles', [ 'route' => 'Botanic.Admin.Families.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Families.index'])->order(1);
|
||||
$menu->addTo('Botanic', 'Genres', [ 'route' => 'Botanic.Admin.Genres.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Genres.index'])->order(2);
|
||||
$menu->addTo('Botanic', 'Espèces', [ 'route' => 'Botanic.Admin.Species.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Species.index'])->order(3);
|
||||
$menu->addTo('Botanic', 'Variétés', [ 'route' => 'Botanic.Admin.Varieties.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Varieties.index'])->order(4);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,6 @@ class Shop
|
||||
->activeIfRoute('shop')
|
||||
->order(1);
|
||||
|
||||
$menu->addTo('shop', 'Familles', [ 'route' => 'Shop.Admin.Families.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Families.index'])->order(1);
|
||||
$menu->addTo('shop', 'Genres', [ 'route' => 'Shop.Admin.Genres.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Genres.index'])->order(2);
|
||||
$menu->addTo('shop', 'Espèces', [ 'route' => 'Shop.Admin.Species.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Species.index'])->order(3);
|
||||
$menu->addTo('shop', 'Variétés', [ 'route' => 'Shop.Admin.Varieties.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Varieties.index'])->order(4);
|
||||
|
||||
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Sections.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Sections.index'])->order(5);
|
||||
$menu->addTo('shop', 'Produits', [ 'route' => 'Shop.Admin.Products.index', 'permission' => 'backend' ])
|
||||
@@ -32,7 +23,5 @@ class Shop
|
||||
$menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.index'])->order(8);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Family extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_families';
|
||||
protected $table = 'botanic_families';
|
||||
|
||||
public function genres()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Genre');
|
||||
return $this->hasMany('App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Genre extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_genres';
|
||||
protected $table = 'botanic_genres';
|
||||
|
||||
public function family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Family');
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
}
|
||||
|
||||
public function species()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Specie');
|
||||
return $this->hasMany('App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Specie extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_species';
|
||||
protected $table = 'botanic_species';
|
||||
|
||||
public function Genre()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Family');
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
}
|
||||
|
||||
public function Varieties()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Variety');
|
||||
return $this->hasMany('App\Models\Botanic\Variety');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Variety extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_varieties';
|
||||
protected $table = 'botanic_varieties';
|
||||
|
||||
public function Specie()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Specie');
|
||||
return $this->belongsTo('App\Models\Botanic\Specie');
|
||||
}
|
||||
}
|
||||
@@ -4,45 +4,34 @@ namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use Categorizable;
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_products';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Inventory');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ProductPrice');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function ProductAttributes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ProductAttribute');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Categories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\CategoryProduct');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function InvoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
|
||||
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class ProductSection extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_product_sections';
|
||||
|
||||
public function Product()
|
||||
{
|
||||
|
||||
@@ -4,12 +4,17 @@ namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Rinvex\Categories\Traits\Categorizable,
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
|
||||
class Section extends Model
|
||||
{
|
||||
use Categorizable;
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_sections';
|
||||
|
||||
public function Category()
|
||||
{
|
||||
return $this->hasMany('App\Models\Category');
|
||||
}
|
||||
|
||||
public function Products()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Family;
|
||||
use App\Models\Botanic\Family;
|
||||
|
||||
class Families
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Genre;
|
||||
use App\Models\Botanic\Genre;
|
||||
|
||||
class Genres
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
namespace App\Repositories\Botanic;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -8,7 +8,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Specie;
|
||||
use App\Models\Botanic\Specie;
|
||||
|
||||
class Species
|
||||
{
|
||||
@@ -8,25 +8,25 @@ use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Product;
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class Products
|
||||
class Articles
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Product::orderBy('name');
|
||||
$model = Article::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Product::orderBy('name','asc')->get();
|
||||
return Article::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Product::find($id);
|
||||
return Article::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
@@ -38,17 +38,17 @@ class Products
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Product::create($data);
|
||||
return Article::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Product::find($id)->update($data);
|
||||
return Article::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Product::destroy($id);
|
||||
return Article::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
56
app/Repositories/Shop/Categories.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Categorie;
|
||||
|
||||
class Categories
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Categorie::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Categorie::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Categorie::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
app('rinvex.categories.category')->create(['name' => $data['name']]);
|
||||
return Categorie::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
app('rinvex.categories.category')->update(['name' => $data['name']]);
|
||||
return Categorie::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Categorie::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
44
build/Admin/Auth/permissions.js
Normal file
@@ -0,0 +1,44 @@
|
||||
var elements = {
|
||||
handle: "permissions",
|
||||
model: "permission",
|
||||
route: "Stack.Admin.Permission",
|
||||
route_api: "Stack.Admin.API.Permission",
|
||||
table_selector: "#permissions_datatable",
|
||||
exist: "the_permission_already_exists",
|
||||
added: "permission_has_been_added",
|
||||
modified: "permission_has_been_modified",
|
||||
deleted: "permission_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
];
|
||||
|
||||
var columns = [
|
||||
{
|
||||
data: "display_name",
|
||||
render: function (data) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row ) {
|
||||
var name = eval('client_translate.getText.' + row.translated);
|
||||
return '<div class="text-center" data-id="' + data + '" data-name="' + name + '">'+
|
||||
'<button class="btn btn-border btn-yellow btn-xs edit-btn" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>'+
|
||||
'<button class="btn btn-border btn-danger btn-xs delete-btn" title="'+translate.getText.delete+'"><i class="glyph-icon icon-trash"></i></button>'+
|
||||
'<input type="hidden" class="id" value="'+data+'" />'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
];
|
||||
console.log(columnsdef);
|
||||
var permissions = handleAdmin;
|
||||
|
||||
$(document).ready(function() {
|
||||
permissions.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
} );
|
||||
} );
|
||||
|
||||
50
build/Admin/Auth/roles.js
Normal file
@@ -0,0 +1,50 @@
|
||||
var elements = {
|
||||
handle: "roles",
|
||||
model: "role",
|
||||
route: "Stack.Admin.Role",
|
||||
route_api: "Stack.Admin.API.Role",
|
||||
table_selector: "#roles_datatable",
|
||||
exist: "the_role_already_exists",
|
||||
added: "role_has_been_added",
|
||||
modified: "role_has_been_modified",
|
||||
deleted: "role_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
];
|
||||
|
||||
|
||||
var columns = [
|
||||
{
|
||||
"data": "translated",
|
||||
"render": function ( data, type, full, meta ) {
|
||||
if (data)
|
||||
{
|
||||
return admin_content.get_translated_names(data);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row, meta ) {
|
||||
var name = eval('client_translate.getText.' + row.translated);
|
||||
return '<div class="text-center" data-id="' + data + '" data-name="' + name + '">'+
|
||||
'<button class="btn btn-border btn-yellow border-yellow btn-xs update-btn margin-right-10" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>'+
|
||||
'<button class="btn btn-border btn-danger border-danger btn-xs delete-btn" title="'+translate.getText.delete+'"><i class="glyph-icon icon-trash"></i></button>'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var roles = handleAdmin;
|
||||
|
||||
$(document).ready(function() {
|
||||
roles.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
initIcheck();
|
||||
} );
|
||||
} );
|
||||
|
||||
51
build/Admin/Auth/teams.js
Normal file
@@ -0,0 +1,51 @@
|
||||
var elements = {
|
||||
handle: "teams",
|
||||
model: "team",
|
||||
route: "Stack.Admin.Team",
|
||||
route_api: "Stack.Admin.API.Team",
|
||||
table_selector: "#teams_datatable",
|
||||
exist: "the_team_already_exists",
|
||||
added: "team_has_been_added",
|
||||
modified: "team_has_been_modified",
|
||||
deleted: "team_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
];
|
||||
|
||||
var columns = [
|
||||
{
|
||||
data: "active",
|
||||
className: 'text-center',
|
||||
"render": function ( data, type, row, meta ) {
|
||||
var checked = data ? "checked" : "";
|
||||
tpl = '<div class="text-center"><input type="checkbox"' + checked + ' data-id="' + row.id + '" class="active-checkbox" data-toggle="toggle" data-size="mini" data-width="50" data-height="25" data-onstyle="success" data-offstyle="danger"></div>';
|
||||
return tpl;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "translated",
|
||||
render: function ( data, type, full, meta ) {
|
||||
return admin_content.get_translated_names(data);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row ) {
|
||||
var name = eval('client_translate.getText.' + row.translated);
|
||||
return '<div class="text-center" data-id="' + data + '" data-name="' + name + '">'+
|
||||
'<button class="btn btn-border btn-yellow border-yellow btn-xs update-btn margin-right-10" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>'+
|
||||
'<button class="btn btn-border btn-danger border-danger btn-xs delete-btn" title="'+translate.getText.delete+'"><i class="glyph-icon icon-trash"></i></button>'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var teams = handleAdmin;
|
||||
|
||||
$(document).ready(function() {
|
||||
teams.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
} );
|
||||
} );
|
||||
347
build/Admin/Auth/users.js
Normal file
@@ -0,0 +1,347 @@
|
||||
var elements = {
|
||||
handle: "users",
|
||||
model: "user",
|
||||
route: "Stack.Admin.User",
|
||||
route_api: "Stack.Admin.API.User",
|
||||
table_selector: "#users_datatable",
|
||||
exist: "the_user_type_already_exists",
|
||||
added: "user_has_been_added",
|
||||
modified: "user_has_been_modified",
|
||||
deleted: "user_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
{ orderable: false, targets: [0, 6] },
|
||||
{ responsivePriority: 1, targets: [0, 1, 6] }
|
||||
];
|
||||
|
||||
var columns = [
|
||||
{
|
||||
data: "active",
|
||||
searchable: false,
|
||||
className: 'text-center',
|
||||
render: function ( data, type, row, meta ) {
|
||||
var checked = data ? "checked" : "";
|
||||
tpl = '<div class="text-center"><input type="checkbox"' + checked + ' data-id="' + row.id + '" class="active-checkbox" data-size="mini" data-width="50" data-height="25" data-onstyle="success" data-offstyle="danger"></div>';
|
||||
return tpl;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "name",
|
||||
render: function ( data, type, row, meta ) {
|
||||
return '<button type="button" class="btn btn-round btn-border btn-info btn-xs avatar-user-btn" title="'+translate.getText.avatar+'"><i class="glyph-icon icon-elusive-camera"></i></button> ' + data;
|
||||
}
|
||||
},
|
||||
{ data: "username" },
|
||||
{ data: "email" },
|
||||
{ data: "phone" },
|
||||
{
|
||||
data: "roles",
|
||||
searchable: false,
|
||||
render: function ( data, type, row, meta ) {
|
||||
if (data) {
|
||||
tpl = '';
|
||||
for (var k in data){
|
||||
if (data.hasOwnProperty(k)) {
|
||||
tpl += data[k]['name'] + ' ';
|
||||
}
|
||||
}
|
||||
return tpl;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row ) {
|
||||
var name = row.name;
|
||||
tpl = '<div class="text-center" data-id="' + data + '" data-name="' + name + '">';
|
||||
tpl += '<button class="btn btn-border btn-gray btn-xs password-btn margin-right-10" title="'+translate.getText.change_password+'"><i class="glyph-icon fa fa-key"></i></button>';
|
||||
if (hasPermission('users_client')) {
|
||||
tpl += '<button class="btn btn-border btn-default border-default btn-xs manage-btn margin-right-10" title="'+translate.getText.manage+'"><i class="glyph-icon icon-file-text-o"></i></button>';
|
||||
}
|
||||
if (hasPermission('users_update')) {
|
||||
tpl += '<button class="btn btn-border btn-yellow btn-xs update-btn margin-right-10" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>';
|
||||
}
|
||||
if (hasPermission('users_delete')) {
|
||||
tpl += '<button class="btn btn-border btn-danger btn-xs delete-btn margin-right-10" title="'+translate.getText.delete+'"><i class="glyph-icon fa fa-trash"></i></button>';
|
||||
}
|
||||
tpl += '</div>';
|
||||
return tpl;
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var users = handleAdmin;
|
||||
|
||||
var users_addon = {
|
||||
avatar: null,
|
||||
upload_avatar: false,
|
||||
upload_input: null,
|
||||
passwordButtonsClick: function() {
|
||||
$('.password-btn').off('click').on('click', function() {
|
||||
var id = $(this).parent().data('id');
|
||||
var name = $(this).parent().data('name');
|
||||
users.passwordUser(id, name);
|
||||
});
|
||||
},
|
||||
avatarButtonsClick: function() {
|
||||
$('#users_datatable .avatar-user-btn').off('click').on('click', function() {
|
||||
var id = $(this).parent().data('id');
|
||||
var name = $(this).parent().data('name');
|
||||
users.avatarUser(id, name);
|
||||
});
|
||||
},
|
||||
generatePassword: function(elt) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.generateUserPassword"),
|
||||
success: function(response) {
|
||||
elt.val(response.pwd);
|
||||
},
|
||||
error: function() {
|
||||
admin_content.alertError();
|
||||
}
|
||||
});
|
||||
},
|
||||
initAvatarUploader: function() {
|
||||
users.upload_input = $("#avatar_file").filer({
|
||||
showThumbs: true,
|
||||
addMore: true,
|
||||
allowDuplicates: false,
|
||||
limit: 1,
|
||||
maxSize: 5,
|
||||
extensions: [ 'jpg' ],
|
||||
uploadFile: {
|
||||
url: laroute.route("Stack.Admin.API.User.uploadAvatar"),
|
||||
data: { "extension": 'jpg' },
|
||||
type: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
synchron: true,
|
||||
success: function(data, itemEl, listEl, boxEl, newInputEl, inputEl, id){
|
||||
var parent = itemEl.find(".jFiler-jProgressBar").parent(),
|
||||
new_file_name = JSON.parse(data),
|
||||
filerKit = inputEl.prop("jFiler");
|
||||
|
||||
filerKit.files_list[id].name = new_file_name;
|
||||
|
||||
itemEl.find(".jFiler-jProgressBar").fadeOut("slow", function(){
|
||||
$("<div class=\"jFiler-item-others text-success\"><i class=\"icon-jfi-check-circle\"></i> Success</div>").hide().appendTo(parent).fadeIn("slow");
|
||||
});
|
||||
|
||||
$("#avatar_file_hidden").val(new_file_name);
|
||||
},
|
||||
error: function(el){
|
||||
var parent = el.find(".jFiler-jProgressBar").parent();
|
||||
el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
|
||||
$("<div class=\"jFiler-item-others text-error\"><i class=\"icon-jfi-minus-circle\"></i> Error</div>").hide().appendTo(parent).fadeIn("slow");
|
||||
});
|
||||
},
|
||||
statusCode: null,
|
||||
onProgress: null,
|
||||
onComplete: null
|
||||
},
|
||||
files: null,
|
||||
clipBoardPaste: true,
|
||||
excludeName: null,
|
||||
beforeRender: null,
|
||||
afterRender: null,
|
||||
beforeShow: null,
|
||||
beforeSelect: null,
|
||||
onSelect: null,
|
||||
afterShow: null,
|
||||
onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){
|
||||
var filerKit = inputEl.prop("jFiler"),
|
||||
file_name = filerKit.files_list[id].name;
|
||||
|
||||
$.post(laroute.route('Stack.Admin.API.User.removeAvatar'), {file: file_name});
|
||||
},
|
||||
onEmpty: null,
|
||||
options: null,
|
||||
dialogs: {
|
||||
alert: function(text) {
|
||||
$.alert({
|
||||
title: translate.getText.informations,
|
||||
type: 'red',
|
||||
content: text,
|
||||
});
|
||||
},
|
||||
confirm: function (text, callback) {
|
||||
$.confirm({
|
||||
title: translate.getText.informations,
|
||||
type: 'red',
|
||||
content: text,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: translate.getText.confirm,
|
||||
btnClass: 'btn-danger',
|
||||
action: function(){
|
||||
callback()
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: translate.getText.cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
captions: {
|
||||
button: translate.getText.choose_file,
|
||||
feedback: "",
|
||||
feedback2: translate.getText.selected_files,
|
||||
removeConfirmation: translate.getText.are_you_sure_you_want_to_remove_this_file,
|
||||
errors: {
|
||||
filesLimit: translate.getText.file_number_authorized + ": {{fi-limit}}",
|
||||
filesType: translate.getText.file_extension_authorized + ": .{{fi-extensions}}",
|
||||
filesSize: translate.getText.file_max_size_authorized + ": {{fi-maxSize}} MB."
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
avatarUser: function(id, name) {
|
||||
$.confirm({
|
||||
title: translate.getText.avatar,
|
||||
columnClass: 'small',
|
||||
content: function () {
|
||||
var self = this;
|
||||
return $.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.getAvatar"),
|
||||
data: { 'id': id },
|
||||
}).done(function (response) {
|
||||
|
||||
if (response.error == -1) {
|
||||
header.logout();
|
||||
} else if (response.avatar == "") {
|
||||
self.setContent('<div><i class="glyph-icon fa fa-caret-right margin-left-15 margin-right-5"></i><i class="text-blue">'+name+'</i></div><hr class="margin-top-10 margin-bottom-10"><div class="text-center padding-top-10" id="avatar_upload"><input type="file" name="files[]" id="avatar_file" /><input type="hidden" id="avatar_file_hidden" name="avatar_file" value="NULL" class="form-control" /></div>');
|
||||
users.upload_avatar = true;
|
||||
} else {
|
||||
self.setContent('<div><i class="glyph-icon fa fa-caret-right margin-left-15 margin-right-5"></i><i class="text-blue">'+name+'</i></div><hr class="margin-top-10 margin-bottom-10"><div class="text-center padding-top-10" id="avatar_upload"><img src="'+response.avatar+'" /><br><button type="button" id="delete_avatar" class="btn btn-danger margin-top-10">'+translate.getText.delete+'</button></div>');
|
||||
users.upload_avatar = false;
|
||||
}
|
||||
|
||||
}).fail(function(){
|
||||
self.setContent(translate.getText.an_error_occured);
|
||||
});
|
||||
},
|
||||
typeAnimated: true,
|
||||
onContentReady: function() {
|
||||
$("#delete_avatar").off('click').on('click', function(){
|
||||
$("#avatar_upload").html('<input type="file" name="files[]" id="avatar_file" /><input type="hidden" id="avatar_file_hidden" name="avatar_file" class="form-control" />');
|
||||
users.upload_avatar = true;
|
||||
users.initAvatarUploader();
|
||||
});
|
||||
|
||||
if (users.upload_avatar) {
|
||||
users.initAvatarUploader();
|
||||
}
|
||||
},
|
||||
type: 'blue',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: translate.getText.validate,
|
||||
btnClass: 'btn-blue',
|
||||
action: function(){
|
||||
if($('#novation_select').val() == '') {
|
||||
admin_content.alertCustomError('please_select_third_party');
|
||||
} else {
|
||||
var datas = {};
|
||||
datas['ujcaid'] = id;
|
||||
datas["ujcafile"] = $('#avatar_file_hidden').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.updateAvatar"),
|
||||
data: datas,
|
||||
success: function(response) {
|
||||
if (response.error == -1) {
|
||||
header.logout();
|
||||
} else if(response.error == -6) {
|
||||
admin_content.alertNotFound();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
admin_content.alertError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: translate.getText.cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
passwordUser: function(id, name) {
|
||||
|
||||
$.confirm({
|
||||
title: translate.getText.change_password,
|
||||
columnClass: 'small',
|
||||
content: '<div class="margin-top-3"><i class="glyph-icon fa-caret-right margin-left-10 margin-right-5"></i><i class="">'+name+'</i><div><div class="input-group"><input type="text" name="password" id="update_password" maxlength="32" class="form-control"><span class="input-group-addon pointer" id="user_password_regenerate"><i class="glyph-icon fa fa-lock"></i></span></div></div></div>',
|
||||
typeAnimated: true,
|
||||
type: 'dark',
|
||||
animation: 'RotateXR',
|
||||
onContentReady: function() {
|
||||
$("#user_password_regenerate").off('click').on('click', function(){
|
||||
event.preventDefault();
|
||||
users.generatePassword($("#update_password"));
|
||||
});
|
||||
},
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: translate.getText.confirm,
|
||||
btnClass: 'btn-dark',
|
||||
action: function() {
|
||||
if ($("#update_password").val() == "") {
|
||||
return false;
|
||||
} else {
|
||||
var datas = {};
|
||||
datas['id'] = id;
|
||||
datas['password'] = $("#update_password").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.updatePassword"),
|
||||
data: datas,
|
||||
success: function(response) {
|
||||
if (response.error == -1) {
|
||||
header.logout();
|
||||
} else if(response.error == -6) {
|
||||
admin_content.alertNotFound();
|
||||
} else if(response.error == -7) {
|
||||
admin_content.alertCustomError('the_password_must_have_at_least_six_characters');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
admin_content.alertError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: translate.getText.cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
users = {...users, ...users_addon };
|
||||
|
||||
$(document).ready(function() {
|
||||
users.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
initIcheck();
|
||||
users.passwordButtonsClick();
|
||||
users.avatarButtonsClick();
|
||||
} );
|
||||
} );
|
||||
105
build/Shop/admin/customer.js
Normal file
@@ -0,0 +1,105 @@
|
||||
var columns = [
|
||||
{
|
||||
data: "type_contact_statut_id",
|
||||
render: function (data, type, row) {
|
||||
if (row.type_contact_statut_id) {
|
||||
tpl = row.type_contact_statut.nom;
|
||||
} else {
|
||||
tpl = '';
|
||||
}
|
||||
return tpl;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "name",
|
||||
},
|
||||
{
|
||||
data: "firstname",
|
||||
},
|
||||
{
|
||||
data: "mobile",
|
||||
render: function (data, type, row) {
|
||||
tpl = '';
|
||||
if (row.mobile) {
|
||||
tpl += 'Mobile : ' + row.mobile + '<br/>';
|
||||
}
|
||||
if (row.tel_perso) {
|
||||
tpl += 'Domicile : ' + row.phone + '<br/>';
|
||||
}
|
||||
if (row.tel_pro) {
|
||||
tpl += 'Pro : ' + row.phone_pro;
|
||||
}
|
||||
return tpl;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "email",
|
||||
render: function (data) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "zipcode",
|
||||
render: function (data, type, row) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "city",
|
||||
render: function (data) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
orderable: false,
|
||||
render: function (data, type, row) {
|
||||
tpl = " <a data-id=" + data + " class='btn btn-xs btn-primary' href='" + laroute.route('Shop.Customers.Admin.edit', { id : data }) + "'><i class='fa fa-edit fa-fw'></i></a>";
|
||||
tpl += " <a data-id=" + data + " class='btn btn-xs btn-danger btn-delete' href='#''><i class='fa fa-times fa-fw'></i></a>";
|
||||
return tpl;
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
var model = "contact";
|
||||
var route = "Contacts";
|
||||
|
||||
var options = {
|
||||
// order: [[ 2, 'asc' ]],
|
||||
fixedColumns: { leftColumns: 1, rightColumns: 1 },
|
||||
// fixedColumns: false,
|
||||
// columnDefs: columnDefs,
|
||||
columns: columns,
|
||||
}
|
||||
|
||||
var globals = [];
|
||||
globals['handlers'] = [];
|
||||
|
||||
|
||||
function populate() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var Table = getDataTables(options,route,model);
|
||||
|
||||
$(".search-input-text").off().on("change keyup", function(e) {
|
||||
Table.column( $(this).parent().index()+':visible' ).search( this.value ).draw();
|
||||
})
|
||||
|
||||
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
|
||||
tpl = '<a href="'+laroute.route('CRM.Contacts.create')+'" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> Création d\'un contact</a>';
|
||||
$('div.col-md-4.add').html(tpl);
|
||||
|
||||
|
||||
initModalAdmin(route,model,Table.ajax.reload,populate,Table);
|
||||
|
||||
});
|
||||
187
build/css/shadow.css
Normal file
@@ -0,0 +1,187 @@
|
||||
|
||||
.drop-shadow {
|
||||
position:relative;
|
||||
float:left;
|
||||
width:100%;
|
||||
background:#fff;
|
||||
-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
|
||||
.drop-shadow:before,
|
||||
.drop-shadow:after {
|
||||
content:"";
|
||||
position:absolute;
|
||||
z-index:-2;
|
||||
}
|
||||
|
||||
/* Lifted corners */
|
||||
|
||||
.lifted {
|
||||
-moz-border-radius:4px;
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
.lifted:before,
|
||||
.lifted:after {
|
||||
bottom:15px;
|
||||
left:10px;
|
||||
width:50%;
|
||||
height:20%;
|
||||
max-width:300px;
|
||||
max-height:100px;
|
||||
-webkit-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
|
||||
-moz-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
|
||||
box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
|
||||
-webkit-transform:rotate(-3deg);
|
||||
-moz-transform:rotate(-3deg);
|
||||
-ms-transform:rotate(-3deg);
|
||||
-o-transform:rotate(-3deg);
|
||||
transform:rotate(-3deg);
|
||||
}
|
||||
|
||||
.lifted:after {
|
||||
right:10px;
|
||||
left:auto;
|
||||
-webkit-transform:rotate(3deg);
|
||||
-moz-transform:rotate(3deg);
|
||||
-ms-transform:rotate(3deg);
|
||||
-o-transform:rotate(3deg);
|
||||
transform:rotate(3deg);
|
||||
}
|
||||
|
||||
/* Curled corners */
|
||||
|
||||
.curled {
|
||||
border:1px solid #efefef;
|
||||
-moz-border-radius:0 0 120px 120px / 0 0 6px 6px;
|
||||
border-radius:0 0 120px 120px / 0 0 6px 6px;
|
||||
}
|
||||
|
||||
.curled:before,
|
||||
.curled:after {
|
||||
bottom:12px;
|
||||
left:10px;
|
||||
width:50%;
|
||||
height:55%;
|
||||
max-width:200px;
|
||||
max-height:100px;
|
||||
-webkit-box-shadow:0 8px 12px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow:0 8px 12px rgba(0, 0, 0, 0.5);
|
||||
box-shadow:0 8px 12px rgba(0, 0, 0, 0.5);
|
||||
-webkit-transform:skew(-8deg) rotate(-3deg);
|
||||
-moz-transform:skew(-8deg) rotate(-3deg);
|
||||
-ms-transform:skew(-8deg) rotate(-3deg);
|
||||
-o-transform:skew(-8deg) rotate(-3deg);
|
||||
transform:skew(-8deg) rotate(-3deg);
|
||||
}
|
||||
|
||||
.curled:after {
|
||||
right:10px;
|
||||
left:auto;
|
||||
-webkit-transform:skew(8deg) rotate(3deg);
|
||||
-moz-transform:skew(8deg) rotate(3deg);
|
||||
-ms-transform:skew(8deg) rotate(3deg);
|
||||
-o-transform:skew(8deg) rotate(3deg);
|
||||
transform:skew(8deg) rotate(3deg);
|
||||
}
|
||||
|
||||
/* Perspective */
|
||||
|
||||
.perspective:before {
|
||||
left:80px;
|
||||
bottom:5px;
|
||||
width:50%;
|
||||
height:35%;
|
||||
max-width:200px;
|
||||
max-height:50px;
|
||||
-webkit-box-shadow:-80px 0 8px rgba(0, 0, 0, 0.4);
|
||||
-moz-box-shadow:-80px 0 8px rgba(0, 0, 0, 0.4);
|
||||
box-shadow:-80px 0 8px rgba(0, 0, 0, 0.4);
|
||||
-webkit-transform:skew(50deg);
|
||||
-moz-transform:skew(50deg);
|
||||
-ms-transform:skew(50deg);
|
||||
-o-transform:skew(50deg);
|
||||
transform:skew(50deg);
|
||||
-webkit-transform-origin:0 100%;
|
||||
-moz-transform-origin:0 100%;
|
||||
-ms-transform-origin:0 100%;
|
||||
-o-transform-origin:0 100%;
|
||||
transform-origin:0 100%;
|
||||
}
|
||||
|
||||
.perspective:after {
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* Raised shadow - no pseudo-elements needed */
|
||||
|
||||
.raised {
|
||||
-webkit-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
-moz-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
|
||||
/* Curved shadows */
|
||||
|
||||
.curved:before {
|
||||
top:10px;
|
||||
bottom:10px;
|
||||
left:0;
|
||||
right:50%;
|
||||
-webkit-box-shadow:0 0 15px rgba(0,0,0,0.6);
|
||||
-moz-box-shadow:0 0 15px rgba(0,0,0,0.6);
|
||||
box-shadow:0 0 15px rgba(0,0,0,0.6);
|
||||
-moz-border-radius:10px / 100px;
|
||||
border-radius:10px / 100px;
|
||||
}
|
||||
|
||||
.curved-vt-2:before {
|
||||
right:0;
|
||||
}
|
||||
|
||||
.curved-hz-1:before {
|
||||
top:50%;
|
||||
bottom:0;
|
||||
left:10px;
|
||||
right:10px;
|
||||
-moz-border-radius:100px / 10px;
|
||||
border-radius:100px / 10px;
|
||||
}
|
||||
|
||||
.curved-hz-2:before {
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:10px;
|
||||
right:10px;
|
||||
-moz-border-radius:100px / 10px;
|
||||
border-radius:100px / 10px;
|
||||
}
|
||||
|
||||
/* Rotated box */
|
||||
|
||||
.rotated {
|
||||
-webkit-box-shadow:none;
|
||||
-moz-box-shadow:none;
|
||||
box-shadow:none;
|
||||
-webkit-transform:rotate(-3deg);
|
||||
-moz-transform:rotate(-3deg);
|
||||
-ms-transform:rotate(-3deg);
|
||||
-o-transform:rotate(-3deg);
|
||||
transform:rotate(-3deg);
|
||||
}
|
||||
|
||||
.rotated > :first-child:before {
|
||||
content:"";
|
||||
position:absolute;
|
||||
z-index:-1;
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:0;
|
||||
right:0;
|
||||
background:#fff;
|
||||
-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
19
build/css/theme.css
Normal file
BIN
build/img/logo.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
build/img/payments/americanexpress.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
build/img/payments/discover.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
build/img/payments/jcb.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
build/img/payments/mastercard.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
build/img/payments/paypal.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
build/img/payments/visa.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
15
build/js/include/animate.js
Normal file
@@ -0,0 +1,15 @@
|
||||
function initAnimate()
|
||||
{
|
||||
/*
|
||||
var wew = new Wew({
|
||||
target: '.wow',
|
||||
keyword: 'wow',
|
||||
});
|
||||
|
||||
wew.init();
|
||||
*/
|
||||
wow = new WOW({animateClass: 'animated', live: true});
|
||||
wow.init();
|
||||
|
||||
}
|
||||
|
||||
77
build/js/include/app.js
Normal file
@@ -0,0 +1,77 @@
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
(function($) {
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
// Toggle the side navigation
|
||||
$("#sidebarToggle, #sidebarToggleTop").on('click', function(e) {
|
||||
$("body").toggleClass("sidebar-toggled");
|
||||
$(".sidebar").toggleClass("toggled");
|
||||
if ($(".sidebar").hasClass("toggled")) {
|
||||
$('.sidebar .collapse').collapse('hide');
|
||||
};
|
||||
});
|
||||
|
||||
// Close any open menu accordions when window is resized below 768px
|
||||
$(window).resize(function() {
|
||||
if ($(window).width() < 768) {
|
||||
$('.sidebar .collapse').collapse('hide');
|
||||
};
|
||||
});
|
||||
|
||||
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
|
||||
$('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) {
|
||||
if ($(window).width() > 768) {
|
||||
var e0 = e.originalEvent,
|
||||
delta = e0.wheelDelta || -e0.detail;
|
||||
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Scroll to top button appear
|
||||
$(document).on('scroll', function() {
|
||||
var scrollDistance = $(this).scrollTop();
|
||||
if (scrollDistance > 100) {
|
||||
$('.scroll-to-top').fadeIn();
|
||||
} else {
|
||||
$('.scroll-to-top').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// Smooth scrolling using jQuery easing
|
||||
$(document).on('click', 'a.scroll-to-top', function(e) {
|
||||
var $anchor = $(this);
|
||||
$('html, body').stop().animate({
|
||||
scrollTop: ($($anchor.attr('href')).offset().top)
|
||||
}, 1000, 'easeInOutExpo');
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('#changePassword-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
url: '/changePassword',
|
||||
data: $('#password-form-data').serialize(),
|
||||
method : 'POST',
|
||||
success: function(resp){
|
||||
if (resp.success) {
|
||||
$('#changePasswordMessage').html(resp.message);
|
||||
// await sleep(1000);
|
||||
$('#changepasswordModal').modal('hide');
|
||||
$('#password-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
} else {
|
||||
$('#changePasswordMessage').html(resp.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
numeral.locale('fr');
|
||||
|
||||
})(jQuery); // End of use strict
|
||||
75
build/js/include/appender.js
Normal file
@@ -0,0 +1,75 @@
|
||||
(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);
|
||||
|
||||
if (settings.type) {
|
||||
type = settings.type;
|
||||
} else {
|
||||
type = settings.rowSection;
|
||||
}
|
||||
|
||||
$(type).each(function(rowIndex) {
|
||||
$(this).find('input[name]').each(function(){
|
||||
var name;
|
||||
name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('select[name]').each(function(){
|
||||
var name;
|
||||
name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('textarea[name]').each(function(){
|
||||
var name;
|
||||
name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
});
|
||||
|
||||
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));
|
||||
5
build/js/include/cache.js
Normal file
@@ -0,0 +1,5 @@
|
||||
function loadCache(file, callback) {
|
||||
file += '?v=' + cache_versions[file];
|
||||
loadScript(file, callback);
|
||||
}
|
||||
|
||||
27
build/js/include/check_fields.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function checkCollapsedFields(selector)
|
||||
{
|
||||
var selector = selector + ' input,textarea,select';
|
||||
var nb_fields = $(selector).length();
|
||||
var nb_required = $(selector).filter('[required]').length();
|
||||
var nb_filled = 0;
|
||||
var nb_necessary = 0;
|
||||
|
||||
$(selector).each(function(i, Field){
|
||||
if ($(Field).val() != '')
|
||||
{
|
||||
nb_filled++;
|
||||
}
|
||||
});
|
||||
|
||||
$(selector).filter('[required]').each(function(i, required){
|
||||
if ($(required).val() != '')
|
||||
{
|
||||
nb_necessary++;
|
||||
}
|
||||
});
|
||||
|
||||
result = nb_filled + " / " + nb_fields;
|
||||
result + " | " + nb_necessary + " / " + nb_required;
|
||||
|
||||
$(selector + ' .check').html(result);
|
||||
}
|
||||
14
build/js/include/chosen.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function initChosen()
|
||||
{
|
||||
$(".chosen-select").chosen({ no_results_text: translate.getText.no_result });
|
||||
$(".chosen-search").append('<i class="glyph-icon icon-search"></i>');
|
||||
$(".chosen-single div").html('<i class="glyph-icon icon-caret-down"></i>');
|
||||
$(".chosen-container-single").addClass('styled');
|
||||
}
|
||||
|
||||
function resetChosen()
|
||||
{
|
||||
$('.chosen-select').each(function() {
|
||||
$(this).val("").trigger("chosen:updated");
|
||||
});
|
||||
}
|
||||
75
build/js/include/confirm.js
Normal file
@@ -0,0 +1,75 @@
|
||||
var confirm_delete_options = {
|
||||
title: "Etes-vous sur ?",
|
||||
text: "Cet enregistrement sera effacé.",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
confirmButtonText: "Oui !",
|
||||
cancelButtonText: "Annuler"
|
||||
};
|
||||
|
||||
function confirm_delete(id, route,callback) {
|
||||
console.log(route);
|
||||
Swal.fire(confirm_delete_options).then(function(result) {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url : route,
|
||||
method : 'DELETE',
|
||||
data: {id:id},
|
||||
success : function(resp){
|
||||
if (resp.success) {
|
||||
console.log(resp);
|
||||
callback();
|
||||
Swal.fire("Supprimé !", "L'enregistrement a été supprimé.", "success");
|
||||
} else {
|
||||
Swal.fire("Erreur!", "L'enregistrement n'a pu être supprimé pour les raisons suivantes : "+resp.message, "danger");
|
||||
if(resp.code == 401){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function confirm(route,options,callback) {
|
||||
var confirm_options = {
|
||||
title: options.title,
|
||||
text: options.text,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
confirmButtonText: "Oui !",
|
||||
cancelButtonText: "Annuler",
|
||||
success: options.success ? options.success : "L'enregistrement a été supprimé.",
|
||||
notsuccess: options.notsuccess ? options.notsuccess : "L'enregistrement n'a pu être supprimé pour les raisons suivantes : "
|
||||
};
|
||||
|
||||
console.log(route);
|
||||
Swal.fire(confirm_options).then(function(result) {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url : route,
|
||||
method : 'GET',
|
||||
success : function(resp){
|
||||
if (resp.success) {
|
||||
console.log(resp);
|
||||
callback();
|
||||
Swal.fire("Supprimé !", confirm_options.success, "success");
|
||||
} else {
|
||||
Swal.fire("Erreur!", confirm_options.notsuccess + resp.message, "danger");
|
||||
if(resp.code == 401){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
147
build/js/include/datatable.js
Normal file
@@ -0,0 +1,147 @@
|
||||
function getDatatablesSelector(module) {
|
||||
return '#' + module + '-table';
|
||||
}
|
||||
|
||||
function getDataTables(options,route,module, nobuttons) {
|
||||
|
||||
var params = {
|
||||
ajax: {
|
||||
url: route,
|
||||
data: function ( d ) {
|
||||
d.where = $('#where').val();
|
||||
}
|
||||
},
|
||||
buttons: (!nobuttons) ? getDatatablesButtons() : [],
|
||||
responsive: false,
|
||||
keys: false,
|
||||
autoWidth: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
lengthChange: true,
|
||||
lengthMenu: [
|
||||
[ 10, 25, 50, 100, -1],
|
||||
[ '10 lignes', '25 lignes', '50 lignes', '100 lignes', 'Tous']
|
||||
],
|
||||
deferRender: true,
|
||||
stateSave: false,
|
||||
sDom: options['dom'] ? options['dom'] : getDatatablesDomDefault(),
|
||||
fixedHeader: false,
|
||||
fixedColumns: options['fixedColumns'],
|
||||
colReorder: false,
|
||||
scrollX: true,
|
||||
scrollY: "70vh",
|
||||
scrollCollapse: true,
|
||||
searchDelay: 300,
|
||||
select: false,
|
||||
columns: options['columns'],
|
||||
language: datatables_lang,
|
||||
rowId: 'id',
|
||||
};
|
||||
|
||||
/* // DOM Position key index //
|
||||
|
||||
l - Length changing (dropdown)
|
||||
f - Filtering input (search)
|
||||
t - The Table! (datatable)
|
||||
i - Information (records)
|
||||
p - Pagination (paging)
|
||||
r - pRocessing
|
||||
< and > - div elements
|
||||
<"#id" and > - div with an id
|
||||
<"class" and > - div with a class
|
||||
<"#id.class" and > - div with an id and class
|
||||
|
||||
Also see: http://legacy.datatables.net/usage/features
|
||||
*/
|
||||
|
||||
if (options['order']) {
|
||||
params.order = options['order'];
|
||||
}
|
||||
|
||||
// console.log(params);
|
||||
|
||||
var Table = $('#'+module+'-table').DataTable(params);
|
||||
|
||||
handleDataTablesFilter(Table,module);
|
||||
|
||||
// Table.buttons().container().appendTo( $('.col-sm-6:eq(0)'));
|
||||
|
||||
return Table;
|
||||
}
|
||||
|
||||
function handleDataTablesFilter(Table) {
|
||||
$(Table.table().container()).on('change keyup', 'thead input', function() {
|
||||
Table.column( $(this).parent().index()+':visible' ).search( this.value ).draw();
|
||||
});
|
||||
|
||||
$(Table.table().container()).on('change', 'thead select', function() {
|
||||
Table.column( $(this).parent().index()+':visible' ).search( this.value ).draw();
|
||||
});
|
||||
|
||||
$('[data-toggle="popover"]').popover({html: true});
|
||||
};
|
||||
|
||||
function getDatatablesButtons() {
|
||||
return ['pageLength',
|
||||
{
|
||||
extend: 'copyHtml5',
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
},
|
||||
text: '<i class="fa fa-files-o fa-lg"></i>',
|
||||
titleAttr: 'Copier',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
},
|
||||
text: '<i class="fa fa-file-excel-o fa-lg"></i>',
|
||||
titleAttr: 'Excel',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'A4',
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
},
|
||||
text: '<i class="fa fa-file-pdf-o fa-lg"></i>',
|
||||
titleAttr: 'PDF',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
text: '<i class="fa fa-print fa-lg"></i>',
|
||||
titleAttr: 'Imprimer',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'colvis',
|
||||
text: '<i class="fa fa-columns fa-lg"></i>',
|
||||
titleAttr: 'Colonnes',
|
||||
columns: ':not(.fixed)'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
function getDatatablesDomDefault(nobuttons) {
|
||||
dom = (!nobuttons) ? getDatatablesHeaderDefault() : '';
|
||||
dom += "t";
|
||||
dom += getDatatablesFooterDefault();
|
||||
return dom;
|
||||
}
|
||||
|
||||
function getDatatablesHeaderDefault() {
|
||||
return "<' row dt-toolbar-header'<'col-md-4 tool'B><'col-md-4'<'toolbar'>><'col-md-4 text-right add'>r>";
|
||||
}
|
||||
|
||||
function getDatatablesFooterDefault() {
|
||||
return "<'row dt-toolbar-footer'<'col-md-6'i><'col-md-6'p>>";
|
||||
}
|
||||
|
||||
function getDatatableLang() {
|
||||
return "/assets/plugins/datatables_lang/" + getLang() + '.json';
|
||||
}
|
||||
67
build/js/include/datetime.js
Normal file
@@ -0,0 +1,67 @@
|
||||
function initDatepicker() {
|
||||
var lang = getLang();
|
||||
loadScript('assets/plugins/datepicker/bootstrap-datepicker.' + lang + '.min.js', function() {
|
||||
$(".datepicker").datepicker({
|
||||
language: lang
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initDaterangePicker() {
|
||||
var lang = getLang();
|
||||
loadScript('assets/plugins/daterangepicker/' + lang + '.js');
|
||||
}
|
||||
|
||||
function initMomentLang() {
|
||||
var lang = getLang();
|
||||
loadScript('assets/plugins/moment/' + lang + '.js');
|
||||
}
|
||||
|
||||
function getDaterangePicker(selector, startDate, parentEl, endDate) {
|
||||
// console.log('getDaterangePicker');
|
||||
if (typeof(parentEL) == 'undefined') {
|
||||
parentEl = 'file_effect_date_selection';
|
||||
}
|
||||
if (typeof(startDate) == 'undefined') {
|
||||
startDate = moment().format(dateRangePickerLanguage.format);
|
||||
}
|
||||
// console.log("selector : ", selector);
|
||||
// console.log("StartDate : ", startDate);
|
||||
var options = {
|
||||
autoUpdateInput: false,
|
||||
autoApply: true,
|
||||
singleDatePicker: true,
|
||||
format: dateRangePickerLanguage.format,
|
||||
opens: 'left',
|
||||
showDropdowns: true,
|
||||
showWeekNumbers: true,
|
||||
alwaysShowCalendars: true,
|
||||
startDate: startDate,
|
||||
separator: dateRangePickerLanguage.separator,
|
||||
locale: dateRangePickerLanguage.locale,
|
||||
buttonClasses: 'btn btn-light uppercase weight-900',
|
||||
parentEl: '.' +parentEl
|
||||
};
|
||||
|
||||
if (typeof(endDate) != 'undefined') {
|
||||
options.endDate = endDate;
|
||||
options.ranges = dateRangePickerLanguage.ranges;
|
||||
};
|
||||
|
||||
$('#files_selection').parent().parent().parent().parent().parent().parent().parent().parent().parent().removeClass(parentEl).addClass(parentEl);
|
||||
var picker = $(selector).daterangepicker(options, function(start, end, label) {
|
||||
//console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
|
||||
});
|
||||
|
||||
$(selector + ' .daterangepicker').removeClass('light').addClass('light');
|
||||
|
||||
$(selector).next('span.add-on').off('click').on('click', function() {
|
||||
$(selector).trigger('click');
|
||||
});
|
||||
|
||||
$(selector).on('apply.daterangepicker', function(ev, picker) {
|
||||
$(this).val(picker.startDate.format(dateRangePickerLanguage.format));
|
||||
});
|
||||
|
||||
return picker;
|
||||
}
|
||||
27
build/js/include/geo_autocomplete.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function initializeAutocomplete(id) {
|
||||
var element = document.getElementById(id);
|
||||
if (element) {
|
||||
var autocomplete = new google.maps.places.Autocomplete(element, { types: ['geocode'] });
|
||||
google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged);
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaceChanged() {
|
||||
var place = this.getPlace();
|
||||
|
||||
// console.log(place); // Uncomment this line to view the full object returned by Google API.
|
||||
|
||||
for (var i in place.address_components) {
|
||||
var component = place.address_components[i];
|
||||
for (var j in component.types) { // Some types are ["country", "political"]
|
||||
var type_element = document.getElementById(component.types[j]);
|
||||
if (type_element) {
|
||||
type_element.value = component.long_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
google.maps.event.addDomListener(window, 'load', function() {
|
||||
initializeAutocomplete('adresse');
|
||||
});
|
||||
67
build/js/include/handlebars.js
Normal file
@@ -0,0 +1,67 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
167
build/js/include/modal.js
Normal file
@@ -0,0 +1,167 @@
|
||||
var modal_confirm_delete_options = {
|
||||
title: "Etes-vous sur ?",
|
||||
text: "Cet enregistrement sera effacé.",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
confirmButtonText: "Oui !",
|
||||
cancelButtonText: "Annuler"
|
||||
};
|
||||
|
||||
|
||||
function modal_confirm_delete(id,module,route,callback) {
|
||||
// console.log(id);
|
||||
var $loader = $('#loader');
|
||||
Swal.fire(modal_confirm_delete_options).then(function(result) {
|
||||
if (result.value) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
// console.log('/' + route +'/'+ id);
|
||||
$.ajax({
|
||||
url : '/' + route +'/'+ id,
|
||||
method : 'DELETE',
|
||||
success : function(resp){
|
||||
if (resp.success) {
|
||||
Swal.fire("Supprimé !", "L'enregistrement a été supprimé.", "success");
|
||||
$('#'+module+'-modal').modal('hide');
|
||||
callback();
|
||||
} else {
|
||||
Swal.fire("Erreur!", "L'enregistrement n'a pu être supprimé pour les raisons suivantes : "+resp.message, "danger");
|
||||
if(resp.code == 401){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
$loader.hide();
|
||||
}
|
||||
});
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function modal_save(id,route,module,callback,$button) {
|
||||
var $loader = $('#loader');
|
||||
var $data = $('#'+module+'-form-data').serialize();
|
||||
var $method = $button.attr('data-method');
|
||||
var $url = ($method == 'POST') ? '/' + route : '/' + route +'/'+ id;
|
||||
|
||||
$button.prop('disabled', true);
|
||||
$button.html('en cours...');
|
||||
$loader.show();
|
||||
|
||||
$.ajax({
|
||||
url: $url,
|
||||
data: $data,
|
||||
method : $method,
|
||||
success: function(resp){
|
||||
|
||||
$button.prop('disabled', false);
|
||||
$button.html('Enregistrer');
|
||||
$loader.hide();
|
||||
|
||||
if (resp.success) {
|
||||
$('#'+module+'-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
$('#btn-'+module+'-delete').hide();
|
||||
$('#'+module+'-modal').modal('hide');
|
||||
callback();
|
||||
} else {
|
||||
swal(resp.message);
|
||||
if (resp.code == 401) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function modal_add(module, callback) {
|
||||
/*
|
||||
$('#'+module+'-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
*/
|
||||
$('#btn-'+module+'-save').attr('data-method', 'POST');
|
||||
$('#btn-'+module+'-delete').hide();
|
||||
$('#'+module+'-modal').modal('show');
|
||||
callback();
|
||||
}
|
||||
|
||||
function modal_edit(id,route,module,callback) {
|
||||
var $loader = $('#loader');
|
||||
$loader.show();
|
||||
$('#btn-'+module+'-delete').show();
|
||||
|
||||
$.get('/'+route+'/'+id, function(resp){
|
||||
if (resp.success) {
|
||||
/*
|
||||
$('#'+module+'-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
*/
|
||||
callback(resp.data);
|
||||
|
||||
$('#btn-'+module+'-save').attr('data-method', 'PUT');
|
||||
$('#btn-'+module+'-delete').show();
|
||||
$('#'+module+'-modal').modal('show');
|
||||
} else {
|
||||
if (resp.code == 401) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
$loader.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function initModalAdmin(route,module,callback,populate,Table) {
|
||||
|
||||
var selector = getDatatablesSelector(model);
|
||||
/*
|
||||
$( selector + ' tbody').on( 'click', 'tr', function (e) {
|
||||
e.preventDefault();
|
||||
// $(this).toggleClass('selected');
|
||||
id = Table.row(this).id();
|
||||
modal_edit(id,route,module,populate);
|
||||
} );
|
||||
*/
|
||||
/*
|
||||
$('#btn-'+module+'-add').click(function(e){
|
||||
e.preventDefault();
|
||||
modal_add(module, populate);
|
||||
});
|
||||
*/
|
||||
/*
|
||||
$('#'+module+'-table').on('click', '.btn-'+module+'-edit', function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('data-id');
|
||||
modal_edit(id,route,module,populate);
|
||||
});
|
||||
*/
|
||||
/*
|
||||
$('#'+module+'-table').on('click', '.btn-'+module+'-delete', function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('data-id');
|
||||
modal_confirm_delete(id,route,callback);
|
||||
});
|
||||
*/
|
||||
|
||||
$('#btn-'+module+'-delete').click(function(e){
|
||||
e.preventDefault();
|
||||
var id = $('#id').val();
|
||||
modal_confirm_delete(id,module,route,callback);
|
||||
});
|
||||
|
||||
/*
|
||||
$('#btn-'+module+'-save').click(function(e){
|
||||
e.preventDefault();
|
||||
var id = $('#id').val();
|
||||
modal_save(id,route,module,callback,$(this));
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Google Place Autocomplete
|
||||
|
||||
This sample code show you how to quickly use the Places Autocomplete javascript
|
||||
API from Google.
|
||||
|
||||
[See demo right now](http://lewagon.github.io/google-place-autocomplete)
|
||||
|
||||
## Code
|
||||
|
||||
Look at the [index.html](index.html) file, you'll see a very standard form.
|
||||
The input with id `user_input_autocomplete_address` is very important as it
|
||||
is bound to an `autocomplete` object in the `autocomplete.js` code.
|
||||
|
||||
The code you see is not dependent on jQuery, also the `initializeAutocomplete`
|
||||
method has to be called when `google` is ready, not just when the DOM is ready.
|
||||
|
||||
## API Key
|
||||
|
||||
In order to get a lot of requests for free to the API, you need to create a
|
||||
new project under the [Google API Console](https://code.google.com/apis/console).
|
||||
For this project, enable the Google Maps Javascript API v3:
|
||||
|
||||

|
||||
|
||||
Then, for this project, create a new "Browser Key", the one you'll put in the
|
||||
`index.html` file when calling the `https://maps.googleapis.com/maps/api/js` script.
|
||||
|
||||

|
||||
|
||||
Make sure to specify referers so that **only you** can use this key! Remember,
|
||||
you API calls are limited per day.
|
||||
|
||||

|
||||
|
||||
## Documentation
|
||||
|
||||
[Full Reference](https://developers.google.com/maps/documentation/javascript/places-autocomplete)
|
||||
@@ -0,0 +1,27 @@
|
||||
function initializeAutocomplete(id) {
|
||||
var element = document.getElementById(id);
|
||||
if (element) {
|
||||
var autocomplete = new google.maps.places.Autocomplete(element, { types: ['geocode'] });
|
||||
google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged);
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaceChanged() {
|
||||
var place = this.getPlace();
|
||||
|
||||
// console.log(place); // Uncomment this line to view the full object returned by Google API.
|
||||
|
||||
for (var i in place.address_components) {
|
||||
var component = place.address_components[i];
|
||||
for (var j in component.types) { // Some types are ["country", "political"]
|
||||
var type_element = document.getElementById(component.types[j]);
|
||||
if (type_element) {
|
||||
type_element.value = component.long_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
google.maps.event.addDomListener(window, 'load', function() {
|
||||
initializeAutocomplete('user_input_autocomplete_address');
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Google Place Autocomplete</title>
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-sm-offset-2">
|
||||
<h1>Google Place Autocomplete exemple</h1>
|
||||
|
||||
<a href="https://github.com/lewagon/google-place-autocomplete">Source</a>
|
||||
<hr>
|
||||
|
||||
<form role="form" class="form-horizontal">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Address</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="user_input_autocomplete_address" name="user_input_autocomplete_address"
|
||||
class="form-control" placeholder="Start typing your address...">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="disabled">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>street_number</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="street_number" name="street_number" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>route</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="route" name="route" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>locality</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="locality" name="locality" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>administrative_area_level_1</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="administrative_area_level_1" name="administrative_area_level_1" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>postal_code</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="postal_code" name="postal_code" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>country</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="country" name="country" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Include Google Maps JS API -->
|
||||
<script type="text/javascript"
|
||||
src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyDANjx3bosEtIyzJaoWs50Wnt6nt_1rmxU "></script>
|
||||
|
||||
<!-- Custom JS code to bind to Autocomplete API -->
|
||||
<script type="text/javascript" src="autocomplete.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 61 KiB |
20
build/js/include/rights.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function hasRole(str) {
|
||||
return checkRole('admin') ? true : checkRole(str);
|
||||
}
|
||||
|
||||
function checkRole(str) {
|
||||
return (global.roles.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
|
||||
function isAdmin() {
|
||||
return hasRole('admin');
|
||||
}
|
||||
|
||||
function hasPermission(str) {
|
||||
if (isAdmin()) {
|
||||
return true;
|
||||
} else {
|
||||
return (global.permissions.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
18
build/js/include/set_options.js
Normal file
@@ -0,0 +1,18 @@
|
||||
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('Tous'));
|
||||
}
|
||||
$.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));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
11
build/js/include/url_on_tab.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// Javascript to enable link to tab
|
||||
var url = document.location.toString();
|
||||
if (url.match('#')) {
|
||||
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
|
||||
}
|
||||
|
||||
// Change hash for page-reload
|
||||
$('.nav-tabs a').on('shown.bs.tab', function (e) {
|
||||
window.location.hash = e.target.hash;
|
||||
$(window).scrollTop(0);
|
||||
})
|
||||
29
build/js/include/user.js
Normal file
@@ -0,0 +1,29 @@
|
||||
function getCurrentUser() {
|
||||
var user = $('#current_user').html();
|
||||
return (typeof(user) != 'undefined') ? user : false;
|
||||
}
|
||||
|
||||
function isConnected() {
|
||||
return getCurrentUser() ? true : false;
|
||||
}
|
||||
|
||||
function hasRole(str) {
|
||||
return checkRole('admin') ? true : checkRole(str);
|
||||
}
|
||||
|
||||
function checkRole(str) {
|
||||
return (global.roles.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
|
||||
function isAdmin() {
|
||||
return hasRole('admin');
|
||||
}
|
||||
|
||||
function hasPermission(str) {
|
||||
if (isAdmin()) {
|
||||
return true;
|
||||
} else {
|
||||
return (global.permissions.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
17
build/js/include/validator.js
Normal file
@@ -0,0 +1,17 @@
|
||||
function initValidator()
|
||||
{
|
||||
window.addEventListener('load', function() {
|
||||
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
||||
var forms = document.getElementsByClassName('needs-validation');
|
||||
// Loop over them and prevent submission
|
||||
var validation = Array.prototype.filter.call(forms, function(form) {
|
||||
form.addEventListener('submit', function(event) {
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
form.classList.add('was-validated');
|
||||
}, false);
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
9140
build/js/theme.js
Normal file
@@ -9,6 +9,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.2",
|
||||
"alexisgeneau/mailvalidate": "dev-master",
|
||||
"arcanedev/log-viewer": "^5.0",
|
||||
"arrilot/laravel-widgets": "^3.13",
|
||||
"awssat/laravel-sync-migration": "^0.1",
|
||||
|
||||
36
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class LaratrustSetupTeams extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Create table for storing teams
|
||||
Schema::create('teams', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('role_user', function (Blueprint $table) {
|
||||
// Drop role foreign key and primary key
|
||||
$table->dropForeign(['role_id']);
|
||||
$table->dropPrimary(['user_id', 'role_id', 'user_type']);
|
||||
|
||||
// Add team_id column
|
||||
$table->unsignedInteger('team_id')->nullable();
|
||||
|
||||
// Create foreign keys
|
||||
$table->foreign('role_id')->references('id')->on('roles')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->foreign('team_id')->references('id')->on('teams')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
// Create a unique key
|
||||
$table->unique(['user_id', 'role_id', 'user_type', 'team_id']);
|
||||
});
|
||||
|
||||
Schema::table('permission_user', function (Blueprint $table) {
|
||||
// Drop permission foreign key and primary key
|
||||
$table->dropForeign(['permission_id']);
|
||||
$table->dropPrimary(['permission_id', 'user_id', 'user_type']);
|
||||
|
||||
$table->foreign('permission_id')->references('id')->on('permissions')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
// Add team_id column
|
||||
$table->unsignedInteger('team_id')->nullable();
|
||||
|
||||
$table->foreign('team_id')->references('id')->on('teams')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->unique(['user_id', 'permission_id', 'user_type', 'team_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel Schematics
|
||||
*
|
||||
* WARNING: removing @tag value will disable automated removal
|
||||
*
|
||||
* @package Laravel-schematics
|
||||
* @author Maarten Tolhuijs <mtolhuys@protonmail.com>
|
||||
* @url https://github.com/mtolhuys/laravel-schematics
|
||||
* @tag laravel-schematics-products-model
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('products', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('title', 255)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel Schematics
|
||||
*
|
||||
* WARNING: removing @tag value will disable automated removal
|
||||
*
|
||||
* @package Laravel-schematics
|
||||
* @author Maarten Tolhuijs <mtolhuys@protonmail.com>
|
||||
* @url https://github.com/mtolhuys/laravel-schematics
|
||||
* @tag laravel-schematics-customers-model
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customers', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customers');
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel Schematics
|
||||
*
|
||||
* WARNING: removing @tag value will disable automated removal
|
||||
*
|
||||
* @package Laravel-schematics
|
||||
* @author Maarten Tolhuijs <mtolhuys@protonmail.com>
|
||||
* @url https://github.com/mtolhuys/laravel-schematics
|
||||
* @tag laravel-schematics-invoices-model
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvoicesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoices', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id');
|
||||
$table->boolean('status_id', true);
|
||||
$table->decimal('subtotal', 10, 2);
|
||||
$table->decimal('total', 10, 2);
|
||||
$table->decimal('shipping', 10, 2);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoices');
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel Schematics
|
||||
*
|
||||
* WARNING: removing @tag value will disable automated removal
|
||||
*
|
||||
* @package Laravel-schematics
|
||||
* @author Maarten Tolhuijs <mtolhuys@protonmail.com>
|
||||
* @url https://github.com/mtolhuys/laravel-schematics
|
||||
* @tag laravel-schematics-invoice_items-model
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvoiceItemsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('invoice_items', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('invoice_id')->nullable();
|
||||
$table->integer('product_id')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->integer('quantity')->nullable();
|
||||
$table->decimal('unit_price',10,2);
|
||||
$table->integer('tax_id')->nullable();
|
||||
$table->integer('raw_price')->nullable();
|
||||
$table->integer('tax')->nullable();
|
||||
$table->integer('total_price')->nullable();
|
||||
$table->decimal('discount_percent')->nullable();
|
||||
$table->decimal('discount')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoice_items');
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel Schematics
|
||||
*
|
||||
* WARNING: removing @tag value will disable automated removal
|
||||
*
|
||||
* @package Laravel-schematics
|
||||
* @author Maarten Tolhuijs <mtolhuys@protonmail.com>
|
||||
* @url https://github.com/mtolhuys/laravel-schematics
|
||||
* @tag laravel-schematics-orders-model
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrdersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('orders', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('orders');
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Laravel Schematics
|
||||
*
|
||||
* WARNING: removing @tag value will disable automated removal
|
||||
*
|
||||
* @package Laravel-schematics
|
||||
* @author Maarten Tolhuijs <mtolhuys@protonmail.com>
|
||||
* @url https://github.com/mtolhuys/laravel-schematics
|
||||
* @tag laravel-schematics-order_payments-model
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateOrderPaymentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('order_payments', static function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('order_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_payments');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateBotanicFamiliesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('botanic_families', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('id')->nullable();
|
||||
$table->string('name', 50)->nullable();
|
||||
$table->string('alias', 50)->nullable();
|
||||
$table->string('latin', 50)->nullable();
|
||||
$table->text('description', 65535)->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('botanic_families');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateBotanicGenresTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('botanic_genres', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('id', true);
|
||||
$table->integer('family_id')->nullable();
|
||||
$table->string('name', 50)->nullable();
|
||||
$table->string('alias', 50)->nullable();
|
||||
$table->string('latin', 50)->nullable();
|
||||
$table->text('description', 65535)->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('botanic_genres');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateBotanicSpeciesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('botanic_species', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('genre_id')->unsigned()->nullable();
|
||||
$table->string('name', 50)->nullable();
|
||||
$table->string('alias', 50)->nullable();
|
||||
$table->string('latin', 50)->nullable();
|
||||
$table->text('description', 65535)->nullable();
|
||||
$table->string('genre_name', 50)->nullable();
|
||||
$table->string('subspecies', 50)->nullable();
|
||||
$table->boolean('germination_legal')->nullable();
|
||||
$table->string('pmg', 50)->nullable();
|
||||
$table->string('grow_duration', 50)->nullable();
|
||||
$table->string('vegetative_cycle', 50)->nullable();
|
||||
$table->string('reglementary_status', 50)->nullable();
|
||||
$table->boolean('add_germination')->nullable();
|
||||
$table->boolean('add_life_duration')->nullable();
|
||||
$table->text('add_diseases', 65535)->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('botanic_species');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateBotanicVarietiesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('botanic_varieties', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('specie_id')->unsigned()->nullable();
|
||||
$table->string('specie_name', 50)->nullable();
|
||||
$table->string('name', 100)->nullable();
|
||||
$table->text('description', 65535)->nullable();
|
||||
$table->string('range', 50)->nullable();
|
||||
$table->string('category', 50)->nullable();
|
||||
$table->string('life_duration', 50)->nullable();
|
||||
$table->string('packaging', 50)->nullable();
|
||||
$table->string('unit', 50)->nullable();
|
||||
$table->string('characteristics', 50)->nullable();
|
||||
$table->string('nutrition_quality', 50)->nullable();
|
||||
$table->string('production_quality', 50)->nullable();
|
||||
$table->string('size', 50)->nullable();
|
||||
$table->string('maturity', 50)->nullable();
|
||||
$table->string('rusticity', 50)->nullable();
|
||||
$table->string('color', 50)->nullable();
|
||||
$table->string('usage', 50)->nullable();
|
||||
$table->string('pot_culture', 50)->nullable();
|
||||
$table->string('color_type', 50)->nullable();
|
||||
$table->string('plant', 50)->nullable();
|
||||
$table->text('description_2', 65535)->nullable();
|
||||
$table->text('genre', 65535)->nullable();
|
||||
$table->text('specie_latin')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('botanic_varieties');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopArticleAttributeFamiliesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_article_attribute_families', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('id', true);
|
||||
$table->string('name', 50)->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_article_attribute_families');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopArticleAttributeValuesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_article_attribute_values', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('id')->unsigned()->nullable();
|
||||
$table->integer('attribute_family_id')->unsigned()->nullable();
|
||||
$table->boolean('type_value')->nullable()->comment('1 = INT, 2 = DECIMAL, 3 = STRING');
|
||||
$table->string('value', 50)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_article_attribute_values');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopArticleAttributesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_article_attributes', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('id')->unsigned()->nullable();
|
||||
$table->integer('article_id')->unsigned()->nullable();
|
||||
$table->integer('attribute_value_id')->unsigned()->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_article_attributes');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopArticleCategoriesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_article_categories', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('article_id')->unsigned()->nullable();
|
||||
$table->integer('category_id')->unsigned()->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_article_categories');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopArticleComponentsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_article_components', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('article_id')->unsigned()->nullable();
|
||||
$table->string('model')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_article_components');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopArticlePricesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_article_prices', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('article_attribute_id')->unsigned()->nullable();
|
||||
$table->decimal('price', 10)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_article_prices');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopArticlesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_articles', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_articles');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopCategoriesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_categories', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('category_id')->unsigned()->nullable();
|
||||
$table->string('name', 50)->nullable();
|
||||
$table->text('description', 65535)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_categories');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopCategoryTagsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_category_tags', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('category_id')->unsigned()->nullable();
|
||||
$table->string('name', 50)->nullable();
|
||||
$table->text('description', 65535)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_category_tags');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopCustomersTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_customers', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name', 50)->default('0');
|
||||
$table->string('address1', 50)->default('0');
|
||||
$table->string('address2', 50)->default('0');
|
||||
$table->string('zipcode', 50)->default('0');
|
||||
$table->string('city', 50)->default('0');
|
||||
$table->string('country', 50)->default('0');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_customers');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopInvoiceItemsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_invoice_items', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('invoice_id')->nullable();
|
||||
$table->integer('product_id')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->integer('quantity')->nullable();
|
||||
$table->decimal('unit_price', 10);
|
||||
$table->integer('tax_id')->nullable();
|
||||
$table->integer('raw_price')->nullable();
|
||||
$table->integer('tax')->nullable();
|
||||
$table->integer('total_price')->nullable();
|
||||
$table->decimal('discount_percent')->nullable();
|
||||
$table->decimal('discount')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_invoice_items');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopInvoicesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_invoices', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('user_id');
|
||||
$table->boolean('status_id');
|
||||
$table->decimal('subtotal', 10);
|
||||
$table->decimal('total', 10);
|
||||
$table->decimal('shipping', 10);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_invoices');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopOrderPaymentsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_order_payments', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('order_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_order_payments');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateShopOrdersTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('shop_orders', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('shop_orders');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateActivityLogTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('activity_log', function(Blueprint $table)
|
||||
{
|
||||
$table->bigInteger('id', true)->unsigned();
|
||||
$table->string('log_name')->nullable()->index();
|
||||
$table->text('description', 65535);
|
||||
$table->bigInteger('subject_id')->unsigned()->nullable();
|
||||
$table->string('subject_type')->nullable();
|
||||
$table->bigInteger('causer_id')->unsigned()->nullable();
|
||||
$table->string('causer_type')->nullable();
|
||||
$table->text('properties', 65535)->nullable();
|
||||
$table->timestamps();
|
||||
$table->index(['subject_id','subject_type'], 'subject');
|
||||
$table->index(['causer_id','causer_type'], 'causer');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('activity_log');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateAuthenticationLogTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('authentication_log', function(Blueprint $table)
|
||||
{
|
||||
$table->bigInteger('id', true)->unsigned();
|
||||
$table->string('authenticatable_type');
|
||||
$table->bigInteger('authenticatable_id')->unsigned();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent', 65535)->nullable();
|
||||
$table->dateTime('login_at')->nullable();
|
||||
$table->dateTime('logout_at')->nullable();
|
||||
$table->index(['authenticatable_type','authenticatable_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('authentication_log');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateCategoriesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('categories', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('slug')->unique();
|
||||
$table->text('name', 65535);
|
||||
$table->text('description', 65535)->nullable();
|
||||
$table->integer('_lft')->unsigned()->default(0);
|
||||
$table->integer('_rgt')->unsigned()->default(0);
|
||||
$table->integer('parent_id')->unsigned()->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['_lft','_rgt','parent_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('categories');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateCategorizablesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('categorizables', function(Blueprint $table)
|
||||
{
|
||||
$table->integer('category_id')->unsigned();
|
||||
$table->string('categorizable_type');
|
||||
$table->bigInteger('categorizable_id')->unsigned();
|
||||
$table->timestamps();
|
||||
$table->unique(['category_id','categorizable_id','categorizable_type'], 'categorizables_ids_type_unique');
|
||||
$table->index(['categorizable_type','categorizable_id']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('categorizables');
|
||||
}
|
||||
|
||||
}
|
||||