diff --git a/app/Entities/BaseRepository.php b/app/Entities/BaseRepository.php index 9375b45..65d8268 100755 --- a/app/Entities/BaseRepository.php +++ b/app/Entities/BaseRepository.php @@ -2,6 +2,7 @@ namespace App\Entities; +use App\Entities\Projects\Feature; use App\Entities\Projects\Project; use App\Entities\Users\User; @@ -24,4 +25,9 @@ abstract class BaseRepository extends EloquentRepository { { return Project::orderBy('name')->lists('name','id'); } + + public function requireFeatureById($featureId) + { + return Feature::findOrFail($featureId); + } } \ No newline at end of file diff --git a/app/Entities/Projects/Feature.php b/app/Entities/Projects/Feature.php index 761edd8..343e7f2 100755 --- a/app/Entities/Projects/Feature.php +++ b/app/Entities/Projects/Feature.php @@ -27,7 +27,7 @@ class Feature extends Model { public function tasks() { - return $this->hasMany(Task::class)->orderBy('progress'); + return $this->hasMany(Task::class)->orderBy('progress')->orderBy('position'); } } diff --git a/app/Entities/Projects/FeaturesRepository.php b/app/Entities/Projects/FeaturesRepository.php index d43bfd8..92e0b7d 100755 --- a/app/Entities/Projects/FeaturesRepository.php +++ b/app/Entities/Projects/FeaturesRepository.php @@ -23,6 +23,9 @@ class FeaturesRepository extends BaseRepository return $this->model->whereHas('tasks', function($query) { return $query->where('progress','<',100); }) + ->whereHas('project', function($query) { + return $query->whereIn('status_id', [2,3]); + }) ->with(['tasks','project','worker']) ->get(); } @@ -84,4 +87,17 @@ class FeaturesRepository extends BaseRepository $feature->update($featureData); return $feature; } + + public function tasksReorder($sortedData) + { + $taskOrder = explode(',', $sortedData); + + foreach ($taskOrder as $order => $taskId) { + $task = $this->requireTaskById($taskId); + $task->position = $order + 1; + $task->save(); + } + + return $taskOrder; + } } \ No newline at end of file diff --git a/app/Entities/Projects/Project.php b/app/Entities/Projects/Project.php index b79166c..82974aa 100755 --- a/app/Entities/Projects/Project.php +++ b/app/Entities/Projects/Project.php @@ -18,7 +18,7 @@ class Project extends Model { public function features() { - return $this->hasMany(Feature::class); + return $this->hasMany(Feature::class)->orderBy('position'); } public function payments() diff --git a/app/Entities/Projects/ProjectsRepository.php b/app/Entities/Projects/ProjectsRepository.php index 976f4aa..669e1ee 100755 --- a/app/Entities/Projects/ProjectsRepository.php +++ b/app/Entities/Projects/ProjectsRepository.php @@ -95,7 +95,7 @@ class ProjectsRepository extends BaseRepository public function getProjectFeatures($projectId) { - return Feature::whereProjectId($projectId)->with('worker','tasks')->get(); + return Feature::whereProjectId($projectId)->orderBy('position')->with('worker','tasks')->get(); } public function updateStatus($statusId, $projectId) @@ -103,8 +103,19 @@ class ProjectsRepository extends BaseRepository $project = $this->requireById($projectId); $project->status_id = $statusId; $project->save(); - // die('hit'); return $project; } + + public function featuresReorder($sortedData) + { + $featureOrder = explode(',', $sortedData); + foreach ($featureOrder as $order => $featureId) { + $feature = $this->requireFeatureById($featureId); + $feature->position = $order + 1; + $feature->save(); + } + + return $featureOrder; + } } \ No newline at end of file diff --git a/app/Entities/Projects/TasksRepository.php b/app/Entities/Projects/TasksRepository.php index adb4254..9042427 100755 --- a/app/Entities/Projects/TasksRepository.php +++ b/app/Entities/Projects/TasksRepository.php @@ -3,7 +3,6 @@ namespace App\Entities\Projects; use App\Entities\BaseRepository; -use App\Entities\Projects\Feature; /** * Tasks Repository Class @@ -17,11 +16,6 @@ class TasksRepository extends BaseRepository parent::__construct($model); } - public function requireFeatureById($featureId) - { - return Feature::findOrFail($featureId); - } - public function createTask($taskData, $featureId) { $taskData['feature_id'] = $featureId; diff --git a/app/Http/Controllers/Projects/FeaturesController.php b/app/Http/Controllers/Projects/FeaturesController.php index a00da38..9a94cf7 100755 --- a/app/Http/Controllers/Projects/FeaturesController.php +++ b/app/Http/Controllers/Projects/FeaturesController.php @@ -111,4 +111,14 @@ class FeaturesController extends Controller { return redirect()->route('projects.features', $projectId); } + public function tasksReorder(Request $req, $featureId) + { + if ($req->ajax()) { + $data = $this->repo->tasksReorder($req->get('postData')); + return 'oke'; + } + + return null; + } + } diff --git a/app/Http/Controllers/Projects/ProjectsController.php b/app/Http/Controllers/Projects/ProjectsController.php index 70ae3f4..be83520 100755 --- a/app/Http/Controllers/Projects/ProjectsController.php +++ b/app/Http/Controllers/Projects/ProjectsController.php @@ -91,6 +91,22 @@ class ProjectsController extends Controller { return view('projects.features', compact('project','features')); } + public function featuresExport($projectId) + { + $project = $this->repo->requireById($projectId); + $features = $this->repo->getProjectFeatures($projectId); + // return view('projects.features-export', compact('project','features')); + + \Excel::create(str_slug(trans('project.features') . '-' . $project->name), function($excel) use ($project, $features) { + + $excel->sheet('testng', function($sheet) use ($project, $features) { + + $sheet->loadView('projects.features-export',compact('project','features')); + + }); + })->download('xlsx'); + } + public function payments($projectId) { $project = $this->repo->requireById($projectId); @@ -105,4 +121,14 @@ class ProjectsController extends Controller { return redirect()->route('projects.show', $projectId); } + public function featuresReorder(Request $req, $projectId) + { + if ($req->ajax()) { + $data = $this->repo->featuresReorder($req->get('postData')); + return 'oke'; + } + + return null; + } + } diff --git a/app/Http/routes.php b/app/Http/routes.php index 8a7094c..82c2a2d 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -9,4 +9,5 @@ require __DIR__ . '/routes/backup.php'; require __DIR__ . '/routes/projects.php'; require __DIR__ . '/routes/payments.php'; require __DIR__ . '/routes/subscriptions.php'; -require __DIR__ . '/routes/reports.php'; \ No newline at end of file +require __DIR__ . '/routes/reports.php'; +require __DIR__ . '/routes/options-vue.php'; \ No newline at end of file diff --git a/app/Http/routes/options-vue.php b/app/Http/routes/options-vue.php new file mode 100644 index 0000000..1125c3e --- /dev/null +++ b/app/Http/routes/options-vue.php @@ -0,0 +1,61 @@ +'api/options'], function() { + Route::match(['GET','POST'], '/', function() { + if (Request::isMethod('GET')) + return App\Entities\Options\Option::all(); + else { + return App\Entities\Options\Option::create(Request::only('key','value')); + } + }); + + Route::match(['GET','PATCH','DELETE'], '/{id}', function($id) { + if (Request::isMethod('GET')) + return App\Entities\Options\Option::findOrFail($id); + else if (Request::isMethod('PATCH')) { + App\Entities\Options\Option::findOrFail($id)->update(Request::only('key','value')); + return Response::json(Request::all()); + } else { + return App\Entities\Options\Option::destroy($id); + } + }); +}); + +// /** Fetch all options (API) */ +// Route::get('api/options', function() { +// return App\Entities\Options\Option::all(); +// }); + +// /** Create new options (API) */ +// use App\Http\Requests\Options\CreateRequest; +// Route::post('api/options', function(CreateRequest $req) { +// return App\Entities\Options\Option::create($req->only('key','value')); +// }); + +// /** get one option (API) */ +// Route::get('api/options/{id}', function($id) { +// return App\Entities\Options\Option::findOrFail($id); +// }); + +// /** update one option (API) */ +// use Illuminate\Http\Request; +// Route::patch('api/options/{id}', function(Request $req, $id) { +// return App\Entities\Options\Option::findOrFail($id)->update($req->only('key','value')); +// }); + +// /** delete one option (API) */ +// Route::delete('api/options/{id}', function($id) { +// App\Entities\Options\Option::destroy($id); +// return 'ok'; +// }); + + +/** end of Vue js Trial */ \ No newline at end of file diff --git a/app/Http/routes/projects.php b/app/Http/routes/projects.php index 87c46f7..63ac012 100644 --- a/app/Http/routes/projects.php +++ b/app/Http/routes/projects.php @@ -6,7 +6,9 @@ Route::group(['middleware' => ['web','role:admin'], 'namespace' => 'Projects'], */ Route::get('projects/{id}/delete', ['as'=>'projects.delete', 'uses'=>'ProjectsController@delete']); Route::get('projects/{id}/features', ['as'=>'projects.features', 'uses'=>'ProjectsController@features']); + Route::get('projects/{id}/features-export', ['as'=>'projects.features-export', 'uses'=>'ProjectsController@featuresExport']); Route::get('projects/{id}/payments', ['as'=>'projects.payments', 'uses'=>'ProjectsController@payments']); + Route::post('projects/{id}/features-reorder', ['as'=>'projects.features-reorder', 'uses'=>'ProjectsController@featuresReorder']); Route::patch('projects/{id}/status-update', ['as'=>'projects.status-update', 'uses'=>'ProjectsController@statusUpdate']); Route::resource('projects','ProjectsController'); @@ -16,6 +18,7 @@ Route::group(['middleware' => ['web','role:admin'], 'namespace' => 'Projects'], Route::get('projects/{id}/features/create', ['as'=>'features.create', 'uses'=>'FeaturesController@create']); Route::get('projects/{id}/features/add-from-other-project', ['as'=>'features.add-from-other-project', 'uses'=>'FeaturesController@addFromOtherProject']); + Route::post('features/{id}/tasks-reorder', ['as'=>'features.tasks-reorder', 'uses'=>'FeaturesController@tasksReorder']); Route::post('projects/{id}/features', ['as'=>'features.store', 'uses'=>'FeaturesController@store']); Route::post('projects/{id}/features/store-from-other-project', ['as'=>'features.store-from-other-project', 'uses'=>'FeaturesController@storeFromOtherProject']); Route::get('features/{id}/delete', ['as'=>'features.delete', 'uses'=>'FeaturesController@delete']); diff --git a/app/Services/FormField.php b/app/Services/FormField.php index b885037..d218d6a 100644 --- a/app/Services/FormField.php +++ b/app/Services/FormField.php @@ -67,7 +67,7 @@ class FormField $hasError = $this->errorBag->has($name) ? 'has-error' : ''; $htmlForm = '
'; - $rows = isset($options['rows']) ? $options['rows'] : 5; + $rows = isset($options['rows']) ? $options['rows'] : 3; $value = isset($options['value']) ? $options['value'] : null; $fieldParams = ['class'=>'form-control','rows' => $rows]; diff --git a/composer.json b/composer.json index ee4b6ee..442f820 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,9 @@ "laracasts/flash": "~1.3", "laracasts/presenter": "^0.2.1", "barryvdh/laravel-debugbar": "^2.0", - "backup-manager/laravel": "^1.0" + "backup-manager/laravel": "^1.0", + "maatwebsite/excel": "~2.1.0", + "barryvdh/laravel-dompdf": "^0.6.1" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index 88791ad..0b1a432 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "2fd93827839a83f6c46976e8a385211d", - "content-hash": "b3621e04a66796e567dde2e91b0878b4", + "hash": "6bdf9803e50e6cdbf8ae6733adee4b03", + "content-hash": "dff508a3fbbb8c01be9e0bd1e1352235", "packages": [ { "name": "backup-manager/backup-manager", @@ -184,6 +184,54 @@ "time": "2016-05-11 13:54:43" }, { + "name": "barryvdh/laravel-dompdf", + "version": "v0.6.1", + "source": { + "type": "git", + "url": "https://github.com/barryvdh/laravel-dompdf.git", + "reference": "b606788108833f7765801dca35455fb23ce9f869" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/b606788108833f7765801dca35455fb23ce9f869", + "reference": "b606788108833f7765801dca35455fb23ce9f869", + "shasum": "" + }, + "require": { + "dompdf/dompdf": "0.6.*", + "illuminate/support": "5.0.x|5.1.x|5.2.x", + "php": ">=5.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.6-dev" + } + }, + "autoload": { + "psr-4": { + "Barryvdh\\DomPDF\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "A DOMPDF Wrapper for Laravel", + "keywords": [ + "dompdf", + "laravel", + "pdf" + ], + "time": "2015-12-21 19:51:22" + }, + { "name": "classpreloader/classpreloader", "version": "3.0.0", "source": { @@ -338,6 +386,47 @@ "time": "2015-11-06 14:35:42" }, { + "name": "dompdf/dompdf", + "version": "v0.6.2", + "source": { + "type": "git", + "url": "https://github.com/dompdf/dompdf.git", + "reference": "cc06008f75262510ee135b8cbb14e333a309f651" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/cc06008f75262510ee135b8cbb14e333a309f651", + "reference": "cc06008f75262510ee135b8cbb14e333a309f651", + "shasum": "" + }, + "require": { + "phenx/php-font-lib": "0.2.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "include/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + }, + { + "name": "Brian Sweeney", + "email": "eclecticgeek@gmail.com" + } + ], + "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", + "homepage": "https://github.com/dompdf/dompdf", + "time": "2015-12-07 04:07:13" + }, + { "name": "jakub-onderka/php-console-color", "version": "0.1", "source": { @@ -838,6 +927,73 @@ "time": "2016-06-03 19:11:39" }, { + "name": "maatwebsite/excel", + "version": "v2.1.3", + "source": { + "type": "git", + "url": "https://github.com/Maatwebsite/Laravel-Excel.git", + "reference": "c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9", + "reference": "c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9", + "shasum": "" + }, + "require": { + "illuminate/cache": "5.0.*|5.1.*|5.2.*", + "illuminate/config": "5.0.*|5.1.*|5.2.*", + "illuminate/filesystem": "5.0.*|5.1.*|5.2.*", + "illuminate/support": "5.0.*|5.1.*|5.2.*", + "nesbot/carbon": "~1.0", + "php": ">=5.5", + "phpoffice/phpexcel": "1.8.*", + "tijsverkoyen/css-to-inline-styles": "~1.5" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "orchestra/testbench": "3.1.*", + "phpseclib/phpseclib": "~1.0", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "illuminate/http": "5.0.*|5.1.*|5.2.*", + "illuminate/queue": "5.0.*|5.1.*|5.2.*", + "illuminate/routing": "5.0.*|5.1.*|5.2.*", + "illuminate/view": "5.0.*|5.1.*|5.2.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/Maatwebsite/Excel" + ], + "psr-0": { + "Maatwebsite\\Excel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maatwebsite.nl", + "email": "patrick@maatwebsite.nl" + } + ], + "description": "An eloquent way of importing and exporting Excel and CSV in Laravel 4 with the power of PHPExcel", + "keywords": [ + "PHPExcel", + "batch", + "csv", + "excel", + "export", + "import", + "laravel" + ], + "time": "2016-07-09 09:40:10" + }, + { "name": "maximebf/debugbar", "version": "v1.11.1", "source": { @@ -1167,6 +1323,97 @@ "time": "2016-03-18 20:34:03" }, { + "name": "phenx/php-font-lib", + "version": "0.2.2", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-font-lib.git", + "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", + "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "classes/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/PhenX/php-font-lib", + "time": "2014-02-01 15:22:28" + }, + { + "name": "phpoffice/phpexcel", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PHPExcel.git", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "ext-xmlwriter": "*", + "php": ">=5.2.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "PHPExcel": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "http://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker" + }, + { + "name": "Franck Lefevre", + "homepage": "http://blog.rootslabs.net" + }, + { + "name": "Erik Tilt" + } + ], + "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "http://phpexcel.codeplex.com", + "keywords": [ + "OpenXML", + "excel", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "time": "2015-05-01 07:00:55" + }, + { "name": "psr/log", "version": "1.0.0", "source": { @@ -1390,6 +1637,59 @@ "time": "2016-06-06 15:08:35" }, { + "name": "symfony/css-selector", + "version": "v3.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "e8a66c51bf65f188c02f8120c0748b2291d3a2d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/e8a66c51bf65f188c02f8120c0748b2291d3a2d0", + "reference": "e8a66c51bf65f188c02f8120c0748b2291d3a2d0", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2016-06-06 11:33:26" + }, + { "name": "symfony/debug", "version": "v3.0.7", "source": { @@ -2109,6 +2409,53 @@ "time": "2016-05-24 10:03:10" }, { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "1.5.5", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "9753fc340726e327e4d48b7c0604f85475ae0bc3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/9753fc340726e327e4d48b7c0604f85475ae0bc3", + "reference": "9753fc340726e327e4d48b7c0604f85475ae0bc3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/css-selector": "~2.1|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "time": "2015-12-08 16:14:14" + }, + { "name": "vlucas/phpdotenv", "version": "v2.3.0", "source": { @@ -3324,59 +3671,6 @@ "time": "2015-06-21 13:59:46" }, { - "name": "symfony/css-selector", - "version": "v3.0.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "e8a66c51bf65f188c02f8120c0748b2291d3a2d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/e8a66c51bf65f188c02f8120c0748b2291d3a2d0", - "reference": "e8a66c51bf65f188c02f8120c0748b2291d3a2d0", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2016-06-06 11:33:26" - }, - { "name": "symfony/dom-crawler", "version": "v3.0.7", "source": { diff --git a/config/app.php b/config/app.php index 5ad84f8..51ff996 100644 --- a/config/app.php +++ b/config/app.php @@ -158,10 +158,11 @@ return [ App\Providers\OptionServiceProvider::class, App\Providers\RouteServiceProvider::class, + BackupManager\Laravel\Laravel5ServiceProvider::class, // Barryvdh\Debugbar\ServiceProvider::class, Collective\Html\HtmlServiceProvider::class, Laracasts\Flash\FlashServiceProvider::class, - BackupManager\Laravel\Laravel5ServiceProvider::class, + Maatwebsite\Excel\ExcelServiceProvider::class, ], @@ -211,6 +212,7 @@ return [ 'Carbon' => Carbon\Carbon::class, 'Debugbar' => Barryvdh\Debugbar\Facade::class, + 'Excel' => Maatwebsite\Excel\Facades\Excel::class, 'Form' => Collective\Html\FormFacade::class, 'FormField' => App\Services\Facades\FormField::class, 'Html' => Collective\Html\HtmlFacade::class, diff --git a/config/excel.php b/config/excel.php new file mode 100644 index 0000000..4af2701 --- /dev/null +++ b/config/excel.php @@ -0,0 +1,691 @@ + array( + + /* + |-------------------------------------------------------------------------- + | Enable/Disable cell caching + |-------------------------------------------------------------------------- + */ + 'enable' => true, + + /* + |-------------------------------------------------------------------------- + | Caching driver + |-------------------------------------------------------------------------- + | + | Set the caching driver + | + | Available methods: + | memory|gzip|serialized|igbinary|discISAM|apc|memcache|temp|wincache|sqlite|sqlite3 + | + */ + 'driver' => 'memory', + + /* + |-------------------------------------------------------------------------- + | Cache settings + |-------------------------------------------------------------------------- + */ + 'settings' => array( + + 'memoryCacheSize' => '32MB', + 'cacheTime' => 600 + + ), + + /* + |-------------------------------------------------------------------------- + | Memcache settings + |-------------------------------------------------------------------------- + */ + 'memcache' => array( + + 'host' => 'localhost', + 'port' => 11211, + + ), + + /* + |-------------------------------------------------------------------------- + | Cache dir (for discISAM) + |-------------------------------------------------------------------------- + */ + + 'dir' => storage_path('cache') + ), + + 'properties' => array( + 'creator' => 'Nafies Luthfi', + 'lastModifiedBy' => 'Nafies Luthfi', + 'title' => 'Spreadsheet', + 'description' => 'Default spreadsheet export', + 'subject' => 'Spreadsheet export', + 'keywords' => 'maatwebsite, excel, export', + 'category' => 'Excel', + 'manager' => 'Nafies Luthfi', + 'company' => 'JasaWebsiteBanjarmasin.com', + ), + + /* + |-------------------------------------------------------------------------- + | Sheets settings + |-------------------------------------------------------------------------- + */ + 'sheets' => array( + + /* + |-------------------------------------------------------------------------- + | Default page setup + |-------------------------------------------------------------------------- + */ + 'pageSetup' => array( + 'orientation' => 'portrait', + 'paperSize' => '9', + 'scale' => '100', + 'fitToPage' => false, + 'fitToHeight' => true, + 'fitToWidth' => true, + 'columnsToRepeatAtLeft' => array('', ''), + 'rowsToRepeatAtTop' => array(0, 0), + 'horizontalCentered' => false, + 'verticalCentered' => false, + 'printArea' => null, + 'firstPageNumber' => null, + ), + ), + + /* + |-------------------------------------------------------------------------- + | Creator + |-------------------------------------------------------------------------- + | + | The default creator of a new Excel file + | + */ + + 'creator' => 'Maatwebsite', + + 'csv' => array( + /* + |-------------------------------------------------------------------------- + | Delimiter + |-------------------------------------------------------------------------- + | + | The default delimiter which will be used to read out a CSV file + | + */ + + 'delimiter' => ',', + + /* + |-------------------------------------------------------------------------- + | Enclosure + |-------------------------------------------------------------------------- + */ + + 'enclosure' => '"', + + /* + |-------------------------------------------------------------------------- + | Line endings + |-------------------------------------------------------------------------- + */ + + 'line_ending' => "\r\n", + + /* + |-------------------------------------------------------------------------- + | setUseBom + |-------------------------------------------------------------------------- + */ + + 'use_bom' => false + ), + + 'export' => array( + + /* + |-------------------------------------------------------------------------- + | Autosize columns + |-------------------------------------------------------------------------- + | + | Disable/enable column autosize or set the autosizing for + | an array of columns ( array('A', 'B') ) + | + */ + 'autosize' => true, + + /* + |-------------------------------------------------------------------------- + | Autosize method + |-------------------------------------------------------------------------- + | + | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX + | The default is based on an estimate, which does its calculation based + | on the number of characters in the cell value (applying any calculation + | and format mask, and allowing for wordwrap and rotation) and with an + | "arbitrary" adjustment based on the font (Arial, Calibri or Verdana, + | defaulting to Calibri if any other font is used) and a proportional + | adjustment for the font size. + | + | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT + | The second method is more accurate, based on actual style formatting as + | well (bold, italic, etc), and is calculated by generating a gd2 imagettf + | bounding box and using its dimensions to determine the size; but this + | method is significantly slower, and its accuracy is still dependent on + | having the appropriate fonts installed. + | + */ + 'autosize-method' => PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX, + + /* + |-------------------------------------------------------------------------- + | Auto generate table heading + |-------------------------------------------------------------------------- + | + | If set to true, the array indices (or model attribute names) + | will automatically be used as first row (table heading) + | + */ + 'generate_heading_by_indices' => true, + + /* + |-------------------------------------------------------------------------- + | Auto set alignment on merged cells + |-------------------------------------------------------------------------- + */ + 'merged_cell_alignment' => 'left', + + /* + |-------------------------------------------------------------------------- + | Pre-calculate formulas during export + |-------------------------------------------------------------------------- + */ + 'calculate' => false, + + /* + |-------------------------------------------------------------------------- + | Include Charts during export + |-------------------------------------------------------------------------- + */ + 'includeCharts' => false, + + /* + |-------------------------------------------------------------------------- + | Default sheet settings + |-------------------------------------------------------------------------- + */ + 'sheets' => array( + + /* + |-------------------------------------------------------------------------- + | Default page margin + |-------------------------------------------------------------------------- + | + | 1) When set to false, default margins will be used + | 2) It's possible to enter a single margin which will + | be used for all margins. + | 3) Alternatively you can pass an array with 4 margins + | Default order: array(top, right, bottom, left) + | + */ + 'page_margin' => false, + + /* + |-------------------------------------------------------------------------- + | Value in source array that stands for blank cell + |-------------------------------------------------------------------------- + */ + 'nullValue' => null, + + /* + |-------------------------------------------------------------------------- + | Insert array starting from this cell address as the top left coordinate + |-------------------------------------------------------------------------- + */ + 'startCell' => 'A1', + + /* + |-------------------------------------------------------------------------- + | Apply strict comparison when testing for null values in the array + |-------------------------------------------------------------------------- + */ + 'strictNullComparison' => false + ), + + /* + |-------------------------------------------------------------------------- + | Store settings + |-------------------------------------------------------------------------- + */ + + 'store' => array( + + /* + |-------------------------------------------------------------------------- + | Path + |-------------------------------------------------------------------------- + | + | The path we want to save excel file to + | + */ + 'path' => storage_path('exports'), + + /* + |-------------------------------------------------------------------------- + | Return info + |-------------------------------------------------------------------------- + | + | Whether we want to return information about the stored file or not + | + */ + 'returnInfo' => false + + ), + + /* + |-------------------------------------------------------------------------- + | PDF Settings + |-------------------------------------------------------------------------- + */ + 'pdf' => array( + + /* + |-------------------------------------------------------------------------- + | PDF Drivers + |-------------------------------------------------------------------------- + | Supported: DomPDF, tcPDF, mPDF + */ + 'driver' => 'DomPDF', + + /* + |-------------------------------------------------------------------------- + | PDF Driver settings + |-------------------------------------------------------------------------- + */ + 'drivers' => array( + + /* + |-------------------------------------------------------------------------- + | DomPDF settings + |-------------------------------------------------------------------------- + */ + 'DomPDF' => array( + 'path' => base_path('vendor/dompdf/dompdf/') + ), + + /* + |-------------------------------------------------------------------------- + | tcPDF settings + |-------------------------------------------------------------------------- + */ + 'tcPDF' => array( + 'path' => base_path('vendor/tecnick.com/tcpdf/') + ), + + /* + |-------------------------------------------------------------------------- + | mPDF settings + |-------------------------------------------------------------------------- + */ + 'mPDF' => array( + 'path' => base_path('vendor/mpdf/mpdf/') + ), + ) + ) + ), + + 'filters' => array( + /* + |-------------------------------------------------------------------------- + | Register read filters + |-------------------------------------------------------------------------- + */ + + 'registered' => array( + 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter' + ), + + /* + |-------------------------------------------------------------------------- + | Enable certain filters for every file read + |-------------------------------------------------------------------------- + */ + + 'enabled' => array() + ), + + 'import' => array( + + /* + |-------------------------------------------------------------------------- + | Has heading + |-------------------------------------------------------------------------- + | + | The sheet has a heading (first) row which we can use as attribute names + | + | Options: true|false|slugged|slugged_with_count|ascii|numeric|hashed|trans|original + | + */ + + 'heading' => 'slugged', + + /* + |-------------------------------------------------------------------------- + | First Row with data or heading of data + |-------------------------------------------------------------------------- + | + | If the heading row is not the first row, or the data doesn't start + | on the first row, here you can change the start row. + | + */ + + 'startRow' => 1, + + /* + |-------------------------------------------------------------------------- + | Cell name word separator + |-------------------------------------------------------------------------- + | + | The default separator which is used for the cell names + | Note: only applies to 'heading' settings 'true' && 'slugged' + | + */ + + 'separator' => '_', + + /* + |-------------------------------------------------------------------------- + | Include Charts during import + |-------------------------------------------------------------------------- + */ + + 'includeCharts' => false, + + /* + |-------------------------------------------------------------------------- + | Sheet heading conversion + |-------------------------------------------------------------------------- + | + | Convert headings to ASCII + | Note: only applies to 'heading' settings 'true' && 'slugged' + | + */ + + 'to_ascii' => true, + + /* + |-------------------------------------------------------------------------- + | Import encoding + |-------------------------------------------------------------------------- + */ + + 'encoding' => array( + + 'input' => 'UTF-8', + 'output' => 'UTF-8' + + ), + + /* + |-------------------------------------------------------------------------- + | Calculate + |-------------------------------------------------------------------------- + | + | By default cells with formulas will be calculated. + | + */ + + 'calculate' => true, + + /* + |-------------------------------------------------------------------------- + | Ignore empty cells + |-------------------------------------------------------------------------- + | + | By default empty cells are not ignored + | + */ + + 'ignoreEmpty' => false, + + /* + |-------------------------------------------------------------------------- + | Force sheet collection + |-------------------------------------------------------------------------- + | + | For a sheet collection even when there is only 1 sheets. + | When set to false and only 1 sheet found, the parsed file will return + | a row collection instead of a sheet collection. + | When set to true, it will return a sheet collection instead. + | + */ + 'force_sheets_collection' => false, + + /* + |-------------------------------------------------------------------------- + | Date format + |-------------------------------------------------------------------------- + | + | The format dates will be parsed to + | + */ + + 'dates' => array( + + /* + |-------------------------------------------------------------------------- + | Enable/disable date formatting + |-------------------------------------------------------------------------- + */ + 'enabled' => true, + + /* + |-------------------------------------------------------------------------- + | Default date format + |-------------------------------------------------------------------------- + | + | If set to false, a carbon object will return + | + */ + 'format' => false, + + /* + |-------------------------------------------------------------------------- + | Date columns + |-------------------------------------------------------------------------- + */ + 'columns' => array() + ), + + /* + |-------------------------------------------------------------------------- + | Import sheets by config + |-------------------------------------------------------------------------- + */ + 'sheets' => array( + + /* + |-------------------------------------------------------------------------- + | Example sheet + |-------------------------------------------------------------------------- + | + | Example sheet "test" will grab the firstname at cell A2 + | + */ + + 'test' => array( + + 'firstname' => 'A2' + + ) + + ) + ), + + 'views' => array( + + /* + |-------------------------------------------------------------------------- + | Styles + |-------------------------------------------------------------------------- + | + | The default styles which will be used when parsing a view + | + */ + + 'styles' => array( + + /* + |-------------------------------------------------------------------------- + | Table headings + |-------------------------------------------------------------------------- + */ + 'th' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Strong tags + |-------------------------------------------------------------------------- + */ + 'strong' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Bold tags + |-------------------------------------------------------------------------- + */ + 'b' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Italic tags + |-------------------------------------------------------------------------- + */ + 'i' => array( + 'font' => array( + 'italic' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 1 + |-------------------------------------------------------------------------- + */ + 'h1' => array( + 'font' => array( + 'bold' => true, + 'size' => 24, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 2 + |-------------------------------------------------------------------------- + */ + 'h2' => array( + 'font' => array( + 'bold' => true, + 'size' => 18, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 2 + |-------------------------------------------------------------------------- + */ + 'h3' => array( + 'font' => array( + 'bold' => true, + 'size' => 13.5, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 4 + |-------------------------------------------------------------------------- + */ + 'h4' => array( + 'font' => array( + 'bold' => true, + 'size' => 12, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 5 + |-------------------------------------------------------------------------- + */ + 'h5' => array( + 'font' => array( + 'bold' => true, + 'size' => 10, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Heading 6 + |-------------------------------------------------------------------------- + */ + 'h6' => array( + 'font' => array( + 'bold' => true, + 'size' => 7.5, + ) + ), + + /* + |-------------------------------------------------------------------------- + | Hyperlinks + |-------------------------------------------------------------------------- + */ + 'a' => array( + 'font' => array( + 'underline' => true, + 'color' => array('argb' => 'FF0000FF'), + ) + ), + + /* + |-------------------------------------------------------------------------- + | Horizontal rules + |-------------------------------------------------------------------------- + */ + 'hr' => array( + 'borders' => array( + 'bottom' => array( + 'style' => 'thin', + 'color' => array('FF000000') + ), + ) + ) + ) + + ) + +); diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 2eea94e..f26be01 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -96,6 +96,7 @@ $factory->define(Feature::class, function (Faker\Generator $faker) { 'description' => $faker->paragraph, 'worker_id' => factory(User::class)->create()->id, 'type_id' => rand(1,2), + 'position' => rand(1,10), ]; }); @@ -106,6 +107,7 @@ $factory->define(Task::class, function (Faker\Generator $faker) { 'name' => $faker->sentence(3), 'description' => $faker->paragraph, 'progress' => rand(40,100), - 'route_name' => implode('.', $faker->words(3)) + 'route_name' => implode('.', $faker->words(3)), + 'position' => rand(1,10), ]; }); \ No newline at end of file diff --git a/public/assets/js/sb-admin-2.js b/public/assets/js/sb-admin-2.js index 0e45718..56fb5ce 100755 --- a/public/assets/js/sb-admin-2.js +++ b/public/assets/js/sb-admin-2.js @@ -8,21 +8,21 @@ $(function() { //collapses the sidebar on window resize. // Sets the min-height of #page-wrapper to window size $(function() { - // $(window).bind("load resize", function() { - // topOffset = 50; - // width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width; - // if (width < 768) { - // $('div.navbar-collapse').addClass('collapse') - // topOffset = 100; // 2-row-menu - // } else { - // $('div.navbar-collapse').removeClass('collapse') - // } + $(window).bind("load resize", function() { + topOffset = 50; + width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width; + if (width < 768) { + $('div.navbar-collapse').addClass('collapse') + topOffset = 100; // 2-row-menu + } else { + $('div.navbar-collapse').removeClass('collapse') + } - // height = (this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height; - // height = height - topOffset; - // if (height < 1) height = 1; - // if (height > topOffset) { - // $("#page-wrapper").css("min-height", (height) + "px"); - // } - // }) + // height = (this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height; + // height = height - topOffset; + // if (height < 1) height = 1; + // if (height > topOffset) { + // $("#page-wrapper").css("min-height", (height) + "px"); + // } + }) }); diff --git a/resources/lang/id/project.php b/resources/lang/id/project.php index 05eedce..732c20b 100644 --- a/resources/lang/id/project.php +++ b/resources/lang/id/project.php @@ -24,6 +24,7 @@ return [ 'cash_out_total' => 'Total Pengeluaran', 'customer' => 'Customer', 'features' => 'Daftar Fitur', + 'features_export' => 'Export Fitur ke Excel', 'worker' => 'Pekerja', 'status' => 'Status Project', 'payments' => 'Pembayaran', diff --git a/resources/views/features/partials/feature-show.blade.php b/resources/views/features/partials/feature-show.blade.php index b348f29..a1f1def 100644 --- a/resources/views/features/partials/feature-show.blade.php +++ b/resources/views/features/partials/feature-show.blade.php @@ -2,7 +2,7 @@

{{ trans('feature.show') }}

- + diff --git a/resources/views/features/partials/feature-tasks-operation.blade.php b/resources/views/features/partials/feature-tasks-operation.blade.php index 5d2c736..60e1d1b 100644 --- a/resources/views/features/partials/feature-tasks-operation.blade.php +++ b/resources/views/features/partials/feature-tasks-operation.blade.php @@ -8,7 +8,7 @@
{!! FormField::text('route_name') !!}
{!! FormField::text('progress', ['addon' => ['after' => '%'],'value' => 0]) !!}
- {!! FormField::text('description') !!} + {!! FormField::textarea('description') !!} {!! Form::submit(trans('task.create'), ['class' => 'btn btn-primary']) !!} {!! Form::close() !!} @@ -20,12 +20,18 @@

{{ trans('task.edit') }}

-
{!! FormField::text('name') !!}
-
{!! FormField::text('route_name') !!}
-
{!! FormField::text('progress', ['addon' => ['after' => '%']]) !!}
+
{!! FormField::text('name') !!}
+
{!! FormField::text('route_name') !!}
{!! FormField::textarea('description') !!} - {!! Form::hidden('feature_id', $editableTask->feature_id) !!} +
+
+ {!! FormField::text('progress', ['addon' => ['after' => '%']]) !!} +
+
+ {!! FormField::select('feature_id', $feature->project->features->lists('name','id'), ['label' => 'Pindahkan ke Fitur lain']) !!} +
+
{!! Form::submit(trans('task.update'), ['class' => 'btn btn-warning']) !!} {!! link_to_route('features.show', trans('app.cancel'), [$feature->id], ['class' => 'btn btn-default']) !!} {!! Form::close() !!} @@ -36,18 +42,22 @@

{{ trans('task.delete') }}

+
{{ $editableTask->name }}
+
{!! $editableTask->description !!}
+
+ -
@endif \ No newline at end of file diff --git a/resources/views/features/partials/feature-tasks.blade.php b/resources/views/features/partials/feature-tasks.blade.php index 32c8dfb..8517156 100644 --- a/resources/views/features/partials/feature-tasks.blade.php +++ b/resources/views/features/partials/feature-tasks.blade.php @@ -8,13 +8,13 @@ - + @forelse($feature->tasks as $key => $task) - + @@ -43,4 +43,23 @@
{{ trans('feature.name') }}{{ $feature->name }}
{{ trans('feature.name') }}{{ $feature->name }}
{{ trans('feature.price') }}{{ formatRp($feature->price) }}
{{ trans('feature.tasks_count') }}{{ $feature->tasks->count() }}
{{ trans('feature.progress') }}{{ formatDecimal($feature->tasks->avg('progress')) }}%
{{ trans('task.progress') }} {{ trans('app.action') }}
{{ 1 + $key }}
{{ $task->name }}
-
{{ $task->description }}
+
{!! nl2br($task->description) !!}
{{ $task->route_name }} {{ $task->progress }} %
-
\ No newline at end of file + + +@section('ext_js') + {!! Html::script(url('assets/js/plugins/jquery-ui.min.js')) !!} +@endsection + +@section('script') + + +@endsection \ No newline at end of file diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 84658c8..894bea2 100755 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -19,7 +19,6 @@ @include('layouts.partials.sidebar')
- {{-- @include('layouts.partials.top-nav') --}} @include('flash::message')
@yield('content') diff --git a/resources/views/layouts/guest.blade.php b/resources/views/layouts/guest.blade.php index 80b5d5d..0a17f06 100755 --- a/resources/views/layouts/guest.blade.php +++ b/resources/views/layouts/guest.blade.php @@ -9,11 +9,12 @@ @yield('title', Option::get('app_name', 'Aplikasi Laravel')) - {!! Html::style('assets/css/bootstrap.min.css') !!} - {!! Html::style('assets/css/bootstrap-theme.min.css') !!} - {!! Html::style('assets/css/font-awesome.min.css') !!} - {!! Html::style('assets/css/sb-admin-2.css') !!} + {{-- {!! Html::style('assets/css/bootstrap.min.css') !!} --}} + {{-- {!! Html::style('assets/css/bootstrap-theme.min.css') !!} --}} + {{-- {!! Html::style('assets/css/font-awesome.min.css') !!} --}} + {{-- {!! Html::style('assets/css/sb-admin-2.css') !!} --}} {!! Html::style('assets/css/app.css') !!} + @yield('ext_css')
@@ -25,11 +26,14 @@ {!! Html::script(url('assets/js/jquery.js')) !!} {!! Html::script(url('assets/js/bootstrap.min.js')) !!} + @yield('ext_js') + + @yield('script') \ No newline at end of file diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index aefe4fc..12f34dc 100755 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -1,3 +1,11 @@ +