Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Revision 414 | Revision 418 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
395 lars 3
    namespace App\Http\Controllers;
2 lars 4
 
395 lars 5
    use App\Models\SalesPortal;
6
    use App\Models\SalesPortalItem;
7
    use Illuminate\Contracts\Foundation\Application;
8
    use Illuminate\Contracts\View\Factory;
9
    use Illuminate\Contracts\View\View;
2 lars 10
 
395 lars 11
    class SalesPortalItemController extends Controller
390 lars 12
    {
395 lars 13
        //
14
        //
15
        /**
16
         * @return Application|Factory|View
17
         */
18
        public function index(): View|Factory|Application
19
        {
20
            $salesPortals = SalesPortal::all();
399 lars 21
            $vPortale = array( "" => "Bitte wählen" );
398 lars 22
            foreach ( $salesPortals as $vPortal )
23
            {
24
                $vPortale[$vPortal->id] = $vPortal->name;
25
            }
26
            return view( 'salesPortal/itemPortalSelect', [ "vportale" => $vPortale, ] );
395 lars 27
        }
390 lars 28
 
417 lars 29
        public function show( SalesPortal $salesPortal ): Factory|View|Application
395 lars 30
        {
408 lars 31
            \view::share( "salesPortal", $salesPortal );
402 lars 32
            return view( "salesPortal/itemList" );
395 lars 33
        }
390 lars 34
 
395 lars 35
        /**
36
         * @return Application|Factory|View
37
         */
38
        public function create(): View|Factory|Application
39
        {
40
            return view( "salesPortal/edit" );
41
        }
390 lars 42
 
395 lars 43
        /**
44
         * @param SalesPortal $salesPortal
45
         * @return Application|Factory|View
46
         */
47
        public function edit( SalesPortal $salesPortal ): View|Factory|Application
48
        {
49
            return view( "salesPortal/edit", [ "vportal" => $salesPortal ] );
50
        }
390 lars 51
 
395 lars 52
        public function store()
53
        {
390 lars 54
 
395 lars 55
        }
390 lars 56
 
395 lars 57
        public function update()
58
        {
390 lars 59
 
395 lars 60
        }
390 lars 61
 
395 lars 62
        public function destroy()
63
        {
64
 
65
        }
66
 
417 lars 67
        public function getArtikel(): bool|string
404 lars 68
        {
414 lars 69
            $items = SalesPortalItem::where( "sales_portal_id", $_GET["vp_id"] )->get();
417 lars 70
            foreach ( $items as $id => $item )
71
            {
72
                $items[$id]->aktionen = "";
73
                if ( $items[$id]->artikel_id != 1000 )
74
                {
75
                    $items[$id]->aktionen .= '<button class="edit" id="edit_' . $items[$id]->id . '"> ändern </button>';
76
                    $items[$id]->aktionen .= '<button class="del" id="del_' . $items[$id]->id . '_' . $items[$id]->name . '"> Löschen </button>';
77
                    if ( $items[$id]->status != 9 )
78
                    {
79
                        $items[$id]->aktionen .= '<button class="lock" id="lock_' . $items[$id]->id . '_' . $items[$id]->name . '"> Sperren </button>';
80
                    }
81
                    /*if ( $bestandsUpdate )
82
                    {
83
                        $items[$id]->aktionen .= '<button class="bestandsUpdate" id="bestandsUpdate_' . $items[$id]->foreign_item_id . '_' . $vp_id . '"> Bestandsupdate </button>';
84
                    }*/
85
 
86
                    if ( $items[$id]->artikel_id == null && $items[$id]["artstamm_id"] == null )
87
                    {
88
                        $items[$id]->aktionen .= '<button class="assign" id="assign_' . $items[$id]->foreign_item_id . '"> Shopartikel zuweisen </button>';
89
                        $items[$id]->aktionen .= '<button class="del" id="del_' . $items[$id]->id . '_' . $items[$id]->name . '"> Löschen </button>';
90
                    }
91
 
92
                }
93
                else
94
                {
95
                    $items[$id]->aktionen .= '<button class="assign" id="assign_' . $items[$id]->foreign_item_id . '"> Shopartikel zuweisen </button>';
96
                    $items[$id]->aktionen .= '<button class="del" id="del_' . $items[$id]->id . '_' . $items[$id]->name . '"> Löschen </button>';
97
                }
98
            }
99
            $ret = array(
100
                "data"            => $items,
101
                "recordsTotal"    => count( $items ),
102
                "recordsFiltered" => count( $items ),
414 lars 103
            );
104
            return json_encode( $ret );
404 lars 105
        }
106
 
390 lars 107
    }