Compare commits

...

13 Commits
1.5 ... 1.5.2

Author SHA1 Message Date
Dennis
120b4c9df7 prod mix 2021-05-13 20:37:41 +02:00
Dennis
0eb66c10f6 Merge branch 'develop' 2021-05-13 20:37:09 +02:00
Dennis
1a6b14a250 Ran psr formatting 2021-05-13 20:37:03 +02:00
Dennis
072c8569eb added indian rupee 2021-05-13 20:36:41 +02:00
Dennis
5b9378255b Loading state to select country dropdown 2021-05-11 14:59:34 +02:00
Dennis
ac3cf16377 Production mix 2021-05-11 11:55:08 +02:00
Dennis
31154d20f6 wip 2021-05-11 11:54:43 +02:00
Dennis
f8031ac71a Merge branch 'develop'
# Conflicts:
#	public/css/app.css
#	public/js/2035.js
#	public/js/2407.js
#	public/js/2741.js
#	public/js/4104.js
#	public/js/4627.js
#	public/js/547.js
#	public/js/5727.js
#	public/js/630.js
#	public/js/6341.js
#	public/js/6675.js
#	public/js/6974.js
#	public/js/7438.js
#	public/js/9039.js
#	public/js/9202.js
#	public/js/9737.js
#	public/js/9989.js
#	public/js/app.js
#	public/js/app.js.LICENSE.txt
2021-05-11 11:54:09 +02:00
Dennis
898ec6a454 Stripe billing details used for india regulations 2021-05-11 11:50:41 +02:00
Dennis
9dbd54fdf6 wip 2021-05-07 11:07:48 +02:00
Dennis
934017384d wip 2021-05-07 11:04:38 +02:00
Dennis
aee3dc0d93 Merge branch 'develop' 2021-05-05 15:50:42 +02:00
Dennis
8046687ae7 Bugfix for settings 2021-05-05 15:49:05 +02:00
74 changed files with 5961 additions and 6281 deletions

View File

@@ -8,11 +8,11 @@ $finder = Symfony\Component\Finder\Finder::create()
->name('*.php')
->notName('*.blade.php');
return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'length'],
'ordered_imports' => ['sort_algorithm' => 'length'],
'no_unused_imports' => true,
])
->setFinder($finder);

View File

@@ -13,7 +13,7 @@ class Css extends Command
public function handle()
{
if(file_exists(storage_path('app/public/theme.css')) && !$this->confirm('You seem to already have a theme.css published, are you sure you want to overwrite?')){
if (file_exists(storage_path('app/public/theme.css')) && !$this->confirm('You seem to already have a theme.css published, are you sure you want to overwrite?')) {
$this->warn('Aborted publishing of theme.css.');
return 0;

View File

@@ -13,7 +13,7 @@ class CssBackup extends Command
public function handle()
{
if(!file_exists(storage_path('app/public/theme.css'))){
if (!file_exists(storage_path('app/public/theme.css'))) {
$this->warn('There is no custom theme.css, aborting backup.');
return 0;

View File

@@ -4,7 +4,6 @@ namespace App\Console\Commands\Core;
use Exception;
use App\Models\User;
use Illuminate\Support\Facades\Artisan;
use RuntimeException;
use App\Models\Package;
use App\Services\Ploi\Ploi;
@@ -13,6 +12,7 @@ use Illuminate\Console\Command;
use App\Services\VersionChecker;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Artisan;
class Install extends Command
{

View File

@@ -2,10 +2,10 @@
namespace App\Console;
use App\Console\Commands\Core\Css;
use App\Console\Commands\Core\CssBackup;
use App\Jobs\Core\Ping;
use App\Console\Commands\Core\Css;
use App\Console\Commands\Core\Install;
use App\Console\Commands\Core\CssBackup;
use App\Console\Commands\Core\Synchronize;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

281
app/Helpers/Country.php Normal file
View File

@@ -0,0 +1,281 @@
<?php
if (!function_exists('countries')) {
function countries($key = null)
{
$arr = [
'af' => 'Afghanistan',
'al' => 'Albania',
'dz' => 'Algeria',
'as' => 'American Samoa',
'ad' => 'Andorra',
'ao' => 'Angola',
'ai' => 'Anguilla',
'aq' => 'Antarctica',
'ag' => 'Antigua and Barbuda',
'ar' => 'Argentina',
'am' => 'Armenia',
'aw' => 'Aruba',
'au' => 'Australia',
'at' => 'Austria',
'az' => 'Azerbaijan',
'bs' => 'Bahamas',
'bh' => 'Bahrain',
'bd' => 'Bangladesh',
'bb' => 'Barbados',
'by' => 'Belarus',
'be' => 'Belgium',
'bz' => 'Belize',
'bj' => 'Benin',
'bm' => 'Bermuda',
'bt' => 'Bhutan',
'bo' => 'Bolivia',
'ba' => 'Bosnia and Herzegovina',
'bw' => 'Botswana',
'bv' => 'Bouvet Island',
'br' => 'Brazil',
'bq' => 'British Antarctic Territory',
'io' => 'British Indian Ocean Territory',
'vg' => 'British Virgin Islands',
'bn' => 'Brunei',
'bg' => 'Bulgaria',
'bf' => 'Burkina Faso',
'bi' => 'Burundi',
'kh' => 'Cambodia',
'cm' => 'Cameroon',
'ca' => 'Canada',
'ct' => 'Canton and Enderbury Islands',
'cv' => 'Cape Verde',
'ky' => 'Cayman Islands',
'cf' => 'Central African Republic',
'td' => 'Chad',
'cl' => 'Chile',
'cn' => 'China',
'cx' => 'Christmas Island',
'cc' => 'Cocos [Keeling] Islands',
'co' => 'Colombia',
'km' => 'Comoros',
'cg' => 'Congo - Brazzaville',
'cd' => 'Congo - Kinshasa',
'ck' => 'Cook Islands',
'cr' => 'Costa Rica',
'hr' => 'Croatia',
'cu' => 'Cuba',
'cy' => 'Cyprus',
'cz' => 'Czech Republic',
'ci' => 'Côte dIvoire',
'dk' => 'Denmark',
'dj' => 'Djibouti',
'dm' => 'Dominica',
'do' => 'Dominican Republic',
'nq' => 'Dronning Maud Land',
'dd' => 'East Germany',
'ec' => 'Ecuador',
'eg' => 'Egypt',
'sv' => 'El Salvador',
'gq' => 'Equatorial Guinea',
'er' => 'Eritrea',
'ee' => 'Estonia',
'et' => 'Ethiopia',
'fk' => 'Falkland Islands',
'fo' => 'Faroe Islands',
'fj' => 'Fiji',
'fi' => 'Finland',
'fr' => 'France',
'gf' => 'French Guiana',
'pf' => 'French Polynesia',
'tf' => 'French Southern Territories',
'fq' => 'French Southern and Antarctic Territories',
'ga' => 'Gabon',
'gm' => 'Gambia',
'ge' => 'Georgia',
'de' => 'Germany',
'gh' => 'Ghana',
'gi' => 'Gibraltar',
'gr' => 'Greece',
'gl' => 'Greenland',
'gd' => 'Grenada',
'gp' => 'Guadeloupe',
'gu' => 'Guam',
'gt' => 'Guatemala',
'gg' => 'Guernsey',
'gn' => 'Guinea',
'gw' => 'Guinea-Bissau',
'gy' => 'Guyana',
'ht' => 'Haiti',
'hm' => 'Heard Island and McDonald Islands',
'hn' => 'Honduras',
'hk' => 'Hong Kong SAR China',
'hu' => 'Hungary',
'is' => 'Iceland',
'in' => 'India',
'id' => 'Indonesia',
'ir' => 'Iran',
'iq' => 'Iraq',
'ie' => 'Ireland',
'im' => 'Isle of Man',
'il' => 'Israel',
'it' => 'Italy',
'jm' => 'Jamaica',
'jp' => 'Japan',
'je' => 'Jersey',
'jt' => 'Johnston Island',
'jo' => 'Jordan',
'kz' => 'Kazakhstan',
'ke' => 'Kenya',
'ki' => 'Kiribati',
'kw' => 'Kuwait',
'kg' => 'Kyrgyzstan',
'la' => 'Laos',
'lv' => 'Latvia',
'lb' => 'Lebanon',
'ls' => 'Lesotho',
'lr' => 'Liberia',
'ly' => 'Libya',
'li' => 'Liechtenstein',
'lt' => 'Lithuania',
'lu' => 'Luxembourg',
'mo' => 'Macau SAR China',
'mk' => 'Macedonia',
'mg' => 'Madagascar',
'mw' => 'Malawi',
'my' => 'Malaysia',
'mv' => 'Maldives',
'ml' => 'Mali',
'mt' => 'Malta',
'mh' => 'Marshall Islands',
'mq' => 'Martinique',
'mr' => 'Mauritania',
'mu' => 'Mauritius',
'yt' => 'Mayotte',
'fx' => 'Metropolitan France',
'mx' => 'Mexico',
'fm' => 'Micronesia',
'mi' => 'Midway Islands',
'md' => 'Moldova',
'mc' => 'Monaco',
'mn' => 'Mongolia',
'me' => 'Montenegro',
'ms' => 'Montserrat',
'ma' => 'Morocco',
'mz' => 'Mozambique',
'mm' => 'Myanmar [Burma]',
'na' => 'Namibia',
'nr' => 'Nauru',
'np' => 'Nepal',
'nl' => 'Netherlands',
'an' => 'Netherlands Antilles',
'nt' => 'Neutral Zone',
'nc' => 'New Caledonia',
'nz' => 'New Zealand',
'ni' => 'Nicaragua',
'ne' => 'Niger',
'ng' => 'Nigeria',
'nu' => 'Niue',
'nf' => 'Norfolk Island',
'kp' => 'North Korea',
'vd' => 'North Vietnam',
'mp' => 'Northern Mariana Islands',
'no' => 'Norway',
'om' => 'Oman',
'pc' => 'Pacific Islands Trust Territory',
'pk' => 'Pakistan',
'pw' => 'Palau',
'ps' => 'Palestinian Territories',
'pa' => 'Panama',
'pz' => 'Panama Canal Zone',
'pg' => 'Papua New Guinea',
'py' => 'Paraguay',
'yd' => 'People\'s Democratic Republic of Yemen',
'pe' => 'Peru',
'ph' => 'Philippines',
'pn' => 'Pitcairn Islands',
'pl' => 'Poland',
'pt' => 'Portugal',
'pr' => 'Puerto Rico',
'qa' => 'Qatar',
'ro' => 'Romania',
'ru' => 'Russia',
'rw' => 'Rwanda',
're' => 'Réunion',
'bl' => 'Saint Barthélemy',
'sh' => 'Saint Helena',
'kn' => 'Saint Kitts and Nevis',
'lc' => 'Saint Lucia',
'mf' => 'Saint Martin',
'pm' => 'Saint Pierre and Miquelon',
'vc' => 'Saint Vincent and the Grenadines',
'ws' => 'Samoa',
'sm' => 'San Marino',
'sa' => 'Saudi Arabia',
'sn' => 'Senegal',
'rs' => 'Serbia',
'cs' => 'Serbia and Montenegro',
'sc' => 'Seychelles',
'sl' => 'Sierra Leone',
'sg' => 'Singapore',
'sk' => 'Slovakia',
'si' => 'Slovenia',
'sb' => 'Solomon Islands',
'so' => 'Somalia',
'za' => 'South Africa',
'gs' => 'South Georgia and the South Sandwich Islands',
'kr' => 'South Korea',
'es' => 'Spain',
'lk' => 'Sri Lanka',
'sd' => 'Sudan',
'sr' => 'Suriname',
'sj' => 'Svalbard and Jan Mayen',
'sz' => 'Swaziland',
'se' => 'Sweden',
'ch' => 'Switzerland',
'sy' => 'Syria',
'st' => 'São Tomé and Príncipe',
'tw' => 'Taiwan',
'tj' => 'Tajikistan',
'tz' => 'Tanzania',
'th' => 'Thailand',
'tl' => 'Timor-Leste',
'tg' => 'Togo',
'tk' => 'Tokelau',
'to' => 'Tonga',
'tt' => 'Trinidad and Tobago',
'tn' => 'Tunisia',
'tr' => 'Turkey',
'tm' => 'Turkmenistan',
'tc' => 'Turks and Caicos Islands',
'tv' => 'Tuvalu',
'um' => 'U.S. Minor Outlying Islands',
'pu' => 'U.S. Miscellaneous Pacific Islands',
'vi' => 'U.S. Virgin Islands',
'ug' => 'Uganda',
'ua' => 'Ukraine',
'su' => 'Union of Soviet Socialist Republics',
'ae' => 'United Arab Emirates',
'en' => 'United Kingdom (EN)',
'uk' => 'United Kingdom (UK)',
'gb' => 'United Kingdom (GB)',
'us' => 'United States',
'zz' => 'Unknown or Invalid Region',
'uy' => 'Uruguay',
'uz' => 'Uzbekistan',
'vu' => 'Vanuatu',
'va' => 'Vatican City',
've' => 'Venezuela',
'vn' => 'Vietnam',
'wk' => 'Wake Island',
'wf' => 'Wallis and Futuna',
'eh' => 'Western Sahara',
'ye' => 'Yemen',
'zm' => 'Zambia',
'zw' => 'Zimbabwe',
'ax' => 'Åland Islands',
];
if ($key && array_key_exists($key, $arr)) {
return $arr[strtolower($key)];
}
return $arr;
}
}

View File

@@ -1,7 +1,7 @@
<?php
if (!function_exists('languages')) {
function languages()
function languages(): array
{
$languages = [
'en'

View File

@@ -2,10 +2,9 @@
namespace App\Http\Controllers\Admin;
use App\Models\Alert;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\AlertRequest;
use App\Models\Alert;
use Illuminate\Http\Request;
class AlertController extends Controller
{

View File

@@ -3,10 +3,10 @@
namespace App\Http\Controllers\Admin;
use App\Models\Package;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\SettingRequest;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;
use App\Http\Requests\Admin\SettingRequest;
class SettingController extends Controller
{
@@ -60,6 +60,14 @@ class SettingController extends Controller
$value = null;
}
if ($value === 'false') {
$value = 0;
}
if ($value === 'true') {
$value = 1;
}
setting([$key => $value]);
}

View File

@@ -2,10 +2,10 @@
namespace App\Http\Controllers;
use Illuminate\Support\Str;
use App\Models\DocumentationItem;
use App\Models\DocumentationCategory;
use App\Http\Resources\DocumentationCategoryRouteResource;
use App\Models\DocumentationItem;
use Illuminate\Support\Str;
class DocumentationController extends Controller
{

View File

@@ -60,6 +60,7 @@ class ProfileBillingController extends Controller
Package::CURRENCY_CAD => 'CAD $',
Package::CURRENCY_AUD => 'AUD $',
Package::CURRENCY_GBP => 'GBP £',
Package::CURRENCY_INR => 'INR ',
];
$package->price_monthly = ($currencies[$package->currency] ?? '[Unknown currency]') . number_format($package->price_monthly, 2, ',', '.');
@@ -75,6 +76,7 @@ class ProfileBillingController extends Controller
return inertia('Profile/Billing', [
'packages' => $packages,
'countries' => countries(),
'subscription' => $user->subscription('default'),
'public_key' => config('cashier.key'),
'data_client_secret' => $clientSecret,
@@ -96,8 +98,14 @@ class ProfileBillingController extends Controller
$user = $request->user();
$user->createOrGetStripeCustomer([
'name' => $user->name,
'description' => $request->input('billing_details')
'name' => $request->input('billing_details.name'),
'description' => 'Ploi Core Customer ' . $request->input('billing_details.name'),
'address' => [
'line1' => $request->input('billing_details.address.line1'),
'postal_code' => $request->input('billing_details.address.postal_code'),
'city' => $request->input('billing_details.address.city'),
'country' => $request->input('billing_details.address.country'),
]
]);
foreach ($user->paymentMethods() as $paymentMethod) {

View File

@@ -12,7 +12,8 @@ class ProfileController extends Controller
public function index()
{
return inertia('Profile/Index', [
'profile' => new UserProfileResource(auth()->user())
'profile' => new UserProfileResource(auth()->user()),
'countries' => countries()
]);
}

View File

@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Profile;
use App\Models\UserProvider;
use App\Http\Controllers\Controller;
use App\Http\Requests\ProfileIntegrationRequest;
use App\Models\UserProvider;
use Illuminate\Http\Request;
class ProfileIntegrationController extends Controller
{
public function index()
{
$providers = auth()->user()->providers()->latest()->get()->map(function($provider){
$providers = auth()->user()->providers()->latest()->get()->map(function ($provider) {
return [
'id' => $provider->id,
'type' => $provider->type,
@@ -28,7 +27,7 @@ class ProfileIntegrationController extends Controller
{
$request->user()->providers()->updateOrCreate([
'type' => UserProvider::TYPE_CLOUDFLARE
],[
], [
'type' => UserProvider::TYPE_CLOUDFLARE,
'token' => $request->input('meta.api_key'),
'meta' => [

View File

@@ -2,12 +2,12 @@
namespace App\Http\Controllers;
use App\Http\Requests\SiteDnsRequest;
use App\Models\Site;
use Illuminate\Support\Arr;
use App\Models\UserProvider;
use App\Services\Cloudflare;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use App\Http\Requests\SiteDnsRequest;
class SiteDnsController extends Controller
{

View File

@@ -3,9 +3,9 @@
namespace App\Http\Middleware;
use App\Models\Alert;
use App\Models\UserProvider;
use Inertia\Middleware;
use Illuminate\Support\Arr;
use App\Models\UserProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
@@ -61,6 +61,10 @@ class HandleInertiaRequests extends Middleware
'theme' => Auth::user()->theme,
'keyboard_shortcuts' => Auth::user()->keyboard_shortcuts,
'requires_password_for_ftp' => Auth::user()->requires_password_for_ftp,
'address' => Auth::user()->address,
'country' => Auth::user()->country,
'zip' => Auth::user()->zip,
'city' => Auth::user()->city,
] : null,
'package' => auth()->user() && auth()->user()->package ? [
'name' => auth()->user()->package->name,

View File

@@ -3,8 +3,8 @@
namespace App\Http\Requests\Admin;
use App\Models\Alert;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
class AlertRequest extends FormRequest
{

View File

@@ -40,6 +40,7 @@ class PackageRequest extends FormRequest
Package::CURRENCY_AUD,
Package::CURRENCY_CAD,
Package::CURRENCY_GBP,
Package::CURRENCY_INR,
])
],
'maximum_sites' => [

View File

@@ -3,9 +3,9 @@
namespace App\Http\Requests;
use App\Models\UserProvider;
use Illuminate\Validation\Rule;
use App\Rules\CloudflareGeneralTest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileIntegrationRequest extends FormRequest
{

View File

@@ -41,6 +41,22 @@ class UserProfileRequest extends FormRequest
'required',
'string',
Rule::in(languages()),
],
'address' => [
'nullable',
'string'
],
'country' => [
'nullable',
'string'
],
'zip' => [
'nullable',
'string'
],
'city' => [
'nullable',
'string'
]
];
}

View File

@@ -19,7 +19,11 @@ class UserProfileResource extends JsonResource
return [
'name' => $this->name,
'email' => $this->email,
'language' => $this->language
'language' => $this->language,
'address' => $this->address,
'country' => $this->country,
'zip' => $this->zip,
'city' => $this->city
];
}
}

View File

@@ -3,8 +3,8 @@
namespace App\Jobs\Core;
use App\Services\Ploi\Ploi;
use App\Services\VersionChecker;
use Illuminate\Bus\Queueable;
use App\Services\VersionChecker;
use Illuminate\Support\Facades\Http;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;

View File

@@ -13,6 +13,7 @@ class Package extends Model
const CURRENCY_AUD = 'aud';
const CURRENCY_CAD = 'cad';
const CURRENCY_GBP = 'gbp';
const CURRENCY_INR = 'inr';
public $fillable = [
'name',

View File

@@ -41,12 +41,12 @@ class Provider extends Model
public static function booted()
{
static::deleting(function(self $provider){
static::deleting(function (self $provider) {
$provider->regions()->delete();
$provider->plans()->delete();
$provider->packages()->detach();
foreach($provider->servers as $server){
foreach ($provider->servers as $server) {
$server->provider_id = null;
$server->provider_plan_id = null;
$server->provider_region_id = null;

View File

@@ -28,6 +28,7 @@ class User extends Authenticatable implements HasLocalePreference
'address',
'city',
'country',
'zip',
'notes',
'language',
'blocked',

View File

@@ -2,8 +2,8 @@
namespace App\Services;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Str;
use GuzzleHttp\Exception\ClientException;
class Cloudflare
{

View File

@@ -41,7 +41,6 @@ class VersionChecker
cache()->forget('ploi-core-current-version');
cache()->forget('ploi-core-remote-version');
} catch (\Exception $exception) {
}
}
}

View File

@@ -31,9 +31,10 @@
"facade/ignition": "^2.3",
"friendsofphp/php-cs-fixer": "^2.16",
"fzaninotto/faker": "^1.9.1",
"laravel/dusk": "^6.15",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^8.5"
"phpunit/phpunit": "^9.5.4"
},
"config": {
"optimize-autoloader": true,

1162
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateAlertsTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddMetaToUserProvidersTable extends Migration
{

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddZipToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('zip')->after('city')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('zip');
});
}
}

10317
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
@@ -12,13 +13,16 @@
"@inertiajs/inertia": "^0.4.3",
"@inertiajs/inertia-vue": "^0.3.2",
"@inertiajs/progress": "^0.1.2",
"@tailwindcss/ui": "^0.3.0",
"@tailwindcss/forms": "^0.3.2",
"@tailwindcss/typography": "^0.4.0",
"autoprefixer": "^10.2.5",
"axios": "^0.19",
"balloon-css": "^1.2.0",
"cross-env": "^7.0",
"laravel-mix": "^6.0.18",
"lodash": "^4.17.15",
"portal-vue": "^2.1.7",
"postcss": "^8.2.13",
"resolve-url-loader": "^3.1.0",
"sass": "^1.15.2",
"sass-loader": "^8.0.0",
@@ -30,11 +34,5 @@
"vue-meta": "^2.4.0",
"vue-template-compiler": "^2.6.11",
"vuex": "^3.5.1"
},
"dependencies": {
"@tailwindcss/forms": "^0.3.2",
"@tailwindcss/typography": "^0.4.0",
"autoprefixer": "^10.2.5",
"postcss": "^8.2.13"
}
}

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

1
public/js/1382.js vendored Normal file

File diff suppressed because one or more lines are too long

2
public/js/2035.js vendored

File diff suppressed because one or more lines are too long

2
public/js/2407.js vendored

File diff suppressed because one or more lines are too long

1
public/js/2488.js vendored

File diff suppressed because one or more lines are too long

1
public/js/2574.js vendored

File diff suppressed because one or more lines are too long

2
public/js/2741.js vendored

File diff suppressed because one or more lines are too long

1
public/js/3028.js vendored Normal file

File diff suppressed because one or more lines are too long

2
public/js/4104.js vendored

File diff suppressed because one or more lines are too long

1
public/js/461.js vendored

File diff suppressed because one or more lines are too long

2
public/js/4627.js vendored

File diff suppressed because one or more lines are too long

1
public/js/506.js vendored Normal file

File diff suppressed because one or more lines are too long

2
public/js/547.js vendored

File diff suppressed because one or more lines are too long

2
public/js/5727.js vendored

File diff suppressed because one or more lines are too long

2
public/js/630.js vendored

File diff suppressed because one or more lines are too long

2
public/js/6341.js vendored

File diff suppressed because one or more lines are too long

2
public/js/6675.js vendored

File diff suppressed because one or more lines are too long

2
public/js/6974.js vendored

File diff suppressed because one or more lines are too long

1
public/js/7319.js vendored Normal file

File diff suppressed because one or more lines are too long

2
public/js/7438.js vendored

File diff suppressed because one or more lines are too long

1
public/js/7541.js vendored

File diff suppressed because one or more lines are too long

2
public/js/9039.js vendored

File diff suppressed because one or more lines are too long

2
public/js/9202.js vendored

File diff suppressed because one or more lines are too long

2
public/js/9737.js vendored

File diff suppressed because one or more lines are too long

2
public/js/9989.js vendored

File diff suppressed because one or more lines are too long

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -2,20 +2,20 @@
* @license MIT */
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* Vue.js v2.6.12
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
/*!
* clipboard.js v2.0.6
* clipboard.js v2.0.8
* https://clipboardjs.com/
*
*
* Licensed MIT © Zeno Rocha
*/
/*!
* vuex v3.5.1
* (c) 2020 Evan You
* vuex v3.6.2
* (c) 2021 Evan You
* @license MIT
*/

View File

@@ -35,6 +35,7 @@
<option value="nok">{{ __('NOK (Norwegian Krone)') }}</option>
<option value="aud">{{ __('AUD (Australian dollar)') }}</option>
<option value="cad">{{ __('CAD (Canadian dollar)') }}</option>
<option value="inr">{{ __('INR (Indian rupee)') }}</option>
</FormSelect>
<div class="space-y-4">

View File

@@ -37,6 +37,7 @@
<option value="nok">{{ __('NOK (Norwegian Krone)') }}</option>
<option value="aud">{{ __('AUD (Australian dollar)') }}</option>
<option value="cad">{{ __('CAD (Canadian dollar)') }}</option>
<option value="inr">{{ __('INR (Indian rupee)') }}</option>
</FormSelect>
<div class="space-y-4">

View File

@@ -18,6 +18,22 @@
id="card-holder-name"
:label="__('Card holder name')"/>
<form-input v-model="address"
:errors="$page.props.errors.address"
:disabled="sending"
:label="__('Address')"/>
<form-select :disabled="sending" :label="__('Country')" :errors="$page.props.errors.country" v-model="country">
<option :value="code" v-for="(country, code) in countries" v-text="country"></option>
</form-select>
<form-input v-model="zip"
:errors="$page.props.errors.zip"
:disabled="sending"
:label="__('ZIP (postal code)')"/>
<form-input v-model="city"
:errors="$page.props.errors.city"
:disabled="sending"
:label="__('City')"/>
<div class="w-full pb-4">
<label class="form-label" for="card-element">{{ __('Card details') }}</label>
<div id="card-element" class="form-input"></div>
@@ -159,6 +175,7 @@
import Modal from '@/components/Modal'
import ModalContainer from '@/components/ModalContainer'
import FormInput from '@/components/forms/FormInput'
import FormSelect from '@/components/forms/FormSelect'
import FormTextarea from '@/components/forms/FormTextarea'
import FormActions from '@/components/FormActions'
import Table from '@/components/Table'
@@ -201,6 +218,7 @@
Modal,
ModalContainer,
FormInput,
FormSelect,
FormTextarea,
FormActions,
Table,
@@ -213,6 +231,7 @@
props: {
packages: Array,
countries: Object,
subscription: [Object, null],
public_key: String,
data_client_secret: String,
@@ -232,6 +251,11 @@
currentCardBrand: this.card.brand,
coupon: '',
address: this.$page.props.auth.user.address,
country: this.$page.props.auth.user.country,
zip: this.$page.props.auth.user.zip,
city: this.$page.props.auth.user.city,
invoices: [],
breadcrumbs: [
@@ -288,6 +312,12 @@
card: this.cardElement,
billing_details: {
name: this.cardHolderName,
address: {
line1: this.address,
postal_code: this.zip,
city: this.city,
country: this.country,
}
}
}
}
@@ -305,7 +335,15 @@
const paymentMethod = setupIntent.payment_method;
this.$inertia.post(this.route('profile.billing.update.card'), {
payment_method: paymentMethod,
billing_details: this.billingDetails
billing_details: {
name: this.cardHolderName,
address: {
line1: this.address,
postal_code: this.zip,
city: this.city,
country: this.country,
}
}
}, {
onStart: () => this.sending = true,
onFinish: () => this.sending = false

View File

@@ -17,6 +17,13 @@
<option value="pt">Portuguese</option>
</FormSelect>
<FormInput :label="__('Address')" type="text" :errors="$page.props.errors.address" v-model="form.address" />
<FormSelect :label="__('Country')" :errors="$page.props.errors.country" v-model="form.country">
<option :value="code" v-for="(country, code) in countries" v-text="country"></option>
</FormSelect>
<FormInput :label="__('ZIP')" type="text" :errors="$page.props.errors.zip" v-model="form.zip" />
<FormInput :label="__('City')" type="text" :errors="$page.props.errors.city" v-model="form.city" />
<FormActions>
<Button>{{ __('Save changes') }}</Button>
</FormActions>
@@ -84,6 +91,7 @@
props: {
profile: Object,
countries: Object,
},
data() {
@@ -92,6 +100,11 @@
name: this.profile.name,
email: this.profile.email,
language: this.profile.language,
address: this.profile.address,
country: this.profile.country,
zip: this.profile.zip,
city: this.profile.city,
},
breadcrumbs: [

View File

@@ -1,6 +1,6 @@
<template>
<aside
class="relative w-full h-full max-w-lg p-8 rounded shadow-2xl pointer-events-auto bg-overlay bf-blur"
class="relative w-full h-full max-w-lg p-8 rounded shadow-2xl pointer-events-auto bg-overlay bf-blur-high"
v-click-outside="() => $emit('close')"
>
<button

View File

@@ -13,6 +13,10 @@
backdrop-filter: blur(2px) saturate(125%);
}
.bf-blur-high {
backdrop-filter: blur(15px) saturate(125%);
}
.text-gradient {
background: -webkit-linear-gradient(
35deg,

View File

@@ -0,0 +1,25 @@
<?php
namespace Tests\Browser;
use App\Models\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
class DashboardTest extends DuskTestCase
{
/**
* A Dusk test example.
*
* @return void
*/
public function testDashboard()
{
$this->browse(function (Browser $browser) {
$browser
->loginAs(User::first())
->visit('/')
->assertSee('Dashboard');
});
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Tests\Browser;
use App\Models\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
class LoginTest extends DuskTestCase
{
public function testLogin()
{
$this->browse(function (Browser $browser) {
$browser
->loginAs(User::query()->where('role', User::ADMIN)->first())
->visit('/')
->assertUrlIs(config('app.url') . '/');
$browser->visit('/admin')
->assertSee('Administration');
});
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Browser;
class HomePage extends Page
{
/**
* Get the URL for the page.
*
* @return string
*/
public function url()
{
return '/';
}
/**
* Assert that the browser is on the page.
*
* @param \Laravel\Dusk\Browser $browser
* @return void
*/
public function assert(Browser $browser)
{
//
}
/**
* Get the element shortcuts for the page.
*
* @return array
*/
public function elements()
{
return [
'@element' => '#selector',
];
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Tests\Browser\Pages;
use Laravel\Dusk\Page as BasePage;
abstract class Page extends BasePage
{
/**
* Get the global element shortcuts for the site.
*
* @return array
*/
public static function siteElements()
{
return [
'@element' => '#selector',
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Tests\Browser;
use App\Models\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
class ProfileChangeTest extends DuskTestCase
{
/**
* A Dusk test example.
*
* @return void
*/
public function testProfileChange()
{
$this->browse(function (Browser $browser) {
$browser
->loginAs(User::query()->where('role', User::ADMIN)->first())
->visit('/profile')
->press('Save Changes')
->pause(250)
->assertSee('Success')
->assertSee('Profile saved');
});
}
}

2
tests/Browser/console/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

2
tests/Browser/screenshots/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

62
tests/DuskTestCase.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
namespace Tests;
use Laravel\Dusk\TestCase as BaseTestCase;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
abstract class DuskTestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare()
{
if (! static::runningInSail()) {
static::startChromeDriver();
}
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments(collect([
'--window-size=1920,1080',
])->unless($this->hasHeadlessDisabled(), function ($items) {
return $items->merge([
'--disable-gpu',
'--headless',
]);
})->all());
return RemoteWebDriver::create(
$_ENV['DUSK_DRIVER_URL'] ?? 'http://localhost:9515',
DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY,
$options
)
);
}
/**
* Determine whether the Dusk command has disabled headless mode.
*
* @return bool
*/
protected function hasHeadlessDisabled()
{
return isset($_SERVER['DUSK_HEADLESS_DISABLED']) ||
isset($_ENV['DUSK_HEADLESS_DISABLED']);
}
}