Many fixes n stuff
This commit is contained in:
@ -2,6 +2,12 @@
|
||||
|
||||
HFSPlay stock management
|
||||
|
||||
## TODO
|
||||
- [ ] fix style
|
||||
- [ ] handle file upload
|
||||
- [ ] editable categories
|
||||
- [ ] qrcode generation
|
||||
|
||||
## Install the dependencies
|
||||
```bash
|
||||
yarn
|
||||
|
@ -57,7 +57,6 @@ export default {
|
||||
return date.formatDate(timestamp, format)
|
||||
},
|
||||
timeAgo (timestamp) {
|
||||
console.log('timestamp', timestamp)
|
||||
let date1 = new Date(timestamp)
|
||||
let date2 = Date.now()
|
||||
let hoursDiff = date.getDateDiff(date2, date1, 'hours')
|
||||
|
@ -11,22 +11,19 @@
|
||||
v-if="searchResults.length > 0"
|
||||
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
|
||||
link
|
||||
:class="{'text-red': result.deleted}"
|
||||
v-for="result in searchResults"
|
||||
:disabled="result.deleted"
|
||||
:key="result.ref"
|
||||
:to="`item/${result.ref}`"
|
||||
>
|
||||
<q-item-section>
|
||||
<q-item-section label>{{ result.name }}</q-item-section>
|
||||
<q-item-section sublabel>
|
||||
#{{result.ref}}, dans <span class="text-secondary">{{result.type}}</span>
|
||||
<q-item-section caption>
|
||||
<div>#{{ result.ref }}, dans <b class="text-secondary">{{ result.type }}</b></div>
|
||||
</q-item-section>
|
||||
</q-item-section>
|
||||
<q-item-section right :stamp="`Etat: ${result.state}`"/>
|
||||
<q-item-section side>{{`Etat: ${result.state}`}}</q-item-section>
|
||||
</q-item>
|
||||
<!-- <q-item-separator />-->
|
||||
</q-list>
|
||||
|
@ -11,17 +11,26 @@
|
||||
>
|
||||
|
||||
<template v-slot:top>
|
||||
<div class="full-width">
|
||||
<q-toggle v-model="showDeleted"
|
||||
label="Voir items supprimés"
|
||||
class="q-mr-md"
|
||||
class="q-mr-md float-right"
|
||||
/>
|
||||
<q-input
|
||||
hide-underline
|
||||
borderless
|
||||
clearable
|
||||
icon="search"
|
||||
color="secondary"
|
||||
v-model="search"
|
||||
class="col-6"
|
||||
@input="updateSearchUrl"
|
||||
/>
|
||||
placeholder="Search"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="search" color="secondary" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:body="props">
|
||||
|
@ -1,11 +1,5 @@
|
||||
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) {
|
||||
return Promise.all([
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
return pb.collection(data.collection).delete(data.data.id)
|
||||
}
|
||||
|
Reference in New Issue
Block a user