<style type="text/css">
    .blink_me {
      animation: blinker 0.8s linear infinite;
    }

    @keyframes blinker {
      50% {
        opacity: 0;
      }
    }
</style>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2><?= print_lang($app_lang,'add_new_journal'); ?></h2>
        <ol class="breadcrumb">
            <li>
                <a class="url-elem" href="<?php echo url('/dashboard'); ?>"><?= print_lang($app_lang,'home'); ?></a>
            </li>
            <li>
                <a class="url-elem" href="<?php echo url('/journal'); ?>"><?= print_lang($app_lang,'journal'); ?></a>
            </li>
            <li class="active">
                <strong><?= print_lang($app_lang,'new_journal'); ?></strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2">
    </div>
</div>


<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox-title">
        <h5><?= print_lang($app_lang,'fields_with'); ?> <strong class="text-danger">*</strong> <?= print_lang($app_lang,'are_mandatory'); ?></h5>

        <div class="text-<?php if($app_direction == 'rtl'){echo 'left';}else{echo 'right';} ?>">
            <input style="width: 100px; border: none; background: #e0e0e0; padding: 9px 5px; text-align: center; border-radius: 2px; color: black;" type="text" class="pointer-none" value="<?= print_lang($app_lang,'add_entry_jv_num').''.get_serial_id('journal'); ?>" readonly="">
        </div>
    </div>
    <div class="ibox-content">
        <!-- 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="journal-form" action="<?php echo url('/journal/save'); ?>">

                    <div class="row extra-mar-botm">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'date'); ?> <strong class="text-danger">*</strong></label>
                                <?php $edate = display_true_date( date('y-m-d') ); ?>
                                <?php if($branch_calander == 'persian'){ ?>
                                    <input type="text" class="form-control persian-date" name="journal_date" value="<?= true_date_for_inputs($edate); ?>" placeholder="<?= print_lang($app_lang,'date'); ?>" readonly="" style="background: #fff;">
                                <?php }else{ ?>
                                    <input type="date" class="form-control" value="<?= date("Y-m-d",strtotime(true_date_for_inputs($edate))); ?>" name="journal_date">
                                <?php } ?>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'receiving_currency'); ?> <strong class="text-danger">*</strong></label>
                                <select class="form-control chosen-select" name="receiving_currency">
                                    <option disabled="" selected="">-- <?= print_lang($app_lang,'select_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-4">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'payment_currency'); ?> <strong class="text-danger">*</strong></label>
                                <select class="form-control chosen-select" name="payment_currency">
                                    <option disabled="" selected="">-- <?= print_lang($app_lang,'select_currency'); ?> --</option>
                                    <?php foreach($currencies as $row){ ?>
                                        <option value="<?= $row['uid']; ?>" data-rate="<?= $row['usd_equalance']; ?>"><?= $row['name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="row extra-mar-botm" style="margin-bottom: 3px !important;">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'receiving_account'); ?> <strong class="text-danger">*</strong><span class="blink_me" style="font-size: 14px; font-weight: 700; color: red;" id="receiving_account_span"></span></label>
                                <select class="form-control chosen-select" name="receiving_account">
                                    <option disabled="" selected="">-- <?= print_lang($app_lang,'select_account'); ?> --</option>
                                    <?php foreach($accounts as $row){ ?>
                                        <option value="<?= $row['uid']; ?>"><?= $row['display_name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'payment_account'); ?> <strong class="text-danger">*</strong><span class="blink_me" style="font-size: 14px; font-weight: 700; color: red;" id="payment_account_span"></span></label>
                                <select class="form-control chosen-select" name="payment_account">
                                    <option disabled="" selected="">-- <?= print_lang($app_lang,'select_account'); ?> --</option>
                                    <?php foreach($accounts as $row){ ?>
                                        <option value="<?= $row['uid']; ?>"><?= $row['display_name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="row journal-rate-row pointer-none display-none" style="width: 60%; margin: 0 auto;">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'calculation_type'); ?></label>
                                <div style="margin-top: 10px;">
                                    <label class="checkbox-inline i-checks">
                                        <input type="radio" name="calculation_type" value="multiply" checked> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'calculation_type_multiply'); ?>
                                    </label>
                                    <label class="checkbox-inline i-checks" style="margin-left: 30px;">
                                        <input type="radio" name="calculation_type" value="divide"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'calculation_type_divide'); ?>
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'journal_rate'); ?> <strong class="text-danger">*</strong> <span class="text-danger" style="font-size: 10px;"><?= print_lang($app_lang,'journal_rate_note'); ?></span></label>
                                <input type="number" class="form-control" name="rate" value="1" placeholder="<?= print_lang($app_lang,'journal_rate'); ?>">
                            </div>
                        </div>
                    </div>

                    <div class="row extra-mar-botm">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'receiving_amount'); ?> <strong class="text-danger">*</strong></label>
                                <input type="number" class="form-control" name="receiving_amount" placeholder="<?= print_lang($app_lang,'receiving_amount'); ?>">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'payment_amount'); ?> <strong class="text-danger">*</strong></label>
                                <input type="number" class="form-control" name="payment_amount" placeholder="<?= print_lang($app_lang,'payment_amount'); ?>">
                            </div>
                        </div>
                    </div>

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

                    <div class="row extra-mar-botm extra-income-row display-none">
                        <div class="col-md-12" style="margin-bottom: 10px;">
                            <h4 style="margin-bottom: 0px;"><?= print_lang($app_lang,'extra_income_title'); ?></h4>
                            <span class="extra_income_note_span text-info" style="font-size: 12px;"><?= print_lang($app_lang,'extra_income_note'); ?></span>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>
                                    <?= print_lang($app_lang,'extra_income_account'); ?>
                                </label>
                                <select class="form-control chosen-select" name="extra_income_account">
                                    <option disabled="" selected="" value="">-- <?= print_lang($app_lang,'select_account'); ?> --</option>
                                    <?php foreach($accounts as $row){ ?>
                                        <option value="<?= $row['uid']; ?>"><?= $row['display_name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'extra_income_amount'); ?></label>
                                <input class="form-control" name="extra_income_amount" placeholder="<?= print_lang($app_lang,'extra_income_amount'); ?>" readonly>
                            </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('/journal'); ?>"><?= print_lang($app_lang,'cancel'); ?></a>
                            <button class="btn btn-w-m btn-primary" type="submit"><?= print_lang($app_lang,'save'); ?></button>
                        </div>
                    </div>

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

</div>