Move options to first page

This commit is contained in:
Matt-Yorkley
2018-07-15 13:15:26 +01:00
parent 12838ba61e
commit bd200c885b
7 changed files with 44 additions and 43 deletions

View File

@@ -2,37 +2,24 @@ angular.module("admin.productImport").controller "ImportOptionsFormCtrl", ($scop
$scope.initForm = () ->
$scope.settings = {} if $scope.settings == undefined
$scope.settings[$scope.supplierId] = {
import_into: 'product_list'
defaults:
count_on_hand:
mode: 'overwrite_all'
on_hand:
mode: 'overwrite_all'
tax_category_id:
mode: 'overwrite_all'
shipping_category_id:
mode: 'overwrite_all'
available_on:
mode: 'overwrite_all'
$scope.settings = {
import_into: 'product_list',
reset_all_absent: false
}
$scope.import_into = 'product_list'
$scope.updateImportInto = () ->
$scope.import_into = $scope.settings[$scope.supplierId]['import_into']
$scope.$watch 'settings', (updated) ->
ProductImportService.updateSettings(updated)
, true
$scope.toggleResetAbsent = (id) ->
checked = $scope.settings[id]['reset_all_absent']
$scope.toggleResetAbsent = ->
checked = $scope.settings['reset_all_absent']
confirmed = confirm t('js.product_import.confirmation') if checked
if confirmed or !checked
ProductImportService.updateResetAbsent($scope.supplierId, $scope.reset_counts[$scope.supplierId], checked)
else
$scope.settings[id]['reset_all_absent'] = false
$scope.settings['reset_all_absent'] = false
$scope.resetTotal = ProductImportService.resetTotal