i m p o r t   {   u s e E f f e c t   }   f r o m   " r e a c t " ; 
 
 i m p o r t   {   u s e N a v i g a t e ,   u s e P a r a m s   }   f r o m   " r e a c t - r o u t e r - d o m " ; 
 
 i m p o r t   {   u s e F o r m i k   }   f r o m   " f o r m i k " ; 
 
 i m p o r t   {   S a v e   }   f r o m   " l u c i d e - r e a c t " ; 
 
 i m p o r t   {   P a g e W r a p p e r   }   f r o m   " . . / . . / . . / c o m p o n e n t s / l a y o u t s / P a g e W r a p p e r " ; 
 
 i m p o r t   {   B u t t o n   }   f r o m   " . . / . . / . . / c o m p o n e n t s / c u s t o m s / B u t t o n " ; 
 
 i m p o r t   {   u s e A s s e t T y p e   }   f r o m   " . . / h o o k / u s e A s s e t T y p e " ; 
 
 i m p o r t   {   a s s e t T y p e S c h e m a   }   f r o m   " . . / v a l i d a t i o n / a s s e t - t y p e s . s c h e m a " ; 
 
 i m p o r t   t y p e   {   A s s e t T y p e C r e a t e R e q u e s t   }   f r o m   " . . / t y p e s / a s s e t - t y p e s . t y p e s " ; 
 
 i m p o r t   {   B r e a d c r u m b   }   f r o m   " . . / . . / . . / c o m p o n e n t s / l a y o u t s / B r e a d c r u m b " ; 
 
 
 
 c o n s t   S T A T U S _ O P T I O N S   =   [ 
 
     {   v a l u e :   ' a c t i v e ' ,   l a b e l :   ' A c t i v e '   } , 
 
     {   v a l u e :   ' i n a c t i v e ' ,   l a b e l :   ' I n a c t i v e '   } , 
 
 ] ; 
 
 
 
 c o n s t   i n p u t C l a s s   =   ( e r r o r ? :   b o o l e a n )   = >   
 
     ` w - f u l l   b o r d e r   $ { e r r o r   ?   ' b o r d e r - r e d - 5 0 0   f o c u s : r i n g - r e d - 5 0 0 '   :   ' b o r d e r - g r a y - 2 0 0   f o c u s : r i n g - p u r p l e - 5 0 0 ' }   r o u n d e d - l g   p x - 3   p y - 2 . 5   t e x t - s m   f o c u s : o u t l i n e - n o n e   f o c u s : r i n g - 2   f o c u s : b o r d e r - t r a n s p a r e n t   t r a n s i t i o n - s h a d o w   b g - w h i t e ` ; 
 
 c o n s t   e r r o r C l a s s   =   ' t e x t - x s   t e x t - r e d - 5 0 0   m t - 1 ' ; 
 
 c o n s t   l a b e l C l a s s   =   ' b l o c k   t e x t - s m   f o n t - m e d i u m   t e x t - g r a y - 7 0 0   m b - 1 . 5 ' ; 
 
 
 
 e x p o r t   d e f a u l t   f u n c t i o n   N e w A s s e t T y p e ( )   { 
 
     c o n s t   n a v i g a t e   =   u s e N a v i g a t e ( ) ; 
 
     c o n s t   {   i d   }   =   u s e P a r a m s < {   i d ? :   s t r i n g   } > ( ) ; 
 
     c o n s t   i s E d i t   =   B o o l e a n ( i d ) ; 
 
 
 
     c o n s t   {   c r e a t e I t e m ,   u p d a t e I t e m ,   i t e m s ,   f e t c h I t e m s   }   =   u s e A s s e t T y p e ( ) ; 
 
 
 
     u s e E f f e c t ( ( )   = >   { 
 
         f e t c h I t e m s ( ) ; 
 
         / /   e s l i n t - d i s a b l e - n e x t - l i n e   r e a c t - h o o k s / e x h a u s t i v e - d e p s 
 
     } ,   [ ] ) ; 
 
 
 
     c o n s t   f o r m i k   =   u s e F o r m i k ( { 
 
         i n i t i a l V a l u e s :   { 
 
             n a m e :   " " , 
 
             s t a t u s :   " a c t i v e "   a s   " a c t i v e "   |   " i n a c t i v e " , 
 
         } , 
 
         v a l i d a t i o n S c h e m a :   a s s e t T y p e S c h e m a , 
 
         o n S u b m i t :   a s y n c   ( v a l u e s ,   {   s e t S u b m i t t i n g   } )   = >   { 
 
             t r y   { 
 
                 i f   ( i s E d i t   & &   i d )   { 
 
                     a w a i t   u p d a t e I t e m ( i d ,   v a l u e s   a s   a n y ) ; 
 
                 }   e l s e   { 
 
                     a w a i t   c r e a t e I t e m ( v a l u e s   a s   A s s e t T y p e C r e a t e R e q u e s t ) ; 
 
                 } 
 
                 n a v i g a t e ( " . . " ) ; 
 
             }   c a t c h   { 
 
                 / /   H a n d l e d   b y   s e r v i c e / h o o k 
 
             }   f i n a l l y   { 
 
                 s e t S u b m i t t i n g ( f a l s e ) ; 
 
             } 
 
         } , 
 
     } ) ; 
 
 
 
     u s e E f f e c t ( ( )   = >   { 
 
         i f   ( i s E d i t   & &   i d   & &   i t e m s . l e n g t h   >   0 )   { 
 
             c o n s t   m a t c h   =   i t e m s . f i n d ( ( i t e m )   = >   i t e m . i d   = = =   i d ) ; 
 
             i f   ( m a t c h )   { 
 
                 f o r m i k . s e t V a l u e s ( { 
 
                     n a m e :   m a t c h . n a m e , 
 
                     s t a t u s :   m a t c h . s t a t u s   a s   " a c t i v e "   |   " i n a c t i v e " , 
 
                 } ) ; 
 
             } 
 
         } 
 
         / /   e s l i n t - d i s a b l e - n e x t - l i n e   r e a c t - h o o k s / e x h a u s t i v e - d e p s 
 
     } ,   [ i s E d i t ,   i d ,   i t e m s ] ) ; 
 
 
 
     r e t u r n   ( 
 
         < P a g e W r a p p e r > 
 
             < B r e a d c r u m b 
 
                 i t e m s = { [ {   l a b e l :   ' H o m e '   } ,   {   l a b e l :   ' A s s e t   T y p e s ' ,   h r e f :   ' / a s s e t - t y p e s '   } ,   {   l a b e l :   i s E d i t   ?   ' E d i t   A s s e t   T y p e '   :   ' C r e a t e   A s s e t   T y p e '   } ] } 
 
                 b a c k T o = " / a s s e t - t y p e s " 
 
                 a c t i o n s = { 
 
                     < > 
 
                         < B u t t o n   v a r i a n t = " o u t l i n e "   s i z e = " m d "   t y p e = " b u t t o n "   o n C l i c k = { ( )   = >   n a v i g a t e ( ' . . ' ) }   d i s a b l e d = { f o r m i k . i s S u b m i t t i n g } > C a n c e l < / B u t t o n > 
 
                         < B u t t o n   v a r i a n t = " p r i m a r y "   s i z e = " m d "   t y p e = " s u b m i t "   f o r m = " a s s e t - t y p e - f o r m "   i c o n = { < S a v e   c l a s s N a m e = " w - 4   h - 4 "   / > }   l o a d i n g = { f o r m i k . i s S u b m i t t i n g } > { i s E d i t   ?   ' U p d a t e   A s s e t   T y p e '   :   ' C r e a t e   A s s e t   T y p e ' } < / B u t t o n > 
 
                     < / > 
 
                 } 
 
             / > 
 
             < f o r m   i d = " a s s e t - t y p e - f o r m "   o n S u b m i t = { f o r m i k . h a n d l e S u b m i t }   c l a s s N a m e = " m a x - w - 4 x l   s p a c e - y - 1 0 " > 
 
                 < d i v > 
 
                     < h 2   c l a s s N a m e = " t e x t - l g   f o n t - s e m i b o l d   t e x t - g r a y - 9 0 0   m b - 6   b o r d e r - b   b o r d e r - g r a y - 2 0 0   p b - 2 " > I n f o r m a t i o n < / h 2 > 
 
                     < d i v   c l a s s N a m e = " g r i d   g r i d - c o l s - 1   m d : g r i d - c o l s - 2   g a p - 6 " > 
 
                         < d i v   c l a s s N a m e = " m d : c o l - s p a n - 2 " > 
 
                             < l a b e l   c l a s s N a m e = { l a b e l C l a s s } > N a m e   * < / l a b e l > 
 
                             < i n p u t   
 
                                 n a m e = " n a m e " 
 
                                 c l a s s N a m e = { i n p u t C l a s s ( f o r m i k . t o u c h e d . n a m e   & &   B o o l e a n ( f o r m i k . e r r o r s . n a m e ) ) }   
 
                                 v a l u e = { f o r m i k . v a l u e s . n a m e }   
 
                                 o n C h a n g e = { f o r m i k . h a n d l e C h a n g e }   
 
                                 o n B l u r = { f o r m i k . h a n d l e B l u r } 
 
                                 p l a c e h o l d e r = " e . g .   I m a g e "   
 
                             / > 
 
                             { f o r m i k . t o u c h e d . n a m e   & &   f o r m i k . e r r o r s . n a m e   & &   < p   c l a s s N a m e = { e r r o r C l a s s } > { f o r m i k . e r r o r s . n a m e } < / p > } 
 
                         < / d i v > 
 
                         
 
                         < d i v   c l a s s N a m e = " m d : c o l - s p a n - 2 " > 
 
                             < l a b e l   c l a s s N a m e = { l a b e l C l a s s } > S t a t u s < / l a b e l > 
 
                             < s e l e c t   
 
                                 n a m e = " s t a t u s " 
 
                                 c l a s s N a m e = { i n p u t C l a s s ( ) }   
 
                                 v a l u e = { f o r m i k . v a l u e s . s t a t u s }   
 
                                 o n C h a n g e = { f o r m i k . h a n d l e C h a n g e } 
 
                                 o n B l u r = { f o r m i k . h a n d l e B l u r } 
 
                             > 
 
                                 { S T A T U S _ O P T I O N S . m a p ( ( s )   = >   ( 
 
                                     < o p t i o n   k e y = { s . v a l u e }   v a l u e = { s . v a l u e } > { s . l a b e l } < / o p t i o n > 
 
                                 ) ) } 
 
                             < / s e l e c t > 
 
                         < / d i v > 
 
                     < / d i v > 
 
                 < / d i v > 
 
 
 
             < / f o r m > 
 
         < / P a g e W r a p p e r > 
 
     ) ; 
 
 } 
 
 