From 1cc7d040da8483548eba3939441faa5a087e1aa5 Mon Sep 17 00:00:00 2001 From: Priatmoko Date: Thu, 2 May 2019 10:41:17 +0700 Subject: [PATCH 01/16] Repair username rule, add alpha_dash validation --- app/Http/Controllers/Admin/Profile/FormController.php | 4 ++-- app/Http/Controllers/Auth/RegisterController.php | 2 +- resources/views/Admin/Profile/menu-setting.blade.php | 2 +- resources/views/auth/register.blade.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Admin/Profile/FormController.php b/app/Http/Controllers/Admin/Profile/FormController.php index 07fea70..5bd473f 100644 --- a/app/Http/Controllers/Admin/Profile/FormController.php +++ b/app/Http/Controllers/Admin/Profile/FormController.php @@ -21,7 +21,7 @@ public function store(Request $r) $validation =\Validator::make($r->all(), [ 'name'=>'required|max:191', 'id'=>'required', - 'username'=>'required', + 'username'=>'required|alpha_dash', 'email'=>'required|email', 'avatar'=>'image|max:1024']); //check validataion result @@ -79,7 +79,7 @@ private function moveFile($file, $filename, $path, $user) if (file_exists($path.$filename)) unlink($path.$filename); //check the existing file refer to exist data - if (file_exists($path.$user->avatar)) + if ($user->avatar!="" && file_exists($path.$user->avatar)) unlink($path.$user->avatar); //check the existing file refer to exist data (thumbnail) if (file_exists($path.'thumb-'.$user->avatar)) diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 5c06fd1..d688d83 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -50,7 +50,7 @@ protected function validator(array $data) { return Validator::make($data, [ 'name' => ['required', 'string', 'max:255'], - 'username' => ['required', 'string', 'max:255', 'unique:users'], + 'username' => ['required', 'string', 'alpha_dash ', 'max:255', 'unique:users'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], ]); diff --git a/resources/views/Admin/Profile/menu-setting.blade.php b/resources/views/Admin/Profile/menu-setting.blade.php index edecc86..a012bd2 100644 --- a/resources/views/Admin/Profile/menu-setting.blade.php +++ b/resources/views/Admin/Profile/menu-setting.blade.php @@ -3,7 +3,7 @@
imageavatar)?asset('files/admin/users/thumb-'.\Auth::user()->avatar):asset('assets/img/avatar/avatar-1.png')}}" class="rounded-circle author-box-picture" style="width:100px;">
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 9fe7d2c..4396d19 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -26,7 +26,7 @@
- +
@if ($errors->has('username')) {{ $errors->first('username') }} From e2e9531c68f25f1dc0fe4d8397dc6952fdd1a854 Mon Sep 17 00:00:00 2001 From: Priatmoko Date: Thu, 2 May 2019 16:54:24 +0700 Subject: [PATCH 02/16] Progress, create applicataion management --- .../Admin/Apps/IndexController.php | 11 ++++++ app/Models/Apps.php | 10 +++++ .../2019_05_02_064742_create_apps_table.php | 39 +++++++++++++++++++ resources/views/Admin/Apps/index.blade.php | 0 4 files changed, 60 insertions(+) create mode 100644 app/Http/Controllers/Admin/Apps/IndexController.php create mode 100644 app/Models/Apps.php create mode 100644 database/migrations/2019_05_02_064742_create_apps_table.php create mode 100644 resources/views/Admin/Apps/index.blade.php diff --git a/app/Http/Controllers/Admin/Apps/IndexController.php b/app/Http/Controllers/Admin/Apps/IndexController.php new file mode 100644 index 0000000..5f13092 --- /dev/null +++ b/app/Http/Controllers/Admin/Apps/IndexController.php @@ -0,0 +1,11 @@ +bigIncrements('id'); + $table->bigInteger('parent'); + $table->integer('sorter'); + $table->string('name'); + $table->string('node_name'); + $table->mediumText('desc'); + $table->string('url'); + $table->string('color'); + $table->string('icon'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('apps'); + } +} diff --git a/resources/views/Admin/Apps/index.blade.php b/resources/views/Admin/Apps/index.blade.php new file mode 100644 index 0000000..e69de29 From 218303d214c6fd21d3b4140dce640833ae2d5880 Mon Sep 17 00:00:00 2001 From: Priatmoko Date: Fri, 3 May 2019 14:40:22 +0700 Subject: [PATCH 03/16] Improve email validation on update data user --- app/Http/Controllers/Admin/Profile/FormController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/Profile/FormController.php b/app/Http/Controllers/Admin/Profile/FormController.php index 5bd473f..168db08 100644 --- a/app/Http/Controllers/Admin/Profile/FormController.php +++ b/app/Http/Controllers/Admin/Profile/FormController.php @@ -22,7 +22,7 @@ public function store(Request $r) 'name'=>'required|max:191', 'id'=>'required', 'username'=>'required|alpha_dash', - 'email'=>'required|email', + 'email'=>'required|email|unique:users,email,'.$r->input('id'), 'avatar'=>'image|max:1024']); //check validataion result if ($validation->fails()) From 4ddcf8a276a8811107d246187592939407f0b6db Mon Sep 17 00:00:00 2001 From: Priatmoko Date: Fri, 3 May 2019 16:50:22 +0700 Subject: [PATCH 04/16] Start coding Application management / menu management --- .../Admin/Apps/IndexController.php | 9 +- resources/views/Admin/Apps/index.blade.php | 125 ++++++++++++++++++ .../layouts/elements/others/card.blade.php | 7 +- routes/web.php | 4 + 4 files changed, 143 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/Apps/IndexController.php b/app/Http/Controllers/Admin/Apps/IndexController.php index 5f13092..d60b173 100644 --- a/app/Http/Controllers/Admin/Apps/IndexController.php +++ b/app/Http/Controllers/Admin/Apps/IndexController.php @@ -7,5 +7,12 @@ class IndexController extends Controller { - // + /** + * Displaying main panel of application management + * @return void displaying main panel of Application management + */ + public function index() + { + return view('Admin.Apps.index'); + } } diff --git a/resources/views/Admin/Apps/index.blade.php b/resources/views/Admin/Apps/index.blade.php index e69de29..9f87a41 100644 --- a/resources/views/Admin/Apps/index.blade.php +++ b/resources/views/Admin/Apps/index.blade.php @@ -0,0 +1,125 @@ +@extends('layouts.master-admin') +@section('component') + @component('layouts.elements.others.with-header', + ['title'=>'Application Management', + 'subtitle'=>'Application List', + 'desc'=>'Page for doing some operation like register, update, delete Application, manage menu', + 'breadcrumb'=> (isset($breadcrumb)?$breadcrumb:'')]) + @component('layouts.elements.others.card', + ['title'=>'Application List', + 'body_class'=>'p-0']) + @slot('header_action') +   Add  + @endslot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Task NameProgressMembersDue DateStatusAction
+
+ +
+
Redesign homepage +
+
+
+
+ image + image + image + 2018-04-10
Todo
Detail
+
+ +
+
Backup database +
+
+
+
+ image + image + 2018-01-29
In Progress
Detail
+
+ +
+
Input data +
+
+
+
+ image + image + image + image + 2018-01-16
Completed
Detail
+
+ +
+
Create a mobile app +
+
+
+
+ image + 2018-01-20
Completed
Detail
+ + @slot('footer')@endslot + @endcomponent + @endcomponent +@endsection +@section('scripts') + +@endsection \ No newline at end of file diff --git a/resources/views/layouts/elements/others/card.blade.php b/resources/views/layouts/elements/others/card.blade.php index b561608..fbb4ba8 100644 --- a/resources/views/layouts/elements/others/card.blade.php +++ b/resources/views/layouts/elements/others/card.blade.php @@ -8,8 +8,13 @@ @ component('layouts.elements.others.card', ['title'=>'Your Title']) @endif + @if (isset($header_action)) +
+ {{$header_action}} +
+ @endif
-
+
{{$slot}}
@if (isset($footer)) diff --git a/routes/web.php b/routes/web.php index 28f921c..deafff7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -20,8 +20,12 @@ * Grouping all the route that need authentication to access it */ Route::group(['middleware' => 'auth'], function() { + Route::get('profile', 'Admin\Profile\IndexController@index')->name('profile'); Route::get('profile/setting', 'Admin\Profile\IndexController@setting')->name('profile-setting'); Route::post('profile/store', 'Admin\Profile\FormController@store')->name('profile-store'); Route::post('profile/password', 'Admin\Profile\PwdController@change')->name('profile-change-pwd'); + + Route::get('apps', 'Admin\Apps\IndexController@index')->name('apps'); + }); From 56a81a1979cbbc6c72286ffacaa4dc794c9f3dac Mon Sep 17 00:00:00 2001 From: Priatmoko Date: Wed, 8 May 2019 14:59:54 +0700 Subject: [PATCH 05/16] create page for registering new App --- .../Controllers/Admin/Apps/FormController.php | 14 ++ resources/views/Admin/Apps/create.blade.php | 55 +++++++ resources/views/Admin/Apps/index.blade.php | 144 +++++------------- routes/web.php | 2 + 4 files changed, 113 insertions(+), 102 deletions(-) create mode 100644 app/Http/Controllers/Admin/Apps/FormController.php create mode 100644 resources/views/Admin/Apps/create.blade.php diff --git a/app/Http/Controllers/Admin/Apps/FormController.php b/app/Http/Controllers/Admin/Apps/FormController.php new file mode 100644 index 0000000..96113b5 --- /dev/null +++ b/app/Http/Controllers/Admin/Apps/FormController.php @@ -0,0 +1,14 @@ +'Application Management', + 'subtitle'=>'Create / Update Menu', + 'desc'=>'Page for registering / updating application information', + 'breadcrumb'=> (isset($breadcrumb)?$breadcrumb:'')]) +
+ @csrf + @component('layouts.elements.others.card', + ['title'=>'Application / Menu Configuration']) +

General settings such as name, photo profile, etc

+
+ +
+ +
+ @if ($errors->has('id')) + {{ $errors->first('id') }} + @else + {{__('Please fill in your username')}} + @endif +
+
+
+ +
+ @if ($errors->has('username')) + {{ $errors->first('username') }} + @else + {{__('Please fill in your username')}} + @endif +
+
+
+ @endcomponent +
+ + @endcomponent +@endsection \ No newline at end of file diff --git a/resources/views/Admin/Apps/index.blade.php b/resources/views/Admin/Apps/index.blade.php index 9f87a41..e232a0c 100644 --- a/resources/views/Admin/Apps/index.blade.php +++ b/resources/views/Admin/Apps/index.blade.php @@ -9,108 +9,50 @@ ['title'=>'Application List', 'body_class'=>'p-0']) @slot('header_action') -   Add  +   Add  @endslot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Task NameProgressMembersDue DateStatusAction
-
- -
-
Redesign homepage -
-
-
-
- image - image - image - 2018-04-10
Todo
Detail
-
- -
-
Backup database -
-
-
-
- image - image - 2018-01-29
In Progress
Detail
-
- -
-
Input data -
-
-
-
- image - image - image - image - 2018-01-16
Completed
Detail
-
- -
-
Create a mobile app -
-
-
-
- image - 2018-01-20
Completed
Detail
+ + + + Icon + + Name + URL Link + Sorter + Desc + + + + + +
+ + Redesign homepage + + Apps/test + + + 1 + + 2018-04-10 + + + +
+ + Redesign homepage + + Apps/test + + + 1 + + 2018-04-10 + + + @slot('footer')@endslot @endcomponent @@ -118,8 +60,6 @@ @endsection @section('scripts') @endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index deafff7..5c86643 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,5 +27,7 @@ Route::post('profile/password', 'Admin\Profile\PwdController@change')->name('profile-change-pwd'); Route::get('apps', 'Admin\Apps\IndexController@index')->name('apps'); + Route::get('apps/create', 'Admin\Apps\FormController@create')->name('apps.create'); + Route::post('apps/ajax/store', 'Admin\Apps\FormController@store')->name('apps.ajax.store'); }); From d780dd0aa2654fe1dc2f39cceff9115fe3526bc0 Mon Sep 17 00:00:00 2001 From: Priatmoko Date: Wed, 8 May 2019 16:01:42 +0700 Subject: [PATCH 06/16] Add create Apps menu --- resources/views/Admin/Apps/create.blade.php | 75 ++++++++++++++++----- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/resources/views/Admin/Apps/create.blade.php b/resources/views/Admin/Apps/create.blade.php index 30edef2..a3f6636 100644 --- a/resources/views/Admin/Apps/create.blade.php +++ b/resources/views/Admin/Apps/create.blade.php @@ -11,8 +11,8 @@ ['title'=>'Application / Menu Configuration'])

General settings such as name, photo profile, etc

-
+
+ +
+ +
+ @if ($errors->has('url')) + {{ $errors->first('url') }} + @endif +
+
+
+
+ +
+ +
+ @if ($errors->has('color')) + {{ $errors->first('color') }} + @endif +
+
+
+
+ +
+ +
+ @if ($errors->has('icon')) + {{ $errors->first('icon') }} + @endif +
+
+
+
+ +
+ +
+ @if ($errors->has('desc')) + {{ $errors->first('desc') }} + @endif +
+
+
+ @slot('footer') + + @endslot @endcomponent From 2c00bbcb247557c1ab1bc0a0978f9f3d98b65261 Mon Sep 17 00:00:00 2001 From: Priatmoko Date: Fri, 10 May 2019 11:01:18 +0700 Subject: [PATCH 08/16] PROGRESS, develop menu management, register new app / menu --- public/assets/Admin/Apps/create.js | 0 resources/views/Admin/Apps/create.blade.php | 39 ++++++++++++--------- 2 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 public/assets/Admin/Apps/create.js diff --git a/public/assets/Admin/Apps/create.js b/public/assets/Admin/Apps/create.js new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/Admin/Apps/create.blade.php b/resources/views/Admin/Apps/create.blade.php index 8ea3af0..d891099 100644 --- a/resources/views/Admin/Apps/create.blade.php +++ b/resources/views/Admin/Apps/create.blade.php @@ -11,21 +11,21 @@ ['title'=>'Application / Menu Configuration'])

General settings such as name, photo profile, etc

-