mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
Searching frontend
This commit is contained in:
@@ -73,14 +73,14 @@ class SetupDevEnvironment extends Command
|
||||
$this->info('Clearing application cache...');
|
||||
$this->clear_cache();
|
||||
|
||||
// Oasis demo content generator
|
||||
resolve(OasisDevService::class)->create_demo_content();
|
||||
|
||||
$this->info('Dispatching jobs...');
|
||||
$this->call('queue:work', [
|
||||
'--stop-when-empty' => true,
|
||||
]);
|
||||
|
||||
// Oasis demo content generator
|
||||
resolve(OasisDevService::class)->create_demo_content();
|
||||
|
||||
$this->info('Everything is done, congratulations! 🥳🥳🥳');
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class OasisDevService
|
||||
))->count(14)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular_invoice'
|
||||
'invoice_type' => 'regular-invoice'
|
||||
]);
|
||||
|
||||
Invoice::factory(Invoice::class)
|
||||
@@ -45,7 +45,7 @@ class OasisDevService
|
||||
['client_id' => $clients[5]->id],
|
||||
))->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'advance_invoice'
|
||||
'invoice_type' => 'advance-invoice'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,11 @@ trait Oasis
|
||||
|
||||
public function regularInvoices()
|
||||
{
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('regular_invoice');
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('regular-invoice');
|
||||
}
|
||||
|
||||
public function advanceInvoices()
|
||||
{
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('advance_invoice');
|
||||
return $this->hasMany(Invoice::class)->whereInvoiceType('advance-invoice');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class InvoiceFactory extends Factory
|
||||
'id' => $this->faker->uuid,
|
||||
'user_id' => $this->faker->uuid,
|
||||
'client_id' => $this->faker->uuid,
|
||||
'invoice_type' => $this->faker->randomElement(['regular_invoice', 'advance_invoice']),
|
||||
'invoice_type' => $this->faker->randomElement(['regular-invoice', 'advance-invoice']),
|
||||
'invoice_number' => $this->faker->numberBetween(2120001, 2120999),
|
||||
'variable_number' => $this->faker->numberBetween(2120001, 2120999),
|
||||
'currency' => $this->faker->randomElement(['CZK', 'EUR']),
|
||||
|
||||
@@ -18,7 +18,7 @@ class CreateInvoicesTable extends Migration
|
||||
$table->uuid('user_id')->index();
|
||||
$table->uuid('client_id')->index();
|
||||
|
||||
$table->enum('invoice_type', ['regular_invoice', 'advance_invoice']);
|
||||
$table->enum('invoice_type', ['regular-invoice', 'advance-invoice']);
|
||||
|
||||
$table->text('invoice_number')->nullable();
|
||||
$table->text('variable_number')->nullable();
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
"/chunks/invoices.js": "/chunks/invoices.js?id=1deb187f6d3eb1e81ad0",
|
||||
"/chunks/not-found-shared.js": "/chunks/not-found-shared.js?id=7fc7f9b6f10bdfac770e",
|
||||
"/chunks/oasis/homepage.js": "/chunks/oasis/homepage.js?id=a1885dd8814f9eb63a1c",
|
||||
"/chunks/oasis/invoices.js": "/chunks/oasis/invoices.js?id=30278fb5c1b753cf4094",
|
||||
"/chunks/oasis/invoices/list.js": "/chunks/oasis/invoices/list.js?id=3f569f48e82c6a309607",
|
||||
"/chunks/oasis/invoices.js": "/chunks/oasis/invoices.js?id=fd5e7aca8897f59cd625",
|
||||
"/chunks/oasis/invoices/list.js": "/chunks/oasis/invoices/list.js?id=b94927bd83dae0172ac2",
|
||||
"/chunks/oasis/invoices~chunks/platform~chunks/shared.js": "/chunks/oasis/invoices~chunks/platform~chunks/shared.js?id=28a7253b6d421716fe94",
|
||||
"/chunks/oasis/platba.js": "/chunks/oasis/platba.js?id=53d9f2a31b1dd5dad85e",
|
||||
"/chunks/oasis/platba~chunks/oasis/upgrade-billing~chunks/oasis/upgrade-plan~chunks/upgrade-billing~ch~6880400b.js": "/chunks/oasis/platba~chunks/oasis/upgrade-billing~chunks/oasis/upgrade-plan~chunks/upgrade-billing~ch~6880400b.js?id=0c8d1c3cca084baa177f",
|
||||
@@ -204,9 +204,30 @@
|
||||
"/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~707bd579.js": "/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~707bd579.js?id=3c49df5afaf5bb1f42f3",
|
||||
"/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~87b39a8d.ff6244ee2f7e17d2e294.hot-update.js": "/chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~chunks/s~87b39a8d.ff6244ee2f7e17d2e294.hot-update.js",
|
||||
"/chunks/oasis/invoices.ff6244ee2f7e17d2e294.hot-update.js": "/chunks/oasis/invoices.ff6244ee2f7e17d2e294.hot-update.js",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list.js?id=e558d42270d3546150ed",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list.js?id=045d3dd7ce573cb7ed11",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared.js?id=750a1e714440c4f03c2f",
|
||||
"/vendors~chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~~c9df84c5.js": "/vendors~chunks/files~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared~~c9df84c5.js?id=4d042d0c0d8477a4f7ac",
|
||||
"/vendors~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared.js": "/vendors~chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared.js?id=11378342c3b6251c133e",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list.b6331b0d83b19d605c15.hot-update.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list.b6331b0d83b19d605c15.hot-update.js"
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list.b6331b0d83b19d605c15.hot-update.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list.b6331b0d83b19d605c15.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.5d88a5be6062e7fa4355.hot-update.js": "/chunks/oasis/invoices/list.5d88a5be6062e7fa4355.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.60219d2d9565d9f33c8e.hot-update.js": "/chunks/oasis/invoices/list.60219d2d9565d9f33c8e.hot-update.js",
|
||||
"/js/main.59770d8f19d126c20857.hot-update.js": "/js/main.59770d8f19d126c20857.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.45266dd27efa6308b30c.hot-update.js": "/chunks/oasis/invoices/list.45266dd27efa6308b30c.hot-update.js",
|
||||
"/js/main.ea73616d0263b7381d92.hot-update.js": "/js/main.ea73616d0263b7381d92.hot-update.js",
|
||||
"/chunks/oasis/invoices.ea73616d0263b7381d92.hot-update.js": "/chunks/oasis/invoices.ea73616d0263b7381d92.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.ea73616d0263b7381d92.hot-update.js": "/chunks/oasis/invoices/list.ea73616d0263b7381d92.hot-update.js",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list.ea73616d0263b7381d92.hot-update.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list.ea73616d0263b7381d92.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.eb7dc8dac4d97559bcd0.hot-update.js": "/chunks/oasis/invoices/list.eb7dc8dac4d97559bcd0.hot-update.js",
|
||||
"/js/main.40139f7ba1f89ce571f1.hot-update.js": "/js/main.40139f7ba1f89ce571f1.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.8aadf09b04d33c69c3f3.hot-update.js": "/chunks/oasis/invoices/list.8aadf09b04d33c69c3f3.hot-update.js",
|
||||
"/js/main.4ab821360ef654ccd12c.hot-update.js": "/js/main.4ab821360ef654ccd12c.hot-update.js",
|
||||
"/js/main.7e28417def5250427fd2.hot-update.js": "/js/main.7e28417def5250427fd2.hot-update.js",
|
||||
"/js/main.e3b0c66de37a9569a86b.hot-update.js": "/js/main.e3b0c66de37a9569a86b.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.448571d4db8b1c5ce60f.hot-update.js": "/chunks/oasis/invoices/list.448571d4db8b1c5ce60f.hot-update.js",
|
||||
"/js/main.ca59ebbdd8d1097912a1.hot-update.js": "/js/main.ca59ebbdd8d1097912a1.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.93390201f6f6f228b850.hot-update.js": "/chunks/oasis/invoices/list.93390201f6f6f228b850.hot-update.js",
|
||||
"/js/main.4ea5f95a6ebe1bc881ca.hot-update.js": "/js/main.4ea5f95a6ebe1bc881ca.hot-update.js",
|
||||
"/chunks/oasis/invoices.4ea5f95a6ebe1bc881ca.hot-update.js": "/chunks/oasis/invoices.4ea5f95a6ebe1bc881ca.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.4ea5f95a6ebe1bc881ca.hot-update.js": "/chunks/oasis/invoices/list.4ea5f95a6ebe1bc881ca.hot-update.js",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list.4ea5f95a6ebe1bc881ca.hot-update.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list.4ea5f95a6ebe1bc881ca.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
methods: {
|
||||
goTo(location) {
|
||||
let routes = {
|
||||
'invoices': 'getInvoices',
|
||||
'advance-invoices': 'getAdvanceInvoices',
|
||||
'regular-invoice': 'getRegularInvoices',
|
||||
'advance-invoice': 'getAdvanceInvoices',
|
||||
'clients': 'getClients',
|
||||
}
|
||||
this.$store.dispatch(routes[location])
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!--Sidebar navigation-->
|
||||
<ContentSidebar>
|
||||
<ContentGroup title="Invoices" class="navigator menu-list-wrapper vertical">
|
||||
<a @click="goTo('invoices')" :class="{'is-active': $isThisLocation(['invoices'])}" class="menu-list-item link">
|
||||
<a @click="goTo('regular-invoice')" :class="{'is-active': $isThisLocation(['regular-invoice'])}" class="menu-list-item link">
|
||||
<div class="icon text-theme">
|
||||
<file-text-icon size="17" />
|
||||
</div>
|
||||
@@ -12,7 +12,7 @@
|
||||
Invoices
|
||||
</div>
|
||||
</a>
|
||||
<a @click="goTo('advance-invoices')" :class="{'is-active': $isThisLocation(['advance-invoices'])}" class="menu-list-item link">
|
||||
<a @click="goTo('advance-invoice')" :class="{'is-active': $isThisLocation(['advance-invoice'])}" class="menu-list-item link">
|
||||
<div class="icon text-theme">
|
||||
<clock-icon size="17" />
|
||||
</div>
|
||||
@@ -85,8 +85,8 @@
|
||||
methods: {
|
||||
goTo(location) {
|
||||
let routes = {
|
||||
'invoices': 'getInvoices',
|
||||
'advance-invoices': 'getAdvanceInvoices',
|
||||
'regular-invoice': 'getRegularInvoices',
|
||||
'advance-invoice': 'getAdvanceInvoices',
|
||||
'clients': 'getClients',
|
||||
}
|
||||
this.$store.dispatch(routes[location])
|
||||
@@ -98,7 +98,7 @@
|
||||
events.$on('fileItem:deselect', () => this.isScaledDown = false)
|
||||
events.$on('mobile-menu:hide', () => this.isScaledDown = false)
|
||||
|
||||
this.$store.dispatch('getInvoices')
|
||||
this.$store.dispatch('getRegularInvoices')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
this.$store.commit('STORE_CURRENT_FOLDER', {
|
||||
name: 'Invoices',
|
||||
id: undefined,
|
||||
location: 'invoices',
|
||||
location: 'regular-invoice',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<MenuMobile name="invoice-create">
|
||||
<MenuMobileGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="showLocation('invoices')" title="Create Invoice" icon="file-plus" is-hover-disabled="true" />
|
||||
<Option @click.native="showLocation('advance-invoices')" title="Create Advance Invoice" icon="clock" is-hover-disabled="true" />
|
||||
<Option @click.native="showLocation('regular-invoice')" title="Create Invoice" icon="file-plus" is-hover-disabled="true" />
|
||||
<Option @click.native="showLocation('advance-invoice')" title="Create Advance Invoice" icon="clock" is-hover-disabled="true" />
|
||||
</OptionGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="showLocation('clients')" title="Create Client" icon="user-plus" is-hover-disabled="true" />
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
import {events} from '@/bus'
|
||||
import OptionGroup from '@/components/FilesView/OptionGroup'
|
||||
import Option from '@/components/FilesView/Option'
|
||||
import {debounce} from "lodash";
|
||||
|
||||
export default {
|
||||
name: 'InvoiceDesktopToolbar',
|
||||
@@ -98,8 +99,8 @@
|
||||
},
|
||||
canActiveInView() {
|
||||
let locations = [
|
||||
'invoices',
|
||||
'advance-invoices',
|
||||
'regular-invoice',
|
||||
'advance-invoice',
|
||||
]
|
||||
return !this.$isThisLocation(locations) || this.clipboard.length === 0
|
||||
},
|
||||
@@ -110,9 +111,29 @@
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
query(val) {
|
||||
this.$searchFiles(val)
|
||||
}
|
||||
query: debounce(function (value) {
|
||||
|
||||
if (value !== '' && typeof value !== 'undefined') {
|
||||
|
||||
if (['regular-invoice', 'advance-invoice'].includes(this.$store.getters.currentFolder.location)) {
|
||||
this.$store.dispatch('getSearchResultForInvoices', value)
|
||||
} else {
|
||||
this.$store.dispatch('getSearchResultForClients', value)
|
||||
}
|
||||
|
||||
} else if (typeof value !== 'undefined') {
|
||||
|
||||
let locations = {
|
||||
'regular-invoice': 'getRegularInvoices',
|
||||
'advance-invoice': 'getAdvanceInvoices',
|
||||
'clients': 'getClients',
|
||||
}
|
||||
|
||||
this.$store.dispatch(locations[this.$store.getters.currentFolder.location])
|
||||
|
||||
this.$store.commit('CHANGE_SEARCHING_STATE', false)
|
||||
}
|
||||
}, 300)
|
||||
},
|
||||
methods: {
|
||||
showSortingMenu() {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<MenuMobile name="invoice-filter">
|
||||
<MenuMobileGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="showLocation('invoices')" :is-active="$isThisLocation('invoices')" title="Invoices" icon="file-text" is-hover-disabled="true" />
|
||||
<Option @click.native="showLocation('advance-invoices')" :is-active="$isThisLocation('advance-invoices')" title="Advance Invoices" icon="clock" is-hover-disabled="true" />
|
||||
<Option @click.native="showLocation('regular-invoice')" :is-active="$isThisLocation('regular-invoice')" title="Invoices" icon="file-text" is-hover-disabled="true" />
|
||||
<Option @click.native="showLocation('advance-invoice')" :is-active="$isThisLocation('advance-invoice')" title="Advance Invoices" icon="clock" is-hover-disabled="true" />
|
||||
</OptionGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="showLocation('clients')" :is-active="$isThisLocation('clients')" title="Clients" icon="users" is-hover-disabled="true" />
|
||||
@@ -35,8 +35,8 @@ export default {
|
||||
methods: {
|
||||
showLocation(location) {
|
||||
let routes = {
|
||||
'invoices': 'getInvoices',
|
||||
'advance-invoices': 'getAdvanceInvoices',
|
||||
'regular-invoice': 'getRegularInvoices',
|
||||
'advance-invoice': 'getAdvanceInvoices',
|
||||
'clients': 'getClients',
|
||||
}
|
||||
this.$store.dispatch(routes[location])
|
||||
|
||||
@@ -5,13 +5,13 @@ import Vue from "vue"
|
||||
const defaultState = {}
|
||||
|
||||
const actions = {
|
||||
getInvoices: ({commit, getters}) => {
|
||||
getRegularInvoices: ({commit, getters}) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
|
||||
commit('STORE_CURRENT_FOLDER', {
|
||||
name: 'Invoices',
|
||||
id: undefined,
|
||||
location: 'invoices',
|
||||
location: 'regular-invoice',
|
||||
})
|
||||
|
||||
axios
|
||||
@@ -32,7 +32,7 @@ const actions = {
|
||||
commit('STORE_CURRENT_FOLDER', {
|
||||
name: 'Advance Invoices',
|
||||
id: undefined,
|
||||
location: 'advance-invoices',
|
||||
location: 'advance-invoice',
|
||||
})
|
||||
|
||||
axios
|
||||
@@ -68,6 +68,35 @@ const actions = {
|
||||
events.$emit('scrollTop')
|
||||
})
|
||||
},
|
||||
getSearchResultForInvoices: ({commit, getters}, query) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
commit('CHANGE_SEARCHING_STATE', true)
|
||||
|
||||
axios
|
||||
.get('/api/oasis/invoices/search', {
|
||||
params: {
|
||||
query: query,
|
||||
type: getters.currentFolder.location,
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
})
|
||||
.catch(() => Vue.prototype.$isSomethingWrong())
|
||||
},
|
||||
getSearchResultForClients: ({commit, getters}, query) => {
|
||||
commit('LOADING_STATE', {loading: true, data: []})
|
||||
commit('CHANGE_SEARCHING_STATE', true)
|
||||
|
||||
axios
|
||||
.get('/api/oasis/clients/search', {
|
||||
params: {query: query}
|
||||
})
|
||||
.then(response => {
|
||||
commit('LOADING_STATE', {loading: false, data: response.data})
|
||||
})
|
||||
.catch(() => Vue.prototype.$isSomethingWrong())
|
||||
},
|
||||
deleteClient: ({commit, getters}, payload) => {
|
||||
//
|
||||
},
|
||||
|
||||
@@ -141,7 +141,7 @@ class OasisInvoiceTest extends TestCase
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular_invoice'
|
||||
'invoice_type' => 'regular-invoice'
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/regular')
|
||||
@@ -163,7 +163,7 @@ class OasisInvoiceTest extends TestCase
|
||||
$invoice = Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'advance_invoice'
|
||||
'invoice_type' => 'advance-invoice'
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/advance')
|
||||
@@ -185,19 +185,19 @@ class OasisInvoiceTest extends TestCase
|
||||
Invoice::factory(Invoice::class)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
'invoice_type' => 'regular_invoice',
|
||||
'invoice_type' => 'regular-invoice',
|
||||
'invoice_number' => 2001212,
|
||||
'client' => [
|
||||
'name' => 'VueFileManager Inc.',
|
||||
]
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular_invoice&query=2001212')
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular-invoice&query=2001212')
|
||||
->assertJsonFragment([
|
||||
'invoiceNumber' => '2001212',
|
||||
])->assertStatus(200);
|
||||
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular_invoice&query=Vue')
|
||||
$this->getJson('/api/oasis/invoices/search?type=regular-invoice&query=Vue')
|
||||
->assertJsonFragment([
|
||||
'invoiceNumber' => '2001212',
|
||||
])->assertStatus(200);
|
||||
|
||||
Reference in New Issue
Block a user