<?php
session_start()
?>

<link rel="stylesheet" href="/css/bootstrap.min.css">
<script src="/js/jquery-3.4.1.js"></script>
<script src="/js/bootstrap.min.js"></script>

<style>
    .seeline{
        border: #ffffff 1px solid;
    }
.input{
    border: #2B333F 1px solid;
    background-color: black;
}
    .btn_login{
        border-style: none;
        padding: 5px 10px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 14px;
        color:#ffffff;
        border-radius: 5px;
        margin-top: 20px;
    }
</style>
<title>差勤系統</title>
<body style="background-color: #2588a2;">
    <div  style="width: 100%;height: 100%;padding-top: 15%">
        <div class="align-items-center container" align="center" style="width:70vw;height:40vh;border-radius: 5px;background-color: rgb(78,156,187);margin: 0 auto;float: none;">
            <div class="row">
                <div class="col-6" style="background-color: #2588a2; height: 7vh"></div>
                <div class="col-5" style="background-color: #e8eff9;"></div>
                <div class="col-1" style="background-color: #2588a2;"></div>
            </div>
            <div class="row">
                <div class="col-6" style="background-color: #e2e2e2; height:40vh">
                    <div class="header" align="left" style="height: 20%;">
                        <label style="font-size:32px;color:#000000;text-align:center;line-height:90px;"><strong>昱通資訊事業股份有限公司</strong></label>
                        <br>
                        <label style="font-size:28px;color:#000000;text-align:center;line-height:75px;">差勤系統</label>
                    </div>
                </div>
                <div class="col-5" style="background-color: #e8eff9;">
                    <div style="margin: 20px 2px 2px 2px" >
                        <form  method="post" action="{{ route("user_login") }}" >
                            {{ csrf_field() }}
                            <table>
                                <tbody>
                                @if($auth=1)
                                    <tr>
                                        <td></td>
                                        <td style="width: 40%;text-align: right"><label for="user_name" id="test"  style="color:#000000;font-size: 18px;">使用者名稱：</label></td>
                                        <td><input class="input" type="text" id="user_name" name="user_name" style="background-color: #e8eff9;width: 70%;color: #000000;font-size: 18px;text-align: left" value="{{$uername}}"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td style="width: 40%;text-align: right"><label for="user_pwd"  style="color:#000000;font-size: 18px">密碼：</label></td>
                                        <td><input class="input" type="password" id="user_pwd" name="user_pwd" style="background-color: #e8eff9;width: 70%;color: #000000;font-size: 18px;text-align: left" value="{{$userpwd}}" ></td>
                                    </tr>
                                @endif
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td style="text-align: left"><input class="" type="checkbox" id="Auto_live" name="Auto_live" value="right" checked/>&nbsp<label for="Auto_live" style="color:#000000">記住帳號</label></td>

                                </tr>
                                </tbody>
                            </table>
                            <div class="col-12">
                                <input class="col-md-3 btn_login" type="submit" value="登入" style="background-color: #EE8434;">
                                <input class="col-md-3 btn_login" type="reset"  value="取消" style="background-color: #2B333F;">
                            </div>
                        </form>
                        {{--                <button class="col-md-4 btn_login" style="margin-right: 10px;background-color: #1d68a7;" data-toggle="modal" data-target="#RegisterModalCenter">註冊</button>--}}
                        <div class="col-12 ">
                            <p></p>
                        </div>
                    </div>
                </div>
                <div class="col-1" style="background-color: #e2e2e2;"></div>
            </div>
            <div class="row">
                <div class="col-6" style="background-color: #2588a2; height: 7vh"></div>
                <div class="col-5" style="background-color: #e8eff9;"></div>
                <div class="col-1" style="background-color: #2588a2;"></div>
            </div>
        </div>
    </div>

    {{-- 註冊彈出視窗 --}}
    <div class="modal fade" id="RegisterModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLongTitle">註冊</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <form action="{{ route("user_register") }}" method="POST" >
                    {{ csrf_field() }}
                    <div class="modal-body row">
                        <div class="col-sm-12">
                            <div class="col-sm-1"></div>
                            <div class="form-group row">
                                <label for="inputID" class="col-sm-2 col-form-label" style="text-align: right">ID</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="inputID" name="user_id" placeholder="請輸入使用者編號" required>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="form-group row">
                                <label for="inputName" class="col-sm-2 col-form-label" style="text-align: right">姓名</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="inputName" name="user_name" placeholder="請輸入姓名" required>
                                </div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label" for="selectGroup" style="text-align: right">身份</label>
                                <div class="col-sm-9">
                                    <select class="custom-select form-control" id="selectGroup" name="user_role" required>
                                        <option selected disabled >請選擇人員身份</option>
                                        @foreach($userroles as $userrole)
                                            <Option value="{{ $userrole["id"] }}">{{ $userrole["name"] }}</Option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="inputJob" class="col-sm-2 col-form-label" style="text-align: right">職稱</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="inputJob" name="user_job" placeholder="請輸入職稱" required>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="inputDepartment" class="col-sm-2 col-form-label" style="text-align: right">單位</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="inputDepartment" name="user_department" placeholder="請輸入單位" required>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="inputEmail" class="col-sm-2 col-form-label" style="text-align: right">email</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="inputEmail" name="user_email" placeholder="請輸入email" required>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="inputPhone" class="col-sm-2 col-form-label" style="text-align: right">電話</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" id="inputPhone" name="user_phone" placeholder="請輸入電話" required>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label for="inputUserName" class="col-sm-4 col-form-label" style="text-align: right">使用者名稱</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" id="inputUserName" name="user_username" placeholder="請輸入使用者名稱" required>
                                </div>
                                <div class="col-sm-1"></div>
                            </div>
                            <div class="col-sm-1"></div>
                            <div class="form-group row">
                                <label for="inputpwd" class="col-sm-4 col-form-label" style="text-align: right">使用者密碼</label>
                                <div class="col-sm-7">
                                    <input type="password" class="form-control" id="inputpwd" name="user_password" maxlength="12" placeholder="請輸入使用者密碼" required>
                                </div>
                                <div class="col-sm-1"></div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                        <button type="submit" class="btn btn-primary">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
@if(isset($error_msg))
    <script>
        alert('{{ $error_msg }}');
    </script>
@endif


