Homparty v1.0

This commit is contained in:
Kevin Adametz 2020-12-17 23:02:22 +01:00
parent ac0d5b781e
commit c73299e52e
40 changed files with 1234 additions and 908 deletions

1
.env
View file

@ -20,6 +20,7 @@ APP_DEFAULT_MAIL=kevin.adametz@me.com
APP_CHECKOUT_TEST_MAIL=kevin.adametz@me.com
APP_INFO_TEST_MAIL=kevin.adametz@me.com
APP_MAIN_TAX = 1.19
LOG_CHANNEL=stack

74
.idea/workspace.xml generated
View file

@ -5,60 +5,45 @@
</component>
<component name="ChangeListManager">
<list default="true" id="2fbaac5f-25ba-4502-a970-cc14728d7d55" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/app/Http/Controllers/IngredientController.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/Services/HomepartyCart.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/app/Services/HomepartyUserCart.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/js/iq-homeparty-cart.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/public/js/summernote-cleaner.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/admin/ingredient/edit.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/admin/ingredient/form.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/admin/ingredient/index.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/user/homeparty/_address.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/user/homeparty/modal_show_products.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/user/homeparty/order.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/user/homeparty/show_bonus.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/user/homeparty/show_calc_bonus_host.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/user/homeparty/show_products_order.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/user/homeparty/show_total_order.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/admin/sales/_detail_homparty.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/admin/sales/_detail_homparty_total.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/emails/homeparty_detail.blade.php" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resources/views/emails/homeparty_detail_total.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.env" beforeDir="false" afterPath="$PROJECT_DIR$/.env" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.phpstorm.meta.php" beforeDir="false" afterPath="$PROJECT_DIR$/.phpstorm.meta.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/_ide_helper.php" beforeDir="false" afterPath="$PROJECT_DIR$/_ide_helper.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/_ide_helper_models.php" beforeDir="false" afterPath="$PROJECT_DIR$/_ide_helper_models.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/ModalController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/ModalController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/ProductController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/ProductController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Sys/AdminToolsController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Sys/AdminToolsController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/SalesController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/SalesController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/User/HomepartyController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/User/HomepartyController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Web/ContactController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Web/ContactController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Web/HomepartyController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Web/HomepartyController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/User/OrderController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/User/OrderController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Web/CheckoutController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Web/CheckoutController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/Homeparty.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/Homeparty.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/HomepartyUser.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/HomepartyUser.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/Product.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/Product.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Repositories/ContractPDFRepository.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Repositories/ContractPDFRepository.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Repositories/ProductRepository.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Repositories/ProductRepository.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Services/HTMLHelper.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Services/HTMLHelper.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingInstance.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingInstance.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingOrder.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingOrder.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingOrderItem.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingOrderItem.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/ShoppingUser.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/ShoppingUser.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Models/UserHistory.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Models/UserHistory.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Services/HomepartyCart.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Services/HomepartyCart.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Services/HomepartyUserCart.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Services/HomepartyUserCart.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Services/Payment.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Services/Payment.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/app.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2019_02_23_161530_create_shopping_users_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2019_02_23_161530_create_shopping_users_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2019_02_23_163527_create_shopping_orders_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2019_02_23_163527_create_shopping_orders_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2019_02_23_163724_create_shopping_order_items_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2019_02_23_163724_create_shopping_order_items_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2020_10_15_151059_create_homeparties_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2020_10_15_151059_create_homeparties_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2020_10_15_151136_create_homeparty_users_table.php" beforeDir="false" afterPath="$PROJECT_DIR$/database/migrations/2020_10_15_151136_create_homeparty_users_table.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/lang/de/navigation.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/lang/de/navigation.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/admin/category/images.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/admin/category/images.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/public/js/iq-homeparty-cart.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/js/iq-homeparty-cart.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/admin/product/form.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/admin/product/form.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/admin/site/images.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/admin/site/images.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/layouts/application.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/layouts/application.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/layouts/includes/layout-sidenav.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/layouts/includes/layout-sidenav.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/sys/admin/customers.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/sys/admin/customers.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/detail.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/detail.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/guest_detail.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/guest_detail.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/admin/sales/_detail.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/admin/sales/_detail.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/emails/checkout.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/emails/checkout.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/emails/checkout_status.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/emails/checkout_status.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/guests.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/guests.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/index.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/index.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/self_guest_detail.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/self_guest_detail.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/order/list.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/order/list.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/order/yard_view_form.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/order/yard_view_form.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/web/start.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/start.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/kontakt.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/kontakt.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/produkte.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/produkte.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/order.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/order.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/show_calc_bonus_host.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/show_calc_bonus_host.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/show_products_order.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/show_products_order.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/user/homeparty/show_total_order.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/user/homeparty/show_total_order.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resources/views/web/templates/checkout.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/resources/views/web/templates/checkout.blade.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/web.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -298,7 +283,7 @@
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/resources/views/user/homeparty" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/resources/views/emails" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
@ -307,11 +292,11 @@
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resources/views/emails" />
<recent name="$PROJECT_DIR$/resources/views/admin/sales" />
<recent name="$PROJECT_DIR$/resources/views/user/homeparty" />
<recent name="$PROJECT_DIR$/app/Services" />
<recent name="$PROJECT_DIR$/public/js" />
<recent name="$PROJECT_DIR$/resources/views/admin/ingredient" />
<recent name="$PROJECT_DIR$/app/Http/Controllers" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resources/views/user/order" />
@ -600,7 +585,8 @@
<workItem from="1605201129884" duration="22000" />
<workItem from="1605201310540" duration="157000" />
<workItem from="1605599347354" duration="281000" />
<workItem from="1608113166691" duration="26240000" />
<workItem from="1608113166691" duration="26421000" />
<workItem from="1608198795441" duration="30640000" />
</task>
<servers />
</component>

View file

@ -79,6 +79,9 @@ class SalesController extends Controller
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'hp'){
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
}
return '-';
})
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
@ -221,6 +224,9 @@ class SalesController extends Controller
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'hp'){
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
}
return '-';
})
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {

View file

@ -54,6 +54,11 @@ class HomepartyController extends Controller
$homeparty_user = new HomepartyUser();
$homeparty_user->is_host = true;
}
if($homeparty->completed){
abort(404);
}
$data = [
'homeparty' => $homeparty,
'homeparty_user' => $homeparty_user,
@ -155,6 +160,9 @@ class HomepartyController extends Controller
abort(404);
}
}
if($homeparty->completed){
abort(404);
}
$data = [
'homeparty' => $homeparty,
'homeparty_user' => $homeparty_user,
@ -213,18 +221,25 @@ class HomepartyController extends Controller
public function order($id = null)
{
$user = User::find(Auth::user()->id);
$homeparty = $this->getHomparty($id);
HomepartyCart::calculateHomeparty($homeparty);
$userHistoryPaymentOrder = UserHistory::whereUserId($user->id)->whereAction('payment_homeparty')->where('referenz', $homeparty->id)->get()->last();
$data = [
'homeparty' => $homeparty,
'userHistoryPaymentOrder' => $userHistoryPaymentOrder,
];
return view('user.homeparty.order', $data);
}
//perform Request
public function orderStore($id = null)
{
$homeparty = $this->getHomparty($id);
if(Request::ajax()) {
$data = Request::all();
@ -265,7 +280,7 @@ class HomepartyController extends Controller
}
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
HomepartyCart::calculateHomeparty($homeparty);
$html_user_cart = view("user.homeparty.show_products_order", ['homeparty_guest' => $homeparty_user])->render();
$html_user_cart = view("user.homeparty.show_products_order", ['homeparty' => $homeparty, 'homeparty_guest' => $homeparty_user])->render();
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
$html_host_bonus = view("user.homeparty.show_calc_bonus_host")->render();
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
@ -292,7 +307,7 @@ class HomepartyController extends Controller
}
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
HomepartyCart::calculateHomeparty($homeparty);
$html_user_cart = view("user.homeparty.show_products_order", ['homeparty_guest' => $homeparty_user])->render();
$html_user_cart = view("user.homeparty.show_products_order", ['homeparty' => $homeparty, 'homeparty_guest' => $homeparty_user])->render();
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
$html_host_bonus = view("user.homeparty.show_calc_bonus_host")->render();
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
@ -313,20 +328,81 @@ class HomepartyController extends Controller
}
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
HomepartyCart::calculateHomeparty($homeparty);
$html_user_cart = view("user.homeparty.show_products_order", ['homeparty_guest' => $homeparty_user])->render();
$html_user_cart = view("user.homeparty.show_products_order", ['homeparty' => $homeparty, 'homeparty_guest' => $homeparty_user])->render();
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
$html_host_bonus = view("user.homeparty.show_calc_bonus_host")->render();
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
return response()->json(['response' => true, 'data'=>$data, 'html_user_cart'=>$html_user_cart, 'html_bonus'=>$html_bonus, 'html_host_bonus'=>$html_host_bonus, 'html_total'=>$html_total]);
}
if($data['action'] === 'updateDeliveryOption') {
if($data['homeparty_id'] == $homeparty->id){
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
if($homeparty_user->homeparty_id !== $homeparty->id){
abort(404);
}
if(isset($data['delivery'])){
$homeparty_user->delivery = $data['delivery'];
$homeparty_user->save();
}
}
$homeparty_user = HomepartyUser::findOrFail($data['homeparty_user_id']);
HomepartyCart::calculateHomeparty($homeparty);
$html_user_cart = view("user.homeparty.show_products_order", ['homeparty' => $homeparty, 'homeparty_guest' => $homeparty_user])->render();
$html_bonus = view("user.homeparty.show_bonus", ['homeparty' => $homeparty])->render();
$html_host_bonus = view("user.homeparty.show_calc_bonus_host")->render();
$html_total = view("user.homeparty.show_total_order", ['homeparty' => $homeparty])->render();
return response()->json(['response' => true, 'data'=>$data, 'html_user_cart'=>$html_user_cart, 'html_bonus'=>$html_bonus, 'html_host_bonus'=>$html_host_bonus, 'html_total'=>$html_total]);
}
return response()->json(['response' => false, 'data'=>$data]);
}
/* $data = [
'homeparty' => $homeparty,
];
return view('user.homeparty.order', $data);*/
HomepartyCart::calculateHomeparty($homeparty);
if(\App\Services\HomepartyCart::$price === 0){
\Session()->flash('alert-error', 'Dein Warenkorb ist leer, bitte füge erst Produkte hinzu.');
return redirect(route('user_homeparty_order', [$homeparty->id]));
}
//save the calucalte card!
$time = time();
$date = date('d.m.Y H:i:s', $time);
$user = User::find(Auth::user()->id);
Yard::instance('shopping')->destroy();
Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty '.$date, 1, \App\Services\HomepartyCart::$price, ['image' => "", 'slug' => $time, 'weight' => 0]);
do {
$identifier = Util::getToken();
} while( ShoppingInstance::where('identifier', $identifier)->count() );
HomepartyCart::store($identifier, $date);
$data = [];
$data['is_from'] = 'homeparty';
$data['shop_price_net'] = HomepartyCart::getFormattedPriceNet();
$data['shop_price_tax'] = HomepartyCart::getFormattedPriceTax();
$data['homeparty_id'] = $homeparty->id;
$data['is_for'] = 'hp';
ShoppingInstance::create([
'identifier' => $identifier,
'user_shop_id' => 1, //is first faker shop for nuy intern
'auth_user_id' => Auth::user()->id,
'payment' => 5, //Berater Membership
'subdomain' => url('/'),
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'shopping_data' => $data,
'back' => url()->previous(),
]);
HomepartyCart::store($identifier, $date);
Yard::instance('shopping')->store($identifier);
$path = route('checkout.checkout_card', ['identifier'=>$identifier]);
UserHistory::create(['user_id' => $user->id, 'action'=>'payment_homeparty', 'status'=>1, 'referenz'=>$homeparty->id, 'identifier'=>$identifier]);
//$path = str_replace('http', 'https', $path);
return redirect()->secure($path);
}

View file

@ -84,6 +84,9 @@ class OrderController extends Controller
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'hp'){
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
}
return '-';
})
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {

View file

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Pay\PayoneController;
use App\Models\Homeparty;
use App\Models\PaymentMethod;
use App\Models\PaymentTransaction;
use App\Models\ShippingCountry;
@ -48,6 +49,7 @@ class CheckoutController extends Controller
$is_from = isset($shopping_data['is_from']) ? $shopping_data['is_from'] : 'shopping';
$is_for = isset($shopping_data['is_for']) ? $shopping_data['is_for'] : false;
$homeparty_id = isset($shopping_data['homeparty_id']) ? $shopping_data['homeparty_id'] : null;
$shopping_user = null;
@ -76,6 +78,7 @@ class CheckoutController extends Controller
$shopping_user = new ShoppingUser();
$shopping_user->is_for = $is_for;
$shopping_user->is_from = $is_from;
$shopping_user->homeparty_id = $homeparty_id;
$shopping_user->mode = 'prev';
}
}else{
@ -117,6 +120,7 @@ class CheckoutController extends Controller
$data = [
'is_from' => $is_from,
'is_for' => $is_for,
'shopping_data' => $shopping_data,
'user_shop' => Util::getUserShop(),
'shopping_user' => $shopping_user,
'shopping_mode' => Util::getUserShoppingMode(),
@ -151,6 +155,8 @@ class CheckoutController extends Controller
$shopping_user->accepted_data_checkbox = 1;
$shopping_user->is_for = $is_for;
$shopping_user->is_from = $is_from;
$shopping_user->homeparty_id = isset($data['homeparty_id']) ? $data['homeparty_id'] : null;
//Lieferadresse
if($is_from === 'user_order'){
if(isset($data['shopping_user_id']) && $data['is_for'] === 'ot'){
@ -456,30 +462,50 @@ class CheckoutController extends Controller
$user_shop = Util::getUserShop();
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => $user_shop->id,
'payment_for' => Util::getUserPaymentFor(),
if($shopping_user->is_from === 'homeparty'){
//get data
$homeparty = Homeparty::find($shopping_user->homeparty_id);
//set Data!
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => $user_shop->id,
'payment_for' => Util::getUserPaymentFor(),
'homeparty_id' => $shopping_user->homeparty_id,
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => $homeparty->order['price_net'],
'shipping' => $homeparty->order['shipping_price'],
'shipping_net' => $homeparty->order['shipping_price_net'],
'subtotal_ws' => 0,
'tax' => 0,
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => $homeparty->order['points'],
'weight' => 0,
'txaction' => 'prev',
'mode' => Util::getUserShoppingMode(),
];
}else{
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => $user_shop->id,
'payment_for' => Util::getUserPaymentFor(),
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
'shipping_net' => Yard::instance('shopping')->shippingNet(2, '.', ''),
'subtotal_ws' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
'tax' => Yard::instance('shopping')->taxWithShipping(2, '.', ''),
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => Yard::instance('shopping')->points(),
'weight' => Yard::instance('shopping')->weight(),
'txaction' => 'prev',
'mode' => Util::getUserShoppingMode(),
];
}
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
'shipping_net' => Yard::instance('shopping')->shippingNet(2, '.', ''),
'subtotal_ws' => Yard::instance('shopping')->subtotalWithShipping(2, '.', ''),
'tax' => Yard::instance('shopping')->taxWithShipping(2, '.', ''),
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => Yard::instance('shopping')->points(),
'weight' => Yard::instance('shopping')->weight(),
'txaction' => 'prev',
'mode' => Util::getUserShoppingMode(),
];
$shopping_order= false;
if($this->getPayments('shopping_order_id')){
$shopping_order = ShoppingOrder::find($this->getPayments('shopping_order_id'));
@ -493,13 +519,11 @@ class CheckoutController extends Controller
}
$this->putPayments('shopping_order_id', $shopping_order->id);
$items = Yard::instance('shopping')->getContentByOrder();
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order) {
foreach ($items as $item) {
$items = Yard::instance('shopping')->getContentByOrder();
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order, $shopping_user) {
foreach ($items as $item) {
if ($model->row_id === $item->rowId) {
$model->fill([
$data = [
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
'product_id' => $item->id,
@ -509,27 +533,43 @@ class CheckoutController extends Controller
'price_net' => Yard::instance('shopping')->rowPriceNet($item, 3, '.', ''),
'tax_rate' => $item->taxRate,
'slug' => $item->options->slug,
])->save();
];
if($shopping_user->is_from === 'homeparty'){
$data['homeparty_id'] = (int) $shopping_user->homeparty_id;
$data['product_id'] = null;
}
$model->fill($data)->save();
return false;
}
}
return $model->delete();
});
foreach ($items as $item) {
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count())
ShoppingOrderItem::create([
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count()){
$data = [
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
'product_id' => $item->id,
'product_id' => 70,
'comp' => $item->options->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => Yard::instance('shopping')->rowPriceNet($item, 3, '.', ''),
'tax_rate' => $item->taxRate,
'slug' => $item->options->slug
]);
};
];
if($shopping_user->is_from === 'homeparty'){
$data['homeparty_id'] = (int) $shopping_user->homeparty_id;
$data['product_id'] = null;
}
$shopping_order_item = ShoppingOrderItem::create($data);
}
}
return $shopping_order;
}

View file

@ -69,7 +69,9 @@ class Homeparty extends Model
'order_to' => 'bool',
'active' => 'bool',
'default' => 'bool',
'token_active' => 'bool'
'token_active' => 'bool',
'settings' => 'array',
'order' => 'array'
];
protected $dates = [
@ -94,6 +96,8 @@ class Homeparty extends Model
'default',
'token',
'token_active',
'settings',
'order'
];
public function auth_user()

View file

@ -123,7 +123,9 @@ class HomepartyUser extends Model
'shipping_country_id' => 'int',
'has_buyed' => 'bool',
'subscribed' => 'bool',
];
'settings' => 'array',
];
protected $dates = [
'user_deleted_at'
@ -161,7 +163,9 @@ class HomepartyUser extends Model
'subscribed',
'notice',
'mode',
'user_deleted_at'
'settings',
'delivery',
'user_deleted_at'
];
public function homeparty()
@ -190,9 +194,27 @@ class HomepartyUser extends Model
}
public function isAddress(){
if($this->billing_firstname !== null){
if($this->billing_firstname !== null && $this->billing_country_id !== null){
return true;
}
return false;
}
public function getDelivery(){
return $this->delivery === 'direct' ? 'direct' : 'host';
}
public function getShipping(){
if($this->same_as_billing){
$country_id = $this->billing_country_id != null ? $this->billing_country_id : 1;
}else{
$country_id = $this->shipping_country_id != null ? $this->shipping_country_id : 1;
}
$shippingCountry = ShippingCountry::whereCountryId($country_id)->first();
if(!$shippingCountry){
return null;
}
return $shippingCountry->shipping;
}
}

View file

@ -174,6 +174,8 @@ class Product extends Model
'show_order' => 'Wird immer als Option angezeigt',
'upgrade' => 'Produktupgrade zur Produkt ID',
'upgrade_member' => 'Beraterupgrade zur Karriere ID',
'proportional_voucher' => 'Anteiliger Gutschein Berater',
];
public $unitTypes = [
@ -192,6 +194,7 @@ class Product extends Model
4 => 'Nur Mitgliedschaft Berater',
5 => 'Onboarding Berater',
6 => 'Onboarding Berater + Berater Shop',
7 => 'zur internen Berechnung',
];

View file

@ -43,6 +43,7 @@ class ShoppingInstance extends Model
2 => 'Berater Shop',
3 => 'Berater Membership',
4 => 'Berater Wizard',
5 => 'Berater Homeparty',
];
protected $table = 'shopping_instances';

View file

@ -92,6 +92,7 @@ class ShoppingOrder extends Model
'shopping_user_id',
'auth_user_id',
'member_id',
'homeparty_id',
'country_id',
'user_shop_id',
'total',
@ -143,6 +144,11 @@ class ShoppingOrder extends Model
return $this->belongsTo('App\Models\ShippingCountry','country_id');
}
public function homeparty()
{
return $this->belongsTo('App\Models\Homeparty','homeparty_id');
}
public function user_shop()
{
return $this->belongsTo('App\Models\UserShop','user_shop_id');

View file

@ -57,6 +57,7 @@ class ShoppingOrderItem extends Model
'shopping_order_id',
'row_id',
'product_id',
'homeparty_id',
'comp',
'qty',
'price',
@ -76,6 +77,11 @@ class ShoppingOrderItem extends Model
return $this->belongsTo('App\Models\Product','product_id');
}
public function homeparty()
{
return $this->belongsTo('App\Models\Homeparty','homeparty_id');
}
public function getFormattedPrice()
{
return formatNumber($this->attributes['price']);

View file

@ -160,6 +160,7 @@ class ShoppingUser extends Model
'is_for',
'is_from',
'shopping_user_id',
'homeparty_id',
'wp_order_number',
'wp_order_date',
];

View file

@ -79,11 +79,11 @@ class UserHistory extends Model
2 => 'warning',
3 => 'danger',
4 => 'warning',
5 => 'success',
5 => 'warning',
6 => 'danger',
7 => 'warning',
8 => 'success',
9 => 'success',
9 => 'secondary',
10 => 'success',
21 => 'danger',
22 => 'danger',

View file

@ -5,6 +5,8 @@ namespace App\Services;
use App\Models\Homeparty;
use App\Models\Product;
use App\Models\ShippingCountry;
class HomepartyCart
{
@ -26,6 +28,9 @@ class HomepartyCart
public static $ek_price = 0;
public static $income_price = 0;
private static $shipping_total = 0;
private static $shipping_net_total = 0;
private static $homeparty;
private static $userCarts = [];
@ -34,10 +39,14 @@ class HomepartyCart
public static $is_bonus = false;
public static $is_bonus_coupon = false;
private static $bonus_coupon = 0;
private static $bonus_value = 30;
private static $bonus_price = 0;
private static $voucher_price = 0;
public static $voucher_name = "";
private static $bonus_diff = 0;
private static $bonus_points_diff = 0;
private static $bonus_coupon_fault = 0;
@ -51,7 +60,6 @@ class HomepartyCart
500 => 35,
600 => 40,
700 => 50,
];
public static function calculateHomeparty(Homeparty $homeparty){
@ -62,7 +70,9 @@ class HomepartyCart
}
self::$userCarts[$homeparty_user->id] = new HomepartyUserCart($homeparty_user);
self::addCart(self::$userCarts[$homeparty_user->id]);
}
self::caluclateShipping();
self::caluclateBonus();
self::calculateBonusHost();
}
@ -80,15 +90,16 @@ class HomepartyCart
}
public static function caluclateBonus(){
private static function caluclateBonus(){
if(self::$price >= 200){
self::$is_bonus = true;
$proportional_voucher = Product::whereIdentifier('proportional_voucher')->first();
self::$voucher_price = $proportional_voucher->price;
self::$voucher_name = $proportional_voucher->getLang('name');
//TODO get from PRODUCT
self::$bonus_price = 11.90;
self::$price += self::$bonus_price;
self::$price_net += 10;
self::$price += self::$voucher_price;
self::$price_net += $proportional_voucher->getPriceWith(true, false);
$bonus_tmp = self::$price - self::$bonus_value;
@ -118,7 +129,7 @@ class HomepartyCart
}
public static function calculateBonusHost(){
private static function calculateBonusHost(){
if(self::$is_bonus){
$bonus_total = self::$bonus_value + self::$bonus_coupon;
$user_cart = self::getUserCart(self::$user_host_id);
@ -133,11 +144,140 @@ class HomepartyCart
$bonus_percent = (100/$user_cart->price*$bonus_total);
self::$bonus_points_diff = round($user_cart->points/100*$bonus_percent);
$user_cart->points -= self::$bonus_points_diff;
$user_cart->price -= $bonus_total;
$user_cart->price -= $bonus_total;
$user_cart->price_net -= ($bonus_total / config('app.main_tax'));
self::$price -= $bonus_total;
self::$price_net -= ($bonus_total / config('app.main_tax'));
}
}
private static function caluclateShipping(){
//weight to the orders
//first host
$host_user_cart = self::getUserCart(self::$user_host_id);
$host_user_cart->shipping_weight = $host_user_cart->weight;
foreach (self::$homeparty->homeparty_users as $homeparty_user){
if(!$homeparty_user->is_host){
$user_cart = self::$userCarts[$homeparty_user->id];
if($homeparty_user->getDelivery() === 'direct'){
$user_cart->shipping_weight += $user_cart->weight;
}else{
$host_user_cart->shipping_weight += $user_cart->weight;
}
}
}
self::calculateShippingPrice();
}
private static function calculateShippingPrice(){
foreach (self::$homeparty->homeparty_users as $homeparty_user) {
$shipping = $homeparty_user->getShipping();
$user_cart = self::$userCarts[$homeparty_user->id];
if(!$shipping){
return;
}
if($user_cart->shipping_weight === 0){
$shipping_price = $shipping->shipping_prices->first();
$shipping_price->price = 0;
$shipping_price->shipping_price_net = 0;
}else{
//sec by weight
$shipping_price = self::shippingPriceByWeight($shipping->shipping_prices, $user_cart->shipping_weight);
//default
if(!$shipping_price){
$shipping_price = $shipping->shipping_prices->first();
}
}
if($shipping_price){
$price = $shipping_price->price;
$user_cart->shipping_price = $price;
$user_cart->shipping_tax_rate = $shipping_price->tax_rate;
$user_cart->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2);
$user_cart->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2);
}
//on the end, add prices for porto
$user_cart->price += $user_cart->shipping_price;
$user_cart->price_net += $user_cart->shipping_price_net;
self::$price += $user_cart->shipping_price;
self::$price_net += $user_cart->shipping_price_net;
self::$shipping_total += $user_cart->shipping_price;
self::$shipping_net_total += $user_cart->shipping_price_net;
}
}
private static function shippingPriceByWeight($prices, $weight){
foreach ($prices as $price){
if($price->weight_from > 0 && $price->weight_to > 0){
if($weight >= $price->weight_from && $weight <= $price->weight_to){
return $price;
}
}
}
return false;
}
public static function store($identifier, $date){
$data = [
'date' => $date,
'identifier' => $identifier,
'points' => self::$points,
'price' => round(self::$price, 2),
'price_net' => round(self::$price_net, 2),
'ek_price' => round(self::$ek_price, 2),
'income_price' => round(self::$income_price, 2),
'user_host_id' => self::$user_host_id,
'is_bonus' => self::$is_bonus,
'is_bonus_coupon' => self::$is_bonus_coupon,
'bonus_value' => self::$bonus_value,
'bonus_coupon' => self::$bonus_coupon,
'bonus_total' => self::$bonus_value + self::$bonus_coupon,
'shipping_price' => self::$shipping_total,
'shipping_price_net' => self::$shipping_net_total,
'bonus_points_diff' => self::$bonus_points_diff,
'voucher_price' => self::$voucher_price,
'voucher_name' => self::$voucher_name,
];
$user_data = [];
foreach (self::$homeparty->homeparty_users as $homeparty_user){
$user_cart = self::$userCarts[$homeparty_user->id];
$user_data[$homeparty_user->id] = [
'is_host' => $homeparty_user->is_host,
'points' => $user_cart->points,
'price' => round($user_cart->price, 2),
'price_net' => round($user_cart->price_net, 2),
'ek_price' => round($user_cart->ek_price, 2),
'income_price' => round($user_cart->income_price, 2),
'weight' => $user_cart->weight,
'shipping_weight' => $user_cart->shipping_weight,
'shipping_price' => round($user_cart->shipping_price, 2),
'shipping_tax_rate' => round($user_cart->shipping_tax_rate, 2),
'shipping_price_net' => round($user_cart->shipping_price_net, 2),
'shipping_tax' => $user_cart->shipping_tax,
];
}
$data['user_carts'] = $user_data;
self::$homeparty->order = $data;
self::$homeparty->save();
}
public static function getUserCartHost(){
return self::getUserCart(self::$user_host_id);
}
@ -172,7 +312,7 @@ class HomepartyCart
}
public static function getFormattedBonusPrice()
{
return formatNumber(self::$bonus_price);
return formatNumber(self::$voucher_price);
}
public static function getFormattedBonusStart(){
return formatNumber(self::$bonus_start);
@ -211,330 +351,7 @@ class HomepartyCart
return formatNumber( self::$bonus_points_diff, 0 );
}
/* public static function getTaxRate()
{
return config('cart.tax');
}
public function putYardExtra($key, $value){
$content = $this->getYContent();
$content->put($key, $value);
$this->ysession->put($this->yinstance, $content);
}
public function getYardExtra($key){
$content = $this->getYContent();
if ($content->has($key)){
return $content->get($key);
}
return false;
}
public function getShippingCountryName(){
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
if($shippingCountry && $shippingCountry->country){
return $shippingCountry->country->getLocated();
}
return "";
}
public function getShippingCountryCountryId()
{
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
if($shippingCountry && $shippingCountry->country){
return $shippingCountry->country->id;
}
return 1; //default DE
}
public function getShippingCountryId()
{
return $this->shipping_country_id;
}
public function getYContent()
{
if (is_null($this->ysession->get($this->yinstance))) {
return new Collection([]);
}
return $this->ysession->get($this->yinstance);
}
public function reCalculateShippingPrice(){
$this->calculateShippingPrice();
}
public function setShippingCountryWithPrice($shipping_country_id, $shipping_is_for = 'ot')
{
$this->shipping_country_id = $shipping_country_id;
$this->putYardExtra('shipping_country_id', $shipping_country_id);
$this->shipping_is_for = $shipping_is_for;
$this->putYardExtra('shipping_is_for', $shipping_is_for);
$this->calculateShippingPrice();
}
private function calculateShippingPrice(){
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
if(!$shippingCountry){
return;
}
$shipping = $shippingCountry->shipping;
if($this->weight() == 0){
$shipping_price = $shipping->shipping_prices->first();
$shipping_price->price = 0;
$shipping_price->price_comp = 0;
}else{
//first by price
$shipping_price = $this->shippingPriceByTotal($shipping->shipping_prices, $this->total(2, '.', ''));
//sec by weight
if(!$shipping_price){
$shipping_price = $this->shippingPriceByWeight($shipping->shipping_prices, $this->weight());
}
//default
if(!$shipping_price){
$shipping_price = $shipping->shipping_prices->first();
}
}
if($shipping_price){
$price = $shipping_price->price;
$this->num_comp = 0;
if($this->shipping_is_for === 'me'){
$price = $shipping_price->price_comp;
$this->num_comp = $shipping_price->num_comp;
}
$this->shipping_price = $price;
$this->shipping_tax_rate = $shipping_price->tax_rate;
$this->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2);
$this->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2);
$this->putYardExtra('num_comp', $this->num_comp);
$this->putYardExtra('shipping_price', $this->shipping_price);
$this->putYardExtra('shipping_tax_rate', $this->shipping_tax_rate);
$this->putYardExtra('shipping_tax', $this->shipping_tax);
$this->putYardExtra('shipping_price_net', $this->shipping_price_net);
}
}
private function shippingPriceByTotal($prices, $total){
foreach ($prices as $price){
if($price->total_from > 0 && $price->total_to > 0){
if($total >= $price->total_from && $total <= $price->total_to){
return $price;
}
}
}
return false;
}
private function shippingPriceByWeight($prices, $weight){
foreach ($prices as $price){
if($price->weight_from > 0 && $price->weight_to > 0){
if($weight >= $price->weight_from && $weight <= $price->weight_to){
return $price;
}
}
}
return false;
}
public function shipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->shipping_price, $decimals, $decimalPoint, $thousandSeperator);
}
public function shippingNet($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->shipping_price_net, $decimals, $decimalPoint, $thousandSeperator);
}
//
private function shippingTax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->shipping_tax, $decimals, $decimalPoint, $thousandSeperator);
}
//netto
public function subtotalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$subtotal = (float) $this->shipping_price_net + $this->subtotal(2, '.', '');
return $this->numberFormat($subtotal, $decimals, $decimalPoint, $thousandSeperator);
}
public function taxWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$total = $this->totalWithShipping(2, '.', '');
// $totalTax = (float) $this->tax(2, '.', '') + $this->shipping_tax;
$totalTax = $this->subtotalWithShipping(2, '.', '');
return $this->numberFormat(($total - $totalTax), $decimals, $decimalPoint, $thousandSeperator);
}
public function totalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$total = (float) ($this->total(2, '.', '')) + $this->shipping_price;
return $this->numberFormat($total, $decimals, $decimalPoint, $thousandSeperator);
}
public function weight($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
return $total + ($cartItem->options->weight ? ($cartItem->options->weight*$cartItem->qty) : 0);
}, 0);
return $total;
}
public function points()
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
return $total + ($cartItem->options->points ? ($cartItem->options->points * $cartItem->qty) : 0);
}, 0);
return $total;
}
public function compCount()
{
$content = $this->getContent();
$count = parent::count();
$comp_count = $content->reduce(function ($comp_count, CartItem $cartItem) {
return $cartItem->options->comp ? $comp_count + 1 : $comp_count;
}, 0);
return $count-$comp_count;
}
public function total($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
return $total + ($cartItem->qty * $cartItem->price);
}, 0);
return $this->numberFormat($total, $decimals, $decimalPoint, $thousandSeperator);
}
public function tax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$tax = $content->reduce(function ($tax, CartItem $cartItem) {
$priceTax = $cartItem->price / (100 + $cartItem->taxRate) * $cartItem->taxRate;
return $tax + ($cartItem->qty * $priceTax);
}, 0);
return $this->numberFormat($tax, $decimals, $decimalPoint, $thousandSeperator);
}
public function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$subTotal = $content->reduce(function ($subTotal, CartItem $cartItem) {
$price_net = $cartItem->price / ((100 + $cartItem->taxRate) / 100);
return $subTotal + ($cartItem->qty * $price_net);
}, 0);
return $this->numberFormat($subTotal, $decimals, $decimalPoint, $thousandSeperator);
}
public function getCartItemByProduct($product_id, $set_price='with'){
if($product = Product::find($product_id)) {
$image = "";
if ($product->images->count()) {
$image = $product->images->first()->slug;
}
$price = $product->price;
if($set_price === 'with'){
$price = $product->getPriceWith(false, true);
}
$cartItem = $this->getCartItem($product->id, $product->getLang('name'), 1, $price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$content = $this->getContent();
if ($content->has($cartItem->rowId)){
return $content->get($cartItem->rowId);
}
return $cartItem;
}
return null;
}
public function getCartItem($id, $name = null, $qty = null, $price = null, array $options = []){
if ($id instanceof Buyable) {
$cartItem = CartItem::fromBuyable($id, $qty ?: []);
} elseif (is_array($id)) {
$cartItem = CartItem::fromArray($id);
} else {
$cartItem = CartItem::fromAttributes($id, $name, $price, $options);
}
return $cartItem;
}
public function destroy()
{
$this->ysession->remove($this->yinstance);
parent::destroy();
}
public function rowPriceNet(CartItem $row, $decimals = null, $decimalPoint = null, $thousandSeperator = null){
$price = round($row->price / ((100 + $row->taxRate) /100), 4);
return $this->numberFormat($price, $decimals, $decimalPoint, $thousandSeperator);
}
public function rowSubtotalNet(CartItem $row, $decimals = null, $decimalPoint = null, $thousandSeperator = null){
$price = round($row->price / ((100 + $row->taxRate) /100), 4);
return $this->numberFormat(($price * $row->qty), $decimals, $decimalPoint, $thousandSeperator);
}
public function getNumComp(){
return $this->num_comp;
}
public function getCompProductBy($comp, $product_id=false){
foreach ($this->content() as $row) {
if($row->options->comp == $comp) {
return $row->options->product_id;
}
}
return false;
}
public function getContentByOrder(){
$ret = [];
$comp = [];
foreach ($this->content() as $row) {
if($row->options->comp){
$comp[100+$row->options->comp] = $row;
}else{
$ret[] = $row;
}
}
ksort($comp);
$ret = array_merge($ret, $comp);
return $ret;
}
*/
protected function numberFormat($value, $decimals, $decimalPoint, $thousandSeperator)
{
if(is_null($decimals)){

View file

@ -32,17 +32,34 @@ class HomepartyUserCart
public $ek_price;
public $income_price;
public $weight;
public $shipping_weight;
public $shipping_price;
public $shipping_tax_rate;
public $shipping_price_net;
public $shipping_tax;
private $homepartyUser;
public function __construct(HomepartyUser $homepartyUser)
{
$this->homepartyUser = $homepartyUser;
//is all total
$this->points = 0;
$this->price = 0;
$this->price_net = 0;
$this->ek_price = 0;
$this->income_price = 0;
$this->weight = 0;
$this->shipping_weight = 0;
$this->shipping_price = 0;
$this->shipping_tax_rate = 0;
$this->shipping_price_net = 0;
$this->shipping_tax = 0;
$this->calculateUserCart();
}
@ -54,6 +71,7 @@ class HomepartyUserCart
$this->price_net += $order_item->geTotalPriceNet();
$this->ek_price += $order_item->geTotalEKPrice();
$this->income_price += $order_item->geTotalIncomePrice();
$this->weight += ($order_item->product->weight * $order_item->qty);
}
}
@ -82,330 +100,12 @@ class HomepartyUserCart
{
return formatNumber($this->income_price);
}
/* public static function getTaxRate()
public function getFormattedShippingPrice()
{
return config('cart.tax');
}
public function putYardExtra($key, $value){
$content = $this->getYContent();
$content->put($key, $value);
$this->ysession->put($this->yinstance, $content);
return formatNumber($this->shipping_price);
}
public function getYardExtra($key){
$content = $this->getYContent();
if ($content->has($key)){
return $content->get($key);
}
return false;
}
public function getShippingCountryName(){
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
if($shippingCountry && $shippingCountry->country){
return $shippingCountry->country->getLocated();
}
return "";
}
public function getShippingCountryCountryId()
{
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
if($shippingCountry && $shippingCountry->country){
return $shippingCountry->country->id;
}
return 1; //default DE
}
public function getShippingCountryId()
{
return $this->shipping_country_id;
}
public function getYContent()
{
if (is_null($this->ysession->get($this->yinstance))) {
return new Collection([]);
}
return $this->ysession->get($this->yinstance);
}
public function reCalculateShippingPrice(){
$this->calculateShippingPrice();
}
public function setShippingCountryWithPrice($shipping_country_id, $shipping_is_for = 'ot')
{
$this->shipping_country_id = $shipping_country_id;
$this->putYardExtra('shipping_country_id', $shipping_country_id);
$this->shipping_is_for = $shipping_is_for;
$this->putYardExtra('shipping_is_for', $shipping_is_for);
$this->calculateShippingPrice();
}
private function calculateShippingPrice(){
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
if(!$shippingCountry){
return;
}
$shipping = $shippingCountry->shipping;
if($this->weight() == 0){
$shipping_price = $shipping->shipping_prices->first();
$shipping_price->price = 0;
$shipping_price->price_comp = 0;
}else{
//first by price
$shipping_price = $this->shippingPriceByTotal($shipping->shipping_prices, $this->total(2, '.', ''));
//sec by weight
if(!$shipping_price){
$shipping_price = $this->shippingPriceByWeight($shipping->shipping_prices, $this->weight());
}
//default
if(!$shipping_price){
$shipping_price = $shipping->shipping_prices->first();
}
}
if($shipping_price){
$price = $shipping_price->price;
$this->num_comp = 0;
if($this->shipping_is_for === 'me'){
$price = $shipping_price->price_comp;
$this->num_comp = $shipping_price->num_comp;
}
$this->shipping_price = $price;
$this->shipping_tax_rate = $shipping_price->tax_rate;
$this->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2);
$this->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2);
$this->putYardExtra('num_comp', $this->num_comp);
$this->putYardExtra('shipping_price', $this->shipping_price);
$this->putYardExtra('shipping_tax_rate', $this->shipping_tax_rate);
$this->putYardExtra('shipping_tax', $this->shipping_tax);
$this->putYardExtra('shipping_price_net', $this->shipping_price_net);
}
}
private function shippingPriceByTotal($prices, $total){
foreach ($prices as $price){
if($price->total_from > 0 && $price->total_to > 0){
if($total >= $price->total_from && $total <= $price->total_to){
return $price;
}
}
}
return false;
}
private function shippingPriceByWeight($prices, $weight){
foreach ($prices as $price){
if($price->weight_from > 0 && $price->weight_to > 0){
if($weight >= $price->weight_from && $weight <= $price->weight_to){
return $price;
}
}
}
return false;
}
public function shipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->shipping_price, $decimals, $decimalPoint, $thousandSeperator);
}
public function shippingNet($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->shipping_price_net, $decimals, $decimalPoint, $thousandSeperator);
}
//
private function shippingTax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
return $this->numberFormat($this->shipping_tax, $decimals, $decimalPoint, $thousandSeperator);
}
//netto
public function subtotalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$subtotal = (float) $this->shipping_price_net + $this->subtotal(2, '.', '');
return $this->numberFormat($subtotal, $decimals, $decimalPoint, $thousandSeperator);
}
public function taxWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$total = $this->totalWithShipping(2, '.', '');
// $totalTax = (float) $this->tax(2, '.', '') + $this->shipping_tax;
$totalTax = $this->subtotalWithShipping(2, '.', '');
return $this->numberFormat(($total - $totalTax), $decimals, $decimalPoint, $thousandSeperator);
}
public function totalWithShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$total = (float) ($this->total(2, '.', '')) + $this->shipping_price;
return $this->numberFormat($total, $decimals, $decimalPoint, $thousandSeperator);
}
public function weight($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
return $total + ($cartItem->options->weight ? ($cartItem->options->weight*$cartItem->qty) : 0);
}, 0);
return $total;
}
public function points()
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
return $total + ($cartItem->options->points ? ($cartItem->options->points * $cartItem->qty) : 0);
}, 0);
return $total;
}
public function compCount()
{
$content = $this->getContent();
$count = parent::count();
$comp_count = $content->reduce(function ($comp_count, CartItem $cartItem) {
return $cartItem->options->comp ? $comp_count + 1 : $comp_count;
}, 0);
return $count-$comp_count;
}
public function total($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
return $total + ($cartItem->qty * $cartItem->price);
}, 0);
return $this->numberFormat($total, $decimals, $decimalPoint, $thousandSeperator);
}
public function tax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$tax = $content->reduce(function ($tax, CartItem $cartItem) {
$priceTax = $cartItem->price / (100 + $cartItem->taxRate) * $cartItem->taxRate;
return $tax + ($cartItem->qty * $priceTax);
}, 0);
return $this->numberFormat($tax, $decimals, $decimalPoint, $thousandSeperator);
}
public function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
{
$content = $this->getContent();
$subTotal = $content->reduce(function ($subTotal, CartItem $cartItem) {
$price_net = $cartItem->price / ((100 + $cartItem->taxRate) / 100);
return $subTotal + ($cartItem->qty * $price_net);
}, 0);
return $this->numberFormat($subTotal, $decimals, $decimalPoint, $thousandSeperator);
}
public function getCartItemByProduct($product_id, $set_price='with'){
if($product = Product::find($product_id)) {
$image = "";
if ($product->images->count()) {
$image = $product->images->first()->slug;
}
$price = $product->price;
if($set_price === 'with'){
$price = $product->getPriceWith(false, true);
}
$cartItem = $this->getCartItem($product->id, $product->getLang('name'), 1, $price, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$content = $this->getContent();
if ($content->has($cartItem->rowId)){
return $content->get($cartItem->rowId);
}
return $cartItem;
}
return null;
}
public function getCartItem($id, $name = null, $qty = null, $price = null, array $options = []){
if ($id instanceof Buyable) {
$cartItem = CartItem::fromBuyable($id, $qty ?: []);
} elseif (is_array($id)) {
$cartItem = CartItem::fromArray($id);
} else {
$cartItem = CartItem::fromAttributes($id, $name, $price, $options);
}
return $cartItem;
}
public function destroy()
{
$this->ysession->remove($this->yinstance);
parent::destroy();
}
public function rowPriceNet(CartItem $row, $decimals = null, $decimalPoint = null, $thousandSeperator = null){
$price = round($row->price / ((100 + $row->taxRate) /100), 4);
return $this->numberFormat($price, $decimals, $decimalPoint, $thousandSeperator);
}
public function rowSubtotalNet(CartItem $row, $decimals = null, $decimalPoint = null, $thousandSeperator = null){
$price = round($row->price / ((100 + $row->taxRate) /100), 4);
return $this->numberFormat(($price * $row->qty), $decimals, $decimalPoint, $thousandSeperator);
}
public function getNumComp(){
return $this->num_comp;
}
public function getCompProductBy($comp, $product_id=false){
foreach ($this->content() as $row) {
if($row->options->comp == $comp) {
return $row->options->product_id;
}
}
return false;
}
public function getContentByOrder(){
$ret = [];
$comp = [];
foreach ($this->content() as $row) {
if($row->options->comp){
$comp[100+$row->options->comp] = $row;
}else{
$ret[] = $row;
}
}
ksort($comp);
$ret = array_merge($ret, $comp);
return $ret;
}
*/
protected function numberFormat($value, $decimals, $decimalPoint, $thousandSeperator)
{
if(is_null($decimals)){

View file

@ -120,8 +120,14 @@ class Payment
}
}
}
}
}
if($shopping_order->homeparty){
$shopping_order->setUserHistoryValue(['status' => 9]);
$shopping_order->homeparty->completed = 1;
$shopping_order->homeparty->save();
}
return $send_link;
}

View file

@ -67,7 +67,7 @@ return [
'default_mail' => env('APP_DEFAULT_MAIL', 'info@mivita.care'),
'info_test_mail' => env('APP_INFO_TEST_MAIL', 'devtest@mivita.care'),
'main_tax' => env('APP_MAIN_TAX', 1.19),
/* 'url_backend' => env('APP_URL', 'http://mivita.local/'),
'url_backend' => env('APP_URL', 'http://mivita.local/'),
'url_backend' => env('APP_URL', 'http://mivita.local/'),

View file

@ -58,6 +58,7 @@ class CreateShoppingUsersTable extends Migration
$table->boolean('subscribed')->default(false);
$table->text('notice')->default(false);
$table->unsignedInteger('homeparty_id')->nullable();
$table->char('mode', 4)->nullable();

View file

@ -23,6 +23,7 @@ class CreateShoppingOrdersTable extends Migration
$table->unsignedInteger('user_shop_id');
$table->unsignedInteger('member_id')->nullable();
$table->unsignedInteger('homeparty_id')->nullable();
$table->unsignedTinyInteger('payment_for')->nullable();

View file

@ -19,6 +19,7 @@ class CreateShoppingOrderItemsTable extends Migration
$table->unsignedInteger('shopping_order_id');
$table->string('row_id', 40)->nullable();
$table->unsignedInteger('product_id');
$table->unsignedInteger('homeparty_id')->nullable();
$table->unsignedTinyInteger('comp')->nullable();

View file

@ -31,6 +31,9 @@ class CreateHomepartiesTable extends Migration
$table->string('token')->nullable();
$table->boolean('token_active')->default(true);
$table->text('settings')->nullable();
$table->text('order')->nullable();
$table->timestamps();
});
}

View file

@ -54,6 +54,10 @@ class CreateHomepartyUsersTable extends Migration
$table->text('notice')->nullable();
$table->char('mode', 4)->nullable();
$table->char('delivery', 6)->nullable();
$table->text('settings')->nullable();
$table->timestamps();
$table->softDeletes();

View file

@ -13,6 +13,7 @@ var IqHomepartyCart = {
insert_show_total_order: '#insert_show_total_order',
insert_show_bonus: '#insert_show_bonus',
insert_show_bonus_host: '#insert_show_bonus_host',
select_delivery_option: '.select_delivery_option',
/*
comp_holder: '#holder_html_view_comp_product',
is_for: null,
@ -32,7 +33,6 @@ var IqHomepartyCart = {
init: function () {
var _self = this;
_self.url = $(_self.form).attr('action');
_self._log(_self.url);
$(_self.cart_holders).each(function (key, obj){
@ -48,7 +48,6 @@ var IqHomepartyCart = {
},
setDatabase: function (oTable){
var _self = this;
_self._log($(oTable));
_self.oTable = oTable;
},
reInitModal: function (){
@ -78,7 +77,6 @@ var IqHomepartyCart = {
_self.remove_product($(this), _obj)
});
obj.find(_self.table_input).off('change').on('change', function(){
_self._log($(this));
_self.update_input_table($(this), _obj);
});
@ -86,7 +84,9 @@ var IqHomepartyCart = {
_self.remove_from_cart($(this), _obj);
});
obj.find(_self.select_delivery_option).off('change').on('change', function(){
_self.update_delivery_option($(this), _obj);
});
},
add_product: function (_obj, _holder){
@ -133,6 +133,16 @@ var IqHomepartyCart = {
action: 'removeFromCart'
}).done(_self.refreshView);
},
update_delivery_option: function (_obj, _holder){
var _self = this;
_self.performRequest({
delivery: _obj.val(),
homeparty_id: _holder.data('homeparty-id'),
homeparty_user_id: _holder.data('homeparty-user-id'),
action: 'updateDeliveryOption'
}).done(_self.refreshView);
},
refreshView: function (data) {
var _self = IqHomepartyCart;
var obj = $(_self.cart_holder+data.data.homeparty_user_id)
@ -187,98 +197,5 @@ var IqHomepartyCart = {
return 100;
}
return number;
},
/*
showInit: function (){
var _self = this;
$(_self.btn_clear).on('click', function (){
_self.performRequest({action: 'clearCart'})
.done(_self.refreshDatabaseRefreshAndView)
});
$(_self.cart_input).on('change', function(){
_self.update_input_cart($(this));
});
$(_self.remove_item).on('click', function(event){
event.preventDefault();
_self.update_cart_database($(this).data('product-id'), 0);
});
if(_self.is_for === 'me'){
$('input[name^="'+_self.comp_products+'"]').on('change', function(){
_self.update_comp_product($(this));
});
}
},
update_shipping_state : function (_obj){
var _self = this;
var id = parseInt(_obj.val());
var is_for = _obj.data('is-for');
_self.performRequest({shipping_country_id: id, shipping_is_for: is_for, action: 'updateShippingCountry'})
.done(_self.refreshItemsAndView);
},
update_input_table: function (_obj){
var _self = this;
var qty = parseInt(_obj.val());
qty = _self.checkNumber(qty);
_obj.val(qty);
_self.update_cart(_obj.data('product-id'), qty);
},
update_input_cart: function (_obj){
var _self = this;
var qty = parseInt(_obj.val());
qty = _self.checkNumber(qty);
_obj.val(qty);
_self.update_cart_database(_obj.data('product-id'), qty);
},
update_comp_product: function (_obj){
var _self = this;
_self.performRequest({comp_product_id: _obj.val(), comp_num: _obj.data('comp_num'), count_comp_products: $('input[name="'+_self.count_comp_products+'"]').val(), action: 'updateCompProduct'})
.done(_self.refreshItemsAndView);
},
update_cart_database: function (product_id, qty){
var _self = this;
_self.performRequest({product_id: product_id, qty: qty, action: 'updateCart'})
.done(_self.refreshDatabaseAndView);
},
update_cart: function (product_id, qty){
var _self = this;
_self.performRequest({product_id: product_id, qty: qty, action: 'updateCart'})
.done(_self.refreshItemsAndView);
},
refreshItemsAndView: function (data){
var _self = IqShoppingCart;
$(_self.cart_holder).html(data.html_cart);
$(_self.comp_holder).html(data.html_comp);
_self.showInit();
},
refreshDatabaseAndView: function (data) {
var _self = IqShoppingCart;
$(_self.cart_holder).html(data.html_cart);
$(_self.comp_holder).html(data.html_comp);
var input = $(_self.table).find('input[name="product_qty_'+data.data.product_id+'"]');
input.val(data.data.qty);
_self.showInit();
},
refreshDatabaseRefreshAndView : function (data){
var _self = IqShoppingCart;
$(_self.cart_holder).html(data.html_cart);
$(_self.comp_holder).html(data.html_comp);
_self.showInit();
_self.oTable.draw();
},
checkNumber : function(number){
if(number < 0 || isNaN(number)){
return 0;
}
if(number >= 100){
return 100;
}
return number;
},
*/
}
};

View file

@ -26,9 +26,9 @@
<div class="form-row">
<div class="form-group col-sm-5">
<label class="form-label" for="title">{{ __('Kategorie (Mehrfachauswahl)') }}</label>
<select class="selectpicker" name="categories[]" id="categories" data-style="btn-light" data-live-search="false" multiple>
{!! HTMLHelper::getCategoriesOptions($product->categories()->pluck('category_id')->toArray()) !!}
<label class="form-label" for="title">{{ __('Kategorie (Mehrfachauswahl)') }}*</label>
<select class="selectpicker" name="categories[]" id="categories" data-style="btn-light" data-live-search="false" multiple required>
{!! HTMLHelper::getCategoriesOptions($product->categories()->pluck('category_id')->toArray(), false) !!}
</select>
</div>
<div class="form-group col-sm-5">

View file

@ -177,11 +177,13 @@
</div>
</div>
</div>
<hr class="m-0">
<!-- / Billing -->
<!-- Shipping -->
<div class="card-body">
@if(!$shopping_order->shopping_user->is_from === 'homeparty')
<hr class="m-0">
<div class="card-body">
<h6 class="small font-weight-semibold">
@if($shopping_order->shopping_user->is_from === 'user_order')
@if($shopping_order->shopping_user->is_for === 'me')
@ -256,6 +258,7 @@
</div>
@endif
</div>
@endif
<hr class="m-0">
<!-- / Shipping -->
@ -278,6 +281,10 @@
@if($shopping_order->shopping_user->is_from === 'shopping')
<strong>Kundenbestellung über Shop</strong>
@endif
@if($shopping_order->shopping_user->is_from === 'homeparty')
<h5>Beraterbestellung für eine Homeparty</h5>
<hr>
@endif
</h6>
<style>
table.table-product, table.table-product tr td, table.table-product tr th {
@ -291,7 +298,8 @@
}
</style>
<div class="table-responsive">
@if(!$shopping_order->shopping_user->is_from === 'homeparty')
<div class="table-responsive">
<table class="table table-product m-0" style="">
<tbody>
<tr class="border-bottom">
@ -393,6 +401,105 @@
</tfoot>
</table>
</div>
@else
@if($shopping_order->homeparty)
<style>
.table-small {
font-size: 0.9em;
width: auto;
}
.table-small td {
padding: 0.225rem 1rem 0.225rem 0;
}
.btn-md-extra {
padding: 0.3rem 0.6rem;
font-size: 0.8rem;
line-height: 1.5;
border-radius: 0.25rem;
}
.md-btn-extra {
width: calc(1.7rem + 2px) !important;
line-height: 1.5rem;
}
.form-control.input-extra {
padding: 0.28rem 0.6rem;
font-size: 0.8rem;
font-weight: 500;
min-height: calc(1.8rem + 2px);
height: calc(1.8rem + 2px);
width: 44px;
}
.input-group-min-w {
min-width: 102px;
}
.img-extra {
min-width:55px;
max-height: 120px;
}
.table td.border-top {
border: none;
border-top: 1px solid #ccccdb;
}
.table td {
border: none;
}
.table th {
border: none;
border-bottom: 1px solid #c3c3d2;
}
@media (max-width: 767px) {
.default-style:not([dir=rtl]) div.card-datatable table.dataTable thead th:first-child,
.default-style:not([dir=rtl]) div.card-datatable table.dataTable tbody td:first-child,
.default-style:not([dir=rtl]) div.card-datatable table.dataTable tfoot th:first-child {
padding-left: 0.6rem !important;
}
.img-extra {
min-width:35px;
max-height: 160px;
}
}
.table .foot-small td {
padding: 0.225rem 0.625rem;
}
.table .text-body {
font-size: 0.9em;
}
.table .options a.auto-delete-product {
font-size: 0.7em;
font-weight: bold;
text-transform: uppercase;
}
.table .min-width-80 {
min-width: 160px;
}
</style>
@php($homeparty = $shopping_order->homeparty)
@if($homeparty->homeparty_host)
<p><strong>Bestellung Gastgeber/in {{$homeparty->homeparty_host->billing_firstname}} {{$homeparty->homeparty_host->billing_lastname}}</strong></p>
@include('admin.sales._detail_homparty', ['homeparty'=>$shopping_order->homeparty, 'homeparty_guest' => $homeparty->homeparty_host])
@endif
@if($homeparty->homeparty_guests)
@php($g_count = 1)
@foreach($homeparty->homeparty_guests as $homeparty_guest)
<hr>
<p><strong>Bestellung {!! $g_count++ !!}. Gast {{$homeparty_guest->billing_firstname}} {{$homeparty_guest->billing_lastname}}</strong></p>
@include('admin.sales._detail_homparty', ['homeparty'=>$shopping_order->homeparty, 'homeparty_guest' => $homeparty_guest])
@endforeach
@endif
<hr>
@include('admin.sales._detail_homparty_total', ['homeparty' => $homeparty])
@endif
@endif
</div>
<hr class="m-0">

View file

@ -0,0 +1,246 @@
@if($homeparty_guest && $homeparty_guest->homeparty_user_order_items->count() || $homeparty_guest->is_host)
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{__('Bild')}}</th>
<th>{{__('Produkt')}}</th>
<th>{{__('Anzahl')}}</th>
<th>{{__('Marge')}}</th>
<th class="text-right">{{__('EK-Preis')}}</th>
<th class="text-right">{{__('Points')}}</th>
<th class="text-right">{{__('Verdienst')}}</th>
<th class="text-right">{{__('VK-Preis')}}</th>
</tr>
</thead>
<tbody>
@foreach($homeparty_guest->homeparty_user_order_items as $value)
<tr>
<td>
@if(count($value->product->images))
<img class="img-fluid img-extra" alt="" src="{{ route('product_image', [$value->product->images->first()->slug]) }}">
@endif
</td>
<td class="min-width-80">
<strong>{{ $value->product->name }}</strong>
<div class="text-body">
<div>Inhalt: {{ $value->product->contents }}</div>
<div>Art.-Nr.: {{ $value->product->number }}</div>
</div>
</td>
<td>
{{$value->qty}}
</td>
<td>
{{ $value->margin }}%
</td>
<td class="text-right">
{{ $value->getFormattedTotalEKPrice() }} &euro;
</td>
<td class="text-right">
{{ $value->getFormattedTotalPoints() }}
</td>
<td class="text-right">
{{ $value->getFormattedTotalIncomePrice() }} &euro;
</td>
<td class="text-right">
{{ $value->getFormattedTotalPrice() }} &euro;
</td>
</tr>
@endforeach
</tbody>
<tfoot id="insert_show_bonus_host">
@php($user_cart = $homeparty->order['user_carts'][$homeparty_guest->id])
@php($hp_order = $homeparty->order)
@if(!$homeparty_guest->is_host)
<tr class="foot-small">
<td colspan="8" class="text-left">
@if($homeparty_guest->getDelivery() === 'host')
Lieferung an Gastgeber
@endif
@if($homeparty_guest->getDelivery() === 'direct')
Lieferung direkt an den Gast
@endif
</td>
</tr>
@if($homeparty_guest->getDelivery() === 'direct')
<tr>
<td colspan="5" class="text-left">Versandkosten</td>
<td>&nbsp;</td>
<td class="text-right">&nbsp;</td>
<td class="text-right">{{ Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
</tr>
@endif
<tr>
<td colspan="4" class="border-top"><strong>Gesamt:</strong></td>
<td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['ek_price'])}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{$user_cart['points']}}</strong></td>
<td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['income_price'])}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
</tr>
@else
@if($hp_order['is_bonus'])
<tr class="foot-small">
<td colspan="5" class="text-left">Gutschrift Homeparty Gutschein</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="text-right">- {{ Util::formatNumber($hp_order['bonus_value']) }} &euro;</td>
</tr>
@endif
@if($hp_order['is_bonus_coupon'])
<tr class="foot-small">
<td colspan="5" class="text-left">Gutschrift Bonus</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="text-right">- {{ Util::formatNumber($hp_order['bonus_coupon']) }} &euro;</td>
</tr>
@endif
@if($hp_order['is_bonus'])
<tr class="foot-small">
<td colspan="5" class="text-left">Abzug Points durch Gutschein</td>
<td class="text-right">- {{ $hp_order['bonus_points_diff'] }} </td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
@endif
<tr class="foot-small">
<td colspan="5" class="text-left">Versandkosten:</td>
<td>&nbsp;</td>
<td class="text-right">&nbsp;</td>
<td class="text-right">{{Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
</tr>
<tr>
<td colspan="4" class="border-top"><strong>Summen:</strong></td>
<td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['ek_price'])}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{$user_cart['points']}}</strong></td>
<td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['income_price'])}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
</tr>
@endif
</tfoot>
</table>
</div>
@if($homeparty_guest->is_host || $homeparty_guest->getDelivery() === 'direct')
<hr class="m-0">
<div class="card-body" style="background-color: #E5E9EF">
<h6 class="small font-weight-semibold">
Lieferadresse
</h6>
@if($homeparty_guest->same_as_billing)
<div class="row">
@if($homeparty_guest->billing_company)
<div class="col-md-12 mb-3">
<div class="text-muted small">Firma</div>
{{ $homeparty_guest->billing_company }}
</div>
@endif
<div class="col-md-3 mb-3">
<div class="text-muted small">Anrede</div>
{{ \App\Services\HTMLHelper::getSalutationLang($homeparty_guest->billing_salutation) }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Vorname</div>
{{ $homeparty_guest->billing_firstname }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Nachname</div>
{{ $homeparty_guest->billing_lastname }}
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<div class="text-muted small">Straße</div>
{{ $homeparty_guest->billing_address }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Zusatz</div>
{{ $homeparty_guest->billing_address_2 }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">PLZ</div>
{{ $homeparty_guest->billing_zipcode }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Stadt</div>
{{ $homeparty_guest->billing_city }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">E-Mail</div>
{{ $homeparty_guest->billing_email }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Telefon</div>
{{ $homeparty_guest->billing_phone }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Land</div>
{{ $homeparty_guest->billing_country->getLocated() }}
</div>
</div>
@else
<div class="row">
@if($homeparty_guest->shipping_company)
<div class="col-md-12 mb-3">
<div class="text-muted small">Firma</div>
{{ $homeparty_guest->shipping_company }}
</div>
@endif
<div class="col-md-3 mb-3">
<div class="text-muted small">Anrede</div>
{{ \App\Services\HTMLHelper::getSalutationLang($homeparty_guest->shipping_salutation) }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Vorname</div>
{{ $homeparty_guest->shipping_firstname }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Nachname</div>
{{ $homeparty_guest->shipping_lastname }}
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<div class="text-muted small">Straße</div>
{{ $homeparty_guest->shipping_address }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Zusatz</div>
{{ $homeparty_guest->shipping_address_2 }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">PLZ</div>
{{ $homeparty_guest->shipping_zipcode }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Stadt</div>
{{ $homeparty_guest->shipping_city }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">E-Mail</div>
{{ $homeparty_guest->shipping_email }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Telefon</div>
{{ $homeparty_guest->shipping_phone }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Land</div>
{{ $homeparty_guest->shipping_country->getLocated() }}
</div>
</div>
@endif
</div>
@endif
@else
<p>Keine Bestellung</p>
@endif

View file

@ -0,0 +1,58 @@
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Gesamt</th>
<th class="text-right">{{__('EK-Preis')}}</th>
<th class="text-right">{{__('Points')}}</th>
<th class="text-right">{{__('Verdienst')}}</th>
<th class="text-right">{{__('VK-Preis')}}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
@php($hp_order = $homeparty->order)
@if($hp_order['is_bonus'])
<tr class="foot-small">
<td colspan="4" class="border-top">
{{ $hp_order['voucher_name'] }}
</td>
<td class="border-top text-right">{{ Util::formatNumber($hp_order['voucher_price'])}} &euro;</td>
</tr>
@endif
<tr class="foot-small">
<td colspan="1" class="border-top">
<strong>Gesamtsummen:</strong>
</td>
<td class="border-top text-right"><strong>{{ Util::formatNumber($hp_order['ek_price'])}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{ $hp_order['points']}}</strong></td>
<td class="border-top text-right"><strong>{{ Util::formatNumber($hp_order['income_price'])}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{ Util::formatNumber($hp_order['price'])}} &euro;</strong></td>
</tr>
<tr class="foot-small">
<td colspan="1" class="text-muted">
Summe ohne MwSt:
</td>
<td class="">&nbsp;</td>
<td class="">&nbsp;</td>
<td class="">&nbsp;</td>
<td class="text-muted text-right">{{ Util::formatNumber($hp_order['price_net'])}} &euro;</td>
</tr>
<tr class="foot-small">
<td colspan="1" class="text-muted">
Enthaltene MwSt:
</td>
<td class="">&nbsp;</td>
<td class="">&nbsp;</td>
<td class="">&nbsp;</td>
<td class="text-muted text-right">{{ Util::formatNumber($hp_order['price']-$hp_order['price_net'])}} &euro;</td>
</tr>
</tfoot>
</table>
</div>

View file

@ -165,10 +165,35 @@
@if($shopping_order->shopping_user->is_from === 'shopping')
<b>{{__('email.checkout_mail_hl1')}}</b>
@endif
@if($shopping_order->shopping_user->is_from === 'homeparty')
<b>{{ __('navigation.my_homeparty') }} / {{ $shopping_order->homeparty->name }} - {{ $shopping_order->homeparty->date }}</b><br>
<b>{{__('email.checkout_mail_hl1')}}</b>
@endif
</td>
</tr>
<tr>
<td>
@if($shopping_order->shopping_user->is_from === 'homeparty')
@php($homeparty = $shopping_order->homeparty)
@if($homeparty->homeparty_host)
<p><strong>Bestellung Gastgeber/in {{$homeparty->homeparty_host->billing_firstname}} {{$homeparty->homeparty_host->billing_lastname}}</strong></p>
@include('emails.homeparty_detail', ['homeparty'=>$shopping_order->homeparty, 'homeparty_guest' => $homeparty->homeparty_host])
@endif
@if($homeparty->homeparty_guests)
@php($g_count = 1)
@foreach($homeparty->homeparty_guests as $homeparty_guest)
<hr>
<p><strong>Bestellung {!! $g_count++ !!}. Gast {{$homeparty_guest->billing_firstname}} {{$homeparty_guest->billing_lastname}}</strong></p>
@include('emails.homeparty_detail', ['homeparty'=>$shopping_order->homeparty, 'homeparty_guest' => $homeparty_guest])
@endforeach
@endif
<hr>
@include('emails.homeparty_detail_total', ['homeparty' => $homeparty])
@else
<table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">
<tr>
<th style="color:#43413f; text-align: left; vertical-align: top;line-height:1.2em;">Produkt</th>
@ -256,6 +281,7 @@
</td>
</tr>
</table>
@endif
</td>
</tr>

View file

@ -211,10 +211,35 @@
@if($shopping_order->shopping_user->is_from === 'shopping')
<b>{{__('email.checkout_mail_hl1')}}</b>
@endif
@if($shopping_order->shopping_user->is_from === 'homeparty')
<b>{{ __('navigation.my_homeparty') }} / {{ $shopping_order->homeparty->name }} - {{ $shopping_order->homeparty->date }}</b><br>
<b>{{__('email.checkout_mail_hl1')}}</b>
@endif
</td>
</tr>
<tr>
<td>
@if($shopping_order->shopping_user->is_from === 'homeparty')
@php($homeparty = $shopping_order->homeparty)
@if($homeparty->homeparty_host)
<p><strong>Bestellung Gastgeber/in {{$homeparty->homeparty_host->billing_firstname}} {{$homeparty->homeparty_host->billing_lastname}}</strong></p>
@include('emails.homeparty_detail', ['homeparty'=>$shopping_order->homeparty, 'homeparty_guest' => $homeparty->homeparty_host])
@endif
@if($homeparty->homeparty_guests)
@php($g_count = 1)
@foreach($homeparty->homeparty_guests as $homeparty_guest)
<hr>
<p><strong>Bestellung {!! $g_count++ !!}. Gast {{$homeparty_guest->billing_firstname}} {{$homeparty_guest->billing_lastname}}</strong></p>
@include('emails.homeparty_detail', ['homeparty'=>$shopping_order->homeparty, 'homeparty_guest' => $homeparty_guest])
@endforeach
@endif
<hr>
@include('emails.homeparty_detail_total', ['homeparty' => $homeparty])
@else
<table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">
<tr>
<th style="color:#43413f; text-align: left; vertical-align: top;line-height:1.2em;">Produkt</th>
@ -302,6 +327,7 @@
</td>
</tr>
</table>
@endif
</td>
</tr>

View file

@ -0,0 +1,142 @@
@if($homeparty_guest && $homeparty_guest->homeparty_user_order_items->count() || $homeparty_guest->is_host)
<table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">
<tr>
<th>{{__('Produkt')}}</th>
<th style="color:#37302d; text-align: right;">{{__('Anzahl')}}</th>
<th style="color:#37302d; text-align: right;">{{__('VK-Preis')}}</th>
</tr>
@foreach($homeparty_guest->homeparty_user_order_items as $value)
<tr>
<td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
<strong>{{ $value->product->name }}</strong><br>
Art.-Nr.: {{ $value->product->number }}
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
{{$value->qty}}
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
{{ $value->getFormattedTotalPrice() }} &euro;
</td>
</tr>
@endforeach
@php($user_cart = $homeparty->order['user_carts'][$homeparty_guest->id])
@php($hp_order = $homeparty->order)
@if(!$homeparty_guest->is_host)
<tr>
<td colspan="3" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
@if($homeparty_guest->getDelivery() === 'host')
Lieferung an Gastgeber
@endif
@if($homeparty_guest->getDelivery() === 'direct')
Lieferung direkt an den Gast
@endif
</td>
</tr>
@if($homeparty_guest->getDelivery() === 'direct')
<tr>
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Versandkosten</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{ Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
</tr>
@endif
<tr>
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;"><strong>Gesamt:</strong></td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
</tr>
@else
@if($hp_order['is_bonus'])
<tr>
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Gutschrift Homeparty Gutschein</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">- {{ Util::formatNumber($hp_order['bonus_value']) }} &euro;</td>
</tr>
@endif
@if($hp_order['is_bonus_coupon'])
<tr>
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Gutschrift Bonus</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">- {{ Util::formatNumber($hp_order['bonus_coupon']) }} &euro;</td>
</tr>
@endif
@if($hp_order['is_bonus'])
@endif
<tr>
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Versandkosten:</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
</tr>
<tr>
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;"><strong>Summen:</strong></td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
</tr>
@endif
</table>
@if($homeparty_guest->is_host || $homeparty_guest->getDelivery() === 'direct')
<table style="padding: 0px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td style="color:#37302d; ">
<table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="color:#37302d;line-height:1.6em;">
@if($homeparty_guest->same_as_billing)
@if($homeparty_guest->billing_company)
{{ $homeparty_guest->billing_company }}<br>
@endif
{{ $homeparty_guest->billing_firstname }}
{{ $homeparty_guest->billing_lastname }} <br>
<br>
{{ $homeparty_guest->billing_address }} <br>
@if($homeparty_guest->billing_address_2)
{{ $homeparty_guest->billing_address_2 }}<br>
@endif
{{ $homeparty_guest->billing_zipcode }}
{{ $homeparty_guest->billing_city }} <br>
{{ $homeparty_guest->billing_country->getLocated() }} <br>
@if($homeparty_guest->billing_phone)
<br><br> {{ $homeparty_guest->billing_phone }}<br>
@endif
@else
@if($homeparty_guest->shipping_company)
{{ $homeparty_guest->shipping_company }}<br>
@endif
{{ $homeparty_guest->shipping_firstname }}
{{ $homeparty_guest->shipping_lastname }} <br>
<br>
{{ $homeparty_guest->shipping_address }} <br>
@if($homeparty_guest->shipping_address_2)
{{ $homeparty_guest->shipping_address_2 }}<br>
@endif
{{ $homeparty_guest->shipping_zipcode }}
{{ $homeparty_guest->shipping_city }} <br>
{{ $homeparty_guest->shipping_country->getLocated() }} <br>
@if($homeparty_guest->shipping_phone)
<br><br> {{ $homeparty_guest->shipping_phone }}<br>
@endif
@endif
</td>
</tr>
</table>
</td>
</tr>
</table>
@endif
@endif

View file

@ -0,0 +1,38 @@
@php($hp_order = $homeparty->order)
<table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">
<tr>
<th>Gesamt</th>
<th style="color:#37302d; text-align: right;">{{__('VK-Preis')}}</th>
</tr>
@if($hp_order['is_bonus'])
<tr class="foot-small">
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
{{ $hp_order['voucher_name'] }}
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{ Util::formatNumber($hp_order['voucher_price'])}} &euro;</td>
</tr>
@endif
<tr class="foot-small">
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
<strong>Gesamtsummen:</strong>
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;"><strong>{{ Util::formatNumber($hp_order['price'])}} &euro;</strong></td>
</tr>
<tr class="foot-small">
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
Summe ohne MwSt:
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{ Util::formatNumber($hp_order['price_net'])}} &euro;</td>
</tr>
<tr class="foot-small">
<td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
Enthaltene MwSt:
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{ Util::formatNumber($hp_order['price']-$hp_order['price_net'])}} &euro;</td>
</tr>
</table>

View file

@ -3,7 +3,9 @@
@section('content')
<h4 class="font-weight-bold py-2 mb-2 d-flex justify-content-between align-items-center w-100 ">
<div>{{ __('navigation.my_homeparty') }} / {{ $homeparty->name }} - {{ $homeparty->date }}</div>
<a href="{{route('user_homeparty_guest_detail', [$homeparty->id, 'new'])}}" class="btn btn-sm btn-secondary rounded-pill d-block float-right"><span class="ion ion-md-add"></span>&nbsp; Neue Gast anlegen</a>
@if(!$homeparty->completed)
<a href="{{route('user_homeparty_guest_detail', [$homeparty->id, 'new'])}}" class="btn btn-sm btn-secondary rounded-pill d-block float-right"><span class="ion ion-md-add"></span>&nbsp; Neue Gast anlegen</a>
@endif
</h4>
<div class="row">
@ -24,6 +26,8 @@
</a>
{{-- <span class="badge badge-success align-text-bottom ml-1">offen ...</span> --}}
</div>
@if(!$homeparty->completed)
<div>
<a href="{{route('user_homeparty_guest_detail', [$homeparty->id, $homeparty_user->id])}}" class="btn btn-sm btn-secondary mr-2"><i class="fa fa-edit"></i> bearbeiten</a>
<div class="btn-group project-actions">
@ -46,6 +50,7 @@
</div>
</div>
@endif
</div>
<div class="progress rounded-0" style="height: 2px;">
<div class="progress-bar" style="width: 100%;"></div>
@ -79,7 +84,10 @@
</div>
</div>
<div class="text-left mt-1">
@if(!$homeparty->completed)
<a href="{{route('user_homeparty_detail', [$homeparty->id])}}" class="btn btn-sm btn-secondary mr-2 mb-2"><i class="ion ion-ios-cog"></i> Homparty verwalten</a>
@endif
<a href="{{route('user_homeparty_order', [$homeparty->id])}}" class="btn btn-sm btn-secondary mr-2 mb-2"><i class="ion ion-md-basket"></i> Bestellung</a>
<a href="{{route('user_homepartys')}}" class="btn btn-sm btn-default mb-2">zurück zur Übersicht</a>
</div>

View file

@ -14,8 +14,12 @@
<div class="card-body d-flex justify-content-between align-items-start pb-2">
<div>
<a href="{{route('user_homeparty_detail', [$homeparty->id])}}" class="text-body text-big font-weight-semibold">{{$homeparty->name}}</a>
{{-- <span class="badge badge-success align-text-bottom ml-1">offen ...</span> --}}
@if($homeparty->completed)
<span class="badge badge-secondary align-text-bottom ml-1">abgeschlossen</span>
@endif
</div>
@if(!$homeparty->completed)
<div class="btn-group project-actions">
<button type="button" class="btn btn-sm btn-default icon-btn borderless rounded-pill md-btn-flat dropdown-toggle hide-arrow" data-toggle="dropdown">
<i class="ion ion-ios-more"></i>
@ -27,6 +31,7 @@
</a>
</div>
</div>
@endif
</div>
<div class="progress rounded-0" style="height: 2px;">
<div class="progress-bar" style="width: 100%;"></div>
@ -50,14 +55,15 @@
</div>
<div class="col">
<div class="text-muted small">Umsatz</div>
<div class="font-weight-bold">0</div>
<div class="font-weight-bold">@if(isset($homeparty->order['price'])){{Util::formatNumber($homeparty->order['price'])}}@endif</div>
</div>
<div class="col">
<div class="text-muted small">Points</div>
<div class="font-weight-bold">0</div>
<div class="font-weight-bold">@if(isset($homeparty->order['points'])){{$homeparty->order['points']}}@endif</div>
</div>
</div>
</div>
@if(!$homeparty->completed)
<hr class="m-0">
<div class="card-body py-3">
<div class="form-group mb-0">
@ -69,12 +75,21 @@
</div>
</div>
</div>
@endif
<hr class="m-0">
<div class="card-body py-3">
<div class="d-flex flex-wrap">
@if(!$homeparty->completed)
<a href="{{route('user_homeparty_detail', [$homeparty->id])}}" class="btn btn-secondary mr-2 mb-2"><i class="ion ion-ios-cog"></i> Verwalten</a>
<a href="{{route('user_homeparty_guests', [$homeparty->id])}}" class="btn btn-secondary mr-2 mb-2"><i class="ion ion-md-person-add"></i> Gäste anlegen</a>
<a href="{{route('user_homeparty_order', [$homeparty->id])}}" class="btn btn-secondary mr-2 mb-2"><i class="ion ion-md-basket"></i> Bestellung</a>
<a href="{{route('user_homeparty_order', [$homeparty->id])}}" class="btn btn-secondary mr-2 mb-2"><i class="ion ion-md-basket"></i> Bestellung</a>
@else
<a href="{{route('user_homeparty_guests', [$homeparty->id])}}" class="btn btn-secondary mr-2 mb-2"><i class="ion ion-md-person"></i> Gäste ansehen</a>
<a href="{{route('user_homeparty_order', [$homeparty->id])}}" class="btn btn-secondary mr-2 mb-2"><i class="ion ion-md-basket"></i> Bestellung ansehen</a>
@endif
</div>
</div>
</div>

View file

@ -84,6 +84,10 @@
<a href="{{route('user_homepartys')}}" class="btn btn-sm btn-default float-right">zurück</a>
</h4>
@if($userHistoryPaymentOrder && $userHistoryPaymentOrder->status > 2)
<h6 class="alert badge-{{$userHistoryPaymentOrder->getStatusColor()}}">Eine Zahlung wurde ausgeführt. Status: {{ trans('payment.status.'.$userHistoryPaymentOrder->getStatusType())}}</h6>
@endif
{!! Form::open(['url' => route('user_homeparty_order', [$homeparty->id]), 'class' => 'form-horizontal', 'id'=>'homeparty-order-form']) !!}
<div class="card mb-4">
@ -92,10 +96,12 @@
<div class="col-12">
<div class="d-flex justify-content-between align-items-center w-100">
<div>Bestellung anlegen</div>
@if(!$homeparty->completed)
<div class="float-right">
<a href="{{route('user_homeparty_detail', [$homeparty->id])}}" class="btn btn-sm btn-secondary mr-2 mb-1"><i class="ion ion-ios-cog"></i> Verwalten</a>
<a href="{{route('user_homeparty_guests', [$homeparty->id])}}" class="btn btn-sm btn-secondary mr-2 mb-1"><i class="ion ion-md-person-add"></i> Gäste anlegen</a>
</div>
@endif
</div>
</div>
</div>
@ -103,7 +109,11 @@
<div class="card-body">
<div class="row">
<div class="col-md-6">
<h6>Lieferadresse Gastgeber/in <a href="{{route('user_homeparty_guest_detail', [$homeparty->id, $homeparty->homeparty_host->id])}}"><i class="fa fa-edit"></i> </a></h6>
<h6>Lieferadresse Gastgeber/in
@if(!$homeparty->completed)
<a href="{{route('user_homeparty_guest_detail', [$homeparty->id, $homeparty->homeparty_host->id])}}"><i class="fa fa-edit"></i> </a>
@endif
</h6>
@include('user.homeparty._address', ['homeparty_user' => $homeparty->homeparty_host])
</div>
@ -128,6 +138,7 @@
<div>Bestellung Gastgeber/in {{$homeparty->homeparty_host->billing_firstname}} {{$homeparty->homeparty_host->billing_lastname}}</div>
</div>
</div>
@if(!$homeparty->completed)
<div class="col-12">
<button type="button" class="btn btn-sm btn-secondary btn-block mt-2" data-toggle="modal" data-target="#modals-load-content"
data-id="{{ $homeparty->id }}"
@ -135,6 +146,7 @@
data-user_id="{{$homeparty->homeparty_host->id}}"
data-route="{{ route('modal_load') }}"><i class="fa fa-plus-circle"></i> Produkt hinzufügen</button>
</div>
@endif
</div>
</h5>
<div class="card-body">
@ -156,6 +168,7 @@
<div>Bestellung {!! $g_count++ !!}. Gast {{$homeparty_guest->billing_firstname}} {{$homeparty_guest->billing_lastname}}</div>
</div>
</div>
@if(!$homeparty->completed)
<div class="col-12">
<button type="button" class="btn btn-sm btn-secondary btn-block mt-2" data-toggle="modal" data-target="#modals-load-content"
data-id="{{ $homeparty->id }}"
@ -163,6 +176,7 @@
data-user_id="{{$homeparty_guest->id}}"
data-route="{{ route('modal_load') }}"><i class="fa fa-plus-circle"></i> Produkt hinzufügen</button>
</div>
@endif
</div>
</h5>
<div class="card-body">
@ -186,31 +200,32 @@
</div>
</h5>
{{-- TODO Berechnung des WK --}}
<div class="card-body">
<div id="insert_show_total_order">
@include('user.homeparty.show_total_order', ['homeparty' => $homeparty])
</div>
<hr>
@if($homeparty->homeparty_host && $homeparty->homeparty_host->isAddress())
<div class="float-right">
<button type="submit" class="btn btn-secondary"><i class="ion ion-ios-redo"></i> bestätigen und weiter zur Kasse</button>
</div>
<br><br>
<em class="small text-center"> <i class="fa fa-lock"></i> Du wirst auf unseren checkout Server weitergeletet, die Verbindung ist SSL verschlüsselt.</em>
@else
<div class="alert alert-warning">
Die Bestellung kann erst abgesendet werden, wenn die Lieferadresse Gastgeber/in angelegt ist. <a href="{{route('user_homeparty_guest_detail', [$homeparty->id, $homeparty->homeparty_host->id])}}"><i class="fa fa-edit"></i> </a></h6>
@if(!$homeparty->completed)
<hr>
@if($homeparty->homeparty_host && $homeparty->homeparty_host->isAddress())
<div class="float-right">
<button type="submit" class="btn btn-secondary"><i class="ion ion-ios-redo"></i> bestätigen und weiter zur Kasse</button>
</div>
<br><br>
<em class="small text-center"> <i class="fa fa-lock"></i> Du wirst auf unseren checkout Server weitergeletet, die Verbindung ist SSL verschlüsselt.</em>
@else
<div class="alert alert-warning">
Die Bestellung kann erst abgesendet werden, wenn die Lieferadresse Gastgeber/in angelegt ist. <a href="{{route('user_homeparty_guest_detail', [$homeparty->id, $homeparty->homeparty_host->id])}}"><i class="fa fa-edit"></i> </a></h6>
</div>
@endif
@endif
</div>
</div>
<div class="text-left mt-3">
@if(!$homeparty->completed)
<a href="{{route('user_homeparty_detail', [$homeparty->id])}}" class="btn btn-sm btn-secondary mr-2 mb-2"><i class="ion ion-ios-cog"></i> Homparty verwalten</a>
@endif
<a href="{{route('user_homepartys')}}" class="btn btn-sm btn-default mb-2">zurück zur Übersicht</a>
</div>
{!! Form::close() !!}

View file

@ -27,8 +27,8 @@
<tr class="foot-small">
<td colspan="5" class="text-left">Versandkosten:</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="text-right">0 &euro;</td>
<td class="text-right">&nbsp;</td>
<td class="text-right">{{$user_cart->getFormattedShippingPrice()}} &euro;</td>
</tr>
<tr>
<td colspan="4" class="border-top"><strong>Gesamt:</strong></td>

View file

@ -1,4 +1,4 @@
@if($homeparty_guest && $homeparty_guest->homeparty_user_order_items->count())
@if($homeparty_guest && $homeparty_guest->homeparty_user_order_items->count() || $homeparty_guest->is_host)
<div class="table-responsive">
<table class="table table-striped">
<thead>
@ -27,11 +27,14 @@
<div>Inhalt: {{ $value->product->contents }}</div>
<div>Art.-Nr.: {{ $value->product->number }}</div>
</div>
<div class="options">
@if(!$homeparty->completed)
<div class="options">
<a href="#" class="auto-delete-product remove_item_form_cart product-tooltip" data-order-item-id="{{$value->id}}" data-product-id="{{ $value->product->id }}"><i class="fa fa-times"></i> Artikel entfernen</a>
</div>
@endif
</td>
<td>
@if(!$homeparty->completed)
<div class="no-line-break input-group-min-w">
<div class="input-group d-inline-flex w-auto">
<span class="input-group-prepend">
@ -43,6 +46,9 @@
</span>
</div>
</div>
@else
{{$value->qty}}
@endif
</td>
<td>
{{ $value->margin }}%
@ -67,21 +73,36 @@
@php($user_cart = \App\Services\HomepartyCart::getUserCart($homeparty_guest->id))
@if(!$homeparty_guest->is_host)
<tr class="foot-small">
@if(!$homeparty_guest->isAddress())
<td colspan="3" class="border-top">
<p>Keine Lieferadresse angelegt <a href="{{route('user_homeparty_guest_detail', [$homeparty_guest->homeparty->id, $homeparty_guest->id])}}"><i class="fa fa-edit"></i> </a></p>
<td colspan="5" class="border-top">&nbsp;</td>
@else
<td colspan="3" class="border-top">
<select class="custom-select" name="filter_member_id" id="filter_member_id">
<option value="">Lieferung an Gastgeber</option>
<option value="">Lieferung direkt an den Gast</option>
@if(!$homeparty->completed)
<select class="custom-select select_delivery_option" name="select_delivery_option">
<option value="host" @if($homeparty_guest->getDelivery() === 'host') selected @endif>Lieferung an Gastgeber</option>
<option value="direct" @if($homeparty_guest->getDelivery() === 'direct') selected @endif>Lieferung direkt an den Gast</option>
</select>
@else
@if($homeparty_guest->getDelivery() === 'host') Lieferung an Gastgeber @endif
@if($homeparty_guest->getDelivery() === 'direct') Lieferung direkt an den Gast @endif
@endif
</td>
<td colspan="5" class="border-top">&nbsp;</td>
@endif
</tr>
{{-- <tr>
@if($homeparty_guest->getDelivery() === 'direct')
<tr>
<td colspan="5" class="text-left">Versandkosten</td>
<td>12</td>
<td>&nbsp;</td>
<td>25,00 &euro;</td>
<td class="text-right">&nbsp;</td>
<td class="text-right">{{$user_cart->getFormattedShippingPrice()}} &euro;</td>
</tr>
--}}
@endif
<tr>
<td colspan="4" class="border-top"><strong>Gesamt:</strong></td>
<td class="border-top text-right"><strong>{{$user_cart->getFormattedEkPrice()}} &euro;</strong></td>

View file

@ -57,13 +57,12 @@
@endif
</tbody>
<tfoot>
@if(\App\Services\HomepartyCart::$is_bonus)
<tr class="foot-small">
<td colspan="4" class="border-top">
zzgl. anteiliger Bonusgutschein:
{{ \App\Services\HomepartyCart::$voucher_name }}
</td>
<td class="border-top text-right">{{ App\Services\HomepartyCart::getFormattedBonusPrice() }}&euro;</td>
</tr>
@ -73,7 +72,7 @@
<td colspan="1" class="border-top">
<strong>Gesamtsummen:</strong>
</td>
<td class="border-top text-right"><strong>{{\App\Services\HomepartyCart::getFormattedEkPrice()}}</strong></td>
<td class="border-top text-right"><strong>{{\App\Services\HomepartyCart::getFormattedEkPrice()}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{\App\Services\HomepartyCart::getFormattedPoints()}}</strong></td>
<td class="border-top text-right"><strong>{{\App\Services\HomepartyCart::getFormattedIncomePrice()}} &euro;</strong></td>
<td class="border-top text-right"><strong>{{\App\Services\HomepartyCart::getFormattedPrice()}} &euro;</strong></td>

View file

@ -146,13 +146,16 @@
<div class="m-checkout">
{!! Form::open(['url' => route('checkout.checkout_card_final'), 'class' => 'row clearfix', 'id'=>'checkout_card_final']) !!}
{!! Form::hidden('selected_country', '') !!}
{!! Form::hidden('is_for', $shopping_user->is_for) !!}
{!! Form::hidden('is_from', $shopping_user->is_from) !!}
{!! Form::hidden('homeparty_id', $shopping_user->homeparty_id) !!}
@if (\Session::has('elv-managemandate'))
@if (\Session::has('elv-managemandate'))
<div class="col-sm-12">
<fieldset class="mb-20 box-border-shadow p-20">
@ -626,7 +629,7 @@
<label class="mt-4 fs-14 fw-400 radio pull-left" style="width: 100%">
{!! Form::radio('payment_method', 'fnc#MIV', '') !!}
<i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> Rechnungskauf</span>
<img class="float-right" width="90" src="{{asset('images/payments-assets/fnc.png')}}" alt="Vorkasse">
<img class="float-right" width="90" src="{{asset('images/payments-assets/fnc.png')}}" alt="Rechnungskauf">
</label>
</div>
@endif
@ -798,31 +801,48 @@
<strong class="pull-left">Zwischensumme:</strong>
</div>
@if($shopping_user->is_from !== 'homeparty')
<hr class="mt-4 mb-4">
<div class="clearfix mb-2">
<span class="pull-right small">{{ Yard::instance('shopping')->shipping() }} </span>
<span class="pull-left small">Versandkosten:</span>
</div>
@endif
@endif
@if($shopping_user->is_from !== 'homeparty')
<div class="clearfix mb-2">
<span class="pull-right small">{{ Yard::instance('shopping')->getShippingCountryName() }}</span>
<span class="pull-left small">Lieferland:</span>
</div>
<span class="pull-right small">{{ Yard::instance('shopping')->getShippingCountryName() }}</span>
<span class="pull-left small">Lieferland:</span>
</div>
<hr class="mt-4 mb-4">
<div class="clearfix mb-2" style="font-size: 90%">
<span class="pull-right small">{{ Yard::instance('shopping')->subtotalWithShipping() }} </span>
<span class="pull-left small">Summe ohne MwSt:</span>
</div>
<hr class="mt-4 mb-4">
<div class="clearfix mb-2" style="font-size: 90%">
<span class="pull-right small">{{ Yard::instance('shopping')->taxWithShipping() }} </span>
<span class="pull-left small"> zzgl. {{-- Yard::getTaxRate() --}} MwSt:</span>
</div>
<div class="clearfix mb-2" style="font-size: 90%">
<span class="pull-right small">{{ Yard::instance('shopping')->subtotalWithShipping() }} </span>
<span class="pull-left small">Summe ohne MwSt:</span>
</div>
<div class="clearfix mb-2" style="font-size: 90%">
<span class="pull-right small">{{ Yard::instance('shopping')->taxWithShipping() }} </span>
<span class="pull-left small"> zzgl. {{-- Yard::getTaxRate() --}} MwSt:</span>
</div>
@else
<hr class="mt-4 mb-4">
<div class="clearfix mb-2" style="font-size: 90%">
<span class="pull-right small">{!! $shopping_data['shop_price_net'] !!} </span>
<span class="pull-left small">Summe ohne MwSt:</span>
</div>
<div class="clearfix mb-2" style="font-size: 90%">
<span class="pull-right small">{!! $shopping_data['shop_price_tax'] !!} </span>
<span class="pull-left small"> zzgl. {{-- Yard::getTaxRate() --}} MwSt:</span>
</div>
@endif
<hr />
<div class="clearfix">

View file

@ -266,16 +266,16 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car
//user homeparty
Route::get('/user/homepartys', 'User\HomePartyController@index')->name('user_homepartys');
Route::get('/user/homeparty/detail/{id?}', 'User\HomePartyController@detail')->name('user_homeparty_detail');
Route::post('/user/homeparty/detail/{id?}', 'User\HomePartyController@store')->name('user_homeparty_detail');
Route::get('/user/homeparty/guests/{id?}', 'User\HomePartyController@guests')->name('user_homeparty_guests');
Route::get('/user/homeparty/guest/detail/{id?}/{gid?}', 'User\HomePartyController@guestDetail')->name('user_homeparty_guest_detail');
Route::post('/user/homeparty/guest/detail/{id?}/{gid?}', 'User\HomePartyController@guestStore')->name('user_homeparty_guest_detail');
Route::get('/user/homeparty/order/{id?}', 'User\HomePartyController@order')->name('user_homeparty_order');
Route::post('/user/homeparty/order/{id?}', 'User\HomePartyController@orderStore')->name('user_homeparty_order');
Route::get('/user/homeparty/delete/{do}/{id?}/{gid?}', 'User\HomePartyController@delete')->name('user_homeparty_delete');
Route::get('/user/homeparty/datatable', 'User\HomePartyController@datatable')->name('user_homeparty_datatable');
Route::get('/user/homepartys', 'User\HomepartyController@index')->name('user_homepartys');
Route::get('/user/homeparty/detail/{id?}', 'User\HomepartyController@detail')->name('user_homeparty_detail');
Route::post('/user/homeparty/detail/{id?}', 'User\HomepartyController@store')->name('user_homeparty_detail');
Route::get('/user/homeparty/guests/{id?}', 'User\HomepartyController@guests')->name('user_homeparty_guests');
Route::get('/user/homeparty/guest/detail/{id?}/{gid?}', 'User\HomepartyController@guestDetail')->name('user_homeparty_guest_detail');
Route::post('/user/homeparty/guest/detail/{id?}/{gid?}', 'User\HomepartyController@guestStore')->name('user_homeparty_guest_detail');
Route::get('/user/homeparty/order/{id?}', 'User\HomepartyController@order')->name('user_homeparty_order');
Route::post('/user/homeparty/order/{id?}', 'User\HomepartyController@orderStore')->name('user_homeparty_order');
Route::get('/user/homeparty/delete/{do}/{id?}/{gid?}', 'User\HomepartyController@delete')->name('user_homeparty_delete');
Route::get('/user/homeparty/datatable', 'User\HomepartyController@datatable')->name('user_homeparty_datatable');
//products images
Route::post('/user/shop_on_site/upload/image', 'UserShopController@uploadOnSiteImage')->name('user_shop_on_site_upload_image');