<?php if(is_sales_man_user() === true){ ?>
<style type="text/css">
  .navbar-default.navbar-static-side{display: none !important;}
  #page-wrapper{width: 100%; margin: 0;}
  .footer.fixed{margin: 0;}

  .blink_me {
    animation: blinker 0.6s linear infinite;
  }

  @keyframes blinker {
    50% {
      opacity: 0;
    }
  }
</style>
<?php } ?>

<?php if(is_marketer_user() === true){ ?>
<style type="text/css">
  .blink_me {
    animation: blinker 0.9s linear infinite;
  }

  @keyframes blinker {
    50% {
      opacity: 0;
    }
  }
</style>
<?php } ?>


<?php
    $account = null;
    if(is_marketer_user() === true)
    { 
        $marketer = get_active_marketer();
        $marketer_data = fetch_table_where('marketers','uid',$marketer,true);
        $account = $marketer_data['account'];
    }
    if(is_sales_man_user() === true)
    { 
        $salesman = get_active_sales_man();
        $sales_man_data = fetch_table_where('sales_man','uid',$salesman,true);
        $account = $sales_man_data['account'];
    }
?>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox-title text-center">
        <h3><?= print_lang($app_lang,'activity_add_title'); ?></h3>
    </div>
    <div class="ibox-title">
        <h5><?= print_lang($app_lang,'fields_with'); ?> <strong class="text-danger">*</strong> <?= print_lang($app_lang,'are_mandatory'); ?></h5>
    </div>
    <div class="ibox-content">
        <?php if(empty($account)){?>
            <h5 class="text-danger blink_me">Debit account not selected. Please ask admin to select your admin account and reload the page to make activity..</h5>
        <?php } ?>
        <!-- spinner -->
        <div class="sk-spinner sk-spinner-three-bounce">
            <div class="sk-bounce1"></div>
            <div class="sk-bounce2"></div>
            <div class="sk-bounce3"></div>
        </div>
        <!-- spinner -->
        <div class="row">
            <div class="col-sm-12 b-r">
                <form role="form" id="activities-form" action="<?php echo url('/activities/save'); ?>">
                    <input type="hidden" name="debit_account" value="<?php echo $account; ?>">
                    <div class="row extra-mar-botm">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'activity_add_input_currency'); ?> <strong class="text-danger">*</strong></label>
                                <select class="form-control chosen-select" name="currency">
                                    <option disabled="" selected="">-- <?= print_lang($app_lang,'activity_add_input_currency'); ?> --</option>
                                    <?php foreach($currencies as $row){ ?>
                                        <option value="<?= $row['uid']; ?>" data-rate="<?= $row['usd_equalance']; ?>"><?= $row['name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div> 

                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'activity_add_input_amount'); ?> <strong class="text-danger">*</strong></label>
                                <input type="text" class="form-control" name="amount" placeholder="<?= print_lang($app_lang,'activity_add_input_amount'); ?>">
                            </div>
                        </div>                                           
                    </div>

                    <div class="row extra-mar-botm">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'activity_add_input_narration'); ?></label>
                                <textarea class="form-control" name="narration" rows="2" placeholder="<?= print_lang($app_lang,'activity_add_input_narration'); ?>"></textarea>
                            </div>
                        </div>
                    </div>

                    <div class="row extra-mar-botm">
                        <div class="col-md-12 text-right">
                            <a class="btn btn-w-m btn-outline btn-danger url-elem" href="<?php echo url('/activities'); ?>"><?= print_lang($app_lang,'cancel'); ?></a>
                            <button class="btn btn-w-m btn-primary <?php if(empty($account)){echo 'pointer-none';}?>" type="submit"><?= print_lang($app_lang,'save'); ?></button>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>

</div>