From f885c7f2cbd091136988176a7ed7bdfed8d6d426 Mon Sep 17 00:00:00 2001 From: ydb5755 Date: Thu, 10 Oct 2024 15:21:55 +0300 Subject: [PATCH] updating budget cat for vendors --- app/routes.py | 4 ++++ app/static/vendors.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index d90b643..a58dcd0 100644 --- a/app/routes.py +++ b/app/routes.py @@ -153,5 +153,9 @@ def get_month_line_items(month:str, year:str): line_item_list.append(line_item_data) return jsonify(line_item_list) +@app.route('/update_vendors_budget_category//', methods=['POST']) +def update_vendors_budget_category(vendor_id, updated_budget_name): + db.session.execute(update(Vendor).values().where(id=vendor_id)) + return {"status":'success'} \ No newline at end of file diff --git a/app/static/vendors.js b/app/static/vendors.js index c92feca..a0de1db 100644 --- a/app/static/vendors.js +++ b/app/static/vendors.js @@ -7,6 +7,11 @@ async function deleteVendor(id){ document.getElementById(`${id}-row`).remove(); } +async function updateBudgetCategory(id, updatedName){ + var result = await fetch(`/delete_vendor/${id}/${updatedName}`, {method:'POST'}); + var data = await result.json(); +} + function startEditMode(id){ for(let i = 0; i < reassignButtons.length; i++){ reassignButtons[i].disabled = true; @@ -31,10 +36,10 @@ function startEditMode(id){ document.addEventListener('keydown', handleKeydown); const vendor = document.getElementById(`bc-line-${id}`); - console.log(id) var placeholderText = vendor.innerText vendor.innerText = '' var inputElem = document.createElement("input"); + inputElem.className = "form-control"; inputElem.value = placeholderText; inputElem.id = `bc-input-${id}` vendor.appendChild(inputElem);