<style type="text/css">
    .extra-mar-botm{margin-bottom: 5px !important;}
</style>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2><?= print_lang($app_lang,'add_new_account'); ?></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('/accounts'); ?>"><?= print_lang($app_lang,'accounts'); ?></a>
            </li>
            <li class="active">
                <strong><?= print_lang($app_lang,'new_account'); ?></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>
    <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="accounts-form" action="<?php echo url('/accounts/save'); ?>">

                    <div class="row extra-mar-botm">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'name'); ?> <strong class="text-danger">*</strong></label>
                                <input type="text" class="form-control" name="name" placeholder="<?= print_lang($app_lang,'name'); ?>">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label><?= print_lang($app_lang,'under_ac'); ?> <strong class="text-danger">*</strong></label>
                                <select class="chosen-select form-control" name="type">
                                    <option selected="" value=""><?= print_lang($app_lang,'select'); ?></option>
                                    <?php foreach($root_accounts as $row){ ?>
                                        <option value="<?= $row['uid']; ?>"><?= ($row['branch'] == 'general') ? print_lang($app_lang,'builtin_account_'.$row['uid']) : $row['name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="shared-account-row display-none">
                        <div class="row extra-mar-botm">
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'shared'); ?></label>
                                    <div style="margin-top: 10px;">
                                        <label class="checkbox-inline i-checks">
                                            <input type="radio" name="shared" value="yes" id="shared_yes"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'shared_yes'); ?>
                                        </label>
                                        <label class="checkbox-inline i-checks" style="margin-left: 30px;">
                                            <input type="radio" name="shared" value="no" checked id="shared_no"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'shared_no'); ?>
                                        </label>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-3 customer-user-col-data display-none">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'is_user'); ?></label>
                                    <div style="margin-top: 10px;">
                                        <label class="checkbox-inline i-checks">
                                            <input type="radio" name="is_user" value="yes" id="is_user_yes"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'is_user_yes'); ?>
                                        </label>
                                        <label class="checkbox-inline i-checks" style="margin-left: 30px;">
                                            <input type="radio" name="is_user" value="no" checked id="is_user_no"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'is_user_no'); ?>
                                        </label>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-3 customer-user-col-data display-none">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'account_username'); ?></label>
                                    <input type="text" class="form-control" readonly name="username" placeholder="<?= print_lang($app_lang,'account_username'); ?>">
                                </div>
                            </div>

                            <div class="col-md-3 customer-user-col-data display-none">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'account_password'); ?></label>
                                    <input type="password" class="form-control" readonly name="password" placeholder="<?= print_lang($app_lang,'account_password'); ?>">
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- client type row -->
                    <div class="client-category-row-expand display-none">
                        <div class="row extra-mar-botm">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'client_account_type'); ?></label>
                                    <div style="margin-top: 10px;">
                                        <label class="checkbox-inline i-checks">
                                            <input type="radio" name="client_type" checked value="general"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'client_account_radio_general'); ?>
                                        </label>

                                        <label class="checkbox-inline i-checks">
                                            <input type="radio" name="client_type" value="category"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'client_account_radio_category'); ?>
                                        </label>

                                        <label class="checkbox-inline i-checks">
                                            <input type="radio" name="client_type" value="sales_man"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'client_account_radio_sales_man'); ?>
                                        </label>

                                        <label class="checkbox-inline i-checks">
                                            <input type="radio" name="client_type" value="marketer"> &nbsp;&nbsp;&nbsp; <?= print_lang($app_lang,'client_account_radio_marketer'); ?>
                                        </label>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="client-categories-select display-none">
                                    <div class="form-group">
                                        <label><?= print_lang($app_lang,'client_dp_client_categories'); ?> <strong class="text-danger">*</strong></label>
                                        <select class="chosen-select form-control" name="category">
                                            <option selected="" value=""><?= '--'.print_lang($app_lang,'client_dp_client_categories').'--'; ?></option>
                                            <?php foreach($client_categories as $row){ ?>
                                                <option value="<?= $row['uid']; ?>"><?= $row['name']; ?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>

                                <div class="client-sales-man-select display-none">
                                    <div class="form-group">
                                        <label><?= print_lang($app_lang,'client_dp_sales_man'); ?> <strong class="text-danger">*</strong></label>
                                        <select class="chosen-select form-control" name="sales_man">
                                            <option selected="" value=""><?= '--'.print_lang($app_lang,'client_dp_sales_man').'--'; ?></option>
                                            <?php foreach($sales_man as $row){ ?>
                                                <option value="<?= $row['uid']; ?>"><?= $row['name']." ".$row['last_name']; ?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>

                                <div class="client-marketer-select display-none">
                                    <div class="form-group">
                                        <label><?= print_lang($app_lang,'client_dp_marketer'); ?> <strong class="text-danger">*</strong></label>
                                        <select class="chosen-select form-control" name="marketer">
                                            <option selected="" value=""><?= '--'.print_lang($app_lang,'client_dp_marketer').'--'; ?></option>
                                            <?php foreach($marketers as $row){ ?>
                                                <option value="<?= $row['uid']; ?>"><?= $row['name']." ".$row['last_name']; ?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- accounts-form-expended-makups -->
                    <div class="accounts-form-expended-makups display-none">
                        
                        <div class="row extra-mar-botm">
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'code'); ?></label>
                                    <input type="text" class="form-control" name="code" value="<?= $code; ?>" placeholder="<?= print_lang($app_lang,'code'); ?>">
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'mobile'); ?></label>
                                    <input type="text" class="form-control" name="mobile" placeholder="<?= print_lang($app_lang,'mobile'); ?>">
                                </div>
                            </div>
                            <div class="col-md-3">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'email'); ?></label>
                                    <input type="text" class="form-control" name="email" placeholder="<?= print_lang($app_lang,'email'); ?>">
                                </div>
                            </div>
                            <div class="col-md-3 text-right">
                                <a href="javascript:void(0);" id="opening-balance-add-trigger" data-lang-amount-iput="<?= print_lang($app_lang,'amount'); ?>" data-lang-debit-iput="<?= print_lang($app_lang,'account_opening_balance_debit'); ?>" data-lang-credit-iput="<?= print_lang($app_lang,'account_opening_balance_credit'); ?>" data-lang-currency-iput="<?= print_lang($app_lang,'account_opening_balance_currency'); ?>" style="margin-top: 28px;" class="btn btn-sm btn-outline btn-primary"><i class="fa fa-plus"></i>&nbsp; <?= print_lang($app_lang,'add_opening_balance'); ?></a>
                            </div>
                        </div>

                        <!-- account-opening-balance-wrap -->
                        <div id="account-opening-balance-wrap"></div>

                        <div class="row extra-mar-botm">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'memo'); ?> <strong class="text-danger">*</strong></label>
                                    <textarea class="form-control" name="memo" placeholder="<?= print_lang($app_lang,'memo'); ?>" rows="3"></textarea>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label><?= print_lang($app_lang,'address'); ?> </label>
                                    <textarea class="form-control" name="address" placeholder="<?= print_lang($app_lang,'address'); ?>" rows="3"></textarea>
                                </div>
                            </div>
                        </div>

                    </div>
                    <!-- accounts-form-expended-makups -->

                    <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('/accounts'); ?>"><?= 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>



<div class="display-none" id="currency-options-wrapper">
    <?php foreach($currencies as $row){ ?>
        <option value="<?= $row['uid']; ?>"><?= $row['name']; ?></option>
    <?php } ?>
</div>
