diff --git a/src/App.vue b/src/App.vue index 3c03016..c2b8bba 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,102 +4,77 @@

-
+ + +
+ +
Add data to database
- -
- - -
+ +
+ placeholder="Enter Address" />
- -
+ placeholder="Enter Cost" />
-
+

Edit data to database
- -
- - -
- - -
+ +
+ placeholder="Enter new Name" />
- -
+ +
+ placeholder="Enter new Cost" />


-
-
Enter user ID to delete data from the database
- - -
- -

-
All Data ({{this.base.length}})

+

+ +
+
    +
  • id: {{item.id}}
  • +
  • Address: {{item.address}}
  • +
  • Name: {{item.name_uz}}
  • +
  • Cost: {{item.cost}}
  • +
  • Product type ID: {{item.product_type_id}}
  • +

+
- -


@@ -127,9 +102,12 @@ export default { edit_inp_data_name: String(""), edit_inp_data_address: String(""), edit_inp_data_cost: Number(0), + + add_block_visible: Boolean(false) } }, methods: { + showAddBlock() {this.add_block_visible = true;}, createPagination() { let array = this.base; let size = 3; @@ -139,6 +117,15 @@ export default { } this.pagination = this.pagiDB[this.pageInt - 1]; }, + async deleteItemBtn(event) { + try { + let response = await fetch("http://94.158.54.194:9092/api/product/" + event.target.childNodes[1].innerHTML, { + method: "DELETE" + }); + } catch (error) {alert(error.message);} + + this.updateDB(); + }, pagiButtons(event) { this.pageInt = Number(event.target.innerHTML); this.pagination = this.pagiDB[this.pageInt - 1]; @@ -148,8 +135,6 @@ export default { event.target.style = "border: 2px solid springgreen; background: springgreen"; this.lastBtn = event.target; - - console.log(event.target); }, generateProductID(min, max) { let rand = min + Math.random() * (max + 1 - min); @@ -182,6 +167,7 @@ export default { }); } catch (error) {} + this.add_block_visible = false; this.updateDB(); }, async editDataBtn() { @@ -217,15 +203,6 @@ export default { this.updateDB(); }, - async deleteBtn() { - try { - let response = await fetch("http://94.158.54.194:9092/api/product/" + this.inp_del_id, { - method: "DELETE" - }); - } catch (error) {alert(error.message);} - - this.updateDB(); - }, async fetch_data() { try { let response = await fetch("http://94.158.54.194:9092/api/product?page=1&perPage=10", { @@ -245,7 +222,11 @@ export default {