|
|
|
@ -4,6 +4,16 @@
|
|
|
|
|
define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', 'uiBootstrap', 'uiRouter', 'ngBootSwitch', 'ngFileUpload'], function (angular) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
var merchantTypes = [
|
|
|
|
|
{
|
|
|
|
|
"label": "All",
|
|
|
|
|
"value": 0
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"label": "Custom",
|
|
|
|
|
"value": 1
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
var app = angular.module('noticeApp', ['ui.bootstrap', 'ui.router', 'frapontillo.bootstrap-switch', 'ngFileUpload', 'ng.uditor']);
|
|
|
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
|
|
|
$stateProvider.state('notice', {
|
|
|
|
@ -93,8 +103,8 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
|
|
|
|
|
if (notice.end_time) {
|
|
|
|
|
notice.end_time = $filter('date')(notice.end_time, 'yyyyMMdd')
|
|
|
|
|
}
|
|
|
|
|
if (notice.merchants_type==1){
|
|
|
|
|
if (notice.send_clients.length==0){
|
|
|
|
|
if (notice.merchants_type == 1) {
|
|
|
|
|
if (notice.send_clients.length == 0) {
|
|
|
|
|
commonDialog.alert({title: 'Error', content: 'Send Clients is null', type: 'error'});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -111,6 +121,8 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
|
|
|
|
|
};
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('noticeDetailCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog', 'notice', function ($scope, $http, $state, $uibModal, commonDialog, notice) {
|
|
|
|
|
$scope.init = {};
|
|
|
|
|
|
|
|
|
|
$scope.notice = notice.data;
|
|
|
|
|
$scope.pagination = {};
|
|
|
|
|
$scope.params = {};
|
|
|
|
@ -132,13 +144,30 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
|
|
|
|
|
$scope.listClients();
|
|
|
|
|
$scope.totalClients();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.toggleAppWindow = function () {
|
|
|
|
|
if (!$scope.init.is_app_window) {
|
|
|
|
|
$scope.init.is_app_window = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$http.put('/sys/notice/' + $scope.notice.notice_id + '/app_window', {is_app_window: $scope.notice.is_app_window}).then(function () {
|
|
|
|
|
commonDialog.alert({
|
|
|
|
|
title: 'Success',
|
|
|
|
|
content: "修改成功",
|
|
|
|
|
type: 'success'
|
|
|
|
|
})
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
commonDialog.alert({
|
|
|
|
|
title: 'failed to change App Window status',
|
|
|
|
|
content: resp.data.message,
|
|
|
|
|
type: 'error'
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.sendNotice = function () {
|
|
|
|
|
$uibModal.open({
|
|
|
|
|
templateUrl: '/static/config/notice/templates/send_notice_dialog.html',
|
|
|
|
|
controller: 'sendNoticeCtrl',
|
|
|
|
|
size: 'sm',
|
|
|
|
|
resolve: {
|
|
|
|
|
notice: function () {
|
|
|
|
|
return $scope.notice;
|
|
|
|
@ -149,24 +178,17 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('sendNoticeCtrl', ['$scope', '$http','$state','commonDialog','notice', function ($scope, $http,$state,commonDialog,notice) {
|
|
|
|
|
app.controller('sendNoticeCtrl', ['$scope', '$http', '$state', 'commonDialog', 'notice', function ($scope, $http, $state, commonDialog, notice) {
|
|
|
|
|
$scope.notice = angular.copy(notice);
|
|
|
|
|
$scope.submit = function (form) {
|
|
|
|
|
if (form.$invalid) {
|
|
|
|
|
angular.forEach(form, function (item, key) {
|
|
|
|
|
if (key.indexOf('$') <= 0) {
|
|
|
|
|
item.$dirty = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$scope.errmsg = null;
|
|
|
|
|
$scope.saveNoticeResult = true;
|
|
|
|
|
$http.put('/sys/notice/' + $scope.notice.notice_id, notice).then(function (resp) {
|
|
|
|
|
$scope.notice.status = 1;
|
|
|
|
|
$http.put('/sys/notice/' + $scope.notice.notice_id, $scope.notice).then(function (resp) {
|
|
|
|
|
$scope.saveNoticeResult = false;
|
|
|
|
|
commonDialog.alert({title: 'Success', content: 'Send a notice successfully', type: 'success'});
|
|
|
|
|
$scope.loadNotices(1);
|
|
|
|
|
$state.go('^.detail', {notice_id: $scope.notice.notice_id})
|
|
|
|
|
$scope.close();
|
|
|
|
|
$state.go('notice.detail', {notice_id: $scope.notice.notice_id})
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
$scope.saveNoticeResult = false;
|
|
|
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
|
|
@ -176,9 +198,11 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
|
|
|
|
|
|
|
|
|
|
app.controller('noticeEditCtrl', ['$scope', '$http', '$filter', '$timeout', '$state', '$uibModal', 'commonDialog', 'notice',
|
|
|
|
|
function ($scope, $http, $filter, $timeout, $state, $uibModal, commonDialog, notice) {
|
|
|
|
|
$scope.merchantTypes = angular.copy(merchantTypes);
|
|
|
|
|
|
|
|
|
|
$scope.saveNoticeResult = false;
|
|
|
|
|
$scope.notice = notice.data;
|
|
|
|
|
|
|
|
|
|
$scope.notice.merchants_type = $scope.notice.merchants_type ? 1 : 0;
|
|
|
|
|
if (notice.data.end_time != null) {
|
|
|
|
|
$scope.notice.end_time = new Date(notice.data.end_time);
|
|
|
|
|
}
|
|
|
|
@ -239,8 +263,8 @@ define(['angular', 'static/commons/commons', 'static/commons/angular-ueditor', '
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
app.controller('clientsSectorCtrl', ['$scope', '$http', 'notice', 'clients', 'commonDialog','$state', function ($scope, $http, notice, clients, commonDialog,$state) {
|
|
|
|
|
$scope.partners=angular.copy(clients)||{};
|
|
|
|
|
app.controller('clientsSectorCtrl', ['$scope', '$http', 'notice', 'clients', 'commonDialog', '$state', function ($scope, $http, notice, clients, commonDialog, $state) {
|
|
|
|
|
$scope.partners = angular.copy(clients) || {};
|
|
|
|
|
// $scope.select={};
|
|
|
|
|
$scope.selectedPartners = "";
|
|
|
|
|
$scope.selectAll = function () {
|
|
|
|
|