Skip to content

Commit

Permalink
feat: update trade seeking additions, fix custom selectize rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ScuffedNewt committed Jan 3, 2025
1 parent 46c0054 commit 0956523
Show file tree
Hide file tree
Showing 39 changed files with 765 additions and 421 deletions.
4 changes: 2 additions & 2 deletions app/Helpers/AssetHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ function getAssetKeys($isCharacter = false) {
*/
function getAssetModelString($type, $namespaced = true) {
switch ($type) {
case 'items':
case 'items': case 'item':
if ($namespaced) {
return '\App\Models\Item\Item';
} else {
return 'Item';
}
break;

case 'currencies':
case 'currencies': case 'currency':
if ($namespaced) {
return '\App\Models\Currency\Currency';
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Admin/Characters/CharacterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
use App\Models\Rarity;
use App\Models\Species\Species;
use App\Models\Species\Subtype;
use App\Models\Trade;
use App\Models\Trade\Trade;
use App\Models\User\User;
use App\Services\CharacterManager;
use App\Services\TradeManager;
use App\Services\Trade\TradeManager;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use App\Models\Gallery\GallerySubmission;
use App\Models\Report\Report;
use App\Models\Submission\Submission;
use App\Models\Trade;
use App\Models\Trade\Trade;
use App\Models\User\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/Users/GrantController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use App\Models\Currency\Currency;
use App\Models\Item\Item;
use App\Models\Submission\Submission;
use App\Models\Trade;
use App\Models\Trade\Trade;
use App\Models\User\User;
use App\Models\User\UserItem;
use App\Services\CurrencyManager;
Expand Down
11 changes: 10 additions & 1 deletion app/Http/Controllers/Characters/DesignController.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,21 @@ public function getAddons($id) {
$inventory = isset($r->data['user']) ? parseAssetData($r->data['user']) : null;
}

$item_filter = Item::orderBy('name')->get()->mapWithKeys(function ($item) {
return [
$item->id => json_encode([
'name' => $item->name,
'image_url' => $item->image_url,
]),
];
});

return view('character.design.addons', [
'request' => $r,
'categories' => ItemCategory::visible(Auth::user() ?? null)->orderBy('sort', 'DESC')->get(),
'inventory' => $inventory,
'items' => Item::all()->keyBy('id'),
'item_filter' => Item::orderBy('name')->get()->keyBy('id'),
'item_filter' => $item_filter,
'page' => 'update',
]);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Comments/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use App\Models\Sales\Sales;
use App\Models\SitePage;
use App\Models\User\User;
use App\Models\TradeListing;
use App\Models\Trade\TradeListing;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
Expand Down Expand Up @@ -131,7 +131,7 @@ public function store(Request $request, $model, $id) {
$post = 'your site page';
$link = $page->url.'/#comment-'.$comment->getKey();
break;
case 'App\Models\TradeListing':
case 'App\Models\Trade\TradeListing':
$listing = TradeListing::find($comment->commentable_id);
$recipient = $listing->user;
$post = 'your trade listing';
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Users/InventoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use App\Models\Item\ItemCategory;
use App\Models\Rarity;
use App\Models\Submission\Submission;
use App\Models\Trade;
use App\Models\Trade\Trade;
use App\Models\User\User;
use App\Models\User\UserItem;
use App\Services\InventoryManager;
Expand Down
44 changes: 40 additions & 4 deletions app/Http/Controllers/Users/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ public function getNewSubmission(Request $request) {
$gallerySubmissions = [];
}

$item_filter = Item::released()->orderBy('name')->get()->mapWithKeys(function ($item) {
return [
$item->id => json_encode([
'name' => $item->name,
'image_url' => $item->image_url,
]),
];
});

return view('home.create_submission', [
'closed' => $closed,
'isClaim' => false,
Expand All @@ -108,7 +117,7 @@ public function getNewSubmission(Request $request) {
'prompts' => Prompt::active()->sortAlphabetical()->pluck('name', 'id')->toArray(),
'characterCurrencies' => Currency::where('is_character_owned', 1)->orderBy('sort_character', 'DESC')->pluck('name', 'id'),
'categories' => ItemCategory::visible(Auth::user() ?? null)->orderBy('sort', 'DESC')->get(),
'item_filter' => Item::orderBy('name')->released()->get()->keyBy('id'),
'item_filter' => $item_filter,
'items' => Item::orderBy('name')->released()->pluck('name', 'id'),
'character_items' => Item::whereIn('item_category_id', ItemCategory::where('is_character_owned', 1)->pluck('id')->toArray())->orderBy('name')->released()->pluck('name', 'id'),
'currencies' => Currency::where('is_user_owned', 1)->orderBy('name')->pluck('name', 'id'),
Expand Down Expand Up @@ -143,6 +152,15 @@ public function getEditSubmission(Request $request, $id) {
$gallerySubmissions = [];
}

$item_filter = Item::released()->orderBy('name')->get()->mapWithKeys(function ($item) {
return [
$item->id => json_encode([
'name' => $item->name,
'image_url' => $item->image_url,
]),
];
});

return view('home.edit_submission', [
'closed' => $closed,
'isClaim' => false,
Expand All @@ -151,7 +169,7 @@ public function getEditSubmission(Request $request, $id) {
'prompts' => Prompt::active()->sortAlphabetical()->pluck('name', 'id')->toArray(),
'characterCurrencies' => Currency::where('is_character_owned', 1)->orderBy('sort_character', 'DESC')->pluck('name', 'id'),
'categories' => ItemCategory::orderBy('sort', 'DESC')->get(),
'item_filter' => Item::orderBy('name')->released()->get()->keyBy('id'),
'item_filter' => $item_filter,
'items' => Item::orderBy('name')->released()->pluck('name', 'id'),
'character_items' => Item::whereIn('item_category_id', ItemCategory::where('is_character_owned', 1)->pluck('id')->toArray())->orderBy('name')->released()->pluck('name', 'id'),
'currencies' => Currency::where('is_user_owned', 1)->orderBy('name')->pluck('name', 'id'),
Expand Down Expand Up @@ -392,6 +410,15 @@ public function getNewClaim(Request $request) {
$closed = !Settings::get('is_claims_open');
$inventory = UserItem::with('item')->whereNull('deleted_at')->where('count', '>', '0')->where('user_id', Auth::user()->id)->get();

$item_filter = Item::released()->orderBy('name')->get()->mapWithKeys(function ($item) {
return [
$item->id => json_encode([
'name' => $item->name,
'image_url' => $item->image_url,
]),
];
});

return view('home.create_submission', [
'closed' => $closed,
'isClaim' => true,
Expand All @@ -400,7 +427,7 @@ public function getNewClaim(Request $request) {
'characterCurrencies' => Currency::where('is_character_owned', 1)->orderBy('sort_character', 'DESC')->pluck('name', 'id'),
'categories' => ItemCategory::visible(Auth::user() ?? null)->orderBy('sort', 'DESC')->get(),
'inventory' => $inventory,
'item_filter' => Item::orderBy('name')->released()->get()->keyBy('id'),
'item_filter' => $item_filter,
'items' => Item::orderBy('name')->released()->pluck('name', 'id'),
'currencies' => Currency::where('is_user_owned', 1)->orderBy('name')->pluck('name', 'id'),
'raffles' => Raffle::where('rolled_at', null)->where('is_active', 1)->orderBy('name')->pluck('name', 'id'),
Expand All @@ -425,6 +452,15 @@ public function getEditClaim(Request $request, $id) {
abort(404);
}

$item_filter = Item::released()->orderBy('name')->get()->mapWithKeys(function ($item) {
return [
$item->id => json_encode([
'name' => $item->name,
'image_url' => $item->image_url,
]),
];
});

return view('home.edit_submission', [
'closed' => $closed,
'isClaim' => true,
Expand All @@ -434,7 +470,7 @@ public function getEditClaim(Request $request, $id) {
'character_items' => Item::whereIn('item_category_id', ItemCategory::where('is_character_owned', 1)->pluck('id')->toArray())->orderBy('name')->released()->pluck('name', 'id'),
'categories' => ItemCategory::orderBy('sort', 'DESC')->get(),
'currencies' => Currency::where('is_user_owned', 1)->orderBy('name')->pluck('name', 'id'),
'item_filter' => Item::orderBy('name')->released()->get()->keyBy('id'),
'item_filter' => $item_filter,
'items' => Item::orderBy('name')->released()->pluck('name', 'id'),
'inventory' => $inventory,
'raffles' => Raffle::where('rolled_at', null)->where('is_active', 1)->orderBy('name')->pluck('name', 'id'),
Expand Down
Loading

0 comments on commit 0956523

Please sign in to comment.