Skip to content

Commit

Permalink
Fixed Flag save, date save
Browse files Browse the repository at this point in the history
  • Loading branch information
terragou committed Jan 21, 2016
1 parent 2b3092c commit cd42733
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 27 deletions.
20 changes: 11 additions & 9 deletions angular/controllers/productAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ module.exports = ['$scope', '$window', 'util', 'config', 'Product', 'Image', 'At
$scope.formData.MasterVariant.SalePrice = $scope.formData.MasterVariant.OriginalPrice;
}

if($scope.formData.ExpireDate){
/*if($scope.formData.ExpireDate){
var cpdate = angular.copy($scope.formData.ExpireDate);
if(moment.isDate(cpdate)){
$scope.formData.ExpireDate = moment(cpdate).format('LL');
$scope.formData.ExpireTime = moment(cpdate).format('HH:mm');
$scope.formData.ExpireTime = moment(cpdate).format('HH:mm:ss');
}else{
$scope.formData.ExpireDate = "";
$scope.formData.ExpireTime = "";
$scope.formData.ExpireDate = $scope.formData.ExpireDate;
$scope.formData.ExpireTime = $scope.formData.ExpireTime;
}
}
if($scope.formData.EffectiveDate){
var cpdate = angular.copy($scope.formData.EffectiveDate);
if(moment.isDate(cpdate)){
$scope.formData.EffectiveDate = moment(cpdate).format('LL');
$scope.formData.EffectiveTime = moment(cpdate).format('HH:mm');
$scope.formData.EffectiveTime = moment(cpdate).format('HH:mm:ss');
}else{
$scope.formData.EffectiveDate = "";
$scope.formData.EffectiveTime = "";
$scope.formData.EffectiveDate = $scope.formData.EffectiveDate;
$scope.formData.EffectiveTime = $scope.formData.EffectiveTime;
}
}
}*/


};
Expand Down Expand Up @@ -182,7 +182,9 @@ module.exports = ['$scope', '$window', 'util', 'config', 'Product', 'Image', 'At
Variants: [],
GlobalCategories: [null, null, null],
LocalCategories: [null, null, null],
SEO: {},
SEO: {
ProductBoostingWeight: 10000
},
ControlFlags: [],
Keywords: []
};
Expand Down
14 changes: 10 additions & 4 deletions angular/services/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,17 @@ module.exports = ['$http', 'common', 'util', 'LocalCategory', 'Brand',
clean.ControlFlags = fd.ControlFlags;
clean.Brand = fd.Brand;
clean.ShippingMethod = fd.ShippingMethod;
clean.EffectiveDate = fd.EffectiveDate;
clean.EffectiveTime = fd.EffectiveTime;
clean.ExpireDate = fd.ExpireDate;
clean.ExpireTime = fd.ExpireTime;

var cpdate = angular.copy(fd.ExpireDate);
clean.ExpireDate = moment(cpdate).format('LL');
clean.ExpireTime = moment(cpdate).format('HH:mm:ss');

cpdate = angular.copy(fd.EffectiveDate);

clean.EffectiveDate = moment(cpdate).format('LL');
clean.EffectiveTime = moment(cpdate).format('HH:mm:ss');

console.log('1-1', clean);
//clean.EffectiveDate = moment(fd.EffectiveDate + " " + fd.EffectiveTime);
//clean.EffectiveTime = fd.EffectiveTime;
//clean.ExpireDate = moment(fd.ExpireDate + " " + fd.ExpireTime);
Expand Down
34 changes: 21 additions & 13 deletions public/assets/js/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1246,27 +1246,27 @@ module.exports = ['$scope', '$window', 'util', 'config', 'Product', 'Image', 'At
$scope.formData.MasterVariant.SalePrice = $scope.formData.MasterVariant.OriginalPrice;
}

if($scope.formData.ExpireDate){
/*if($scope.formData.ExpireDate){
var cpdate = angular.copy($scope.formData.ExpireDate);
if(moment.isDate(cpdate)){
$scope.formData.ExpireDate = moment(cpdate).format('LL');
$scope.formData.ExpireTime = moment(cpdate).format('HH:mm');
$scope.formData.ExpireTime = moment(cpdate).format('HH:mm:ss');
}else{
$scope.formData.ExpireDate = "";
$scope.formData.ExpireTime = "";
$scope.formData.ExpireDate = $scope.formData.ExpireDate;
$scope.formData.ExpireTime = $scope.formData.ExpireTime;
}
}

if($scope.formData.EffectiveDate){
var cpdate = angular.copy($scope.formData.EffectiveDate);
if(moment.isDate(cpdate)){
$scope.formData.EffectiveDate = moment(cpdate).format('LL');
$scope.formData.EffectiveTime = moment(cpdate).format('HH:mm');
$scope.formData.EffectiveTime = moment(cpdate).format('HH:mm:ss');
}else{
$scope.formData.EffectiveDate = "";
$scope.formData.EffectiveTime = "";
$scope.formData.EffectiveDate = $scope.formData.EffectiveDate;
$scope.formData.EffectiveTime = $scope.formData.EffectiveTime;
}
}
}*/


};
Expand Down Expand Up @@ -1379,7 +1379,9 @@ module.exports = ['$scope', '$window', 'util', 'config', 'Product', 'Image', 'At
Variants: [],
GlobalCategories: [null, null, null],
LocalCategories: [null, null, null],
SEO: {},
SEO: {
ProductBoostingWeight: 10000
},
ControlFlags: [],
Keywords: []
};
Expand Down Expand Up @@ -4031,11 +4033,17 @@ module.exports = ['$http', 'common', 'util', 'LocalCategory', 'Brand',
clean.ControlFlags = fd.ControlFlags;
clean.Brand = fd.Brand;
clean.ShippingMethod = fd.ShippingMethod;
clean.EffectiveDate = fd.EffectiveDate;
clean.EffectiveTime = fd.EffectiveTime;
clean.ExpireDate = fd.ExpireDate;
clean.ExpireTime = fd.ExpireTime;

var cpdate = angular.copy(fd.ExpireDate);
clean.ExpireDate = moment(cpdate).format('LL');
clean.ExpireTime = moment(cpdate).format('HH:mm:ss');

cpdate = angular.copy(fd.EffectiveDate);

clean.EffectiveDate = moment(cpdate).format('LL');
clean.EffectiveTime = moment(cpdate).format('HH:mm:ss');

console.log('1-1', clean);
//clean.EffectiveDate = moment(fd.EffectiveDate + " " + fd.EffectiveTime);
//clean.EffectiveTime = fd.EffectiveTime;
//clean.ExpireDate = moment(fd.ExpireDate + " " + fd.ExpireTime);
Expand Down
2 changes: 1 addition & 1 deletion templates/components/forms/multiple-checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<? foreach ($choices as $i=>$choice): ?>
<label class="<?= $checkbox_class; ?>"><input type="checkbox"
<?php if(isset($ng_model)): ?>
ng-model="<?= $ng_model ?>.Flag<?= $i ?>"
ng-model="<?= $ng_model ?>.Flag<?= $i + 1 ?>"
<?php endif; ?>

class="<?= $input_class; ?>"> <?= $choice ?></label>
Expand Down

0 comments on commit cd42733

Please sign in to comment.