diff --git a/app/Http/Controllers/MenuItems.php b/app/Http/Controllers/MenuItems.php new file mode 100644 index 0000000..a0fc2fa --- /dev/null +++ b/app/Http/Controllers/MenuItems.php @@ -0,0 +1,10 @@ +resetInput(); + } + + public function resetForm(){ + $this->resetErrorBag(); + } + + protected $messages = [ + 'menuLevel.name.required' => 'Menu name is required.', + 'menuLevel.name.min' => 'Menu must be at-least 4 letters long.', + 'menuLevel.name.unique' => ':attribute menu already exists!.', + ]; + + protected function rules() + { + return [ + 'menuLevel.name' => 'required|min:4|unique:menu_levels,name' + ]; + } + + protected function validationAttributes() + { + return [ + 'menuLevel.name' => $this->menuLevel['name'], + ]; + } + + public function resetInput(){ + $this->menuLevel=['name'=>'']; + } + + + + public function submit(){ + $this->validate(); + $level=new MenuLevel(); + $level->name=$this->menuLevel['name']; + $level->save(); + $this->resetForm(); + $this->resetInput(); + $this->dispatchBrowserEvent('FirstModel',['show'=>false]); + } + + public function render() + { + return view('livewire.admin.menu.level'); + } +} diff --git a/app/Models/MenuItems.php b/app/Models/MenuItems.php new file mode 100644 index 0000000..8be2d88 --- /dev/null +++ b/app/Models/MenuItems.php @@ -0,0 +1,11 @@ +id(); + $table->timestamps(); + $table->string('name'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('menu_levels'); + } +}; diff --git a/database/migrations/2022_11_10_105400_create_menu_items_table.php b/database/migrations/2022_11_10_105400_create_menu_items_table.php new file mode 100644 index 0000000..44f8299 --- /dev/null +++ b/database/migrations/2022_11_10_105400_create_menu_items_table.php @@ -0,0 +1,41 @@ +id(); + $table->unsignedBigInteger('menu_id'); + $table->unsignedBigInteger('menu_level_id'); + $table->string('name'); + $table->timestamps(); + + //FOREIGN KEYS + $table->foreign('menu_id','menu_items_fk0')->on('menus')->references('id')->onUpdate('cascade')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + + public function down() + { + Schema::table('menu_items', function (Blueprint $table) { + $table->dropForeign('menu_links_fk0'); + }); + Schema::dropIfExists('menu_items'); + } +}; diff --git a/package-lock.json b/package-lock.json index 427c8f3..d6dd618 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "tailwind-scrollbar": "^2.1.0-preview.0" }, "devDependencies": { - "@tailwindcss/forms": "^0.5.2", + "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.0", "alpinejs": "^3.10.4", "autoprefixer": "^10.4.13", diff --git a/package.json b/package.json index 955864f..452170e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build": "vite build" }, "devDependencies": { - "@tailwindcss/forms": "^0.5.2", + "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.0", "alpinejs": "^3.10.4", "autoprefixer": "^10.4.13", diff --git a/resources/js/components/main.js b/resources/js/components/main.js index e976e43..6f4e778 100644 --- a/resources/js/components/main.js +++ b/resources/js/components/main.js @@ -5,18 +5,28 @@ // // }); -export function Main(data){ - return{ - darkMode:data.darkMode, - isSidebarOpen:false, - isFirstModelButtonClicked:false, - init() { - this.darkMode=true; - Alpine.effect(() => { - console.log( this.isModelButtonClicked); - }); - } - } +export function Main(data) { + return { + darkMode: data.darkMode, + isSidebarOpen: false, + isFirstModelButtonClicked: false, + + init() { + this.darkMode = true; + this.eventToListen(); + Alpine.effect(() => { + console.log(this.isFirstModelButtonClicked); + }); + }, + eventToListen() { + console.log('hello'); + window.addEventListener('FirstModel', event => { + if (event.detail.show === false) { + this.isFirstModelButtonClicked = false + } + }); + } + } } export default Main diff --git a/resources/views/components/item/button.blade.php b/resources/views/components/item/button.blade.php index ac254e5..0364d59 100644 --- a/resources/views/components/item/button.blade.php +++ b/resources/views/components/item/button.blade.php @@ -1,24 +1,44 @@ -@props(['size'=>'default']) +@props([ +'size'=>'medium', +'type'=>'button', +'defaultBg'=>'transition-all duration-300 inline-flex justify-center items-center gap-2 rounded-md border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white focus:ring-blue-600 transition-all text-sm dark:bg-oblue-100 dark:hover:bg-oblue-100 dark:border-olblue-800 dark:text-gray-400 dark:hover:text-white dark:focus:ring-offset-oblue-100', +'primaryBg'=>'transition-all duration-300 inline-flex justify-center items-center gap-2 rounded-md border font-medium bg-blue-600 text-gray-100 shadow-sm align-middle hover:bg-blue-700 border-blue-700 dark:border-blue-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white focus:ring-blue-300 transition-all text-sm ' +]) @switch($size) @case('small') - + @if($type==='submit') + + @else + + @endif @break - @case('default') - + @case('medium') + @if($type==='submit') + + @else + + @endif @break @case('large') - + @if($type==='submit') + + @else + + @endif @break @endswitch diff --git a/resources/views/components/item/elements/input.blade.php b/resources/views/components/item/elements/input.blade.php new file mode 100644 index 0000000..5dbabb5 --- /dev/null +++ b/resources/views/components/item/elements/input.blade.php @@ -0,0 +1,40 @@ +@props([ +'wireName', +'updating'=>'defer', +'debounce'=>'500ms', +'size'=>'small', +'label', +'name', +'placeholder', +]) + +
merge(['class']) }}> + +
+ @switch($updating) + @case('defer') + + @break + + @case('lazy') + + @break + + @case('debounce') + + @break + + @default + + @break + + @endswitch + + + {{-- Input error svg icon --}} +{{--
--}} +{{-- --}} +{{--
--}} +
+ +
diff --git a/resources/views/components/item/form-submit.blade.php b/resources/views/components/item/form-submit.blade.php new file mode 100644 index 0000000..47f1e59 --- /dev/null +++ b/resources/views/components/item/form-submit.blade.php @@ -0,0 +1,10 @@ +@props(['name']) +
+ + Close + + + + {{$name}} + +
diff --git a/resources/views/components/item/form.blade.php b/resources/views/components/item/form.blade.php new file mode 100644 index 0000000..15240b6 --- /dev/null +++ b/resources/views/components/item/form.blade.php @@ -0,0 +1,9 @@ +@props(['method'=>'GET','hasFiles'=>false, 'wireSubmit'=>'submit']) +
+ @csrf + @method($method) +
+ {{ $slot }} +
+
diff --git a/resources/views/components/item/input.blade.php b/resources/views/components/item/input.blade.php new file mode 100644 index 0000000..5f3e87e --- /dev/null +++ b/resources/views/components/item/input.blade.php @@ -0,0 +1,25 @@ +@props([ +'name'=>'', +'placeholder'=>'', +'size'=>'small', +'sizeSmall'=>'py-2 px-3 block w-full border-gray-200 rounded-md text-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-oblue-300 dark:border-olblue-800/[0.5] dark:text-gray-400', +'sizeMedium'=>'py-2 px-3 block w-full border-gray-200 rounded-md text-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400', +'sizeLarge'=>'y-3 px-4 block w-full border-gray-200 rounded-md text-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 sm:p-5', + +]) +merge() }} type="text" id="{{$name}}" placeholder="{{$placeholder}}" name="{{$name}}" +@switch($size) + @case('small') + {{ $attributes->merge(['class' => $sizeSmall])}} + @break + + @case('medium') + {{ $attributes->merge(['class' => $sizeMedium])}} + @break + + @case('large') + {{ $attributes->merge(['class' => $sizeLarge])}} + @break +@endswitch + +> diff --git a/resources/views/components/item/label.blade.php b/resources/views/components/item/label.blade.php new file mode 100644 index 0000000..2909f7b --- /dev/null +++ b/resources/views/components/item/label.blade.php @@ -0,0 +1,2 @@ +@props(['for'=>'','label']) + diff --git a/resources/views/components/item/modal.blade.php b/resources/views/components/item/modal.blade.php index 31e5d74..197aa8f 100644 --- a/resources/views/components/item/modal.blade.php +++ b/resources/views/components/item/modal.blade.php @@ -1,5 +1,14 @@ -@props(['type','buttonName'=>'Give some name', 'modalHeader'=>'Give a header']) - +@props([ +'type', +'size'=>'small', +'buttonName'=>'Give some name', +'modalHeader'=>'Give a header', +'smallModal'=>'sm:max-w-lg sm:w-full ', +'mediumModal'=>'md:max-w-2xl md:w-full ', +'largeModal'=>'lg:max-w-4xl lg:w-full ', +]) + + @switch($type) @case('add') @@ -20,15 +29,30 @@
merge(['class' => $smallModal.'opacity-0 m-3 sm:mx-auto h-[calc(100%-3.5rem)] min-h-[calc(100%-3.5rem)] flex justify-center items-center' ]) }} + @break + + @case('medium') + {{ $attributes->merge(['class' => $mediumModal.'opacity-0 m-3 sm:mx-auto h-[calc(100%-3.5rem)] min-h-[calc(100%-3.5rem)] flex justify-center items-center' ]) }} + @break + + @case('large') + {{ $attributes->merge(['class' => $largeModal.'opacity-0 m-3 sm:mx-auto h-[calc(100%-3.5rem)] min-h-[calc(100%-3.5rem)] flex justify-center items-center' ]) }} + @break + + @endswitch + :class="{ '!flex transition-all duration-300 opacity-100 ': isFirstModelButtonClicked===true }" >
-
+ class="max-h-full !min-w-full overflow-hidden flex flex-col bg-white border shadow-sm rounded-xl dark:bg-oblue-300 dark:border-oblue-100 dark:shadow-olblue-900/[.5]"> +

@switch($type) @case('add') @@ -47,69 +71,14 @@ class="max-h-full overflow-hidden flex flex-col bg-white border shadow-sm rounde {{$modalHeader}}

- -
-
-
-
-

Be bold

-

- Motivate teams to do their best work. Offer best practices to get users going in the right - direction. Be bold and offer just enough help to get the work started, and then get out of - the way. Give accurate information so users can make educated decisions. Know your user's - struggles and desired outcomes and give just enough information to let them get where they - need to go. -

-
- -
-

Be optimistic

-

- Focusing on the details gives people confidence in our products. Weave a consistent story - across our fabric and be diligent about vocabulary across all messaging by being brand - conscious across products to create a seamless flow across all the things. Let people know - that they can jump in and start working expecting to find a dependable experience across all - the things. Keep teams in the loop about what is happening by informing them of relevant - features, products and opportunities for success. Be on the journey with them and highlight - the key points that will help them the most - right now. Be in the moment by focusing - attention on the important bits first. -

-
- -
-

Be practical, with a wink

-

- Keep our own story short and give teams just enough to get moving. Get to the point and be - direct. Be concise - we tell the story of how we can help, but we do it directly and with - purpose. Be on the lookout for opportunities and be quick to offer a helping hand. At the - same time realize that novbody likes a nosy neighbor. Give the user just enough to know that - something awesome is around the corner and then get out of the way. Write clear, accurate, - and concise text that makes interfaces more usable and consistent - and builds trust. We - strive to write text that is understandable by anyone, anywhere, regardless of their culture - or language so that everyone feels they are part of the team. -

-
-
-
-
- - - Save changes - + +
+ {{$slot}}
diff --git a/resources/views/components/item/validation-error.blade.php b/resources/views/components/item/validation-error.blade.php new file mode 100644 index 0000000..66ba406 --- /dev/null +++ b/resources/views/components/item/validation-error.blade.php @@ -0,0 +1,5 @@ +@props(['name'=>'']) +@error($name) +

{{ $message }}

+@enderror + diff --git a/resources/views/components/svg/close.blade.php b/resources/views/components/svg/close.blade.php new file mode 100644 index 0000000..ca88af2 --- /dev/null +++ b/resources/views/components/svg/close.blade.php @@ -0,0 +1,6 @@ +merge(['class' => 'flex-none w-3.5 h-3.5']) }} viewBox="0 0 8 8" fill="none" + xmlns="http://www.w3.org/2000/svg"> + + diff --git a/resources/views/components/svg/exclamation.blade.php b/resources/views/components/svg/exclamation.blade.php new file mode 100644 index 0000000..7da010e --- /dev/null +++ b/resources/views/components/svg/exclamation.blade.php @@ -0,0 +1,3 @@ +merge(['class' => 'flex-none w-4 h-4']) }} width="16" height="16" fill="currentColor" viewBox="0 0 16 16" aria-hidden="true"> + + diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 304d5ef..249a27f 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -31,7 +31,7 @@ @livewireScripts
diff --git a/resources/views/livewire/admin/menu.blade.php b/resources/views/livewire/admin/menu.blade.php index a68ae4d..4ee3fcf 100644 --- a/resources/views/livewire/admin/menu.blade.php +++ b/resources/views/livewire/admin/menu.blade.php @@ -4,10 +4,20 @@ @livewire('layout.sidebar') @livewire('layout.header',['header'=>$pageHeader]) - + + + + - +
+ + +
+ + +
+
diff --git a/resources/views/livewire/admin/menu/level.blade.php b/resources/views/livewire/admin/menu/level.blade.php new file mode 100644 index 0000000..c4ddadd --- /dev/null +++ b/resources/views/livewire/admin/menu/level.blade.php @@ -0,0 +1,19 @@ +
+ @livewire('layout.navigation') + @livewire('layout.toggle') + @livewire('layout.sidebar') + @livewire('layout.header',['header'=>$pageHeader]) + + + + + + +
+ +
+ +
+
+
+
diff --git a/resources/views/livewire/layout/header.blade.php b/resources/views/livewire/layout/header.blade.php index afd997e..07e9826 100644 --- a/resources/views/livewire/layout/header.blade.php +++ b/resources/views/livewire/layout/header.blade.php @@ -1,4 +1,3 @@ -
{{ $header }} diff --git a/resources/views/livewire/layout/navigation-toggle.blade.php b/resources/views/livewire/layout/navigation-toggle.blade.php index 4d20ea5..25ac9aa 100644 --- a/resources/views/livewire/layout/navigation-toggle.blade.php +++ b/resources/views/livewire/layout/navigation-toggle.blade.php @@ -1,38 +1,3 @@ -{{--
--}} -{{-- --}} -{{--
--}} -{{--
--}} -{{-- --}} -{{-- --}} -{{-- --}} - -{{-- --}} -{{--
    --}} -{{--
  1. --}} -{{-- OMJ--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{--
  2. --}} -{{--
  3. --}} -{{-- Dashboard--}} -{{--
  4. --}} -{{--
--}} -{{-- --}} -{{--
--}} -{{--
--}} -{{-- --}} -{{--
--}} - - - -
@@ -61,5 +26,4 @@
-
diff --git a/resources/views/livewire/layout/navigation.blade.php b/resources/views/livewire/layout/navigation.blade.php index 0f234a7..643c640 100644 --- a/resources/views/livewire/layout/navigation.blade.php +++ b/resources/views/livewire/layout/navigation.blade.php @@ -1,3 +1,24 @@ +
+ +
+ {{--
--}} {{----}} - - - - -
- -
- diff --git a/resources/views/livewire/layout/sidebar.blade.php b/resources/views/livewire/layout/sidebar.blade.php index 9475c95..2e41aa1 100644 --- a/resources/views/livewire/layout/sidebar.blade.php +++ b/resources/views/livewire/layout/sidebar.blade.php @@ -25,6 +25,7 @@ class="flex flex-col justify-center items-center px-6 xs:!h-[128px] lg:!h-[146px + diff --git a/routes/admin.php b/routes/admin.php index 6d14de7..efb86f7 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -57,7 +57,10 @@ Route::get('/dashboard', \App\Http\Livewire\Admin\Dashboard::class)->name('dashboard'); Route::get('/profile', \App\Http\Livewire\Admin\Profile::class)->name('profile.show'); + + // Menu Route::get('/menu', \App\Http\Livewire\Admin\Menu::class)->name('menu'); + Route::get('/menu-levels', \App\Http\Livewire\Admin\Menu\Level::class)->name('menu-level'); Route::put('/profile-information', [\App\Actions\Fortify\Controllers\ProfileInformationController::class, 'update'])->name('user-profile-information.update'); Route::post('/admin/two-factor-authentication', [TwoFactorAuthenticationController::class, 'store'])->name('two-factor.enable');