mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 12:46:54 +00:00
feature/ add ATM Attribute in update ATM
This commit is contained in:
parent
bce119802b
commit
69818aa353
@ -206,14 +206,14 @@ class CreateAtmForm(forms.Form):
|
||||
required=False,
|
||||
)
|
||||
has_deposit_capability = forms.ChoiceField(
|
||||
label=_('Deposit Capabilities'),
|
||||
widget=forms.Select(
|
||||
attrs={
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
label=_('Deposit Capabilities'),
|
||||
widget=forms.Select(
|
||||
attrs={
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
supported_languages = forms.CharField(
|
||||
label=_('Supported Languages'),
|
||||
widget=forms.TextInput(
|
||||
|
||||
@ -1,50 +1,5 @@
|
||||
$(document).ready(function($) {
|
||||
$('.runner button.forSave').click(function(e) {
|
||||
e.preventDefault();
|
||||
let runner = $(this).parent().parent().parent();
|
||||
let name = $(runner).find('.atm_attribute_name').val();
|
||||
let type = $(runner).find('.atm_attribute_type').val();
|
||||
let value = $(runner).find('.atm_attribute_value').val();
|
||||
$('.runner button.forUpdate').attr("disabled","disabled");
|
||||
$('.runner button.forSave').attr("disabled","disabled");
|
||||
$('.runner button.forDelete').attr("disabled","disabled");
|
||||
$.post('save/attribute', {
|
||||
'name': name,
|
||||
'type': type,
|
||||
'value': value,
|
||||
}, function (response) {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
$('.runner button.forUpdate').click(function(e) {
|
||||
e.preventDefault();
|
||||
let runner = $(this).parent().parent().parent();
|
||||
let name = $(runner).find('.atm_attribute_name').val();
|
||||
let type = $(runner).find('.atm_attribute_type').val();
|
||||
let value = $(runner).find('.atm_attribute_value').val();
|
||||
$('.runner button.forUpdate').attr("disabled","disabled");
|
||||
$('.runner button.forSave').attr("disabled","disabled");
|
||||
$('.runner button.forDelete').attr("disabled","disabled");
|
||||
$.post('updateattribute/attribute', {
|
||||
'name': name,
|
||||
'type': type,
|
||||
'value': value,
|
||||
}, function (response) {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
|
||||
$('.runner button.forDelete').click(function(e) {
|
||||
e.preventDefault();
|
||||
let runner = $(this).parent().parent().parent();
|
||||
let atm_attribute_id = $(runner).find('.atm_attribute_id').attr("value");
|
||||
$('.runner button.forUpdate').attr("disabled","disabled");
|
||||
$('.runner button.forSave').attr("disabled","disabled");
|
||||
$('.runner button.forDelete').attr("disabled","disabled");
|
||||
$.post('delete/attribute', {
|
||||
'atm_attribute_id': atm_attribute_id
|
||||
}, function (response) {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
$('#info').click(function() {
|
||||
alert("Hello World")
|
||||
});
|
||||
});
|
||||
|
||||
@ -203,6 +203,7 @@
|
||||
<div class="form-group">
|
||||
{{ form.address.label_tag }} {{ form.address }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.lobby.errors %}
|
||||
@ -211,6 +212,7 @@
|
||||
{{ form.lobby.label_tag }} {{ form.lobby }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="submit" value="Update" class="btn btn-primary"/>
|
||||
</form>
|
||||
|
||||
@ -261,13 +261,12 @@ class UpdateAtmsView(LoginRequiredMixin, FormView):
|
||||
my_supported_languages = result['supported_languages']
|
||||
supported_languages_initial = ','.join(my_supported_languages)
|
||||
fields['supported_languages'].initial = supported_languages_initial
|
||||
|
||||
my_accessibility_features = result['accessibility_features']
|
||||
my_accessibility_features_initial = ','.join(my_accessibility_features)
|
||||
fields['accessibility_features'].initial = my_accessibility_features_initial
|
||||
self._paylod_choices(result, fields)
|
||||
except APIError as err:
|
||||
messages.error(self.request, err)
|
||||
except Exception as err:
|
||||
messages.error(self.request, "Unknown Error {}".format(err))
|
||||
return form
|
||||
|
||||
def _paylod_choices(self, result, fields):
|
||||
@ -352,6 +351,7 @@ class UpdateAtmsView(LoginRequiredMixin, FormView):
|
||||
messages.success(self.request, msg)
|
||||
return super(UpdateAtmsView, self).form_valid(form)
|
||||
def _update_boolean_payload1(self, data):
|
||||
|
||||
return {
|
||||
"is_accessible": data["is_accessible"] if data["is_accessible"]!="" else "false",
|
||||
"located_at": data["located_at"] if data["located_at"]!="no-example-provided" else " ",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user