Commit 187c3371 authored by 李崇誌's avatar 李崇誌

account -v0.1

parent bcb0ae80
Z:\
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="Z:/" vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -63,6 +63,6 @@ class AccountController extends Controller ...@@ -63,6 +63,6 @@ class AccountController extends Controller
{ {
// 查詢 // 查詢
$user = User::where('name',$request->name)->get(); $user = User::where('name',$request->name)->get();
return redirect()->route('account',['Users'=>$user]); return $user ;
} }
} }
...@@ -29,7 +29,7 @@ class LogMiddleware ...@@ -29,7 +29,7 @@ class LogMiddleware
else{ else{
$usernum=$request->user('User')->id; //操作人(要自己獲取) $usernum=$request->user('User')->id; //操作人(要自己獲取)
} }
print(sprintf("當前使用者ID: %s ,log 目前先不寫進資料庫,如果不想顯示此段訊息,或是想寫進資料庫,通知 Bruce",$usernum == 0 ? "訪客" : $usernum)); //print(sprintf("當前使用者ID: %s ,log 目前先不寫進資料庫,如果不想顯示此段訊息,或是想寫進資料庫,通知 Bruce",$usernum == 0 ? "訪客" : $usernum));
self::writeLog($usernum,$input,$path,$method,$ip); self::writeLog($usernum,$input,$path,$method,$ip);
return $next($request); return $next($request);
......
@extends('layouts.default') @extends('layouts.default')
@section('header') @section('header')
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="{{asset('css/templatemo-style.css')}}"> <link rel="stylesheet" href="{{asset('css/templatemo-style.css')}}">
{{--引入 jquery 相關套件--}}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
@endsection @endsection
@section('content') @section('content')
<div class="container-fluid"> <div class="container-fluid">
<div class="tm-bg-light tm-block-taller "style="padding:20px;margin-bottom: 100px"> <div class="tm-bg-light tm-block-taller "style="padding:20px;margin-bottom: 100px">
<table class="table table-light table-hover"> <h2 style="font-size: x-large" class="tm-block-title">使用者管理介面</h2>
<thead> <ul class="nav nav-tabs">
<tr> <li class="active"><a data-toggle="tab" href="#home" id="show_account"><span class="glyphicon glyphicon-user"></span>帳號管理</a></li>
<th scope="col">編號</th> <li><a data-toggle="tab" href="#Edit" id="edit_account" style="display: none"><span class="glyphicon glyphicon-pencil"></span>編輯帳號</a></li>
<th scope="col">車牌號碼</th> <li><a data-toggle="tab" href="#Create" id="create_account"><span class="glyphicon glyphicon-plus"></span>新增帳號</a></li>
<th scope="col">車種</th> </ul>
<th scope="col">經過日期</th>
<th scope="col">時間</th> <div class="tab-content">
<th scope="col" >偵測地點</th> <div id="home" class="tab-pane fade in active" style="padding: 20px 20px 20px 20px; background-color: white">
<th scope="col">違規項目</th> <table class="table tm-table-small">
<th scope="col">違規案號</th> <thead>
<th scope="col" style="text-align: center">修改</th> <tr>
</tr> <th scope="col" style="text-align: center">姓名</th>
</thead> <th scope="col" style="text-align: center">權限等級</th>
<tbody id="result"> <th scope="col" style="text-align: center">狀態</th>
<tr class="car_info" onclick="toPhotos()"> <th scope="col" style="text-align: center">群組ID</th>
<td> <th scope="col" style="text-align: center">編輯區</th>
<div class="tm-status-circle parking"> </tr>
</div>1 </thead>
</td> <tbody>
<td><b><a href="#photos"></a>BMW-0857</b></td> @foreach($Users as $user)
<td><b>自小客車</b></td> <form method="post" id="send_S" onsubmit="return false" style="display: inline-block">
<td><b>2020-07-09</b></td> @csrf
<td><b>13:08:21</b></td> <tr>
<td><b>國道187km</b></td> <td style="vertical-align: middle;text-align: center" id="id">{{$user -> name}}</td>
<td><b>&nbsp;</b></td> <td style="vertical-align: middle;text-align: center" id="Auth_level">{{$user -> Auth_level}}</td>
<td><b>&nbsp;</b></td> <td style="vertical-align: middle;text-align: center" id="Status">
<td> <label style="background-color: #2a9055;color: white;border-radius: 45px;padding: 3px;font-family: 'Microsoft JhengHei UI';">{{$user -> Status}}</label>
{{-- <input class="btn btn-info" disabled="disabled" type="button" value="" style="width: auto;text-align: center;font-weight:bold;">--}} </td>
<input class="btn btn-primary4" type="button" style="width: auto;text-align: center;font-weight:bold;"> <td style="vertical-align: middle;text-align: center" id="Group_ID">{{$user -> Group_ID}}</td>
</td> <td style="vertical-align: middle;text-align: center">
</tr> <input type="hidden" value="{{$user -> name}}" name="name">
<tr> <input class="btn btn-primary4" type="submit" value="" style="width: auto;height:40px;text-align: center;font-weight:bold;display: inline-block;" id="btn_edit" name="{{$user->name}}">
<td>
<div class="tm-status-circle cancelled"> </form>
</div>2 <form method="post" id="send_D" onsubmit="return false" style="display: inline-block">
</td> @csrf
<td><b>KLM-9999</b></td> <input type="hidden" value="test2" name="name">
<td><b>大客車</b></td> <input class="btn btn-primary3" type="submit" value="" style="width: auto;height:40px;text-align: center;font-weight:bold;display: inline-block;" id="btn_delete">
<td><b>2020-06-07</b></td> </td>
<td><b>16:08:21</b></td> </tr>
<td><b>蘇花公路777km</b></td> </form>
<td><b>未依速限行駛</b></td> @endforeach
<td><b>9587654132</b></td> </tbody>
<td> </table>
{{-- <input class="btn btn-info" disabled="disabled" type="button" value="" style="width: auto;text-align: center;font-weight:bold;">--}} {{-- <form method="post" id="send_S" onsubmit="return false">--}}
<input class="btn btn-primary4" type="button" style="width: auto;text-align: center;font-weight:bold;"> {{-- @csrf--}}
</td> {{-- --}}
</tr> {{-- </form>--}}
</tbody> </div>
</table> {{-- 表身 --}} <div id="Edit" class="tab-pane fade" style="padding: 20px 20px 20px 20px; background-color: white">
<hr style="margin: 0px;"> <form method="post" id="send_U" onsubmit="return false">
<div class="table" style="height:70px;text-align: right"> @csrf
<span style="margin-right: 3px"class="tm-block-title">第1頁,共6頁</span> <table class="table tm-table-small" border="1">
<button style="margin-top: 20px" class="btn-info" >頁首</button> <thead>
<button class="btn-info">上一頁</button> <th scope="col">資料欄位</th>
<button class="btn-success">1</button> <th scope="col"></th>
<button class="btn-success">2</button> </thead>
<button class="btn-success">3</button> <tbody>
<button class="btn-success">4</button> <tr>
<button class="btn-success">5</button> <td width=20%>
<span class="tm-block-title">...</span> 帳號
<button class="btn-info">下一頁</button> </td>
<button style="margin-right:5px " class="btn-info">頁尾</button> <td width=max>
</div> {{-- 表尾 --}} <input class="" type="text" style="width:80%;color: black" id="name" name="name">
</td>
</tr>
<tr>
<td>
密碼
</td>
<td width=max>
<input class="" type="password" style="width:80%;color: black" id="password" name="password">
</td>
</tr>
<tr>
<td>
權限等級
</td>
<td width=max>
<input class="" type="number" style="width:80%;color: black" id="Auth_level" name="Auth_level">
</td>
</tr>
<tr>
<td>
群組ID
</td>
<td width=max>
<input class="" type="text" style="width:80%;color: black" id="Group_ID" name="Group_ID">
</td>
</tr>
<tr align="center">
<td></td>
<td align="left">
<button class="btn btn-danger" style="vertical-align: middle" type="submit"><label style="font-family: 'Microsoft JhengHei UI';font-size: 16px;height: 16px">保存</label></button>
<button class="btn btn-danger" style="vertical-align: middle" type="submit"><label style="font-family: 'Microsoft JhengHei UI';font-size: 16px;height: 16px">取消</label></button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div id="Create" class="tab-pane fade" style="padding: 20px 20px 20px 20px; background-color: white">
<form id="send_C" method="post" action="{{route('acc_C')}}">
{{ csrf_field() }}
<table class="table tm-table-small" border="1">
<thead>
<th scope="col">資料欄位</th>
<th scope="col"></th>
</thead>
<tbody>
<tr>
<td width=20%>
帳號
</td>
<td width=max>
{{-- <input class="" type="text" style="width:80%;color: black" id="name" name="name">--}}
<input id="name" type="text" class=" @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus style="width:80%;color: black">
@if(session('error'))
<span class="text-danger">
<strong>{{ session('error')}}</strong>
</span>
@endif
</td>
</tr>
<tr>
<td>
密碼
</td>
<td width=max>
<input class="" type="text" style="width:80%;color: black" id="password" name="password">
</td>
</tr>
<tr>
<td>
權限等級
</td>
<td width=max>
<input class="" type="text" style="width:80%;color: black" id="Auth_level" name="Auth_level">
</td>
</tr>
<tr>
<td>
狀態
</td>
<td width=max>
<input class="" type="text" style="width:80%;color: black" id="Status" name="Status">
</td>
</tr>
<tr>
<td>
群組ID
</td>
<td width=max>
<input class="" type="text" style="width:80%;color: black" id="Group_ID" name="Group_ID">
</td>
</tr>
<tr align="center">
<td></td>
<td align="left">
<button class="btn btn-danger" style="vertical-align: middle" type="submit"><label style="font-family: 'Microsoft JhengHei UI';font-size: 16px;height: 16px">新增</label></button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div> </div>
<form action="{{route('acc_C')}}" method="POST"> <form action="{{route('acc_C')}}" method="POST">
{{ csrf_field() }} {{ csrf_field() }}
帳號:<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus> 帳號:<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
...@@ -102,5 +209,69 @@ ...@@ -102,5 +209,69 @@
<input type="submit" value="刪除" /> <input type="submit" value="刪除" />
</form> </form>
</div> </div>
<script>
$("#send_S").submit(function(e) {
var form = $(this);
var url = '{{route('acc_R')}}';
$.ajax({
type: "POST",
url: url,
data:form.serialize(),
dataType: 'json',
success: function(data)
{
alert(JSON.stringify(data))
$('#show_account').hide();
$('#create_account').hide();
$('#edit_account').show();
$('#edit_account').click();
},
error:function(data){
alert(JSON.stringify(data))
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
</script>
<script>
$("#send_D").submit(function(e) {
var form = $(this);
var url = '{{route('acc_D')}}';
$.ajax({
type: "POST",
url: url,
data:form.serialize(),
dataType: 'json',
success: function(data)
{
alert(JSON.stringify(data))
},
error:function(data){
alert(JSON.stringify(data))
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
</script>
<script>
$("#send_U").submit(function (e) {
var form = $(this);
var url = '{{route('acc_U')}}';
$.ajax({
type: "POST",
url: url,
data:form.serialize(),
dataType: 'json',
success: function (data) {
alert("success")
},
error:function (data) {
alert(JSON.stringify(data))
}
})
e.preventDefault(); // avoid to execute the actual submit of the form.
})
</script>
{{ $Users }} {{ $Users }}
@endsection @endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment