Subiendo proyecto completo sin restricciones de git ignore

This commit is contained in:
Jose Sanchez
2023-08-17 11:44:02 -04:00
parent a0d4f5ba3b
commit 20f1c60600
19921 changed files with 2509159 additions and 45 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@@ -0,0 +1,92 @@
{
"name" : "affiliate",
"unique_identifier" : "affiliate_system",
"version" : "1.9",
"minimum_item_version" : "7.0.0",
"addon_banner" : "affiliate_banner.jpg",
"directory" :
[
{
"name" : ["resources/views/affiliate", "resources/views/affiliate/frontend"]
}
],
"sql_file" : "",
"files" :
[
{
"root_directory" : "addons/affiliate_system/views/affiliate/frontend/apply_for_affiliate.blade.php",
"update_directory" : "resources/views/affiliate/frontend/apply_for_affiliate.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/frontend/index.blade.php",
"update_directory" : "resources/views/affiliate/frontend/index.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/frontend/payment_history.blade.php",
"update_directory" : "resources/views/affiliate/frontend/payment_history.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/frontend/payment_settings.blade.php",
"update_directory" : "resources/views/affiliate/frontend/payment_settings.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/frontend/withdraw_request_history.blade.php",
"update_directory" : "resources/views/affiliate/frontend/withdraw_request_history.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/affiliate_logs.blade.php",
"update_directory" : "resources/views/affiliate/affiliate_logs.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/affiliate_withdraw_modal.blade.php",
"update_directory" : "resources/views/affiliate/affiliate_withdraw_modal.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/affiliate_withdraw_requests.blade.php",
"update_directory" : "resources/views/affiliate/affiliate_withdraw_requests.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/configs.blade.php",
"update_directory" : "resources/views/affiliate/configs.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/index.blade.php",
"update_directory" : "resources/views/affiliate/index.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/payment_history.blade.php",
"update_directory" : "resources/views/affiliate/payment_history.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/payment_modal.blade.php",
"update_directory" : "resources/views/affiliate/payment_modal.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/refferal_users.blade.php",
"update_directory" : "resources/views/affiliate/refferal_users.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/show_verification_request.blade.php",
"update_directory" : "resources/views/affiliate/show_verification_request.blade.php"
},
{
"root_directory" : "addons/affiliate_system/views/affiliate/users.blade.php",
"update_directory" : "resources/views/affiliate/users.blade.php"
},
{
"root_directory" : "addons/affiliate_system/controllers/AffiliateController.php",
"update_directory" : "app/Http/Controllers/AffiliateController.php"
},
{
"root_directory" : "addons/affiliate_system/assets/affiliate_banner.jpg",
"update_directory" : "public/affiliate_banner.jpg"
}
]
}

View File

@@ -0,0 +1,564 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\AffiliateOption;
use App\Models\Order;
use App\Models\AffiliateConfig;
use App\Models\AffiliateUser;
use App\Models\AffiliatePayment;
use App\Models\AffiliateWithdrawRequest;
use App\Models\AffiliateLog;
use App\Models\AffiliateStats;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Category;
use Auth;
use DB;
use Hash;
use Illuminate\Auth\Events\Registered;
class AffiliateController extends Controller
{
public function __construct() {
// Staff Permission Check
$this->middleware(['permission:affiliate_registration_form_config'])->only('configs');
$this->middleware(['permission:affiliate_configurations'])->only('index');
$this->middleware(['permission:view_affiliate_users'])->only('users');
$this->middleware(['permission:pay_to_affiliate_user'])->only('payment_modal');
$this->middleware(['permission:affiliate_users_payment_history'])->only('payment_history');
$this->middleware(['permission:view_all_referral_users'])->only('refferal_users');
$this->middleware(['permission:view_affiliate_withdraw_requests'])->only('affiliate_withdraw_requests');
$this->middleware(['permission:accept_affiliate_withdraw_requests'])->only('affiliate_withdraw_modal');
$this->middleware(['permission:reject_affiliate_withdraw_request'])->only('reject_withdraw_request');
$this->middleware(['permission:view_affiliate_logs'])->only('affiliate_logs_admin');
}
//
public function index(){
return view('affiliate.index');
}
public function affiliate_option_store(Request $request){
//dd($request->all());
$affiliate_option = AffiliateOption::where('type', $request->type)->first();
if($affiliate_option == null){
$affiliate_option = new AffiliateOption;
}
$affiliate_option->type = $request->type;
$commision_details = array();
if ($request->type == 'user_registration_first_purchase') {
$affiliate_option->percentage = $request->percentage;
}
elseif ($request->type == 'product_sharing') {
$commision_details['commission'] = $request->amount;
$commision_details['commission_type'] = $request->amount_type;
}
elseif ($request->type == 'category_wise_affiliate') {
foreach(Category::all() as $category) {
$data['category_id'] = $request['categories_id_'.$category->id];
$data['commission'] = $request['commison_amounts_'.$category->id];
$data['commission_type'] = $request['commison_types_'.$category->id];
array_push($commision_details, $data);
}
}
elseif ($request->type == 'max_affiliate_limit') {
$affiliate_option->percentage = $request->percentage;
}
$affiliate_option->details = json_encode($commision_details);
if ($request->has('status')) {
$affiliate_option->status = 1;
if($request->type == 'product_sharing'){
$affiliate_option_status_update = AffiliateOption::where('type', 'category_wise_affiliate')->first();
$affiliate_option_status_update->status = 0;
$affiliate_option_status_update->save();
}
if($request->type == 'category_wise_affiliate'){
$affiliate_option_status_update = AffiliateOption::where('type', 'product_sharing')->first();
$affiliate_option_status_update->status = 0;
$affiliate_option_status_update->save();
}
}
else {
$affiliate_option->status = 0;
}
$affiliate_option->save();
flash("This has been updated successfully")->success();
return back();
}
public function configs(){
return view('affiliate.configs');
}
public function config_store(Request $request){
if($request->type == 'validation_time') {
//affiliate validation time
$affiliate_config = AffiliateConfig::where('type', $request->type)->first();
if($affiliate_config == null){
$affiliate_config = new AffiliateConfig;
}
$affiliate_config->type = $request->type;
$affiliate_config->value = $request[$request->type];
$affiliate_config->save();
flash("Validation time updated successfully")->success();
} else {
$form = array();
$select_types = ['select', 'multi_select', 'radio'];
$j = 0;
for ($i=0; $i < count($request->type); $i++) {
$item['type'] = $request->type[$i];
$item['label'] = $request->label[$i];
if(in_array($request->type[$i], $select_types)){
$item['options'] = json_encode($request['options_'.$request->option[$j]]);
$j++;
}
array_push($form, $item);
}
$affiliate_config = AffiliateConfig::where('type', 'verification_form')->first();
$affiliate_config->value = json_encode($form);
flash("Verification form updated successfully")->success();
}
if($affiliate_config->save()){
return back();
}
}
public function apply_for_affiliate(Request $request){
if(Auth::check() && AffiliateUser::where('user_id', Auth::user()->id)->first() != null){
flash(translate("You are already an affiliate user!"))->warning();
return back();
}
return view('affiliate.frontend.apply_for_affiliate');
}
public function affiliate_logs_admin()
{
$affiliate_logs = AffiliateLog::latest()->paginate(10);
return view('affiliate.affiliate_logs',compact('affiliate_logs'));
}
public function store_affiliate_user(Request $request){
if(!Auth::check()){
if(User::where('email', $request->email)->first() != null){
flash(translate('Email already exists!'))->error();
return back();
}
if($request->password == $request->password_confirmation){
$user = new User;
$user->name = $request->name;
$user->email = $request->email;
$user->user_type = "customer";
$user->password = Hash::make($request->password);
$user->save();
auth()->login($user, false);
if(get_setting('email_verification') != 1){
$user->email_verified_at = date('Y-m-d H:m:s');
$user->save();
}
else {
event(new Registered($user));
}
}
else{
flash(translate('Sorry! Password did not match.'))->error();
return back();
}
}
$affiliate_user = Auth::user()->affiliate_user;
if ($affiliate_user == null) {
$affiliate_user = new AffiliateUser;
$affiliate_user->user_id = Auth::user()->id;
}
$data = array();
$i = 0;
foreach (json_decode(AffiliateConfig::where('type', 'verification_form')->first()->value) as $key => $element) {
$item = array();
if ($element->type == 'text') {
$item['type'] = 'text';
$item['label'] = $element->label;
$item['value'] = $request['element_'.$i];
}
elseif ($element->type == 'select' || $element->type == 'radio') {
$item['type'] = 'select';
$item['label'] = $element->label;
$item['value'] = $request['element_'.$i];
}
elseif ($element->type == 'multi_select') {
$item['type'] = 'multi_select';
$item['label'] = $element->label;
$item['value'] = json_encode($request['element_'.$i]);
}
elseif ($element->type == 'file') {
$item['type'] = 'file';
$item['label'] = $element->label;
$item['value'] = $request['element_'.$i]->store('uploads/affiliate_verification_form');
}
array_push($data, $item);
$i++;
}
$affiliate_user->informations = json_encode($data);
if($affiliate_user->save()){
flash(translate('Your verification request has been submitted successfully!'))->success();
return redirect()->route('home');
}
flash(translate('Sorry! Something went wrong.'))->error();
return back();
}
public function users(){
$affiliate_users = AffiliateUser::paginate(12);
return view('affiliate.users', compact('affiliate_users'));
}
public function show_verification_request($id){
$affiliate_user = AffiliateUser::findOrFail($id);
return view('affiliate.show_verification_request', compact('affiliate_user'));
}
public function approve_user($id)
{
$affiliate_user = AffiliateUser::findOrFail($id);
$affiliate_user->status = 1;
if($affiliate_user->save()){
flash(translate('Affiliate user has been approved successfully'))->success();
return redirect()->route('affiliate.users');
}
flash(translate('Something went wrong'))->error();
return back();
}
public function reject_user($id)
{
$affiliate_user = AffiliateUser::findOrFail($id);
$affiliate_user->status = 0;
$affiliate_user->informations = null;
if($affiliate_user->save()){
flash(translate('Affiliate user request has been rejected successfully'))->success();
return redirect()->route('affiliate.users');
}
flash(translate('Something went wrong'))->error();
return back();
}
public function updateApproved(Request $request)
{
$affiliate_user = AffiliateUser::findOrFail($request->id);
$affiliate_user->status = $request->status;
if($affiliate_user->save()){
return 1;
}
return 0;
}
public function payment_modal(Request $request)
{
$affiliate_user = AffiliateUser::findOrFail($request->id);
return view('affiliate.payment_modal', compact('affiliate_user'));
}
public function payment_store(Request $request){
$affiliate_payment = new AffiliatePayment;
$affiliate_payment->affiliate_user_id = $request->affiliate_user_id;
$affiliate_payment->amount = $request->amount;
$affiliate_payment->payment_method = $request->payment_method;
$affiliate_payment->save();
$affiliate_user = AffiliateUser::findOrFail($request->affiliate_user_id);
$affiliate_user->balance -= $request->amount;
$affiliate_user->save();
flash(translate('Payment completed'))->success();
return back();
}
public function payment_history($id){
$affiliate_user = AffiliateUser::findOrFail(decrypt($id));
$affiliate_payments = $affiliate_user->affiliate_payments();
return view('affiliate.payment_history', compact('affiliate_payments', 'affiliate_user'));
}
public function user_index(Request $request){
$affiliate_logs = AffiliateLog::where('referred_by_user', Auth::user()->id)->latest()->paginate(10);
$query = AffiliateStats::query();
$query = $query->select(
DB::raw('SUM(no_of_click) AS count_click, SUM(no_of_order_item) AS count_item, SUM(no_of_delivered) AS count_delivered, SUM(no_of_cancel) AS count_cancel')
);
if($request->type == 'Today') {
$query->whereDate('created_at', Carbon::today());
} else if($request->type == '7' || $request->type == '30') {
$query->whereRaw('created_at <= NOW() AND created_at >= DATE_SUB(created_at, INTERVAL '. $request->type .' DAY)');
}
$query->where('affiliate_user_id', Auth::user()->id);
$affliate_stats = $query->first();
$type = $request->type;
// dd($type);
return view('affiliate.frontend.index', compact('affiliate_logs', 'affliate_stats', 'type'));
}
// payment history for user
public function user_payment_history(){
$affiliate_user = Auth::user()->affiliate_user;
$affiliate_payments = $affiliate_user->affiliate_payments();
return view('affiliate.frontend.payment_history', compact('affiliate_payments'));
}
// withdraw request history for user
public function user_withdraw_request_history(){
$affiliate_user = Auth::user()->affiliate_user;
$affiliate_withdraw_requests = AffiliateWithdrawRequest::where('user_id', Auth::user()->id)->orderBy('id', 'desc')->paginate(10);
return view('affiliate.frontend.withdraw_request_history', compact('affiliate_withdraw_requests'));
}
public function payment_settings(){
$affiliate_user = Auth::user()->affiliate_user;
return view('affiliate.frontend.payment_settings', compact('affiliate_user'));
}
public function payment_settings_store(Request $request){
$affiliate_user = Auth::user()->affiliate_user;
$affiliate_user->paypal_email = $request->paypal_email;
$affiliate_user->bank_information = $request->bank_information;
$affiliate_user->save();
flash(translate('Affiliate payment settings has been updated successfully'))->success();
return redirect()->route('affiliate.user.index');
}
public function processAffiliatePoints(Order $order){
if(addon_is_activated('affiliate_system')){
if(AffiliateOption::where('type', 'user_registration_first_purchase')->first()->status){
if ($order->user != null && $order->user->orders->count() == 1) {
if($order->user->referred_by != null){
$user = User::find($order->user->referred_by);
if ($user != null) {
$amount = (AffiliateOption::where('type', 'user_registration_first_purchase')->first()->percentage * $order->grand_total)/100;
$affiliate_user = $user->affiliate_user;
if($affiliate_user != null){
$affiliate_user->balance += $amount;
$affiliate_user->save();
// Affiliate log
$affiliate_log = new AffiliateLog;
$affiliate_log->user_id = $order->user_id;
$affiliate_log->referred_by_user = $order->user->referred_by;
$affiliate_log->amount = $amount;
$affiliate_log->order_id = $order->id;
$affiliate_log->affiliate_type = 'user_registration_first_purchase';
$affiliate_log->save();
}
}
}
}
}
if(AffiliateOption::where('type', 'product_sharing')->first()->status) {
foreach ($order->orderDetails as $key => $orderDetail) {
$amount = 0;
if($orderDetail->product_referral_code != null) {
$referred_by_user = User::where('referral_code', $orderDetail->product_referral_code)->first();
if($referred_by_user != null) {
if(AffiliateOption::where('type', 'product_sharing')->first()->details != null && json_decode(AffiliateOption::where('type', 'product_sharing')->first()->details)->commission_type == 'amount') {
$amount = json_decode(AffiliateOption::where('type', 'product_sharing')->first()->details)->commission;
}
elseif(AffiliateOption::where('type', 'product_sharing')->first()->details != null && json_decode(AffiliateOption::where('type', 'product_sharing')->first()->details)->commission_type == 'percent') {
$amount = (json_decode(AffiliateOption::where('type', 'product_sharing')->first()->details)->commission * $orderDetail->price)/100;
}
$affiliate_user = $referred_by_user->affiliate_user;
if($affiliate_user != null) {
$affiliate_user->balance += $amount;
$affiliate_user->save();
// Affiliate log
$affiliate_log = new AffiliateLog;
if($order->user_id != null) {
$affiliate_log->user_id = $order->user_id;
}
else {
$affiliate_log->guest_id = $order->guest_id;
}
$affiliate_log->referred_by_user = $referred_by_user->id;
$affiliate_log->amount = $amount;
$affiliate_log->order_id = $order->id;
$affiliate_log->order_detail_id = $orderDetail->id;
$affiliate_log->affiliate_type = 'product_sharing';
$affiliate_log->save();
}
}
}
}
}
elseif (AffiliateOption::where('type', 'category_wise_affiliate')->first()->status) {
foreach ($order->orderDetails as $key => $orderDetail) {
$amount = 0;
if($orderDetail->product_referral_code != null) {
$referred_by_user = User::where('referral_code', $orderDetail->product_referral_code)->first();
if($referred_by_user != null) {
if(AffiliateOption::where('type', 'category_wise_affiliate')->first()->details != null){
foreach (json_decode(AffiliateOption::where('type', 'category_wise_affiliate')->first()->details) as $key => $value) {
if($value->category_id == $orderDetail->product->category->id){
if($value->commission_type == 'amount'){
$amount = $value->commission;
}
else {
$amount = ($value->commission * $orderDetail->price)/100;
}
}
}
}
$affiliate_user = $referred_by_user->affiliate_user;
if($affiliate_user != null){
$affiliate_user->balance += $amount;
$affiliate_user->save();
// Affiliate log
$affiliate_log = new AffiliateLog;
if($order->user_id != null){
$affiliate_log->user_id = $order->user_id;
}
else{
$affiliate_log->guest_id = $order->guest_id;
}
$affiliate_log->referred_by_user = $referred_by_user->id;
$affiliate_log->amount = $amount;
$affiliate_log->order_id = $order->id;
$affiliate_log->order_detail_id = $orderDetail->id;
$affiliate_log->affiliate_type = 'category_wise_affiliate';
$affiliate_log->save();
}
}
}
}
}
}
}
public function processAffiliateStats($affiliate_user_id, $no_click = 0, $no_item = 0, $no_delivered = 0, $no_cancel = 0) {
$affiliate_stats = AffiliateStats::whereDate('created_at', Carbon::today())
->where("affiliate_user_id", $affiliate_user_id)
->first();
if(!$affiliate_stats) {
$affiliate_stats = new AffiliateStats;
$affiliate_stats->no_of_order_item = 0;
$affiliate_stats->no_of_delivered = 0;
$affiliate_stats->no_of_cancel = 0;
$affiliate_stats->no_of_click = 0;
}
$affiliate_stats->no_of_order_item += $no_item;
$affiliate_stats->no_of_delivered += $no_delivered;
$affiliate_stats->no_of_cancel += $no_cancel;
$affiliate_stats->no_of_click += $no_click;
$affiliate_stats->affiliate_user_id = $affiliate_user_id;
// dd($affiliate_stats);
$affiliate_stats->save();
// foreach($order->orderDetails as $key => $orderDetail) {
// $referred_by_user = User::where('referral_code', $orderDetail->product_referral_code)->first();
//
// if($referred_by_user != null) {
// if($orderDetail->delivery_status == 'delivered') {
// $affiliate_stats->no_of_delivered++;
// } if($orderDetail->delivery_status == 'cancelled') {
// $affiliate_stats->no_of_cancel++;
// }
//
// $affiliate_stats->affiliate_user_id = $referred_by_user->id;
// dd($affiliate_stats);
// $affiliate_stats->save();
// }
// }
}
public function refferal_users()
{
$refferal_users = User::where('referred_by', '!=' , null)->paginate(10);
return view('affiliate.refferal_users', compact('refferal_users'));
}
// Affiliate Withdraw Request
public function withdraw_request_store(Request $request)
{
$withdraw_request = new AffiliateWithdrawRequest;
$withdraw_request->user_id = Auth::user()->id;
$withdraw_request->amount = $request->amount;
$withdraw_request->status = 0 ;
if($withdraw_request->save()){
$affiliate_user = AffiliateUser::where('user_id',Auth::user()->id)->first();
$affiliate_user->balance = $affiliate_user->balance - $request->amount;
$affiliate_user->save();
flash(translate('New withdraw request created successfully'))->success();
return redirect()->route('affiliate.user.withdraw_request_history');
}
else{
flash(translate('Something went wrong'))->error();
return back();
}
}
public function affiliate_withdraw_requests()
{
$affiliate_withdraw_requests = AffiliateWithdrawRequest::orderBy('id', 'desc')->paginate(10);
return view('affiliate.affiliate_withdraw_requests', compact('affiliate_withdraw_requests'));
}
public function affiliate_withdraw_modal(Request $request)
{
$affiliate_withdraw_request = AffiliateWithdrawRequest::findOrFail($request->id);
$affiliate_user = AffiliateUser::where('user_id',$affiliate_withdraw_request->user_id)->first();
return view('affiliate.affiliate_withdraw_modal', compact('affiliate_withdraw_request','affiliate_user'));
}
public function withdraw_request_payment_store(Request $request){
$affiliate_payment = new AffiliatePayment;
$affiliate_payment->affiliate_user_id = $request->affiliate_user_id;
$affiliate_payment->amount = $request->amount;
$affiliate_payment->payment_method = $request->payment_method;
$affiliate_payment->save();
if ($request->has('affiliate_withdraw_request_id')) {
$affiliate_withdraw_request = AffiliateWithdrawRequest::findOrFail($request->affiliate_withdraw_request_id);
$affiliate_withdraw_request->status = 1;
$affiliate_withdraw_request->save();
}
flash(translate('Payment completed'))->success();
return back();
}
public function reject_withdraw_request($id)
{
$affiliate_withdraw_request = AffiliateWithdrawRequest::findOrFail($id);
$affiliate_withdraw_request->status = 2;
if($affiliate_withdraw_request->save()){
$affiliate_user = AffiliateUser::where('user_id', $affiliate_withdraw_request->user_id)->first();
$affiliate_user->balance = $affiliate_user->balance + $affiliate_withdraw_request->amount;
$affiliate_user->save();
flash(translate('Affiliate withdraw request has been rejected successfully'))->success();
return redirect()->route('affiliate.withdraw_requests');
}
flash(translate('Something went wrong'))->error();
return back();
}
}

View File

@@ -0,0 +1,2 @@
INSERT INTO `affiliate_options` (`id`, `type`, `details`, `percentage`, `status`, `created_at`, `updated_at`) VALUES (NULL, 'category_wise_affiliate', NULL, '0', '0', current_timestamp(), current_timestamp());
COMMIT;

View File

@@ -0,0 +1 @@
COMMIT;

View File

@@ -0,0 +1,16 @@
CREATE TABLE `affiliate_withdraw_requests` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`amount` double(10,2) NOT NULL,
`status` int(1) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `affiliate_withdraw_requests`
ADD PRIMARY KEY (`id`);
ALTER TABLE `affiliate_withdraw_requests`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

View File

@@ -0,0 +1 @@
COMMIT;

View File

@@ -0,0 +1,22 @@
CREATE TABLE `affiliate_logs` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`guest_id` int(11) DEFAULT NULL,
`referred_by_user` int(11) NOT NULL,
`amount` double(20,2) NOT NULL,
`order_id` bigint(20) DEFAULT NULL,
`order_detail_id` bigint(20) DEFAULT NULL,
`affiliate_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `affiliate_logs`
ADD PRIMARY KEY (`id`);
ALTER TABLE `affiliate_logs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

View File

@@ -0,0 +1,15 @@
CREATE TABLE `affiliate_stats` (
`id` int(11) NOT NULL,
`affiliate_user_id` int(11) NOT NULL,
`no_of_click` int(11) NOT NULL DEFAULT 0,
`no_of_order_item` int(11) NOT NULL DEFAULT 0,
`no_of_delivered` int(11) NOT NULL DEFAULT 0,
`no_of_cancel` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `affiliate_stats` ADD PRIMARY KEY (`id`);
ALTER TABLE `affiliate_stats`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

View File

@@ -0,0 +1 @@
COMMIT;

View File

@@ -0,0 +1 @@
COMMIT;

View File

@@ -0,0 +1 @@
COMMIT;

View File

@@ -0,0 +1,343 @@
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 10, 2020 at 09:14 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `shop`
--
-- --------------------------------------------------------
--
-- Table structure for table `affiliate_options`
--
CREATE TABLE `affiliate_options` (
`id` int(11) NOT NULL,
`type` varchar(255) COLLATE utf32_unicode_ci DEFAULT NULL,
`details` LONGTEXT COLLATE utf32_unicode_ci DEFAULT NULL,
`percentage` double NOT NULL DEFAULT 0,
`status` int(1) NOT NULL DEFAULT 1,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Dumping data for table `affiliate_options`
--
INSERT INTO `affiliate_options` (`id`, `type`, `details`, `percentage`, `status`, `created_at`, `updated_at`) VALUES
(2, 'user_registration_first_purchase', NULL, 20, 1, '2020-03-03 05:08:37', '2020-03-05 03:56:30'),
(3, 'product_sharing', NULL, 20, 0, '2020-03-08 01:55:03', '2020-03-10 02:12:32'),
(4, 'category_wise_affiliate', NULL, 0, 0, '2020-03-08 01:55:03', '2020-03-10 02:12:32');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `affiliate_options`
--
ALTER TABLE `affiliate_options`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `affiliate_options`
--
ALTER TABLE `affiliate_options`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 10, 2020 at 09:14 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `shop`
--
-- --------------------------------------------------------
--
-- Table structure for table `affiliate_configs`
--
CREATE TABLE `affiliate_configs` (
`id` int(11) NOT NULL,
`type` varchar(1000) COLLATE utf32_unicode_ci DEFAULT NULL,
`value` text COLLATE utf32_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Dumping data for table `affiliate_configs`
--
INSERT INTO `affiliate_configs` (`id`, `type`, `value`, `created_at`, `updated_at`) VALUES
(1, 'verification_form', '[{\"type\":\"text\",\"label\":\"Your name\"},{\"type\":\"text\",\"label\":\"Email\"},{\"type\":\"text\",\"label\":\"Full Address\"},{\"type\":\"text\",\"label\":\"Phone Number\"},{\"type\":\"text\",\"label\":\"How will you affiliate?\"}]', '2020-03-09 09:56:21', '2020-03-09 04:30:59');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `affiliate_configs`
--
ALTER TABLE `affiliate_configs`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `affiliate_configs`
--
ALTER TABLE `affiliate_configs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 10, 2020 at 09:14 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `shop`
--
-- --------------------------------------------------------
--
-- Table structure for table `affiliate_users`
--
CREATE TABLE `affiliate_users` (
`id` int(11) NOT NULL,
`paypal_email` varchar(255) COLLATE utf32_unicode_ci DEFAULT NULL,
`bank_information` text COLLATE utf32_unicode_ci DEFAULT NULL,
`user_id` int(11) NOT NULL,
`informations` text COLLATE utf32_unicode_ci DEFAULT NULL,
`balance` double(10,2) NOT NULL DEFAULT 0.00,
`status` int(1) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf32 COLLATE=utf32_unicode_ci;
--
-- Dumping data for table `affiliate_users`
--
INSERT INTO `affiliate_users` (`id`, `paypal_email`, `bank_information`, `user_id`, `informations`, `balance`, `status`, `created_at`, `updated_at`) VALUES
(1, 'demo@gmail.com', '123456', 8, '[{\"type\":\"text\",\"label\":\"Your name\",\"value\":\"Nostrum dicta sint l\"},{\"type\":\"text\",\"label\":\"Email\",\"value\":\"Aut perferendis null\"},{\"type\":\"text\",\"label\":\"Full Address\",\"value\":\"Voluptatem Sit dolo\"},{\"type\":\"text\",\"label\":\"Phone Number\",\"value\":\"Ut ad beatae occaeca\"},{\"type\":\"text\",\"label\":\"How will you affiliate?\",\"value\":\"Porro sint soluta u\"}]', 30.00, 1, '2020-03-09 05:35:07', '2020-03-10 02:04:30');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `affiliate_users`
--
ALTER TABLE `affiliate_users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `affiliate_users`
--
ALTER TABLE `affiliate_users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 10, 2020 at 09:14 AM
-- Server version: 10.3.16-MariaDB
-- PHP Version: 7.3.7
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `shop`
--
-- --------------------------------------------------------
--
-- Table structure for table `affiliate_payments`
--
CREATE TABLE `affiliate_payments` (
`id` int(11) NOT NULL,
`affiliate_user_id` int(11) NOT NULL,
`amount` double(8,2) NOT NULL,
`payment_method` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`payment_details` longtext COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `affiliate_payments`
--
INSERT INTO `affiliate_payments` (`id`, `affiliate_user_id`, `amount`, `payment_method`, `payment_details`, `created_at`, `updated_at`) VALUES
(2, 1, 20.00, 'Paypal', NULL, '2020-03-10 02:04:30', '2020-03-10 02:04:30');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `affiliate_payments`
--
ALTER TABLE `affiliate_payments`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `affiliate_payments`
--
ALTER TABLE `affiliate_payments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
CREATE TABLE `affiliate_withdraw_requests` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`amount` double(10,2) NOT NULL,
`status` int(1) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `affiliate_withdraw_requests`
ADD PRIMARY KEY (`id`);
ALTER TABLE `affiliate_withdraw_requests`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
CREATE TABLE `affiliate_logs` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`guest_id` int(11) DEFAULT NULL,
`referred_by_user` int(11) NOT NULL,
`amount` double(20,2) NOT NULL,
`order_id` bigint(20) DEFAULT NULL,
`order_detail_id` bigint(20) DEFAULT NULL,
`affiliate_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `affiliate_logs`
ADD PRIMARY KEY (`id`);
ALTER TABLE `affiliate_logs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
CREATE TABLE `affiliate_stats` (
`id` int(11) NOT NULL,
`affiliate_user_id` int(11) NOT NULL,
`no_of_click` int(11) NOT NULL DEFAULT 0,
`no_of_order_item` int(11) NOT NULL DEFAULT 0,
`no_of_delivered` int(11) NOT NULL DEFAULT 0,
`no_of_cancel` int(11) NOT NULL DEFAULT 0,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`updated_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `affiliate_stats` ADD PRIMARY KEY (`id`);
ALTER TABLE `affiliate_stats`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

View File

@@ -0,0 +1,61 @@
@extends('backend.layouts.app')
@section('content')
<div class="card">
<div class="card-header">
<h5 class="mb-0 h6">{{translate('Affiliate Logs')}}</h5>
</div>
<div class="card-body">
<table class="table aiz-table mb-0">
<thead>
<tr>
<th>#</th>
<th data-breakpoints="lg">{{ translate('Referred By')}}</th>
<th>{{ translate('Referral User')}}</th>
<th>{{ translate('Amount')}}</th>
<th data-breakpoints="lg">{{ translate('Order Id')}}</th>
<th data-breakpoints="lg">{{ translate('Referral Type') }}</th>
<th data-breakpoints="lg">{{ translate('Product') }}</th>
<th data-breakpoints="lg">{{ translate('Date') }}</th>
</thead>
<tbody>
@foreach($affiliate_logs as $key => $affiliate_log)
@if ($affiliate_log->user != null)
<tr>
<td>{{ ($key+1) + ($affiliate_logs->currentPage() - 1)*$affiliate_logs->perPage() }}</td>
<td>
{{ optional(\App\Models\User::where('id', $affiliate_log->referred_by_user)->first())->name }}
</td>
<td>
@if($affiliate_log->user_id !== null)
{{ optional($affiliate_log->user)->name }}
@else
{{ translate('Guest').' ('. $affiliate_log->guest_id.')' }}
@endif
</td>
<td>{{ single_price($affiliate_log->amount) }}</td>
<td>
@if($affiliate_log->order_id != null)
{{ optional($affiliate_log->order)->code }}
@else
{{ optional($affiliate_log->order_detail->order)->code }}
@endif
</td>
<td> {{ ucwords(str_replace('_',' ', $affiliate_log->affiliate_type)) }}</td>
<td>
@if($affiliate_log->order_detail_id != null && $affiliate_log->order_detail)
{{ optional($affiliate_log->order_detail->product)->name }}
@endif
</td>
<td>{{ $affiliate_log->created_at->format('d, F Y') }} </td>
</tr>
@endif
@endforeach
</tbody>
</table>
<div class="aiz-pagination">
{{ $affiliate_logs->links() }}
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,47 @@
<form action="{{ route('withdraw_request.payment_store') }}" method="POST">
@csrf
<div class="modal-header">
<h5 class="modal-title h6">{{translate('Affiliate Withdraw Request')}}</h5>
<button type="button" class="close" data-dismiss="modal">
</button>
</div>
<div class="modal-body">
<table class="table table-striped table-bordered" >
<tbody>
<tr>
<td>{{ translate('Paypal Email') }}</td>
<td>{{ $affiliate_user->paypal_email }}</td>
</tr>
<tr>
<td>{{ translate('Bank Information') }}</td>
<td>{{ $affiliate_user->bank_information }}</td>
</tr>
</tbody>
</table>
<input type="hidden" name="affiliate_user_id" value="{{ $affiliate_user->id }}">
<input type="hidden" name="affiliate_withdraw_request_id" value="{{ $affiliate_withdraw_request->id }}">
<div class="form-group row">
<label class="col-sm-3 col-from-label" for="amount">{{translate('Amount')}}</label>
<div class="col-sm-9">
<input type="hidden" name="amount" value="{{$affiliate_withdraw_request->amount}}" class="form-control">
<input type="number" value="{{$affiliate_withdraw_request->amount}}" class="form-control" disabled>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-from-label" for="payment_method">{{translate('Payment Method')}}</label>
<div class="col-sm-9">
<select name="payment_method" id="payment_method" class="form-control aiz-selectpicker" required>
<option value="">{{translate('Select Payment Method')}}</option>
<option value="Paypal">{{translate('Paypal')}}</option>
<option value="Bank">{{translate('Bank')}}</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-sm btn-primary" type="submit">{{ translate('Pay')}}</button>
<button type="button" class="btn btn-sm btn-light" data-dismiss="modal">{{translate('Cancel')}}</button>
</div>
</form>

View File

@@ -0,0 +1,117 @@
@extends('backend.layouts.app')
@section('content')
<div class="card">
<div class="card-header">
<h5 class="mb-0 h6">{{translate('Affiliate Withdraw Request')}}</h5>
</div>
<div class="card-body">
<table class="table aiz-table mb-0">
<thead>
<tr>
<th>#</th>
<th data-breakpoints="lg">{{translate('Date')}}</th>
<th>{{translate('Name')}}</th>
<th data-breakpoints="lg">{{translate('Email')}}</th>
<th>{{translate('Amount')}}</th>
<th data-breakpoints="lg">{{translate('Status')}}</th>
<th data-breakpoints="lg">{{translate('options')}}</th>
</tr>
</thead>
<tbody>
@foreach($affiliate_withdraw_requests as $key => $affiliate_withdraw_request)
@php $status = $affiliate_withdraw_request->status ; @endphp
@if ($affiliate_withdraw_request->user != null)
<tr>
<td>{{ ($key+1) + ($affiliate_withdraw_requests->currentPage() - 1)*$affiliate_withdraw_requests->perPage() }}</td>
<td>{{ $affiliate_withdraw_request->created_at}}</td>
<td>{{ optional($affiliate_withdraw_request->user)->name}}</td>
<td>{{ optional($affiliate_withdraw_request->user)->email}}</td>
<td>{{ single_price($affiliate_withdraw_request->amount)}}</td>
<td>
@if($status == 1)
<span class="badge badge-inline badge-success">{{translate('Approved')}}</span>
@elseif($status == 2)
<span class="badge badge-inline badge-danger">{{translate('Rejected')}}</span>
@else
<span class="badge badge-inline badge-info">{{translate('Pending')}}</span>
@endif
</td>
<td class="text-right">
@if($status == 0)
@can('accept_affiliate_withdraw_requests')
<a href="#" class="btn btn-soft-primary btn-icon btn-circle btn-sm" onclick="show_affiliate_withdraw_modal('{{$affiliate_withdraw_request->id}}');" title="{{ translate('Pay Now') }}">
<i class="las la-money-bill"></i>
</a>
@endcan
@can('reject_affiliate_withdraw_request')
<a href="#" class="btn btn-soft-danger btn-icon btn-circle btn-sm" onclick="affiliate_withdraw_reject_modal('{{route('affiliate.withdraw_request.reject', $affiliate_withdraw_request->id)}}');" title="{{ translate('Reject') }}">
<i class="las la-trash"></i>
</a>
@endcan
@else
{{ translate('No Action Available')}}
@endif
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
<div class="clearfix">
<div class="pull-right">
{{ $affiliate_withdraw_requests->links() }}
</div>
</div>
</div>
</div>
@endsection
@section('modal')
<div class="modal fade" id="affiliate_withdraw_modal">
<div class="modal-dialog">
<div class="modal-content" id="modal-content">
</div>
</div>
</div>
<div class="modal fade" id="affiliate_withdraw_reject_modal">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title h6">{{ translate('Affiliate Withdraw Request Reject')}}</h5>
<button type="button" class="close" data-dismiss="modal">
</button>
</div>
<div class="modal-body">
<p>{{translate('Are you sure, You want to reject this?')}}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-dismiss="modal">{{translate('Cancel')}}</button>
<a href="#" id="reject_link" class="btn btn-primary">{{ translate('Reject') }}</a>
</div>
</div>
</div>
</div>
@endsection
@section('script')
<script type="text/javascript">
function show_affiliate_withdraw_modal(id){
$.post('{{ route('affiliate_withdraw_modal') }}',{_token:'{{ @csrf_token() }}', id:id}, function(data){
$('#affiliate_withdraw_modal #modal-content').html(data);
$('#affiliate_withdraw_modal').modal('show', {backdrop: 'static'});
AIZ.plugins.bootstrapSelect('refresh');
});
}
function affiliate_withdraw_reject_modal(reject_link){
$('#affiliate_withdraw_reject_modal').modal('show');
document.getElementById('reject_link').setAttribute('href' , reject_link);
}
</script>
@endsection

View File

@@ -0,0 +1,192 @@
@extends('backend.layouts.app')
@section('content')
<div class="col-sm-12">
<div class="card">
<div class="card-header">
<h5 class="mb-0 h6">{{ translate('Affiliate Registration Form')}}</h5>
</div>
<div class="card-body">
<form action="{{ route('affiliate.configs.store') }}" method="post" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-lg-8 form-horizontal" id="form">
@foreach (json_decode(\App\Models\AffiliateConfig::where('type', 'verification_form')->first()->value) as $key => $element)
@if ($element->type == 'text' || $element->type == 'file')
<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">
<input type="hidden" name="type[]" value="{{ $element->type }}">
<div class="col-lg-3">
<label class="control-label">{{ ucfirst($element->type) }}</label>
</div>
<div class="col-lg-7">
<input class="form-control" type="text" name="label[]" value="{{ $element->label }}" placeholder="Label">
</div>
<div class="col-lg-2"><span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span></div>
</div>
@elseif ($element->type == 'select' || $element->type == 'multi_select' || $element->type == 'radio')
<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">
<input type="hidden" name="type[]" value="{{ $element->type }}">
<input type="hidden" name="option[]" class="option" value="{{ $key }}">
<div class="col-lg-3">
<label class="control-label">{{ ucfirst(str_replace('_', ' ', $element->type)) }}</label>
</div>
<div class="col-lg-7">
<input class="form-control" type="text" name="label[]" value="{{ $element->label }}" placeholder="Select Label" style="margin-bottom:10px">
<div class="customer_choice_options_types_wrap_child">
@if (is_array(json_decode($element->options)))
@foreach (json_decode($element->options) as $value)
<div class="form-group row">
<div class="col-sm-6 col-sm-offset-4">
<input class="form-control" type="text" name="options_{{ $key }}[]" value="{{ $value }}" required="">
</div>
<div class="col-sm-2"> <span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span></div>
</div>
@endforeach
@endif
</div>
<button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>
</div>
<div class="col-lg-2"><span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span></div>
</div>
@endif
@endforeach
</div>
<div class="col-lg-4">
<ul class="list-group">
<li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('text')">{{translate('Text Input')}}</li>
<li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('select')">{{translate('Select')}}</li>
<li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('multi-select')">{{translate('Multiple Select')}}</li>
<li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('radio')">{{translate('Radio')}}</li>
<li class="list-group-item btn" style="text-align: left;" onclick="appenddToForm('file')">{{translate('File')}}</li>
</ul>
</div>
</div>
<div class="form-group mb-0 text-right">
<button type="submit" class="btn btn-primary">{{translate('Save')}}</button>
</div>
</form>
</div>
</div>
</div>
@endsection
@section('script')
<script type="text/javascript">
var i = 0;
function add_customer_choice_options(em){
var j = $(em).closest('.form-group.row').find('.option').val();
var str = '<div class="form-group row">'
+'<div class="col-sm-6 col-sm-offset-4">'
+'<input class="form-control" type="text" name="options_'+j+'[]" value="" required>'
+'</div>'
+'<div class="col-sm-2"> <span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
+'</div>'
+'</div>'
$(em).parent().find('.customer_choice_options_types_wrap_child').append(str);
}
function delete_choice_clearfix(em){
$(em).parent().parent().remove();
}
function appenddToForm(type){
//$('#form').removeClass('seller_form_border');
if(type == 'text'){
var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
+'<input type="hidden" name="type[]" value="text">'
+'<div class="col-lg-3">'
+'<label class="control-label">Text</label>'
+'</div>'
+'<div class="col-lg-7">'
+'<input class="form-control" type="text" name="label[]" placeholder="Label">'
+'</div>'
+'<div class="col-lg-2">'
+'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
+'</div>'
+'</div>';
$('#form').append(str);
}
else if (type == 'select') {
i++;
var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
+'<input type="hidden" name="type[]" value="select"><input type="hidden" name="option[]" class="option" value="'+i+'">'
+'<div class="col-lg-3">'
+'<label class="control-label">Select</label>'
+'</div>'
+'<div class="col-lg-7">'
+'<input class="form-control" type="text" name="label[]" placeholder="Select Label" style="margin-bottom:10px">'
+'<div class="customer_choice_options_types_wrap_child">'
+'</div>'
+'<button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>'
+'</div>'
+'<div class="col-lg-2">'
+'<span class="btn btn-icon btn-circle icon-lg fa fa-times" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
+'</div>'
+'</div>';
$('#form').append(str);
}
else if (type == 'multi-select') {
i++;
var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
+'<input type="hidden" name="type[]" value="multi_select"><input type="hidden" name="option[]" class="option" value="'+i+'">'
+'<div class="col-lg-3">'
+'<label class="control-label">Multiple select</label>'
+'</div>'
+'<div class="col-lg-7">'
+'<input class="form-control" type="text" name="label[]" placeholder="Multiple Select Label" style="margin-bottom:10px">'
+'<div class="customer_choice_options_types_wrap_child">'
+'</div>'
+'<button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>'
+'</div>'
+'<div class="col-lg-2">'
+'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
+'</div>'
+'</div>';
$('#form').append(str);
}
else if (type == 'radio') {
i++;
var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
+'<input type="hidden" name="type[]" value="radio"><input type="hidden" name="option[]" class="option" value="'+i+'">'
+'<div class="col-lg-3">'
+'<label class="control-label">Radio</label>'
+'</div>'
+'<div class="col-lg-7">'
+'<input class="form-control" type="text" name="label[]" placeholder="Radio Label" style="margin-bottom:10px">'
+'<div class="customer_choice_options_types_wrap_child">'
+'</div>'
+'<button class="btn btn-success pull-right" type="button" onclick="add_customer_choice_options(this)"><i class="glyphicon glyphicon-plus"></i> Add option</button>'
+'</div>'
+'<div class="col-lg-2">'
+'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
+'</div>'
+'</div>';
$('#form').append(str);
}
else if (type == 'file') {
var str = '<div class="form-group row" style="background:rgba(0,0,0,0.1);padding:10px 0;">'
+'<input type="hidden" name="type[]" value="file">'
+'<div class="col-lg-3">'
+'<label class="control-label">File</label>'
+'</div>'
+'<div class="col-lg-7">'
+'<input class="form-control" type="text" name="label[]" placeholder="Label">'
+'</div>'
+'<div class="col-lg-2">'
+'<span class="btn btn-icon btn-circle" onclick="delete_choice_clearfix(this)"><i class="las la-times"></i></span>'
+'</div>'
+'</div>';
$('#form').append(str);
}
}
</script>
@endsection

View File

@@ -0,0 +1,169 @@
@extends('frontend.layouts.app')
@section('content')
<section class="pt-4 mb-4">
<div class="container">
<div class="row">
<div class="col-lg-6 text-center text-lg-left">
<h1 class="fw-600 h4">{{ translate('Affiliate Informations') }}</h1>
</div>
<div class="col-lg-6">
<ul class="breadcrumb bg-transparent p-0 justify-content-center justify-content-lg-end">
<li class="breadcrumb-item opacity-50">
<a class="text-reset" href="{{ route('home') }}">{{ translate('Home') }}</a>
</li>
<li class="text-dark fw-600 breadcrumb-item">
<a class="text-reset" href="{{ route('affiliate.apply') }}">"{{ translate('Affiliate') }}"</a>
</li>
</ul>
</div>
</div>
<div class="row mt-4">
<div class="col-lg-8 mx-auto">
<form class="" action="{{ route('affiliate.store_affiliate_user') }}" method="POST" enctype="multipart/form-data">
@csrf
@if (!Auth::check())
<div class="card rounded-0 shadow-none">
<div class="card-header border-bottom-0">
<h5 class="mb-0 fs-15 fw-600">{{translate('User Info')}}</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="form-group">
<div class="input-group input-group--style-1">
<input type="text" class="form-control rounded-0{{ $errors->has('name') ? ' is-invalid' : '' }}" value="{{ old('name') }}" placeholder="{{ translate('Name') }}" name="name">
<span class="input-group-addon">
<i class="las la-user"></i>
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group">
<div class="input-group input-group--style-1">
<input type="email" class="form-control rounded-0{{ $errors->has('email') ? ' is-invalid' : '' }}" value="{{ old('email') }}" placeholder="{{ translate('Email') }}" name="email">
<span class="input-group-addon">
<i class="las la-envelope"></i>
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group">
<div class="input-group input-group--style-1">
<input type="password" class="form-control rounded-0{{ $errors->has('password') ? ' is-invalid' : '' }}" placeholder="{{ translate('Password') }}" name="password">
<span class="input-group-addon">
<i class="las la-lock"></i>
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group">
<div class="input-group input-group--style-1">
<input type="password" class="form-control rounded-0" placeholder="{{ translate('Confirm Password') }}" name="password_confirmation">
<span class="input-group-addon">
<i class=" las la-lock"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
@endif
<div class="card rounded-0 shadow-none">
<div class="card-header border-bottom-0">
<h5 class="mb-0 fs-15 fw-600">{{translate('Verification info')}}</h5>
</div>
<div class="card-body">
@php
$verification_form = \App\Models\AffiliateConfig::where('type', 'verification_form')->first()->value;
@endphp
@foreach (json_decode($verification_form) as $key => $element)
@if ($element->type == 'text')
<div class="row">
<label class="col-md-2 col-form-label">{{ $element->label }} <span class="text-danger">*</span></label>
<div class="col-md-10">
<input type="{{ $element->type }}" class="form-control rounded-0 mb-3" placeholder="{{ $element->label }}" name="element_{{ $key }}" required>
</div>
</div>
@elseif($element->type == 'file')
<div class="row">
<label class="col-md-2 col-form-label">{{ $element->label }}</label>
<div class="col-md-10">
<input type="{{ $element->type }}" name="element_{{ $key }}" id="file-{{ $key }}" class="custom-input-file custom-input-file--4" data-multiple-caption="{count} files selected" required/>
<label for="file-{{ $key }}" class="mw-100 mb-3">
<span></span>
<strong>
<i class="fa fa-upload"></i>
{{translate('Choose file')}}
</strong>
</label>
</div>
</div>
@elseif ($element->type == 'select' && is_array(json_decode($element->options)))
<div class="row">
<label class="col-md-2 col-form-label">{{ $element->label }}</label>
<div class="col-md-10">
<div class="mb-3">
<select class="form-control rounded-0 selectpicker" data-minimum-results-for-search="Infinity" name="element_{{ $key }}" required>
@foreach (json_decode($element->options) as $value)
<option value="{{ $value }}">{{ $value }}</option>
@endforeach
</select>
</div>
</div>
</div>
@elseif ($element->type == 'multi_select' && is_array(json_decode($element->options)))
<div class="row">
<label class="col-md-2 col-form-label">{{ $element->label }}</label>
<div class="col-md-10">
<div class="mb-3">
<select class="form-control rounded-0 selectpicker" data-minimum-results-for-search="Infinity" name="element_{{ $key }}[]" multiple required>
@foreach (json_decode($element->options) as $value)
<option value="{{ $value }}">{{ $value }}</option>
@endforeach
</select>
</div>
</div>
</div>
@elseif ($element->type == 'radio')
<div class="row">
<label class="col-md-2 col-form-label">{{ $element->label }}</label>
<div class="col-md-10">
<div class="mb-3">
@foreach (json_decode($element->options) as $value)
<div class="radio radio-inline">
<input type="radio" name="element_{{ $key }}" value="{{ $value }}" id="{{ $value }}" required>
<label for="{{ $value }}">{{ $value }}</label>
</div>
@endforeach
</div>
</div>
</div>
@endif
@endforeach
</div>
</div>
<div class="form-group mb-0 text-right">
<button type="submit" class="btn btn-primary rounded-0 w-150px">{{translate('Save')}}</button>
</div>
</form>
</div>
</div>
</div>
</section>
@endsection

View File

@@ -0,0 +1,294 @@
@extends('frontend.layouts.app')
@section('content')
<section class="py-5">
<div class="container">
<div class="d-flex align-items-start">
@include('frontend.inc.user_side_nav')
<div class="aiz-user-panel">
<div class="aiz-titlebar mb-4">
<div class="row align-items-center">
<div class="col-md-6">
<h1 class="fs-20 fw-700 text-dark">{{ translate('Affiliate') }}</h1>
</div>
</div>
</div>
<div class="row gutters-16 mb-2">
<!-- Affiliate Balance -->
<div class="col-md-4 mx-auto mb-4" >
<div class="bg-dark text-white overflow-hidden text-center p-4 h-100">
<svg xmlns="http://www.w3.org/2000/svg" width="17.402" height="32" viewBox="0 0 17.402 32">
<path id="Path_32606" data-name="Path 32606" d="M14.888-4.338a4.994,4.994,0,0,0-2.021-1.9,6.687,6.687,0,0,0-3.175-.7,5.029,5.029,0,0,0-3.258.969,3.108,3.108,0,0,0-1.2,2.536q0,2.515,3.34,3.175l3.052.577a13.933,13.933,0,0,1,2.8.825,7.913,7.913,0,0,1,2.227,1.381,5.876,5.876,0,0,1,1.485,2.082A7.211,7.211,0,0,1,18.682,7.5a6.445,6.445,0,0,1-.536,2.7,6.111,6.111,0,0,1-1.505,2.041A7.129,7.129,0,0,1,14.332,13.6a11.987,11.987,0,0,1-2.907.66v2.474a1.62,1.62,0,0,1-.371,1.093,1.334,1.334,0,0,1-1.072.433,1.334,1.334,0,0,1-1.072-.433,1.62,1.62,0,0,1-.371-1.093V14.219A9.33,9.33,0,0,1,5.61,13.5a9.09,9.09,0,0,1-2.082-1.258,6.581,6.581,0,0,1-1.34-1.464,6.227,6.227,0,0,1-.7-1.381,2.691,2.691,0,0,1-.206-.948A1.548,1.548,0,0,1,1.734,7.27a1.6,1.6,0,0,1,1.155-.433,1.3,1.3,0,0,1,.928.33,3.373,3.373,0,0,1,.639.866,13.046,13.046,0,0,0,.763,1.175A4.954,4.954,0,0,0,6.332,10.3a5.722,5.722,0,0,0,1.67.8,7.922,7.922,0,0,0,2.351.309,4.989,4.989,0,0,0,3.629-1.175,3.727,3.727,0,0,0,1.2-2.742,3.53,3.53,0,0,0-1.052-2.763,6.445,6.445,0,0,0-3.072-1.361L7.837,2.755A8.572,8.572,0,0,1,3.115.507a5.631,5.631,0,0,1-1.381-3.9A5.738,5.738,0,0,1,3.589-7.843,8.258,8.258,0,0,1,8.538-9.822v-2.433a1.45,1.45,0,0,1,.412-1.072,1.45,1.45,0,0,1,1.072-.412,1.316,1.316,0,0,1,1.031.412,1.542,1.542,0,0,1,.371,1.072v2.474a9.785,9.785,0,0,1,2.412.66,9.885,9.885,0,0,1,1.856,1.031,6.7,6.7,0,0,1,1.32,1.216,6.849,6.849,0,0,1,.8,1.216A2.018,2.018,0,0,1,18.1-4.627,1.4,1.4,0,0,1,17.692-3.6a1.5,1.5,0,0,1-1.113.412,1.5,1.5,0,0,1-.99-.309A3.423,3.423,0,0,1,14.888-4.338Z" transform="translate(-1.28 13.74)" fill="#fff"/>
</svg>
<div class="py-2 mt-2">
<div class="fs-14 fw-400 text-center">{{ translate('Affiliate Balance') }}</div>
<div class="fs-30 fw-700 text-center">{{ single_price(Auth::user()->affiliate_user->balance) }}</div>
</div>
</div>
</div>
<!-- Configure Payout -->
<div class="col-md-4 mx-auto mb-4" >
<a href="{{ route('affiliate.payment_settings') }}">
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light">
<span class="size-60px rounded-circle mx-auto bg-dark d-flex align-items-center justify-content-center mb-3">
<i class="las la-cog la-3x text-white"></i>
</span>
<div class="fs-14 fw-600 text-dark">{{ translate('Configure Payout') }}</div>
</div>
</a>
</div>
<!-- Affiliate Withdraw Request -->
<div class="col-md-4 mx-auto mb-4" >
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light" onclick="show_affiliate_withdraw_modal()">
<span class="size-60px rounded-circle mx-auto bg-dark d-flex align-items-center justify-content-center mb-3">
<i class="las la-plus la-3x text-white"></i>
</span>
<div class="fs-14 fw-600 text-dark">{{ translate('Affiliate Withdraw Request') }}</div>
</div>
</div>
</div>
<!-- Copy Url -->
@if (addon_is_activated('affiliate_system')
&& \App\Models\AffiliateOption::where('type', 'user_registration_first_purchase')->first()->status)
<div class="row">
@php
if(Auth::user()->referral_code == null){
Auth::user()->referral_code = substr(Auth::user()->id.Str::random(), 0, 10);
Auth::user()->save();
}
$referral_code = Auth::user()->referral_code;
$referral_code_url = URL::to('/users/registration')."?referral_code=$referral_code";
@endphp
<div class="col mb-2">
<div class="card rounded-0 shadow-none border mb-4">
<div class="form-box-content p-4">
<div class="row gutters-16">
<div class="col-lg-10 col-sm-9 form-group mb-3 mb-sm-0">
<textarea id="referral_code_url" class="form-control rounded-0" readonly type="text">{{$referral_code_url}}</textarea>
</div>
<div class="col-lg-2 col-sm-3">
<button type=button id="ref-cpurl-btn" class="btn btn-primary btn-block rounded-0" data-attrcpy="{{translate('Copied')}}" onclick="copyToClipboard('url')" >{{translate('Copy Url')}}</button>
</div>
</div>
</div>
</div>
</div>
</div>
@endif
<!-- Affiliate Stats -->
<div class="card rounded-0 shadow-none border mb-3">
<form class="" id="sort_blogs" action="" method="GET">
<div class="card-header border-bottom-0 row pt-4">
<div class="col text-center text-md-left">
<h5 class="mb-md-0 fs-18 fw-700 text-dark">{{translate('Affiliate Status')}}</h5>
</div>
<div class="col-md-5 col-xl-4">
<div class="input-group mb-0">
<select class="form-control aiz-selectpicker" name="type" data-live-search="true">
<option value="">Choose</option>
<option value="Today" @if($type == 'Today') selected @endif>Today</option>
<option value="7" @if($type == '7') selected @endif>Last 7 Days</option>
<option value="30" @if($type == '30') selected @endif>Last 30 Days</option>
</select>
<button class="btn btn-primary rounded-0 input-group-append" type="submit">{{ translate('Filter') }}</button>
</div>
</div>
</div>
</form>
<div class="card-body">
<div class="row gutters-16">
<!-- No. of Click -->
<div class="col-md-3 mx-auto mb-3">
<a href="#">
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light">
<span class="fs-30 fw-700 text-dark mb-3">
@if($affliate_stats->count_click)
{{ $affliate_stats->count_click }}
@else
0
@endif
</span>
<div class="fs-14 fw-700 text-dark">{{ translate('No. of Click') }}</div>
</div>
</a>
</div>
<!-- No. of Item -->
<div class="col-md-3 mx-auto mb-3" >
<a href="#">
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light">
<span class="fs-30 fw-700 text-dark">
@if($affliate_stats->count_item)
{{ $affliate_stats->count_item }}
@else
0
@endif
</span>
<div class="fs-14 fw-700 text-dark">{{ translate('No. of Item') }}</div>
</div>
</a>
</div>
<!-- No. of Deliverd -->
<div class="col-md-3 mx-auto mb-3" >
<a href="#">
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light">
<span class="fs-30 fw-700 text-dark">
@if($affliate_stats->count_delivered)
{{ $affliate_stats->count_delivered }}
@else
0
@endif
</span>
<div class="fs-14 fw-700 text-dark">{{ translate('No. of Deliverd') }}</div>
</div>
</a>
</div>
<!-- No. of Cancel -->
<div class="col-md-3 mx-auto mb-3" >
<a href="#">
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light">
<span class="fs-30 fw-700 text-dark">
@if($affliate_stats->count_cancel)
{{ $affliate_stats->count_cancel }}
@else
0
@endif
</span>
<div class="fs-14 fw-700 text-dark">{{ translate('No. of Cancel') }}</div>
</div>
</a>
</div>
</div>
</div>
</div>
<br>
<!-- Affiliate Earning History -->
<div class="card rounded-0 shadow-none border">
<div class="card-header border-bottom-0">
<h5 class="mb-0 fs-18 fw-700 text-dark mt-4">{{translate('Affiliate Earning History')}}</h5>
</div>
<div class="card-body pt-0">
<table class="table aiz-table mb-0">
<thead class="text-gray fs-12">
<tr>
<th class="pl-0">#</th>
<th>{{ translate('Referral User')}}</th>
<th>{{ translate('Amount')}}</th>
<th data-breakpoints="lg">{{ translate('Order Id')}}</th>
<th data-breakpoints="lg">{{ translate('Referral Type') }}</th>
<th data-breakpoints="lg">{{ translate('Product') }}</th>
<th data-breakpoints="lg" class="text-right pr-0">{{ translate('Date') }}</th>
</tr>
</thead>
<tbody class="fs-14">
@foreach($affiliate_logs as $key => $affiliate_log)
<tr>
<td class="pl-0" style="vertical-align: middle;">{{ sprintf('%02d', ($key+1) + ($affiliate_logs->currentPage() - 1)*$affiliate_logs->perPage()) }}</td>
<td class="fw-700" style="vertical-align: middle;">
@if($affiliate_log->user_id !== null)
{{ $affiliate_log->user->name }}
@else
{{ translate('Guest').' ('. $affiliate_log->guest_id.')' }}
@endif
</td>
<td class="fw-700" style="vertical-align: middle;">{{ single_price($affiliate_log->amount) }}</td>
<td class="fw-700 text-primary" style="vertical-align: middle;">
@if($affiliate_log->order_id != null)
{{ $affiliate_log->order->code }}
@else
{{ $affiliate_log->order_detail->order->code }}
@endif
</td>
<td style="vertical-align: middle;"> {{ ucwords(str_replace('_',' ', $affiliate_log->affiliate_type)) }}</td>
<td class="fw-700" style="vertical-align: middle;">
@if($affiliate_log->order_detail_id != null)
@php
$url = $affiliate_log->order_detail->product->auction_product == 1 ? route('auction-product', $affiliate_log->order_detail->product->slug) : route('product', $affiliate_log->order_detail->product->slug)
@endphp
<a href="{{ $url }}" target="_blank"
title="{{ $affiliate_log->order_detail->product->name }}" class="text-reset text-truncate hov-text-primary">
{{ $affiliate_log->order_detail->product->name }}
</a>
@endif
</td>
<td class="text-right pr-0" style="vertical-align: middle;">{{ $affiliate_log->created_at->format('d-m-Y') }} </td>
</tr>
@endforeach
</tbody>
</table>
<div class="aiz-pagination">
{{ $affiliate_logs->links() }}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('modal')
<!-- Affiliate Withdraw Modal -->
<div class="modal fade" id="affiliate_withdraw_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{ translate('Affiliate Withdraw Request') }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
</div>
<form class="" action="{{ route('affiliate.withdraw_request.store') }}" method="post">
@csrf
<div class="modal-body gry-bg px-3 pt-3">
<div class="row">
<div class="col-md-3">
<label>{{ translate('Amount')}} <span class="text-danger">*</span></label>
</div>
<div class="col-md-9">
<input type="number" class="form-control mb-3 rounded-0" name="amount" min="1" max="{{ Auth::user()->affiliate_user->balance }}" placeholder="{{ translate('Amount')}}" required>
</div>
</div>
<div class="form-group text-right">
<button type="submit" class="btn btn-sm btn-primary rounded-0 transition-3d-hover mr-1">{{translate('Confirm')}}</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@section('script')
<script>
function copyToClipboard(btn){
// var el_code = document.getElementById('referral_code');
var el_url = document.getElementById('referral_code_url');
// var c_b = document.getElementById('ref-cp-btn');
var c_u_b = document.getElementById('ref-cpurl-btn');
// if(btn == 'code'){
// if(el_code != null && c_b != null){
// el_code.select();
// document.execCommand('copy');
// c_b .innerHTML = c_b.dataset.attrcpy;
// }
// }
if(btn == 'url'){
if(el_url != null && c_u_b != null){
el_url.select();
document.execCommand('copy');
c_u_b .innerHTML = c_u_b.dataset.attrcpy;
}
}
}
function show_affiliate_withdraw_modal(){
$('#affiliate_withdraw_modal').modal('show');
}
</script>
@endsection

View File

@@ -0,0 +1,140 @@
@extends('frontend.layouts.app')
@section('content')
<section class="py-5">
<div class="container">
<div class="d-flex align-items-start">
@include('frontend.inc.user_side_nav')
<div class="aiz-user-panel">
<div class="aiz-titlebar mb-4">
<div class="row align-items-center">
<div class="col-md-6">
<h1 class="fs-20 fw-700 text-dark">{{ translate('Affiliate') }}</h1>
</div>
</div>
</div>
<div class="row gutters-16 mb-2">
<!-- Affiliate Balance -->
<div class="col-md-6 mx-auto mb-4" >
<div class="bg-dark text-white overflow-hidden text-center p-4 h-100">
<svg xmlns="http://www.w3.org/2000/svg" width="17.402" height="32" viewBox="0 0 17.402 32">
<path id="Path_32606" data-name="Path 32606" d="M14.888-4.338a4.994,4.994,0,0,0-2.021-1.9,6.687,6.687,0,0,0-3.175-.7,5.029,5.029,0,0,0-3.258.969,3.108,3.108,0,0,0-1.2,2.536q0,2.515,3.34,3.175l3.052.577a13.933,13.933,0,0,1,2.8.825,7.913,7.913,0,0,1,2.227,1.381,5.876,5.876,0,0,1,1.485,2.082A7.211,7.211,0,0,1,18.682,7.5a6.445,6.445,0,0,1-.536,2.7,6.111,6.111,0,0,1-1.505,2.041A7.129,7.129,0,0,1,14.332,13.6a11.987,11.987,0,0,1-2.907.66v2.474a1.62,1.62,0,0,1-.371,1.093,1.334,1.334,0,0,1-1.072.433,1.334,1.334,0,0,1-1.072-.433,1.62,1.62,0,0,1-.371-1.093V14.219A9.33,9.33,0,0,1,5.61,13.5a9.09,9.09,0,0,1-2.082-1.258,6.581,6.581,0,0,1-1.34-1.464,6.227,6.227,0,0,1-.7-1.381,2.691,2.691,0,0,1-.206-.948A1.548,1.548,0,0,1,1.734,7.27a1.6,1.6,0,0,1,1.155-.433,1.3,1.3,0,0,1,.928.33,3.373,3.373,0,0,1,.639.866,13.046,13.046,0,0,0,.763,1.175A4.954,4.954,0,0,0,6.332,10.3a5.722,5.722,0,0,0,1.67.8,7.922,7.922,0,0,0,2.351.309,4.989,4.989,0,0,0,3.629-1.175,3.727,3.727,0,0,0,1.2-2.742,3.53,3.53,0,0,0-1.052-2.763,6.445,6.445,0,0,0-3.072-1.361L7.837,2.755A8.572,8.572,0,0,1,3.115.507a5.631,5.631,0,0,1-1.381-3.9A5.738,5.738,0,0,1,3.589-7.843,8.258,8.258,0,0,1,8.538-9.822v-2.433a1.45,1.45,0,0,1,.412-1.072,1.45,1.45,0,0,1,1.072-.412,1.316,1.316,0,0,1,1.031.412,1.542,1.542,0,0,1,.371,1.072v2.474a9.785,9.785,0,0,1,2.412.66,9.885,9.885,0,0,1,1.856,1.031,6.7,6.7,0,0,1,1.32,1.216,6.849,6.849,0,0,1,.8,1.216A2.018,2.018,0,0,1,18.1-4.627,1.4,1.4,0,0,1,17.692-3.6a1.5,1.5,0,0,1-1.113.412,1.5,1.5,0,0,1-.99-.309A3.423,3.423,0,0,1,14.888-4.338Z" transform="translate(-1.28 13.74)" fill="#fff"/>
</svg>
<div class="py-2 mt-2">
<div class="fs-14 fw-400 text-center">{{ translate('Affiliate Balance') }}</div>
<div class="fs-30 fw-700 text-center">{{ single_price(Auth::user()->affiliate_user->balance) }}</div>
</div>
</div>
</div>
<!-- Affiliate Withdraw Request -->
<div class="col-md-6 mx-auto mb-4">
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light" onclick="show_affiliate_withdraw_modal()">
<span class="size-60px rounded-circle mx-auto bg-dark d-flex align-items-center justify-content-center mb-3">
<i class="las la-plus la-3x text-white"></i>
</span>
<div class="fs-14 fw-600 text-dark">{{ translate('Affiliate Withdraw Request') }}</div>
</div>
</div>
</div>
<!-- Affiliate payment history -->
<div class="card rounded-0 shadow-none border">
<div class="card-header border-bottom-0">
<h5 class="mb-0 fs-20 fw-700 text-dark">{{ translate('Affiliate payment history')}}</h5>
</div>
<div class="card-body">
<table class="table aiz-table mb-0">
<thead class="text-gray fs-12">
<tr>
<th class="pl-0">#</th>
<th>{{ translate('Date') }}</th>
<th>{{translate('Amount')}}</th>
<th class="pr-0">{{translate('Payment Method')}}</th>
</tr>
</thead>
<tbody class="fs-14">
@foreach ($affiliate_payments as $key => $affiliate_payment)
<tr>
<td class="pl-0">{{ sprintf('%02d', $key+1) }}</td>
<td>{{ date('d-m-Y', strtotime($affiliate_payment->created_at)) }}</td>
<td>{{ single_price($affiliate_payment->amount) }}</td>
<td class="pr-0">{{ ucfirst(str_replace('_', ' ', $affiliate_payment ->payment_method)) }}</td>
</tr>
@endforeach
</tbody>
</table>
<div class="aiz-pagination">
{{ $affiliate_payments->links() }}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('modal')
<!-- Affiliate Withdraw Modal -->
<div class="modal fade" id="affiliate_withdraw_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{ translate('Affiliate Withdraw Request') }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
</div>
<form class="" action="{{ route('affiliate.withdraw_request.store') }}" method="post">
@csrf
<div class="modal-body gry-bg px-3 pt-3">
<div class="row">
<div class="col-md-3">
<label>{{ translate('Amount')}} <span class="text-danger">*</span></label>
</div>
<div class="col-md-9">
<input type="number" class="form-control mb-3 rounded-0" name="amount" min="1" max="{{ Auth::user()->affiliate_user->balance }}" placeholder="{{ translate('Amount')}}" required>
</div>
</div>
<div class="form-group text-right">
<button type="submit" class="btn btn-sm btn-primary rounded-0 transition-3d-hover mr-1">{{translate('Confirm')}}</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@section('script')
<script>
function copyToClipboard(btn){
// var el_code = document.getElementById('referral_code');
var el_url = document.getElementById('referral_code_url');
// var c_b = document.getElementById('ref-cp-btn');
var c_u_b = document.getElementById('ref-cpurl-btn');
// if(btn == 'code'){
// if(el_code != null && c_b != null){
// el_code.select();
// document.execCommand('copy');
// c_b .innerHTML = c_b.dataset.attrcpy;
// }
// }
if(btn == 'url'){
if(el_url != null && c_u_b != null){
el_url.select();
document.execCommand('copy');
c_u_b .innerHTML = c_u_b.dataset.attrcpy;
}
}
}
function show_affiliate_withdraw_modal(){
$('#affiliate_withdraw_modal').modal('show');
}
</script>
@endsection

View File

@@ -0,0 +1,47 @@
@extends('frontend.layouts.app')
@section('content')
<section class="py-5">
<div class="container">
<div class="d-flex align-items-start">
@include('frontend.inc.user_side_nav')
<div class="aiz-user-panel">
<div class="aiz-titlebar mb-4">
<div class="row align-items-center">
<div class="col-md-6">
<h1 class="fs-20 fw-700 text-dark">{{ translate('Affiliate') }}</h1>
</div>
</div>
</div>
<div class="card rounded-0 shadow-none border">
<div class="card-header border-bottom-0">
<h5 class="mb-0 fs-18 fw-700 text-dark">{{ translate('Payment Settings')}}</h5>
</div>
<div class="card-body">
<form action="{{ route('affiliate.payment_settings_store') }}" method="POST">
@csrf
<div class="form-group row">
<label class="col-md-2 col-form-label">{{translate('Paypal Email')}}</label>
<div class="col-md-10">
<input type="email" class="form-control rounded-0" placeholder="{{ translate('Paypal Email')}}" name="paypal_email" value="{{ $affiliate_user->paypal_email }}">
</div>
</div>
<div class="form-group row">
<label class="col-md-2 col-form-label">{{translate('Bank Informations')}}</label>
<div class="col-md-10">
<input type="text" class="form-control rounded-0" placeholder="{{ translate('Acc. No, Bank Name etc')}}" name="bank_information" value="{{ $affiliate_user->bank_information }}">
</div>
</div>
<div class="form-group mb-0 text-right">
<button type="submit" class="btn btn-primary rounded-0">{{translate('Update Payment Settings')}}</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection

View File

@@ -0,0 +1,125 @@
@extends('frontend.layouts.app')
@section('content')
<section class="py-5">
<div class="container">
<div class="d-flex align-items-start">
@include('frontend.inc.user_side_nav')
<div class="aiz-user-panel">
<div class="aiz-titlebar mb-4">
<div class="row align-items-center">
<div class="col-md-6">
<h1 class="fs-20 fw-700 text-dark">{{ translate('Affiliate') }}</h1>
</div>
</div>
</div>
<div class="row gutters-16 mb-2">
<!-- Affiliate Balance -->
<div class="col-md-6 mx-auto mb-4" >
<div class="bg-dark text-white overflow-hidden text-center p-4 h-100">
<svg xmlns="http://www.w3.org/2000/svg" width="17.402" height="32" viewBox="0 0 17.402 32">
<path id="Path_32606" data-name="Path 32606" d="M14.888-4.338a4.994,4.994,0,0,0-2.021-1.9,6.687,6.687,0,0,0-3.175-.7,5.029,5.029,0,0,0-3.258.969,3.108,3.108,0,0,0-1.2,2.536q0,2.515,3.34,3.175l3.052.577a13.933,13.933,0,0,1,2.8.825,7.913,7.913,0,0,1,2.227,1.381,5.876,5.876,0,0,1,1.485,2.082A7.211,7.211,0,0,1,18.682,7.5a6.445,6.445,0,0,1-.536,2.7,6.111,6.111,0,0,1-1.505,2.041A7.129,7.129,0,0,1,14.332,13.6a11.987,11.987,0,0,1-2.907.66v2.474a1.62,1.62,0,0,1-.371,1.093,1.334,1.334,0,0,1-1.072.433,1.334,1.334,0,0,1-1.072-.433,1.62,1.62,0,0,1-.371-1.093V14.219A9.33,9.33,0,0,1,5.61,13.5a9.09,9.09,0,0,1-2.082-1.258,6.581,6.581,0,0,1-1.34-1.464,6.227,6.227,0,0,1-.7-1.381,2.691,2.691,0,0,1-.206-.948A1.548,1.548,0,0,1,1.734,7.27a1.6,1.6,0,0,1,1.155-.433,1.3,1.3,0,0,1,.928.33,3.373,3.373,0,0,1,.639.866,13.046,13.046,0,0,0,.763,1.175A4.954,4.954,0,0,0,6.332,10.3a5.722,5.722,0,0,0,1.67.8,7.922,7.922,0,0,0,2.351.309,4.989,4.989,0,0,0,3.629-1.175,3.727,3.727,0,0,0,1.2-2.742,3.53,3.53,0,0,0-1.052-2.763,6.445,6.445,0,0,0-3.072-1.361L7.837,2.755A8.572,8.572,0,0,1,3.115.507a5.631,5.631,0,0,1-1.381-3.9A5.738,5.738,0,0,1,3.589-7.843,8.258,8.258,0,0,1,8.538-9.822v-2.433a1.45,1.45,0,0,1,.412-1.072,1.45,1.45,0,0,1,1.072-.412,1.316,1.316,0,0,1,1.031.412,1.542,1.542,0,0,1,.371,1.072v2.474a9.785,9.785,0,0,1,2.412.66,9.885,9.885,0,0,1,1.856,1.031,6.7,6.7,0,0,1,1.32,1.216,6.849,6.849,0,0,1,.8,1.216A2.018,2.018,0,0,1,18.1-4.627,1.4,1.4,0,0,1,17.692-3.6a1.5,1.5,0,0,1-1.113.412,1.5,1.5,0,0,1-.99-.309A3.423,3.423,0,0,1,14.888-4.338Z" transform="translate(-1.28 13.74)" fill="#fff"/>
</svg>
<div class="py-2 mt-2">
<div class="fs-14 fw-400 text-center">{{ translate('Affiliate Balance') }}</div>
<div class="fs-30 fw-700 text-center">{{ single_price(Auth::user()->affiliate_user->balance) }}</div>
</div>
</div>
</div>
<!-- Affiliate Withdraw Request -->
<div class="col-md-6 mx-auto mb-4">
<div class="p-4 mb-3 c-pointer text-center bg-light has-transition border h-100 hov-bg-soft-light" onclick="show_affiliate_withdraw_modal()">
<span class="size-60px rounded-circle mx-auto bg-dark d-flex align-items-center justify-content-center mb-3">
<i class="las la-plus la-3x text-white"></i>
</span>
<div class="fs-14 fw-600 text-dark">{{ translate('Affiliate Withdraw Request') }}</div>
</div>
</div>
</div>
<!-- Affiliate withdraw request history -->
<div class="card rounded-0 shadow-none border">
<div class="card-header border-bottom-0">
<h5 class="mb-0 fs-20 fw-700 text-dark">{{ translate('Affiliate withdraw request history')}}</h5>
</div>
<div class="card-body">
<table class="table aiz-table mb-0">
<thead class="text-gray fs-12">
<tr>
<th class="pl-0">#</th>
<th>{{ translate('Date') }}</th>
<th>{{ translate('Amount')}}</th>
<th data-breakpoints="lg">{{ translate('Status')}}</th>
</tr>
</thead>
<tbody class="fs-14">
@foreach ($affiliate_withdraw_requests as $key => $affiliate_withdraw_request)
<tr>
<td class="pl-0">{{ sprintf('%02d', $key+1) }}</td>
<td>{{ date('d-m-Y', strtotime($affiliate_withdraw_request->created_at)) }}</td>
<td class="fw-700">{{ single_price($affiliate_withdraw_request->amount) }}</td>
<td>
@if($affiliate_withdraw_request->status == 1)
<span class="badge badge-inline badge-success p-3 fs-12" style="border-radius: 25px; min-width: 80px !important;">{{translate('Approved')}}</span>
@elseif($affiliate_withdraw_request->status == 2)
<span class="badge badge-inline badge-danger p-3 fs-12" style="border-radius: 25px; min-width: 80px !important;">{{translate('Rejected')}}</span>
@else
<span class="badge badge-inline badge-info p-3 fs-12" style="border-radius: 25px; min-width: 80px !important;">{{translate('Pending')}}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="aiz-pagination">
{{ $affiliate_withdraw_requests->links() }}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('modal')
<!-- Affiliate Withdraw Modal -->
<div class="modal fade" id="affiliate_withdraw_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">{{ translate('Affiliate Withdraw Request') }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
</div>
<form class="" action="{{ route('affiliate.withdraw_request.store') }}" method="post">
@csrf
<div class="modal-body gry-bg px-3 pt-3">
<div class="row">
<div class="col-md-3">
<label>{{ translate('Amount')}} <span class="text-danger">*</span></label>
</div>
<div class="col-md-9">
<input type="number" class="form-control mb-3 rounded-0" name="amount" min="1" max="{{ Auth::user()->affiliate_user->balance }}" placeholder="{{ translate('Amount')}}" required>
</div>
</div>
<div class="form-group text-right">
<button type="submit" class="btn btn-sm btn-primary rounded-0 transition-3d-hover mr-1">{{translate('Confirm')}}</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@section('script')
<script>
function show_affiliate_withdraw_modal(){
$('#affiliate_withdraw_modal').modal('show');
}
</script>
@endsection

View File

@@ -0,0 +1,236 @@
@extends('backend.layouts.app')
@section('content')
<div class="row">
<div class="col-lg-6">
<div class="card">
<div class="card-header">
<h6 class="mb-0 h6">{{ translate('Basic Affiliate')}}</h6>
</div>
<div class="card-body">
<form class="form-horizontal" action="{{ route('affiliate.store') }}" method="POST">
@csrf
<div class="form-group row">
<input type="hidden" name="type" value="user_registration_first_purchase">
<div class="col-lg-4">
<label class="control-label">{{ translate('User Registration & First Purchase')}}</label>
</div>
<div class="col-lg-6">
@php
if(\App\Models\AffiliateOption::where('type', 'user_registration_first_purchase')->first() != null){
$percentage = \App\Models\AffiliateOption::where('type', 'user_registration_first_purchase')->first()->percentage;
$status = \App\Models\AffiliateOption::where('type', 'user_registration_first_purchase')->first()->status;
}
else {
$percentage = null;
}
@endphp
<input type="number" min="0" step="0.01" max="100" class="form-control" name="percentage" value="{{ $percentage }}" placeholder="Percentage of Order Amount" required>
</div>
<div class="col-lg-2">
<label class="control-label">%</label>
</div>
</div>
<div class="form-group row">
<div class="col-lg-4">
<label class="control-label">{{ translate('Status')}}</label>
</div>
<div class="col-lg-8">
<label class="aiz-switch aiz-switch-success mb-0">
<input value="1" name="status" type="checkbox" @if ($status)
checked
@endif>
<span class="slider round"></span>
</label>
</div>
</div>
<div class="form-group mb-0 text-right">
<button type="submit" class="btn btn-sm btn-primary">{{translate('Save')}}</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card">
<div class="card-header">
<h3 class="mb-0 h6">{{ translate('Product Sharing Affiliate')}}</h3>
</div>
<div class="card-body">
<form action="{{ route('affiliate.store') }}" method="POST">
@csrf
<div class="form-group row">
<input type="hidden" name="type" value="product_sharing">
<label class="col-lg-3 col-from-label">{{ translate('Product Sharing and Purchasing')}}</label>
<div class="col-lg-6">
@php
if(\App\Models\AffiliateOption::where('type', 'product_sharing')->first() != null && \App\Models\AffiliateOption::where('type', 'product_sharing')->first()->details != null){
$commission_product_sharing = json_decode(\App\Models\AffiliateOption::where('type', 'product_sharing')->first()->details)->commission;
$commission_type_product_sharing = json_decode(\App\Models\AffiliateOption::where('type', 'product_sharing')->first()->details)->commission_type;
$status = \App\Models\AffiliateOption::where('type', 'product_sharing')->first()->status;
}
else {
$commission_product_sharing = null;
$commission_type_product_sharing = null;
}
@endphp
<input type="number" min="0" step="0.01" max="100" class="form-control" name="amount" value="{{ $commission_product_sharing }}" placeholder="Percentage of Order Amount" required>
</div>
<div class="col-md-3">
<select class="form-control aiz-selectpicker" name="amount_type">
<option value="amount" @if ($commission_type_product_sharing == "amount") selected @endif>$</option>
<option value="percent" @if ($commission_type_product_sharing == "percent") selected @endif>%</option>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-lg-4">
<label class="control-label">{{ translate('Status')}}</label>
</div>
<div class="col-lg-8">
<label class="aiz-switch aiz-switch-success mb-0">
<input value="1" name="status" type="checkbox" @if ($status) checked @endif>
<span class="slider round"></span>
</label>
</div>
</div>
<div class="form-group mb-0 text-right">
<button type="submit" class="btn btn-sm btn-primary">{{translate('Save')}}</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="card">
<div class="card-header">
<h3 class="mb-0 h6">{{ translate('Product Sharing Affiliate (Category Wise)')}}</h3>
</div>
<div class="card-body">
<form class="form-horizontal" action="{{ route('affiliate.store') }}" method="POST">
@csrf
@php
if(\App\Models\AffiliateOption::where('type', 'category_wise_affiliate')->first() != null){
$category_wise_affiliate_status = \App\Models\AffiliateOption::where('type', 'category_wise_affiliate')->first()->status;
}
@endphp
<div class="form-group row">
<div class="col-lg-4">
<label class="control-label">{{ translate('Status')}}</label>
</div>
<div class="col-lg-8">
<label class="aiz-switch aiz-switch-success mb-0">
<input value="1" name="status" type="checkbox" @if ($category_wise_affiliate_status) checked @endif>
<span class="slider round"></span>
</label>
</div>
</div>
@if (\App\Models\AffiliateOption::where('type', 'category_wise_affiliate')->first() != null)
<input type="hidden" name="type" value="category_wise_affiliate">
@foreach (\App\Models\Category::all() as $key => $category)
@php
$found = false;
@endphp
@if(\App\Models\AffiliateOption::where('type', 'category_wise_affiliate')->first()->details != null)
@foreach (json_decode(\App\Models\AffiliateOption::where('type', 'category_wise_affiliate')->first()->details) as $key => $data)
@if($data->category_id == $category->id)
@php
$found = true;
$value = $data;
@endphp
@endif
@endforeach
@endif
@if ($found)
<div class="form-group row">
<div class="col-lg-5">
<input type="hidden" name="categories_id_{{ $value->category_id }}" value="{{ $value->category_id }}">
<input type="text" class="form-control" value="{{ \App\Models\Category::find($value->category_id)->name }}" readonly>
</div>
<div class="col-lg-4">
<input type="number" min="0" step="0.01" class="form-control" name="commison_amounts_{{ $value->category_id }}" value="{{ $value->commission }}">
</div>
<div class="col-md-3">
<select class="form-control aiz-selectpicker" name="commison_types_{{ $value->category_id }}">
<option value="amount" @if($value->commission_type == 'amount') selected @endif>$</option>
<option value="percent" @if($value->commission_type == 'percent') selected @endif>%</option>
</select>
</div>
</div>
@else
<div class="form-group row">
<div class="col-lg-5">
<input type="hidden" name="categories_id_{{ $category->id }}" value="{{ $category->id }}">
<input type="text" class="form-control" value="{{ $category->getTranslation('name') }}" readonly>
</div>
<div class="col-lg-4">
<input type="number" min="0" step="0.01" class="form-control" name="commison_amounts_{{ $category->id }}" value="0">
</div>
<div class="col-md-3">
<select class="form-control aiz-selectpicker" name="commison_types_{{ $category->id }}">
<option value="amount">$</option>
<option value="percent">%</option>
</select>
</div>
</div>
@endif
@endforeach
@endif
<div class="form-group mb-0 text-right">
<button type="submit" class="btn btn-sm btn-primary">{{translate('Save')}}</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-gray-light">
<div class="card-header">
<h5 class="mb-0 h6">
<i>{{ translate('N:B: You can not enable Single Product Sharing Affiliate and Category Wise Affiliate at a time.') }}</i>
</h5>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-gray-light">
<div class="card-header">
<h3 class="mb-0 h6">{{ translate('Affiliate Link Validatin Time (Days)')}}</h3>
</div>
<div class="card-body">
<form class="form-horizontal" action="{{ route('affiliate.configs.store') }}" method="POST">
@csrf
@php
$validation_time_info = \App\Models\AffiliateConfig::where('type', 'validation_time')->first();
$validation_time = '';
if($validation_time_info) {
$validation_time = $validation_time_info->value;
}
@endphp
<div class="form-group row">
<div class="col-lg-4">
<input type="hidden" class="form-control" name="type" value="validation_time">
<label class="control-label">{{ translate('Validation Time')}}</label>
</div>
<div class="col-lg-8">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="No of Days" name="validation_time" value="{{$validation_time}}">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Days</span>
</div>
</div>
</div>
</div>
<div class="form-group mb-0 text-right">
<button type="submit" class="btn btn-sm btn-primary">{{translate('Save')}}</button>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,35 @@
@extends('backend.layouts.app')
@section('content')
<div class="card">
<div class="card-header">
<h5 class="mb-0 h6">{{ translate('Affiliate payments of ').$affiliate_user->user->name }}</h5>
</div>
<div class="card-body">
<table class="table aiz-table mb-0">
<thead>
<tr>
<th>#</th>
<th>{{ translate('Date')}}</th>
<th>{{ translate('Amount')}}</th>
<th>{{ translate('Payment Method') }}</th>
</tr>
</thead>
<tbody>
@foreach($affiliate_payments as $key => $payment)
<tr>
<td>{{ $key+1 }}</td>
<td>{{ $payment->created_at }}</td>
<td>
{{ single_price($payment->amount) }}
</td>
<td>{{ ucfirst($payment->payment_method) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View File

@@ -0,0 +1,55 @@
<form action="{{ route('affiliate_user.payment_store') }}" method="POST">
@csrf
<div class="modal-header">
<h5 class="modal-title h6">{{ translate('Affiliate Payment')}}</h5>
<button type="button" class="close" data-dismiss="modal">
</button>
</div>
<div class="modal-body">
<table class="table table-striped table-bordered" >
<tbody>
<tr>
@if($affiliate_user->balance >= 0)
<td>{{ translate('Due Amount') }}</td>
<td><strong>{{ single_price($affiliate_user->balance) }}</strong></td>
@endif
</tr>
<tr>
<td>{{ translate('Paypal Email') }}</td>
<td>{{ $affiliate_user->paypal_email }}</td>
</tr>
<tr>
<td>{{ translate('Bank Information') }}</td>
<td>{{ $affiliate_user->bank_information }}</td>
</tr>
</tbody>
</table>
@if ($affiliate_user->balance > 0)
<input type="hidden" name="affiliate_user_id" value="{{ $affiliate_user->id }}">
<div class="form-group row">
<label class="col-sm-3 col-from-label" for="amount">{{ translate('Amount')}}</label>
<div class="col-sm-9">
<input type="number" min="0" step="0.01" name="amount" id="amount" value="{{ $affiliate_user->balance }}" class="form-control" required>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-from-label" for="payment_method">{{ translate('Payment Method')}}</label>
<div class="col-sm-9">
<select name="payment_method" id="payment_method" class="form-control aiz-selectpicker" required>
<option value="">{{ translate('Select Payment Method')}}</option>
<option value="Paypal">{{ translate('Paypal')}}</option>
<option value="Bank">{{ translate('Bank')}}</option>
</select>
</div>
</div>
@endif
</div>
<div class="modal-footer">
@if ($affiliate_user->balance > 0)
<button class="btn btn-sm btn-primary" type="submit">{{ translate('Pay')}}</button>
@endif
<button type="button" class="btn btn-sm btn-light" data-dismiss="modal">{{translate('Cancel')}}</button>
</div>
</form>

View File

@@ -0,0 +1,43 @@
@extends('backend.layouts.app')
@section('content')
<div class="card">
<div class="card-header">
<h5 class="mb-0 h6">{{ translate('Refferal Users')}}</h5>
</div>
<div class="card-body">
<table class="table aiz-table mb-0">
<thead>
<tr>
<th>#</th>
<th>{{ translate('Name')}}</th>
<th data-breakpoints="lg">{{ translate('Phone')}}</th>
<th data-breakpoints="lg">{{ translate('Email Address')}}</th>
<th data-breakpoints="lg">{{ translate('Reffered By')}}</th>
</tr>
</thead>
<tbody>
@foreach($refferal_users as $key => $refferal_user)
@if ($refferal_user != null)
<tr>
<td>{{ ($key+1) + ($refferal_users->currentPage() - 1)*$refferal_users->perPage() }}</td>
<td>{{$refferal_user->name}}</td>
<td>{{$refferal_user->phone}}</td>
<td>{{$refferal_user->email}}</td>
<td>
@if (\App\Models\User::find($refferal_user->referred_by) != null)
{{ \App\Models\User::find($refferal_user->referred_by)->name }} ({{ \App\Models\User::find($refferal_user->referred_by)->email }})
@endif
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
<div class="aiz-pagination">
{{ $refferal_users->appends(request()->input())->links() }}
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,59 @@
@extends('backend.layouts.app')
@section('content')
<div class="card">
<div class="card-header">
<h5 class="mb-0 h6">{{ translate('Affiliate User Verification')}}</h5>
</div>
<div class="card-body row">
<div class="col-md-4">
<h6 class="mb-4">{{ translate('User Info') }}</h6>
<p class="text-muted">
<strong>{{ translate('Name') }} :</strong>
<span class="ml-2">{{ $affiliate_user->user->name }}</span>
</p>
<p class="text-muted">
<strong>{{translate('Email')}}</strong>
<span class="ml-2">{{ $affiliate_user->user->email }}</span>
</p>
<p class="text-muted">
<strong>{{translate('Address')}}</strong>
<span class="ml-2">{{ $affiliate_user->user->address }}</span>
</p>
<p class="text-muted">
<strong>{{translate('Phone')}}</strong>
<span class="ml-2">{{ $affiliate_user->user->phone }}</span>
</p>
</div>
<div class="col-md-6">
<h6 class="mb-4">{{ translate('Verification Info') }}</h6>
<table class="table table-striped table-bordered" cellspacing="0" width="100%">
<tbody>
@foreach (json_decode($affiliate_user->informations) as $key => $info)
<tr>
<th class="text-muted">{{ $info->label }}</th>
@if ($info->type == 'text' || $info->type == 'select' || $info->type == 'radio')
<td>{{ $info->value }}</td>
@elseif ($info->type == 'multi_select')
<td>
{{ implode(json_decode($info->value), ', ') }}
</td>
@elseif ($info->type == 'file')
<td>
<a href="{{ static_asset($info->value) }}" target="_blank" class="btn-info">{{ translate('Click here')}}</a>
</td>
@endif
</tr>
@endforeach
</tbody>
</table>
<div class="text-center">
<a href="{{ route('affiliate_user.reject', $affiliate_user->id) }}" class="btn btn-sm btn-default d-innline-block">{{ translate('Reject')}}</a></li>
<a href="{{ route('affiliate_user.approve', $affiliate_user->id) }}" class="btn btn-sm btn-dark d-innline-block">{{ translate('Accept')}}</a>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,113 @@
@extends('backend.layouts.app')
@section('content')
<div class="card">
<div class="card-header">
<h5 class="mb-0 h6">{{ translate('Affiliate Users')}}</h5>
</div>
<div class="card-body">
<table class="table aiz-table">
<thead>
<tr>
<th>#</th>
<th>{{ translate('Name')}}</th>
<th data-breakpoints="lg">{{ translate('Phone')}}</th>
<th data-breakpoints="lg">{{ translate('Email Address')}}</th>
<th data-breakpoints="lg">{{ translate('Verification Info')}}</th>
<th>{{ translate('Approval')}}</th>
<th data-breakpoints="lg">{{ translate('Due Amount') }}</th>
<th width="10%" class="text-right">{{ translate('Options')}}</th>
</tr>
</thead>
<tbody>
@foreach($affiliate_users as $key => $affiliate_user)
@if($affiliate_user->user != null)
<tr>
<td>{{ ($key+1) + ($affiliate_users->currentPage() - 1)*$affiliate_users->perPage() }}</td>
<td>{{$affiliate_user->user->name}}</td>
<td>{{$affiliate_user->user->phone}}</td>
<td>{{$affiliate_user->user->email}}</td>
<td>
@if ($affiliate_user->informations != null)
<a href="{{ route('affiliate_users.show_verification_request', $affiliate_user->id) }}">
<span class="badge badge-inline badge-info">{{translate('Show')}}</span>
</a>
@endif
</td>
<td>
<label class="aiz-switch aiz-switch-success mb-0">
<input onchange="update_approved(this)" value="{{ $affiliate_user->id }}" type="checkbox" <?php if($affiliate_user->status == 1) echo "checked";?> >
<span class="slider round"></span>
</label>
</td>
<td>
@if ($affiliate_user->balance >= 0)
{{ single_price($affiliate_user->balance) }}
@endif
</td>
<td class="text-right">
@can('pay_to_affiliate_user')
<a href="#" class="btn btn-soft-primary btn-icon btn-circle btn-sm" onclick="show_payment_modal('{{$affiliate_user->id}}');" title="{{ translate('Pay Now') }}">
<i class="las la-money-bill"></i>
</a>
@endcan
@can('affiliate_users_payment_history')
<a class="btn btn-soft-success btn-icon btn-circle btn-sm" href="{{route('affiliate_user.payment_history', encrypt($affiliate_user->id))}}" title="{{ translate('Payment History') }}">
<i class="las la-history"></i>
</a>
@endcan
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
<div class="aiz-pagination">
{{ $affiliate_users->appends(request()->input())->links() }}
</div>
</div>
</div>
@endsection
@section('modal')
@include('modals.delete_modal')
<div class="modal fade" id="payment_modal">
<div class="modal-dialog">
<div class="modal-content" id="modal-content">
</div>
</div>
</div>
@endsection
@section('script')
<script type="text/javascript">
function show_payment_modal(id){
$.post('{{ route('affiliate_user.payment_modal') }}',{_token:'{{ @csrf_token() }}', id:id}, function(data){
$('#payment_modal #modal-content').html(data);
$('#payment_modal').modal('show', {backdrop: 'static'});
AIZ.plugins.bootstrapSelect('refresh');
});
}
function update_approved(el){
if(el.checked){
var status = 1;
}
else{
var status = 0;
}
$.post('{{ route('affiliate_user.approved') }}', {_token:'{{ csrf_token() }}', id:el.value, status:status}, function(data){
if(data == 1){
AIZ.plugins.notify('success', '{{ translate('Approved sellers updated successfully') }}');
}
else{
AIZ.plugins.notify('danger', '{{ translate('Something went wrong') }}');
}
});
}
</script>
@endsection