| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace JeroenNoten\LaravelAdminLte\Helpers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | class PreloaderHelper | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |      * Check if the preloader animation is enabled for the specified mode. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |      * @param  string  $mode  The preloader mode to check. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 | 5 |  |     public static function isPreloaderEnabled($mode = 'fullscreen') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 | 5 |  |         return config('adminlte.preloader.enabled', false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 | 5 |  |             && config('adminlte.preloader.mode', 'fullscreen') == $mode; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      * Make and return the set of classes related to the preloader animation. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * @return string | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 23 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 24 | 1 |  |     public static function makePreloaderClasses() | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |         // Setup the base set of classes for the preloader. | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 28 | 1 |  |         $classes = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 29 | 1 |  |             'preloader', | 
            
                                                                        
                            
            
                                    
            
            
                | 30 | 1 |  |             'flex-column', | 
            
                                                                        
                            
            
                                    
            
            
                | 31 | 1 |  |             'justify-content-center', | 
            
                                                                        
                            
            
                                    
            
            
                | 32 | 1 |  |             'align-items-center', | 
            
                                                                        
                            
            
                                    
            
            
                | 33 | 1 |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |         // When the preloader is attached to the content-wrapper, the CSS | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |         // position attribute should be absolute. | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 38 | 1 |  |         if (self::isPreloaderEnabled('cwrapper')) { | 
            
                                                                        
                            
            
                                    
            
            
                | 39 | 1 |  |             $classes[] = 'position-absolute'; | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 42 | 1 |  |         return trim(implode(' ', $classes)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * Make and return the set of styles related to the preloader. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 1 |  |     public static function makePreloaderStyle() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 1 |  |         $styles = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         // When the preloader is attached to the content-wrapper, the CSS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         // z-index attribute should be less than the value of z-index for the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         // sidebars, the top navbar and the footer (they all are between 1030 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         // and 1040). This way, we avoid overlapping with those elements. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 1 |  |         if (self::isPreloaderEnabled('cwrapper')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 1 |  |             $styles[] = 'z-index:1000'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 1 |  |         return trim(implode(';', $styles)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 65 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 66 |  |  |  |