Skip to content

Commit

Permalink
feat: update shop table
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrycu committed Apr 27, 2021
1 parent 1fbf640 commit 9cd41dd
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 32 deletions.
7 changes: 7 additions & 0 deletions scripts/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ async function get_player_actors() {
return pcs;
}

function send_item_to_user(...args) {
console.log(...args)
}

class ShopGenerator extends FormApplication {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
Expand Down Expand Up @@ -267,6 +271,9 @@ class ShopGenerator extends FormApplication {
label: "Don't show again",
callback: () => game.settings.set("JB2A_DnD5e", "runonlyonce", true)
},
three: {
callback: send_item_to_user
}
},
}, {
// options
Expand Down
71 changes: 39 additions & 32 deletions templates/shop_generator_inventory.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@

<h2>Store Inventory</h2>

<table border="1">
<tbody>
<tr>
<td>Image</td>
<td>Item</td>
<td>Type</td>
<td>Price</td>
<td>Roll Result</td>
<td>Action</td>
</tr>
{{#each inventory as |item|}}
<tr>
<td><img height="64" src="{{item.item.image}}" width="128"></td>
<td>
<a class="entity-link" data-id="{{item.item.id}}" data-pack="{{item.item.compendium}}" draggable="true">
{{item.item.name}}
</a>
</td>
<td>{{item.item.type}}</td>
<td>{{item.price}}</td>
<td>{{{item.roll}}}</td>
<td>
{{log 'hello' actors}}
</td>
</tr>
{{/each}}
</tbody>
</table>


<h2>Store Inventory</h2>

<table border="1">
<tbody>
<tr>
<td>Image</td>
<td>Item</td>
<td>Type</td>
<td>Price</td>
<td>Roll Result</td>
<!--<td>Action</td>-->
</tr>
{{#inventory}}
<tr>
<td><img height="64" src="{{item.image}}" width="128"></td>
<td>
<a class="entity-link" data-id="{{item.id}}" data-pack="{{item.compendium}}" draggable="true">
{{item.name}}
</a>
</td>
<td>{{item.type}}</td>
<td>{{price}}</td>
<td>{{{roll}}}</td>
<td>
<!--
this section is non-functional as of now
<select id="shop_actor" name="shop_actor">
{{#each ../actors}}
<option value="{{this.data.id}}">{{this.data.name}}</option>
{{/each}}
</select>
<div class="dialog"><div class="dialog-buttons">
<button class="dialog-button three" data-button="three"><i class="fas fa-plus"></i>Send</button>
</div></div>
-->
</td>
</tr>
{{/inventory}}
</tbody>
</table>

0 comments on commit 9cd41dd

Please sign in to comment.