From 825876169177126e095f52bef587ab281cc45847 Mon Sep 17 00:00:00 2001 From: Bruno Fontes Date: Sun, 16 Sep 2018 16:18:49 -0300 Subject: [PATCH] Restyling / refactoring ITEM --- resources/views/item.blade.php | 63 ++++----------------- resources/views/item/buttons.blade.php | 24 -------- resources/views/item/deleteButton.blade.php | 28 +++++++++ resources/views/item/editButton.blade.php | 32 +++++++++++ resources/views/item/otherItems.blade.php | 17 ++++++ resources/views/item/users.blade.php | 37 ++++++++++++ 6 files changed, 125 insertions(+), 76 deletions(-) delete mode 100644 resources/views/item/buttons.blade.php create mode 100644 resources/views/item/deleteButton.blade.php create mode 100644 resources/views/item/editButton.blade.php create mode 100644 resources/views/item/otherItems.blade.php create mode 100644 resources/views/item/users.blade.php diff --git a/resources/views/item.blade.php b/resources/views/item.blade.php index 7462e8c..2f816ba 100644 --- a/resources/views/item.blade.php +++ b/resources/views/item.blade.php @@ -6,8 +6,13 @@
- Item: {{$item->name}} - @include ('item.buttons') + {{$item->name}} + +
+ @include ('item.editButton') + @include ('item.deleteButton') +
+
@@ -16,61 +21,15 @@
@endif - Other items from the same product: -
    - @forelse ($otherItems as $otherItem) - @if (!$otherItem->used_by) -
  • {{ $otherItem->name }}
  • - @endif - @empty -

    There are no items yet. Include one with the form above.

    - @endforelse -
+ @include('item.users')
-
-
- Users of this item -
-
- Users that has access to this item: -
    - @forelse ($users as $user) -
    -
  • - {{ $user->name }} ({{ $user->email}}) -
    -
    - {{ csrf_field() }} - @method('DELETE') - - - -
    -
  • - @empty -

    There are no items yet. Include one with the form above.

    - @endforelse -
-
- Add user -
-
- {{ csrf_field() }} -
-
- -
-
-
-
- @include ('layouts.errors') + @include ('item.otherItems') -
-
-
BACK
+ +
BACK
diff --git a/resources/views/item/buttons.blade.php b/resources/views/item/buttons.blade.php deleted file mode 100644 index 3435755..0000000 --- a/resources/views/item/buttons.blade.php +++ /dev/null @@ -1,24 +0,0 @@ - -
- - - - @if ($item->product->user_id == \Auth::id()) -
- @method('PATCH') - -
- @endif - - - -
- @method('DELETE') - {{ csrf_field() }} - - -
- - -
-
\ No newline at end of file diff --git a/resources/views/item/deleteButton.blade.php b/resources/views/item/deleteButton.blade.php new file mode 100644 index 0000000..cc49276 --- /dev/null +++ b/resources/views/item/deleteButton.blade.php @@ -0,0 +1,28 @@ + + + + \ No newline at end of file diff --git a/resources/views/item/editButton.blade.php b/resources/views/item/editButton.blade.php new file mode 100644 index 0000000..a013282 --- /dev/null +++ b/resources/views/item/editButton.blade.php @@ -0,0 +1,32 @@ + + + + \ No newline at end of file diff --git a/resources/views/item/otherItems.blade.php b/resources/views/item/otherItems.blade.php new file mode 100644 index 0000000..f59513f --- /dev/null +++ b/resources/views/item/otherItems.blade.php @@ -0,0 +1,17 @@ +
+
+ Other items from the same product +
+ +
+
    + @forelse ($otherItems as $otherItem) + @if (!$otherItem->used_by) +
  • {{ $otherItem->name }}
  • + @endif + @empty +

    There are no items yet. Include one with the form above.

    + @endforelse +
+
+
\ No newline at end of file diff --git a/resources/views/item/users.blade.php b/resources/views/item/users.blade.php new file mode 100644 index 0000000..d45b16e --- /dev/null +++ b/resources/views/item/users.blade.php @@ -0,0 +1,37 @@ +

Users:

+@forelse ($users as $user) + @if (!$loop->first) +
+ @endif + {{ $user->name }} ({{ $user->email}}) +
+
+
+ {{ csrf_field() }} + @method('DELETE') + + + +
+
+
+@empty +

There are no items yet. Include one with the form above.

+@endforelse + + + +
+
+

Add user

+
+
+ {{ csrf_field() }} +
+
+ +
+
+
+
+@include ('layouts.errors') \ No newline at end of file