<?php
use Carbon\Carbon;
?>


<?php $__env->startSection('title', 'Settings'); ?>

<?php $__env->startPush('css'); ?>
    <!-- data tables -->
    <link href="<?php echo e(asset('admin/assets/plugins/datatables/plugins/bootstrap/dataTables.bootstrap4.min.css')); ?> "
        rel="stylesheet" type="text/css" />
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="page-bar">
        <div class="page-title-breadcrumb">

        </div>
    </div>
    <div class="row">
        <div class="col-md-10 col-sm-12 m-auto">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">SMS Provider Settings</h4>
                </div>
                <div class="card-body ">
                    <?php if(session('message')): ?>
                        <div class="alert alert-success"><?php echo e(session('message')); ?></div>
                    <?php endif; ?>
                    <form action="<?php echo e(route('settings.sms_provider')); ?>" method="post">
                        <?php echo csrf_field(); ?>
                        <div class="form-group">
                            <label>Provider Url*</label>
                            <input type="text" name="provider" value="<?php echo e($provider->provider); ?>" placeholder="Provider"
                                class="form-control" required />
                        </div>
                        <div class="form-row">
                            <div class="col-md-5 col-sm-12 form-group">
                                <input type="text" name="key[]" value="phone" class="form-control" readonly />
                            </div>
                            <div class="col-md-5 col-sm-12 form-group">
                                <input type="text" name="value[]" value="<?php echo e($provider->phone); ?>" placeholder="Phone"
                                    class="form-control" required />
                            </div>
                            <div class="col-md-2 col-sm-12 form-group">&nbsp;</div>
                        </div>
                        <div class="form-row">
                            <div class="col-md-5 col-sm-12 form-group">
                                <input type="text" name="key[]" value="message" class="form-control" readonly />
                            </div>
                            <div class="col-md-5 col-sm-12 form-group">
                                <input type="text" name="value[]" placeholder="Message" value="<?php echo e($provider->message); ?>"
                                    class="form-control" required />
                            </div>
                            <div class="col-md-2 col-sm-12 form-group">&nbsp;</div>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-sm btn-info" id="add-new-key" type="button">Add New Key</button>
                        </div>
                        <div id="new_key">
                            <?php $__empty_1 = true; $__currentLoopData = $provider->extra; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <div class="form-row key">
                                    <div class="col-md-5 col-sm-12 form-group">
                                        <input type="text" name="key[]" placeholder="Key" value="<?php echo e($key); ?>" class="form-control" />
                                    </div>
                                    <div class="col-md-5 col-sm-12 form-group">
                                        <input type="text" name="value[]" placeholder="Value" value="<?php echo e($value); ?>" class="form-control" />
                                    </div>
                                    <div class="col-md-2 col-sm-12 form-group">
                                        <button class="btn btn-sm btn-outline-danger remove" type="button">Remove</button>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <?php endif; ?>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-sm btn-success" type="submit">Save</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    
    <div class="row">
        <div class="col-md-10 col-sm-12 m-auto">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Invoice Message Template</h4>
                </div>
                <div class="card-body">
                    <div class="form-group">
                        <p class="p-1 m-0">Farmer Name - {{farmer_name}}</p>
                        <p class="p-1 m-0">Batch Name - {{batch_name}}</p>
                        <p class="p-1 m-0">Date - {{date}}</p>
                        <p class="p-1 m-0">Invoice Number - {{invoice_number}}</p>
                        <p class="p-1 m-0">Total Amount - {{total_amount}}</p>
                        <p class="p-1 m-0">Receipt No - {{receipt_no}}</p>
                    </div>
                    <form action="<?php echo e(route("settings.invoiceSmsTemplate")); ?>" method="post">
                        <?php echo csrf_field(); ?> 
                        <div class="form-group">
                            <label>Invoice SMS Template*</label>
                            <textarea name="template" id="" cols="30" rows="5" class="form-control" placeholder="Write..." required><?php echo e($templates->invoice_template ?? ""); ?></textarea>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-info" type="submit">Save</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <!-- sweet aleart -->
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@8"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $('#add-new-key').on("click", function() {
                let output = `<div class="form-row key">
                        <div class="col-md-5 col-sm-12 form-group">
                            <input type="text" name="key[]" placeholder="Key" class="form-control" />
                        </div>
                        <div class="col-md-5 col-sm-12 form-group">
                            <input type="text" name="value[]" placeholder="Value" class="form-control" />
                        </div>
                        <div class="col-md-2 col-sm-12 form-group">
                            <button class="btn btn-sm btn-outline-danger remove" type="button">Remove</button>
                        </div>
                    </div>`;
                $("#new_key").append(output);
            });

            $(document).on("click", ".remove", function() {
                let box = $(this).closest('.key');
                $(box).remove();
            });
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('template.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\forazi\resources\views/admin/settings/index.blade.php ENDPATH**/ ?>