front fix
This commit is contained in:
miroman-afk
2021-12-29 14:05:32 +03:00
parent 2702c4b6e9
commit f8c4060a82
2 changed files with 41 additions and 35 deletions

View File

@@ -22,11 +22,11 @@ class TopDishesNewYear extends HRCCommand implements HRCCommandInterface {
if (!file_exists($dirname . $filename)) { if (!file_exists($dirname . $filename)) {
$info = ExchangeItems::where('menu_code', '>', 0) $info = ExchangeItems::where('menu_code', '>', 0)
->where('real_price', '>', 1) ->where('real_price', '>', 1)
->where('created_at', '>=', '2021-10-01 00:00:00') ->where('created_at', '>=', '2021-01-01 00:00:00')
->where('created_at', '<', '2021-12-31 23:59:59') ->where('created_at', '<', '2021-12-31 23:59:59')
->get() ->get()
->unique('menu_code'); ->unique('menu_code');
$count = ExchangeItems::where('menu_code', '>', 0)->where('created_at', '>=', '2021-10-01 00:00:00')->where('created_at', '<', '2021-12-31 23:59:59')->count(); $count = ExchangeItems::where('menu_code', '>', 0)->where('created_at', '>=', '2021-01-01 00:00:00')->where('created_at', '<', '2021-12-31 23:59:59')->count();
if ($count > 0) { if ($count > 0) {
foreach ($info as $key => $value) { foreach ($info as $key => $value) {
$out[] = $value; $out[] = $value;
@@ -38,12 +38,12 @@ class TopDishesNewYear extends HRCCommand implements HRCCommandInterface {
->first(); ->first();
$onlineDishInfo = ExchangeItems::where('menu_code', '=', $item['menu_code']) $onlineDishInfo = ExchangeItems::where('menu_code', '=', $item['menu_code'])
->where('dishes_code', '=', $item['dishes_code']) ->where('dishes_code', '=', $item['dishes_code'])
->where('created_at', '>=', '2021-10-01 00:00:00') ->where('created_at', '>=', '2021-01-01 00:00:00')
->where('created_at', '<', '2021-12-31 23:59:59') ->where('created_at', '<', '2021-12-31 23:59:59')
->first(); ->first();
$dishName = $dishInfo['name']; $dishName = $dishInfo['name'];
$dishCount = ExchangeItems::where('menu_code', '=', $item['menu_code']) $dishCount = ExchangeItems::where('menu_code', '=', $item['menu_code'])
->where('created_at', '>=', '2021-10-01 00:00:00') ->where('created_at', '>=', '2021-01-01 00:00:00')
->where('created_at', '<', '2021-12-31 23:59:59') ->where('created_at', '<', '2021-12-31 23:59:59')
->sum('count'); ->sum('count');
$dishSum = $onlineDishInfo['real_price'] * $dishCount; $dishSum = $onlineDishInfo['real_price'] * $dishCount;

View File

@@ -25,40 +25,46 @@
function DashboardCtrl($scope, smartRequest, $interval, $location) { function DashboardCtrl($scope, smartRequest, $interval, $location) {
$(document).ready(function() { $(document).ready(function() {
if (moment(moment().format('YYYY-MM-DD')).isAfter('2021-12-25')) { if (moment(moment().format('YYYY-MM-DD')).isAfter('2021-12-25')) {
console.log('moment_first_true');
if (moment(moment().format('YYYY-MM-DD')).isBefore('2022-01-10')) { if (moment(moment().format('YYYY-MM-DD')).isBefore('2022-01-10')) {
smartRequest.get('v1/topdishesnewyear', function (data) { console.log('moment_second_true');
$scope.year_count = data.count; var delayMs = 1500; // delay in milliseconds
$scope.top_dishes = data.dishes; console.log('delay_true');
$scope.top_shifts = data.top_shift; setTimeout(function(){
}); $('#get-more-newyear').modal('show');
var delayMs = 1500; // delay in milliseconds }, delayMs);
setTimeout(function(){ console.log('modal_true');
$('#get-more-newyear').modal('show'); if ($( window ).width() < 700) {
}, delayMs); $('#get-more-newyear').on('show.bs.modal', function () {
if ($( window ).width() < 700) { $('.modal-dialog').css('margin',0);
$('#get-more-newyear').on('show.bs.modal', function () { $('.modal-content').css('height',$( window ).height()*0.95);
$('.modal-dialog').css('margin',0); $('.modal-content').css('width',$( window ).width());
$('.modal-content').css('height',$( window ).height()*0.95); $('.myCarousel').css('height', $( window ).height()*0.95);
$('.modal-content').css('width',$( window ).width()); $('.myCarousel').css('width', 'auto');
$('.myCarousel').css('height', $( window ).height()*0.95); $('.myCarousel').css('object-fit', 'cover');
$('.myCarousel').css('width', 'auto'); });
$('.myCarousel').css('object-fit', 'cover'); } else {
}); $('#get-more-newyear').on('show.bs.modal', function () {
} else { $('.modal-dialog').css('margin-right',$( window ).width()/4);
$('#get-more-newyear').on('show.bs.modal', function () { $('.modal-dialog').css('margin-left',$( window ).width()/4);
$('.modal-dialog').css('margin-right',$( window ).width()/4); $('.modal-dialog').css('margin-top',$( window ).height()/8);
$('.modal-dialog').css('margin-left',$( window ).width()/4); $('.modal-content').css('height',$( window ).height()*0.7);
$('.modal-dialog').css('margin-top',$( window ).height()/8); $('.modal-content').css('width',$( window ).width()*0.5);
$('.modal-content').css('height',$( window ).height()*0.7); $('.myCarousel').css('height', $( window ).height()*0.7);
$('.modal-content').css('width',$( window ).width()*0.5); $('.myCarousel').css('width', 'auto');
$('.myCarousel').css('height', $( window ).height()*0.7); $('.myCarousel').css('object-fit', 'cover');
$('.myCarousel').css('width', 'auto'); });
$('.myCarousel').css('object-fit', 'cover'); }
}); smartRequest.get('v1/topdishesnewyear', function (data) {
} $scope.year_count = data.count;
} $scope.top_dishes = data.dishes;
$scope.top_shifts = data.top_shift;
});
console.log('request_true');
}
} }
}); });
$scope.nextImage = function () { $scope.nextImage = function () {
$('.carousel').carousel('next'); $('.carousel').carousel('next');
}; };