@extends('base.base')
@section('base')

    <style>
        .form-control:disabled, .form-control[readonly] {
            background-color: white;
            opacity: 1;
        }
    </style>

    <form onsubmit="return false;" id="form">
        <table class="table table-striped">
            <tr>
                <th>{{ __('auto.皇冠倍数') }}</th>
                <th colspan="3"><input type="number" name="CrownMul" class="form-control" value="{{$LuckyGemstoneMul->CrownMul}}"></th>
            </tr>
            <tr>
                <th colspan="3">{{ __('auto.钻石组倍数（15组）') }}</th>
            </tr>
            @for ($i = 0; $i < 15; $i++)
                <tr>
                    <td colspan="3">
                        <input type="text" name="DiamondTeamMul[]" class="form-control" value="{{$LuckyGemstoneMul->DiamondTeamMul[$i]}}">
                    </td>

                </tr>

            @endfor


        </table>

        <button type="button" onclick="commit()"
                class="btn btn-sm btn-gradient-primary btn-icon-text">
            <i class="mdi mdi-file-check btn-icon-prepend"></i>
            {{ __('auto.提交') }}
        </button>
        <button type="button" onclick="cancel()"
                class="btn btn-sm btn-gradient-warning btn-icon-text">
            <i class="mdi mdi-reload btn-icon-prepend"></i>
            {{ __('auto.取消') }}
        </button>
    </form>
@endsection

<script>

    function commit() {
        if (!checkForm()) {
            return false;
        }
        var data = $("#form").serializeArray();
        console.log(data)
        myRequest("/admin/group_control/LuckyGemstoneMul_update", "post", data, function (res) {
            layer.msg(res.msg)
            if (res.code == 200){
                setTimeout(function () {
                    parent.location.reload();
                }, 1500)
            }
        });
    }

    function cancel() {
        parent.location.reload();
    }

    function add() {

        html = '<tr>' +
            '<td><input type="text" name="GemstoneLevel[]" value="" class="form-control"></td>' +
            '<td><input type="text" name="RewardRate[]" value="" class="form-control"></td>' +
            '<td><input type="text" name="RewardMul[]" value="" class="form-control"></td>' +
            '<td><button class="btn btn-sm btn-gradient-danger" onclick="del(this)">{{ __('auto.删除') }}</button></td>' +
            ' </tr>'


        $('.table').append(html)
    }
</script>
