diff --git a/.gitignore b/.gitignore index d7cf440..b444c78 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ yarn-error.log /.phpstorm.meta.php /_ide_helper.php /_ide_helper_models.php +vite.config.js diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 7961411..ce9fc18 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -12,11 +12,12 @@ class Quote extends Model { use SoftDeletes; - public function request() + public function request(): void { // Send the notification // If success, add it to the transactions } + protected $fillable = [ 'quote', ]; diff --git a/composer.lock b/composer.lock index 5a05184..9dfa19f 100644 --- a/composer.lock +++ b/composer.lock @@ -367,16 +367,16 @@ }, { "name": "egulias/email-validator", - "version": "4.0.1", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "3a85486b709bc384dae8eb78fb2eec649bdb64ff" + "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/3a85486b709bc384dae8eb78fb2eec649bdb64ff", - "reference": "3a85486b709bc384dae8eb78fb2eec649bdb64ff", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ebaaf5be6c0286928352e054f2d5125608e5405e", + "reference": "ebaaf5be6c0286928352e054f2d5125608e5405e", "shasum": "" }, "require": { @@ -385,8 +385,8 @@ "symfony/polyfill-intl-idn": "^1.26" }, "require-dev": { - "phpunit/phpunit": "^9.5.27", - "vimeo/psalm": "^4.30" + "phpunit/phpunit": "^10.2", + "vimeo/psalm": "^5.12" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -422,7 +422,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.1" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.2" }, "funding": [ { @@ -430,7 +430,7 @@ "type": "github" } ], - "time": "2023-01-14T14:17:03+00:00" + "time": "2023-10-06T06:47:41+00:00" }, { "name": "fruitcake/php-cors", @@ -1612,16 +1612,16 @@ }, { "name": "league/flysystem", - "version": "3.16.0", + "version": "3.17.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "4fdf372ca6b63c6e281b1c01a624349ccb757729" + "reference": "bd4c9b26849d82364119c68429541f1631fba94b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fdf372ca6b63c6e281b1c01a624349ccb757729", - "reference": "4fdf372ca6b63c6e281b1c01a624349ccb757729", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/bd4c9b26849d82364119c68429541f1631fba94b", + "reference": "bd4c9b26849d82364119c68429541f1631fba94b", "shasum": "" }, "require": { @@ -1639,8 +1639,8 @@ "symfony/http-client": "<5.2" }, "require-dev": { - "async-aws/s3": "^1.5", - "async-aws/simple-s3": "^1.1", + "async-aws/s3": "^1.5 || ^2.0", + "async-aws/simple-s3": "^1.1 || ^2.0", "aws/aws-sdk-php": "^3.220.0", "composer/semver": "^3.0", "ext-fileinfo": "*", @@ -1686,7 +1686,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.16.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.17.0" }, "funding": [ { @@ -1698,7 +1698,7 @@ "type": "github" } ], - "time": "2023-09-07T19:22:17+00:00" + "time": "2023-10-05T20:15:05+00:00" }, { "name": "league/flysystem-local", @@ -2171,16 +2171,16 @@ }, { "name": "nette/schema", - "version": "v1.2.4", + "version": "v1.2.5", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab" + "reference": "0462f0166e823aad657c9224d0f849ecac1ba10a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/c9ff517a53903b3d4e29ec547fb20feecb05b8ab", - "reference": "c9ff517a53903b3d4e29ec547fb20feecb05b8ab", + "url": "https://api.github.com/repos/nette/schema/zipball/0462f0166e823aad657c9224d0f849ecac1ba10a", + "reference": "0462f0166e823aad657c9224d0f849ecac1ba10a", "shasum": "" }, "require": { @@ -2227,9 +2227,9 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.2.4" + "source": "https://github.com/nette/schema/tree/v1.2.5" }, - "time": "2023-08-05T18:56:25+00:00" + "time": "2023-10-05T20:37:59+00:00" }, { "name": "nette/utils", @@ -5921,16 +5921,16 @@ }, { "name": "brianium/paratest", - "version": "v7.2.8", + "version": "v7.2.9", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "882b02d197328138686bb06ce7d8cbb98fc0a16c" + "reference": "1f9e41c0779be4540654d92a9314016713f5e62c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/882b02d197328138686bb06ce7d8cbb98fc0a16c", - "reference": "882b02d197328138686bb06ce7d8cbb98fc0a16c", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/1f9e41c0779be4540654d92a9314016713f5e62c", + "reference": "1f9e41c0779be4540654d92a9314016713f5e62c", "shasum": "" }, "require": { @@ -5938,13 +5938,13 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-simplexml": "*", - "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", + "fidry/cpu-core-counter": "^0.5.1", "jean85/pretty-package-versions": "^2.0.5", "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "phpunit/php-code-coverage": "^10.1.3", - "phpunit/php-file-iterator": "^4.0.2", + "phpunit/php-code-coverage": "^10.1.7", + "phpunit/php-file-iterator": "^4.1.0", "phpunit/php-timer": "^6.0", - "phpunit/phpunit": "^10.3.2", + "phpunit/phpunit": "^10.4.0", "sebastian/environment": "^6.0.1", "symfony/console": "^6.3.4", "symfony/process": "^6.3.4" @@ -5953,8 +5953,8 @@ "doctrine/coding-standard": "^12.0.0", "ext-pcov": "*", "ext-posix": "*", - "infection/infection": "^0.27.0", - "phpstan/phpstan": "^1.10.32", + "infection/infection": "^0.27.3", + "phpstan/phpstan": "^1.10.37", "phpstan/phpstan-deprecation-rules": "^1.1.4", "phpstan/phpstan-phpunit": "^1.3.14", "phpstan/phpstan-strict-rules": "^1.5.1", @@ -6000,7 +6000,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v7.2.8" + "source": "https://github.com/paratestphp/paratest/tree/v7.2.9" }, "funding": [ { @@ -6012,7 +6012,7 @@ "type": "paypal" } ], - "time": "2023-10-04T13:38:04+00:00" + "time": "2023-10-06T07:53:04+00:00" }, { "name": "composer/class-map-generator", @@ -7244,35 +7244,35 @@ }, { "name": "pestphp/pest", - "version": "v2.20.0", + "version": "v2.21.0", "source": { "type": "git", "url": "https://github.com/pestphp/pest.git", - "reference": "a8b785f69e44ae3f902cbf08fe6b79359ba46945" + "reference": "2ffafd445d42c8b7b7e1874bde1c29945767a49d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest/zipball/a8b785f69e44ae3f902cbf08fe6b79359ba46945", - "reference": "a8b785f69e44ae3f902cbf08fe6b79359ba46945", + "url": "https://api.github.com/repos/pestphp/pest/zipball/2ffafd445d42c8b7b7e1874bde1c29945767a49d", + "reference": "2ffafd445d42c8b7b7e1874bde1c29945767a49d", "shasum": "" }, "require": { - "brianium/paratest": "^7.2.7", + "brianium/paratest": "^7.2.9", "nunomaduro/collision": "^7.9.0", "nunomaduro/termwind": "^1.15.1", "pestphp/pest-plugin": "^2.1.1", "pestphp/pest-plugin-arch": "^2.3.3", "php": "^8.1.0", - "phpunit/phpunit": "^10.3.5" + "phpunit/phpunit": "^10.4.0" }, "conflict": { - "phpunit/phpunit": ">10.3.5", + "phpunit/phpunit": ">10.4.0", "sebastian/exporter": "<5.1.0", "webmozart/assert": "<1.11.0" }, "require-dev": { "pestphp/pest-dev-tools": "^2.16.0", - "pestphp/pest-plugin-type-coverage": "^2.2.0", + "pestphp/pest-plugin-type-coverage": "^2.4.0", "symfony/process": "^6.3.4" }, "bin": [ @@ -7331,7 +7331,7 @@ ], "support": { "issues": "https://github.com/pestphp/pest/issues", - "source": "https://github.com/pestphp/pest/tree/v2.20.0" + "source": "https://github.com/pestphp/pest/tree/v2.21.0" }, "funding": [ { @@ -7343,7 +7343,7 @@ "type": "github" } ], - "time": "2023-09-29T18:05:52+00:00" + "time": "2023-10-06T12:33:39+00:00" }, { "name": "pestphp/pest-plugin", @@ -8197,16 +8197,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.3.5", + "version": "10.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503" + "reference": "9784e877e3700de37475545bdbdce8383ff53d25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/747c3b2038f1139e3dcd9886a3f5a948648b7503", - "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9784e877e3700de37475545bdbdce8383ff53d25", + "reference": "9784e877e3700de37475545bdbdce8383ff53d25", "shasum": "" }, "require": { @@ -8246,7 +8246,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.3-dev" + "dev-main": "10.4-dev" } }, "autoload": { @@ -8278,7 +8278,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.0" }, "funding": [ { @@ -8294,7 +8294,7 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:42:37+00:00" + "time": "2023-10-06T03:41:22+00:00" }, { "name": "psr/cache", @@ -9758,5 +9758,5 @@ "php": "^8.1" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/package-lock.json b/package-lock.json index c998ee0..73ad443 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "html", + "name": "priceybot", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 2ecd503..af1f575 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --host", "build": "vite build" }, "devDependencies": { diff --git a/resources/views/components/button.blade.php b/resources/views/components/button.blade.php new file mode 100644 index 0000000..f2172f4 --- /dev/null +++ b/resources/views/components/button.blade.php @@ -0,0 +1,3 @@ + diff --git a/resources/views/components/primary-button.blade.php b/resources/views/components/primary-button.blade.php index c655792..f27ca1f 100644 --- a/resources/views/components/primary-button.blade.php +++ b/resources/views/components/primary-button.blade.php @@ -1,3 +1,3 @@ - diff --git a/resources/views/components/secondary-button.blade.php b/resources/views/components/secondary-button.blade.php index 56f3692..32ece40 100644 --- a/resources/views/components/secondary-button.blade.php +++ b/resources/views/components/secondary-button.blade.php @@ -1,3 +1,3 @@ - diff --git a/resources/views/components/sidebar.blade.php b/resources/views/components/sidebar.blade.php index f355088..e64b822 100644 --- a/resources/views/components/sidebar.blade.php +++ b/resources/views/components/sidebar.blade.php @@ -29,23 +29,25 @@ -
  • -
    Admin Menu
    - -
  • + @if(auth()->user()->is_admin) +
  • +
    Admin Menu
    + +
  • + @endif diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 19e1b39..5f951f0 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -6,6 +6,7 @@ }" x-init="$watch('darkMode', val => localStorage.setItem('darkMode', val))" x-bind:class="{'dark': darkMode === 'dark' || (darkMode === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches)}" + class="h-full" > @@ -21,7 +22,7 @@ @vite(['resources/css/app.css', 'resources/js/app.js']) - +
    - -
    -
    + class="fixed inset-0 bg-nexi-black/80"> +
    - -
    + x-transition:enter="transition ease-in-out duration-300 transform" + x-transition:enter-start="-translate-x-full" + x-transition:enter-end="translate-x-0" + x-transition:leave="transition ease-in-out duration-300 transform" + x-transition:leave-start="translate-x-0" + x-transition:leave-end="-translate-x-full" + class="relative mr-16 flex w-full max-w-xs flex-1"> -
    - +
    + +
    + +
    + +
    diff --git a/resources/views/livewire/pages/quote/list.blade.php b/resources/views/livewire/pages/quote/list.blade.php index 01a3a2e..de3a28d 100644 --- a/resources/views/livewire/pages/quote/list.blade.php +++ b/resources/views/livewire/pages/quote/list.blade.php @@ -23,7 +23,18 @@ new #[Layout('layouts.guest')] class extends Component // TODO: add code to send a notification } + public function delete(Quote $quote): void + { + $this->authorize('request', $quote); + + $quote->delete(); + + $this->dispatch('quote-deleted'); + + } + #[On('quote-approved')] + #[On('quote-deleted')] public function getQuotes(): void { $this->quotes = Quote::all()->whereNull('deleted_at')->sortDesc(); @@ -54,8 +65,40 @@ new #[Layout('layouts.guest')] class extends Component
    - {{ __('Request') }} + {{ __('Request') }}
    + @if(auth()->user()->is_admin) + {{ __('Delete') }} + + +
    +

    + {{ __('Are you sure you want to delete the quote?') }} +

    + +

    + "{{ $quote->quote }}" +

    + +
    + + {{ __('Cancel') }} + + {{ __('Delete') }} +
    +
    +
    + @endif
    @endif diff --git a/resources/views/livewire/pages/quote/request.blade.php b/resources/views/livewire/pages/quote/request.blade.php index 6ef15b1..5530b7d 100644 --- a/resources/views/livewire/pages/quote/request.blade.php +++ b/resources/views/livewire/pages/quote/request.blade.php @@ -35,6 +35,6 @@ new #[Layout('layouts.guest')] class extends Component > - {{ __('Request') }} + {{ __('Request') }}
    diff --git a/resources/views/livewire/pages/quote/requested.blade.php b/resources/views/livewire/pages/quote/requested.blade.php index ff60f1f..d9647d7 100644 --- a/resources/views/livewire/pages/quote/requested.blade.php +++ b/resources/views/livewire/pages/quote/requested.blade.php @@ -69,12 +69,67 @@ new #[Layout('layouts.guest')] class extends Component @if(!empty(auth()->user()) && auth()->user()->is_admin)
    -
    - {{ __('Approve') }} -
    -
    - {{ __('Reject') }} -
    + {{ __('Approve') }} + + +
    +

    + {{ __('Are you sure you want to approve the quote?') }} +

    + +

    + "{{ $quote->quote }}" +

    + +
    + + {{ __('Cancel') }} + + {{ __('Approve') }} +
    +
    +
    + + {{ __('Reject') }} + + +
    +

    + {{ __('Are you sure you want to reject the quote?') }} +

    + +

    + "{{ $quote->quote }}" +

    + +
    + + {{ __('Cancel') }} + + {{ __('Reject') }} +
    +
    +
    @endif diff --git a/resources/views/profile.blade.php b/resources/views/profile.blade.php index ed027ee..314e5f1 100644 --- a/resources/views/profile.blade.php +++ b/resources/views/profile.blade.php @@ -7,11 +7,11 @@
    -
    -
    - -
    -
    +{{--
    --}} +{{--
    --}} +{{-- --}} +{{--
    --}} +{{--
    --}}
    @@ -19,11 +19,11 @@
    -
    -
    - -
    -
    +{{--
    --}} +{{--
    --}} +{{-- --}} +{{--
    --}} +{{--
    --}}
    diff --git a/vite.config.js b/vite.config.js deleted file mode 100644 index 7457b31..0000000 --- a/vite.config.js +++ /dev/null @@ -1,19 +0,0 @@ -import { defineConfig } from 'vite'; -import laravel from 'laravel-vite-plugin'; - -export default defineConfig({ - plugins: [ - laravel({ - input: [ - 'resources/css/app.css', - 'resources/js/app.js', - ], - refresh: true, - }), - ], - server: { - hmr: { - host: '192.168.1.71', - }, - } -});