Skip to content

Commit

Permalink
Adjust some API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
truongtphat committed Sep 15, 2023
1 parent db5a4fd commit 412c969
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 245 deletions.
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
app.component("themeImportCultures", {
templateUrl:
"/mix-app/views/app-portal/pages/theme-import/components/theme-import-cultures/view.html",
controller: [
"$rootScope",
"$scope",
"ngAppSettings",
function ($rootScope, $scope, ngAppSettings) {
var ctrl = this;
var service = $rootScope.getRestService("mix-culture");
ctrl.selectAllContent = false;
ctrl.request = angular.copy(ngAppSettings.request);
ctrl.$onInit = async () => {
ctrl.getList();
};
ctrl.getList = async (cultureIndex) => {
if (cultureIndex !== undefined) {
ctrl.request.cultureIndex = cultureIndex;
}
if (ctrl.request.fromDate !== null) {
var d = new Date(ctrl.request.fromDate);
ctrl.request.fromDate = d.toISOString();
}
if (ctrl.request.toDate !== null) {
var d = new Date(ctrl.request.toDate);
ctrl.request.toDate = d.toISOString();
}
let getData = await service.getList(ctrl.request);
if (getData.success) {
ctrl.data = getData.data;
}
};
ctrl.selectContent = (culture, selected) => {
ctrl.selectAllContent = ctrl.selectAllContent && selected;
ctrl.selectAllData = ctrl.selectAllData && selected;
culture.isImportData = selected && culture.isImportData;
ctrl.updateContent([culture.id], selected);
};
ctrl.updateContent = function (arr, selected) {
if (selected) {
ctrl.importThemeDto.cultureIds = ctrl.unionArray(
ctrl.importThemeDto.cultureIds,
arr
);
} else {
ctrl.importThemeDto.cultureIds =
ctrl.importThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0);
ctrl.updateData(arr, false);
}
};
ctrl.selectAll = function (arr) {
// ctrl.selectedList.data = [];
var ids = arr.map(function (obj) {
return obj.id;
});
ctrl.updateContent(ids, ctrl.selectAllContent);
angular.forEach(arr, function (e) {
e.isActived = ctrl.selectAllContent;
});
};
ctrl.unionArray = (a, b) => {
return [...new Set([...a, ...b])];
};
templateUrl:
"/mix-app/views/app-portal/pages/theme-import/components/theme-import-cultures/view.html",
controller: [
"$rootScope",
"$scope",
"ngAppSettings",
function ($rootScope, $scope, ngAppSettings) {
var ctrl = this;
var service = $rootScope.getRestService("culture");
ctrl.selectAllContent = false;
ctrl.request = angular.copy(ngAppSettings.request);
ctrl.$onInit = async () => {
ctrl.getList();
};
ctrl.getList = async (cultureIndex) => {
if (cultureIndex !== undefined) {
ctrl.request.cultureIndex = cultureIndex;
}
if (ctrl.request.fromDate !== null) {
var d = new Date(ctrl.request.fromDate);
ctrl.request.fromDate = d.toISOString();
}
if (ctrl.request.toDate !== null) {
var d = new Date(ctrl.request.toDate);
ctrl.request.toDate = d.toISOString();
}
let getData = await service.getList(ctrl.request);
if (getData.success) {
ctrl.data = getData.data;
}
};
ctrl.selectContent = (culture, selected) => {
ctrl.selectAllContent = ctrl.selectAllContent && selected;
ctrl.selectAllData = ctrl.selectAllData && selected;
culture.isImportData = selected && culture.isImportData;
ctrl.updateContent([culture.id], selected);
};
ctrl.updateContent = function (arr, selected) {
if (selected) {
ctrl.importThemeDto.cultureIds = ctrl.unionArray(
ctrl.importThemeDto.cultureIds,
arr
);
} else {
ctrl.importThemeDto.cultureIds =
ctrl.importThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0);
ctrl.updateData(arr, false);
}
};
ctrl.selectAll = function (arr) {
// ctrl.selectedList.data = [];
var ids = arr.map(function (obj) {
return obj.id;
});
ctrl.updateContent(ids, ctrl.selectAllContent);
angular.forEach(arr, function (e) {
e.isActived = ctrl.selectAllContent;
});
};
ctrl.unionArray = (a, b) => {
return [...new Set([...a, ...b])];
};
},
],
bindings: {
importThemeDto: "=",
},
],
bindings: {
importThemeDto: "=",
},
});
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
app.component("themeExportCultures", {
templateUrl:
"/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html",
controller: [
"$rootScope",
"$scope",
"ngAppSettings",
function ($rootScope, $scope, ngAppSettings) {
var ctrl = this;
var service = $rootScope.getRestService("mix-culture");
ctrl.selectAllContent = false;
ctrl.request = angular.copy(ngAppSettings.request);
ctrl.$onInit = async () => {
ctrl.getList();
};
ctrl.getList = async (cultureIndex) => {
if (cultureIndex !== undefined) {
ctrl.request.cultureIndex = cultureIndex;
}
if (ctrl.request.fromDate !== null) {
var d = new Date(ctrl.request.fromDate);
ctrl.request.fromDate = d.toISOString();
}
if (ctrl.request.toDate !== null) {
var d = new Date(ctrl.request.toDate);
ctrl.request.toDate = d.toISOString();
}
let getData = await service.getList(ctrl.request);
if (getData.success) {
ctrl.data = getData.data;
}
};
ctrl.selectContent = (culture, selected) => {
ctrl.selectAllContent = ctrl.selectAllContent && selected;
ctrl.selectAllData = ctrl.selectAllData && selected;
culture.isExportData = selected && culture.isExportData;
ctrl.updateContent([culture.id], selected);
};
ctrl.updateContent = function (arr, selected) {
if (selected) {
ctrl.exportThemeDto.cultureIds = ctrl.unionArray(
ctrl.exportThemeDto.cultureIds,
arr
);
} else {
ctrl.exportThemeDto.cultureIds =
ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0);
ctrl.updateData(arr, false);
}
};
ctrl.selectAll = function (arr) {
// ctrl.selectedList.data = [];
var ids = arr.map(function (obj) {
return obj.id;
});
ctrl.updateContent(ids, ctrl.selectAllContent);
angular.forEach(arr, function (e) {
e.isActived = ctrl.selectAllContent;
});
};
ctrl.unionArray = (a, b) => {
return [...new Set([...a, ...b])];
};
templateUrl:
"/mix-app/views/app-portal/pages/theme/components/theme-export-cultures/view.html",
controller: [
"$rootScope",
"$scope",
"ngAppSettings",
function ($rootScope, $scope, ngAppSettings) {
var ctrl = this;
var service = $rootScope.getRestService("culture");
ctrl.selectAllContent = false;
ctrl.request = angular.copy(ngAppSettings.request);
ctrl.$onInit = async () => {
ctrl.getList();
};
ctrl.getList = async (cultureIndex) => {
if (cultureIndex !== undefined) {
ctrl.request.cultureIndex = cultureIndex;
}
if (ctrl.request.fromDate !== null) {
var d = new Date(ctrl.request.fromDate);
ctrl.request.fromDate = d.toISOString();
}
if (ctrl.request.toDate !== null) {
var d = new Date(ctrl.request.toDate);
ctrl.request.toDate = d.toISOString();
}
let getData = await service.getList(ctrl.request);
if (getData.success) {
ctrl.data = getData.data;
}
};
ctrl.selectContent = (culture, selected) => {
ctrl.selectAllContent = ctrl.selectAllContent && selected;
ctrl.selectAllData = ctrl.selectAllData && selected;
culture.isExportData = selected && culture.isExportData;
ctrl.updateContent([culture.id], selected);
};
ctrl.updateContent = function (arr, selected) {
if (selected) {
ctrl.exportThemeDto.cultureIds = ctrl.unionArray(
ctrl.exportThemeDto.cultureIds,
arr
);
} else {
ctrl.exportThemeDto.cultureIds =
ctrl.exportThemeDto.cultureIds.filter((m) => arr.indexOf(m) < 0);
ctrl.updateData(arr, false);
}
};
ctrl.selectAll = function (arr) {
// ctrl.selectedList.data = [];
var ids = arr.map(function (obj) {
return obj.id;
});
ctrl.updateContent(ids, ctrl.selectAllContent);
angular.forEach(arr, function (e) {
e.isActived = ctrl.selectAllContent;
});
};
ctrl.unionArray = (a, b) => {
return [...new Set([...a, ...b])];
};
},
],
bindings: {
exportThemeDto: "=",
},
],
bindings: {
exportThemeDto: "=",
},
});
Loading

0 comments on commit 412c969

Please sign in to comment.