<?php
include VIEWPATH . 'front/theme1/header.php';
$get_current_currency = dt_get_current_currency();
$app_site_setting=dt_app_site_setting();


$is_breadcrumb_enabled=dt_get_content('is_breadcrumb_enabled');
$banner_content=dt_get_content_image('donation_background');
$banner_image_path = base_url() . img_path . "/donation.jpg";

if (isset($banner_content) && $banner_content!= "") {
    if (file_exists(FCPATH .uploads_path.'/'.$banner_content)) {
        $banner_image_path = base_url() . uploads_path . '/' .$banner_content;
    }
}
$dt_get_all_payment_setting=dt_get_all_payment_setting();
?>
<input type="hidden" id="get_current_currency_hidden" value="<?php echo $get_current_currency['code']; ?>" />
<input type="hidden" id="get_stripepublish" value="<?php echo dt_get_Stripepublish(); ?>" />
<section class="ftco-section" id="asdn">
    <div class="container mt-5">
        <div class="row justify-content-center">
            <div class="col-md-6 pl-md-5 ftco-animate">
                <div class="card">
                    <div class="card-body">
                        <?php if(dt_check_payment_method('offline')==false && dt_check_payment_method('paystack')==false && dt_check_payment_method('flutterwave')==false && dt_check_payment_method('paypal')==false && dt_check_payment_method('stripe')==false && dt_check_payment_method('razorpay')==false) :?>
                            <div class="form-content">
                                <div class="col-md-10 text-left">
                                    <?php $this->load->view('message'); ?>
                                    <div>
                                        <h3><?php echo dt_translate('slogan_one') ?></h3>
                                        <p class="mt-5 mb-5"><?php echo dt_translate('currently_not_available'); ?></p>
                                    </div>
                                </div>
                            </div>
                        <?php else: ?>
                            <div class="form-content">
                                <div class="col-md-12 text-left">
                                    <?php $this->load->view('message'); ?>
                                    <h3><?php echo dt_translate('slogan_one') ?></h3>
                                    <p><?php echo dt_translate('slogan_two') ?></p>
                                    <br/>
                                    <?php
                                    $attributes = array('id' => 'donationForm', 'name' => 'donationForm', 'method' => "post");
                                    echo form_open('donate-action', $attributes);
                                    ?>
                                    <input type="hidden" id="cause_id" name="cause_id" value="0">
                                    <input type="hidden" id="phone_code" name="phone_code">
                                    <input name="donation_type" value="donation" type="hidden" />
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input autocomplete="off" data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" class="form-control" type="text" name="first_name" id="first_name" placeholder="<?php echo dt_translate('first_name') ?>" required>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input autocomplete="off" data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" class="form-control" type="text" name="last_name" id="last_name" placeholder="<?php echo dt_translate('last_name') ?>" required>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input autocomplete="off" data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" data-msg-email="<?php echo dt_translate('enter_valid_email'); ?>"  class="form-control" type="email" name="email" id="email" placeholder="<?php echo dt_translate('email') ?>" required>
                                            </div>
                                        </div>

                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input autocomplete="off"  data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" class="form-control phone_input_with_code" maxlength="18" type="tel"  onkeypress='validatePhone(event)'  id="phone" name="phone" placeholder="<?php echo dt_translate('phone') ?>" required>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <input autocomplete="off" data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" class="form-control" type="text" maxlength="50" id="city" name="city" placeholder="<?php echo dt_translate('city') ?>" required>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <span class="input-symbol-euro">
                                                     <input autocomplete="off" data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" class="form-control" type="number" min="1" id="amount" name="amount" placeholder="<?php echo dt_translate('amount')." (".$get_current_currency['currency_code'].")"; ?>" required>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label><?php echo dt_translate('donation_towards'); ?></label>
                                                <select data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" required class="form-control" id="category_id" name="category_id">
                                                    <option value=""><?php echo dt_translate('select'); ?></option>
                                                    <?php foreach ($app_donation_category as $val): ?>
                                                        <option value="<?php echo $val['id']; ?>"><?php echo $val['title']; ?></option>
                                                    <?php endforeach; ?>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div id="emotion">
                                        <?php if (dt_check_payment_method('paypal')): ?>
                                            <input required type="radio" name="payment_by" id="happy" value="paypal" />
                                            <label for="happy"><img class="width_100px" src="<?php echo base_url('assets/images/paypal_1.png') ?>" alt="PayPal" /></label>
                                        <?php endif; ?>

                                        <?php if (dt_check_payment_method('stripe')): ?>
                                            <input required type="radio" name="payment_by" id="stripe_in" value="stripe" />
                                            <label for="stripe_in"><img class="width_100px" src="<?php echo base_url('assets/images/stripe_1.png') ?>" alt="Stripe" /></label>
                                        <?php endif; ?>

                                        <?php if (dt_check_payment_method('razorpay')): ?>
                                            <input required type="radio" name="payment_by" id="razorpay_in" value="razorpay" />
                                            <label for="razorpay_in"><img class="width_100px" src="<?php echo base_url('assets/images/razorpay_1.png') ?>" alt="razorpay" /></label>
                                        <?php endif; ?>

                                        <?php if (dt_check_payment_method('flutterwave')): ?>
                                            <input required type="radio" name="payment_by" id="flutterwave_in" value="flutterwave" />
                                            <label for="flutterwave_in"><img class="width_100px" src="<?php echo base_url('assets/images/flutterwave_1.png') ?>" alt="flutterwave" /></label>
                                        <?php endif; ?>

                                        <?php if (dt_check_payment_method('paystack')): ?>
                                            <input required type="radio" name="payment_by" id="paystack_in" value="paystack" />
                                            <label for="paystack_in"><img class="width_100px" src="<?php echo base_url('assets/images/paystack_1.png') ?>" alt="paystack" /></label>
                                        <?php endif; ?>

                                        <?php if (dt_check_payment_method('offline')): ?>
                                            <input onclick="show_offline_notes()" required type="radio" name="payment_by" id="offline_in" value="offline" />
                                            <label for="offline_in"><img class="width_100px" src="<?php echo base_url('assets/images/offline.png') ?>" alt="offline" /></label>
                                        <?php endif; ?>
                                    </div>

                                    <?php if (isset($dt_get_all_payment_setting['offline']) && $dt_get_all_payment_setting['offline']=='Y'): ?>
                                        <div class="row d-none" id="offline_payment_section">
                                            <div class="col-md-12">
                                                <?php echo nl2br($dt_get_all_payment_setting['offline_details']); ?>
                                            </div>
                                            <div class="col-md-12 mt-3">
                                                <div class="form-group">
                                                    <textarea autocomplete="off" data-msg-required="<?php echo dt_translate('this_field_is_required'); ?>" class="form-control" name="notes" id="notes" placeholder="<?php echo dt_translate('notes'); ?>"></textarea>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endif;?>


                                    <div class="form-button">
                                        <button  type="submit" class="text_white nav-link donation_button_style mt-3 border-0 w-100">
                                            <span class="spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span>
                                            <?php echo dt_translate('donate_now') ?>
                                        </button>
                                    </div>
                                    <?php echo form_close(); ?>
                                </div>
                            </div>
                        <?php endif;?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<?php
include VIEWPATH . 'front/theme1/footer.php';
?>
<?php
include VIEWPATH . 'validation_js_message.php';
?>
<script src="<?php echo base_url('assets/global/js/front_custom.js'); ?>"></script>