Created
May 4, 2015 12:53
-
-
Save Johan-ZeLearner/079b933d8f3ad76f9527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form ng-submit="saveItem(customer_profile)" method="post" class="smart-form" novalidate="novalidate"> | |
<header>Edition : profil client</header> | |
<fieldset> | |
<div class="row"> | |
<section> | |
<label class="label">Nom</label> | |
<label class="input"> | |
<i class="icon-append fa fa-user"></i> | |
<input placeholder="Indiquez le nom du profil client" type="text" ng-model="customer_profile.name"> | |
</label> | |
</section> | |
</div> | |
<div class="row"> | |
<section> | |
<label class="label">Id sur la boutique</label> | |
<label class="input"> | |
<i class="icon-append fa fa-tag"></i> | |
<input type="text" placeholder="Indiquez l'id du profil sur la boutique prestashop" ng-model="customer_profile.id_on_store"> | |
</label> | |
</section> | |
</div> | |
<section> | |
<label class="checkbox"><input type="checkbox" ng-model="customer_profile.visible"><i></i> Groupe visible dans Erpedia</label> | |
</section> | |
</fieldset> | |
<footer> | |
<button type="submit" class="btn btn-primary">Valider</button> | |
<a ui-sref="customerProfile.list" class="btn btn-warning">Annuler</a> | |
</footer> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
angular.module('erpedia-customer-profile') | |
.directive('customerProfileForm', ['CustomerProfile', '$state', function (CustomerProfile, $state) { | |
return { | |
restrict: 'E', | |
replace: true, | |
scope: { | |
'id_customer_profile': '=idcustomerprofile' | |
}, | |
templateUrl: jsBaseHref + '/templates/directives/customerProfileForm.html', | |
link: function (scope, element, attr) { | |
var id_customer_profile = scope.id_customer_profile; | |
scope.customer_profile = CustomerProfile.get({id: id_customer_profile}); | |
}, | |
controller: function ($scope) { | |
$scope.customer_profile = {name: '...chargement', id_on_store: '... chargement'}; | |
$scope.saveItem = function (item) { | |
CustomerProfile.save(item, function (results) { | |
if (results.success === true) { | |
success('Enregistrement de <strong>' + results.name + ' effectué avec succès</strong>'); | |
$state.go('customerProfile.list'); | |
} | |
else { | |
alert('Echec lors de l\'enregistrement du profil'); | |
} | |
}); | |
}; | |
} | |
}; | |
}]); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment