Skip to content

Commit

Permalink
Merge latest work into tvi (#81)
Browse files Browse the repository at this point in the history
* FileManager - Only show tenant bucket

* WIP - Lang

* WIP - Lang latest

* Initial Zora implementation
- Add some sample translations to use as a base

* WIP latest translations

* Updated readme

* WIP - Lang latest changes

* Translations

* WIP - translations + new course page

* WIP - new translations + changed website course page

* WIP latest with FAQ

* Show refund message + footer component

* feat: Implement BE that allows for CMS pages to be created with course(s) attached

* Added auth translations

* WIP - New footer changes for landing page

* WIP - Remove unnecessary route

* Logic for Email to sign up after purchase

* feat(course-template-fe): Add FE for course pages

* feat(course-template-fe): Add FE for course pages

* Changes to landing page

* Clean up

* Fix for organisation unit creator

* Fix for organisation units edit

* Fix for side menu icon

* Implement organisation unit cms field

* Org updates
- Add snap and tiktok
- Fix email required
- Update twitter/x label

* Org updates
- Add snap and tiktok
- Fix email required
- Update twitter/x label

* Add page-meta to page show and course template

* Latest

* remove unused import

* Add keywords metadata

* WIP

* Show section files in all lectures for student

* Implement theme settings

- Add new color vars to support theming
- Add UI/UX to set colours in admin
- Update Course FE components to use theme

* Yarn prod & zora generate

* Implement repeater functionality into faqs section

- Fix repeater CMS selector
- Ensure course template uses the repeater data

* Updates for course show template

* Updates for course show template

* yarn prod

* yarn prod

* yarn prod

* yarn prod

* yarn prod

* yarn prod

* yarn prod

* yarn prod

* Commit

* Commit

* Allow super users to manually create student accounts

* ignition in core deps

* ignition in core deps

* Composer

* Composer

* Updated img links

* Basic Page/Layout FE

* Basic Page/Layout FE

* yarn prod

* Fixes

* Remove unused script

* Latest changes and text next to video

* Translations

* Adjustments to payments

* VAT message for Lei

* Add settings to landlord

* UX changes to footer and improvements

* Clean up

* UX changes

* Fixes and improv

* Only load theme for tenants

* Only load theme for tenants

* Handle the redemption/mail outside of commit to ensure data persists

* Implement GTM support

- Add Setting for GTM ID
- Refactor head to allow for tenant head data to be set, including GTM script
- Add dataLayer.push event for navigation

* Implement filter to hide decimals for whole numbers

* Add logic for ignoring stripe events

* Ensure only active pages are shown on the website

* Migrate from Laravel Mix to Vite (#72)

* Add npm dependencies

* Update build scripts

* Configure Vite

* Remove `webpack.mix.js`

* Use ES modules

* Rename ENV variables

* Add PostCSS configuration for Tailwind

* Use new `@vite` Blade directive

* Add `.vue` extension to Vue imports

* Ignore build assets

* PostCSS Setup

---------

Co-authored-by: Shift <[email protected]>

* Implement CMS Redirects (#73)

* Fix for dayjs locale (#74)

Fix for landlord web middleware
Add inertia head
Fix inertia versioning
Bump inertia php version

* Add form column for submit button text

* Refactor course components to sit within website/course/

* yarb prod

* yarn prod

* refactor course components

* Implement course interest form for non-published courses (#75)

* Small changes and improvements

* Call to Action section

* Latest

* Changes to UX + wip animations

* minor chore: Style cleanups (#79)

* minor chore: Style cleanups

- Remove styles from base / create anime.css
- Remove usages of style=""
- Add in missing en translations

* yarn prod

* Ignore Stripe Checkout Session Expired requests.

* Fix tenant scheduled commands

* Test commit for scheduled commandfs

* Test commit for scheduled commands

* Prod commit to enable scheduled jobs

* Changes for logo and small impro

* WIP

* Yt field on org unit

* WIP

* Student video show updates

* Add GTM dataLayer push on course purchase (#83)

* Fix vue-cookie issue (#84)

* - Allow '/' for page URLs
- Allow non-'/' urls for redirect to's

* - Allow '/' for page URLs
- Allow non-'/' urls for redirect to's

* - Revert slugify changes - was working as expected
- Refactor sticky-menu css

* - Revert slugify changes - was working as expected
- Refactor sticky-menu css

* Email updates

* Fix

* Fix

* Fix

* Fix

* Locale for checkout

* Multiple updates for live:
- Sort purchases by newest first
- Student admin FE=
- Student course - show latest incomplete course when loading the page
- Minimise toggled sections on mobile by default

* Add date to purchases
Remove hard coded redirect from home page

* Fix course purchase date

* Template update

* Template update

* Quick changes + yarn prod

* Revert format change

* Fixed conflict

* Add third party mailer setting and config bootstrapper (#86)

* Add third party mailer setting and config bootstrapper

* Tenancy bootstrapper fix

* Fixes

* Updates with test mail and correct config handling

* Add comment

* Yarn prod

* Yarn prod

* Yarn prod

* Add internal notifications for form submissions (#80)

* WIP commit for initial notificaiton email and preview

* Send internal mail notification on form submission

* Remove hard coded "Minducate" reference in mails (#89)

- Implement helper to allow us to us the theme to get the tenant_name as needed

* yarn prod

* Add domain to tenant store action

* Add xdebug support

* Add dignostics route

* Fix tenant migrations running on artisan migrate

* Initial fix for tests (#90)

- Tests still take too long to run per test but can at least test!

* Fix EDU summary length check causing error when no summary is set

* Removed unwanted sign up button

* Yarn prod

---------

Co-authored-by: dorusomcutean <[email protected]>
Co-authored-by: dorusomcutean <[email protected]>
Co-authored-by: Shift <[email protected]>
  • Loading branch information
4 people authored Apr 30, 2024
1 parent ee58ef8 commit 1e6d21a
Show file tree
Hide file tree
Showing 491 changed files with 11,643 additions and 5,893 deletions.
73 changes: 73 additions & 0 deletions .documentation/faqs/adding-new-tabler-icons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Adding new tabler icons

The default icon set for this project is [TablerIcons](https://tablericons.com).

They should all be stored inside `./resources/js/components/core/icons/Icon{IconName}.vue`
as this will allow them to be automatically imported and usable within the application via `<icon-icon-name />`.

## Step by step

1. Find the icon you want to use on [TablerIcons](https://tablericons.com)
2. Click it to copy the SVG
1. Make note of the name e.g. `arrows-shuffle`
3. Copy an existing icon, using pascal case prefixed with `Icon` e.g. `IconArrowsShuffle.vue`
1. Alternatively use the icon template below
4. Inside the existing `<svg>` tag, paste the copied SVG
5. Remove the opening and closing `<svg ...>` that were pasted, so only the outer tag remains
6. Update the name to the pascal case icon name e.g. `IconArrowsShuffle`
7. Use the icon wherever needed via kebab case e.g. `<icon-arrows-shuffle />`

The resulting vue file should look similar to the following:
```vue
<template>
<!-- Part of the tabler icon set: https://github.com/tabler/tabler-icons -->
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M18 4l3 3l-3 3" />
<path d="M18 20l3 -3l-3 -3" />
<path d="M3 7h3a5 5 0 0 1 5 5a5 5 0 0 0 5 5h5" />
<path d="M21 7h-5a4.978 4.978 0 0 0 -3 1m-4 8a4.984 4.984 0 0 1 -3 1h-3" />
</svg>
</template>
<script>
export default {
name: "IconArrowsShuffle",
}
</script>
```

## Icon Template
```vue
<template>
<!-- Part of the tabler icon set: https://github.com/tabler/tabler-icons -->
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="2"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
</svg>
</template>
<script>
export default {
name: "IconArrowsShuffle",
}
</script>
```
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

# Whether a user can register themselves on the app
AUTH_USER_REGISTER=false
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,24 @@ So the process is inline with the package's documentation.
./vendor/bin/sail artisan make:settings SettingsName --group=groupName --path=App/Models/Settings/
```
1. Add the settings properties to the class
2. Create the settings migration
2. Create the settings migration (note: the path is important here)
```bash
./vendor/bin/sail artisan make:settings-migration CreateSettingsName
./vendor/bin/sail artisan make:settings-migration CreateSettingsName database/migrations/tenant
```
1. Add the settings to the migration
3. Add the settings class to the `config.settings.settings` config file

### Preparing for production

1. Generate the JS translation files (if any have been added/updated)
```bash
./vendor/bin/sail artisan zora:generate
```
2. Production-ify JS/CSS
```bash
./vendor/bin/sail artisan yarn prod
```


---------

Expand Down
18 changes: 17 additions & 1 deletion app/Actions/CMS/Page/PageQueryAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PageQueryAction extends AbstractQueryAction
protected function addCustomSearchOptions()
{
if (Arr::get($this->search_options, 'page_url')) {
$this->query->whereHas('url', function ($query) {
$this->query->whereHas('url', function (Builder $query) {
$url = Arr::get($this->search_options, 'page_url');
if (!Str::startsWith($url, '/')) {
$url = '/' . $url;
Expand All @@ -36,6 +36,22 @@ protected function addCustomSearchOptions()
$query->where('url_full', $url);
});
}

if (Arr::get($this->search_options, 'is_active')) {
$this->query->whereHas('url', function (Builder $query) {
$query->where('is_enabled', 1);

$query->where(function (Builder $subQ) {
$subQ->whereNull('published_at')
->orWhere('published_at', '<=', now());
});
$query->where(function (Builder $subQ) {
$subQ->whereNull('expired_at')
->orWhere('expired_at', '>=', now());
});

});
}
}

protected function addOrderOptions()
Expand Down
31 changes: 31 additions & 0 deletions app/Actions/CMS/Redirect/RedirectQueryAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Actions\CMS\Redirect;

use App\Actions\AbstractQueryAction;
use App\Models\CMS\Redirect;
use App\Models\CMS\Template;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

class RedirectQueryAction extends AbstractQueryAction
{
protected array $searchable_fields_equals = [
'is_enabled' => 'redirect_is_enabled',
'is_permanent' => 'redirect_is_permanent'
];

protected array $searchable_fields_likes = [
'url_from' => 'redirect_url_from',
'url_to' => 'redirect_url_to',
];

protected string $order_by = 'url_from';


protected function getQueryBuilder(): Builder
{
return Redirect::query();
}
}
14 changes: 14 additions & 0 deletions app/Actions/CMS/Redirect/RedirectStoreAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Actions\CMS\Redirect;


use App\Models\CMS\Redirect;

class RedirectStoreAction
{
public function handle(array $redirect_data): Redirect
{
return Redirect::create($redirect_data);
}
}
19 changes: 19 additions & 0 deletions app/Actions/CMS/Redirect/RedirectUpdateAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Actions\CMS\Redirect;

use App\Models\CMS\Redirect;

class RedirectUpdateAction
{
public function handle(Redirect $redirect, array $redirect_data, bool $refresh = false): Redirect
{
$redirect->update($redirect_data);

if ($refresh) {
$redirect->refresh();
}

return $redirect;
}
}
21 changes: 18 additions & 3 deletions app/Actions/CRM/FormSubmission/FormSubmissionStoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
namespace App\Actions\CRM\FormSubmission;

use App\Interfaces\CRM\FormFieldInterface;
use App\Mail\CRM\Form\FormSubmittedInternal;
use App\Models\CRM\Contact;
use App\Models\CRM\Form;
use App\Models\CRM\FormSubmission;
use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use Illuminate\Validation\ValidationException;

class FormSubmissionStoreAction
Expand All @@ -29,8 +31,8 @@ public function handle(Form $form, array $submissionData) : FormSubmission
$this->form = $form;
$this->submissionData = app(ValidateFormSubmissionDataAction::class)->handle($form, $submissionData);

if (!$form->relationLoaded('formFields')) {
$form->load('formFields');
if (!$this->form->relationLoaded('formFields')) {
$this->form->load('formFields');
}

try {
Expand All @@ -44,6 +46,8 @@ public function handle(Form $form, array $submissionData) : FormSubmission
'form_id' => $this->form->id,
]);

$this->sendSubmissionNotification($formSubmission);

DB::commit();

return $formSubmission;
Expand Down Expand Up @@ -104,4 +108,15 @@ protected function getCrmContactData() : array

return $crmData;
}
}

protected function sendSubmissionNotification(FormSubmission $formSubmission): void
{
// TODO: We may want to move to dispatching events going forward
if (! $this->form->hasEmailRecipients()) {
return;
}

Mail::to($this->form->email_recipients)
->send(new FormSubmittedInternal($formSubmission));
}
}
2 changes: 2 additions & 0 deletions app/Actions/EDU/Course/Purchase/CoursePurchaseQueryAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class CoursePurchaseQueryAction extends AbstractQueryAction

protected string $order_by = 'id';

protected string $order_direction = 'desc';

protected function getQueryBuilder(): Builder
{
return CoursePurchase::query();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Actions\EDU\Course\Purchase;

use App\Interfaces\EDU\Course\CoursePurchaseInterface;
use App\Models\EDU\Course\CoursePurchase;
use App\Models\User;

Expand All @@ -12,11 +13,11 @@ public function handle(User $user)
// Set the user id for any existing purchases with the user's email
CoursePurchase::whereNull('user_id')
->where('email_address', $user->email)
->update(['user_id', $user->id]);
->update(['user_id' => $user->id]);

// Attach purchased courses to the user
$user->coursePurchases()
->where('payment_status', 'PAID')
->whereIn('status', [CoursePurchaseInterface::PAYMENT_STATUS_PAID, CoursePurchaseInterface::PAYMENT_STATUS_PARTIALLY_PAID])
->whereNull('redeemed_at')
->get()->each(function (CoursePurchase $purchase) use ($user) {
$purchase->redeem($user);
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/EDU/Course/Student/StudentCourseShowAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public function handle(Course $course)
$course->load([
'sections',
'sections.webinars',
'sections.files',
'webinars',
'creator',
'labels',
'programme',
]);

Expand Down
13 changes: 12 additions & 1 deletion app/Actions/FileManager/FileManagerFileStoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


use App\Models\EDU\Lecture\LectureFiles;
use App\Models\EDU\Section\SectionFiles;
use Carbon\Carbon;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
Expand Down Expand Up @@ -44,7 +45,17 @@ public function handle(string $directory, UploadedFile $file, $request)
$lectureFiles->save();
}

return $file->storeAs($directory, $filename, $this->storage_disk);;
if ($request->has('section')) {
$sectionFiles = new SectionFiles();
$sectionFiles->fill([
'section_id' => $request->input('section'),
'file_path' => $directory . $filename,
'file_name' => $filename,
]);
$sectionFiles->save();
}

return $file->storeAs($directory, $filename, $this->storage_disk);
}

/**
Expand Down
13 changes: 11 additions & 2 deletions app/Actions/Landlord/Tenant/TenantStoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@

class TenantStoreAction
{
public function handle(array $tenant_data) : Tenant
public function handle(array $tenant_data, ?string $domain = null): Tenant
{
return Tenant::create([
/** @var Tenant $tenant */
$tenant = Tenant::create([
'id' => $tenant_data['id']
]);

if ($domain) {
$tenant->domains()->create([
'domain' => $domain
]);
}

return $tenant;
}
}
26 changes: 26 additions & 0 deletions app/Actions/Setting/MailerSettingTestAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Actions\Setting;

use App\Http\Requests\AdminApi\Setting\MailerSettingTestRequest;
use App\Mail\Setting\MailerTest;
use App\Traits\Base\ManagesTenancyMailer;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Mail;

class MailerSettingTestAction
{
use ManagesTenancyMailer;

public function handle(MailerSettingTestRequest $request): void
{
$mailerSettings = Arr::except($request->validated(), 'recipient');

$this->setMailConfigForTenant(tenant(), $mailerSettings);

Mail::to($request->get('recipient'))
->send(new MailerTest($mailerSettings));

$this->setMailConfigDefaults();
}
}
3 changes: 3 additions & 0 deletions app/Actions/Setting/SettingUpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\Settings\CoreSettings;
use App\Models\Settings\EduSettings;
use App\Models\Settings\ThemeSettings;
use App\Models\Settings\ThirdPartySettings;
use Exception;

Expand All @@ -27,6 +28,8 @@ protected function getSettingClass(string $group): string
return CoreSettings::class;
case 'edu':
return EduSettings::class;
case 'theme':
return ThemeSettings::class;
case 'third-party':
return ThirdPartySettings::class;
default:
Expand Down
Loading

0 comments on commit 1e6d21a

Please sign in to comment.