/
plus.blade.php
126 lines (110 loc) · 4.84 KB
/
plus.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html>
<head>
<title>Входы и выходы</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}" />
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Expires" content="-1">
</head>
<body>
@include('layouts.warning')
<link rel="stylesheet" href="{{asset('/css/style.css')}}">
<link rel="stylesheet" href="{{asset('/css/people.css')}}">
<link rel="stylesheet" href="{{asset('/css/bootstrap.min.css')}}">
<script src="/js/jquery.min.js" type="text/javascript"></script>
<h1 style="text-align: center; width: 100%; font-size: 300px;">Сегодня @php echo date('d.m.y'); @endphp</h1><br>
<div class="row mains">
@foreach($data as $el)
<div class="col-md-1">
<img id="{{$el->id}}" src="/img/people/{{$el->img}}"
@if($data->dop[$el->id]['done'] === 1)
onclick='drop_people({{$el->id}}, "{{$el->name}}")' style="opacity:.5;"
@else
onclick='add_people({{$el->id}}, "{{$el->name}}")'
@endif, class="people">
<div id="p{{$el->id}}" class="plus" @if($data->dop[$el->id]['done'] === 1) style="display:block" @endif>+</div>
</div>
@endforeach
</div>
<h2 style="text-align: center; width: 100%; font-size: 100px;">Если ваш портрет серый и с плюсом, значит @php echo date('d.m'); @endphp вы на рабочем месте без температуры.</h2><br>
<h2 style="text-align: center; width: 100%; font-size: 100px;">Не нашли себя? Обратитесь в 202 кабинет.</h2><br>
<script>
function add_people(id, name) {
let data = name;
$.ajax({
type: 'post',
url: '/people',
global: false,
data: {
'mode': 'add',
'name': data,
'id': parseInt(id),
_token: $('meta[name="csrf-token"]').attr('content')
},
response: 'text',
success: function (res) {
$('#' + id).css('opacity', '.5');
$('#p' + id).css('display', 'block');
$('#' + id).attr('onclick', 'drop_people(' + id + ', "' + name + '")');
}
});
}
function drop_people(id, name) {
let data = name;
$.ajax({
type: 'post',
url: '/people',
global: false,
data: {
'mode': 'drop',
'name': data,
'id': parseInt(id),
_token: $('meta[name="csrf-token"]').attr('content')
},
response: 'text',
success: function (res) {
$('#' + id).css('opacity', '1');
$('#p' + id).css('display', 'none');
$('#' + id).attr('onclick', 'add_people(' + id + ', "' + name + '")');
}
});
}
</script>
<script>
function rel_page() {
document.location.reload();
}
let h = 1000 * 60 * 60;
setInterval(function () {
rel_page();
}, h);
</script>
<script>
function check_cart() {
$.ajax({
type: 'post',
url: '/cart',
global: false,
data: {
'mode': 'check',
_token: $('meta[name="csrf-token"]').attr('content')
},
response: 'text',
success: function (res) {
Object.values(res).forEach((element) => {
if (element !== null) {
console.log('add ' + element);
$('#' + element).click();
}
});
}
});
}
var datet = new Date();
var timeout = (datet.getHours() >= 7 && datet.getHours() < 10) ? 5000 : 1000 * 60 * 30; //проверяемся часто утром, редко в другое время.
setInterval(function () {
check_cart();
}, timeout);
</script>
</body>
</html>