chore: synchronize project dependencies and update vendor directory files
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
@extends('backend.layout')
|
||||
@section('content')
|
||||
<link rel="stylesheet" href="{{asset('public/backend/css/jquery-ui.css')}}">
|
||||
<link href="{{asset('public/backend/css/bootstrap-datepicker.css')}}" rel="stylesheet">
|
||||
<script src="{{asset('public/backend/js/bootstrap-datepicker.js')}}"></script>
|
||||
<script src="{{asset('public/backend/js/bootstrap-datepicker.vi.min.js')}}"></script>
|
||||
<script src="{{asset('public/backend/js/jquery-ui.min.js')}}"></script>
|
||||
<div class='card-header'>
|
||||
<h1>{{$title ?? ''}}</h1>
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
<div class="row" style="padding: 1rem 0;">
|
||||
<div class="col-md-2">
|
||||
<label for="fromDateTime">Từ ngày</label>
|
||||
<input type="text" id="fromDateTime" class="form-control datepicker" placeholder="dd/mm/yyyy"
|
||||
value="{{ $fromdate }}" />
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="toDateTime">Đến ngày</label>
|
||||
<input type="text" id="toDateTime" class="form-control datepicker" placeholder="dd/mm/yyyy"
|
||||
value="{{ $todate }}" />
|
||||
</div>
|
||||
<div class="col-md-2"><br>
|
||||
<button type="button" class="btn btn-primary btn-custom" id="datetime_filter">Lọc dữ liệu</button>
|
||||
<a id="excel_export" class="btn btn-primary btn-custom">Xuất excel</a>
|
||||
</div>
|
||||
</div>
|
||||
@include('backend.prizeuser.table')
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#datetime_filter').on('click', function () {
|
||||
let tungay = $('#fromDateTime').val();
|
||||
let denngay = $('#toDateTime').val();
|
||||
|
||||
if ((tungay != '' && !isValidDDMMYYYY(tungay)) || (denngay != '' && !isValidDDMMYYYY(denngay))) {
|
||||
alert('Ngày không đúng định dạng');
|
||||
return;
|
||||
}
|
||||
|
||||
let url = "{{ route('admin/prizeuser') }}?tungay=" + tungay + '&denngay=' + denngay;
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
$('#excel_export').on('click', function(e) {
|
||||
let fromdate = $('#fromDateTime').val();
|
||||
let todate = $('#toDateTime').val();
|
||||
|
||||
let a = document.createElement("a");
|
||||
a.href = "{{route('admin/prizeuser/export')}}?fromdate=" + fromdate +
|
||||
'&todate=' + todate;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
});
|
||||
});
|
||||
|
||||
function isValidDDMMYYYY(dateString) {
|
||||
// Kiểm tra định dạng bằng regex
|
||||
const regex = /^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/(\d{4})$/;
|
||||
if (!regex.test(dateString)) {
|
||||
return false; // Sai định dạng
|
||||
}
|
||||
|
||||
// Tách ngày, tháng, năm
|
||||
const parts = dateString.split('/');
|
||||
const day = parseInt(parts[0], 10);
|
||||
const month = parseInt(parts[1], 10);
|
||||
const year = parseInt(parts[2], 10);
|
||||
|
||||
// Kiểm tra tháng hợp lệ (1-12)
|
||||
if (month < 1 || month > 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Kiểm tra số ngày hợp lệ trong tháng
|
||||
const daysInMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
||||
|
||||
// Kiểm tra năm nhuận cho tháng 2
|
||||
if (year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)) {
|
||||
daysInMonth[2] = 29;
|
||||
}
|
||||
|
||||
if (day < 1 || day > daysInMonth[month]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // Định dạng hợp lệ và ngày tháng năm hợp lệ
|
||||
}
|
||||
|
||||
function update_spined(user_id) {
|
||||
var csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('updatespined') }}",
|
||||
type: 'POST',
|
||||
data: {
|
||||
user_id: user_id,
|
||||
_token: csrfToken // Bao gồm CSRF token
|
||||
},
|
||||
dataType: 'json', // Mong đợi dữ liệu trả về là JSON
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
alert('Thành công');
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert('Thất bại');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert('Thất bại');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$.datepicker.regional['vi'] = {
|
||||
closeText: 'Đóng',
|
||||
prevText: '<Trước',
|
||||
nextText: 'Tiếp>',
|
||||
currentText: 'Hôm nay',
|
||||
monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng Tư', 'Tháng Năm', 'Tháng Sáu',
|
||||
'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'],
|
||||
monthNamesShort: ['Th1', 'Th2', 'Th3', 'Th4', 'Th5', 'Th6',
|
||||
'Th7', 'Th8', 'Th9', 'Th10', 'Th11', 'Th12'],
|
||||
dayNames: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],
|
||||
dayNamesShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
|
||||
dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],
|
||||
weekHeader: 'Tu',
|
||||
dateFormat: 'dd/mm/yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''
|
||||
};
|
||||
$.datepicker.setDefaults($.datepicker.regional['vi']);
|
||||
|
||||
$(".datepicker").datepicker({
|
||||
dateFormat: "dd/mm/yy",
|
||||
weekStart: 0,
|
||||
calendarWeeks: true,
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
rtl: true,
|
||||
orientation: "auto"
|
||||
// minDate: new Date()
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user