Commit 27797fd5 authored by bahadircyildiz's avatar bahadircyildiz

CHANGE rref #5257. Confirm submit part implemented, put on formservicepg for testing

parent c247db93
......@@ -18,7 +18,7 @@ angular.module('ulakbus.uitemplates', ['ngRoute', 'schemaForm', 'ulakbus.formSer
"name" for defining the name shown in dropdown box. Paste the JSON of form as a member of $scope.forms.
*/
.controller('FormServicePg', function ($scope, Generator) {
.controller('FormServicePg', function ($scope, Generator, $timeout) {
$scope.forms = [
{
name: 'Deneme Form 1',
......@@ -35,17 +35,18 @@ angular.module('ulakbus.uitemplates', ['ngRoute', 'schemaForm', 'ulakbus.formSer
}
},
{
name: 'Deneme Form 2',
form: ['email', 'id', 'name'],
name: 'Confirm Form Trial',
form: ['email', 'id', 'name', 'confirm'],
schema: {
properties: {
email: {title: 'email', type: 'string'},
id: {title: 'id', type: 'number'},
name: {title: 'name', type: 'string'}
name: {title: 'name', type: 'string'},
confirm: {title: 'Confirm Form', style:"btn-success", type:'confirm', confirm_message: "zaaa xDê", cmd:"list_user"}
}, required: [], type: 'object', title: 'servicetest'
},
model: {
email: 'test@test.com', id: 2, name: 'cageman'
email: 'test@test.com', id: 3, name: 'cageman'
}
}
];
......@@ -55,6 +56,9 @@ angular.module('ulakbus.uitemplates', ['ngRoute', 'schemaForm', 'ulakbus.formSer
$scope.selectform = function (index) {
var form = $scope.forms[index];
$scope = Generator.generate($scope, {forms: form});
$timeout(function(){
$scope.$apply();
})
};
$scope.selectform($scope.selection);
});
\ No newline at end of file
......@@ -610,9 +610,30 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
name: k,
key: k,
cmd: v.cmd,
style: v.style,
confirm: function () {
console.log(v.cmd);
// send cmd with submit
generator.submit(scope, false)
// .success(function(data){
// // response data contains object_id and unicode
// // scope.model can be reached via prototype chain
// scope.model[formName] = data.forms.model.object_key;
// // scope.form prototype chain returns this form item
// scope.form.titleMap.push({
// value: data.forms.model.object_key,
// name: data.forms.model.unicode
// });
// scope.form.selected_item = {
// value: data.forms.model.object_key,
// name: data.forms.model.unicode
// };
// scope.$watch(document.querySelector('input[name=' + scope.form.model_name + ']'),
// function () {
// angular.element(document.querySelector('input[name=' + scope.form.model_name + ']')).val(scope.form.selected_item.name);
// }
// );
// });
}
};
......
Markdown is supported
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