Many fixes n stuff
This commit is contained in:
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
HFSPlay stock management
|
HFSPlay stock management
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
- [ ] fix style
|
||||||
|
- [ ] handle file upload
|
||||||
|
- [ ] editable categories
|
||||||
|
- [ ] qrcode generation
|
||||||
|
|
||||||
## Install the dependencies
|
## Install the dependencies
|
||||||
```bash
|
```bash
|
||||||
yarn
|
yarn
|
||||||
|
@ -57,7 +57,6 @@ export default {
|
|||||||
return date.formatDate(timestamp, format)
|
return date.formatDate(timestamp, format)
|
||||||
},
|
},
|
||||||
timeAgo (timestamp) {
|
timeAgo (timestamp) {
|
||||||
console.log('timestamp', timestamp)
|
|
||||||
let date1 = new Date(timestamp)
|
let date1 = new Date(timestamp)
|
||||||
let date2 = Date.now()
|
let date2 = Date.now()
|
||||||
let hoursDiff = date.getDateDiff(date2, date1, 'hours')
|
let hoursDiff = date.getDateDiff(date2, date1, 'hours')
|
||||||
|
@ -11,22 +11,19 @@
|
|||||||
v-if="searchResults.length > 0"
|
v-if="searchResults.length > 0"
|
||||||
class="q-mb-lg"
|
class="q-mb-lg"
|
||||||
>
|
>
|
||||||
<q-item-label>{{searchResults.length}} résultats de recherche pour "{{srcTxt}}"</q-item-label>
|
<q-item-label header>{{searchResults.length}} résultats de recherche pour "{{srcTxt}}"</q-item-label>
|
||||||
<q-item multiline
|
<q-item multiline
|
||||||
link
|
link
|
||||||
:class="{'text-red': result.deleted}"
|
:class="{'text-red': result.deleted}"
|
||||||
v-for="result in searchResults"
|
v-for="result in searchResults"
|
||||||
:disabled="result.deleted"
|
|
||||||
:key="result.ref"
|
:key="result.ref"
|
||||||
:to="`item/${result.ref}`"
|
:to="`item/${result.ref}`"
|
||||||
>
|
>
|
||||||
<q-item-section>
|
|
||||||
<q-item-section label>{{ result.name }}</q-item-section>
|
<q-item-section label>{{ result.name }}</q-item-section>
|
||||||
<q-item-section sublabel>
|
<q-item-section caption>
|
||||||
#{{result.ref}}, dans <span class="text-secondary">{{result.type}}</span>
|
<div>#{{ result.ref }}, dans <b class="text-secondary">{{ result.type }}</b></div>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item-section>
|
<q-item-section side>{{`Etat: ${result.state}`}}</q-item-section>
|
||||||
<q-item-section right :stamp="`Etat: ${result.state}`"/>
|
|
||||||
</q-item>
|
</q-item>
|
||||||
<!-- <q-item-separator />-->
|
<!-- <q-item-separator />-->
|
||||||
</q-list>
|
</q-list>
|
||||||
|
@ -11,17 +11,26 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<template v-slot:top>
|
<template v-slot:top>
|
||||||
|
<div class="full-width">
|
||||||
<q-toggle v-model="showDeleted"
|
<q-toggle v-model="showDeleted"
|
||||||
label="Voir items supprimés"
|
label="Voir items supprimés"
|
||||||
class="q-mr-md"
|
class="q-mr-md float-right"
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
hide-underline
|
borderless
|
||||||
|
clearable
|
||||||
|
icon="search"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
v-model="search"
|
v-model="search"
|
||||||
class="col-6"
|
class="col-6"
|
||||||
@input="updateSearchUrl"
|
@input="updateSearchUrl"
|
||||||
/>
|
placeholder="Search"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon name="search" color="secondary" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
import { pb } from 'src/boot/pocketbase'
|
import { pb } from 'src/boot/pocketbase'
|
||||||
//
|
|
||||||
// export function loadAppData (store) {
|
|
||||||
// return Firebase.database().ref().once('value').then((snapshot) => {
|
|
||||||
// store.commit('setFirebaseState', snapshot.val())
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
export async function loadAppData (store) {
|
export async function loadAppData (store) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
pb.collection('stock').getFullList(),
|
pb.collection('stock').getFullList(),
|
||||||
@ -20,42 +14,18 @@ export async function loadAppData (store) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// export function addToCollection (store, data) {
|
|
||||||
// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => {
|
|
||||||
// let index = parseInt(Object.keys(snapshot.val()).reverse()[0]) + 1
|
|
||||||
// return Firebase.database().ref('/' + data.collection + '/' + index).set(data.data)
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
export function addToCollection (store, data) {
|
export function addToCollection (store, data) {
|
||||||
return pb.collection(data.collection).create(data.data)
|
return pb.collection(data.collection).create(data.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// export function removeFromCollection (store, data) {
|
|
||||||
// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => {
|
|
||||||
// let index = snapshot.val().findIndex(item =>
|
|
||||||
// item.timestamp === data.data.timestamp && item.ref === data.data.ref
|
|
||||||
// )
|
|
||||||
// return Firebase.database().ref('/' + data.collection + '/' + index).remove()
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
export function removeFromCollection (store, data) {
|
export function removeFromCollection (store, data) {
|
||||||
return pb.collection(data.collection).delete(data.data.id)
|
return pb.collection(data.collection).delete(data.data.id)
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// export function updateItem (store, data) {
|
|
||||||
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(data.data)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
export function updateItem (store, data) {
|
export function updateItem (store, data) {
|
||||||
return pb.collection(data.collection).update(data.data.id, data.data)
|
return pb.collection(data.collection).update(data.data.id, data.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// export function deleteItem (store, data) {
|
|
||||||
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(null)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
export function deleteItem (store, data) {
|
export function deleteItem (store, data) {
|
||||||
return pb.collection(data.collection).delete(data.data.id)
|
return pb.collection(data.collection).delete(data.data.id)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user