D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
tattooscyy
/
test
/
app
/
Http
/
Controllers
/
Manager
/
Filename :
AjaxController.php
back
Copy
<?php namespace App\Http\Controllers\Manager; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use DateTime; use Auth; use App\Size; use App; use App\Orders; use App\Schedule; use App\ShceduleDay; use App\PictureManager; use App\Ordersmanager; use App\ScheduleExcept; use App\Libs\Endhour; class AjaxController extends Controller { public function postIndex() { $id = (int)$_POST['id']; $order = Orders::find($id); return view('manager.templates.modalform', compact('order')); } public function postNeworder() { $id = (int)$_POST['id']; $order = Orders::find($id); $order->typeshow = 'manager'; if($order->size){ $order->status = 'payd20'; } else{ if($order->body == 'gift card'){ $order->status = 'payed full'; }else{ $order->status = 'payd20'; } } $order->save(); return view('manager.templates.modalform', compact('order')); } public function postStartformat() { $date = new DateTime($_POST['putdate']); $putdate = $date->format('d-m-Y h:i'); $id = (int)$_POST['id']; //$putdate = $_POST['putdate']; $manager_id = Auth::user()->id; $ord = Orders::find($id); $ord->putdate = $putdate; $ord->status = 'manager'; $ord->manager_id = $manager_id; $ord->save(); } public function postSum() { $width = (int)$_POST['width']; $height = (int)$_POST['height']; $catalog = (int)$_POST['catalog']; $size = (int)$width * $height; //$sd = \App::make('\App\Libs\Sum')->getPrice($width, $height); //$price = Size::where('size', $sd)->where('catalogs_id', $catalog)->first(); $order = new Ordersmanager; $ret = $order->prices($catalog, $size); echo $ret; } public function postCurrent(Request $request) { $saloon = $request->saloon; $obj = Schedule::where('manager_id', Auth::user()->id)->where('status', 'saloon')->orderBy('id', 'DESC')->first(); $hours = unserialize($obj->hours); if (isset($_POST['day'])) { $one = $_POST['day']; $arr = explode('-', $one); $day = $arr[3] . '-' . $arr[2] . '-' . $arr[1]; } else { $day = date('d-m-Y'); } if (isset($_POST['artist_id'])) { $artist_id = (int)$_POST['artist_id']; $obj = Schedule::where('artist_id', $artist_id)->orderBy('id', 'DESC')->first(); $hours = unserialize($obj->hours); $sche = ShceduleDay::where('day', $day) ->where('artist_id', $artist_id) ->orderBy('id', 'DESC')->first(); } else { $sche = ShceduleDay::where('day', $day) ->where('saloon_id', $saloon->id) ->where('artist_id', 0) ->orderBy('id', 'DESC')->first(); } if (isset($sche)) { $arr = unserialize($sche->hours); if (isset($arr[0])) { $hours = $arr; } else { $hours = array(); } } $h = end($hours); $time_obj = new Endhour(); $hhhhh = $time_obj->fromTime($h); return view('manager.includes.current', compact('hours', 'day', 'hhhhh')); } public function postExcept(Request $request) { $day = $_POST['day']; $artist_id_e = $_POST['artist_id']; //$saloon = $request->saloon; $obj = ScheduleExcept::where('artist_id', $artist_id_e)->where('day', $day)->orderBy('id','DESC')->first(); $hours = []; if(!$obj){ $obj = Schedule::where('artist_id', $artist_id_e)->orderBy('id', 'DESC')->first(); } $hours = unserialize($obj->hours); return view('manager.includes.hours_except', compact('hours', 'artist_id_e', 'day')); } public function postExceptSaloon(){ $day = $_POST['day']; $saloon_id_e = $_POST['saloon_id']; $hours = []; $obj = ScheduleExcept::where('saloon_id', $saloon_id_e)->where('day', $day)->orderBy('id','DESC')->first(); if($obj){ $hours = unserialize($obj->hours); } if(!$obj){ $obj = Schedule::where('manager_id', Auth::user()->id)->where('status', 'saloon')->orderBy('id', 'DESC')->first(); $hours = unserialize($obj->hours); } return view('manager.includes.hours_except_saloon', compact('hours', 'saloon_id_e', 'day')); } public function postOrders(Request $request) { $date = new DateTime(); $putdate = $date->format('d-m-Y h:i:s'); if (Auth::user()->role_id == 1) { $ord = Orders::where('typeshow', Null)->whereIn('status', ['payd20' , 'payed full'])->count(); }else{ $saloon = $request->saloon; $ord = Orders::where('typeshow', Null)->where('saloon_id', $saloon->id)->whereIn('status', ['payd20' , 'payed full'])->count(); } echo "<span href='#' id='link_orders'> " . $ord . " </span> "; echo $putdate; } }