starts working on ItemInput
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<PlayerView :id="state.player_id"
|
<PlayerView
|
||||||
v-slot="{ player, loot, notifications, actions }">
|
:id="state.player_id"
|
||||||
|
v-slot="{ player, loot, notifications, actions }"
|
||||||
|
>
|
||||||
<main id="app" class="container">
|
<main id="app" class="container">
|
||||||
<header>
|
<header>
|
||||||
<HeaderBar :app_state="state">
|
<HeaderBar :app_state="state">
|
||||||
<template v-slot:title>{{ player.name }}</template>
|
<template v-slot:title>
|
||||||
|
{{ player.name }}
|
||||||
|
</template>
|
||||||
<template v-slot:links>
|
<template v-slot:links>
|
||||||
<a class="navbar-item">History of Loot</a>
|
<a class="navbar-item">History of Loot</a>
|
||||||
<template v-if="playerIsGroup">
|
<template v-if="playerIsGroup">
|
||||||
@@ -24,20 +28,26 @@
|
|||||||
<Wealth
|
<Wealth
|
||||||
:wealth="[player.cp, player.sp, player.gp, player.pp]"
|
:wealth="[player.cp, player.sp, player.gp, player.pp]"
|
||||||
:debt="player.debt"
|
:debt="player.debt"
|
||||||
@update="actions.updateWealth">
|
@update="actions.updateWealth"
|
||||||
</Wealth>
|
></Wealth>
|
||||||
<p v-show="notifications.length > 0">{{ notifications }}</p>
|
<p v-show="notifications.length > 0">{{ notifications }}</p>
|
||||||
</header>
|
</header>
|
||||||
<nav>
|
<nav>
|
||||||
<div class="tabs is-centered is-boxed is-medium">
|
<div class="tabs is-centered is-boxed is-medium">
|
||||||
<ul>
|
<ul>
|
||||||
<li :class="{ 'is-active': activeView == 'group' }">
|
<li :class="{ 'is-active': activeView == 'group' }">
|
||||||
<a @click="switchView('group')">Coffre de groupe</a></li>
|
<a @click="switchView('group')">
|
||||||
<li :class="{ 'is-active': activeView == 'player' }"
|
Coffre de groupe
|
||||||
v-show="!playerIsGroup">
|
</a>
|
||||||
<a @click="switchView('player')">Mon coffre</a></li>
|
</li>
|
||||||
|
<li v-show="!playerIsGroup" :class="{ 'is-active': activeView == 'player' }">
|
||||||
|
<a @click="switchView('player')">
|
||||||
|
Mon coffre
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li :class="{'is-active': activeView == 'adding' }">
|
<li :class="{'is-active': activeView == 'adding' }">
|
||||||
<a class="has-text-grey-light" @click="switchView('adding')">
|
<a class="has-text-grey-light"
|
||||||
|
@click="switchView('adding')">
|
||||||
+ {{ playerIsGroup ? 'Nouveau Loot' : 'Acheter' }}
|
+ {{ playerIsGroup ? 'Nouveau Loot' : 'Acheter' }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -46,9 +56,9 @@
|
|||||||
</nav>
|
</nav>
|
||||||
<main class="section">
|
<main class="section">
|
||||||
<template v-if="isAdding">
|
<template v-if="isAdding">
|
||||||
<h2 v-show="playerIsGroup">ItemInput</h2>
|
<ItemInput v-if="playerIsGroup" :source="state.inventory" @addItem="item => pending_loot.push(item)"></ItemInput>
|
||||||
<AddingChest
|
<AddingChest
|
||||||
:items="playerIsGroup ? [] : state.inventory"
|
:items="playerIsGroup ? pending_loot : state.inventory"
|
||||||
:perms="playerIsGroup ? {} : { canBuy: true }"
|
:perms="playerIsGroup ? {} : { canBuy: true }"
|
||||||
@buy="(data) => { switchView('player'); actions.buyItems(data); }">
|
@buy="(data) => { switchView('player'); actions.buyItems(data); }">
|
||||||
</AddingChest>
|
</AddingChest>
|
||||||
@@ -73,6 +83,7 @@ import PlayerView from './components/PlayerView.js'
|
|||||||
import HeaderBar from './components/HeaderBar.vue'
|
import HeaderBar from './components/HeaderBar.vue'
|
||||||
import Wealth from './components/Wealth.vue'
|
import Wealth from './components/Wealth.vue'
|
||||||
import Chest from './components/Chest.vue'
|
import Chest from './components/Chest.vue'
|
||||||
|
import ItemInput from './components/ItemInput.vue'
|
||||||
import { AppStorage } from './AppStorage'
|
import { AppStorage } from './AppStorage'
|
||||||
|
|
||||||
function getCookie(cname) {
|
function getCookie(cname) {
|
||||||
@@ -98,6 +109,7 @@ export default {
|
|||||||
state: AppStorage.state,
|
state: AppStorage.state,
|
||||||
activeView: 'group',
|
activeView: 'group',
|
||||||
shopInventory: [{id: 1, name: "Item from shop #1", base_price: 2000}],
|
shopInventory: [{id: 1, name: "Item from shop #1", base_price: 2000}],
|
||||||
|
pending_loot: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -105,7 +117,8 @@ export default {
|
|||||||
HeaderBar,
|
HeaderBar,
|
||||||
'AddingChest': Chest, // Alias to prevent component re-use
|
'AddingChest': Chest, // Alias to prevent component re-use
|
||||||
Chest,
|
Chest,
|
||||||
Wealth
|
Wealth,
|
||||||
|
ItemInput,
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
// Initiate with active player set to value found in cookie
|
// Initiate with active player set to value found in cookie
|
||||||
|
|||||||
@@ -1,38 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container is-paddingless">
|
<div class="container is-paddingless">
|
||||||
|
<p class="heading">Ajouter un objet</p>
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="control is-expanded"
|
<div class="control is-expanded" :class="{'is-loading': is_loading }">
|
||||||
:class="{'is-loading': is_loading }">
|
|
||||||
<input type="text"
|
<input type="text"
|
||||||
v-model="item_name"
|
v-model="item_name"
|
||||||
@input="autoCompletion"
|
@input="autocompletion"
|
||||||
class="input"
|
class="input"
|
||||||
:class="{'is-danger': no_results,
|
:class="{'is-danger': no_results,
|
||||||
'is-warning': auto_open}"
|
'is-warning': auto_open}"
|
||||||
autocomplete="on">
|
autocomplete="on"
|
||||||
</input>
|
></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input type="text" class="input"
|
<input type="text"
|
||||||
|
class="input"
|
||||||
:class="{'is-danger': !item_price}"
|
:class="{'is-danger': !item_price}"
|
||||||
v-model.number="item_price"></input>
|
v-model.number="item_price"
|
||||||
|
></input>
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button class="button is-primary"
|
<button class="button is-primary"
|
||||||
:disabled="no_results"
|
:disabled="no_results"
|
||||||
@click="addItem"
|
@click="additem"
|
||||||
>+</button>
|
>+</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown" :class="{'is-active': auto_open}">
|
<div class="dropdown" :class="{'is-active': auto_open}">
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<div class="dropdown-content">
|
<div class="dropdown-content">
|
||||||
<a v-for="(result,i) in results" :key="i"
|
<a v-for="(result,i) in results"
|
||||||
@click="setResult(result)"
|
:key="i"
|
||||||
|
@click="setresult(result)"
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
>
|
>{{ result.name }}</a>
|
||||||
{{ result.name }}
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
this.no_results = false;
|
this.no_results = false;
|
||||||
} else {
|
} else {
|
||||||
this.results = this.source.filter(item => {
|
this.results = this.source.filter(item => {
|
||||||
return item.name.includes(this.item_name);
|
return item.name.toUpperCase().includes(this.item_name.toUpperCase());
|
||||||
});
|
});
|
||||||
// Update status
|
// Update status
|
||||||
if (this.results.length == 0) {
|
if (this.results.length == 0) {
|
||||||
@@ -76,13 +77,13 @@
|
|||||||
},
|
},
|
||||||
setResult(result) {
|
setResult(result) {
|
||||||
this.item_name = result.name;
|
this.item_name = result.name;
|
||||||
this.item_price = result.sell_value;
|
this.item_price = result.base_price;
|
||||||
this.auto_open = false;
|
this.auto_open = false;
|
||||||
},
|
},
|
||||||
addItem () {
|
addItem () {
|
||||||
this.$emit("addItem", {
|
this.$emit("addItem", {
|
||||||
name: this.item_name,
|
name: this.item_name,
|
||||||
sell_value: this.item_price
|
base_price: this.item_price
|
||||||
});
|
});
|
||||||
this.item_name = '';
|
this.item_name = '';
|
||||||
this.item_price = '';
|
this.item_price = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user