BPUR: Add datetimepicker to Available On

This commit is contained in:
Rob H
2013-06-22 13:13:24 +05:30
committed by Rohan Mitchell
parent 23a56ff4f1
commit 126f11683d
2 changed files with 21 additions and 1 deletions

View File

@@ -119,6 +119,26 @@ productsApp.directive('ngToggleColumnList', function($compile){
}
});
productsApp.directive('datetimepicker', function ($parse) {
return function (scope, element, attrs) {
// using $parse instead of scope[attrs.datetimepicker] for cases
// where attrs.datetimepicker is 'foo.bar.lol'
$(function(){
element.datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'HH:mm:ss',
stepMinute: 15,
onSelect:function (dateText, inst) {
scope.$apply(function(scope){
parsed = $parse(attrs.datetimepicker);
parsed.assign(scope, dateText);
});
}
});
});
}
});
productsApp.controller('AdminBulkProductsCtrl', function($scope, $timeout, $http, dataFetcher) {
$scope.updateStatusMessage = {
text: "",

View File

@@ -46,7 +46,7 @@
%span{ 'ng-bind' => 'product.on_hand', :name => 'on_hand', 'ng-show' => 'hasVariants(product)' }
%input.field{ 'ng-model' => 'product.on_hand', :name => 'on_hand', 'ng-track-product' => 'on_hand', 'ng-show' => '!hasVariants(product)', :type => 'number' }
%td{ 'ng-show' => 'columns.available_on.visible' }
%input{ 'ng-model' => 'product.available_on', :name => 'available_on', 'ng-track-product' => 'available_on', :type => 'text' }
%input{ 'ng-model' => 'product.available_on', :name => 'available_on', 'ng-track-product' => 'available_on', 'datetimepicker' => 'product.available_on', type: "text" }
%td.actions
%a{ 'ng-click' => 'editWarn(product)', :class => "edit-product icon-edit no-text" }
%a{ 'ng-click' => 'cloneProduct(product)', :class => "clone-product icon-copy no-text" }