114 lines
No EOL
4.5 KiB
PHP
114 lines
No EOL
4.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Homeparty;
|
|
use App\Models\HomepartyUser;
|
|
use App\Models\Product;
|
|
use App\Models\PromotionAdminProduct;
|
|
use App\Models\ShoppingOrder;
|
|
use App\Models\ShoppingUser;
|
|
use App\Models\UserCredit;
|
|
use App\User;
|
|
use Request;
|
|
|
|
class ModalController extends Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
public function load(){
|
|
$data = Request::all();
|
|
$ret = "";
|
|
$status = false;
|
|
if(Request::ajax()){
|
|
if($data['action'] === 'shopping-order-change-member'){
|
|
$value = ShoppingOrder::find($data['id']);
|
|
$route = route('admin_sales_customers_detail', [$value->id]);
|
|
$ret = view("admin.modal.member", compact('value', 'data', 'route'))->render();
|
|
}
|
|
if($data['action'] === 'shopping-user-change-member'){
|
|
$value = ShoppingUser::find($data['id']);
|
|
$route = route('admin_customer_edit', [$value->id]);
|
|
$ret = view("admin.modal.member", compact('value', 'data', 'route'))->render();
|
|
}
|
|
if($data['action'] === 'shopping-user-is-like-member'){
|
|
$current = ShoppingUser::find($data['id']); //current user form order
|
|
$possibles = [];
|
|
if($current->is_like){
|
|
$likes = $current->getNotice('like');
|
|
foreach ($likes as $like_id=>$number){
|
|
$possibles[] = ShoppingUser::find($like_id);
|
|
}
|
|
}
|
|
$ret = view("admin.modal.is_like_member", compact('current', 'possibles', 'data'))->render();
|
|
}
|
|
if($data['action'] === 'user-order-show-product'){
|
|
$product = Product::find($data['id']); //current user form order
|
|
$ret = view("admin.modal.show_product", compact('product', 'data'))->render();
|
|
}
|
|
if($data['action'] === 'user-order-my-delivery-show'){
|
|
$user = \Auth::user();
|
|
$ret = view("admin.modal.show_user_customers", compact('user', 'data'))->render();
|
|
}
|
|
if($data['action'] === 'user-order-my-delivery-add'){
|
|
$user = \Auth::user();
|
|
/* $product = Product::find($data['id']); //current user form order
|
|
$ret = view("admin.modal.show_product", compact('product', 'data'))->render(); */
|
|
}
|
|
|
|
|
|
if($data['action'] === 'user-order-show-user-level-margin'){
|
|
$user = User::find($data['id']);
|
|
$ret = view("admin.modal.user_level_margin", compact('user', 'data'))->render();
|
|
}
|
|
if($data['action'] === 'show-user-pay-credits'){
|
|
$user = User::find($data['id']);
|
|
$ret = view("admin.modal.user_pay_credits", compact('user', 'data'))->render();
|
|
}
|
|
if($data['action'] === 'add-user-pay-credit'){
|
|
$value = [];
|
|
$ret = view("admin.modal.add_pay_credit", compact('value', 'data'))->render();
|
|
}
|
|
if($data['action'] === 'add-user-credit'){
|
|
$value = [];
|
|
$ret = view("admin.modal.add_credit", compact('value', 'data'))->render();
|
|
}
|
|
|
|
if($data['action'] === 'user-credit-status'){
|
|
$value = UserCredit::find($data['id']); //current user form order
|
|
$ret = view("admin.modal.user-credit-status", compact('value', 'data'))->render();
|
|
}
|
|
|
|
|
|
if($data['action'] === 'save-promotion_product'){
|
|
if($data['id'] === 'new'){
|
|
$value = new PromotionAdminProduct();
|
|
$value->calcu_commission = true;
|
|
$value->shipping = true;
|
|
$value->active = true;
|
|
}else{
|
|
$value = PromotionAdminProduct::find($data['id']);
|
|
}
|
|
$ret = view("admin.modal.promotion-product", compact('value', 'data'))->render();
|
|
}
|
|
}
|
|
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* <button type="button" class="btn btn-sm btn-primary" data-toggle="modal"
|
|
data-target="#modals-load-content"
|
|
data-id="{{ $value->id }}"
|
|
data-model="emailTemplate"
|
|
data-action="modal-email-template"
|
|
data-url=""
|
|
data-redirect="back"
|
|
data-route="{{ route('modal_load') }}"><span class="fa fa-edit"></span></button>*/ |