Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $scope.showNewContactDialog = function($event) {
- var parentEl = angular.element(document.body);
- $mdDialog.show({
- parent: parentEl,
- targetEvent: $event,
- templateUrl: 'app/Pages/directory/contacts/newContact.dialog.html',
- controller: NewCompanyContactDialogCtrl,
- clickOutsideToClose: true,
- hasBackdrop: true
- });
- };
- // New User dialog controller
- function NewCompanyContactDialogCtrl($scope, $mdDialog) {
- var self = this;
- $scope.modalIcon = "add";
- $scope.modalTitle = 'Nová položka';
- $scope.modalAdvanced = true;
- // Country Selector
- apiCalls.getData(countryUrl, function(response){
- $scope.countries = response;
- })
- // Add New Object
- $scope.newItem = function() {
- var url = baseUrl + 'new/';
- var data = JSON.stringify({
- code: $scope.newItem.contactCode,
- first_name: $scope.newItem.contactFirstName,
- last_name: $scope.newItem.contactLastName,
- street: $scope.newItem.contactStreet,
- city: $scope.newItem.contactCity,
- country: $scope.newItem.contactCountry,
- postal: $scope.newItem.contactPostal,
- pobox: $scope.newItem.contactPobox,
- price_lvl: $scope.newItem.contactPriceLvl,
- orgid: $cookies.get('orgid')
- });
- apiCalls.postData(url, data, function(response){
- console.log(response);
- // Toast
- if(response.status == 201){
- $mdToast.show(
- $mdToast.simple()
- .textContent('Záznam bol vytvorený.')
- .position('bottom right')
- .action('Skryť')
- .highlightAction(true)
- .highlightClass('md-warn')
- );
- $mdDialog.cancel();
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement