first commit

This commit is contained in:
kizzroyal
2022-02-16 14:01:00 +07:00
commit f876f79060
294 changed files with 92083 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
<div class="modal-header">
<h5 class="modal-title">{{ $titleModal }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row">
<div class="col-sm-1">
<label class="control-label">SĐT: </label>
</div>
<div class="col-sm-4">
<div class="kt-form__group--inline">
<label>
<select class="form-control sdt{{ isset($account) ? "update" : '' }}">
@foreach($accountsMomo as $accountMomo)
<option {{ isset($account) && $account->sdt == $accountMomo['sdt'] ? "selected" : '' }} value="{{$accountMomo['sdt']}}">{{$accountMomo['sdt']}}</option>
@endforeach
</select>
</label>
{{-- <input class="form-control input-mocchoi-{{ $setting['id'] }}" value="{{ $setting['mocchoi'] }}"/>--}}
</div>
<div class="d-md-none kt-margin-b-10"></div>
</div>
<div class="col-sm-1">
<label class="control-label">Trò chơi: </label>
</div>
<div class="col-sm-4">
<div class="kt-form__group--inline">
<label>
<select class="form-control type{{ isset($account) ? "update" : '' }}">
@foreach($types as $type => $label)
<option value="{{$type}}" {{ isset($account) && $account->type == $type ? "selected" : '' }}>{{$label}}</option>
@endforeach
</select>
</label>
{{-- <input class="form-control input-mocchoi-{{ $setting['id'] }}" value="{{ $setting['mocchoi'] }}"/>--}}
</div>
<div class="d-md-none kt-margin-b-10"></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-1">
<label class="control-label">Min: </label>
</div>
<div class="col-sm-4">
<div class="kt-form__group--inline">
<label>
<input class="form-control min{{ isset($account) ? "update" : '' }}" value="{{ isset($account) ? $account->min : '' }}" placeholder="30000"/>
</label>
</div>
<div class="d-md-none kt-margin-b-10"></div>
</div>
<div class="col-sm-1">
<label class="control-label">Max: </label>
</div>
<div class="col-sm-4">
<div class="kt-form__group--inline">
<label>
<input class="form-control max{{ isset($account) ? "update" : '' }}" value="{{ isset($account) ? $account->max : '' }}" placeholder="3000000"/>
</label>
{{-- <input class="form-control input-mocchoi-{{ $setting['id'] }}" value="{{ $setting['mocchoi'] }}"/>--}}
</div>
<div class="d-md-none kt-margin-b-10"></div>
</div>
</div>
</div>
@if(isset($account))
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Đóng</button>
<button type="button" class="btn btn-primary" onclick="UpdateAccountLevel({{ $account->id }})">Cập nhật</button>
</div>
@endif

View File

@@ -0,0 +1,205 @@
@extends('layouts.admin')
@section('style')
<!-- DataTables -->
<link rel="stylesheet" href="https://adminlte.io/themes/AdminLTE/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
@endsection
@section('script')
@if (\Session::has('message'))
<script>
swal("Thông báo", "{{ \Session::get('message') }}", "{{ \Session::get('status') }}");
</script>
@endif
<script src="https://adminlte.io/themes/AdminLTE/bower_components/jquery/dist/jquery.min.js"></script>
<script src="https://adminlte.io/themes/AdminLTE/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="https://adminlte.io/themes/AdminLTE/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script>
$(function () {
$('#my-table').DataTable({
'paging': true,
'lengthChange': true,
'searching': true,
'ordering': true,
'info': true,
'autoWidth': true
})
})
</script>
<script type="text/javascript">
$(document).ready(function () {
mark_offset($('.mark-offset'));
});
function mark_offset(jquery_elements, attribute_name) {
var offset = 1;
jquery_elements.each(function () {
if (attribute_name == undefined) {
$(this).html(offset);
} else {
$(this).attr(attribute_name, offset);
}
offset += 1;
});
}
</script>
<script type="text/javascript">
function addAccountLevels() {
let form = $('.form_create');
let data = {};
data.sdt = form.find('.sdt').first().val();
data.type = form.find('.type').first().val();
data.min = form.find('.min').first().val();
data.max = form.find('.max').first().val();
$.ajax({
url: '{{route('admin_level_money.store')}}',
type: "POST",
data: data,
success: function (data) {
if (data.status == 2) {
swal(data.message, "", 'error');
} else {
location.reload();
}
},
error: function () {
swal("Vui lòng thử lại", "", 'errors');
}
});
}
function showEdit(id) {
$.ajax({
url: '{{route('admin_level_money.edit')}}',
type: "POST",
data: {'id': id},
success: function (data) {
if (data.status == 2) {
swal(data.message, 'errors');
} else {
$('.form_update').html(data);
}
},
error: function () {
swal("Vui lòng thử lại", 'errors');
}
});
}
function UpdateAccountLevel(id) {
let form = $('.form_update');
let data = {};
data.id = id;
data.sdt = form.find('.sdtupdate').first().val();
data.type = form.find('.typeupdate').first().val();
data.min = form.find('.minupdate').first().val();
data.max = form.find('.maxupdate').first().val();
$.ajax({
url: '{{route('admin_level_money.update')}}',
type: "POST",
data: data,
success: function (data) {
if (data.status == 2) {
swal(data.message, "", 'error');
} else {
swal("Cập nhật dữ liệu thành công", "", 'success');
$('.row_' + id).replaceWith(data);
mark_offset($('.mark-offset'));
$("#modalUpdate .close").click()
}
},
error: function () {
swal("Vui lòng thử lại", 'errors');
}
});
}
function deleteAccount(id) {
$.ajax({
url: '{{route('admin_level_money.delete')}}',
type: "POST",
data: {id: id},
success: function (data) {
if (data.status == 2) {
swal(data.message, 'errors');
} else {
swal("Cập nhật dữ liệu thành công", 'success');
$('.row_' + id).remove();
mark_offset($('.mark-offset'));
}
},
error: function () {
swal("Vui lòng thử lại", 'errors');
}
});
}
</script>
@endsection
@section('content')
<div class="modal fade" id="modalCreate" tabindex="-1" aria-labelledby="modalCreateLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content form_create">
@include('AdminPage.AccountLevelMoney.form_template')
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Đóng</button>
<button type="button" class="btn btn-primary" onclick="addAccountLevels()">Thêm</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalUpdate" tabindex="-1" aria-labelledby="modalUpdateLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content form_update">
</div>
</div>
</div>
<div class="box">
<div class="box-header">
<div style="float: left;">
<h3 class="box-title">
Quản hạn mức sđt
</h3>
</div>
<div style="float: right;">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modalCreate">
Thêm
</button>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<table id="my-table" class="table table-bordered table-hover">
<thead>
<tr>
<th>ID</th>
<th>SĐT</th>
<th>Trò chơi</th>
<th>Min</th>
<th>Max</th>
<th>Trạng thái</th>
<th>CHỨC NĂNG</th>
</tr>
</thead>
<tbody>
@foreach($accounts as $account)
@include('AdminPage.AccountLevelMoney.row')
@endforeach
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
</div>
@endsection

View File

@@ -0,0 +1,23 @@
<tr class="row_{{ $account['id'] }}">
<td class="mark-offset"></td>
<td>{{ $account['sdt'] }}</td>
<td>{{ $account['game'] }}</td>
<td>{{ number_format($account['min']) }}</td>
<td>{{ number_format($account['max']) }}</td>
<td> <button class="btn btn-{{ $account['class_status'] }} btn-sm">
{{ $account['text_status'] }}
</button></td>
<td>
<a href="javascript:;" onclick="deleteAccount({{ $account['id'] }})">
<button class="btn btn-danger btn-sm">
Xóa
</button>
</a>
<a href="javascript:;" onclick="showEdit({{ $account['id'] }})">
<button class="btn btn-success btn-sm" data-toggle="modal" data-target="#modalUpdate">
Chỉnh sửa
</button>
</a>
</td>
</tr>