Skip to content

Commit

Permalink
Merge branch 'ui-dev' of github.com:Laki7877/reachrabbit-client into …
Browse files Browse the repository at this point in the history
…ui-dev
  • Loading branch information
poonwu committed Oct 19, 2016
2 parents c487467 + 83325c5 commit e7d154c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion app/brand.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<body class="layout-brand">
<div class="api_override_box" ng-cloak ng-if="API_OVERRIDE_ACTIVE">
<span class="label label-danger">API OVERRIDE ON</span>
<span class="label label-danger">APIO</span>
</div>

<nav class="navbar" ng-cloak>
Expand Down
2 changes: 1 addition & 1 deletion app/components/directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ angular.module('reachRabbitApp.directives', ['reachRabbitApp.service'])
remove: "&?",
removeable: "&?",
viewable: "&?",
view: "&?"
view: "&?"
},
templateUrl: 'components/templates/card-campaign-header.html',
link: function (scope, element, attrs, ctrl, transclude) {
Expand Down
51 changes: 27 additions & 24 deletions app/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ angular.module('reachRabbitApp.controller', ['reachRabbitApp.service'])
});
}
])
.controller('WorkroomController', ['$scope', 'UserProfile', '$uibModal', '$interval', '$rootScope', '$stateParams', 'ProposalService', 'NcAlert', '$state', '$location', '$window', 'util', 'LongPollingService', '$timeout', 'InfluencerAccountService',
function ($scope, UserProfile, $uibModal, $interval, $rootScope, $stateParams, ProposalService, NcAlert, $state, $location, $window, util, LongPollingService, $timeout, InfluencerAccountService) {
.controller('WorkroomController', function ($scope, UserProfile, $uibModal, $interval, $rootScope, $stateParams, ProposalService, NcAlert, $state, $location, $window, util, LongPollingService, $timeout, InfluencerAccountService) {
$scope.msglist = [];
$scope.msgHash = {};
$scope.msgLimit = 30;
Expand Down Expand Up @@ -245,10 +244,10 @@ angular.module('reachRabbitApp.controller', ['reachRabbitApp.service'])
size: 'md',
resolve: {
campaign: function () {
return $scope.proposal.campaign;
return angular.copy($scope.proposal.campaign);
},
proposal: function () {
return $scope.proposal;
return angular.copy($scope.proposal);
}
}
});
Expand All @@ -258,9 +257,8 @@ angular.module('reachRabbitApp.controller', ['reachRabbitApp.service'])
if (!proposal || !proposal.proposalId) {
return;
}
// $location.reload();

window.location.reload();
// $state.go('influencer-workroom', { proposalId: proposal.proposalId });
});
};

Expand Down Expand Up @@ -289,6 +287,8 @@ angular.module('reachRabbitApp.controller', ['reachRabbitApp.service'])
});

$scope.hasPastMessage = function () {
if(!$scope.msglist) return false;
if($scope.msglist.length == 0) return false;
return $scope.totalElements > $scope.msglist.length;
};

Expand Down Expand Up @@ -447,8 +447,8 @@ angular.module('reachRabbitApp.controller', ['reachRabbitApp.service'])
chatArea.scrollTop(9999);
}
}
])
.controller('InfluencerProfilePortfolioController', ['$scope', 'NcAlert', 'AccountService', '$stateParams', function ($scope, NcAlert, AccountService, $stateParams) {
)
.controller('InfluencerProfilePortfolioController', function ($scope, NcAlert, AccountService, $stateParams) {
$scope.formData = {};
$scope.alert = new NcAlert();
if($stateParams.proposalId) {
Expand Down Expand Up @@ -498,16 +498,16 @@ angular.module('reachRabbitApp.controller', ['reachRabbitApp.service'])
.catch(function (err) {
$scope.alert.danger(err.data.message);
});
}])
.controller('BrandProfilePortfolioController', ['$scope', 'AccountService', '$stateParams', function ($scope, AccountService, $stateParams) {
})
.controller('BrandProfilePortfolioController', function ($scope, AccountService, $stateParams) {
if($stateParams.proposalId) {
$scope.proposalId = $stateParams.proposalId;
}
AccountService.getProfile($stateParams.brandId)
.then(function (response) {
$scope.brand = response.data;
});
}])
})
.controller('PayoutHistoryController', ['$scope', '$state', 'TransactionService', function ($scope, $state, TransactionService) {
//Load campaign data
$scope.isExpired = function (T) {
Expand Down Expand Up @@ -1062,6 +1062,16 @@ angular.module('reachRabbitApp.brand.controller', ['reachRabbitApp.service'])
return $filter('number')(budgetObject.fromBudget) + " - " + $filter('number')(budgetObject.toBudget) + " บาท ต่อคน";
};

var mediaBooleanDictProcess = function (formData) {
formData.media = [];
//tell server which media are checked
_.forEach($scope.mediaBooleanDict, function (value, key) {
if (value === true) {
formData.media.push($scope.mediaObjectDict[key]);
}
});
};

//Fetch initial datasets
DataService.getWorkTypes()
.then(function(g){
Expand All @@ -1072,29 +1082,22 @@ angular.module('reachRabbitApp.brand.controller', ['reachRabbitApp.service'])
$scope.medium = response.data;
$scope.medium.forEach(function (item) {
$scope.mediaObjectDict[item.mediaId] = item;
$scope.$watch('mediaBooleanDict', function () {
mediaBooleanDictProcess($scope.formData);
}, true);
});
});

DataService.getCategories()
.then(function (response) {
$scope.categories = response.data;
});

var mediaBooleanDictProcess = function (formData) {
formData.media = [];
//tell server which media are checked
_.forEach($scope.mediaBooleanDict, function (value, key) {
if (value === true) {
formData.media.push($scope.mediaObjectDict[key]);
}
});
};
$scope.$watch('mediaBooleanDict', function () {
mediaBooleanDictProcess($scope.formData);
}, true);



$scope.formData.brand = UserProfile.get().brand;


function getOne(cid) {
CampaignService.getOne(cid)
.then(function (response) {
Expand Down
2 changes: 2 additions & 0 deletions app/js/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ angular.module('reachRabbitApp.service', ['satellizer'])
}])
.factory('CampaignService', ['$http', '$q', function ($http, $q) {
var deserializeCampaign = function (campaign) {

console.log(campaign);
campaign.campaignResources = campaign.campaignResources.map(function (campaignResource) {
return campaignResource.resource;
});
Expand Down
4 changes: 2 additions & 2 deletions app/view/brand-campaign-detail-published.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ <h1 ng-bind="campaignNee.title | truncate: 60"></h1>
</div>
<div class="card-body-content work-type">
<div class="work-type-item" ng-repeat="workType in campaignNee.workType">
<i class="fa" ng-class="{'fa-play-circle-o': workType.workTypeId == 2, 'fa-magic': workType.workTypeId == 3, 'fa-picture-o': workType.workTypeId == 1}"></i>
<span>{{workType.workTypeName}}</span>
<i class="fa" ng-class="{'fa-play-circle-o': workType.workTypeId == 2, 'fa-magic': workType.workTypeId == 3, 'fa-picture-o': workType.workTypeId == 1}"></i>
<span>{{workType.workTypeName}}</span>
</div>
</div>
</div>
Expand Down

0 comments on commit e7d154c

Please sign in to comment.