Commit e640f6b4 authored by Prajkta Patkar's avatar Prajkta Patkar
Browse files

Merge branch 'issue#573' into 'devel'

Issue #573

See merge request !515
parents 2a372429 d76be139
......@@ -28,7 +28,7 @@ Contributors:
$(document).ready(function() {
$('.modal-backdrop').remove();
$("#egdnsubmit").hide();
var prod = 0;
$("#editgoddet").bind("change", function(e) {
$("#egdnsubmit").hide();
var goid = $("#editgoddet option:selected").val();
......@@ -64,8 +64,27 @@ $(document).ready(function() {
$("#edit").show();
}
});
$.ajax({
type: "POST",
url: "/godown?type=numOfProdInGodown",
data: {
"goid": goid
},
global: false,
async: false,
dataType: "json",
beforeSend: function(xhr) {
xhr.setRequestHeader('gktoken', sessionStorage.gktoken);
},
success: function(resp) {
prod = resp["gkresult"]
}
});
});
$("#edit").click(function(event) {
event.preventDefault();
$("#egdnsubmit").show();
......@@ -167,6 +186,7 @@ $(document).ready(function() {
$('.modal').modal('hide');
$('#m_confirmdel').modal('show').on('click', '#goddel', function(e) {
if (prod==0) {
var goid = $("#editgoddet option:selected").val();
$.ajax({
type: "POST",
......@@ -197,7 +217,15 @@ $(document).ready(function() {
}
}
});
});}
else{
$("#prod-alert").alert();
$("#prod-alert").fadeTo(2250, 500).slideUp(500, function() {
$("#prod-alert").hide();
});
$("#editgoddet").focus().select();
return false;
}
});
$('#m_confirmdel').on('shown.bs.modal', function(event) {
$("#m_cancel").focus();
......
......@@ -5,6 +5,10 @@
<a href="" class="close" aria-label="close">&times;</a>
{% trans %}Godown edited successfully.{% endtrans %}
</div>
<div class="alert alert-danger" id="prod-alert" aria-live="rude" role="alert" hidden>
{% trans %}Cannot Delete Godown, Godown Contains Product!{% endtrans %}
</div>
<div class="alert alert-success" id="delsuccess-alert" aria-live="rude" role="alert" hidden>
<a href="" class="close" aria-label="close">&times;</a>
......
......@@ -26,7 +26,7 @@ Contributors:
"Navin Karkera" <navin@dff.org.in>
"Bhavesh Bawadhane" <bbhavesh07@gmail.com>
"Abhijith Balan" <abhijithb21@openmailbox.org>
"Moh. Talha Pawaty" <mtalha456@gmail.com>
"Mohd. Talha Pawaty" <mtalha456@gmail.com>
"""
from pyramid.view import view_config
......@@ -106,6 +106,12 @@ def getallgodowns(request):
goddata.append(gdata)
return {"gkresult":goddata}
@view_config(route_name="godown",request_param="type=numOfProdInGodown", renderer="json")
def getProdInGodown(request):
header={"gktoken":request.headers["gktoken"]}
result = requests.get("http://127.0.0.1:6543/godown?type=goproduct&goid=%d"%int(request.params["goid"]), headers=header)
return{"gkresult":result.json()["gkresult"],"gkstatus":result.json()["gkstatus"]}
@view_config(route_name="godown",request_param="type=getgoddetails", renderer="json")
def getgoddetails(request):
header={"gktoken":request.headers["gktoken"]}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment