mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
BPUR: Add datetimepicker to Available On
This commit is contained in:
@@ -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: "",
|
||||
|
||||
@@ -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" }
|
||||
|
||||
Reference in New Issue
Block a user