<?php
namespace admin\controls;
class GlobelusFirms
{
  public static function order_fvat_switch()
  {
    \admin\factory\GlobelusFirms::order_fvat_switch( \S::get( 'order-id' ) );
    header( 'Location: /admin/globelus_firms/orders_list/' );
    exit;
  }
  
  public static function points_history()
  {
    return \Tpl::view( 'globelus-firms/points-history' );
  }
  
  public static function orders_list()
  {
    return \Tpl::view( 'globelus-firms/orders-list' );
  }
  
  public static function firm_enabled()
  {
    if ( \admin\factory\GlobelusFirms::firm_enabled( \S::get( 'id' ) ) )
      \S::alert( 'Profil został aktywowany.' );

    header( 'Location: /admin/globelus_firms/firm_preview/id=' . \S::get( 'id' ) );
    exit;
  }
  
  public static function firm_preview()
  {
    return \admin\view\GlobelusFirms::firm_preview(
              \admin\factory\GlobelusFirms::firm_details( \S::get( 'id' ) ),
              \front\factory\GlobelusAdverts::categories(),
              \front\factory\Globelus::countries()
            );
  }
  
  public static function firm_delete()
  {
    if ( \admin\factory\GlobelusFirms::firm_delete( \S::get( 'id' ) ) )
      \S::alert( 'Profil pracodawcy został usunięty.' );

    header( 'Location: /admin/globelus_firms/main_view/' );
    exit;
  }
  
  public static function main_view()
  {
    return \admin\view\GlobelusFirms::main_view();
  }
}
