diff --git a/app/Console/Commands/TestMessaging.php b/app/Console/Commands/TestMessaging.php index 3a86ee4b..81fd9558 100644 --- a/app/Console/Commands/TestMessaging.php +++ b/app/Console/Commands/TestMessaging.php @@ -3,10 +3,8 @@ namespace App\Console\Commands; use Exception; -use App\Models\UserDevice; use Illuminate\Console\Command; use App\Events\BudgetCalculated; -use App\Services\MessagingService; class TestMessaging extends Command { diff --git a/app/Domains/Automation/Services/LogerAutomationService.php b/app/Domains/Automation/Services/LogerAutomationService.php index 5b776e6c..84113e27 100644 --- a/app/Domains/Automation/Services/LogerAutomationService.php +++ b/app/Domains/Automation/Services/LogerAutomationService.php @@ -2,9 +2,11 @@ namespace App\Domains\Automation\Services; +use Google\Service\Gmail; use App\Domains\Integration\Actions\BHD; use App\Domains\Automation\Models\Automation; use App\Domains\Integration\Actions\BHDAlert; +use App\Domains\Transaction\Services\BHDService; use App\Domains\Automation\Models\AutomationTask; use App\Domains\Integration\Actions\OccurrenceAutomation; use App\Domains\Integration\Actions\TransactionCreateEntry; @@ -40,8 +42,8 @@ public static function run(Automation $automation, $eventData = null) public static function setupService($serviceId, $service) { $taskTypes = [ - 'triggers' => 'trigger', - 'components' => 'component', + 'triggers' => 'trigger', + 'components' => 'component', 'actions' => 'action' ]; foreach ($taskTypes as $taskTypeName => $taskType) { diff --git a/app/Domains/Budget/Models/Budget.php b/app/Domains/Budget/Models/Budget.php index a4acee42..13077708 100644 --- a/app/Domains/Budget/Models/Budget.php +++ b/app/Domains/Budget/Models/Budget.php @@ -2,8 +2,10 @@ namespace App\Domains\Budget\Models; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Insane\Journal\Models\Core\Account; +use App\Domains\AppCore\Models\Category; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Budget extends Model { diff --git a/app/Domains/Budget/Models/BudgetMonth.php b/app/Domains/Budget/Models/BudgetMonth.php index ca5ec6d9..53797432 100644 --- a/app/Domains/Budget/Models/BudgetMonth.php +++ b/app/Domains/Budget/Models/BudgetMonth.php @@ -9,11 +9,12 @@ use Insane\Journal\Models\Core\Account; use App\Domains\AppCore\Models\Category; use App\Domains\Budget\Data\BudgetReservedNames; +use App\Domains\Budget\Models\Traits\BudgetMonthTrait; use Illuminate\Database\Eloquent\Factories\HasFactory; class BudgetMonth extends Model { - use HasFactory; + use HasFactory, BudgetMonthTrait; protected $fillable = [ 'team_id', diff --git a/app/Domains/Budget/Models/Traits/BudgetMonthTrait.php b/app/Domains/Budget/Models/Traits/BudgetMonthTrait.php new file mode 100644 index 00000000..b4c6bbc3 --- /dev/null +++ b/app/Domains/Budget/Models/Traits/BudgetMonthTrait.php @@ -0,0 +1,101 @@ +where('budget_months.team_id', $teamId); + } + + + public function scopeInDateFrame($query, $startDate = null, $endDate = null, $orderByDate = true) + { + return $query + ->when($startDate && ! $endDate, function ($query) use ($startDate) { + $query->where('budget_months.month', '=', $startDate); + }) + ->when($startDate && $endDate, function ($query) use ($startDate, $endDate) { + $query->where('budget_months.month', '>=', $startDate); + $query->where('budget_months.month', '<=', $endDate); + }) + ->when($orderByDate, function ($query) { + $query->orderBy('budget_months.month', 'desc'); + }); + } + + public function scopeExpenses($query) + { + return $query->where([ + 'transactions.direction' => Transaction::DIRECTION_CREDIT, + 'transactions.status' => 'verified', + ]) + ->whereNotNull('budget_months.category_id'); + } + + public function scopeBalance($query) + { + $transactionsTotalSum = 'sum(budget_months.budgeted) as total_amount, group_concat(distinct(categories.name)) as cat_name'; + + return $query + ->whereNotNull('budget_months.category_id') + ->where('budget_months.budgeted', '<>', 0) + ->selectRaw($transactionsTotalSum); + } + + public function scopeForAccount($query, $accountId) + { + return $query->where(DB::raw("(account_id = $accountId)")); + } + + public function scopeCategories($query, array $categories) + { + return $query->whereIn('budget_months.category_id', $categories) + ->join('categories', 'budget_months.category_id', '=', 'categories.id') + ->when($categories, fn ($query) => $query->whereIn('budget_months.category_id', $categories)); + } + + public function scopeExpenseCategories($query, array $categories = null) + { + $query->whereNot('categories.name', BudgetReservedNames::READY_TO_ASSIGN->value) + ->join('categories', 'budget_months.category_id', '=', 'categories.id'); + + $categories = collect($categories); + $excluded = $categories->filter( fn ($id) => $id < 0)->all(); + $included = $categories->filter( fn ($id) => $id > 0)->all(); + + if (count($excluded)) { + $query->whereNotIn('budget_months.category_id', $excluded); + } + if (count($included)) { + $query->whereIn('budget_months.category_id', $included); + } + + return $query; + } + + public function scopeAllCategories($query, array $categories = null) + { + $query + ->whereNot('categories.name', BudgetReservedNames::READY_TO_ASSIGN->value) + ->join('categories', 'budget_months.category_id', '=', 'categories.id'); + + $categories = collect($categories); + $excluded = $categories->filter( fn ($id) => $id < 0)->all(); + $included = $categories->filter( fn ($id) => $id > 0)->all(); + + if (count($excluded)) { + $query->whereNotIn('budget_months.category_id', $excluded); + } + if (count($included)) { + $query->whereIn('budget_months.category_id', $included); + } + + return $query; + } +} diff --git a/app/Domains/Integration/Actions/GmailReceived.php b/app/Domains/Integration/Actions/GmailReceived.php index bcd1f0b9..c07f8650 100644 --- a/app/Domains/Integration/Actions/GmailReceived.php +++ b/app/Domains/Integration/Actions/GmailReceived.php @@ -25,7 +25,6 @@ public static function handle(Automation $automation, $lastData = null, $task = $config = json_decode($trigger->values); $client = GoogleService::getClient($automation->integration_id); $service = new ServiceGmail($client); - $notification = BHDService::EMAIL_NOTIFICATION; $condition = isset($config->conditionType) && $config->value ? "$config->conditionType:$config->value" : ''; if (! $condition) { $condition = $config->value ?? ''; @@ -35,6 +34,7 @@ public static function handle(Automation $automation, $lastData = null, $task = foreach ($results->getThreads() as $index => $thread) { $theadResponse = $service->users_threads->get('me', $thread->id, ['format' => 'MINIMAL']); foreach ($theadResponse->getMessages() as $message) { + if ($message && $message->getHistoryId() > $trackId) { $raw = $service->users_messages->get('me', $message->id, ['format' => 'raw']); $parser = self::parseEmail($raw); diff --git a/app/Domains/Integration/Actions/TransactionCreateEntry.php b/app/Domains/Integration/Actions/TransactionCreateEntry.php index d28f5ce6..6e111bdf 100644 --- a/app/Domains/Integration/Actions/TransactionCreateEntry.php +++ b/app/Domains/Integration/Actions/TransactionCreateEntry.php @@ -38,23 +38,28 @@ public static function handle( $counterAccountId = $payee->account_id; } + $description = FormulaHelper::parseFormula($taskData->description, $payload); + $transactionData = [ 'team_id' => $automation->team_id, 'user_id' => $automation->user_id, 'account_id' => $accountId, 'payee_id' => $payeeId, + 'payee_name' => $payee?->name, 'counter_account_id' => $counterAccountId ?? null, 'date' => FormulaHelper::parseFormula($taskData->date, $payload), 'currency_code' => FormulaHelper::parseFormula($taskData->currency_code, $payload), 'category_id' => $transactionCategoryId ?? null, - 'description' => FormulaHelper::parseFormula($taskData->description, $payload), + 'description' => $description, + 'reference' => $description, 'direction' => FormulaHelper::parseFormula($taskData->direction, $payload), 'total' => FormulaHelper::parseFormula($taskData->total, $payload), 'items' => [], - 'metaData' => [ + 'meta_data' => [ 'resource_id' => $payload['id'], 'resource_origin' => $previousTask->name, 'resource_type' => $trigger->name, + 'resource_description' => $description ], ]; @@ -72,6 +77,8 @@ public static function handle( return $transaction; } + print_r($transactionData); + $transaction = Transaction::createTransaction($transactionData); User::find($automation->user_id)->notify(new EntryGenerated($transaction)); diff --git a/app/Domains/Meal/Services/MealService.php b/app/Domains/Meal/Services/MealService.php index c406660d..68223942 100644 --- a/app/Domains/Meal/Services/MealService.php +++ b/app/Domains/Meal/Services/MealService.php @@ -6,7 +6,9 @@ use Illuminate\Support\Carbon; use App\Domains\Meal\Models\Meal; use App\Domains\Meal\Models\Product; +use Modules\Plan\Entities\PlanTypes; use App\Domains\Meal\Models\MealPlan; +use Modules\Plan\Services\PlanService; use App\Domains\AppCore\Models\Planner; class MealService @@ -125,4 +127,27 @@ public function addIngredientLabel(Product $product, mixed $postData, User $user return $label; } + + // shopping list + public function addToShoppingList($ingredients = []) + { + $planService = new PlanService(); + $user = request()->user(); + $team = request()->user()->currentTeam; + $shoppingList = $planService->getPlanTypeModel($team->id, PlanTypes::SHOPPING_LIST, request()); + if (!$shoppingList) { + $shoppingList = $planService->createPlanBoard($team, PlanTypes::SHOPPING_LIST, PlanTypes::SHOPPING_LIST->name); + } + + foreach ($ingredients as $ingredient) { + $shoppingList->addItem($user, [ + "title" => $ingredient["name"], + "board_id" => null, + "stage_id" => $shoppingList->stages->first()->id, + "fields" => [], + "order" => 1 + ]); + } + + } } diff --git a/app/Domains/Transaction/Services/ReportService.php b/app/Domains/Transaction/Services/ReportService.php index 3772a76c..044d7253 100644 --- a/app/Domains/Transaction/Services/ReportService.php +++ b/app/Domains/Transaction/Services/ReportService.php @@ -4,6 +4,7 @@ use Carbon\Carbon; use Illuminate\Support\Facades\DB; +use App\Domains\Budget\Models\BudgetMonth; use App\Domains\Transaction\Models\Transaction; use App\Domains\Transaction\Models\TransactionLine; @@ -57,6 +58,23 @@ public static function generateExpensesByPeriod($teamId, $startDate, $timeUnitDi }, $resultGroup)->sortBy('date'); } + public static function getAssignedByPeriod($teamId, $startDate, $timeUnitDiff = 2, $timeUnit = 'month', $categories = null) + { + $rangeEndAt = Carbon::createFromFormat('Y-m-d', $startDate)->endOfMonth()->format('Y-m-d'); + $rangeStartAt = Carbon::now()->subMonth($timeUnitDiff)->startOfMonth()->format('Y-m-d'); + + $results = self::getAssignedByCategoriesInPeriod($teamId, $rangeStartAt, $rangeEndAt, $categories); + $resultGroup = $results->groupBy('date'); + + return $resultGroup->map(function ($monthItems) { + return [ + 'date' => $monthItems->first()->date, + 'data' => $monthItems->sortByDesc('total_amount')->values(), + 'total' => $monthItems->sum('total_amount'), + ]; + }, $resultGroup)->sortBy('date'); + } + public static function getIncomeVsExpenses($teamId, $timeUnitDiff = 2, $startDate = null, $timeUnit = 'month') { $endDate = Carbon::now()->endOfMonth()->format('Y-m-d'); @@ -175,6 +193,30 @@ public static function getExpensesByCategoriesInPeriod($teamId, $startDate, $end return $cats; } + public static function getAssignedByCategoriesInPeriod($teamId, $startDate, $endDate, $categories = null) + { + $cats = BudgetMonth::byTeam($teamId) + ->balance() + ->inDateFrame($startDate, $endDate) + ->expenseCategories($categories) + ->selectRaw(" + date_format(budget_months.month, + '%Y-%m-01') as date, + date_format(budget_months.month, '%Y-%m-01') as month, + year(budget_months.month) as year, + categories.name, + categories.id, + budget_targets.target_type + " + ) + ->groupByRaw('date_format(budget_months.month, "%Y-%m"), categories.id') + ->orderBy('date') + ->leftJoin('budget_targets', 'budget_targets.category_id', 'categories.id') + ->get(); + + return $cats; + } + public static function getExpensesInPeriod($teamId, $startDate, $endDate) { return TransactionLine::byTeam($teamId) diff --git a/app/Http/Controllers/Finance/FinanceTrendController.php b/app/Http/Controllers/Finance/FinanceTrendController.php index 25936ab7..518b6e58 100644 --- a/app/Http/Controllers/Finance/FinanceTrendController.php +++ b/app/Http/Controllers/Finance/FinanceTrendController.php @@ -35,6 +35,9 @@ class FinanceTrendController extends Controller 'spending-year' => [ "handler" => 'spendingYear' ], + 'assigned-year' => [ + "handler" => 'assignedInYear' + ], 'income-expenses-graph' => [ "handler" => 'IncomeExpensesGraph' ], @@ -204,6 +207,31 @@ public function spendingYear() ]; } + public function assignedInYear() + { + $queryParams = request()->query(); + $filters = isset($queryParams['filter']) ? $queryParams['filter'] : []; + [$startDate] = $this->getFilterDates($filters); + $teamId = request()->user()->current_team_id; + $excludedAccounts = null; + if (isset($filters['category'])) { + $excludedAccounts = collect(explode(',', $filters['category']))->map(fn ($id) => "-$id")->all(); + } + + // dd(ReportService::generateExpensesByPeriod($teamId, $startDate, 12, 'month', $excludedAccounts), ReportService::getAssignedByPeriod($teamId, $startDate, 12, 'month', $excludedAccounts)); + + return [ + 'data' => ReportService::getAssignedByPeriod($teamId, $startDate, 12, 'month', $excludedAccounts), + 'metaData' => [ + 'name' => 'assignedYear', + 'title' => 'Assigned in year', + 'props' => [ + 'headerTemplate' => 'grid', + ], + ], + ]; + } + public function yearSummary() diff --git a/app/Http/Controllers/Meal/MealController.php b/app/Http/Controllers/Meal/MealController.php index 1ef639db..c814da43 100644 --- a/app/Http/Controllers/Meal/MealController.php +++ b/app/Http/Controllers/Meal/MealController.php @@ -2,15 +2,17 @@ namespace App\Http\Controllers\Meal; +use Illuminate\Http\Request; +use Illuminate\Support\Carbon; use App\Domains\Meal\Models\Meal; +use App\Http\Resources\MealResource; +use Modules\Plan\Entities\PlanTypes; use App\Domains\Meal\Models\MealType; +use Modules\Plan\Services\PlanService; +use Illuminate\Support\Facades\Redirect; use App\Domains\Meal\Services\MealService; -use App\Http\Resources\MealResource; use App\Http\Resources\PlannedMealResource; use Freesgen\Atmosphere\Http\InertiaController; -use Illuminate\Http\Request; -use Illuminate\Support\Carbon; -use Illuminate\Support\Facades\Redirect; class MealController extends InertiaController { @@ -21,6 +23,7 @@ public function __construct(Meal $meal, private MealService $mealService) 'index' => 'Meals/Index', 'create' => 'Meals/Create', 'edit' => 'Meals/Create', + 'view' => 'Meals/View', ]; $this->searchable = ['name']; $this->validationRules = [ @@ -32,7 +35,7 @@ public function __construct(Meal $meal, private MealService $mealService) ]; } - public function __invoke() + public function __invoke(PlanService $service) { $request = request(); $startDate = $request->query('startDate', Carbon::now()->startOfMonth()->format('Y-m-d')); @@ -51,10 +54,11 @@ public function __invoke() return MealService::getIngredients($weekPlan); }, 'mealTypes' => MealType::where([ - 'team_id' => $request->user()->current_team_id, - 'user_id' => $request->user()->current_team_id, + 'team_id' => $teamId, + 'user_id' => $request->user()->id, ])->get(), 'meals' => PlannedMealResource::collection($plannedMeals), + 'shoppingList' => $service->getPlanType($teamId, PlanTypes::SHOPPING_LIST, request()) ]); } @@ -96,4 +100,8 @@ public function random(Request $request) return count($meals) ? $meals->random() : 'Noting to show'; } + + public function show(Request $request, int $id) { + return inertia($this->templates['view'], $this->getEditProps($request, $id)); + } } diff --git a/app/Http/Controllers/Meal/MealShoppingListController.php b/app/Http/Controllers/Meal/MealShoppingListController.php new file mode 100644 index 00000000..b77b0b8e --- /dev/null +++ b/app/Http/Controllers/Meal/MealShoppingListController.php @@ -0,0 +1,34 @@ +user(); + + return inertia('Meals/ShoppingList', [ + 'chores' => [$service->getPlanType($user->current_team_id, PlanTypes::SHOPPING_LIST, request())] + ]); + } + + public function store(Meal $meal) + { + $this->mealService->addToShoppingList($meal->ingredients->toArray()); + return Redirect::back(); + } + + public function update() { + $items = request()->post('items'); + $this->mealService->addToShoppingList($items); + } +} diff --git a/app/Http/Controllers/System/NotificationController.php b/app/Http/Controllers/System/NotificationController.php index b78b9f09..2b0ca555 100644 --- a/app/Http/Controllers/System/NotificationController.php +++ b/app/Http/Controllers/System/NotificationController.php @@ -1,9 +1,6 @@ unreadNotifications()->where('id', $notificationId)->update(['read_at' => now()]); } - public function bulkUpdate($notificationId) + public function bulkUpdate() { $user = request()->user(); $user->unreadNotifications()->update(['read_at' => now()]); diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index 26911fe6..8b60f311 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -6,6 +6,7 @@ use Tightenco\Ziggy\Ziggy; use Illuminate\Http\Request; use App\Concerns\Facades\Menu; +use Nwidart\Modules\Facades\Module; use Insane\Journal\Models\Core\Account; use App\Domains\AppCore\Models\Category; use Insane\Journal\Models\Core\AccountDetailType; diff --git a/app/Listeners/CreateBudgetTransactionMovement.php b/app/Listeners/CreateBudgetTransactionMovement.php index 4cebd03c..e37fef5f 100644 --- a/app/Listeners/CreateBudgetTransactionMovement.php +++ b/app/Listeners/CreateBudgetTransactionMovement.php @@ -3,7 +3,9 @@ namespace App\Listeners; use Illuminate\Contracts\Queue\ShouldQueue; +use Insane\Journal\Events\TransactionEvent; use Insane\Journal\Events\TransactionCreated; +use Insane\Journal\Events\TransactionUpdated; use App\Domains\Budget\Services\BudgetCategoryService; class CreateBudgetTransactionMovement implements ShouldQueue @@ -12,7 +14,7 @@ public function __construct(private BudgetCategoryService $budgetCategoryService { } - public function handle(TransactionCreated $event) + public function handle(TransactionCreated|TransactionUpdated $event) { $transaction = $event->transaction; $account = $transaction->account; diff --git a/app/Listeners/HandleTransactionCreated.php b/app/Listeners/HandleTransactionCreated.php index 154f8d88..0d349f6c 100644 --- a/app/Listeners/HandleTransactionCreated.php +++ b/app/Listeners/HandleTransactionCreated.php @@ -2,16 +2,17 @@ namespace App\Listeners; -use App\Domains\Automation\Services\LogerAutomationService; use App\Events\AutomationEvent; use Illuminate\Contracts\Queue\ShouldQueue; -use Insane\Journal\Events\TransactionCreated; +use Insane\Journal\Events\TransactionEvent; +use App\Domains\Automation\Services\LogerAutomationService; class HandleTransactionCreated implements ShouldQueue { - public function handle(TransactionCreated $event) + public function handle(TransactionEvent $event) { $transaction = $event->transaction; + AutomationEvent::dispatch( $transaction->team_id, LogerAutomationService::TRANSACTION_CREATED, diff --git a/app/Listeners/HandleTransactionUpdated.php b/app/Listeners/HandleTransactionUpdated.php new file mode 100644 index 00000000..be3720e6 --- /dev/null +++ b/app/Listeners/HandleTransactionUpdated.php @@ -0,0 +1,45 @@ +transaction; + $transactionData = $event->transactionData; + + $labelId = $transactionData["label_id"] ?? null; + $isNewLabel = Str::contains($labelId, "new::"); + $newLabelData = [ + "user_id" => $transaction->user_id, + "team_id" => $transaction->team_id, + ]; + + if (!isset($transactionData["label_id"]) && $transactionData["counter_account_id"]) { + $label = Label::firstOrCreate([ + ...$newLabelData, + "name" => $transactionData["label_name"], + "labelable_type" => TransactionLine::class + ]); + $labelId = $label->id; + } else if ($labelId == 'new' || $isNewLabel) { + $labelName = $transactionData['label_name'] ?? trim(Str::replace('new::', '', $transactionData["label_id"])) ?? null; + if ($labelName) { + $label = Label::firstOrCreate([ + ...$newLabelData, + "name" => $labelName, + "labelable_type" => TransactionLine::class + ]); + $labelId = $label->id; + $transactionData["label_id"] = $labelId; + } + } + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 95db0d81..f8f65c5d 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -22,6 +22,7 @@ use Laravel\Jetstream\Events\TeamCreated; use Laravel\Jetstream\Events\TeamDeleted; use App\Listeners\HandleTransactionCreated; +use App\Listeners\HandleTransactionUpdated; use App\Listeners\CreateOccurrenceAutomation; use Insane\Journal\Events\TransactionCreated; use Insane\Journal\Events\TransactionDeleted; diff --git a/database/migrations/2022_07_23_223710_create_labeelable_table.php b/database/migrations/2022_07_23_223710_create_labeelable_table.php index 9a4ba0d3..8d3ebc36 100644 --- a/database/migrations/2022_07_23_223710_create_labeelable_table.php +++ b/database/migrations/2022_07_23_223710_create_labeelable_table.php @@ -1,8 +1,8 @@ foreignId('category_id')->nullable()->after('meal_type_id'); + $table->integer('prep_minutes')->default(0); + $table->integer('cook_minutes')->default(0); + $table->integer('servings')->default(0); + $table->integer('rating')->default(0); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + // + } +}; diff --git a/modules_statuses.json b/modules_statuses.json index 9787c459..6328ee55 100644 --- a/modules_statuses.json +++ b/modules_statuses.json @@ -1,4 +1,4 @@ { "Watchlist": true, "Plan": true -} \ No newline at end of file +} diff --git a/resources/js/Components/WidgetContainer.vue b/resources/js/Components/WidgetContainer.vue index d03920f4..637cbb23 100644 --- a/resources/js/Components/WidgetContainer.vue +++ b/resources/js/Components/WidgetContainer.vue @@ -123,6 +123,9 @@ const { isTab: isCurrentTab, selectedTab, tabs: widgetTabs } = useTabs( /> + diff --git a/resources/js/Components/atoms/CustomTable.vue b/resources/js/Components/atoms/CustomTable.vue index 1e04dac5..944a175b 100644 --- a/resources/js/Components/atoms/CustomTable.vue +++ b/resources/js/Components/atoms/CustomTable.vue @@ -43,9 +43,16 @@ const range = computed(() => { > - - {{ col.label }} - + + + {{ col.label }} + + diff --git a/resources/js/Components/atoms/Modal.vue b/resources/js/Components/atoms/Modal.vue index 5ccad36e..1b14cada 100644 --- a/resources/js/Components/atoms/Modal.vue +++ b/resources/js/Components/atoms/Modal.vue @@ -56,6 +56,7 @@ const maxWidthClass = computed(() => { 'lg': 'sm:max-w-lg', 'xl': 'sm:max-w-xl', '2xl': 'sm:max-w-2xl', + '4xl': 'sm:max-w-4xl', 'mobile': 'w-full', }[props.maxWidth || '2xl'] }) @@ -67,6 +68,7 @@ const containerClass = computed(() => { 'lg': 'px-4 py-6', 'xl': 'px-4 py-6', '2xl': 'px-4 py-6', + '4xl': 'px-4 py-6', 'mobile': 'w-full', }[props.maxWidth || '2xl'] }) diff --git a/resources/js/Components/board/BoardSection.vue b/resources/js/Components/board/BoardSection.vue index 240e1e2e..ce1f02d7 100644 --- a/resources/js/Components/board/BoardSection.vue +++ b/resources/js/Components/board/BoardSection.vue @@ -10,32 +10,24 @@ import { router } from "@inertiajs/vue3"; import { onMounted, provide, computed, watch, reactive, ref, toRefs } from "vue"; import BoardTitle from "./BoardTitle.vue"; -const props = defineProps({ - board: { - type: Object, - required: true - }, - automations: { - type: Array, - required: true - }, - users: { - type: Array, - required: true - }, - filters: { - type: Object, - default() { - return { - search: '', - done: '', - sort: '' - } - } - } +const emit = defineEmits(['search']) +const props = withDefaults(defineProps<{ + board: Object; + automations: boolean; + users: any[]; + filters: Record + multiStage: boolean; + resourceName: string; +}>(), { + filters: () => ({ + search: '', + done: '', + sort: '' + }) }); provide('users', props.users); + const views = { list:{ name: "list", @@ -76,10 +68,9 @@ const state = reactive({ watch(state.searchOptions, throttle(() => { let query = pickBy(state.searchOptions); query = Object.keys(query).length ? '?' + new URLSearchParams(pickBy(state.searchOptions)) : ''; - // router.replace(`/boards/${props.board.id}${query}`) + emit('search', query) }, 200),{ deep: true, - immediate: true }); const containerComponent = computed(() => { @@ -167,7 +158,7 @@ function addItem(item: Record, stage: Record, re isLoading.value = true; item.order = stage.items.length; - + axios({ url: `/housing/plans/${props.board.id}/items${param}`, method, @@ -323,7 +314,7 @@ const { isItemModalOpen } = toRefs(state) - + - - + +