"use strict";angular.module("getlancerApp.Common.Wallet",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","ui.select","http-auth-interceptor","vcRecaptcha","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngMap","chieffancypants.loadingBar","payment","builder","builder.components","validator.rules","angularMoment","ngFileUpload","720kb.socialshare","slugifier"]).config(function($stateProvider,$urlRouterProvider){var getToken={TokenServiceData:function(TokenService,$q){return $q.all({AuthServiceData:TokenService.promise,SettingServiceData:TokenService.promiseSettings})}};$urlRouterProvider.otherwise("/"),$stateProvider.state("wallets",{url:"/wallets",templateUrl:"scripts/plugins/Common/Wallet/views/default/wallet.html",resolve:getToken})}),angular.module("getlancerApp.Common.Wallet").controller("WalletController",["$rootScope","$scope","$window","countries","states","cities","usersAddresses","wallet","flash","$location","$filter","$state","paymentGateways","userSettings","ConstPaymentGateways","UserMeFactory","$timeout",function($rootScope,$scope,$window,countries,states,cities,usersAddresses,wallet,flash,$location,$filter,$state,paymentGateways,userSettings,ConstPaymentGateways,UserMeFactory,$timeout){$rootScope.url_split=$location.path().split("/")[1],$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Add to wallet"),$scope.minimum_wallet_amount=$rootScope.settings.WALLET_MIN_WALLET_AMOUNT,$scope.maximum_wallet_amount=$rootScope.settings.WALLET_MAX_WALLET_AMOUNT,$scope.buyer={},$scope.paynow_is_disabled=!1,$scope.payment_note_enabled=!1,$scope.payer_form_enabled=!0,$scope.is_wallet_page=!0,$scope.existing_new_address=1,$scope.user_address_id="",$scope.user_address_add={},$scope.save_btn=!1,$scope.first_gateway_id="",$scope.gatewayError="",$scope.isPaytabs=!1,$scope.isPayPal=!1,$scope.index=function(){UserMeFactory.get({},function(response){$scope.user_available_balance=response.data.available_wallet_amount||0,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0});var payment_gateways=[];paymentGateways.get({},function(payment_response){console.log("1-----");if(payment_response.PayPalREST){var response=payment_response.PayPalREST;response.paypalrest_enabled&&($scope.paypal_enabled=!0,$scope.isPaytabs=!0)}if(payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}$scope.isPaytabs?($scope.isPaytabs=!0,$scope.isPayPal=!1):($scope.isPaytabs=!1,$scope.isPayPal=!0),$scope.group_gateway_id="",0===payment_response.error.code&&void 0!==payment_response.zazpay&&(angular.forEach(payment_response.zazpay.gateways,function(gateway_group_value,gateway_group_key){0===gateway_group_key&&($scope.group_gateway_id=gateway_group_value.id,$scope.first_gateway_id=gateway_group_value.id),angular.forEach(gateway_group_value.gateways,function(payment_geteway_value,payment_geteway_key){var payment_gateway={},suffix="sp_";0===gateway_group_key&&($scope.sel_payment_gateway="sp_"+payment_geteway_value.id),suffix+=payment_geteway_value.id,payment_gateway.id=payment_geteway_value.id,payment_gateway.payment_id=suffix,payment_gateway.group_id=gateway_group_value.id,payment_gateway.display_name=payment_geteway_value.display_name,payment_gateway.thumb_url=payment_geteway_value.thumb_url,payment_gateway.suffix=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.form_fields=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.instruction_for_manual=payment_geteway_value.instruction_for_manual,payment_gateways.push(payment_gateway)})}),$scope.gateway_groups=payment_response.zazpay.gateways,$scope.payment_gateways=payment_gateways,$scope.form_fields_tpls=payment_response.zazpay._form_fields_tpls,$scope.show_form=[],$scope.form_fields=[],angular.forEach($scope.form_fields_tpls,function(key,value){"buyer"===value&&($scope.form_fields[value]="scripts/plugins/Common/Wallet/views/default/buyer.html"),"credit_card"===value&&($scope.form_fields[value]="scripts/plugins/Common/Wallet/views/default/credit_card.html"),"manual"===value&&($scope.form_fields[value]="scripts/plugins/Common/Wallet/views/default/manual.html"),$scope.show_form[value]=!0}),$scope.gateway_id=ConstPaymentGateways.ZazPay)})},$scope.paneChanged=function(pane){"Manual / Offline"===pane&&($scope.payment_note_enabled=!0),"paypal"===pane&&($scope.gateway_id=ConstPaymentGateways.PayPal),$scope.defaultselect(pane);var keepGoing=!0;$scope.buyer={},$scope.PaymentForm.$setPristine(),$scope.PaymentForm.$setUntouched(),angular.forEach($scope.form_fields_tpls,function(key,value){$scope.show_form[value]=!1}),$scope.gateway_id=ConstPaymentGateways.ZazPay,angular.forEach($scope.gateway_groups,function(res){if(res.display_name===pane&&"Wallet"!==pane){var selPayment="";angular.forEach($scope.payment_gateways,function(response){keepGoing&&response.group_id===res.id&&(selPayment=response,keepGoing=!1,$scope.rdoclick(selPayment.id,selPayment.form_fields))}),$scope.sel_payment_gateway="sp_"+selPayment.id,$scope.group_gateway_id=selPayment.group_id}})},$scope.defaultselect=function(pane){var selectedTab,selectedPayment;$scope.gateways=[];var keepGoing=!0;angular.forEach($scope.gateway_groups,function(res){keepGoing&&res.display_name==pane&&(selectedTab=res,$scope.selectedTab=res,keepGoing=!1)}),keepGoing=!0,angular.forEach($scope.payment_gateways,function(res){keepGoing&&res.group_id==selectedTab.id&&(selectedPayment=res,keepGoing=!1,$scope.rdoclick(selectedPayment.id,selectedPayment.form_fields))}),$scope.gateways="sp_"+selectedPayment.id},$scope.rdoclick=function(res,res1){$scope.paynow_is_disabled=!1,$scope.sel_payment_gateway="sp_"+res,$scope.array=res1.split(","),angular.forEach($scope.array,function(value){$scope.show_form[value]=!0})},$scope.WalletFormSubmit=function(form){var payment_id="";if($scope.sel_payment_gateway&&$scope.gateway_id===ConstPaymentGateways.ZazPay&&(payment_id=$scope.sel_payment_gateway.split("_")[1]),$scope.buyer.user_id=$rootScope.user.id,$scope.buyer.amount=$scope.amount,$scope.buyer.payment_gateway_id=$scope.gateway_id,$scope.buyer.gateway_id=payment_id,angular.isDefined($scope.buyer.credit_card_expired)&&($scope.buyer.credit_card_expired.month||$scope.buyer.credit_card_expired.year)&&($scope.buyer.credit_card_expired.month>0&&$scope.buyer.credit_card_expired.month<10&&($scope.buyer.credit_card_expired.month="0"+$scope.buyer.credit_card_expired.month),$scope.buyer.credit_card_expire=$scope.buyer.credit_card_expired.month+"/"+$scope.buyer.credit_card_expired.year),form){$scope.paynow_is_disabled=!0;var flashMessage;wallet.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.payment_response.gateway_callback_url?$window.location.href=response.payment_response.gateway_callback_url:"Pending"===response.payment_response.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.payment_response.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.reload()):0===response.payment_response.error.code?(flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.reload()):512===response.payment_response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):($scope.gatewayError=$filter("translate")(response.payment_response.error.message),flashMessage=$filter("translate")("Payment could not be completed.Please try again..."),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.payment_response.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.payment_response.error.message),"error",!1),$scope.paynow_is_disabled=!1})}},$scope.site_url=$location.absUrl().split("?")[1];var flashMessage;"error_code=0"===$scope.site_url&&(flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1)),$scope.payNowPaytabClick=function(){var flashMessage;angular.isDefined($scope.amount)?($scope.buyer.user_id=$rootScope.user.id,$scope.buyer.amount=$scope.amount,$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayTab,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.buyer.lang=null!==$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY")?$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY"):"en",$scope.paynow_is_disabled=!0,wallet.create($scope.buyer,function(response){0===response.error.code?void 0!==response.data.payment_url?$window.location.href=response.data.payment_url:(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):($scope.gatewayError=$filter("translate")(response.payment_response.error.message),flashMessage=$filter("translate")("Payment could not be completed.Please try again..."),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.payment_response.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.payment_response.error.message),"error",!1),$scope.paynow_is_disabled=!1})):(flashMessage=$filter("translate")("please enter amount."),flash.set(flashMessage,"error",!1))},$scope.payNowPayPalClick=function(){var flashMessage;angular.isDefined($scope.amount)?($scope.buyer.user_id=$rootScope.user.id,$scope.buyer.amount=$scope.amount,$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayPal,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.paynow_is_disabled=!0,wallet.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.payment_response.gateway_callback_url?$window.location.href=response.payment_response.gateway_callback_url:"Pending"===response.payment_response.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.payment_response.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.reload()):0===response.payment_response.error.code?(flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.reload()):512===response.payment_response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):($scope.gatewayError=$filter("translate")(response.payment_response.error.message),flashMessage=$filter("translate")("Payment could not be completed.Please try again..."),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.payment_response.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.payment_response.error.message),"error",!1),$scope.paynow_is_disabled=!1})):(flashMessage=$filter("translate")("please enter the valid amount."),flash.set(flashMessage,"error",!1))},countries.get({limit:"all"},function(response){angular.isDefined(response.data)&&($scope.countries=response.data)}),$scope.index()}]),angular.module("getlancerApp.Common.Wallet").factory("wallet",["$resource",function($resource){return $resource("/api/v1/wallets",{},{create:{method:"POST"}})}]),angular.module("getlancerApp.Common.Wallet").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Common/Wallet/views/default/buyer.html",'
{{\'Required\'|translate}}
{{\'Enter Valid Email\'|translate}}
{{\'Required\'|translate}}
{{\'Required\'|translate}}
{{\'Required\'|translate}}
{{\'Required\'|translate}}
{{\'Required\'|translate}}
{{\'Required\'|translate}}
'),$templateCache.put("scripts/plugins/Common/Wallet/views/default/credit_card.html",'
{{\'Required\'|translate}}
{{\'Required\'|translate}}
{{\'Please enter a future date\'|translate}}
{{\'Required\'|translate}}
{{\'Required\'|translate}}
'),$templateCache.put("scripts/plugins/Common/Wallet/views/default/gateway.html",'
{{gatewayError}}
  • {{\'Please enter your credit card details below\'|translate}}.

'),$templateCache.put("scripts/plugins/Common/Wallet/views/default/manual.html",'
{{\'Required\'|translate}}
'),$templateCache.put("scripts/plugins/Common/Wallet/views/default/wallet.html",'
')}]);angular.module('getlancerApp').requires.push('getlancerApp.Common.Wallet');"use strict";angular.module("getlancerApp.Common.Withdrawal",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","ui.select","http-auth-interceptor","vcRecaptcha","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngMap","chieffancypants.loadingBar","payment","builder","builder.components","validator.rules","angularMoment","ngFileUpload","720kb.socialshare","slugifier"]).config(function($stateProvider,$urlRouterProvider){var getToken={TokenServiceData:function(TokenService,$q){return $q.all({AuthServiceData:TokenService.promise,SettingServiceData:TokenService.promiseSettings})}};$urlRouterProvider.otherwise("/"),$stateProvider.state("user_cash_withdrawals",{url:"/users/cash_withdrawals",templateUrl:"scripts/plugins/Common/Withdrawal/views/default/cash_withdrawals.html",resolve:getToken})}),angular.module("getlancerApp.Common.Withdrawal").controller("CashWithdrawalsController",["$rootScope","$scope","cashWithdrawals","moneyTransferAccount","flash","$filter","$state","UserMeFactory","$location","myUserFactory",function($rootScope,$scope,cashWithdrawals,moneyTransferAccount,flash,$filter,$state,UserMeFactory,$location,myUserFactory){$rootScope.url_split=$location.path().split("/")[2],$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Cash Withdrawals"),$scope.minimum_withdraw_amount=$rootScope.settings.USER_MINIMUM_WITHDRAW_AMOUNT,$scope.maximum_withdraw_amount=$rootScope.settings.USER_MAXIMUM_WITHDRAW_AMOUNT,$scope.user_available_balance=$rootScope.user.available_wallet_amount,$scope.withDrawAmount=200,$scope.mul=$scope.withDrawAmount*$rootScope.settings.WITHDRAW_REQUEST_FEE,$scope.ExampleAmount=$scope.withDrawAmount-$rootScope.settings.WITHDRAW_REQUEST_FEE,$scope.total=$scope.mul/100,$scope.account_error=!1;var params={},cashparams={};params.user_id=$rootScope.user.id,cashparams.user_id=$rootScope.user.id,$scope.index=function(){$scope.loader=!0,UserMeFactory.get({},function(response){$scope.user_available_balance=response.data.available_wallet_amount,0===parseInt($scope.user_available_balance)?($scope.getMyuser(),$scope.is_show_wallet_paybtn=!1):$scope.is_show_wallet_paybtn=!0}),void 0===$scope.currentPage?cashparams.page=1:cashparams.page=$scope.currentPage,cashWithdrawals.get(cashparams,function(response){angular.isDefined(response._metadata)&&($scope.currentPage=response._metadata.current_page,$scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page),angular.isDefined(response.data)&&($scope.cashWithdrawalsList=response.data),$scope.loader=!1}),moneyTransferAccount.get(params,function(response){angular.isDefined(response.data)&&($scope.moneyTransferList=response.data)})},$scope.selectedAcc=function(id){$scope.account_id=id,$scope.account_error=!1},$scope.getMyuser=function(){$rootScope.isAuth&&myUserFactory.get(function(response){$scope.my_user=response.data})},$scope.submit_btn=!1,$scope.userCashWithdrawSubmit=function($valid){$scope.submit_btn=!0,void 0===$scope.account_id?$scope.account_error=!0:$scope.account_error=!1,$valid&&$scope.account_error===!1&&($scope.amount=parseFloat($("#amount").val()),parseFloat($scope.user_available_balance)>$scope.amount?(params.amount=$scope.amount,params.money_transfer_account_id=$scope.account_id,params.remark="",cashWithdrawals.save(params,function(response){0===response.error.code&&($scope.my_user.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt($scope.amount),flash.set($filter("translate")("Your request submitted successfully."),"success",!0),$scope.submit_btn=!1,$state.reload())},function(){flash.set($filter("translate")("Withdraw request could not be added"),"error",!1)})):flash.set("You Dont have sufficient amount in your wallet.","error",!1))},$scope.paginate=function(currentpg){$scope.currentPage=parseInt(currentpg),$scope.index()},$scope.index()}]),angular.module("getlancerApp.Common.Withdrawal").factory("cashWithdrawals",["$resource",function($resource){return $resource("/api/v1/users/:user_id/user_cash_withdrawals",{},{get:{method:"GET",params:{user_id:"@user_id"}},save:{method:"POST",params:{user_id:"@user_id"}}})}]),angular.module("getlancerApp.Common.Withdrawal").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Common/Withdrawal/views/default/cash_withdrawals.html",'
')}]);angular.module('getlancerApp').requires.push('getlancerApp.Common.Withdrawal');"use strict";angular.module("getlancerApp.Common.PaypalREST",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","ui.select","http-auth-interceptor","vcRecaptcha","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngMap","chieffancypants.loadingBar","payment","builder","builder.components","validator.rules","angularMoment","ngFileUpload","720kb.socialshare","slugifier"]);angular.module('getlancerApp').requires.push('getlancerApp.Common.PaypalREST');"use strict";function checkFileFormat(file,validFormats){if(file){var value=file.name,ext=value.substring(value.lastIndexOf(".")+1).toLowerCase();return-1!==validFormats.indexOf(ext)}return!1}angular.module("getlancerApp.Bidding",["getlancerApp.Bidding.Constant","ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","slugifier","checklist-model","angularjs-dropdown-multiselect","rzModule"]).config(function($stateProvider,$urlRouterProvider){var getToken={TokenServiceData:function(TokenService,$q){return $q.all({AuthServiceData:TokenService.promise,SettingServiceData:TokenService.promiseSettings})}};$urlRouterProvider.otherwise("/"),$stateProvider.state("Bid_ProjectAdd",{url:"/projects/add?enable_hide",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/project_add.html",controller:"ProjectAddCtrl",resolve:getToken}).state("Bid_ProjectEdit",{url:"/projects/edit/:id?status",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/project_edit.html",controller:"ProjectEditCtrl",resolve:getToken}).state("Bid_ProjectView",{url:"/projects/view/:id/:slug?placebid&edit&action&error_code",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/project_view.html",controller:"ProjectViewCtrl",resolve:getToken}).state("Bid_Projects",{url:"/projects?search&page&type&project_categories&skills&price_range_min&price_range_max",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/projects.html",controller:"ProjectsListCtrl",resolve:getToken}).state("Bid_MeProjects",{url:"/projects/me?status",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/my_projects.html",controller:"MyProjectsCtrl",resolve:getToken}).state("Bid_MeBids",{url:"/projects/bids/me",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/my_bids.html",controller:"MyBidsCtrl",resolve:getToken}).state("Bid_ProjectPayment",{url:"/projects/order/:id/:slug",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/project_payment.html",controller:"ProjectPaymentController",resolve:getToken})}).filter("date_format",function($filter){return function(input,format){return $filter("date")(new Date(input),format)}}).filter("capitalize",function(){return function(input){return input?input.charAt(0).toUpperCase()+input.substr(1).toLowerCase():""}}).filter("milestone_status",function($filter){return function(input,format){return"Completed"}}).config(function(tagsInputConfigProvider){tagsInputConfigProvider.setDefaults("tagsInput",{placeholder:"",minLength:1,addOnEnter:!1}).setDefaults("autoComplete",{debounceDelay:200,loadOnDownArrow:!0,loadOnEmpty:!0})}),angular.module("getlancerApp.Bidding").controller("MyBidsCtrl",function($scope,$rootScope,$state,$filter,flash,MyBids,BidMilestone,BidRetake,MeMilestone,MilestoneStatusConstant,MeInvoice){$scope.index=function(params){"milestone"===params.type?(delete params.type,(void 0===$state.params.status||"milestone"!==$state.params.status)&&$state.go("Bid_MeBids",{status:"milestone"},{notify:!1}),$scope.MilestoneStatusConstant=MilestoneStatusConstant,$scope.milestones=[],MeMilestone.get(params,function(response){0===parseInt(response.error.code)&&($scope.milestones=response.data)},function(error){})):"invoice"===params.type?((void 0===$state.params.status||"invoice"!==$state.params.status)&&$state.go("Bid_MeBids",{status:"invoice"},{notify:!1}),delete params.type,$scope.invoices=[],MeInvoice.get(params,function(response){0===parseInt(response.error.code)&&($scope.invoices=response.data)},function(error){})):("active"===params.type?(void 0===$state.params.status||"active"!==$state.params.status)&&$state.go("Bid_MeBids",{status:"active"},{notify:!1}):"my_bids"===params.type?(void 0===$state.params.status||"my_bids"!==$state.params.status)&&$state.go("Bid_MeBids",{status:"my_bids"},{notify:!1}):(void 0===$state.params.status||"past_projects"!==$state.params.status)&&$state.go("Bid_MeBids",{status:"past_projects"},{notify:!1}),MyBids.get(params,function(response){0===parseInt(response.error.code)&&($scope.currentPage=response._metadata.current_page,$scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page),0===parseInt(response.error.code)?$scope.mybids=response.data:($scope.mybids=[],$scope.errorMessage="",angular.isDefined(response.error)&&($scope.errorMessage=response.error.message),$scope.currentPage=0,$scope.totalItems=0,$scope.itemsPerPage=0,$scope.noOfPages=0)}))},$state.params.status?(alert("in bddd"),"my_bids"===$state.params.status?$scope.activeStatus=1:"past_projects"===$state.params.status?$scope.activeStatus=2:"milestone"===$state.params.status?$scope.activeStatus=3:"invoice"===$state.params.status?$scope.activeStatus=4:$scope.activeStatus=0,$scope.index({type:$state.params.status})):$scope.activeStatus=0,$scope.paginate=function(){$scope.currentPage=parseInt($scope.currentPage),$scope.index()},$scope.getBidsShow=function(tabType){$scope.params={type:tabType,page:void 0!==$scope.currentPage?$scope.currentPage:1},$scope.index($scope.params)},$scope.bidAction=function(indexVal,atype,bidId){if(parseInt(atype)){var title="",cbuton="";1==parseInt(atype)?(title=$filter("translate")("Are you sure you want to edit this bid?"),cbuton="Edit"):(title=$filter("translate")("Are you sure you want to withdraw this bid?"),cbuton="Withdraw"),swal({title:title,text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var flashMessage="";if(1==parseInt(atype))$state.go("Bid_ProjectView",{id:$scope.mybids[indexVal].project.id,slug:$scope.mybids[indexVal].project.slug,placebid:!0,edit:!0});else{var params={};params.is_freelancer_withdrawn=1,BidRetake.put({id:bidId},params,function(response){if(0===response.error.code){flashMessage=$filter("translate")("Your bid withdrawn successfully."),flash.set(flashMessage,"success",!1);var params=$state.params;params.placebid=!0,$state.go("Bid_ProjectView",params)}else flashMessage=$filter("translate")("Please try again."),flash.set(flashMessage,"error",!1)})}}})}}}),angular.module("getlancerApp.Bidding").controller("ProjectPaymentController",function($rootScope,$scope,$window,countries,states,cities,$stateParams,usersAddresses,wallet,flash,$location,$filter,$state,paymentGateways,userSettings,ConstPaymentGateways,ProjectEditView,UserMeFactory,PaymentOrderFactory,$uibModalStack){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Confirm your Payment"),$scope.id=$stateParams.id,$scope.minimum_wallet_amount=$rootScope.settings.WALLET_MIN_WALLET_AMOUNT,$scope.maximum_wallet_amount=$rootScope.settings.WALLET_MAX_WALLET_AMOUNT,$scope.buyer={},$scope.plan={},$scope.paynow_is_disabled=!1,$scope.payment_note_enabled=!1,$scope.payer_form_enabled=!0,$scope.is_wallet_page=!0,$scope.plan_info={},$scope.save_btn=!1,$scope.first_gateway_id="",$scope.plan_info.price_final=10,$scope.index=function(){ProjectEditView.get({id:$state.params.id},function(response){$scope.projectadd=response.data,$scope.total_listing_fee=response.data.total_listing_fee,$scope.projectTitle=response.data.name}),$scope.loader=!0,$scope.payment=!0,UserMeFactory.get({},function(response){$scope.user_available_balance=response.data.available_wallet_amount});$scope.payNowPaytabClick=function(){var flashMessage;$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="Project",$scope.buyer.user_id=$rootScope.user.id,$scope.buyer.amount=$scope.amount,$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayTab,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.buyer.lang=null!==$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY")?$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY"):"en",$scope.paynow_is_disabled=!0,PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.data.payment_url?$window.location.href=response.data.payment_url:(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):($scope.gatewayError=$filter("translate")(response.payment_response.error.message),flashMessage=$filter("translate")("Payment could not be completed.Please try again..."),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.payment_response.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.payment_response.error.message),"error",!1),$scope.paynow_is_disabled=!1})};var payment_gateways=[];paymentGateways.get(function(payment_response){console.log("6-----");if(payment_response.wallet&&($scope.wallet_enabled=!0,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0),payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}if(payment_response.PayPalREST){var response=payment_response.PayPalREST;response.paypalrest_enabled&&($scope.paypal_enabled=!0)}if(payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}$scope.is_show_wallet_paybtn?($scope.isPaytabs=!1,$scope.isPayPal=!1):$scope.isPaytabs?($scope.isPaytabs=!0,$scope.isPayPal=!1):($scope.isPaytabs=!1,$scope.isPayPal=!0),$scope.group_gateway_id="",0===payment_response.error.code&&void 0!==payment_response.zazpay&&(angular.forEach(payment_response.zazpay.gateways,function(gateway_group_value,gateway_group_key){0===gateway_group_key&&($scope.group_gateway_id=gateway_group_value.id,$scope.first_gateway_id=gateway_group_value.id),angular.forEach(gateway_group_value.gateways,function(payment_geteway_value,payment_geteway_key){var payment_gateway={},suffix="sp_";0===gateway_group_key&&($scope.sel_payment_gateway="sp_"+payment_geteway_value.id),suffix+=payment_geteway_value.id,payment_gateway.id=payment_geteway_value.id,payment_gateway.payment_id=suffix,payment_gateway.group_id=gateway_group_value.id,payment_gateway.display_name=payment_geteway_value.display_name,payment_gateway.thumb_url=payment_geteway_value.thumb_url,payment_gateway.suffix=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.form_fields=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.instruction_for_manual=payment_geteway_value.instruction_for_manual,payment_gateways.push(payment_gateway)})}),$scope.gateway_groups=payment_response.zazpay.gateways,$scope.payment_gateways=payment_gateways,$scope.form_fields_tpls=payment_response.zazpay._form_fields_tpls,$scope.show_form=[],$scope.form_fields=[],angular.forEach($scope.form_fields_tpls,function(key,value){"buyer"===value&&($scope.form_fields[value]="views/buyer.html"),"credit_card"===value&&($scope.form_fields[value]="views/credit_card.html"),"manual"===value&&($scope.form_fields[value]="views/manual.html"),$scope.show_form[value]=!0}),$scope.gateway_id=ConstPaymentGateways.ZazPay),$scope.loader=!1})},$scope.applyCoupon=function(){var params={};params.coupon_code=$scope.plan.coupon,params.amount=$scope.project.zazpay_revised_amount,CouponGetStatusFactory.get(params,function(response){if($scope.discountCoupon=response,0===response.error.code)if($scope.discountCoupon.data.discount_type_id==ConstDiscountType.Amount)$scope.plan_info.price_final=parseFloat($scope.project.zazpay_revised_amount)-parseFloat(response.data.discount),$scope.show_discount=$filter("currency")(response.data.discount);else{var discount_amt=response.data.discount/100*$scope.project.zazpay_revised_amount;$scope.plan_info.price_final=$scope.project.zazpay_revised_amount-discount_amt,$scope.show_discount=$filter("translate")(response.data.discount+"%")}else flash.set($filter("translate")(response.error.message),"error",!1),$scope.plan.coupon=""})},$scope.ClearCoupon=function(){$scope.plan_info.price_final=$scope.project.zazpay_revised_amount,$scope.purchase_plan_coupon=!1,$scope.show_discount=!1},$scope.paneChanged=function(pane){"Manual / Offline"===pane&&($scope.payment_note_enabled=!0);var keepGoing=!0;$scope.buyer={},$scope.PaymentForm.$setPristine(),$scope.PaymentForm.$setUntouched(),angular.forEach($scope.form_fields_tpls,function(key,value){$scope.show_form[value]=!1}),$scope.gateway_id=ConstPaymentGateways.ZazPay,angular.forEach($scope.gateway_groups,function(res){if(res.display_name===pane&&"Wallet"!==pane){var selPayment="";angular.forEach($scope.payment_gateways,function(response){keepGoing&&response.group_id===res.id&&(selPayment=response,keepGoing=!1,$scope.rdoclick(selPayment.id,selPayment.form_fields))}),$scope.sel_payment_gateway="sp_"+selPayment.id,$scope.group_gateway_id=selPayment.group_id}}),"Wallet"===pane?$scope.gateway_id=ConstPaymentGateways.Wallet:"paypal"===pane&&($scope.gateway_id=ConstPaymentGateways.PayPal)},$scope.rdoclick=function(res,res1){$scope.paynow_is_disabled=!1,$scope.sel_payment_gateway="sp_"+res,$scope.array=res1.split(","),angular.forEach($scope.array,function(value){$scope.show_form[value]=!0})},$scope.PaymentFormSubmit=function(form){var payment_id="";if($scope.sel_payment_gateway&&$scope.gateway_id===ConstPaymentGateways.ZazPay&&(payment_id=$scope.sel_payment_gateway.split("_")[1]),$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="Project",$scope.buyer.buyer_name=$scope.buyer.credit_card_name_on_card,$scope.buyer.payment_gateway_id=$scope.gateway_id,$scope.buyer.gateway_id=payment_id,$scope.buyer.coupon_code=$scope.plan.coupon,angular.isDefined($scope.buyer.credit_card_expired)&&($scope.buyer.credit_card_expired.month||$scope.buyer.credit_card_expired.year)&&($scope.buyer.credit_card_expire=$scope.buyer.credit_card_expired.month+"/"+$scope.buyer.credit_card_expired.year),form){$scope.paynow_is_disabled=!0;var flashMessage;if(parseFloat($scope.plan_info.price_final)>parseFloat($scope.user_available_balance)&&$scope.gateway_id===ConstPaymentGateways.Wallet)return flashMessage=$filter("translate")("Your wallet has insufficient money."),flash.set(flashMessage,"error",!1),$scope.paynow_is_disabled=!1,!0;PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.reload()):0===response.error.code?("Captured"===response.payment_response.status&&($scope.my_user.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.total_listing_fee)),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.reload(),$state.go("user_dashboard")):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1,$uibModalStack.dismissAll()},function(error){console.log(error)})}},$scope.payNowPayPalClick=function(){var flashMessage;$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="Project",$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayPal,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.paynow_is_disabled=!0,PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.reload()):0===response.error.code?("Captured"===response.payment_response.status&&($scope.my_user.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.total_listing_fee)),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.reload(),$state.go("user_dashboard")):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1,$uibModalStack.dismissAll()},function(error){console.log(error)})},countries.get({limit:"all"},function(response){angular.isDefined(response.data)&&($scope.countries=response.data)}),$scope.index()}),angular.module("getlancerApp.Bidding").controller("ProjectAddCtrl",function($scope,$rootScope,$state,$filter,flash,Projects,ProjectStatus,ProjectSkills,ProjectCategory,ProjectRange,FileFormat,Upload,ProjectStatusConstant,$window,$timeout,AutocompleteUsers,ConstUserRole){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Post a Project"),$scope.data={},$timeout(function(){$scope.text_box=!0},1e3),$scope.show_custom_range=!1,$scope.project_bidding_fee=parseInt($rootScope.settings.PROJECT_MAX_BID_DURATION)||0,$scope.PROJECT_TOTAL_FEE=$rootScope.settings.PROJECT_LISTING_FEE,$scope.ProjectStatusConstant=ProjectStatusConstant,$scope.index=function(){$scope.data.skill_select=[],$scope.data.category_select=[],ProjectStatus.get(function(response){0===parseInt(response.error.code)?$scope.projectStatus=response.data:console.log("Status Error")},function(error){console.log("ProjectStatus Error",error)});var params={};params.limit="all",ProjectSkills.get(params,function(response){0===parseInt(response.error.code)?($scope.projectSkill=[],$scope.projectSkills=response.data,angular.forEach($scope.projectSkills,function(value){$scope.projectSkill.push({id:value.id,text:value.name}),void 0!==$scope.projectskillsList&&-1!=$scope.projectskillsList.indexOf(value.id)&&$scope.data.skill_select.push({id:value.id,text:value.name})})):console.log("Skills Error")},function(error){console.log("Skills Error",error)}),AutocompleteUsers.get(function(response){0===parseInt(response.error.code)?($scope.employerUser=[],$scope.employerUsers=response.data,angular.forEach($scope.employerUsers,function(value){$scope.employerUser.push({id:value.id,text:value.username}),void 0!==$scope.employerUsersList&&-1!=$scope.employerUsersList.indexOf(value.id)&&$scope.data.user_select.push({id:value.id,text:value.username})})):console.log("Users Error")},function(error){console.log("Users Error",error)}),ProjectRange.get(function(response){0===parseInt(response.error.code)?($scope.projectRanges=[],angular.forEach(response.data,function(value){$scope.projectRanges.push({id:value.id,name:value.name+" ("+$rootScope.settings.CURRENCY_SYMBOL+value.min_amount+" - "+$rootScope.settings.CURRENCY_SYMBOL+ +value.max_amount+")"})}),$scope.projectRanges.push({id:0,name:"Custom Range"})):console.log("Ranges Error")},function(error){console.log("projectRanges Error",error)}),ProjectCategory.get(function(response){0===parseInt(response.error.code)?($scope.projectCategories=response.data,$scope.projectCat=[],angular.forEach($scope.projectCategories,function(value){$scope.projectCat.push({id:value.id,text:value.name}),void 0!==$scope.projectCategoriesList&&-1!=$scope.projectCategoriesList.indexOf(value.id)&&$scope.data.category_select.push({id:value.id,text:value.name})})):console.log("Categories Error")},function(error){console.log("ProjectCategory Error",error)})},$scope.index(),$scope.loadCategories=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.projectCat,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.loadSkills=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.projectSkill,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.loadEmployers=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.employerUser,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.save_btn=!1,$scope.postProject=function($valid,projectFrm,data,type){$valid&&!$scope.error_message?($scope.save_btn=!0,1===type?data.project_status_id=ProjectStatusConstant.Draft:data.project_status_id=ProjectStatusConstant.PaymentPending,'Custom Range"'===data.project_range_id&&($scope.custom_range={}),angular.isDefined(data.skill_select)&&Object.keys(data.skill_select).length>0&&($scope.seperate_skills=[],angular.forEach(data.skill_select,function(value){$scope.seperate_skills.push(value.text)}),data.skills=$scope.seperate_skills.toString()),angular.isDefined(data.category_select)&&Object.keys(data.category_select).length>0&&(data.project_categories=[],angular.forEach(data.category_select,function(value){data.project_categories.push({project_category_id:value.id})})),angular.isUndefined(data.user_id)&&(data.user_id=ConstUserRole.Admin),Projects.post($scope.data,function(response){var flashMessage;0===parseInt(response.error.code)?(1===type?(flashMessage=$filter("translate")("Project stored in draft successfully."),$state.go("user_dashboard",{type:"my_projects",status:"draft_payment_pending"})):(flashMessage=$filter("translate")("Project added successfully."),response.total_listing_fee>0?$state.go("Bid_ProjectPayment",{id:response.id,slug:response.slug}):$state.go("Bid_ProjectView",{id:response.id,slug:response.slug})),flash.set(flashMessage,"success",!1)):($scope.save_btn=!1,flashMessage=1===type?$filter("translate")("Project stored in draft failed."):$filter("translate")("Project added failed."),flash.set(flashMessage,"error",!1))},function(error){console.log("postProject Error",error)})):$timeout(function(){$(".error").each(function(){return $(this).hasClass("ng-hide")?void 0:($scope.scrollvalidate($(this).offset().top-140),!1)})},100)},$scope.scrollvalidate=function(topvalue){$("html, body").animate({scrollTop:topvalue})},$scope.customRange=function(val){0===parseInt(val)?$scope.show_custom_range=!0:$scope.show_custom_range=!1},$scope.upload=function(file){Upload.upload({url:"/api/v1/attachments?class=Project",data:{file:file}}).then(function(response){0===response.data.error.code?($scope.data.image=response.data.attachment,$scope.error_message=""):$scope.error_message=response.data.error.message})},$scope.amount_find=!0,$scope.projectFeatureFeeAdd=function(value){$scope.data.is_featured?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))},$scope.projectUrgentFeeAdd=function(value){$scope.data.is_urgent?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))},$scope.projectPrivateFeeAdd=function(value){$scope.data.is_private?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))},$scope.projectHiddenFeeAdd=function(value){$scope.data.is_hidded_bid?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))}}).controller("ProjectEditCtrl",function($scope,$rootScope,$state,$filter,flash,ProjectEditView,ProjectStatus,ProjectSkills,ProjectCategory,ProjectRange,ProjectStatusConstant,md5,$timeout,AutocompleteUsers,ConstUserRole,Upload){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Edit Project"),$timeout(function(){$scope.text_box=!0},1e3),$scope.projectRanges=[],$scope.projectRangesId=[],$scope.OpenForBidding=ProjectStatusConstant.OpenForBidding,$scope.PendingApproval=ProjectStatusConstant.PendingForApproval,$scope.Draft=ProjectStatusConstant.Draft,$scope.paymentPending=ProjectStatusConstant.PaymentPending,$scope.projectCustomCheck=0,$scope.PROJECT_TOTAL_FEE=$rootScope.settings.PROJECT_LISTING_FEE,$scope.project_bidding_fee=parseInt($rootScope.settings.PROJECT_MAX_BID_DURATION)||0,$scope.index=function(){function skillCategoriesBack(){var params={};params.limit="all",params.project_id=$state.params.id,ProjectSkills.get(params,function(response){0===parseInt(response.error.code)?($scope.projectSkills=response.data,$scope.projectSkill=[],$scope.data.skill_select=[],angular.forEach($scope.projectSkills,function(value){$scope.projectSkill.push({id:value.id,text:value.name}),""!==selectedSkill&&-1!=selectedSkill.indexOf(value.id)&&$scope.data.skill_select.push({id:value.id,text:value.name})})):console.log("Skills Error")},function(error){console.log("Skills Error",error)}),ProjectCategory.get(function(response){0===parseInt(response.error.code)?($scope.projectCategories=response.data,$scope.projectCat=[],$scope.data.category_select=[],angular.forEach($scope.projectCategories,function(catvalueFinal){$scope.projectCat.push({id:catvalueFinal.id,text:catvalueFinal.name}),-1!=selectedProjectCat.indexOf(catvalueFinal.id)&&$scope.data.category_select.push({id:catvalueFinal.id,text:catvalueFinal.name})})):console.log("Categories Error")},function(error){console.log("ProjectCategory Error",error)}),AutocompleteUsers.get(function(response){0===parseInt(response.error.code)?($scope.employerUser=[],$scope.employerUsers=response.data,$scope.data.user_select=[],angular.forEach($scope.employerUsers,function(value){$scope.employerUser.push({id:value.id,text:value.username})})):console.log("User Error")},function(error){console.log("Users Error",error)})}var selectedSkill=[],selectedProjectCat=[],params={id:$state.params.id};$state.params.status&&(params.status=$state.params.status),$scope.customRange=function(val){$scope.data.custom_range={},parseInt(val)==parseInt($scope.projectCustomCheck)?($scope.show_custom_range=!0,$scope.data.custom_range.min_amount=""):($scope.show_custom_range=!1,delete $scope.data.custom_range)},ProjectEditView.get(params,function(response){response.data.project_status_id<$scope.OpenForBidding?0===parseInt(response.error.code)?($scope.data={},$scope.data.name=response.data.name,$scope.data.description=response.data.description,$scope.data.bid_duration=response.data.bid_duration,$scope.data.additional_descriptions=response.data.additional_descriptions,$scope.data.project_status_id=response.data.project_status_id,$scope.data.is_featured=response.data.is_featured,$scope.data.is_private=response.data.is_private,$scope.data.is_urgent=response.data.is_urgent,$scope.data.is_hidded_bid=response.data.is_hidded_bid,$scope.data.user_id=response.data.user_id,$scope.data.username=response.data.user.username,$scope.accessCard={id:response.data.user_id,username:response.data.user.username},$scope.data.project_range_id=parseInt(response.data.project_range_id),angular.forEach(response.data.skills_projects,function(value){selectedSkill.push(value.skills.id)}),angular.forEach(response.data.projects_project_categories,function(catvalue){selectedProjectCat.push(catvalue.project_categories.id)}),angular.element(document.getElementsByClassName("btn dropdown-toggle")).prop("title",$scope.data.username),angular.element(".filter-option").text($scope.data.username),skillCategoriesBack(),ProjectRange.get(function(response){0===parseInt(response.error.code)?($scope.amount_find=!0,angular.forEach(response.data,function(value){$scope.projectRangesId.push(value.id),$scope.data.project_range_id===value.id&&($scope.project_range=value.id),$scope.projectRanges.push({id:value.id,name:value.name+" ("+$rootScope.settings.CURRENCY_SYMBOL+value.min_amount+" - "+$rootScope.settings.CURRENCY_SYMBOL+ +value.max_amount+")"})})):console.log("Ranges Error"),$scope.data.project_range_id===$scope.project_range?$scope.show_custom_range=!1:($scope.show_custom_range=!0,$scope.custom_id=0,$scope.data.project_range_id=0)},function(error){console.log("projectRanges Error",error)}),$scope.projectRangesId.indexOf(response.data.project_range_id)>-1?($scope.data.project_range_id=response.data.project_range_id,delete $scope.data.custom_range):($scope.range={},$scope.data.custom_range={},$scope.data.custom_range.min_amount=Number(response.data.project_range.min_amount),$scope.data.custom_range.max_amount=Number(response.data.project_range.max_amount)),$scope.projectRangesId.indexOf($scope.data.project_range_id)?$scope.projectRanges.push({id:0,name:"Custom Range"}):($scope.projectRanges.push({id:$scope.data.project_range_id,name:"Custom Range"}),$scope.projectCustomCheck=$scope.data.project_range_id),angular.isDefined(response.data.attachment)&&null!==response.data.attachment&&($scope.project_filename=response.data.attachment.filename),$scope.data.is_featured&&($scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt($rootScope.settings.PROJECT_FEATURED_FEE||0)),$scope.data.is_urgent&&($scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt($rootScope.settings.PROJECT_URGENT_FEE||0)),$scope.data.is_private&&($scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt($rootScope.settings.PROJECT_PRIVATE_PROJECT_FEE||0)),$scope.data.is_hidded_bid&&($scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt($rootScope.settings.PROJECT_HIDDEN_BID_FEE||0))):console.log("Skills Error"):($scope.data={},$scope.data.project_status_id=response.data.project_status_id,$scope.data.name=response.data.name,$scope.data.additional_descriptions=response.data.additional_descriptions,angular.forEach(response.data.skills_projects,function(value){selectedSkill.push(value.skills.id)}),skillCategoriesBack())}),ProjectStatus.get(function(response){0===parseInt(response.error.code)?$scope.projectStatus=response.data:console.log("Status Error")},function(error){console.log("ProjectStatus Error",error)})},$scope.index(),$scope.loadCategories=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.projectCat,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.loadSkills=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.projectSkill,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.loadEmployers=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.employerUser,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.upload=function(file){Upload.upload({url:"/api/v1/attachments?class=Project",data:{file:file}}).then(function(response){0===response.data.error.code?($scope.data.image=response.data.attachment,$scope.error_message=""):$scope.error_message=response.data.error.message})},$scope.save_btn=!1,$scope.showform=!1,$scope.postProject=function($valid,data,type){$valid&&!$scope.error_message?($scope.showform=!0,$scope.save_btn=!0,1===type?data.project_status_id=ProjectStatusConstant.Draft:2===type?data.project_status_id=ProjectStatusConstant.PaymentPending:delete data.project_status_id,"custom"===data.project_range_id&&($scope.custom_range={}),angular.isDefined(data.skill_select)&&Object.keys(data.skill_select).length>0&&($scope.seperate_skills=[],angular.forEach(data.skill_select,function(value){$scope.seperate_skills.push(value.text)}),data.skills=$scope.seperate_skills.toString()),angular.isDefined(data.category_select)&&Object.keys(data.category_select).length>0&&(data.project_categories=[],angular.forEach(data.category_select,function(value){data.project_categories.push({project_category_id:value.id})})),angular.isUndefined(data.user_id)&&(data.user_id=ConstUserRole.Admin),ProjectEditView.put({id:$state.params.id},data,function(response){var flashMessage;0===parseInt(response.error.code)?(1===type?(flashMessage=$filter("translate")("Project stored in draft successfully."),$state.go("user_dashboard",{type:"my_projects",status:"draft_payment_pending"})):(flashMessage=$filter("translate")("Project updated successfully."), response.total_listing_fee>0&&response.project_status_id!=$scope.OpenForBidding&&response.project_status_id!=$scope.PendingApproval?$state.go("Bid_ProjectPayment",{id:response.id,slug:response.slug}):response.project_status_id==$scope.OpenForBidding?(flashMessage=$filter("translate")("Project updated successfully."),$state.go("Bid_ProjectView",{id:response.id,slug:response.slug})):response.project_status_id==$scope.PendingApproval?(flashMessage=$filter("translate")("Project updated successfully."),$state.go("user_dashboard",{type:"my_projects",status:"open_bidding"})):$state.go("Bid_ProjectView",{id:response.id,slug:response.slug})),flash.set(flashMessage,"success",!1)):(1===type?(flashMessage=$filter("translate")("Project stored in draft failed."),$state.go("Bid_Projects")):flashMessage=$filter("translate")("Project update failed."),flash.set(flashMessage,"error",!1))},function(error){console.log("postProject Error",error)})):$timeout(function(){$(".error").each(function(){return $(this).hasClass("ng-hide")?void 0:($scope.scrollvalidate($(this).offset().top-140),!1)})},100)},$scope.scrollvalidate=function(topvalue){$("html, body").animate({scrollTop:topvalue})},$scope.projectFeatureFeeAdd=function(value){$scope.amount_find=!0,$scope.data.is_featured?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))},$scope.projectUrgentFeeAdd=function(value){$scope.data.is_urgent?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))},$scope.projectPrivateFeeAdd=function(value){$scope.data.is_private?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))},$scope.projectHiddenFeeAdd=function(value){$scope.data.is_hidded_bid?($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)+parseInt(value||0)},100)):($scope.amount_find=!1,$timeout(function(){$scope.amount_find=!0,$scope.PROJECT_TOTAL_FEE=parseInt($scope.PROJECT_TOTAL_FEE||0)-parseInt(value||0)},100))}}).controller("ProjectsListCtrl",function($scope,$rootScope,$state,$filter,$location,flash,Projects,ProjectStatus,ProjectSkills,ProjectCategory,ProjectStatusConstant,$stateParams){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Browse Projects"),$scope.data=[],$scope.priceSlider=150,$scope.params={},$scope.sortby=$scope.params.sortby="desc",$scope.created_at="down",$scope.OpenForBidding=ProjectStatusConstant.OpenForBidding,$scope.bookmarked=!0,$scope.data={search:$state.params.search,project_categories:$state.params.categories,skills:$state.params.skills,price_range_min:$state.params.price_range_min,price_range_max:$state.params.price_range_max,project_status_id:$scope.OpenForBidding,page:void 0!==$scope.currentPage?$scope.currentPage:1},$scope.orderPosted=function(sortby){$scope.sort="created_at",$scope.sortby=sortby,"asc"===sortby&&($scope.created_at="down"),$scope.sortby="desc","desc"===sortby&&($scope.sortby="asc",$scope.created_at="up"),$scope.index()},"bookmarked"==$state.params.type?($scope.type="bookmarked",$scope.bookmarked=!1,$scope.skill=!1):"my_skills"==$state.params.type?($scope.type="my_skills",$scope.bookmarked=!1,$scope.skill=!0):($scope.type="price_range",$scope.bookmarked=!0),$scope.index=function(params){$scope.slider={},$scope.getProjects(),$scope.loader=!0,Projects.get({type:$scope.type},function(response){angular.isDefined(response.data)&&($scope.minimum_price=response.data.min_price,$scope.maximum_price=response.data.max_price,null==response.data.min_price&&null==response.data.max_price?($scope.min_price=0,$scope.max_price=1e3):null!=response.data.min_price&&null!=response.data.max_price&&($scope.min_price=$scope.minimum_price,$scope.max_price=$scope.maximum_price),angular.isDefined($state.params.price_range_min)&&angular.isDefined($state.params.price_range_max)&&($scope.min_price=$state.params.price_range_min,$scope.max_price=$state.params.price_range_max),null==response.data.min_price&&null==response.data.max_price?$scope.slider={min:$scope.min_price,max:$scope.max_price,options:{floor:parseInt($scope.min_price),ceil:parseInt($scope.max_price)}}:null!=response.data.min_price&&null!=response.data.max_price&&void 0===$stateParams.price_range_max&&void 0===$stateParams.price_range_max?$scope.slider={min:$scope.minimum_price,max:$scope.maximum_price,options:{floor:parseInt(response.data.min_price),ceil:parseInt(response.data.max_price)}}:$scope.slider={min:$stateParams.price_range_min,max:$stateParams.price_range_max,options:{floor:parseInt(response.data.min_price),ceil:parseInt(response.data.max_price)}})})},$scope.getProjects=function(){var params={};void 0!=$stateParams.search&&(params.search=$stateParams.search),void 0!=$stateParams.project_categories&&(params.project_categories=$stateParams.project_categories),void 0!=$stateParams.skills&&(params.skills=$stateParams.skills),void 0!=$stateParams.price_range_max&&(params.price_range_max=$stateParams.price_range_max),void 0!=$stateParams.price_range_min&&(params.price_range_min=$stateParams.price_range_min),"bookmarked"===$state.params.type&&(params.type="bookmarked",$scope.bookmarked=!1),"my_skills"===$state.params.type&&(params.type="my_skills",$scope.bookmarked=!1),void 0===$state.params.page?params.page=1:params.page=$state.params.page,void 0!==$scope.sort&&(params.sort=$scope.sort,params.sortby=$scope.sortby),Projects.get(params,function(response){angular.isDefined(response._metadata)&&($scope.currentPage=response._metadata.current_page,$scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page),angular.isDefined(response.data)?$scope.projects=response.data:($scope.projects="",$scope.errorMessage="",angular.isDefined(response.error)&&($scope.errorMessage=response.error.message),$scope.currentPage=0,$scope.totalItems=0,$scope.itemsPerPage=0,$scope.noOfPages=0),$scope.loader=!1})},ProjectCategory.get(function(response){if(0===parseInt(response.error.code)){$scope.projectCategories=response.data,$scope.projectCat=[],$scope.data.category_select=[];var selectedProjectCat="";angular.isDefined($state.params.project_categories)&&(selectedProjectCat=$state.params.project_categories.split(",")),angular.forEach($scope.projectCategories,function(value){$scope.projectCat.push({id:value.id,text:value.name}),""!==selectedProjectCat&&-1!=selectedProjectCat.indexOf(value.id.toString())&&$scope.data.category_select.push({id:value.id,text:value.name})})}else console.log("Categories Error")},function(error){console.log("ProjectCategory Error",error)}),$scope.loadCategories=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.projectCat,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items};var params={};params.limit="all",ProjectSkills.get(params,function(response){if(0===parseInt(response.error.code)){$scope.projectSkill=[],$scope.projectSkills=response.data,$scope.data.skill_select=[];var selectedSkill="";angular.isDefined($state.params.skills)&&(selectedSkill=$state.params.skills.split(",")),angular.forEach($scope.projectSkills,function(value){$scope.projectSkill.push({id:value.id,text:value.name}),""!==selectedSkill&&-1!=selectedSkill.indexOf(value.id.toString())&&$scope.data.skill_select.push({id:value.id,text:value.name})})}else console.log("Skills Error")},function(error){console.log("Skills Error",error)}),$scope.loadSkills=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.projectSkill,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.refinesearch=function(data){if(angular.isDefined(data.skill_select)&&Object.keys(data.skill_select).length>0){var skills=[];angular.forEach(data.skill_select,function(value){skills.push(value.id)}),data.skills=skills.toString()}else data.skills="";if(angular.isDefined(data.category_select)&&Object.keys(data.category_select).length>0){var categories=[];angular.forEach(data.category_select,function(value){categories.push(value.id)}),data.categories=categories.toString()}$scope.params={search:data.search,project_categories:data.categories,skills:data.skills,price_range_min:$scope.slider.min,price_range_max:$scope.slider.max},$state.go("Bid_Projects",$scope.params)},$scope.paginate=function(){$scope.currentPage=parseInt($scope.currentPage),$state.go("Bid_Projects",{page:$scope.currentPage}),$scope.getProjects()},$scope.index()}).controller("ProjectViewCtrl",function($scope,$rootScope,$state,$filter,$cookies,flash,ProjectEditView,ProjectStatusConstant,BidStatusConstant,md5,$window,FollowUser,FollowUserDelete,$timeout,$uibModal,$uibModalStack){$scope.ProjectStatusConstant=ProjectStatusConstant,$scope.isprojectcancel=!1,$scope.is_show_follow=!1,$rootScope.projectlike={},$scope.rating_value=0;var flashMessage;0===parseInt($state.params.error_code)&&(flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1)),$scope.getProjectDetails=function(){ProjectEditView.get({id:$state.params.id,type:"view"},function(response){if(0===parseInt(response.error.code)){$scope.show_response_page=!0,$scope.project=response.data,$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Project")+" - "+$scope.project.name,angular.isDefined($scope.project.user.attachment)&&null!==$scope.project.user.attachment?$scope.project.user.user_avatar_url="images/large_thumb/UserAvatar/"+$scope.project.user.id+"."+md5.createHash("UserAvatar"+$scope.project.user.id+"pnglarge_thumb")+".png":$scope.project.user.user_avatar_url="images/default.png",angular.isDefined($scope.project.follower)&&$scope.project.follower.length>0?(angular.forEach($scope.project.follower,function(follower){$rootScope.book_id=follower.id}),$scope.is_book=!0):$scope.is_book=!1;var skillsList=[];angular.forEach($scope.project.skills_projects,function(value){skillsList.push(value.skills.id)}),$rootScope.projectlike.skills=skillsList;var categoriesList=[];angular.forEach($scope.project.projects_project_categories,function(value){categoriesList.push(parseInt(value.project_category_id))}),$rootScope.projectlike.categories=categoriesList,($scope.project.is_cancel_request_freelancer != '0'||$scope.project.is_cancel_request_employer != '0')&&($scope.isprojectcancel=!0,$rootScope.broadCastDataempolyer={notes:$scope.project.mutual_cancel_note},$rootScope.broadCastDatafreelancer={notes:$scope.project.mutual_cancel_note},$scope.is_freelancer=!1,$rootScope.broadCastDatafreelancer.is_show_accept=!$scope.is_freelancer&&$scope.project.is_cancel_request_employer?!1:!0,$rootScope.broadCastDatafreelancer.userinfo=$scope.project.project_bid.user.username,$rootScope.broadCastDatafreelancer.userImage=$scope.project.bid_winner.user.attachment,$rootScope.broadCastDatafreelancer.userId=$scope.project.project_bid.user.id,$rootScope.broadCastDatafreelancer.createdAt=$scope.project.created_at,$scope.is_freelancer=!0,$rootScope.broadCastDataempolyer.is_show_accept=$scope.is_freelancer&&$scope.project.is_cancel_request_freelancer?!1:!0,$rootScope.broadCastDataempolyer.userinfo=$scope.project.user.username,$rootScope.broadCastDataempolyer.userImage=$scope.project.user.attachment,$rootScope.broadCastDataempolyer.userId=$scope.project.user.id,$rootScope.broadCastDataempolyer.createdAt=$scope.project.created_at),parseInt($rootScope.user.id)===parseInt(response.data.user_id)?$scope.project_user=!0:($scope.project_user=!1,angular.isDefined($scope.project.owner_bid)&&null!==$scope.project.owner_bid&&Object.keys($scope.project.owner_bid.length>0)&&!$scope.project.owner_bid.is_freelancer_withdrawn?$scope.is_already_bidded=!0:$scope.is_already_bidded=!1,void 0!==$state.params.edit&&($scope.is_already_bidded=!1,$scope.is_bid_edit=!0)),parseInt($scope.project.project_status_id)>$scope.ProjectStatusConstant.OpenForBidding&&(parseInt($rootScope.user.id)===parseInt($scope.project.freelancer_user_id)?$scope.bid_lost=!1:$scope.bid_lost=!0);var listbroadcastData={is_show_lost:parseInt($rootScope.user.id)===parseInt($scope.project.freelancer_user_id)||parseInt($rootScope.user.id)===parseInt($scope.project.user_id)?!1:!0},isbookshow={projectid:$scope.project.id,isbook:$scope.is_book};$timeout(function(){$scope.$broadcast("showlostbids",listbroadcastData),$scope.$broadcast("showisbook",isbookshow),$scope.projectbidcount=response.data.project_bid.bid_count},2e3)}},function(error){console.log(error)})},$scope.getProjectDetails(),$scope.closeInstance=function(){$uibModalStack.dismissAll()},$scope.follow=function(){var flashMessage="";Object.keys($scope.project.user.follower).length>0?FollowUserDelete["delete"]({id:$scope.project.user.follower[0].id},function(response){0===response.error.code?(flashMessage=$filter("translate")("Unfollowed successfully"),flash.set(flashMessage,"success",!1),$scope.followBtn="Follow",$scope.getProjectDetails()):(flashMessage=$filter("translate")("Could not unfollow"),flash.set(flashMessage,"error",!1))}):FollowUser.post({foreign_id:$scope.project.user_id,"class":"User"},function(response){0===response.error.code?(flashMessage=$filter("translate")("Followed successfully."),flash.set(flashMessage,"success",!1),$scope.getProjectDetails(),$scope.followBtn="Unfollow"):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})},$scope.$on("is_show_follow",function(event,data){"showfollow"===data&&($scope.followBtn="Follow",Object.keys($scope.project.user.follower).length>0&&($scope.followBtn="Unfollow"),$scope.is_show_follow=!0)})}).controller("MyProjectsCtrl",function($scope,$rootScope,$state,$filter,flash,MyProjects,DelProject,ProjectStatus,ProjectStatusConstant,ProjectStatusUpdate){$scope.projectConstant=ProjectStatusConstant,$scope.index=function(){$scope.GetProjectStatus()},$scope.GetProjectStatus=function(){ProjectStatus.get(function(response){0===parseInt(response.error.code)&&($scope.projectStatus=response.data)},function(error){console.log(error)})},$scope.getProjects=function(tabType){2===tabType?(void 0===$state.params.status||"payment_pending"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"payment_pending"},{notify:!1}):1===tabType?(void 0===$state.params.status||"draft"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"draft"},{notify:!1}):3===tabType?(void 0===$state.params.status||"pending_approval"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"pending_approval"},{notify:!1}):4===tabType?(void 0===$state.params.status||"open_bidding"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"open_bidding"},{notify:!1}):5===tabType?(void 0===$state.params.status||"close_expiry"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"close_expiry"},{notify:!1}):6===tabType?(void 0===$state.params.status||"winner_selected"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"winner_selected"},{notify:!1}):11===tabType?(void 0===$state.params.status||"under_development"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"under_development"},{notify:!1}):14===tabType?(void 0===$state.params.status||"final_review"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"final_review"},{notify:!1}):16===tabType?(void 0===$state.params.status||"closed"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"closed"},{notify:!1}):13===tabType?(void 0===$state.params.status||"admin_cancel"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"admin_cancel"},{notify:!1}):12===tabType?(void 0===$state.params.status||"cancel"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"cancel"},{notify:!1}):(void 0===$state.params.status||"payment_pending"!==$state.params.status)&&$state.go("Bid_MeProjects",{status:"payment_pending"},{notify:!1}),1===parseInt(tabType)?$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Open Project"):2===parseInt(tabType)?$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Work in Progress"):$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Past Project"),$scope.params={project_status_id:tabType},$scope.StatusFilter=function(id){$scope.params={project_status_id:id}},MyProjects.get($scope.params,function(response){0===parseInt(response.error.code)&&($scope.projects=response.data)},function(error){console.log(error)})},$state.params.status?"draft"===$state.params.status?($scope.activeStatus=1,$scope.getProjects(1)):"pending_approval"===$state.params.status?($scope.activeStatus=2,$scope.getProjects(3)):"open_bidding"===$state.params.status?($scope.activeStatus=3,$scope.getProjects(4)):"close_expiry"===$state.params.status?($scope.activeStatus=4,$scope.getProjects(5)):"winner_selected"===$state.params.status?($scope.activeStatus=5,$scope.getProjects(6)):"under_development"===$state.params.status?($scope.activeStatus=6,$scope.getProjects(11)):"final_review"===$state.params.status?($scope.activeStatus=7,$scope.getProjects(14)):"closed"===$state.params.status?($scope.activeStatus=8,$scope.getProjects(16)):"admin_cancel"===$state.params.status?($scope.activeStatus=9,$scope.getProjects(13)):"cancel"===$state.params.status?($scope.activeStatus=10,$scope.getProjects(10)):($scope.activeStatus=0,$scope.getProjects(2)):$scope.getProjects(2),$scope.deleteProject=function(project_id){swal({title:$filter("translate")("Are you sure you want to delete?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel!",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){DelProject["delete"]({id:project_id},function(response){0===response.error.code?(flashMessage=$filter("translate")("Your project has been deleted successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Your project couldn't deleted. Please try again."),flash.set(flashMessage,"error",!1),$state.reload())})})},$scope.cancelProject=function(project_id){swal({title:$filter("translate")("Are you sure you want to cancel this project?"),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){ProjectStatusUpdate.put({id:project_id,project_status_id:$scope.projectConstant.EmployerCanceled},function(response){0===response.error.code?(flashMessage=$filter("translate")("Your project has been cancelled successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Your project couldn't cancelled. Please try again."),flash.set(flashMessage,"error",!1),$state.reload())})})},$scope.index()}),angular.module("getlancerApp.Bidding.Constant",[]).constant("DateFormat",{view:"MMM dd",created_12:"yyyy-MM-dd HH:mm",created_24:"yyyy-MM-dd hh:mma",created:"yyyy-MM-dd",title:"MMMM dd, yyyy hh:mma (EEEE)"}).constant("ClassName",{invoice:"Invoice",milestone:"Milestone",project:"Project"}).constant("FileFormat",{image:["jpg","gif","png","jpeg","bmp"],resume:["doc","docx","pdf","rtf","odt","docm","dot","txt"],project:["doc","docx","pdf","rtf","odt","docm","dot","txt","jpg","gif","png","jpeg"]}).constant("BidStatusConstant",{Pending:1,Won:2,Lost:3}).constant("BiddingMsgClass",{"class":"Bid",type:"inbox"}).constant("BiddingfileClass",{"class":"Project"}).constant("ExamStatusConstant",{Inprogress:1,Incomplete:2,Passed:3,Failed:4,ExamFeePaymentPending:5,FeePaidNotStarted:6,SuspendedDuetoTakingOvertime:7}).constant("PerDayExam",{NumOfTime:"2"}).constant("DisputeMsgClass",{"class":"ProjectDispute"}).constant("DisputeStatusConstant",{Open:1,UnderDiscussion:2,WaitingforAdministratorDecision:3,Closed:4}),angular.module("getlancerApp.Bidding").directive("fileDownload",function(md5,$location,$timeout){var directive={restrict:"EA",template:' ',scope:{attachment:"@",downloadlable:"@"},link:function(scope,element,attrs){scope.attachment=JSON.parse(scope.attachment);var download_file=md5.createHash(scope.attachment["class"]+scope.attachment.foreign_id+"docdownload")+".doc";scope.downloadUrl=$location.protocol()+"://"+$location.host()+"/download/"+scope.attachment["class"]+"/"+scope.attachment.foreign_id+"/"+download_file+"/"+scope.attachment.id,void 0===scope.downloadlable&&(scope.downloadlable=' ')}};return directive}).directive("numberOnly",function(){return{restrict:"EA",link:function(scope,elem,attr,ctrl){elem.bind("keyup",function(e){var text=this.value;this.value=text.replace(/[a-zA-Z]/g,"")})}}}).directive("biddingList",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_list.html",scope:{project:"@",projectuser:"@",projectstatus:"@",hiddienbid:"@",isbid:"@",projectbidid:"@",isprojectcancel:"@",isdispute:"@"},controller:function($rootScope,$scope,$filter,$state,$timeout,ProjectBids,ProjectStatusConstant,BidStatusConstant,AwardedBids,md5,$cookies,ProjectEditView,anchorSmoothScroll,ConstUserRole,$anchorScroll,$uibModal,flash){$scope.ConstUserRole=ConstUserRole,$scope.ProjectStatusConstant=ProjectStatusConstant,$scope.project_is_dispute=($scope.isdispute == "0")?false:true,$scope.auth=JSON.parse($cookies.get("auth")),parseInt($scope.auth.id)!==parseInt($scope.projectuser)?$scope.is_freelancer=!0:$scope.is_freelancer=!1,"withdraw"===$state.params.action?$rootScope.withdrawthisfreelancer=!0:$rootScope.withdrawthisfreelancer=!1,$scope.focusPortfolio=function(profile_user_id,profile_user_name){$state.go("user_profiles",{id:profile_user_id,slug:profile_user_name,portfolio:"portfolios"})},$scope.contactFreelancer=function(projectbidid,messagecount){$rootScope.message_bid_id=projectbidid,$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Bidding/Bidding/views/default/contact_freelancer.html",animation:!1,controller:function($scope,$rootScope,$window,$stateParams,$filter,md5,$state,Upload,$timeout,$uibModal,$uibModalStack,Messages,biduser,authuser,ProjectBids){var flashMessage="";$scope.MessagePage=1,$rootScope.closemodel=function(){$uibModalStack.dismissAll()},$scope.contact_freelancer=!1,$scope.data={},$scope.ContactMessages=[];({id:$stateParams.id,is_freelancer_withdrawn:!1});$rootScope.messagecount=messagecount,$scope.submit=function($valid){if($valid){$scope.contact_freelancer=!0;var contactData={};contactData.foreign_id=projectbidid,contactData.to_user_id=biduser,contactData.message=$scope.data.message,contactData["class"]="Bid",contactData.subject=$state.params.slug,Messages.post(contactData,function(response){$scope.contact_freelancer=!1,0===response.error.code?(flashMessage=$filter("translate")("Message sent successfully."),flash.set(flashMessage,"success",!1),$scope.data.message="",$scope.Contactfrm.$setPristine(),$scope.Contactfrm.$setUntouched(),$scope.ContactMessages=[],"0"===$rootScope.messagecount&&$state.reload(),$scope.MessagePage=1,$scope.GetConactMessage(),$scope.contact_freelancer=!1):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}},$scope.GetConactMessage=function(){var conactparams={};conactparams.foreign_id=$rootScope.message_bid_id,conactparams.limit=5,conactparams.sortby="desc",conactparams["class"]="Bid",conactparams.page=$scope.MessagePage,Messages.get(conactparams,function(response){angular.isDefined(response.data)&&(angular.isDefined(response._metadata)&&($scope.messageNoOfPages=response._metadata.last_page,$scope.ConactmessageTotal=response._metadata.total-response._metadata.current_page*response._metadata.per_page),0===parseInt(response.error.code)?angular.forEach(response.data,function(value){angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png",$scope.ContactMessages.push(value)}):$scope.ContactMessages=[])})},$scope.contactmessage_pagination=function(){$scope.MessagePage=parseInt($scope.MessagePage)+1,$scope.GetConactMessage()},$scope.GetConactMessage()},size:"lg",resolve:{biduser:function(){return $scope.biduser},authuser:function(){return $scope.auth.id}}})},$scope.showLoader=!0,$scope.awardLoader=!0,$scope.is_awarded=!1,$scope.biddings=[],$scope.mutual_cancel=!1,$scope.project_dispute=!1,$scope.project_review=!1,"mutual_cancel"===$state.params.action?($scope.mutual_cancel=!0,$timeout(function(){$anchorScroll("mutual-cancel")},2500)):"dispute"===$state.params.action?($scope.project_dispute=!0,$timeout(function(){$anchorScroll("dispute-block")},2500)):"review-form"===$state.params.action&&($scope.project_review=!0,$timeout(function(){$anchorScroll("update")},2500)),$timeout(function(){if(parseInt($scope.projectstatus)>=parseInt(ProjectStatusConstant.WinnerSelected))$scope.is_awarded=!0,$rootScope.getData=function(){if($scope.is_show_lost||ProjectStatusConstant.Closed){var params={id:$scope.project};parseInt($scope.auth.id)!==parseInt($scope.projectuser)?"false"===$scope.hiddienbid?($scope.otherBids(),$scope.userbids(params),$scope.hiddienbidShow=!0):($scope.biddings=[],$scope.hiddienbidShow=!1):($scope.hiddienbidShow=!0,$scope.otherBids(),$scope.userbids(params))}},$rootScope.getData(),AwardedBids.get({id:$scope.project,status:BidStatusConstant.Won,project_bid_id:$scope.projectbidid},function(response){0===parseInt(response.error.code)?($scope.awarded=response.data,angular.forEach($scope.awarded,function(value){angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png",$scope.project_failed_count=Number(value.user.project_failed_count||0),$scope.project_completed_count=Number(value.user.project_completed_count||0),$scope.total_count=$scope.project_failed_count+$scope.project_completed_count,$scope.mul=$scope.project_completed_count/$scope.total_count,value.completetion_rate=100*$scope.mul,value.rating_count=Number(Math.round(value.user.total_rating_as_freelancer/value.user.review_count_as_freelancer)||0)}),void 0!==$scope.awarded[0]&&parseInt($scope.auth.id)===parseInt($scope.awarded[0].user_id)?$rootScope.bid_awarded=!1:$rootScope.bid_awarded=!0,!$rootScope.bid_awarded&&$scope.is_freelancer&&$scope.$emit("is_show_follow","showfollow")):$scope.awarded=[],$scope.awardLoader=!1},function(error){console.log("Bidding List Directive",error)});else{var params={};"false"!==$scope.hiddienbid?parseInt($scope.auth.id)===parseInt($scope.projectuser)?(params={id:$scope.project,is_freelancer_withdrawn:!1},$scope.userbids(params),$scope.hiddienbidShow=!0):($scope.isbid?(params={id:$scope.project,user_id:$scope.auth.id,is_freelancer_withdrawn:!1},$scope.userbids(params)):($scope.biddings=[],params={id:$scope.project,user_id:$scope.auth.id,is_freelancer_withdrawn:!1},$scope.userbids(params)),$scope.hiddienbidShow=!0):($scope.hiddienbidShow=!0,params={id:$scope.project,is_freelancer_withdrawn:!1},$scope.userbids(params))}},2e3),$scope.$on("showlostbids",function(event,data){$scope.is_show_lost=data.is_show_lost}),$scope.userbids=function(params){params.project_id=$state.params.id,ProjectBids.get(params,function(response){0===parseInt(response.error.code)?($scope.biddings=response.data,angular.forEach($scope.biddings,function(value){void 0!==value.exams_users&&(0!=value.exams_users.length&&($scope.exam_users=value.exams_users,angular.forEach($scope.exam_users,function(exams){if($scope.total_mark=Number(exams.total_mark||0),$scope.total_question_count=Number(exams.total_question_count||0),$scope.average=$scope.total_mark/$scope.total_question_count,exams.exam_user_per=parseInt(100*$scope.average),angular.isDefined(exams.exam.attachment)&&null!==exams.exam.attachment){md5.createHash("Exam"+exams.exam.attachment.foreign_id+"pngsmall_normal_thumb");exams.exam_image="images/small_normal_thumb/Exam/"+exams.exam.attachment.foreign_id+"."+md5.createHash("Exam"+exams.exam.attachment.foreign_id+"pngsmall_normal_thumb")+".png"}else exams.exam_image="images/no-image.png"})),angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png",value.rating_count=Number(Math.round(value.user.total_rating_as_freelancer/value.user.review_count_as_freelancer)||0),$scope.project_failed_count=Number(value.user.project_failed_count||0),$scope.project_completed_count=Number(value.user.project_completed_count||0),$scope.total_count=$scope.project_failed_count+$scope.project_completed_count,$scope.mul=$scope.project_completed_count/$scope.total_count,value.completetion_rate=100*$scope.mul)}),$rootScope.scrollBids===!0&&$timeout(function(){$anchorScroll("bidsAll")},100)):$scope.biddings=[],$scope.showLoader=!1},function(error){console.log("Bidding List Directive",error)})},$scope.otherBids=function(){AwardedBids.get({id:$scope.project,status:BidStatusConstant.Lost,project_bid_id:$scope.projectbidid},function(response){0===parseInt(response.error.code)?($scope.biddings=response.data,angular.forEach($scope.biddings,function(value){angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png"})):$scope.biddings=[],$scope.showLoader=!1},function(error){console.log("Bidding List Directive",error)})},$scope.$on("choosenewfreelancer",function(event,data){$scope.choosenewfreelancer=!0}),$scope.showhideSkills=function(id,is_show){var skillId="skills-"+id;1===parseInt(is_show)?$("#"+skillId).attr("style","display:block"):$(".user-certificate-skills").attr("style","display:none")};var getParams={id:$state.params.id,fields:"id,project_status_id,is_dispute,is_cancel_request_freelancer,is_cancel_request_employer,user_id"};ProjectEditView.get(getParams,function(response){null!=response.data.bid_winner&&($scope.AwardedUserId=response.data.bid_winner.user_id,$rootScope.other_user_reviews=response.data.other_user_reviews),$rootScope.project_is_dispute=response.data.is_dispute,$scope.projectbidcount=response.data.project_bid.bid_count,$scope.projectbidcount>"1"&&($rootScope.newFreelancerSelect=!0),response.data.project_status_id==ProjectStatusConstant.FinalReviewPending&&ProjectStatusConstant.Closed?$rootScope.reviewShow=!0:$rootScope.reviewShow=!1,$scope.reviewsLists=response.data.reviews,$rootScope.userReview=!0;var sucesscount=0;angular.forEach($scope.reviewsLists,function(reviewList){angular.isDefined(reviewList.user.attachment)&&null!==reviewList.user.attachment?reviewList.user.user_avatar_url="images/big_thumb/UserAvatar/"+reviewList.user.id+"."+md5.createHash("UserAvatar"+reviewList.user.id+"pngbig_thumb")+".png":reviewList.user.user_avatar_url="images/default.png",1>sucesscount&&(reviewList.user_id==$rootScope.user.id?($rootScope.userReview=!1,sucesscount++):$rootScope.userReview=!0); })}),"withdraw"===$state.params.action&&$timeout(function(){$anchorScroll("withdaw_scroll")},1e3)}}}).directive("biddingPost",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_add.html",scope:{project:"@"},controller:function($rootScope,$scope,$state,$filter,$timeout,$location,flash,BidPost,BidUpdate,EditBid,$cookies,UserFactory){$scope.buttonText="Place Bid",$scope.showInfo=!0;var absUrl=$location.absUrl().split("?");$state.params.placebid?($rootScope.is_bid_enable=!0,$scope.is_bid_enable=!0):($rootScope.is_bid_enable=!1,$scope.is_bid_enable=!1),$rootScope.bidProject=function(){$rootScope.is_bid_enable=!0,$scope.is_bid_enable=!0;var params=$state.params;params.placebid=!0,$state.go("Bid_ProjectView",params)},$scope.cancleBid=function(){$rootScope.is_bid_enable=!1,$scope.is_bid_enable=!1,window.location.href=absUrl[0]},UserFactory.get({},function(response){$scope.available_credit_count=parseInt(response.data.available_credit_count)}),$timeout(function(){void 0!==$state.params.edit?($scope.buttonText="Update Bid",$scope.showInfo=!1,$scope.auth=JSON.parse($cookies.get("auth")),$scope.data={},EditBid.get({id:$scope.project,user:$scope.auth.id},function(response){$scope.showLoader=!1,0===parseInt(response.error.code)&&($scope.editBidId=parseInt(response.data[0].id),$scope.data={amount:parseInt(response.data[0].amount),duration:parseInt(response.data[0].duration),description:response.data[0].description})},function(error){console.log("Bidding List Directive",error)})):$scope.buttonText="Place Bid"},1e3),$scope.data={},$scope.save_btn=!1,$scope.postBid=function($valid,data){$valid&&($scope.save_btn=!0,data.project_id=$scope.project,void 0===$state.params.edit?BidPost.post(data,function(response){$scope.save_btn=!1;var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Bid posted successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1),$scope.save_btn=!1)},function(error){console.log("Bidding Directive",error)}):BidUpdate.put({id:$scope.editBidId},data,function(response){var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Bid updated successfully."),flash.set(flashMessage,"success",!1),$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,placebid:"",edit:""},{notify:!0})):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}))}}}}).directive("biddingActions",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_actions.html",scope:{bidid:"@",project:"@",biduser:"@",projectuser:"@",projectstatus:"@",reopenbid:"@"},controller:function($rootScope,$scope,$state,$filter,$location,flash,$timeout,$cookies,BidRetake,UpdateBidStatus,BidStatusConstant,ProjectStatusConstant,$uibModal){$scope.project_closed=ProjectStatusConstant.Closed,$scope.auth=JSON.parse($cookies.get("auth")),$state.params.placebid?$scope.is_bid_enable=!0:$scope.is_bid_enable=!1,parseInt($scope.projectstatus)>parseInt(ProjectStatusConstant.WinnerSelected)?($scope.is_disable_select_winner=!0,$rootScope.bid_awarded=!0,$rootScope.contact_winner=!0):parseInt($scope.projectstatus)===parseInt(ProjectStatusConstant.WinnerSelected)?($scope.is_disable_select_winner=!1,$rootScope.bid_awarded=!1,$rootScope.contact_winner=!1):($scope.is_disable_select_winner=!1,$rootScope.bid_awarded=!1,$rootScope.contact_winner=!0),parseInt($scope.auth.id)!==parseInt($scope.projectuser)?$scope.is_freelancer=!0:$scope.is_freelancer=!1,$scope.editBid=function(){$scope.is_bid_enable=!0;var params=$state.params;params.placebid=!0,params.edit=!0,$state.go("Bid_ProjectView",params)},$scope.data={},$scope.retakeBid=function(){swal({title:$filter("translate")("Are you sure you want to withdraw this bid?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var flashMessage="",params={};params.is_freelancer_withdrawn=1,BidRetake.put({id:$scope.bidid},params,function(response){if(0===response.error.code){flashMessage=$filter("translate")("Your bid withdrawn successfully."),flash.set(flashMessage,"success",!1);var params=$state.params;params.placebid=!0,$state.go("Bid_ProjectView",params)}else flashMessage=$filter("translate")("Please try again."),flash.set(flashMessage,"error",!1)})}})},$scope.selectWinner=function(){swal({title:$filter("translate")("Are you sure you want to select this expert as a winner?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var flashMessage="";if(void 0!==$scope.reopenbid)var updateParams={id:$scope.bidid,bid_status_id:BidStatusConstant.Won,new_winer_bid_id:$scope.bidid};else var updateParams={id:$scope.bidid,bid_status_id:BidStatusConstant.Won};UpdateBidStatus.put(updateParams,function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Winner selected successfully"),flash.set(flashMessage,"success",!1),$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:""},{reload:!0})):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))},function(error){console.log(error)})}})}}}}).directive("biddingAwarded",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_awarded.html",replace:"true",scope:{bidid:"@",project:"@",projectuser:"@",projectstatus:"@",windate:"@"},controller:function($scope,$rootScope,$state,$timeout,$cookies,$filter,flash,UpdateProjectStatus,ProjectStatusConstant,UpdateBidStatus,ProjectEditView){$scope.auth=JSON.parse($cookies.get("auth")),$scope.choosenewfreelancer=!1,parseInt($scope.projectstatus)===ProjectStatusConstant.WinnerSelected&&(moment($scope.windate).add($rootScope.settings.PROJECT_WITHDRAW_FREELANCER_DAYS,"days").unix()<=moment().unix()?$scope.is_hide_action=!1:$scope.is_hide_action=!0),parseInt($scope.projectuser)===parseInt($scope.auth.id)?$scope.is_freelancer=!1:$scope.is_freelancer=!0,$scope.awardedprocess=function(ftype){var alertTitle="";1===parseInt(ftype)?alertTitle=$filter("translate")("Are you sure you want to accept this project?"):2===parseInt(ftype)&&(alertTitle=$filter("translate")("Are you sure you want to reject this project?")),swal({title:alertTitle,text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var flashMessage="";if(1===parseInt(ftype))UpdateProjectStatus.put({id:$scope.project,project_status_id:ProjectStatusConstant.UnderDevelopment},function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Project successfully accepted and moved under developement status."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Check your wallet"),flash.set(flashMessage,"error",!1))},function(error){console.log(error)});else{var params={};params.id=$scope.bidid,UpdateBidStatus.put(params,{is_offered_rejected:1},function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("You are successfully ignore this project request."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Project couldn't rejected. Please try again."),flash.set(flashMessage,"error",!1))},function(error){console.log("BiddingAwardDirective",error)})}}})},ProjectEditView.get({id:$state.params.id},function(response){$scope.biddinglist=response.data,$scope.bidEndDate=$scope.biddinglist.bid_winner.is_reached_response_end_date_for_freelancer}),$scope.reopen=function(rtype){swal({title:1===parseInt(rtype)?$filter("translate")("Are you sure you want to choose a new expert?"):$filter("translate")("Are you sure you want to reopen this project?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&(1===parseInt(rtype)?($state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"withdraw"},{reload:!0}),$scope.choosenewfreelancer=!0,$scope.$emit("choosenewfreelancer","true")):UpdateProjectStatus.put({id:$scope.project,project_status_id:ProjectStatusConstant.OpenForBidding,withdraw_bid_id:$scope.bidid},function(response){0===parseInt(response.error.code)?(flash.set($filter("translate")("Project reopen successfully"),"success",!1),$state.reload()):flash.set($filter("translate")("Project reopen failed"),"error",!1)}))})}}}}).directive("biddingAwardedTabs",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_awarded_tabs.html",scope:{bidid:"@",project:"@",projectuser:"@",projectstatus:"@",isdispute:"@"},controller:function($scope,$rootScope,$timeout,$state,$cookies,$filter,flash,md5,ProjectStatusConstant,Messages,Upload,Invoice,BiddingMsgClass,FileFormat,BiddingfileClass,Files,MilestoneStatusConstant,biddingProjectTransactions,TransactionUserMessage){$scope.TransactionUserMessage=TransactionUserMessage,$scope.project_is_dispute=($scope.isdispute == "0")?false:true,$scope.ProjectStatusConstant=ProjectStatusConstant,$scope.BiddingMsgClass=BiddingMsgClass,$scope.FileFormat=FileFormat,$scope.messages=[],$scope.MessagePage=1,$scope.projectBid={id:$state.params.id,slug:$state.params.slug,action:$state.params.action},$scope.renderpage="",$scope.auth=JSON.parse($cookies.get("auth")),parseInt($scope.projectuser)===parseInt($scope.auth.id)?$scope.is_freelancer=!1:$scope.is_freelancer=!0,$scope.selectedTab=function(tabSelected){if($scope.projectBid.action=tabSelected,$scope.is_show_loader=!0,$scope.buttonName=$scope.is_freelancer===!0?"Request Milestone":"Create Milestone","messages"===tabSelected)$scope.MessagePage=1,$scope.renderpage="scripts/plugins/Bidding/Bidding/views/default/bidding_message.html",(void 0===$state.params.action||"messages"!==$state.params.action)&&$state.go("Bid_ProjectView",$scope.projectBid,{notify:!1}),$scope.data={},$scope.message_Frm=!1,$scope.PostMessages=function(messageFrm,$valid){var msgparams={"class":$scope.BiddingMsgClass["class"],foreign_id:$scope.bidid};$valid&&($scope.message_Frm=!0,msgparams.parent_id=0,msgparams.subject="Project Bidding Message",msgparams.message=$scope.data.message,msgparams.image=$scope.file,delete msgparams.type,Messages.post(msgparams,function(response){var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Message sent successfully."),flash.set(flashMessage,"success",!1),$scope.data.message="",$scope.messages=[],$scope.MessagePage=1,$scope.GetMessages(),messageFrm.$setPristine(),messageFrm.$setUntouched()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1),$scope.message_Frm=!1)}))},$scope.GetMessages=function(){var msgparams={"class":$scope.BiddingMsgClass["class"],foreign_id:$scope.bidid,limit:10,page:$scope.MessagePage,sortby:"desc"};$scope.message_Frm=!1,Messages.get(msgparams,function(response){angular.isDefined(response.data)&&(angular.isDefined(response._metadata)&&($scope.messageNoOfPages=response._metadata.last_page,$scope.messageTotal=response._metadata.total-response._metadata.current_page*response._metadata.per_page),0===parseInt(response.error.code)?($scope.loadmore===!1&&($scope.messages=[]),angular.forEach(response.data,function(value){angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png",$scope.messages.push(value)})):$scope.messages=[])})},$scope.message_pagination=function(){$scope.loadmore=!0,$scope.MessagePage=parseInt($scope.MessagePage)+1,$scope.GetMessages()},$scope.GetMessages();else if("invoices"===tabSelected)$scope.loadmore=!1,$scope.renderpage="scripts/plugins/Bidding/Invoice/views/default/bidding_invoice.html",(void 0===$state.params.action||"invoices"!==$state.params.action)&&$state.go("Bid_ProjectView",$scope.projectBid,{notify:!1}),$scope.invoiceparams={bid_id:$scope.bidid};else if("files"===tabSelected)$scope.loadmore=!1,$scope.renderpage="scripts/plugins/Bidding/Bidding/views/default/bidding_files.html",$scope.is_show_upload_form=!1,$scope.showUpload=function(val){val===!1?$scope.is_show_upload_form=!0:$scope.is_show_upload_form=!1},(void 0===$state.params.action||"files"!==$state.params.action)&&$state.go("Bid_ProjectView",$scope.projectBid,{notify:!1}),$scope.BiddingfileClass=BiddingfileClass,$scope.GetFiles=function(){Files.get({project_id:$scope.project},function(response){0===parseInt(response.error.code)?$scope.ProjectFiles=response.data:$scope.ProjectFiles=[]})},$scope.uploadFile=function(file){Upload.upload({url:"/api/v1/attachments?class=Project",data:{file:file}}).then(function(response){0===response.data.error.code?($scope.uploadfile=response.data.attachment,$scope.error_message=""):$scope.error_message=response.data.error.message})},$scope.file_Frm=!1,$scope.PostFiles=function($fileValid,fileFrm){if($fileValid&!$scope.error_message){$scope.file_Frm=!0;var flashMessage="";$scope.projectfile={},$scope.projectfile.files=[{file:$scope.uploadfile}],$scope.projectfile["class"]=$scope.BiddingfileClass["class"],$scope.projectfile.project_id=$scope.project,Files.post($scope.projectfile,function(response){if($scope.response=response,0===parseInt($scope.response.error.code)){$scope.file_Frm=!1,flashMessage=$filter("translate")("File added successfully."),flash.set(flashMessage,"success",!1),fileFrm.$setPristine(),fileFrm.$setUntouched(),$scope.GetFiles(),$scope.is_show_upload_form=!1;var myEl=angular.element(document.querySelector("#resetAttr")),myFileName=angular.element(document.querySelector("#resetFile"));myFileName.empty(),myEl.removeAttr("src"),myEl.removeAttr("title"),myEl.removeAttr("alt")}else flashMessage=$filter("translate")($scope.response.error.message),flash.set(flashMessage,"error",!1),fileFrm.$setPristine(),fileFrm.$setUntouched(),$scope.file_Frm=!1})}},$scope.GetFiles();else if("activities"===tabSelected)$scope.loadmore=!1,$scope.renderpage="scripts/plugins/Bidding/Bidding/views/default/bidding_activities.html",$scope.is_show_upload_form=!1,$scope.showUpload=function(val){val===!1?$scope.is_show_upload_form=!0:$scope.is_show_upload_form=!1},(void 0===$state.params.action||"activities"!==$state.params.action)&&$state.go("Bid_ProjectView",$scope.projectBid,{notify:!1});else if("transactions"===tabSelected)$scope.loadmore=!1,$scope.renderpage="scripts/plugins/Bidding/Bidding/views/default/bidding_transactions.html",$scope.is_show_upload_form=!1,$scope.showUpload=function(val){val===!1?$scope.is_show_upload_form=!0:$scope.is_show_upload_form=!1},(void 0===$state.params.action||"transactions"!==$state.params.action)&&$state.go("Bid_ProjectView",$scope.projectBid,{notify:!1}),$scope.currentPageTransaction=1,$scope.GetTransactions=function(){var params={};biddingProjectTransactions.get({user_id:$rootScope.user.id,model_id:$state.params.id,model_class:"Project",page:$scope.currentPageTransaction,limit:10},function(response){$scope.currentPage=params.page,angular.isDefined(response._metadata)&&($scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page,$scope.currentPageTransaction=response._metadata.current_page),angular.forEach(response.data,function(value){var trans=value.transaction_type,exam={},project={},job={},commission={},subscription={},payment_gateway={};if($rootScope.isAuth===!0&&1===$rootScope.user.id?($scope.transaction_messages=$scope.TransactionAdminMessage[parseInt(trans)],value.transactionAmount={credit:value.amount,debit:"--"}):$rootScope.isAuth===!0&&("5"===trans&&$rootScope.Freelancer&&"0"!==value.site_revenue_from_freelancer?$scope.transaction_messages=$scope.TransactionUserMessage[22]:"7"===trans&&$rootScope.Freelancer&&"0"===value.site_revenue_from_freelancer?$scope.transaction_messages=$scope.TransactionUserMessage[parseInt(24)]:"6"===trans&&$rootScope.Freelancer&&"0"===value.site_revenue_from_freelancer?$scope.transaction_messages=$scope.TransactionUserMessage[parseInt(25)]:"5"===trans&&$rootScope.Freelancer&&"0"===value.site_revenue_from_freelancer?$scope.transaction_messages=$scope.TransactionUserMessage[23]:"7"===trans&&$rootScope.Employer&&"0"===value.site_revenue_from_employer?$scope.transaction_messages=$scope.TransactionUserMessage[24]:"7"===trans&&$rootScope.Employer&&"0"!==value.site_revenue_from_employer?$scope.transaction_messages=$scope.TransactionUserMessage[parseInt(trans)]:"5"===trans&&$rootScope.Employer&&"0"===value.site_revenue_from_employer?$scope.transaction_messages=$scope.TransactionUserMessage[parseInt(23)]:"7"===trans&&$rootScope.Freelancer&&"0"===value.site_revenue_from_employer?$scope.transaction_messages=$scope.TransactionUserMessage[parseInt(24)]:$scope.transaction_messages=$scope.TransactionUserMessage[parseInt(trans)],value.user.id===$rootScope.user.id?"Wallet"===value["class"]?value.transactionAmount={credit:value.amount,debit:"--"}:value.transactionAmount={credit:"--",debit:value.amount}:value.other_user.id===$rootScope.user.id&&("UserCashWithdrawal"===value["class"]?value.transactionAmount={credit:"--",debit:value.amount}:value.transactionAmount={credit:value.amount,debit:"--"})),value.user.id===$rootScope.user.id&&"7"===trans?commission=value.site_revenue_from_employer:value.user.id!==$rootScope.user.id&&"7"===trans&&(commission=value.site_revenue_from_freelancer),value.user.id===$rootScope.user.id&&"22"===trans&&(commission=value.site_revenue_from_employer),value.user.id===$rootScope.user.id&&"6"===trans&&(commission=value.site_revenue_from_employer),value.user.id!==$rootScope.user.id&&"6"===trans&&(commission=value.site_revenue_from_freelancer),value.user.id===$rootScope.user.id&&"5"===trans&&(commission=value.site_revenue_from_employer),value.user.id!==$rootScope.user.id&&"5"===trans&&(commission=value.site_revenue_from_freelancer),angular.isDefined(value.exam)&&(exam=""+value.exam.title+""),angular.isDefined(value.project)&&(project=""+value.project.name+""),angular.isDefined(value.job)&&(job=""+value.job.name+""),angular.isDefined(value.creditPurchasePlan)&&(subscription=value.creditPurchasePlan.name),angular.isDefined(value.payment_gateway)&&(payment_gateway=value.payment_gateway.display_name),value.user.id===$rootScope.user.id&&(value.user.username="You have"),value.user.id!==$rootScope.user.id&&(value.user.username=""+value.user.username+" has"),null!==value.foreign_transaction&&"Project"===value["class"]&&!value.project)var project_name=""+value.foreign_transaction.name+"";if(null!==value.foreign_transaction&&value.foreign_transaction.site_commision)var site_fee=$scope.settings.CURRENCY_SYMBOL+value.foreign_transaction.site_commision;var name={"##USER##":value.user.username,"##EXAM##":exam,"##PROJECT##":project,"##JOB##":job,"##SUBSCRIPTION##":subscription,"##PAYMENTGATEWAY##":payment_gateway,"##PROJECT_NAME##":project_name,"##SITE_FEE##":site_fee,"##OTHERUSER##":""+value.other_user.username+"","##COMMISSION##":commission};value.transaction_message=$scope.transaction_messages.replace(/##CONTEST##|##CONTEST_AMOUNT##|##USER##|##SITE_FEE##|##OTHERUSER##|##EXAM##|##PROJECT##|##PROJECT_NAME##|##PAYMENTGATEWAY##|##SUBSCRIPTION##|##JOB##|##COMMISSION##/gi,function(matched){return name[matched]})}),$scope.transactions=response.data,$scope.from_date=$scope.temp_from_date,$scope.to_date=$scope.temp_to_date})},$scope.paginateTransaction=function(page){$scope.currentPageTransaction=page,$scope.GetTransactions()},$scope.GetTransactions();else if("milestones"===tabSelected){$scope.renderpage="scripts/plugins/Bidding/Milestone/views/default/bidding_milestone.html",$scope.loadmore=!1;(void 0===$state.params.action||"milestones"!==$state.params.action)&&"mutual_cancel"!==$state.params.action&&"dispute"!==$state.params.action&&$state.go("Bid_ProjectView",$scope.projectBid,{notify:!1})}else $scope.selectedTab("messages")},$scope.is_file_error=!1,$scope.upload=function(file){checkFileFormat(file,FileFormat.project)?($scope.is_file_error=!1,Upload.upload({url:"/api/v1/attachments?class=Project",data:{file:file}}).then(function(response){$scope.uploadfile=response.data.attachment})):$scope.is_file_error=!0},$state.params.action?$scope.selectedTab($state.params.action):$scope.selectedTab("messages")}}}).directive("biddingProjectAction",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_project_actions.html",scope:{bidid:"@",project:"@",projectstatus:"@",biduser:"@",projectuser:"@",isprojectcancel:"@",isdispute:"@"},controller:function($scope,$rootScope,$cookies,$state,$filter,flash,ProjectStatusConstant,UpdateProjectStatus,ProjectEditView,$location,$anchorScroll,$timeout,$uibModal,$uibModalStack){function updateprojectstatus(acceptparams){var flashMessage="";UpdateProjectStatus.put(acceptparams,function(response){var msgStr="";0===parseInt(response.error.code)?(msgStr=acceptparams.project_status_id===ProjectStatusConstant.Completed?"Project marked as completed successfully.":acceptparams.project_status_id===ProjectStatusConstant.MutuallyCanceled?"Your reject cancel request has been sended successfully.":acceptparams.project_status_id===ProjectStatusConstant.UnderDevelopment?"Project moved to under developement successfully":"Project is successfully completed",flashMessage=$filter("translate")(msgStr),flash.set(flashMessage,"success",!1),$state.reload(),$rootScope.Employer===!0&&acceptparams.project_status_id===ProjectStatusConstant.FinalReviewPending&&$rootScope.settings.SITE_ENABLED_PLUGINS.indexOf("Bidding/Dispute")>-1&&$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"messages"},{reload:!0})):1===parseInt(response.error.code)?(msgStr=acceptparams.project_status_id===ProjectStatusConstant.FinalReviewPending?"Clear all the milestone payment and complete the project":"",flashMessage=$filter("translate")(msgStr),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))},function(error){console.log(error)})}if($scope.auth=JSON.parse($cookies.get("auth")),$scope.ProjectStatusConstant=ProjectStatusConstant,$scope.is_show_actions={mutual:!0,dispute:!0,review:!0},"mutual_cancel"===$state.params.action?$scope.is_show_actions.mutual=!1:"dispute"===$state.params.action||$rootScope.settings.SITE_ENABLED_PLUGINS.indexOf("Bidding/BiddingReview")>-1&&($scope.projectstatus===$scope.ProjectStatusConstant.FinalReviewPending||$scope.projectstatus===$scope.ProjectStatusConstant.Closed)&&angular.isDefined($rootScope.other_user_reviews)&&null!==$rootScope.other_user_reviews?$scope.is_show_actions.dispute=!1:"review-form"===$state.params.action&&($scope.is_show_actions.review=!1),parseInt($scope.projectuser)===parseInt($scope.auth.id)?$scope.is_freelancer=!1:$scope.is_freelancer=!0,"false"!==$scope.isprojectcancel){var getParams={id:$scope.project,fields:"id,project_status_id,is_dispute,is_cancel_request_freelancer,is_cancel_request_employer,user_id"};ProjectEditView.get(getParams,function(response){0===parseInt(response.error.code)&&($rootScope.projectmutual=response.data,$scope.is_freelancer?response.data.is_cancel_request_freelancer!==!0?$scope.show_request=$rootScope.show_request=!0:$scope.show_request=$rootScope.show_request=!1:response.data.is_cancel_request_employer!==!0?$scope.show_request=$rootScope.show_request=!0:$scope.show_request=$rootScope.show_request=!1)},function(error){console.log(error)})}$scope.projectstatuschange=function(statusType){var alerttitle="";8!==statusType&&9!==statusType?($scope.is_freelancer&&1===statusType?alerttitle="Are you sure you completed this project?":2===statusType?alerttitle="Are you sure you accept this project as completed?":3===statusType?alerttitle="Are you sure you want to request to cancel this project?":4===statusType?alerttitle="Are you sure you accept the cancel request of this project?":5===statusType?alerttitle="Are you sure you reject the cancel request of this project?":6===statusType?alerttitle="Are you sure you raise the dispute for this project?":7===statusType?alerttitle="Are you sure reject this dispute request?":10===statusType&&(alerttitle="Are you sure you want to cancel this request?"),swal({title:$filter("translate")(alerttitle),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm)if($scope.is_freelancer&&1===statusType){var acceptparams={id:$scope.project,project_status_id:ProjectStatusConstant.Completed};updateprojectstatus(acceptparams)}else if(2===statusType){var acceptparams={id:$scope.project,project_status_id:ProjectStatusConstant.FinalReviewPending};updateprojectstatus(acceptparams)}else if(3===statusType)$scope.mutual_cancel=$rootScope.mutual_cancel=!0,$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"mutual_cancel"},{reload:!0}),$timeout(function(){$anchorScroll("cancel_scroll")},2500);else if(4===statusType){var acceptparams={id:$scope.project,project_status_id:ProjectStatusConstant.MutuallyCanceled,is_accept_mutual_cancel:1,mutual_cancel_note:$scope.mutual_canceled_note};updateprojectstatus(acceptparams)}else if(5===statusType){var acceptparams={id:$scope.project,project_status_id:ProjectStatusConstant.MutuallyCanceled,is_accept_mutual_cancel:0,mutual_cancel_note:$scope.mutual_canceled_note};updateprojectstatus(acceptparams)}else if(6===statusType)$scope.project_dispute=$rootScope.project_dispute=!0,$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"dispute"},{reload:!0}),$timeout(function(){$anchorScroll("dispute_scroll")},3500);else if(10===statusType){var acceptparams={id:$scope.project,project_status_id:ProjectStatusConstant.UnderDevelopment};updateprojectstatus(acceptparams)}})):8===statusType?($state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"review-form"},{reload:!0}),$timeout(function(){$anchorScroll("add_review_scroll")},2500)):9===statusType&&($state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"review-form"},{reload:!0}),$timeout(function(){$anchorScroll("update_review_scroll")},3500))},$scope.contactFreelancer=function(projectid){$rootScope.message_bid_id=projectid,$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Bidding/Bidding/views/default/contact_freelancer.html",animation:!1,controller:function($scope,$rootScope,$window,$stateParams,$filter,md5,$state,Upload,$timeout,$uibModal,$uibModalStack,Messages,biduser,authuser){var flashMessage="";$scope.MessagePage=1,$rootScope.closemodel=function(){$uibModalStack.dismissAll()},$scope.contact_freelancer=!1,$scope.data={},$scope.ContactMessages=[],$scope.submit=function($valid){if($valid){$scope.contact_freelancer=!0;var contactData={};contactData.foreign_id=projectid,contactData.to_user_id=biduser,contactData.message=$scope.data.message,contactData["class"]="Bid",contactData.subject=$state.params.slug,Messages.post(contactData,function(response){0===response.error.code?(flashMessage=$filter("translate")("Message sent successfully."),flash.set(flashMessage,"success",!1),$scope.data.message="",$scope.Contactfrm.$setPristine(),$scope.Contactfrm.$setUntouched(),$scope.ContactMessages=[],$scope.MessagePage=1,$scope.GetConactMessage(),$scope.contact_freelancer=!1):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}},$scope.GetConactMessage=function(){var conactparams={};conactparams.foreign_id=$rootScope.message_bid_id,conactparams.limit=5,conactparams.sortby="desc",conactparams.page=$scope.MessagePage,conactparams["class"]="Bid",Messages.get(conactparams,function(response){angular.isDefined(response.data)&&(angular.isDefined(response._metadata)&&($scope.messageNoOfPages=response._metadata.last_page,$scope.ConactmessageTotal=response._metadata.total-response._metadata.current_page*response._metadata.per_page),0===parseInt(response.error.code)?angular.forEach(response.data,function(value){angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png",$scope.ContactMessages.push(value)}):$scope.ContactMessages=[])})},$scope.contactmessage_pagination=function(){$scope.MessagePage=parseInt($scope.MessagePage)+1,$scope.GetConactMessage()},$scope.GetConactMessage()},size:"lg",resolve:{biduser:function(){return $scope.biduser},authuser:function(){return $scope.auth.id}}})},$rootScope.cancelresp=!1,$rootScope.$watch("cancelresp",function(newValue,oldValue){newValue!==!1&&($scope.projectstatuschange(parseInt(newValue)),$rootScope.cancelresp=!1)}),$scope.$on("mutualcancel",function(event,data){$scope.is_show_accept=data.is_show_accept})}}}).directive("biddingHomeSkills",function(ProjectSkills){return{restrict:"EA",replace:!0,templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_home_skills.html",link:function(scope,element,attrs){var params={limit:30,sort:"name",sortby:"DSC",field:"id,name,slug,description"};ProjectSkills.get(params,function(response){scope.project_skills=response.data})}}}).directive("biddingHomeCategories",function(ProjectCategory){return{restrict:"EA",replace:!0,templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_home_categories.html",link:function(scope,element,attrs){var params={limit:8,sort:"name",sortby:"DSC",field:"id,name,slug,description"};ProjectCategory.get(params,function(response){scope.project_categories=response.data})}}}).directive("biddingCategories",function(ProjectCategory,$filter){return{restrict:"EA",replace:!0,templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_categories.html",link:function(scope,element,attrs){var params={limit:8,sort:"name",sortby:"DSC",field:"id,name,slug,description"};ProjectCategory.get(params,function(response){scope.project_categories=response.data,scope.project_categories=$filter("orderBy")(response.data,"id")})}}}),angular.module("getlancerApp.Bidding").directive("biddingMutualCancel",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_project_mutual_cancel.html",scope:{bidid:"@",isfreelancercancel:"@",isemployercancel:"@",project:"@",biduser:"@",projectuser:"@",isprojectcancel:"@",projectstatus:"@"},controller:function($scope,$rootScope,$cookies,$state,$filter,flash,ProjectStatusConstant,UpdateProjectStatus,md5){function updateprojectstatus(acceptparams){var flashMessage="";UpdateProjectStatus.put(acceptparams,function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Cancel request has been rejected successfully."),flash.set(flashMessage,"success",!1),$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"messages"},{reload:!0})):(flashMessage=$filter("translate")("Please Try again"), flash.set(flashMessage,"success",!1))})}if($scope.show_request=$rootScope.show_request,$scope.ProjectStatusConstant=ProjectStatusConstant,angular.isDefined($rootScope.broadCastDataempolyer))if("true"===$scope.isemployercancel)if($rootScope.broadCastDataempolyer,$scope.mutualcancelnote=$rootScope.broadCastDataempolyer.notes,$scope.userinfo=$rootScope.broadCastDataempolyer.userinfo,$scope.is_show_accept=$rootScope.broadCastDataempolyer.is_show_accept,$scope.userid=$rootScope.broadCastDataempolyer.userId,$scope.created_at=$rootScope.broadCastDatafreelancer.createdAt,angular.isDefined($rootScope.broadCastDataempolyer.userImage)&&null!==$rootScope.broadCastDataempolyer.userImage){var c=new Date,hash=md5.createHash($rootScope.broadCastDataempolyer.userImage["class"]+$rootScope.broadCastDataempolyer.userImage.foreign_id+"pngbig_thumb");$scope.user_image="images/big_thumb/"+$rootScope.broadCastDataempolyer.userImage["class"]+"/"+$rootScope.broadCastDataempolyer.userImage.foreign_id+"."+hash+".png?"+c.getTime()}else $scope.user_image="images/default.png";else if($rootScope.broadCastDatafreelancer,$scope.mutualcancelnote=$rootScope.broadCastDatafreelancer.notes,$scope.userinfo=$rootScope.broadCastDatafreelancer.userinfo,$scope.is_show_accept=$rootScope.broadCastDatafreelancer.is_show_accept,$scope.userid=$rootScope.broadCastDataempolyer.userId,$scope.created_at=$rootScope.broadCastDataempolyer.createdAt,angular.isDefined($rootScope.broadCastDatafreelancer.userImage)&&null!==$rootScope.broadCastDatafreelancer.userImage){var c=new Date,hash=md5.createHash($rootScope.broadCastDatafreelancer.userImage["class"]+$rootScope.broadCastDatafreelancer.userImage.foreign_id+"pngbig_thumb");$scope.user_image="images/big_thumb/"+$rootScope.broadCastDatafreelancer.userImage["class"]+"/"+$rootScope.broadCastDatafreelancer.userImage.foreign_id+"."+hash+".png?"+c.getTime()}else $scope.user_image="images/default.png";$scope.closefrm=function(){$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"messages"},{reload:!0})},$scope.mutual_Cancel=!1,$scope.mutualCancel=function($valid,data){if($valid){$scope.mutual_Cancel=!0;var params={id:$scope.project,project_status_id:ProjectStatusConstant.MutuallyCanceled,mutual_cancel_note:data.mutual_cancel_note};swal({title:$filter("translate")("Are you sure you want to request to cancel this project?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var flashMessage="";UpdateProjectStatus.put(params,function(response){$scope.mutual_canceled_note=response.data.mutual_cancel_note,0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Your cancel request has been rejected successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Your cancel request sending failed."),$scope.mutual_Cancel=!1,flash.set(flashMessage,"error",!1))},function(error){console.log(error)})}else $scope.mutual_Cancel=!1})}},$scope.cancelreponse=function(statusType){var alerttitle="";4===statusType?alerttitle="Are you sure you accept the cancel request of this project?":5===statusType&&(alerttitle="Are you sure you reject the cancel request of this project?"),swal({title:$filter("translate")(alerttitle),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm)if(4===statusType){var acceptparams={id:$scope.project,project_status_id:ProjectStatusConstant.MutuallyCanceled,is_accept_mutual_cancel:1,mutual_cancel_note:$scope.mutual_canceled_note};updateprojectstatus(acceptparams)}else if(5===statusType){var acceptparams={id:$scope.project,project_status_id:ProjectStatusConstant.MutuallyCanceled,is_accept_mutual_cancel:0,mutual_cancel_note:$scope.mutual_canceled_note};updateprojectstatus(acceptparams)}})}}}}),angular.module("getlancerApp.Bidding").directive("biddingProjectDashboard",function(){return{restrict:"E",replace:!0,templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_project_dashboard.html",controller:"biddingProjectDashboardCtrl"}}).controller("biddingProjectDashboardCtrl",function($rootScope,$scope,$state,$filter,flash,$window,$cookies,MyProjects,DelProject,ProjectStatsCount,ProjectStatusConstant,ProjectStatusUpdate,MyBids,UpdateProjectStatus,UpdateBidStatus,projectMilestone,projectInvoice,MilestoneStatusChange,MyMilestone,MyInvoices,MilestoneStatusConstant,BidStatusConstant,BidRetake,EmployerStatsCount,FreelancerStatusCount,$uibModal,$stateParams){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("My Projects"),$scope.projectConstant=ProjectStatusConstant,$scope.portal=$window.localStorage.getItem("portal"),$scope.auth=JSON.parse($cookies.get("auth")),$scope.renderSubPage="scripts/plugins/Bidding/Bidding/views/default/my_bids_current_projects.html",$scope.MilestoneStatusConstant=MilestoneStatusConstant,$scope.BidStatusConstant=BidStatusConstant,$scope.milestonePage=function(id,project_name,action,type){1==type?$state.go("Bid_ProjectView",{id:id,slug:project_name,action:"milestones"}):2==type?$state.go("Bid_ProjectView",{id:id,slug:project_name,action:"invoices"}):3==type?$state.go("Bid_ProjectView",{id:id,slug:project_name,action:"dispute"},{reload:!0}):4==type&&$state.go("Bid_ProjectView",{id:id,slug:project_name,action:"review-form"})},$scope.milestoneStatueChange=function(milestoneId,statusId,status){$scope.milestoneid=milestoneId,"pay"!==statusId?swal({title:$filter("translate")("Are you sure you want to do this action?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&("workcompleted"===status?MilestoneStatusChange.put({id:milestoneId,milestone_status_id:$scope.MilestoneStatusConstant.Completed},function(response){0===response.error.code?MilestoneStatusChange.put({id:milestoneId,milestone_status_id:statusId},function(response){var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Milestone status changed"),flash.set(flashMessage,"success",!1),$scope.$emit("isupdated","true")):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}):MilestoneStatusChange.put({id:milestoneId,milestone_status_id:statusId},function(response){var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Milestone status changed"),flash.set(flashMessage,"success",!1),$scope.$emit("isupdated","true")):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}))}):$state.go("Bidding_MilestonePayment",{id:milestoneId,name:"milestone"})},$scope.$on("isupdated",function(event,data){$state.reload()}),$scope.bidcount=function(){$rootScope.scrollBids=!0},$scope.CancelProject=function(project_id){swal({title:$filter("translate")("Are you sure you want to cancel this project?"),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&ProjectStatusUpdate.put({id:project_id,project_status_id:$scope.projectConstant.EmployerCanceled},function(response){0===response.error.code?(flashMessage=$filter("translate")("Your project has been cancelled successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Your project couldn't cancelled. Please try again."),flash.set(flashMessage,"error",!1),$state.reload())})})},$scope.reopen=function(projid){swal({title:$filter("translate")("Are you sure you want to reopen this project?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&UpdateProjectStatus.put({id:projid,project_status_id:ProjectStatusConstant.OpenForBidding},function(response){0===parseInt(response.error.code)?(flash.set($filter("translate")("Project reopen successfully"),"success",!1),$state.reload()):flash.set($filter("translate")("Project reopen failed"),"error",!1)})})},$scope.AcceptCompleted=function(project_id,type){var alertTitle;alertTitle="accept"===type?"Are you sure you completed this project?":"Are you sure you want to cancel this request?",swal({title:$filter("translate")(alertTitle),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var params={};"accept"===type?(params.id=project_id,params.project_status_id=$scope.projectConstant.Completed):(params.id=project_id,params.project_status_id=$scope.projectConstant.UnderDevelopment),ProjectStatusUpdate.put(params,function(response){if(0===response.error.code){var flgmsg="";flgmsg=params.project_status_id===$scope.projectConstant.Completed?"Your project has been Completed successfully.":"Project moved to under developement successfully.",flashMessage=$filter("translate")(flgmsg),flash.set(flashMessage,"success",!1),$state.reload()}else flashMessage=response.error.message,flash.set(flashMessage,"error",!1),$state.reload()})}})},$scope.endpoint="projects",$scope.GetProjectStatus=function(){$scope.loader=!0,ProjectStatsCount.get({id:$scope.auth.id},function(response){$scope.loader=!1,0===parseInt(response.error.code)&&($scope.projectStatus=$filter("orderBy")(response.data,"id"))},function(error){console.log(error)})},$rootScope.Employer===!0&&($scope.EmployerMilestoneCount=function(){EmployerStatsCount.get(function(response){$scope.employer_count=response.data})}),$scope.FreelancerMilestoneCount=function(){FreelancerStatusCount.get(function(response){$scope.freelancer_count=response.data})},$scope.getProjects=function(tabType){if($scope.loader=!0,$scope.tabType=tabType,$scope.GetProjectStatus(),$rootScope.Employer===!0)$scope.EmployerMilestoneCount(),isNaN(tabType)||(1===tabType?($scope.project_status="Draft",(void 0===$state.params.status||"draft_payment_pending"!==$state.params.status)&&$state.go("user_dashboard",{status:"draft_payment_pending",type:"my_projects"},{notify:!1})):3===tabType?($scope.project_status="waiting for approval ",(void 0===$state.params.status||"waiting_for_approval"!==$state.params.status)&&$state.go("user_dashboard",{status:"waiting_for_approval",type:"my_projects"},{notify:!1})):5===tabType?($scope.project_status="Bidding Expired",(void 0===$state.params.status||"close_expiry"!==$state.params.status)&&$state.go("user_dashboard",{status:"close_expiry",type:"my_projects"},{notify:!1})):6===tabType?($scope.project_status="Winner Selected",(void 0===$state.params.status||"winner_selected"!==$state.params.status)&&$state.go("user_dashboard",{status:"winner_selected",type:"my_projects"},{notify:!1})):11===tabType?($scope.project_status="Under Development",(void 0===$state.params.status||"under_development"!==$state.params.status)&&$state.go("user_dashboard",{status:"under_development",type:"my_projects"},{notify:!1})):14===tabType?($scope.project_status="Pending Review",(void 0===$state.params.status||"final_review"!==$state.params.status)&&$state.go("user_dashboard",{status:"final_review",type:"my_projects"},{notify:!1})):16===tabType?($scope.project_status="Closed",(void 0===$state.params.status||"closed"!==$state.params.status)&&$state.go("user_dashboard",{status:"closed",type:"my_projects"},{notify:!1})):9===tabType?($scope.project_status="Closed / Expired",(void 0===$state.params.status||"bid_closed"!==$state.params.status)&&$state.go("user_dashboard",{status:"bid_closed",type:"my_projects"},{notify:!1})):13===tabType?($scope.project_status="Canceled",(void 0===$state.params.status||"admin_cancel"!==$state.params.status)&&$state.go("user_dashboard",{status:"admin_cancel",type:"my_projects"},{notify:!1})):12===tabType?($scope.project_status="Mutually Canceled",(void 0===$state.params.status||"cancel"!==$state.params.status)&&$state.go("user_dashboard",{status:"cancel",type:"my_projects"},{notify:!1})):($scope.project_status="Open for Bidding",(void 0===$state.params.status||"open_bidding"!==$state.params.status)&&$state.go("user_dashboard",{status:"open_bidding",type:"my_projects"},{notify:!1})),$scope.params={},parseInt(tabType)===ProjectStatusConstant.Draft?$scope.params.project_status_id=ProjectStatusConstant.Draft+","+ProjectStatusConstant.PaymentPending:parseInt(tabType)===ProjectStatusConstant.CanceledByAdmin?$scope.params.project_status_id=ProjectStatusConstant.EmployerCanceled+","+ProjectStatusConstant.MutuallyCanceled+","+ProjectStatusConstant.CanceledByAdmin:parseInt(tabType)===ProjectStatusConstant.BiddingClosed?$scope.params.project_status_id=ProjectStatusConstant.BiddingClosed+","+ProjectStatusConstant.BiddingExpired:parseInt(tabType)===ProjectStatusConstant.UnderDevelopment?$scope.params.project_status_id=ProjectStatusConstant.UnderDevelopment+","+ProjectStatusConstant.Completed:$scope.params.project_status_id=-1===tabType?ProjectStatusConstant.OpenForBidding:tabType,$scope.params.page=$scope.projectcurrentPage,MyProjects.get($scope.params,function(response){angular.isDefined(response._metadata)&&($scope.projectcurrentPage=response._metadata.current_page,$scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page),angular.isDefined(response.data)&&($scope.projects=response.data,angular.forEach($scope.projects,function(value){$rootScope.dispute_project=value.is_dispute})),$scope.loader=!1,0===parseInt(response.error.code)&&($scope.endpoint="projects")},function(error){console.log(error)})),"milestone"===tabType?($scope.project_status="Milestones",(void 0===$state.params.status||"milestone"!==$state.params.status)&&$state.go("user_dashboard",{status:"milestone",type:"projects"},{reload:!0}),projectMilestone.get({id:$scope.auth.id},function(response){$scope.loader=!1,0===parseInt(response.error.code)&&($scope.milestones=response.data,$scope.endpoint="milestone",$scope.GetProjectStatus())},function(error){})):"invoice"===tabType&&($scope.project_status="Invoices",(void 0===$state.params.status||"invoice"!==$state.params.status)&&$state.go("user_dashboard",{status:"invoice",type:"projects"},{reload:!0}),$scope.invoices=[],projectInvoice.get({id:$scope.auth.id},function(response){$scope.GetProjectStatus(),$scope.loader=!1,0===parseInt(response.error.code)&&($scope.invoices=response.data,$scope.endpoint="invoice")},function(error){}));else{"my_bids"===tabType?($scope.project_status="Current Projects",$scope.renderSubPage="scripts/plugins/Bidding/Bidding/views/default/my_bids_current_projects.html",(void 0===$state.params.status||"my_bids"!==$state.params.status)&&$state.go("user_dashboard",{status:"my_bids",type:"projects"},{notify:!1})):"active"===tabType?($scope.project_status="Active Bids",$scope.renderSubPage="scripts/plugins/Bidding/Bidding/views/default/my_bids_active.html",(void 0===$state.params.status||"active_bids"!==$state.params.status)&&$state.go("user_dashboard",{status:"active_bids",type:"projects"},{notify:!1})):"past_projects"===tabType&&($scope.renderSubPage="scripts/plugins/Bidding/Bidding/views/default/my_bids_past_projects.html",$scope.project_status="Past Projects",(void 0===$state.params.status||"past_projects"!==$state.params.status)&&$state.go("user_dashboard",{status:"past_projects",type:"projects"},{notify:!1}));var params={};params.page=void 0!==$scope.currentPage?$scope.currentPage:1,"my_bids"===$state.params.status&&(params.type="current_work"),"active_bids"===$state.params.status&&(params.type="active"),"past_projects"===$state.params.status&&(params.type="past_projects"),MyBids.get(params,function(response){$scope.FreelancerMilestoneCount(),$scope.loader=!1,0===parseInt(response.error.code)&&($scope.currentPage=response._metadata.current_page,$scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page),0===parseInt(response.error.code)?$scope.mybids=response.data:($scope.mybids=[],$scope.errorMessage="",angular.isDefined(response.error)&&($scope.errorMessage=response.error.message),$scope.currentPage=0,$scope.totalItems=0,$scope.itemsPerPage=0,$scope.noOfPages=0)}),"milestones"===tabType?($scope.project_status="Milestones",$scope.renderSubPage="scripts/plugins/Bidding/Bidding/views/default/milestone_supplier_portal.html",(void 0===$state.params.status||"milestone"!==$state.params.status)&&$state.go("user_dashboard",{status:"milestones",type:"projects"},{notify:!1}),MyMilestone.get({id:$scope.auth.id,page:$scope.currentPageMilestone},function(response){0===parseInt(response.error.code)&&($scope.my_milestones=response.data,$scope.currentPageMilestone=response._metadata.current_page,$scope.totalItemsMilestone=response._metadata.total,$scope.itemsPerPageMilestone=response._metadata.per_page,$scope.noOfPagesMilestone=response._metadata.last_page,$scope.endpoint="milestone")},function(error){})):"invoices"===tabType&&($scope.renderSubPage="scripts/plugins/Bidding/Bidding/views/default/supplier_portal_invoice.html",$scope.project_status="Invoices",(void 0===$state.params.status||"invoice"!==$state.params.status)&&$state.go("user_dashboard",{status:"invoices",type:"projects"},{notify:!1}),MyInvoices.get({id:$scope.auth.id},function(response){0===parseInt(response.error.code)&&($scope.my_invoices=response.data,$scope.endpoint="milestone")},function(error){}))}},$scope.paginate=function(page){$scope.currentPageMilestone=parseInt(page),$scope.getProjects("milestone")},$scope.pagination=function(page){$scope.projectcurrentPage=parseInt(page),$state.params.status?"draft_payment_pending"===$state.params.status?$scope.getProjects(1):"waiting_for_approval"===$state.params.status?$scope.getProjects(3):"open_bidding"===$state.params.status?$scope.getProjects(4):"close_expiry"===$state.params.status?$scope.getProjects(5):"winner_selected"===$state.params.status?$scope.getProjects(6):"under_development"===$state.params.status?$scope.getProjects(11):"final_review"===$state.params.status?$scope.getProjects(14):"closed"===$state.params.status?$scope.getProjects(16):"milestone"===$state.params.status?$scope.getProjects("milestone"):"invoice"===$state.params.status?$scope.getProjects("invoice"):"bid_closed"===$state.params.status?$scope.getProjects(9):"admin_cancel"===$state.params.status?$scope.getProjects(13):"cancel"===$state.params.status?$scope.getProjects(10):"my_bids"===$state.params.status?$scope.getProjects("my_bids"):"past_projects"===$state.params.status?$scope.getProjects("past_projects"):"milestones"===$state.params.status?$scope.getProjects("milestones"):"invoices"===$state.params.status?$scope.getProjects("invoices"):"active_bids"===$state.params.status?$scope.getProjects("active"):"past_projects"===$state.params.status?$scope.getProjects("past_projects"):'"Employer"'===$scope.portal?$scope.getProjects(4):$scope.getProjects("my_bids"):'"Employer"'===$scope.portal?$scope.getProjects(4):$scope.getProjects("my_bids")},$state.params.status?"draft_payment_pending"===$state.params.status?$scope.getProjects(1):"waiting_for_approval"===$state.params.status?$scope.getProjects(3):"open_bidding"===$state.params.status?$scope.getProjects(4):"close_expiry"===$state.params.status?$scope.getProjects(5):"winner_selected"===$state.params.status?$scope.getProjects(6):"under_development"===$state.params.status?$scope.getProjects(11):"final_review"===$state.params.status?$scope.getProjects(14):"closed"===$state.params.status?$scope.getProjects(16):"milestone"===$state.params.status?$scope.getProjects("milestone"):"invoice"===$state.params.status?$scope.getProjects("invoice"):"bid_closed"===$state.params.status?$scope.getProjects(9):"admin_cancel"===$state.params.status?$scope.getProjects(13):"cancel"===$state.params.status?$scope.getProjects(10):"my_bids"===$state.params.status?$scope.getProjects("my_bids"):"past_projects"===$state.params.status?$scope.getProjects("past_projects"):"milestones"===$state.params.status?$scope.getProjects("milestones"):"invoices"===$state.params.status?$scope.getProjects("invoices"):"active_bids"===$state.params.status?$scope.getProjects("active"):"past_projects"===$state.params.status?$scope.getProjects("past_projects"):'"Employer"'===$scope.portal?$scope.getProjects(4):$scope.getProjects("my_bids"):'"Employer"'===$scope.portal?$scope.getProjects(4):$scope.getProjects("my_bids");var flashMessage;$scope.deleteProject=function(project_id){swal({title:$filter("translate")("Are you sure you want to delete?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&DelProject["delete"]({id:project_id},function(response){0===response.error.code?(flashMessage=$filter("translate")("Your project has been deleted successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Your project couldn't deleted. Please try again."),flash.set(flashMessage,"error",!1),$state.reload())})})},$scope.withdrawfreelancer=function(rtype,projectid){swal({title:1===parseInt(rtype)?$filter("translate")("Are you sure you want to choose a new expert?"):$filter("translate")("Are you sure you want to reopen this project?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&1===parseInt(rtype)&&UpdateProjectStatus.put({id:projectid,project_status_id:ProjectStatusConstant.OpenForBidding,withdraw_bid_id:$scope.bidid},function(response){0===parseInt(response.error.code)?(flash.set($filter("translate")("Project reopen successfully"),"success",!1),$state.reload()):flash.set($filter("translate")("Project reopen failed"),"error",!1)})})},$scope.cancelProject=function(project_id){swal({title:$filter("translate")("Are you sure you want to cancel this project?"),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){ProjectStatusUpdate.put({id:project_id,project_status_id:$scope.projectConstant.EmployerCanceled},function(response){0===response.error.code?(flashMessage=$filter("translate")("Your project has been cancelled successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Your project couldn't cancelled. Please try again."),flash.set(flashMessage,"error",!1),$state.reload())})})},$scope.contactFreelancer=function(projectbidid,projectname,projectbidusername,disputestatus){$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Bidding/Bidding/views/default/contact_freelancer.html",animation:!1,controller:function($scope,$rootScope,$window,$stateParams,$filter,md5,$state,Upload,$timeout,$uibModal,$uibModalStack,Messages,biduser,authuser){$rootScope.project_dispute=disputestatus;var flashMessage="";$rootScope.closemodel=function(){$uibModalStack.dismissAll()},$scope.contact_freelancer=!1,$scope.data={},$scope.ContactMessages=[],$scope.submit=function($valid){if($valid){$scope.contact_freelancer=!0;var contactData={};contactData.foreign_id=projectbidid,contactData.to_user_id=projectbidusername,contactData.message=$scope.data.message,contactData["class"]="Bid",contactData.subject=projectname,Messages.post(contactData,function(response){$scope.contact_freelancer=!1,0===response.error.code?(flashMessage=$filter("translate")("Message sent successfully."),flash.set(flashMessage,"success",!1),$scope.ContactMessages=[],$scope.GetConactMessage(),$scope.data.message="",$scope.contact_freelancer=!1,$scope.Contactfrm.$setPristine(),$scope.Contactfrm.$setUntouched()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}},$scope.GetConactMessage=function(){var conactparams={};conactparams.foreign_id=projectbidid,conactparams.limit=5,conactparams.sortby="desc",conactparams["class"]="Bid",conactparams.page=$scope.MessagePage,Messages.get(conactparams,function(response){angular.isDefined(response.data)&&(angular.isDefined(response._metadata)&&($scope.messageNoOfPages=response._metadata.last_page,$scope.ConactmessageTotal=response._metadata.total-response._metadata.current_page*response._metadata.per_page),0===parseInt(response.error.code)?angular.forEach(response.data,function(value){angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png",$scope.ContactMessages.push(value)}):$scope.ContactMessages=[])})},$scope.MessagePage=1,$scope.contactmessage_pagination=function(){$scope.MessagePage=parseInt($scope.MessagePage)+1,$scope.GetConactMessage()},$scope.GetConactMessage()},size:"lg",resolve:{biduser:function(){return $scope.biduser},authuser:function(){return $scope.auth.id}}})},$scope.awardedprocess=function(ftype,projectbidid,bidid){var alertTitle="";1===parseInt(ftype)?alertTitle=$filter("translate")("Are you sure you want to accept this project?"):2===parseInt(ftype)&&(alertTitle=$filter("translate")("Are you sure you want to reject this project?")),swal({title:alertTitle,text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var flashMessage="";if(1===parseInt(ftype))UpdateProjectStatus.put({id:projectbidid,project_status_id:ProjectStatusConstant.UnderDevelopment},function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Project successfully accepted and moved under developement status."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Check your wallet"),flash.set(flashMessage,"error",!1))},function(error){console.log(error)});else{var params={};params.id=bidid,UpdateBidStatus.put(params,{is_offered_rejected:1},function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("You are successfully ignore this project request."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Project couldn't rejected. Please try again."),flash.set(flashMessage,"error",!1))},function(error){console.log("BiddingAwardDirective",error)})}}})},$scope.bidAction=function(indexVal,atype,bidId){if(parseInt(atype)){var title="";1===parseInt(atype)?title=$filter("translate")("Are you sure you want to edit this bid?"):2===parseInt(atype)?title=$filter("translate")("Are you sure you want to withdraw this bid?"):3===parseInt(atype)?title=$filter("translate")("Are you sure you want to accept this project?"):4===parseInt(atype)?title=$filter("translate")("Are you sure you want to reject this project?"):5===parseInt(atype)&&(title=$filter("translate")("Are you sure you want to withdraw this bid?")),swal({title:title,text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var flashMessage="";if(1===parseInt(atype))$state.go("Bid_ProjectView",{id:$scope.mybids[indexVal].project.id,slug:$scope.mybids[indexVal].project.slug,placebid:!0,edit:!0});else if(2===parseInt(atype)){var params={};params.is_freelancer_withdrawn=1,BidRetake.put({id:$scope.mybids[indexVal].id},params,function(response){0===response.error.code?(flashMessage=$filter("translate")("Your bid withdrawn successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Please try again."),flash.set(flashMessage,"error",!1),$state.reload())})}else 3===parseInt(atype)?$scope.activeBidChange(3,indexVal):4===parseInt(atype)&&$scope.activeBidChange(4,indexVal)}})}},$scope.activeBidChange=function(tval,indexVal){var flashMessage="";3===parseInt(tval)?UpdateProjectStatus.put({id:$scope.mybids[indexVal].project.id,project_status_id:ProjectStatusConstant.UnderDevelopment},function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Project successfully accepted and moved under developement status."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Check your wallet"),flash.set(flashMessage,"error",!1))},function(error){console.log(error)}):4===parseInt(tval)&&UpdateBidStatus.put({id:$scope.mybids[indexVal].id,is_offered_rejected:1},function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("You have successfully rejected this project."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("You have successfully rejected this project."),flash.set(flashMessage,"error",!1))},function(error){console.log("BiddingAwardDirective",error)})}}).directive("biddingActiveBids",function($rootScope,$state,$filter,flash,MyBids,BidMilestone,BidRetake,MeMilestone,MilestoneStatusConstant,MeInvoice){return{restrict:"E",templateUrl:""}}).directive("biddingDashboarProjectAction",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_dasboard_project_action.html",scope:{projstatus:"@",projid:"@",projname:"@",projbidid:"@",projectstatusid:"@",projisreachedresponseenddateforfreelancer:"@",bidusername:"@",disputestatus:"@"},controller:"biddingProjectDashboardCtrl"}}),angular.module("getlancerApp.Bidding").directive("biddingStars",[function(){function link(scope,element,attrs,ngModelCtrl){var computed={get readonly(){return"false"!=attrs.readonly&&(attrs.readonly||""===attrs.readonly)},get fullIcon(){return attrs.iconFull||"fa-star"},get emptyIcon(){return attrs.iconEmpty||"fa-star-o"},get iconBase(){return attrs.iconBase||"fa fa-fw"},get iconHover(){return attrs.iconHover||"angular-input-stars-hover"}};scope.items=new Array(+attrs.max),scope.listClass=attrs.listClass||"angular-input-stars",ngModelCtrl.$render=function(){scope.lastValue=ngModelCtrl.$viewValue||0},scope.getClass=function(index){var icon=index>=scope.lastValue?computed.iconBase+" "+computed.emptyIcon:computed.iconBase+" "+computed.fullIcon+" active ";return computed.readonly?icon+" readonly":icon},scope.unpaintStars=function($index,hover){scope.paintStars(scope.lastValue-1,hover)},scope.paintStars=function($index,hover){if(!computed.readonly){for(var items=element.find("li").find("i"),index=0;index=index?($star.removeClass(computed.emptyIcon),$star.addClass(computed.fullIcon),$star.addClass("active"),$star.addClass(computed.iconHover)):($star.removeClass(computed.fullIcon),$star.removeClass("active"),$star.removeClass(computed.iconHover),$star.addClass(computed.emptyIcon))}hover||items.removeClass(computed.iconHover)}},scope.setValue=function(index,e){if(!computed.readonly){var newValue,star=e.target;newValue=e.pageX
  • ', require:"ngModel",scope:!0,link:link};return directive}]),angular.module("getlancerApp.Bidding").directive("projectViewShare",function($rootScope,md5,$window,$uibModal,$filter,$state){return{templateUrl:"scripts/plugins/Bidding/Bidding/views/default/project_view_share.html",restrict:"EA",replace:"true",scope:"true",link:function(scope,element,attr){scope.ShareModel=function(isvalid){scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Bidding/Bidding/views/default/project_view_share_modal.html",backdrop:"true",controller:"ProjectViewCtrl"})}}}}),angular.module("getlancerApp.Bidding").factory("Projects",["$resource",function($resource){return $resource("/api/v1/projects",{},{get:{method:"GET"},post:{method:"POST"}})}]).factory("DelProject",["$resource",function($resource){return $resource("/api/v1/projects/:id",{},{"delete":{method:"DELETE"}})}]).factory("ProjectEditView",["$resource",function($resource){return $resource("/api/v1/projects/:id",{},{get:{method:"GET"},put:{method:"PUT"}})}]).factory("ProjectStatus",["$resource",function($resource){return $resource("/api/v1/project_statuses",{},{get:{method:"GET"}})}]).factory("ProjectStatusUpdate",["$resource",function($resource){return $resource("/api/v1/projects/:id/update_status",{id:"@id"},{put:{method:"PUT"}})}]).factory("ProjectSkills",["$resource",function($resource){return $resource("/api/v1/skills",{},{get:{method:"GET"}})}]).factory("ProjectCategory",["$resource",function($resource){return $resource("/api/v1/project_categories",{},{get:{method:"GET"}})}]).factory("ProjectRange",["$resource",function($resource){return $resource("/api/v1/project_ranges",{},{get:{method:"GET"}})}]).factory("ProjectBids",["$resource",function($resource){return $resource("/api/v1/bids?project_id=:id",{},{get:{method:"GET"}})}]).factory("MyProjects",["$resource",function($resource){return $resource("/api/v1/me/projects",{},{get:{method:"GET"}})}]).factory("MyMilestone",["$resource",function($resource){return $resource("/api/v1/me/milestones",{},{get:{method:"GET"}})}]).factory("MyInvoices",["$resource",function($resource){return $resource("/api/v1/me/project_bid_invoices",{},{get:{method:"GET"}})}]).factory("UpdateProjectStatus",["$resource",function($resource){return $resource("/api/v1/projects/:id/update_status",{id:"@id"},{put:{method:"PUT"}})}]).factory("BidPost",["$resource",function($resource){return $resource("/api/v1/bids",{},{post:{method:"POST"}})}]).factory("BidRetake",["$resource",function($resource){return $resource("/api/v1/bids/:id",{},{"delete":{method:"DELETE"},put:{method:"PUT"}})}]).factory("EditBid",["$resource",function($resource){return $resource("/api/v1/bids?project_id=:id&user_id=:user&fields=id,amount,duration,description",{},{get:{method:"GET"}})}]).factory("BidUpdate",["$resource",function($resource){return $resource("/api/v1/bids/:id",{},{put:{method:"PUT"}})}]).factory("AwardedBids",["$resource",function($resource){return $resource("/api/v1/bids?project_id=:id&bid_status_id=:status",{id:"@id",status:"@status"},{get:{method:"GET"}})}]).factory("MyBids",["$resource",function($resource){return $resource("/api/v1/me/bids",{},{get:{method:"GET"}})}]).factory("UpdateBidStatus",["$resource",function($resource){return $resource("/api/v1/bids/:id/update_status",{id:"@id"},{put:{method:"PUT"}})}]).factory("Messages",["$resource",function($resource){return $resource("/api/v1/messages/:id",{},{get:{method:"GET"},post:{method:"POST"}})}]).factory("Bookmarks",["$resource",function($resource){return $resource("/api/v1/projects",{},{get:{method:"GET"}})}]).factory("Files",["$resource",function($resource){return $resource("/api/v1/project_attachment/:id",{},{get:{method:"GET"},post:{method:"POST"}})}]).factory("FollowUser",["$resource",function($resource){return $resource("/api/v1/followers",{},{post:{method:"POST"}})}]).factory("FollowUserDelete",["$resource",function($resource){return $resource("/api/v1/followers/:id",{id:"@id"},{"delete":{method:"DELETE"}})}]).factory("ProjectStatsCount",["$resource",function($resource){return $resource("/api/v1/employer/me/projects/stats",{},{get:{method:"GET"}})}]).factory("EmployerStatsCount",["$resource",function($resource){return $resource("/api/v1/employer/me/pay_stats",{},{get:{method:"GET"}})}]).factory("FreelancerStatusCount",["$resource",function($resource){return $resource("/api/v1/freelancer/me/bids/stats",{},{get:{method:"GET"}})}]).factory("projectMilestone",["$resource",function($resource){return $resource("/api/v1/employer/:id/milestones",{},{get:{method:"GET"}})}]).factory("projectInvoice",["$resource",function($resource){return $resource("/api/v1/employer/:id/project_bid_invoices",{},{get:{method:"GET"}})}]).factory("UserFactory",["$resource",function($resource){return $resource("/api/v1/me",{},{get:{method:"GET"}})}]).factory("biddingReviewFactory",["$resource",function($resource){return $resource("/api/v1/reviews/:id",{id:"@id"},{get:{method:"GET"},post:{method:"POST"},put:{method:"PUT"}})}]).factory("biddingProjectFactory",["$resource",function($resource){return $resource("/api/v1/projects/:id",{},{get:{method:"GET"}})}]).factory("AutocompleteUsers",["$resource",function($resource){return $resource("/api/v1/users?type=employer",{},{get:{method:"GET"}})}]).factory("biddingProjectTransactions",["$resource",function($resource){return $resource("/api/v1/users/:user_id/transactions",{},{user_id:"@user_id"},{get:{method:"GET"}})}]).factory("Invoice",["$resource",function($resource){return $resource("/api/v1/project_bid_invoices/:id",{},{get:{method:"GET"},post:{method:"POST"},put:{method:"PUT",params:{id:"@id"}},"delete":{method:"DELETE",params:{id:"@id"}}})}]).factory("MilestoneStatusChange",["$resource",function($resource){return $resource("/api/v1/milestones/:id/update_status",{id:"@id"},{put:{method:"PUT"}})}]),angular.module("getlancerApp.Bidding").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_actions.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_activities.html",'

    {{\'Activities\'|translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_add.html",'
    {{$root.settings.CURRENCY_SYMBOL}} {{$root.settings.CURRENCY_CODE}}
    {{\'Required\'| translate}}
    {{\'Enter the valid amount\'|translate}}
    {{\'Days\'|translate}}
    {{\'Required\'| translate }}
    {{\'Enter the valid day\'|translate}}
    {{\'Currently you dont have enough credit point to send your quote\'|translate}}. {{\'Please\'|translate}} {{\'click here\'|translate}} {{\'to purchase the plan and continue your business\'|translate}}.

    {{\'Your current available credit points\'|translate}}: {{available_credit_count}}

    {{\'You need to pay\' | translate }} {{$root.settings.CREDIT_POINT_FOR_BIDDING_A_PROJECT }} {{\'credit point to send your quote. System will get required points from your current available credit points\' | translate}}.

    {{\'Your current available credit points\'|translate}}: {{available_credit_count}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_awarded.html",'
    • {{\'Withdraw this expert and select existing bidder\'| translate }}
    • {{\'Im not interest existing bidders and move this project to open for bidding again\'| translate}}
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_awarded_tabs.html"," "),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_categories.html",'

    {{\'Hire Experts and Find Expert Jobs Online\'|translate}}

    [Image: Flexible]

    {{project_categories[0][\'name\']}}

    {{\'Post a Project\'|translate}}
    [Image: Multipurpose]

    {{project_categories[1][\'name\']}}

    {{\'Post a Project\'|translate}}
    [Image: Jobs-symbol]

    {{project_categories[2][\'name\']}}

    {{\'Post a Project\'|translate}}
    [Image: Construction]

    {{project_categories[3][\'name\']}}

    {{\'Post a Project\'|translate}}
    [Image: Sio]

    {{project_categories[4][\'name\']}}

    {{\'Post a Project\'|translate}}
    [Image: Flat design]

    {{project_categories[5][\'name\']}}

    {{\'Post a Project\'|translate}}
    [Image: Johnton-doe]

    {{project_categories[6][\'name\']}}

    {{\'Post a Project\'|translate}}
    [Image: Business]

    {{project_categories[7][\'name\']}}

    {{\'Post a Project\'|translate}}
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_dasboard_project_action.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_files.html",'

    {{\'FILES\'|translate}}

    {{(!is_show_upload_form)?\'Add File\':\'Cancel\' | translate}}

    {{\'Required\'| translate }}
    {{\'Allowed extensions:\'|translate}} {{$root.settings.ALLOWED_EXTENSIONS_FOR_PROJECT_DOCUMENT_FILE}} {{error_message}}
    [Image: Group]

    {{\'Drag\'|translate}} & {{\'drop your project related files here\'|translate}}...

    {{\'No records available\' | translate}}

    {{\'Date\'|translate}} {{\'Filename\'|translate}} {{\'Download\'|translate}}
    {{ProjectFile.created_at | date_format: \'yyyy-dd-MM h:mm a\'}} {{ProjectFile.filename}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_home_categories.html",'
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_home_skills.html",'
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_list.html",'
    Info! {{\'You can choose a new expert here\'|translate}}
    '), $templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_message.html",'
    [Image: {{message.user.username}}]

    {{message.user.username}} , {{ message.created_at | timeago}}

    [Image: USer]
    {{\'Required\'| translate }}

    {{"Project under dispute. So you can\'t send message." | translate}}

    {{"Project Mutually Cancelled. So you can\'t send message." | translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_project_actions.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_project_dashboard.html",'
    • {{projectStatus[0][\'project_count\'] -- projectStatus[1][\'project_count\']}}

      {{\'Draft\' | translate}}

    • {{projectStatus[2][\'project_count\']}}

      {{\'Waiting for Approval \'| translate}}

    • {{projectStatus[3][\'project_count\']}}

      {{\'Open for Bidding\' | translate}}

    • {{projectStatus[6][\'project_count\'] -- projectStatus[4][\'project_count\']}}

      {{\'Bidding\'|translate}} {{\'Closed/Expired\' | translate}}

    • {{projectStatus[5][\'project_count\']}}

      {{\'Winner Selected\' | translate}}

    • {{projectStatus[8][\'project_count\'] -- projectStatus[12][\'project_count\']}}

      {{\'Under Development\'| translate}}

    • {{projectStatus[11][\'project_count\']}}

      {{\'Waiting for Review\' | translate}}

    • {{projectStatus[13][\'project_count\']}}

      {{\'Closed\' | translate}}

    • {{projectStatus[10][\'project_count\'] -- projectStatus[9][\'project_count\'] -- projectStatus[7][\'project_count\']}}

      {{\'Cancelled\' | translate}}

    • {{employer_count.milestone_count}} {{\'Milestone\' | translate}}
    • {{employer_count.invoice_count}} {{\'Invoice\' | translate}}
    • {{freelancer_count.current_project_count}}

      {{\'Active Projects\' | translate}}

    • {{freelancer_count.active_bid_count}}

      {{\'Active Bids\' | translate}}

    • {{freelancer_count.past_project_count}}

      {{\'Past Projects\' | translate}}

    • {{freelancer_count.milestone_count}}

      {{\'Milestones\' | translate}}

    • {{freelancer_count.invoice_count}}

      {{\'Invoices\' | translate}}

    {{\'Project Name\'| translate}} {{\'Budget\'| translate}} ({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}}) {{\'Status\'| translate}} {{\'Budget\'| translate}} ({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}}) {{\'Bids\'| translate}} {{\'Average Bid\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Lowest Bid\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Bid Expiry date\'| translate}} {{\'Expert\'| translate}} {{\'Budget\'| translate}} ({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}}) {{\'Awarded Bid\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Milestone\'| translate}} {{\'Paid\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Status\'| translate}} {{\'Budget\'| translate}} ({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}}) {{\'Status\'| translate}} {{\'Amount\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Description\'| translate}} {{\'Status\'| translate}} {{\'Deadline Date\'| translate}} {{\'Amount\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Description\'| translate}} {{\'Total Paid\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Budget\'| translate}} ({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}}) {{\'Bids\'| translate}} {{\'End Date\'| translate}} {{\'Total Paid\'| translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Status\'| translate}} {{\'Action\'| translate}}

    {{project.name}}

    {{\'Featured\'|translate}} {{\'Private\'|translate}} {{\'Urgent\'|translate}} {{\'Sealed\'|translate}}
    {{project.project_range.min_amount}} - {{project.project_range.max_amount}}

    {{project.project_range.min_amount}} - {{project.project_range.max_amount}}

    {{(project.project_bid.bid_count != null) ? project.project_bid.bid_count: \'0\'}} {{project.project_bid.amount}}

    {{project.project_bid.lowest_bid_amount}}

    {{project.project_bid.bidding_end_date | date_format}}

    {{project.project_status.name}}

    {{project.bid_winner.user.username}}

    -

    {{project.project_range.min_amount}} - {{project.project_range.max_amount}}

    {{project.bid_winner.amount}}

    {{project.milestone_count}}

    {{project.bid_winner.amount}}

    {{project.project_status.name}}

    {{project.project_range.min_amount}} - {{project.project_range.max_amount}}

    {{project.project_status.name}}

    {{project.total_paid_amount}}

    {{project.project_range.min_amount}} - {{project.project_range.max_amount}}

    {{(project.project_bid.bid_count != null)?project.project_bid.bid_count: \'0\'}}

    {{project.project_bid.bidding_end_date | date_format}}

    {{project.total_paid_amount}}

    {{project.project_status.name}}

    {{milestone.project.name}} {{milestone.amount}} {{milestone.description}} {{milestone.milestone_status.name}} {{milestone.deadline_date}}
    -
    {{invoice.project.name}} {{invoice.amount}} {{bidinvoice.description}}
    -
    {{\'No records available\' | translate}}
    loading
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_project_mutual_cancel.html",'

    {{\'Project Cancellation Request\'|translate}}

    {{\'Required\'| translate }}

    {{userinfo}} {{\'sent project cancel Request\' | translate}}.

    {{\'You have sent project cancel Request\' | translate}}.

    {{userinfo}} {{\'sent project cancel Request\' | translate}}.

    {{\'You have sent project cancel Request\' | translate}}.

    [Image: {{userinfo}}]

    {{userinfo}} , {{ created_at | timeago}}

    {{\'Reason\'| translate}}: {{mutualcancelnote}}

    {{\'Project Mutually Canceled\' | translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_report.html",''), $templateCache.put("scripts/plugins/Bidding/Bidding/views/default/bidding_transactions.html",'

    {{\'Transactions\'|translate}}

    {{\'Date\' |translate}} {{\'Description\'|translate}} {{\'Credit\'|translate}}({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}}) {{\'Debit\'|translate}} ({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}})

    {{transaction.created_at | date_format : \'MMM dd, yyyy\'}}

    {{transaction.transaction_message}} {{transaction.transactionAmount.credit}} {{transaction.transactionAmount.debit}}

    {{\'No records available\' | translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/contact_freelancer.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/milestone_supplier_portal.html",'
    {{\'Project Name\'|translate}} {{\'Amount\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Description\'|translate}} {{\'Status\'|translate}} {{\'Deadline Date\'|translate}} {{\'Action\'|translate}}
    {{milestone.project.name}} {{milestone.amount}} {{milestone.description}} {{milestone.milestone_status.name}} {{milestone.deadline_date}}
    -
    {{\'No records available\'|translate}}
    loading
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_bids.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_bids_active.html",'
    {{\'Project Name\'|translate}} {{\'Bids\'|translate}} {{\'My Bid amount\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Avg Bid amount\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Bid Expiry date\'|translate}} {{\'Action\'|translate}}
    {{\'PROJECT NAME\'|translate}}
    {{bid.project.name}}
    {{bid.project_bid.bid_count}} {{bid.amount}} {{bid.project_bid.total_bid_amount / bid.project_bid.bid_count | number:2}} {{bid.project_bid.bidding_end_date | date_format : \'MMM dd yyyy\'}}
    {{\'No records available\'|translate}}
    loading
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_bids_current_projects.html",'
    {{\'Project Name\'|translate}} {{\'Employer\'|translate}} {{\'Assigned Amount\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Deadline\'|translate}} {{\'Bid Expiry date\'|translate}} {{\'Milestones\'|translate}} {{\'Invoices\'|translate}} {{\'Total Amount Received\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Action\'|translate}}
    {{\'PROJECT NAME\'|translate}}
    {{bid.project.name}}
    {{\'Employer\'|translate}} {{bid.project.user.username}} {{\'Awarded Bid\'|translate}} {{bid.amount}} {{\'Deadline\'|translate}} {{bid.project_bid.bidding_end_date | date_format : \'MMM dd yyyy\'}} {{\'Bid Expiry date\'|translate}} {{bid.project_bid.bidding_end_date | date_format : \'MMM dd yyyy\'}} {{\'Milestones\'|translate}} {{bid.milestone_count}} {{\'Invoices\'|translate}} {{bid.project.project_bid_invoice_count}} {{bid.paid_escrow_amount--bid.total_invoice_got_paid}}
    {{\'No records available\'|translate}}
    loading
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_bids_past_projects.html",'
    {{\'Project Name\'|translate}} {{\'Employer Details\'|translate}} {{\'Assigned Amount\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Milestones\'|translate}} {{\'Invoices\'|translate}} {{\'Total Amount Received\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}})
    {{\'PROJECT NAME\'|translate}}
    {{bid.project.name}}
    {{\'Employer
    \'|translate}}
    {{bid.project.user.username}}
    {{\'Awarded Bid\'|translate}} {{bid.amount}} {{\'Milestones\'|translate}} {{bid.milestone_count}} {{\'Invoices\'|translate}} {{bid.project.project_bid_invoice_count}} {{bid.paid_escrow_amount}}
    {{\'No records available\'|translate}}
    loading
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_project_draft.html",'

    {{\'Project Name\'| translate}}

    {{\'Bids\'| translate}}

    {{\'Expert\'| translate}}

    {{\'Awarded Bid\'| translate}}

    {{\'Time\'| translate}}

    {{\'Status\'| translate}}

    {{\'Action\'| translate}}


    {{project.project_bid.bid_count}}

    -

    {{project.created_at }}

    {{project.project_status.name}}

    {{\'No records available\'| translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_project_past.html",""),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_project_pending.html",'
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_project_progress.html",""),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/my_projects.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/project_add.html",'

    {{\'Post a Project\'|translate}}

    {{\'Required\'| translate }}

    {{\'Required\'| translate }}
    {{\'Expert can bid their proposals between this budget range.\'|translate}}
    {{settings.CURRENCY_SYMBOL+range.min_amount}} {{settings.CURRENCY_CODE+range.min_amount}}
    {{\'Required\'|translate}} {{\'Enter the valid amount\'|translate}}
    {{settings.CURRENCY_SYMBOL+range.max_amount}} {{settings.CURRENCY_CODE+range.max_amount}}
    {{\'Maximum Budget should be greater than minimum Budget\'| translate }} Required {{\'Enter the valid amount\'|translate}}
    {{\'Required\'| translate }}
    {{\'Required\'| translate }}
    {{\'Specify the Number of Days to Allow of Bidding\'|translate}}. {{\'Maximum days:\'|translate}} {{project_bidding_fee}} {{\'Specify the Number of Days to Allow of Bidding. Maximum days: \'| translate}} {{project_bidding_fee}}
    {{\'Required\'| translate}}
    {{\'Required\'| translate }}
    {{\'Allowed extensions:\'|translate}} {{$root.settings.ALLOWED_EXTENSIONS_FOR_PROJECT_DOCUMENT_FILE}} {{error_message}}
    {{\'Required\'| translate }} [Image: Group]

    {{\'Drag and Drop Any Image or Document That Might Be Helpful In Explaining Your Project Brief Here\'|translate}}

    {{\'Listing fee\'| translate}}: {{\'Free\'|translate}}

    {{\'Get the most from project! (optional)\'|translate}}

    • {{\'Featured\'|translate}}

      250% {{\'Higher success rate\'|translate}}!

      {{\'Our hands on recruitment service ensures you get the best results from your project. Our recruiters personally review your proposals saving you time vetting experts. Let us find to right person for the job\'|translate}}.

      {{\'Free\'|translate}}

    • {{\'Urgent\'|translate}}

      {{\'Our hands on recruitment service ensures you get the best results from your project. Our recruiters personally review your proposals saving you time vetting experts. Let us find to right person for the job\'|translate}}.

      {{\'Free\'|translate}}

    • {{\'Private\'|translate}}

      {{\'I want to hide project details from search engines and users that are not logged in. This feature is recommended for projects where confidentiality is a must\'|translate}}.

      {{\'Free\'|translate}}

    • {{\'SEALED\'|translate}}

      {{\'I want all bids to be sealed so that experts cannot see what others are bidding, leading to more accurate, higher quality proposals\'|translate}}.

      {{\'Free\'|translate}}

    {{"Post your project"|translate}}

    • {{\'Get bid from skilled Expert in minutes\'|translate}}.
    • {{\'View expert profiles and feedback and choose best expert\'|translate}}.
    • {{"Pay the expert once you\'re 100% satisfied"|translate}}.
    • {{"Milestone payment commission"|translate}}: {{settings.PROJECT_COMMISSION_FROM_EMPLOYER_FOR_MILESTONE}}%
    • {{"Invoice payment commission"|translate}}: {{settings.PROJECT_COMMISSION_FROM_EMPLOYER_FOR_INVOICE}}%
    '), $templateCache.put("scripts/plugins/Bidding/Bidding/views/default/project_bookmarks.html",'

    {{\'Bookmarked Projects\'|translate}}

    • {{\'Project\'|translate}}
      {{BookMark.name}}

      {{\'Bids/entries\'|translate}}: {{BookMark.project_bid.bid_count}} 0
      {{\'Date\'|translate}}: {{BookMark.created_at | timeago}}
      {{\'Price\'|translate}} ({{$root.settings.CURRENCY_SYMBOL}}) ({{$root.settings.CURRENCY_CODE}}) {{\'Min Amount\'|translate}} : {{\'Max Amount\'|translate}} :
      {{\'Delete\'|translate}}
    • {{\'No BookMarked Projects\'| translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/project_edit.html",'

    {{\'Edit Project\'|translate}} - {{data.name}}

    {{\'Required\'| translate }}
    {{\'Required\'| translate }}
    {{\'Expert can bid their proposals between this budget range.\'|translate}}
    {{settings.CURRENCY_SYMBOL+range.min_amount}} ({{$root.settings.CURRENCY_CODE}}) {{projectFrm.min_amount.$error.min}}
    {{\'Required\'|translate}} {{\'Enter the Valid Amount\'|translate}}
    {{settings.CURRENCY_SYMBOL+range.max_amount}}
    {{\'Maximum Budget should be greater than minimum Budget\'| translate }} Required {{\'Enter the Valid Amount\'|translate}}
    {{\'Required\'| translate }}
    {{\'Specify the Number of Days to Allow of Bidding\'|translate}}. {{\'Maximum days:\'|translate}}{{project_bidding_fee}} {{\'Specify the Number of Days to Allow of Bidding. Maximum days: \'| translate}} {{project_bidding_fee}}
    {{\'Required\'| translate}}
    {{\'Required\'| translate }}
    {{\'Required\'| translate }}
    {{\'Allowed extensions:\'|translate}} {{$root.settings.ALLOWED_EXTENSIONS_FOR_PROJECT_DOCUMENT_FILE}} {{error_message}}

    {{project_filename}}

    [Image: Group]

    {{\'Drag and Drop Any Image or Document That Might Be Helpful In Explaining Your Project Brief Here\'|translate}}

    {{\'Listing fee\'| translate}}: {{\'Free\'|translate}}

    {{\'Get the most from project! (optional)\'|translate}}

    • {{\'Featured\'|translate}}

      250% {{\'Higher success rate\'|translate}}!

      {{\'Our hands on recruitment service ensures you get the best results from your project. Our recruiters personally review your proposals saving you time vetting experts. Let us find to right person for the job\'|translate}}.

      {{\'Free\'|translate}}

    • {{\'Urgent\'|translate}}

      {{\'Our hands on recruitment service ensures you get the best results from your project. Our recruiters personally review your proposals saving you time vetting experts. Let us find to right person for the job\'|translate}}.

      {{\'Free\'|translate}}

    • {{\'Private\'|translate}}

      {{\'I want to hide project details from search engines and users that are not logged in. This feature is recommended for projects where confidentiality is a must\'|translate}}.

      {{\'Free\'|translate}}

    • {{\'SEALED\'|translate}}

      {{\'I want all bids to be sealed so that experts cannot see what others are bidding, leading to more accurate, higher quality proposals\'|translate}}.

      {{\'Free\'|translate}}

    {{"Post your project"|translate}}

    • {{\'Get bid from skilled expert in minutes\'|translate}}.
    • {{\'View expert profiles and feedback and choose best expert\'|translate}}.
    • {{"Pay the expert once you\'re 100% satisfied"|translate}}.
    • {{"Milestone payment commission"|translate}}: {{settings.PROJECT_COMMISSION_FROM_EMPLOYER_FOR_MILESTONE}}%
    • {{"Invoice payment commission"|translate}}: {{settings.PROJECT_COMMISSION_FROM_EMPLOYER_FOR_INVOICE}}%
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/project_payment.html",'
    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/project_view.html",'

    {{project.name}}

    • {{\'Bids\'|translate}} {{(project.project_bid.bid_count != null)?project.project_bid.bid_count: \'0\'}}
    • {{\'Avg Bids\'|translate}} N/A
    • {{\'Project Budget\'|translate}} -
    {{\'Featured\'|translate}} {{\'Private\'|translate}} {{\'Urgent\'|translate}} {{\'Sealed\'|translate}}
    {{\'Bid Placed\'|translate}}
    {{\'Saved as Draft\'|translate}} {{\'Payment Pending\'|translate}} {{\'Waiting for Approval \'|translate}} {{\'Bidding Expired\'|translate}} {{\'Waiting For Escrow\'|translate}} {{\'Funded In Escrow\'|translate}} {{\'Bidding Closed\'|translate}} {{\'Employer Canceled\'|translate}} {{\'Canceled By Admin\'|translate}} {{\'Open for Bidding\'|translate}} {{\'Winner Selected\'|translate}} {{\'Under Development\'|translate}} {{\'Completed\'|translate}} {{\'Closed\'|translate}} {{\'Mutually Canceled\'|translate}} {{\'Requested for complete\'|translate}} {{\'Final Review Pending\'|translate}}

    {{\'Project Description\' | translate}}

    {{\'Additional Description\' | translate}}

    {{project.attachment.filename}}

    {{\'About the employer\'|translate}}

    • {{value | number:1}}
    • {{rating_value}}
    • {{\'Email Verified\'|translate}}
    • {{\'Email till not verified\'|translate}}
    • {{\'Payment Verified\'|translate}}
    • {{\'Payment till not made\'|translate}}
    '), $templateCache.put("scripts/plugins/Bidding/Bidding/views/default/project_view_share.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/project_view_share_modal.html",''),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/projects.html",'

    {{\'Bookmarked Projects\'|translate}}

    {{\'Projects with My Skills\'|translate}}

    {{\'Browse Projects\'|translate}}

    Search



    {{\'Get started today\'|translate}}

    {{settings.SITE_NAME}} {{\'is the perfect place for you to find the best expert for your projects\'|translate}}.

    '),$templateCache.put("scripts/plugins/Bidding/Bidding/views/default/supplier_portal_invoice.html",'
    {{\'Project Name\'|translate}} {{\'Amount\'|translate}} ({{settings.CURRENCY_SYMBOL}}) ({{settings.CURRENCY_CODE}}) {{\'Description\'|translate}} {{\'Action\'|translate}}
    {{invoice.bid.project.name}} {{invoice.amount}}
    {{invoice.description}}
    -
    {{\'No records available\'|translate}}
    loading
    ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding');"use strict";angular.module("getlancerApp.Bidding.Milestone",["getlancerApp.Bidding.Constant","ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","slugifier","checklist-model","angularjs-dropdown-multiselect","rzModule"]).config(function($stateProvider,$urlRouterProvider){var getToken={TokenServiceData:function(TokenService,$q){return $q.all({AuthServiceData:TokenService.promise,SettingServiceData:TokenService.promiseSettings})}};$urlRouterProvider.otherwise("/"),$stateProvider.state("Bidding_MilestonePayment",{url:"/projects/payment/milestone/:id",templateUrl:"scripts/plugins/Bidding/Milestone/views/default/bidding_milestone_payment.html",controller:"BiddingMilestonePaymentCtrl",resolve:getToken})}),angular.module("getlancerApp.Bidding.Milestone").controller("BiddingMilestoneCtrl",function($scope,$rootScope,$timeout,$state,$cookies,$filter,flash,md5,ProjectStatusConstant,MeMilestone,BidMilestone,GetMilestoneStatus,MilestoneStatusChange,Milestone,MilestoneStatusConstant,DateFormat){function toggleMin(){$scope.inlineOptions.minDate=$scope.inlineOptions.minDate?null:new Date,$scope.dateOptions.minDate=new Date}function getDayClass(data){var date=data.date,mode=data.mode;if("day"===mode)for(var dayToCheck=new Date(date).setHours(0,0,0,0),i=0;i<$scope.events.length;i++){var currentDay=new Date($scope.events[i].date).setHours(0,0,0,0);if(dayToCheck===currentDay)return $scope.events[i].status}return""}$scope.MilestoneStatusConstant=MilestoneStatusConstant;var flashMessage="";$scope.isupdated=!1,$scope.milestones=[],$scope.data={},$scope.form_value=!1,$scope.milestoneinit=function(){$scope.milestoneindex(1),$scope.milestoneindex(2)},$scope.milestoneindex=function(reqType){if(1===reqType?$scope.milestoneParams={page:$scope.currentPageMilestone,limit:3,bid_id:$scope.bidid}:2===reqType?$scope.milestoneParams={page:$scope.currentPage,limit:3,bid_id:$scope.bidid}:$scope.milestoneParams={page:void 0!==$scope.currentPage?$scope.currentPage:1,limit:3,bid_id:$scope.bidid},1===parseInt(reqType))$scope.milestoneParams.milestone_status_id=1,$scope.totalAmount=0;else{var milestone_status_id=[2,3,4,5,6,7,8];$scope.milestoneParams.milestone_status_id=milestone_status_id.toString(),$scope.all=0}BidMilestone.get($scope.milestoneParams,function(response){0===parseInt(response.error.code)&&(angular.forEach(response.data,function(value){1===parseInt(reqType)?$scope.totalAmount+=parseInt(value.amount):value.milestone_status.id!==$scope.MilestoneStatusConstant.Canceled&&($scope.all+=parseInt(value.amount))}),1===parseInt(reqType)?($scope.milestones=response.data,$scope.currentPageMilestone=response._metadata.current_page,$scope.totalItemsMilestone=response._metadata.total,$scope.itemsPerPageMilestone=response._metadata.per_page,$scope.noOfPagesMilestone=response._metadata.last_page,$scope.is_show_loader=!1):($scope.milestonesGet=response.data,$scope.currentPage=response._metadata.current_page,$scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page,$scope.is_show_loader=!1))},function(error){1===parseInt(reqType)?($scope.currentPageMilestone=0,$scope.totalItemsMilestone=0,$scope.itemsPerPageMilestone=0,$scope.noOfPagesMilestone=0):($scope.currentPage=0,$scope.totalItems=0,$scope.itemsPerPage=0,$scope.noOfPages=0)})},GetMilestoneStatus.get(function(response){$scope.is_show_loader=!1,0===parseInt(response.error.code)&&($scope.milestoneStatus=response.data)},function(error){console.log("Milestone directive",error)}),$scope.form=function(){$scope.data={},0==$scope.form_value?($scope.create_mile=!0,$scope.form_value=!0,$scope.milestone_set_status_id=!1,$scope.buttonName="Cancel"):($scope.form_value=!1,$scope.buttonName=$scope.is_freelancer===!0?"Request Milestone":"Create Milestone")},$scope.milestone_set=!1,$scope.submit=function(id,$valid){$valid&&($scope.milestone_set=!0,angular.isDefined(id)?($scope.approveButton=!0,$scope.data.id=id,$scope.data.bid_id=$scope.bidid,$scope.is_freelancer||($scope.data.milestone_status_id=MilestoneStatusConstant.MilestoneSet),Milestone.put($scope.data,function(response){$scope.milestone_set=!1,$scope.milestonesss=response.data,0===response.error.code?($scope.form_value=!1,flashMessage=$filter("translate")("Milestone updated successfully."),flash.set(flashMessage,"success",!1),$scope.milestone_set=!1,$scope.buttonName=$scope.is_freelancer===!0?"Request Milestone":"Create Milestone"):($scope.milestone_set=!1,flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1)),$scope.milestoneinit()})):($scope.data.bid_id=$scope.bidid,$scope.data.deadline_date=$filter("date")(Date.parse($scope.data.deadline_date),DateFormat.created),BidMilestone.post($scope.data,function(response){$scope.milestonesss=response.data,0===response.error.code?($scope.form_value=!1,flashMessage=$filter("translate")("Milestone added successfully."),flash.set(flashMessage,"success",!1),$scope.milestone_set=!1,$scope.buttonName=$scope.is_freelancer===!0?"Request Milestone":"Create Milestone"):($scope.milestone_set=!1,flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1)),$scope.milestoneinit()})))},$scope.milestoneDelete=function(id){Milestone["delete"]({id:id},function(response){$scope.data=response.data;var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Milestone is deleted"),flash.set(flashMessage,"success",!1),$scope.milestoneinit()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})},$scope.MilestoneEdit=function(id){$scope.milestone_set=!1,$scope.create_mile=!1,$scope.data={},$scope.buttonName="Cancel",$scope.form_value=!0,Milestone.get({id:id},function(response){$scope.milestone_set_status_id=response.data.milestone_status_id,response.data.amount=parseInt(response.data.amount),$scope.data=response.data,$scope.setDate($scope.data.deadline_date)})},$scope.paginate=function(value,page){1===value?($scope.currentPageMilestone=parseInt(page),$scope.milestoneindex(1)):($scope.currentPage=parseInt(page),$scope.milestoneindex(2))},$scope.milestoneinit(),$scope.$on("isupdated",function(event,data){$scope.milestoneinit()}),$scope.today=function(){$scope.dt=new Date},$scope.today(),$scope.clear=function(){$scope.dt=null},$scope.inlineOptions={customClass:getDayClass,minDate:new Date,showWeeks:!0},$scope.dateOptions={formatYear:"yy",maxDate:new Date(2020,12,31),minDate:new Date,startingDay:1},toggleMin(),$scope.open1=function(){$scope.popup1.opened=!0},$scope.open2=function(){$scope.popup2.opened=!0},$scope.setDate=function(date){$scope.data.deadline_date=new Date(date)},$scope.formats=["yyyy-MM-dd","yyyy/MM/dd","dd.MM.yyyy","shortDate"],$scope.format=$scope.formats[1],$scope.altInputFormats=$scope.formats[1],$scope.popup1={opened:!1},$scope.popup2={opened:!1}}),angular.module("getlancerApp.Bidding.Milestone").controller("BiddingMilestonePaymentCtrl",function($rootScope,$scope,$window,countries,states,cities,$stateParams,usersAddresses,wallet,flash,$location,$filter,$state,paymentGateways,userSettings,ConstPaymentGateways,ProjectEditView,UserMeFactory,$cookies,Milestone,ClassName,PaymentOrderFactory,CouponGetStatusFactory,$uibModalStack){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Confirm your Payment"),Milestone.get({id:$state.params.id},function(response){0===parseInt(response.error.code)&&($scope.paymentValue=response.data,$scope.projectId=$scope.paymentValue.project.id,$scope.plan_info.price_final=$scope.paymentValue.amount,$scope.className=ClassName.milestone,$scope.commission_value=parseInt($scope.plan_info.price_final*$rootScope.settings.PROJECT_COMMISSION_FROM_EMPLOYER_FOR_MILESTONE)/100)}),$scope.minimum_wallet_amount=$rootScope.settings.WALLET_MIN_WALLET_AMOUNT,$scope.maximum_wallet_amount=$rootScope.settings.WALLET_MAX_WALLET_AMOUNT,$scope.buyer={},$scope.plan={},$scope.paynow_is_disabled=!1,$scope.payment_note_enabled=!1,$scope.payer_form_enabled=!0,$scope.is_wallet_page=!0,$scope.plan_info={},$scope.save_btn=!1,$scope.first_gateway_id="",$scope.index=function(){$scope.loader=!0,$scope.payment=!0,UserMeFactory.get({},function(response){$scope.user_available_balance=response.data.available_wallet_amount,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0});$scope.payNowPaytabClick=function(){var flashMessage;$scope.buyer.user_id=$rootScope.user.id,$scope.buyer.amount=$scope.amount,$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayTab,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]=$scope.className,$scope.buyer.lang=null!==$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY")?$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY"):"en",$scope.paynow_is_disabled=!0,PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.data.payment_url?$window.location.href=response.data.payment_url:(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):($scope.gatewayError=$filter("translate")(response.payment_response.error.message),flashMessage=$filter("translate")("Payment could not be completed.Please try again..."),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.payment_response.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.payment_response.error.message),"error",!1),$scope.paynow_is_disabled=!1})};var payment_gateways=[];paymentGateways.get({},function(payment_response){console.log("2-----");if(payment_response.wallet&&($scope.wallet_enabled=!0,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0),payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}if(payment_response.PayPalREST){var response=payment_response.PayPalREST;response.paypalrest_enabled&&($scope.paypal_enabled=!0)}if(payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}$scope.is_show_wallet_paybtn?($scope.isPaytabs=!1,$scope.isPayPal=!1):$scope.isPaytabs?($scope.isPaytabs=!0,$scope.isPayPal=!1):($scope.isPaytabs=!1,$scope.isPayPal=!0),$scope.group_gateway_id="",0===payment_response.error.code&&(void 0!==payment_response.zazpay&&1!==payment_response.zazpay.error.code?(angular.forEach(payment_response.zazpay.gateways,function(gateway_group_value,gateway_group_key){0===gateway_group_key&&($scope.group_gateway_id=gateway_group_value.id,$scope.first_gateway_id=gateway_group_value.id),angular.forEach(gateway_group_value.gateways,function(payment_geteway_value,payment_geteway_key){var payment_gateway={},suffix="sp_";0===gateway_group_key&&($scope.sel_payment_gateway="sp_"+payment_geteway_value.id),suffix+=payment_geteway_value.id,payment_gateway.id=payment_geteway_value.id,payment_gateway.payment_id=suffix,payment_gateway.group_id=gateway_group_value.id,payment_gateway.display_name=payment_geteway_value.display_name,payment_gateway.thumb_url=payment_geteway_value.thumb_url,payment_gateway.suffix=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.form_fields=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.instruction_for_manual=payment_geteway_value.instruction_for_manual,payment_gateways.push(payment_gateway)})}),$scope.gateway_groups=payment_response.zazpay.gateways,$scope.payment_gateways=payment_gateways,$scope.form_fields_tpls=payment_response.zazpay._form_fields_tpls,$scope.show_form=[],$scope.form_fields=[],angular.forEach($scope.form_fields_tpls,function(key,value){"buyer"===value&&($scope.form_fields[value]="views/buyer.html"),"credit_card"===value&&($scope.form_fields[value]="views/credit_card.html"),"manual"===value&&($scope.form_fields[value]="views/manual.html"),$scope.show_form[value]=!0}),$scope.gateway_id=ConstPaymentGateways.ZazPay):response.paypalrest_enabled&&($scope.gateway_id=ConstPaymentGateways.PayPal)),$scope.loader=!1,$scope.wallet_enabled===!0&&$scope.paypal_enabled!==!0?$scope.paneChanged("Wallet"):$scope.wallet_enabled===!1&&$scope.paypal_enabled===!0&&$scope.paneChanged("paypal")})},$scope.applyCoupon=function(){var params={};params.coupon_code=$scope.plan.coupon,params.amount=$scope.paymentValue.amount,CouponGetStatusFactory.get(params,function(response){if($scope.discountCoupon=response,0===response.error.code)if($scope.discountCoupon.data.discount_type_id==ConstDiscountType.Amount)$scope.plan_info.price_final=parseFloat($scope.paymentValue.amount)-parseFloat(response.data.discount),$scope.show_discount=$filter("currency")(response.data.discount);else{var discount_amt=response.data.discount/100*$scope.paymentValue.amount;$scope.plan_info.price_final=$scope.paymentValue.amount-discount_amt,$scope.show_discount=$filter("translate")(response.data.discount+"%")}else flash.set($filter("translate")(response.error.message),"error",!1),$scope.plan.coupon=""})},$scope.ClearCoupon=function(){$scope.plan_info.price_final=$scope.paymentValue.amount,$scope.purchase_plan_coupon=!1,$scope.show_discount=!1},$scope.paneChanged=function(pane){"Manual / Offline"===pane&&($scope.payment_note_enabled=!0);var keepGoing=!0;$scope.buyer={},$scope.PaymentForm.$setPristine(),$scope.PaymentForm.$setUntouched(),angular.forEach($scope.form_fields_tpls,function(key,value){$scope.show_form[value]=!1}),$scope.gateway_id=ConstPaymentGateways.ZazPay,angular.forEach($scope.gateway_groups,function(res){if(res.display_name===pane&&"Wallet"!==pane){var selPayment="";angular.forEach($scope.payment_gateways,function(response){keepGoing&&response.group_id===res.id&&(selPayment=response,keepGoing=!1,$scope.rdoclick(selPayment.id,selPayment.form_fields))}),$scope.sel_payment_gateway="sp_"+selPayment.id,$scope.group_gateway_id=selPayment.group_id}}),"Wallet"===pane&&($scope.gateway_id=ConstPaymentGateways.Wallet),"paypal"===pane&&($scope.gateway_id=ConstPaymentGateways.PayPal)},$scope.rdoclick=function(res,res1){$scope.paynow_is_disabled=!1,$scope.sel_payment_gateway="sp_"+res,$scope.array=res1.split(","),angular.forEach($scope.array,function(value){$scope.show_form[value]=!0})},$scope.PaymentFormSubmit=function(form){var payment_id="";if($scope.sel_payment_gateway&&$scope.gateway_id===ConstPaymentGateways.ZazPay&&(payment_id=$scope.sel_payment_gateway.split("_")[1]),$scope.auth=JSON.parse($cookies.get("auth")),$scope.buyer.user_id=$scope.auth.id,$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]=$scope.className,$scope.buyer.buyer_name=$scope.buyer.credit_card_name_on_card,$scope.buyer.payment_gateway_id=$scope.gateway_id,$scope.buyer.gateway_id=payment_id,$scope.buyer.coupon_code=$scope.plan.coupon,angular.isDefined($scope.buyer.credit_card_expired)&&($scope.buyer.credit_card_expired.month||$scope.buyer.credit_card_expired.year)&&($scope.buyer.credit_card_expire=$scope.buyer.credit_card_expired.month+"/"+$scope.buyer.credit_card_expired.year),form){$scope.paynow_is_disabled=!0;var flashMessage;if(parseFloat($scope.plan_info.price_final)>parseFloat($scope.user_available_balance)&&$scope.gateway_id===ConstPaymentGateways.Wallet)return flashMessage=$filter("translate")("Your wallet has insufficient money."),flash.set(flashMessage,"error",!1),$scope.paynow_is_disabled=!1,!0;PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.go("Bid_ProjectView",{id:$scope.paymentValue.project.id,slug:$scope.paymentValue.project.slug})):0===response.error.code?("Captured"===response.payment_response.status&&($scope.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.amount),$scope.my_user.available_wallet_amount=$scope.available_wallet_amount-$scope.project_commision),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.go("Bid_ProjectView",{id:$scope.paymentValue.project.id,slug:$scope.paymentValue.project.slug})):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){console.log(error),(angular.isDefined(error.data.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.data.error.message),"error",!1),$scope.paynow_is_disabled=!1})}},$scope.payNowPayPalClick=function(){var flashMessage;$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="Milestone",$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayPal,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.paynow_is_disabled=!0,PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.reload()):0===response.error.code?("Captured"===response.payment_response.status&&($scope.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.amount),$scope.my_user.available_wallet_amount=$scope.available_wallet_amount-$scope.project_commision),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.reload(),$state.go("user_dashboard")):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1,$uibModalStack.dismissAll()},function(error){console.log(error)})},countries.get({limit:"all"},function(response){angular.isDefined(response.data)&&($scope.countries=response.data)}),$scope.index()}),angular.module("getlancerApp.Bidding.Milestone").directive("milestoneActions",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Milestone/views/default/bidding_milestone_actions.html",scope:{projectuser:"@",milestoneid:"@",milestonestatus:"@",actiontype:"@"},controller:function($scope,$rootScope,$cookies,$state,$filter,flash,MilestoneStatusConstant,MilestoneStatusChange){$scope.auth=JSON.parse($cookies.get("auth")),$scope.MilestoneStatusConstant=MilestoneStatusConstant,parseInt($scope.projectuser)===parseInt($scope.auth.id)?$scope.is_freelancer=!1:$scope.is_freelancer=!0,$scope.actiontype=parseInt($scope.actiontype),$scope.milestoneStatueChange=function(milestoneId,statusId,status){"pay"!==statusId?swal({title:$filter("translate")("Are you sure you want to do this action?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&("workcompleted"===status?MilestoneStatusChange.put({id:milestoneId,milestone_status_id:$scope.MilestoneStatusConstant.Completed},function(response){0===response.error.code?MilestoneStatusChange.put({id:milestoneId,milestone_status_id:statusId},function(response){var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Milestone status changed"),flash.set(flashMessage,"success",!1),$scope.$emit("isupdated","true")):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}):MilestoneStatusChange.put({id:milestoneId,milestone_status_id:statusId},function(response){var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Milestone status changed"),flash.set(flashMessage,"success",!1),$scope.$emit("isupdated","true")):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}))}):$state.go("Bidding_MilestonePayment",{id:milestoneId,name:"milestone"})}}}}),angular.module("getlancerApp.Bidding.Milestone").factory("Milestone",["$resource",function($resource){return $resource("/api/v1/milestones/:id",{id:"@id"},{put:{method:"PUT"},get:{method:"GET"},"delete":{method:"DELETE"}})}]).factory("BidMilestone",["$resource",function($resource){return $resource("/api/v1/milestones",{},{get:{method:"GET"},post:{method:"POST"}})}]).factory("MeMilestone",["$resource",function($resource){return $resource("/api/v1/me/milestones",{},{get:{method:"GET"}})}]).factory("MilestoneStatus",["$resource",function($resource){return $resource("/api/v1/milestone_statuses",{},{get:{method:"GET"}})}]).factory("GetMilestoneStatus",["$resource",function($resource){return $resource("/api/v1/milestone_statuses",{},{get:{method:"GET"}})}]),angular.module("getlancerApp.Bidding.Milestone").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/Milestone/views/default/bidding_milestone.html",'

    {{buttonName}}

    {{\'New Milestone Request\'|translate}}

    {{\'Create Milestone\'|translate}}

    {{\'Required\'| translate }} {{\'Not a valid amount\'| translate }}
    {{\'Required\'| translate}}
    {{\'Required\'| translate}}

    {{\'Milestone Requests\'|translate}}

    {{\'Date\' |translate}} {{\'Amount\' |translate}} {{\'Description\'|translate}} {{\'Deadline Date\'|translate}} {{\'Actions\'|translate}}

    {{milestonesValue.created_at | date_format: \'yyyy-dd-MM h:mm a\'}}

    _

    {{milestonesValue.deadline_date}}

    {{\'No records available\' | translate}}

    {{"Project under dispute. So you can\'t send milestone." | translate}}

    {{\'Milestones\'|translate}}

    {{\'Date\' |translate}} {{\'Amount\' |translate}} {{\'Description\'|translate}} {{\'Status\' |translate}} {{\'Deadline Date\'|translate}} {{\'Actions\'|translate}}

    {{milestonesValue.created_at| date_format: \'yyyy-dd-MM h:mm a\'}}

    {{milestonesValue.milestone_status.name}}

    {{milestonesValue.deadline_date}}

    -

    {{\'No records available\' | translate}}

    Total:

    {{\'Milestones\'|translate}}

    {{"No records available" | translate}}

    {{"Project under dispute. So you can\'t send milestone." | translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Milestone/views/default/bidding_milestone_actions.html",'
  • {{\'Approve\'| translate}}
  • '), $templateCache.put("scripts/plugins/Bidding/Milestone/views/default/bidding_milestone_payment.html",'
    '),$templateCache.put("scripts/plugins/Bidding/Milestone/views/default/my_bids_milestones.html",'
    • {{\'PROJECT NAME\'|translate}}
      {{milestone.project.name}}
      {{\'AMOUNT\'|translate}}
      {{\'DESCRIPTION\'|translate}}
      {{\'STATUS\'|translate}} {{milestone.milestone_status.name}}
    • {{\'No milestone\' | translate}}

    ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding.Milestone');"use strict";angular.module("getlancerApp.Bidding.Invoice",["getlancerApp.Bidding.Constant","ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","slugifier","checklist-model","angularjs-dropdown-multiselect","rzModule"]).config(function($stateProvider,$urlRouterProvider){var getToken={TokenServiceData:function(TokenService,$q){return $q.all({AuthServiceData:TokenService.promise,SettingServiceData:TokenService.promiseSettings})}};$urlRouterProvider.otherwise("/"),$stateProvider.state("Bidding_InvoicePayment",{url:"/projects/payment/invoice/:id",templateUrl:"scripts/plugins/Bidding/Invoice/views/default/bidding_invoice_payment.html",controller:"BiddingInvoicePaymentCtrl",resolve:getToken})}),angular.module("getlancerApp.Bidding.Invoice").controller("BiddingInvoiceCtrl",function($scope,$rootScope,$timeout,$state,$cookies,$filter,flash,md5,ProjectStatusConstant,Invoice){$scope.GetInvoices=function(){$scope.invoiceparams.page=void 0!==$scope.InvoicecurrentPage?$scope.InvoicecurrentPage:1,Invoice.get($scope.invoiceparams,function(response){angular.isDefined(response._metadata)&&($scope.InvoicecurrentPage=response._metadata.current_page,$scope.InvoicetotalItems=response._metadata.total,$scope.InvoiceitemsPerPage=response._metadata.per_page,$scope.InvoicenoOfPages=response._metadata.last_page),0===parseInt(response.error.code)?$scope.invoices=response.data:$scope.invoices=[]})},$scope.InvoicePaginate=function(items){$scope.InvoicecurrentPage=parseInt(items),$rootScope.settings.SITE_ENABLED_PLUGINS.indexOf("Bidding/Invoice")>-1&&$scope.GetInvoices()},$scope.buttonInvoice="Add Invoice",$scope.invoice_value=!1,$scope.form=function(){$scope.data={},0==$scope.invoice_value?($scope.invoice_value=!0,$scope.buttonInvoice="Cancel"):($scope.invoice_value=!1,$scope.buttonInvoice="Add Invoice")},$scope.bids={},$scope.invoice_set=!1,$scope.ProjectInvoice=function(invoiceform,is_valid){$scope.invoice_set=!0;var flashMessage="";$scope.projectvalue={},$scope.projectvalue.bid_id=$scope.bidid,$scope.projectvalue.project_bid_invoice_items=[$scope.bids],angular.isDefined($scope.formid)&&null!==$scope.formid?Invoice.put({id:$scope.formid},$scope.projectvalue,function(response){$scope.invoice_set=!1,0===parseInt(response.error.code)?($scope.addInvoice=!1,flashMessage=$filter("translate")("Invoice updated successfully."),$scope.invoice_value=!1,$scope.buttonInvoice="Add Invoice",$scope.formid=null,flash.set(flashMessage,"success",!1),$scope.bids={},invoiceform.$setPristine(),invoiceform.$setUntouched(),$scope.GetInvoices()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}):is_valid&&($scope.invoice_set=!0,Invoice.post($scope.projectvalue,function(response){$scope.invoice_set=!1,0===parseInt(response.error.code)?($scope.addInvoice=!1,flashMessage=$filter("translate")("Invoice sent successfully."),$scope.buttonInvoice="Add Invoice",$scope.invoice_value=!1,flash.set(flashMessage,"success",!1),$scope.bids={},invoiceform.$setPristine(),invoiceform.$setUntouched(),$scope.GetInvoices()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}))},$scope.EditInvoice=function(invoiceId){$scope.buttonInvoice="Cancel",$scope.invoice_value=!0,$rootScope.settings.SITE_ENABLED_PLUGINS.indexOf("Bidding/Invoice")>-1&&Invoice.get({id:invoiceId},function(response){0===parseInt(response.error.code)&&($scope.getinvoice=response.data,angular.forEach($scope.getinvoice.projectbidinvoiceitems,function(value){$scope.formid=value.project_bid_invoice_id,$scope.bids.amount=parseInt(value.amount),$scope.bids.description=value.description}))})},$scope.deleteInvoice=function(invoiceId){var flashMessage={};null!==$rootScope.user&&void 0!==$rootScope.user&&swal({title:$filter("translate")("Are you sure you want to delete?"),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&Invoice["delete"]({id:invoiceId},function(response){0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Invoice deleted successfully."),flash.set(flashMessage,"success",!1),$scope.GetInvoices()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})})},$scope.GetInvoices()}),angular.module("getlancerApp.Bidding.Invoice").controller("BiddingInvoicePaymentCtrl",function($rootScope,$scope,$window,countries,states,cities,$stateParams,usersAddresses,wallet,flash,$location,$filter,$state,paymentGateways,userSettings,ConstPaymentGateways,ProjectEditView,UserMeFactory,$cookies,Invoice,ClassName,PaymentOrderFactory,CouponGetStatusFactory,$uibModalStack){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Confirm your Payment"),$rootScope.settings.SITE_ENABLED_PLUGINS.indexOf("Bidding/Invoice")>-1&&Invoice.get({id:$state.params.id},function(response){0===parseInt(response.error.code)&&($scope.paymentValue=response.data,$scope.plan_info.price_final=$scope.paymentValue.amount,$scope.className=ClassName.invoice,$scope.commission_value=parseInt($scope.plan_info.price_final*$rootScope.settings.PROJECT_COMMISSION_FROM_EMPLOYER_FOR_INVOICE)/100)}),$scope.minimum_wallet_amount=$rootScope.settings.WALLET_MIN_WALLET_AMOUNT,$scope.maximum_wallet_amount=$rootScope.settings.WALLET_MAX_WALLET_AMOUNT,$scope.buyer={},$scope.plan={},$scope.paynow_is_disabled=!1,$scope.payment_note_enabled=!1,$scope.payer_form_enabled=!0,$scope.is_wallet_page=!0,$scope.plan_info={},$scope.save_btn=!1,$scope.first_gateway_id="",$scope.index=function(){$scope.loader=!0,$scope.payment=!0,UserMeFactory.get({},function(response){$scope.user_available_balance=response.data.available_wallet_amount,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0});$scope.payNowPaytabClick=function(){var flashMessage;$scope.buyer.user_id=$rootScope.user.id,$scope.buyer.amount=$scope.amount,$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayTab,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="ProjectBidInvoice",$scope.buyer.lang=null!==$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY")?$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY"):"en",$scope.paynow_is_disabled=!0,PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.data.payment_url?$window.location.href=response.data.payment_url:(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):($scope.gatewayError=$filter("translate")(response.payment_response.error.message),flashMessage=$filter("translate")("Payment could not be completed.Please try again..."),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.payment_response.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.payment_response.error.message),"error",!1),$scope.paynow_is_disabled=!1})};var payment_gateways=[];paymentGateways.get({},function(payment_response){console.log("3-----");if(payment_response.wallet&&($scope.wallet_enabled=!0,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0),payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}if(payment_response.PayPalREST){var response=payment_response.PayPalREST;response.paypalrest_enabled&&($scope.paypal_enabled=!0)}if(payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}$scope.is_show_wallet_paybtn?($scope.isPaytabs=!1,$scope.isPayPal=!1):$scope.isPaytabs?($scope.isPaytabs=!0,$scope.isPayPal=!1):($scope.isPaytabs=!1,$scope.isPayPal=!0),$scope.group_gateway_id="",0===payment_response.error.code&&(void 0!==payment_response.zazpay&&1!==payment_response.zazpay.error.code?(angular.forEach(payment_response.zazpay.gateways,function(gateway_group_value,gateway_group_key){0===gateway_group_key&&($scope.group_gateway_id=gateway_group_value.id,$scope.first_gateway_id=gateway_group_value.id),angular.forEach(gateway_group_value.gateways,function(payment_geteway_value,payment_geteway_key){var payment_gateway={},suffix="sp_";0===gateway_group_key&&($scope.sel_payment_gateway="sp_"+payment_geteway_value.id),suffix+=payment_geteway_value.id,payment_gateway.id=payment_geteway_value.id,payment_gateway.payment_id=suffix,payment_gateway.group_id=gateway_group_value.id,payment_gateway.display_name=payment_geteway_value.display_name,payment_gateway.thumb_url=payment_geteway_value.thumb_url,payment_gateway.suffix=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.form_fields=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.instruction_for_manual=payment_geteway_value.instruction_for_manual,payment_gateways.push(payment_gateway)})}),$scope.gateway_groups=payment_response.zazpay.gateways,$scope.payment_gateways=payment_gateways,$scope.form_fields_tpls=payment_response.zazpay._form_fields_tpls,$scope.show_form=[],$scope.form_fields=[],angular.forEach($scope.form_fields_tpls,function(key,value){"buyer"===value&&($scope.form_fields[value]="views/buyer.html"),"credit_card"===value&&($scope.form_fields[value]="views/credit_card.html"),"manual"===value&&($scope.form_fields[value]="views/manual.html"),$scope.show_form[value]=!0}),$scope.gateway_id=ConstPaymentGateways.ZazPay):response.paypalrest_enabled&&($scope.gateway_id=ConstPaymentGateways.PayPal)),$scope.loader=!1,$scope.wallet_enabled===!0&&$scope.paypal_enabled!==!0?$scope.paneChanged("Wallet"):$scope.wallet_enabled===!1&&$scope.paypal_enabled===!0&&$scope.paneChanged("paypal")})},$scope.applyCoupon=function(){var params={};params.coupon_code=$scope.plan.coupon,params.amount=$scope.paymentValue.amount,CouponGetStatusFactory.get(params,function(response){if($scope.discountCoupon=response,0===response.error.code)if($scope.discountCoupon.data.discount_type_id==ConstDiscountType.Amount)$scope.plan_info.price_final=parseFloat($scope.paymentValue.amount)-parseFloat(response.data.discount),$scope.show_discount=$filter("currency")(response.data.discount);else{var discount_amt=response.data.discount/100*$scope.paymentValue.amount;$scope.plan_info.price_final=$scope.paymentValue.amount-discount_amt,$scope.show_discount=$filter("translate")(response.data.discount+"%")}else flash.set($filter("translate")(response.error.message),"error",!1),$scope.plan.coupon=""})},$scope.ClearCoupon=function(){$scope.plan_info.price_final=$scope.paymentValue.amount,$scope.purchase_plan_coupon=!1,$scope.show_discount=!1},$scope.paneChanged=function(pane){"Manual / Offline"===pane&&($scope.payment_note_enabled=!0);var keepGoing=!0;$scope.buyer={},$scope.PaymentForm.$setPristine(),$scope.PaymentForm.$setUntouched(),angular.forEach($scope.form_fields_tpls,function(key,value){$scope.show_form[value]=!1}),$scope.gateway_id=ConstPaymentGateways.ZazPay,angular.forEach($scope.gateway_groups,function(res){if(res.display_name===pane&&"Wallet"!==pane){var selPayment="";angular.forEach($scope.payment_gateways,function(response){keepGoing&&response.group_id===res.id&&(selPayment=response,keepGoing=!1,$scope.rdoclick(selPayment.id,selPayment.form_fields))}),$scope.sel_payment_gateway="sp_"+selPayment.id,$scope.group_gateway_id=selPayment.group_id}}),"Wallet"===pane&&($scope.gateway_id=ConstPaymentGateways.Wallet),"paypal"===pane&&($scope.gateway_id=ConstPaymentGateways.PayPal)},$scope.rdoclick=function(res,res1){$scope.paynow_is_disabled=!1,$scope.sel_payment_gateway="sp_"+res,$scope.array=res1.split(","),angular.forEach($scope.array,function(value){$scope.show_form[value]=!0})},$scope.PaymentFormSubmit=function(form){var payment_id="";if($scope.sel_payment_gateway&&$scope.gateway_id===ConstPaymentGateways.ZazPay&&(payment_id=$scope.sel_payment_gateway.split("_")[1]),$scope.auth=JSON.parse($cookies.get("auth")),$scope.buyer.user_id=$scope.auth.id,$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="ProjectBidInvoice",$scope.buyer.buyer_name=$scope.buyer.credit_card_name_on_card,$scope.buyer.payment_gateway_id=$scope.gateway_id,$scope.buyer.gateway_id=payment_id,$scope.buyer.coupon_code=$scope.plan.coupon,angular.isDefined($scope.buyer.credit_card_expired)&&($scope.buyer.credit_card_expired.month||$scope.buyer.credit_card_expired.year)&&($scope.buyer.credit_card_expire=$scope.buyer.credit_card_expired.month+"/"+$scope.buyer.credit_card_expired.year),form){$scope.paynow_is_disabled=!0;var flashMessage;if(parseFloat($scope.plan_info.price_final)>parseFloat($scope.user_available_balance)&&$scope.gateway_id===ConstPaymentGateways.Wallet)return flashMessage=$filter("translate")("Your wallet has insufficient money."),flash.set(flashMessage,"error",!1),$scope.paynow_is_disabled=!1,!0;PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.go("Bid_ProjectView",{id:$scope.paymentValue.project.id,slug:$scope.paymentValue.project.slug})):0===response.error.code?("Captured"===response.payment_response.status&&($scope.my_user.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.amount)),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.go("Bid_ProjectView",{id:$scope.paymentValue.project.id,slug:$scope.paymentValue.project.slug})):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.data.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.data.error.message),"error",!1),$scope.paynow_is_disabled=!1})}},$scope.payNowPayPalClick=function(){var flashMessage;$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="ProjectBidInvoice",$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayPal,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.paynow_is_disabled=!0,PaymentOrderFactory.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.reload()):0===response.error.code?("Captured"===response.payment_response.status&&($scope.my_user.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.amount)),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.reload(),$state.go("user_dashboard")):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1,$uibModalStack.dismissAll()},function(error){console.log(error)})},countries.get({limit:"all"},function(response){angular.isDefined(response.data)&&($scope.countries=response.data)}),$scope.index()}),angular.module("getlancerApp.Bidding.Invoice").factory("MeInvoice",function($resource){return $resource("/api/v1/me/project_bid_invoices",{},{get:{method:"GET"}})}),angular.module("getlancerApp.Bidding.Invoice").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/Invoice/views/default/bidding_invoice.html",'

    {{\'INVOICES\'|translate}}

    {{buttonInvoice}}

    {{\'Required\'| translate }}
    {{\'Required\'| translate}}

    {{\'No records available\' | translate}}

    {{\'Date\' |translate}} {{\'Amount\' |translate}} {{\'Description\'|translate}} {{\'Status\'|translate}} {{\'Actions\'|translate}}
    {{invoice.created_at | date_format: \'yyyy-dd-MM h:mm a\'}}
    {{invoice.description}}

    Not yet Paid

    Paid

    '),$templateCache.put("scripts/plugins/Bidding/Invoice/views/default/bidding_invoice_payment.html",'
    '),$templateCache.put("scripts/plugins/Bidding/Invoice/views/default/my_bids_invoices.html",'
    ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding.Invoice');"use strict";angular.module("getlancerApp.Bidding.Exam",["getlancerApp.Bidding.Constant","ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","slugifier","checklist-model","angularjs-dropdown-multiselect","rzModule"]).config(function($stateProvider,$urlRouterProvider){var getToken={TokenServiceData:function(TokenService,$q){return $q.all({AuthServiceData:TokenService.promise,SettingServiceData:TokenService.promiseSettings})}};$urlRouterProvider.otherwise("/"),$stateProvider.state("Exam",{url:"/exams?q&page&enable_hide",templateUrl:"scripts/plugins/Bidding/Exam/views/default/exams.html",controller:"ExamListCtrl",resolve:getToken}).state("MyExams",{url:"/exams/my_attempts",templateUrl:"scripts/plugins/Bidding/Exam/views/default/my_exams.html",controller:"MyExamController",resolve:getToken}).state("ExamCertified",{url:"/exams/my_attempts/status/certified",templateUrl:"scripts/plugins/Bidding/Exam/views/default/my_exams.html",controller:"MyExamController",resolve:getToken}).state("Exam_Payment",{url:"/exams/order/:id",templateUrl:"scripts/plugins/Bidding/Exam/views/default/exam_payment.html",controller:"ExamPaymentController",resolve:getToken}).state("ExamStart",{url:"/exams/start/:id",templateUrl:"scripts/plugins/Bidding/Exam/views/default/exam_start.html",controller:"ExamStartController",resolve:getToken}).state("OnlineTest",{url:"/exams/online_test/:id",templateUrl:"scripts/plugins/Bidding/Exam/views/default/exam_online.html",controller:"ExamOnlineTestCtrl",resolve:getToken}).state("ExamResult",{url:"/exams/result/:id",templateUrl:"scripts/plugins/Bidding/Exam/views/default/exam_result.html",controller:"ExamResultController",resolve:getToken}).state("ExamView",{url:"/exams/:id/:slug",templateUrl:"scripts/plugins/Bidding/Exam/views/default/exam_view.html",controller:"ExamViewCtrl",resolve:getToken})}),angular.module("getlancerApp.Bidding.Exam").controller("ExamListCtrl",function($scope,$rootScope,$state,$filter,$location,flash,Exams,md5){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Skills Lab"),$scope.params={},void 0!==$state.params.q&&($scope.params.q=$state.params.q),$scope.index=function(){$scope.loader=!0,$scope.params.limit=21,$scope.params.page=$scope.currentPage,Exams.get($scope.params,function(response){0===parseInt(response.error.code)&&(angular.isDefined(response._metadata)&&($scope.currentPage=response._metadata.current_page,$scope.totalItems=response._metadata.total,$scope.itemsPerPage=response._metadata.per_page,$scope.noOfPages=response._metadata.last_page),angular.isDefined(response.data)?($scope.exams=response.data,angular.forEach($scope.exams,function(value){angular.isDefined(value.attachment)&&null!=value.attachment?value.logo_url="images/small_normal_thumb/"+value.attachment["class"]+"/"+value.attachment.foreign_id+"."+md5.createHash(value.attachment["class"]+value.attachment.foreign_id+"pngsmall_normal_thumb")+".png":value.logo_url="images/no-image.png"})):($scope.exams="",$scope.errorMessage="",angular.isDefined(response.error)&&($scope.errorMessage=response.error.message),$scope.currentPage=0,$scope.totalItems=0,$scope.itemsPerPage=0,$scope.noOfPages=0))},function(error){console.log("Exam Get",error)}),$scope.loader=!1},$scope.refinesearch=function(qVal){qVal?($scope.params.q=qVal,$state.go("Exam",{q:qVal})):$state.go("Exam")},$scope.paginate=function(){$scope.currentPage=parseInt($scope.currentPage),$scope.index()},$scope.index()}).controller("ExamViewCtrl",function($scope,$rootScope,$state,$filter,$location,flash,ExamsView,PerDayExam,ExamStatus,ExamUser,md5,$cookies){$scope.PerDayLimit=PerDayExam.NumOfTime,$scope.ExamStatus=ExamStatus;var flashMessage="",params={};ExamsView.get({id:$state.params.id},function(response){if(0===parseInt(response.error.code)){$scope.show_response_page=!0,$scope.examValue=response.data,$scope.str=$scope.examValue.instructions.replace("##QUESTION_COUNT##",$scope.examValue.exams_question_count).replace("##EXAM_DURATION##",$scope.examValue.duration),$scope.topics_covered=$scope.examValue.topics_covered,angular.isDefined($scope.examValue.attachment)&&(null!==$scope.examValue.attachment?$scope.examValue.logo_url="images/big_thumb/"+$scope.examValue.attachment["class"]+"/"+$scope.examValue.attachment.foreign_id+"."+md5.createHash($scope.examValue.attachment["class"]+$scope.examValue.attachment.foreign_id+"pngbig_thumb")+".png":$scope.examValue.logo_url="images/no-image.png");var noAttempt=0,passedCount=0,Inprogress=0,Incomplete=0,FeePaidOrNotStarted=0,SuspendedDueToTakingOvertime=0,Failed=0;angular.forEach($scope.examValue.ExamsUser,function(value){noAttempt+=value.no_of_times,value.exam_status_id==ExamStatus.Passed?passedCount+=1:value.exam_status_id==ExamStatus.Inprogress?Inprogress+=1:value.exam_status_id==ExamStatus.Incomplete?Incomplete+=1:value.exam_status_id==ExamStatus.FeePaidOrNotStarted?FeePaidOrNotStarted+=1:value.exam_status_id==ExamStatus.SuspendedDueToTakingOvertime?SuspendedDueToTakingOvertime+=1:value.exam_status_id==ExamStatus.Failed&&(Failed+=1)}),$scope.passedCount=passedCount,$scope.Inprogress=Inprogress,$scope.Incomplete=Incomplete,$scope.FeePaidOrNotStarted=FeePaidOrNotStarted,$scope.SuspendedDueToTakingOvertime=SuspendedDueToTakingOvertime,$scope.Failed=Failed,$scope.examAttempts=noAttempt;var parentpassCount=0;0!==$scope.examValue.parent.length&&(angular.forEach($scope.examValue.parent[0].parent_exams_users,function(parentvalue){parentvalue.exam_status_id==ExamStatus.Passed&&(parentpassCount+=1)}),$scope.parentpassCount=parentpassCount)}},function(error){}),$scope.exam_users=function(value){params.exam_id=value,$cookies.put("exam_id",JSON.stringify(value)),ExamUser.post(params,function(response){0===response.error.code?response.data.exam_status_id==ExamStatus.ExamFeePaymentPending?($rootScope.exam_id=response.data.exam_id,$state.go("Exam_Payment",{id:response.data.id},{reload:!0})):response.data.exam_status_id==ExamStatus.FeePaidOrNotStarted&&$state.go("ExamStart",{id:response.data.id},{reload:!0}):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}}).controller("ExamStartController",function($scope,$rootScope,$state,$filter,$location,flash,ExamStart,$window){ExamStart.get({id:$state.params.id},function(response){0===parseInt(response.error.code)&&($scope.exam_start=response.data,$scope.str=$scope.exam_start.exam.splash_content.replace("##QUESTION_COUNT##",$scope.exam_start.exam.exams_question_count).replace("##EXAM_DURATION##",$scope.exam_start.exam.duration))},function(error){}),$scope.examStart=function(examId){$state.go("OnlineTest",{id:examId})}}).controller("MyExamController",function($scope,$rootScope,$state,$filter,$location,flash,MyExam,$window){function index(){$scope.id="MyExams"==$state.current.name?4:3,MyExam.get({exam_status_id:$scope.id},function(response){0===parseInt(response.error.code)&&($scope.myExams=response.data)},function(error){})}index(),$scope.filter=function(value){3===parseInt(value)?$state.go("ExamCertified"):$state.go("MyExams")}}).controller("ExamOnlineTestCtrl",function($scope,$rootScope,$state,$filter,$location,flash,ExamStart,$cookies,QuestionAnswer,$timeout,$interval,$window){$scope.startautoCall=0,$scope.stopautoCall=0,$scope.questionAnswer=[],$scope.tmp_skills=[];var flashMessage="";$scope.milisecondsDiff=0,$scope.currentPage=void 0!==$cookies.get("exampage")?parseInt($cookies.get("exampage")):0,0===$scope.currentPage?$cookies.put("exampage",0,{path:"/"}):$scope.is_show_previous=!0,void 0!==$cookies.get("examValue")&&($scope.tmp_skills=JSON.parse($cookies.get("examValue"))),parseInt($scope.currentPage)<9?$scope.is_show_next=!0:$scope.is_show_next=!1,ExamStart.get({id:$state.params.id,is_exam_started:1},function(response){function shuffle(array){if($scope.exam_data){if(1===$scope.exam_data.exam_status_id){for(var temporaryValue,randomIndex,currentIndex=array.length;0!==currentIndex;)randomIndex=Math.floor(Math.random()*currentIndex),currentIndex-=1,temporaryValue=array[currentIndex],array[currentIndex]=array[randomIndex],array[randomIndex]=temporaryValue;return array}for(var temporaryValue,currentIndex=array.length;0!==currentIndex;)randomIndex=Math.floor(currentIndex),currentIndex-=0,temporaryValue=array[currentIndex],array[currentIndex]=array[randomIndex],array[randomIndex]=temporaryValue;return array}}if(0===parseInt(response.error.code)){$scope.exam_data=response.data,$timeout(function(){$scope.accessTimeOut=!0},1e3),$scope.intervalFunction(),$scope.callfailure=!1;$scope.questionArray=shuffle($scope.exam_data.Question)}else flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1),$state.go("Exam");$scope.exam_data&&(1===$scope.exam_data.exam_status_id?$scope.milisecondsDiff=6e4*($scope.exam_data.allow_duration-$scope.exam_data.taken_time):($scope.milisecondsDiff=$window.localStorage.getTime,$window.localStorage.removeItem("getTime"))),$timeout(function(){$scope.timerStop=!1,$scope.timerStop===!0&&(flashMessage=$filter("translate")("Your time is out"),flash.set(flashMessage,"success",!1)),$scope.answercall={},$scope.answercall.user_answer=$scope.user_answer,$scope.answercall.exams_user_id=parseInt($state.params.id),$scope.answercall.is_exam_completed=1,QuestionAnswer.post($scope.answercall,function(response){0===response.error.code?(flashMessage=$filter("translate")("Your exam is successfully completed"),flash.set(flashMessage,"success",!1),$scope.stopautoCall=1,$state.go("ExamResult",{id:$state.params.id})):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})},$scope.milisecondsDiff),$scope.timerStop=!0,$scope.timerId=$interval(function(){$scope.timerStop===!0&&($scope.milisecondsDiff<=0||($scope.timeLeft=$scope.getRemainTimeFormat($scope.milisecondsDiff),$(".js-time-display").html($scope.timeLeft+""),$scope.milisecondsDiff=$scope.milisecondsDiff-1e3))},1e3)},function(error){console.log(error)}),window.onbeforeunload=function(event){var hms=$scope.timeLeft,a=hms.split(":"),seconds=60*+a[0]*60+60*+a[1]+ +a[2];$scope.timevalue=1e3*seconds,$scope.reloadresponse=$scope.timevalue;var message="Sure you want to leave?";return"undefined"==typeof event&&(event=window.event),event&&(event.returnValue=message),message},$scope.prevQuestion=function(){Object.keys($scope.questionArray).length>0&&($scope.currentPage=parseInt($scope.currentPage)-1===0?0:parseInt($scope.currentPage)-1,$cookies.put("exampage",$scope.currentPage,{path:"/"}),0===parseInt($scope.currentPage)?($scope.is_show_previous=!1,$scope.is_show_next=!0):($scope.is_show_next=!0,$scope.is_show_previous=!0))},$scope.nextQuestion=function(){Object.keys($scope.questionArray).length>0&&($scope.currentPage=parseInt($scope.currentPage)+1>Object.keys($scope.questionArray).length?Object.keys($scope.questionArray).length-1:$scope.currentPage+1,$cookies.put("exampage",$scope.currentPage,{path:"/"}),Object.keys($scope.questionArray).length===$scope.currentPage+1?$scope.is_show_next=!1:($scope.is_show_next=!0,$scope.is_show_previous=!0))},$scope.user_answer=[],$scope.choosedAnswer=function(qid,ansvalue,$index){$scope.exams_user_id=parseInt($state.params.id),$scope.answer={question_id:qid,answer:ansvalue},0!==$scope.user_answer.length?angular.forEach($scope.user_answer,function(value,key){parseInt(value.question_id)===parseInt(qid)?$scope.user_answer.splice(key,1):$scope.pushvalue=!0}):$scope.user_answer.push($scope.answer),$scope.pushvalue===!0&&$scope.user_answer.push($scope.answer),$scope.autoCallanswer()},$scope.submit=function(){swal({title:$filter("translate")("Are you sure you want to complete this exam?"),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&($scope.timerStop=!0,$scope.answercall={},$scope.answercall.user_answer=$scope.user_answer,$scope.answercall.exams_user_id=parseInt($state.params.id),$scope.answercall.is_exam_completed=1,QuestionAnswer.post($scope.answercall,function(response){0===response.error.code?(flashMessage=$filter("translate")("Your exam is successfully completed"),$scope.stopautoCall=1,flash.set(flashMessage,"success",!1),$state.go("ExamResult",{id:$state.params.id})):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))}))})},$scope.autoCallanswer=function(){$scope.answercall={},$scope.answercall.user_answer=$scope.user_answer,$scope.answercall.exams_user_id=parseInt($state.params.id),QuestionAnswer.post($scope.answercall,function(response){0===response.error.code})},$scope.autoCallanswers=function(){$scope.answercall={},$scope.user_answers=[],$scope.answercall.user_answer=$scope.user_answers,$scope.answercall.exams_user_id=parseInt($state.params.id||0),0!==$scope.answercall.exams_user_id&&QuestionAnswer.post($scope.answercall,function(response){0===response.error.code?($scope.callfailure=!1,$scope.intervalFunction(),console.log("Auto call success")):($scope.callfailure=!0,console.log("Auto call failure"))})},$scope.intervalFunction=function(){$timeout(function(){$scope.callfailure===!1&&void 0!==$scope.callfailure&&0===$scope.stopautoCall&&$scope.autoCallanswers()},5e3)},$scope.getRemainTimeFormat=function($milisecondsDiff){return Math.floor($milisecondsDiff/36e5).toLocaleString(void 0,{minimumIntegerDigits:2})+":"+(Math.floor($milisecondsDiff/6e4)%60).toLocaleString(void 0,{minimumIntegerDigits:2})+":"+(Math.floor($milisecondsDiff/1e3)%60).toLocaleString(void 0,{minimumIntegerDigits:2})}}).controller("ExamResultController",function($scope,$rootScope,$state,$filter,$location,flash,ExamStart,$window,$timeout){function examStart(){ExamStart.get({id:$state.params.id},function(response){0===parseInt(response.error.code)&&($scope.exam_data=response.data,$timeout(function(){$scope.accessTimeOut=!0},1e3))},function(error){console.log(error)})}examStart()}),angular.module("getlancerApp.Bidding.Exam").controller("ExamPaymentController",function($rootScope,$scope,$window,countries,states,cities,$stateParams,usersAddresses,wallet,flash,$location,$filter,$state,paymentGateways,userSettings,ConstPaymentGateways,ProjectEditView,UserMeFactory,ExamsPayment,ExamsView,$cookies,md5){$scope.exam_id=JSON.parse($cookies.get("exam_id")),$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Confirm your Payment"),ExamsView.get({id:$scope.exam_id},function(response){0===parseInt(response.error.code)&&($scope.examValue=response.data,$scope.plan_info.price_final=$scope.examValue.fee),angular.isDefined($scope.examValue.attachment)&&(null!==$scope.examValue.attachment?$scope.examValue.logo_url="images/big_thumb/"+$scope.examValue.attachment["class"]+"/"+$scope.examValue.attachment.foreign_id+"."+md5.createHash($scope.examValue.attachment["class"]+$scope.examValue.attachment.foreign_id+"pngbig_thumb")+".png":$scope.examValue.logo_url="images/no-image.png")}),$scope.minimum_wallet_amount=$rootScope.settings.WALLET_MIN_WALLET_AMOUNT,$scope.maximum_wallet_amount=$rootScope.settings.WALLET_MAX_WALLET_AMOUNT,$scope.buyer={},$scope.plan={},$scope.paynow_is_disabled=!1,$scope.payment_note_enabled=!1,$scope.payer_form_enabled=!0,$scope.is_wallet_page=!0,$scope.plan_info={},$scope.save_btn=!1,$scope.first_gateway_id="",$scope.index=function(){$scope.loader=!0,$scope.payment=!0,UserMeFactory.get({},function(response){$scope.user_available_balance=response.data.available_wallet_amount,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0});$scope.payNowPaytabClick=function(){var flashMessage;$scope.buyer.user_id=$rootScope.user.id,$scope.buyer.amount=$scope.amount,$scope.buyer.payment_gateway_id=ConstPaymentGateways.PayTab,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.buyer.lang=null!==$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY")?$window.localStorage.getItem("NG_TRANSLATE_LANG_KEY"):"en",$scope.paynow_is_disabled=!0,wallet.create($scope.buyer,function(response){0===response.error.code?void 0!==response.data.payment_url?$window.location.href=response.data.payment_url:(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):($scope.gatewayError=$filter("translate")(response.payment_response.error.message),flashMessage=$filter("translate")("Payment could not be completed.Please try again..."),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.payment_response.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.payment_response.error.message),"error",!1),$scope.paynow_is_disabled=!1})};var payment_gateways=[];paymentGateways.get({},function(payment_response){console.log("4-----");if(payment_response.wallet&&($scope.wallet_enabled=!0,0===parseInt($scope.user_available_balance)?$scope.is_show_wallet_paybtn=!1:$scope.is_show_wallet_paybtn=!0),payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}if(payment_response.PayPalREST){var response=payment_response.PayPalREST;response.paypalrest_enabled&&($scope.paypal_enabled=!0)}if(payment_response.PayTabs){var response=payment_response.PayTabs;response.paytabs_enabled&&($scope.paytabs_enabled=!0)}$scope.is_show_wallet_paybtn?($scope.isPaytabs=!1,$scope.isPayPal=!1):$scope.isPaytabs?($scope.isPaytabs=!0,$scope.isPayPal=!1):($scope.isPaytabs=!1,$scope.isPayPal=!0),$scope.group_gateway_id="",0===payment_response.error.code&&(void 0!==payment_response.zazpay&&1!==payment_response.zazpay.error.code?(angular.forEach(payment_response.zazpay.gateways,function(gateway_group_value,gateway_group_key){0===gateway_group_key&&($scope.group_gateway_id=gateway_group_value.id,$scope.first_gateway_id=gateway_group_value.id),angular.forEach(gateway_group_value.gateways,function(payment_geteway_value,payment_geteway_key){var payment_gateway={},suffix="sp_";0===gateway_group_key&&($scope.sel_payment_gateway="sp_"+payment_geteway_value.id),suffix+=payment_geteway_value.id,payment_gateway.id=payment_geteway_value.id,payment_gateway.payment_id=suffix,payment_gateway.group_id=gateway_group_value.id,payment_gateway.display_name=payment_geteway_value.display_name,payment_gateway.thumb_url=payment_geteway_value.thumb_url,payment_gateway.suffix=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.form_fields=payment_geteway_value._form_fields._extends_tpl.join(),payment_gateway.instruction_for_manual=payment_geteway_value.instruction_for_manual,payment_gateways.push(payment_gateway)})}),$scope.gateway_groups=payment_response.zazpay.gateways,$scope.payment_gateways=payment_gateways,$scope.form_fields_tpls=payment_response.zazpay._form_fields_tpls,$scope.show_form=[],$scope.form_fields=[],angular.forEach($scope.form_fields_tpls,function(key,value){"buyer"===value&&($scope.form_fields[value]="views/buyer.html"),"credit_card"===value&&($scope.form_fields[value]="views/credit_card.html"),"manual"===value&&($scope.form_fields[value]="views/manual.html"),$scope.show_form[value]=!0}),$scope.gateway_id=ConstPaymentGateways.ZazPay):response.paypalrest_enabled&&($scope.gateway_id=ConstPaymentGateways.PayPal)),$scope.loader=!1,$scope.wallet_enabled===!0&&$scope.paypal_enabled!==!0?$scope.paneChanged("Wallet"):$scope.wallet_enabled===!1&&$scope.paypal_enabled===!0&&$scope.paneChanged("paypal")})},$scope.applyCoupon=function(){var params={};params.coupon_code=$scope.plan.coupon,params.amount=$scope.examValue.Exam.zazpay_revised_amount,CouponGetStatusFactory.get(params,function(response){if($scope.discountCoupon=response,0===response.error.code)if($scope.discountCoupon.data.discount_type_id==ConstDiscountType.Amount)$scope.plan_info.price_final=parseFloat($scope.examValue.Exam.zazpay_revised_amount)-parseFloat(response.data.discount),$scope.show_discount=$filter("currency")(response.data.discount);else{var discount_amt=response.data.discount/100*$scope.examValue.Exam.zazpay_revised_amount;$scope.plan_info.price_final=$scope.examValue.Exam.zazpay_revised_amount-discount_amt,$scope.show_discount=$filter("translate")(response.data.discount+"%")}else flash.set($filter("translate")(response.error.message),"error",!1),$scope.plan.coupon=""})},$scope.ClearCoupon=function(){$scope.plan_info.price_final=$scope.examValue.Exam.zazpay_revised_amount,$scope.purchase_plan_coupon=!1,$scope.show_discount=!1},$scope.paneChanged=function(pane){"Manual / Offline"===pane&&($scope.payment_note_enabled=!0);var keepGoing=!0;$scope.buyer={},$scope.PaymentForm.$setPristine(),$scope.PaymentForm.$setUntouched(),angular.forEach($scope.form_fields_tpls,function(key,value){$scope.show_form[value]=!1}),$scope.gateway_id=ConstPaymentGateways.ZazPay,angular.forEach($scope.gateway_groups,function(res){if(res.display_name===pane&&"Wallet"!==pane){var selPayment="";angular.forEach($scope.payment_gateways,function(response){keepGoing&&response.group_id===res.id&&(selPayment=response,keepGoing=!1,$scope.rdoclick(selPayment.id,selPayment.form_fields))}),$scope.sel_payment_gateway="sp_"+selPayment.id,$scope.group_gateway_id=selPayment.group_id}}),"Wallet"===pane&&($scope.gateway_id=ConstPaymentGateways.Wallet),"paypal"===pane&&($scope.gateway_id=ConstPaymentGateways.PayPal)},$scope.rdoclick=function(res,res1){$scope.paynow_is_disabled=!1,$scope.sel_payment_gateway="sp_"+res,$scope.array=res1.split(","),angular.forEach($scope.array,function(value){$scope.show_form[value]=!0})},$scope.PaymentFormSubmit=function(form){var payment_id="";if($scope.sel_payment_gateway&&$scope.gateway_id===ConstPaymentGateways.ZazPay&&(payment_id=$scope.sel_payment_gateway.split("_")[1]),$scope.buyer.payment_gateway_id=$scope.gateway_id,$scope.buyer.gateway_id=payment_id,$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="ExamsUser",$scope.buyer.coupon_code=$scope.plan.coupon,angular.isDefined($scope.buyer.credit_card_expired)&&($scope.buyer.credit_card_expired.month||$scope.buyer.credit_card_expired.year)&&($scope.buyer.credit_card_expire=$scope.buyer.credit_card_expired.month+"/"+$scope.buyer.credit_card_expired.year),form){$scope.paynow_is_disabled=!0;var flashMessage;if(parseFloat($scope.plan_info.price_final)>parseFloat($scope.user_available_balance)&&$scope.gateway_id===ConstPaymentGateways.Wallet)return flashMessage=$filter("translate")("Your wallet has insufficient money."),flash.set(flashMessage,"error",!1),$scope.paynow_is_disabled=!1,!0;ExamsPayment.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.go("ExamStart",{id:response.data.id})):0===response.error.code?("Captured"===response.payment_response.status&&($scope.my_user.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.fee_paid)),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.go("ExamStart",{id:response.data.id})):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.data.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.data.error.message),"error",!1),$scope.paynow_is_disabled=!1})}},$scope.payNowPayPalClick=function(){var flashMessage;$scope.buyer.payment_gateway_id=$scope.gateway_id,$scope.buyer.gateway_id=$scope.buyer.payment_gateway_id,$scope.buyer.foreign_id=$state.params.id,$scope.buyer["class"]="ExamsUser",$scope.paynow_is_disabled=!0,ExamsPayment.create($scope.buyer,function(response){0===response.error.code?void 0!==response.redirect_url?$window.location.href=response.redirect_url:void 0!==response.data.gateway_callback_url?$window.location.href=response.data.gateway_callback_url:"Pending"===response.data.status?(flashMessage=$filter("translate")("Your request is in pending."),flash.set(flashMessage,"error",!1),$state.reload()):"Captured"===response.data.status?(flashMessage=$filter("translate")("Amount added successfully."),flash.set(flashMessage,"success",!1),$state.go("ExamStart",{id:response.data.id})):0===response.error.code?("Captured"===response.payment_response.status&&($scope.my_user.available_wallet_amount=$scope.my_user.available_wallet_amount-parseInt(response.data.total_listing_fee)),flashMessage=$filter("translate")("Payment successfully completed."),flash.set(flashMessage,"success",!1),$state.go("ExamStart",{id:response.data.id})):512===response.error.code&&(flashMessage=$filter("translate")("Process Failed. Please, try again."),flash.set(flashMessage,"error",!1)):(flashMessage=$filter("translate")("We are unable to process your request. Please try again."+response.error.message),flash.set(flashMessage,"error",!1)),$scope.paynow_is_disabled=!1},function(error){(angular.isDefined(error.data.error.message)||null!==error.data.error.message)&&flash.set($filter("translate")(error.data.error.message),"error",!1),$scope.paynow_is_disabled=!1})},countries.get({limit:"all"},function(response){angular.isDefined(response.data)&&($scope.countries=response.data)}),$scope.index()}),angular.module("getlancerApp.Bidding.Exam").factory("Exams",["$resource",function($resource){return $resource("/api/v1/exams",{},{get:{method:"GET"}})}]).factory("ExamsView",["$resource",function($resource){return $resource("/api/v1/exams/:id",{},{get:{method:"GET"}})}]).factory("ExamsPayment",["$resource",function($resource){return $resource("/api/v1/order",{},{create:{method:"POST"}})}]).factory("ExamStart",["$resource",function($resource){return $resource("/api/v1/exams_users/:id",{},{get:{method:"GET"}})}]).factory("MyExam",["$resource",function($resource){return $resource("/api/v1/me/exams_users",{},{get:{method:"GET"}})}]).factory("QuestionAnswer",["$resource",function($resource){return $resource("/api/v1/exam_answers",{},{post:{method:"POST"}})}]).factory("ExamUser",["$resource",function($resource){return $resource("/api/v1/exams_users",{},{post:{method:"POST"}})}]),angular.module("getlancerApp.Bidding.Exam").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/Exam/views/default/exam_online.html",'

    {{exam_data.exam.title}} - {{exam_data.exam.exam_level.name}}

    {{\'Question #\'|translate}}{{currentPage + 1}}

    {{questionArray[currentPage].question}}
    {{\'Prev\' | translate}} {{\'Next\' | translate}}
    {{questionName.question}}

    {{\'By clicking answer, system will auto save your answers\' | translate}}.

    {{\'Exam Already attend\'|translate}}

    {{\'Access Denied\' | translate}}

    '),$templateCache.put("scripts/plugins/Bidding/Exam/views/default/exam_payment.html",'

    {{\'Exam fee for\' | translate}} {{examValue.title}}


    '),$templateCache.put("scripts/plugins/Bidding/Exam/views/default/exam_result.html",'

    {{\'Oops\'|translate}}!! {{"We’re Sorry"|translate}}!!

    {{\'You have failed this level of skill test\'|translate}}.

    {{\'We appreciate you for participating in the skill test\'|translate}}.

    {{\'Congratulation\'|translate}}!!!!

    {{\'You have passed this level of skill test\'|translate}}.

    {{\'We appreciate you for participating in the skill test\'|translate}}.


    {{exam_data.exam.title}} ({{exam_data.exam.exam_level.name}})

    {{\'Your score card\'|translate}}: {{exam_data.total_mark * 10}}% Marks

    {{\'Access Denied\' | translate}}

    '), $templateCache.put("scripts/plugins/Bidding/Exam/views/default/exam_start.html",'

    {{\'Test Your Skill -\'|translate}} {{exam_start.exam.title}}

    {{exam_start.exam.exam_level.name}}

    {{\'Please read the below instructions before start your skill test\' | translate}}.

    '),$templateCache.put("scripts/plugins/Bidding/Exam/views/default/exam_view.html",'

    {{examValue.title}}

    {{\'Already you attend this exam\' | translate}}

    • {{\'Exams Level\'|translate}} {{examValue.exam_level.name}}

    • {{\'Questions\'|translate}} {{examValue.exams_question_count}}

    • {{\'Duration\'|translate}} {{examValue.duration}}

    • {{\'To pass\'|translate}} {{examValue.pass_mark_percentage}}%

    ${{examValue.fee}} {{\'is required to take this skills test\' | translate}}.
    {{\'This Skill Test Is Free\' | translate}}.

    {{\'You Already Taken and Got Passed this Exam\'| translate}}.

    {{\'This skill start is already started/inprocess status right now\' | translate}}

    {{\'You have already paid this skill test and yet to start\'| translate}}.

    {{\'Start Your Skill Test Now\'|translate}}

    {{\'You already tried this exam\'| translate}} {{(Failed + Incomplete + SuspendedDueToTakingOvertime)}} {{\'times\' | translate}}.

    ${{examValue.fee}} {{\'is required to take this skills test\' | translate}}. {{\'Retry Skill Test Now\' | translate}}
    ${{examValue.fee}} {{\'is required to take this skills test\' | translate}}. {{\'Test Your Skills\' | translate}}

    {{\'You must complete the exam in order of difficulty. So please complete\'| translate}} {{examValue.parent[0].title}} {{\'Level\' | translate}} {{examValue.parent[0].exam_level_id}} {{\'before trying\' | translate }} {{examValue.title}} {{\'Level\' | translate}} {{examValue.exam_level_id}} {{\'test\' | translate}}

    {{\'Test Your Skills\' | translate}}
    ${{examValue.fee}}
    {{\'is required to take this skills test\' | translate}}. {{\'Test Your Skills\'|translate}}
    {{\'Back To Skills Lab\'|translate}} {{\'Featured\'|translate}}

    {{\'Topics Covered\' | translate}}


    {{\'Instructions\' | translate}}


    '),$templateCache.put("scripts/plugins/Bidding/Exam/views/default/exams.html",'

    {{\'Search Skill Tests\' | translate}}

    • {{examsValue.title}} ({{examsValue.exam_level.name}})

      {{examsValue.exams_question_count}} {{\'Questions\'|translate}}{{examsValue.duration}} mins

    {{\'No records Found\' | translate}}
    '),$templateCache.put("scripts/plugins/Bidding/Exam/views/default/my_exams.html",'
    {{myExam.exam.title}} {{myExam.exam_status.created_at}} {{myExam.total_mark}} {{myExam.exam_status.name}}

    {{\'No exams are found\' | translate}}

    ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding.Exam');"use strict";angular.module("getlancerApp.Bidding.Dispute",["getlancerApp.Bidding.Constant","ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","slugifier","checklist-model","angularjs-dropdown-multiselect","rzModule"]).config(function($stateProvider,$urlRouterProvider){}),angular.module("getlancerApp.Bidding.Dispute").directive("biddingDispute",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Dispute/views/default/bidding_project_dispute.html",scope:{bidid:"@",project:"@",biduser:"@",projectuser:"@",isdispute:"@",projectstatus:"@"},controller:function($scope,$rootScope,$cookies,$state,$filter,flash,DisputeStatus,ProjectDispute,md5){if($scope.auth=JSON.parse($cookies.get("auth")),"true"!==$scope.isdispute)$scope.data={},$scope.closefrm=function(){$scope.project_dispute=$rootScope.project_dispute=!1,$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"messages"},{reload:!0})},DisputeStatus.get({id:$scope.bidid},function(response){0===parseInt(response.error.code)&&($scope.disputeTypes=response.data)},function(error){console.log("DisputeStatus",error)}),$scope.dispute_submit=!1,$scope.disputeSubmit=function($valid,data){$valid&&($scope.dispute_submit=!0,data.bid_id=$scope.bidid,swal({title:$filter("translate")("Are you sure you raise the dispute for this project?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){isConfirm&&ProjectDispute.post(data,function(response){$scope.dispute_submit=!1;var flashMessage="";0===parseInt(response.error.code)?(flashMessage=$filter("translate")("Your dispute request sent successfully."),flash.set(flashMessage,"success",!1),$state.reload()):(flashMessage=$filter("translate")("Your dispute request sending failed."),flash.set(flashMessage,"error",!1),$scope.dispute_submit=!1)},function(error){console.log(error)}),$scope.dispute_submit=!1}))};else{var params={project_id:$scope.project,bid_id:$scope.bidid,user_id:$scope.biduser,fields:"id,reason,user_id,dispute_status_id,created_at"};ProjectDispute.get(params,function(response){0===parseInt(response.error.code)&&($scope.dispute=response.data[0],angular.isDefined($scope.dispute.user.attachment)&&null!==$scope.dispute.user.attachment?$scope.user_avatar_url="images/normal_thumb/UserAvatar/"+$scope.dispute.user.id+"."+md5.createHash("UserAvatar"+$scope.dispute.user.id+"pngnormal_thumb")+".png":$scope.user_avatar_url="images/default.png")},function(error){console.log("ProjectDispute Get",error)})}}}}),angular.module("getlancerApp.Bidding.Dispute").directive("biddingDisputeMessage",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Dispute/views/default/bidding_project_dispute_message.html",scope:{bidid:"@",project:"@",biduser:"@",projectuser:"@",projectstatus:"@",disputeid:"@",disputestatus:"@"},controller:function($scope,$rootScope,$timeout,$state,$cookies,$filter,flash,md5,ProjectStatusConstant,Messages,Upload,DisputeMsgClass,DisputeStatusConstant){$scope.DisputeStatusConstant=DisputeStatusConstant,$timeout(function(){$scope.GetMessages=function(){Messages.get({foreign_id:$scope.disputeid,"class":DisputeMsgClass["class"]},function(response){0===parseInt(response.error.code)?($scope.messages=response.data,angular.forEach($scope.messages,function(value){angular.isDefined(value.user.attachment)&&null!==value.user.attachment?value.user.user_avatar_url="images/big_thumb/UserAvatar/"+value.user.id+"."+md5.createHash("UserAvatar"+value.user.id+"pngbig_thumb")+".png":value.user.user_avatar_url="images/default.png"})):$scope.messages=[]})},$scope.GetMessages()},2e3),$scope.data={},$scope.post_messages=!1,$scope.PostMessages=function(messageFrm,$valid){if($valid){$scope.post_messages=!0;var projectName=$state.params.slug,msgparams={foreign_id:$scope.disputeid,"class":DisputeMsgClass["class"]};msgparams.parent_id=0,msgparams.subject=$filter("capitalize")(projectName.replace(/-/g,"+")),msgparams.message=$scope.data.message,msgparams.image=$scope.file,console.log(msgparams),Messages.post(msgparams,function(response){var flashMessage="";console.log(response),0===parseInt(response.error.code)?($scope.post_messages=!1,flashMessage=$filter("translate")("Message sent successfully."),flash.set(flashMessage,"success",!1),$scope.data.message="",$scope.GetMessages(),messageFrm.$setPristine(),messageFrm.$setUntouched()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1),$scope.post_messages=!1)})}}}}}),angular.module("getlancerApp.Bidding").directive("biddingReviews",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/Dispute/views/default/bidding_project_review.html",scope:{bidid:"@",project:"@",biduser:"@",projectuser:"@",isdispute:"@",projectstatus:"@"},controller:function($scope,$rootScope,$cookies,$state,$filter,flash,biddingReviewFactory,ProjectEditView){function usersDetail(){var getParams={id:$state.params.id,fields:"id,project_status_id,is_dispute,is_cancel_request_freelancer,is_cancel_request_employer"};ProjectEditView.get(getParams,function(response){$scope.reviewsLists=response.data.reviews,angular.forEach($scope.reviewsLists,function(reviewList){reviewList.user_id==$rootScope.user.id&&($scope.review.rating=reviewList.rating,$scope.review.message=reviewList.message,$scope.reviewid=reviewList.id)})})}$scope.auth=JSON.parse($cookies.get("auth"));var flashMessage;$scope.review={},$scope.rating_review=!0,$scope.reviewSubmit=function(is_valid){if(is_valid&&0==$scope.review.rating?(is_valid=!1,$scope.rating_review=!1):is_valid&&$scope.review.rating>0&&(is_valid=!0,$scope.rating_review=!0),is_valid)if($scope.reviewid){var params={};params.id=$scope.reviewid,params.rating=$scope.review.rating,params.message=$scope.review.message,biddingReviewFactory.put(params,function(response){0===response.error.code?(flashMessage=$filter("translate")("review updated successfully."),flash.set(flashMessage,"success",!1),$scope.closefrm()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}else{var params={};params.foreign_id=$scope.bidid,params["class"]="Bid",params.rating=$scope.review.rating,params.message=$scope.review.message,biddingReviewFactory.post(params,function(response){0===response.error.code?(flashMessage=$filter("translate")("review added successfully."),flash.set(flashMessage,"success",!1),$scope.closefrm()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}},$scope.closefrm=function(){$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"messages"},{reload:!0})},usersDetail()}}}),angular.module("getlancerApp.Bidding.Dispute").factory("DisputeStatus",["$resource",function($resource){return $resource("/api/v1/bids/:id/dispute_open_types",{},{get:{method:"GET"}})}]).factory("ProjectDispute",function($resource){return $resource("/api/v1/project_disputes",{},{get:{method:"GET"},post:{method:"POST"}})}),angular.module("getlancerApp.Bidding.Dispute").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/Dispute/views/default/bidding_project_dispute.html",'

    {{\'Dispute\'|translate}}

    {{\'Required\'| translate}}
    {{\'Required\'| translate }}
    {{\'Required\'| translate }}
    {{\'Cancel\'|translate}}
    [Image: {{dispute.user.username}}]

    {{dispute.user.username}} , {{ dispute.created_at | timeago}}

    {{dispute.reason}}

    '),$templateCache.put("scripts/plugins/Bidding/Dispute/views/default/bidding_project_dispute_message.html",'
    [Image: {{message.user.username}}]

    {{message.user.username}} , {{ message.created_at | timeago}}

    [Image: USer]
    {{\'Required\'| translate}}
    '),$templateCache.put("scripts/plugins/Bidding/Dispute/views/default/bidding_project_review.html",'
    {{\' Required \'| translate }} {{\'Required\'| translate }}
    {{\'Required\'| translate }}
    ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding.Dispute');"use strict";angular.module("getlancerApp.Bidding.BiddingReview",["getlancerApp.Bidding.Constant","ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","slugifier","checklist-model","angularjs-dropdown-multiselect","rzModule"]).config(function($stateProvider,$urlRouterProvider){}),angular.module("getlancerApp.Bidding").directive("biddingReview",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/BiddingReview/views/default/bidding_project_review.html",scope:{bidid:"@",project:"@",biduser:"@",projectuser:"@",isdispute:"@",projectstatus:"@"},controller:function($scope,$rootScope,$cookies,$state,$filter,flash,biddingReviewFactory,ProjectEditView){function usersDetail(){var getParams={id:$state.params.id,fields:"id,project_status_id,is_dispute,is_cancel_request_freelancer,is_cancel_request_employer"};ProjectEditView.get(getParams,function(response){$scope.reviewsLists=response.data.reviews,angular.forEach($scope.reviewsLists,function(reviewList){reviewList.user_id==$rootScope.user.id&&($scope.review.rating=reviewList.rating,$scope.review.message=reviewList.message,$scope.reviewid=reviewList.id)})})}$scope.auth=JSON.parse($cookies.get("auth"));var flashMessage;$scope.review={},$scope.rating_review=!0,$scope.reviewSubmit=function(is_valid){if(is_valid&&0==$scope.review.rating?(is_valid=!1,$scope.rating_review=!1):is_valid&&$scope.review.rating>0&&(is_valid=!0,$scope.rating_review=!0),is_valid)if($scope.reviewid){var params={};params.id=$scope.reviewid,params.rating=$scope.review.rating,params.message=$scope.review.message,biddingReviewFactory.put(params,function(response){0===response.error.code?(flashMessage=$filter("translate")("review updated successfully."),flash.set(flashMessage,"success",!1),$scope.closefrm()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}else{var params={};params.foreign_id=$scope.bidid,params["class"]="Bid",params.rating=$scope.review.rating,params.message=$scope.review.message,biddingReviewFactory.post(params,function(response){0===response.error.code?(flashMessage=$filter("translate")("review added successfully."),flash.set(flashMessage,"success",!1),$scope.closefrm()):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1))})}},$scope.closefrm=function(){$state.go("Bid_ProjectView",{id:$state.params.id,slug:$state.params.slug,action:"messages"},{reload:!0})},usersDetail()}}}),angular.module("getlancerApp.Bidding.BiddingReview").directive("biddingReviewPost",function(){return{restrict:"E",templateUrl:"scripts/plugins/Bidding/BiddingReview/views/default/bidding_reivew_post.html",scope:{project:"@",projectuser:"@",projectstatus:"@",bidid:"@",biduser:"@",isprojectcancel:"@",isdispute:"@"},controller:function($scope,$rootScope,$state,$filter,$cookies,flash,ProjectStatusConstant){}}}).directive("biddingReviewView",function(){return{restrict:"E",templateUrl:"scripts/plugins/Bidding/BiddingReview/views/default/bidding_reivew_view.html",scope:{project:"@",projectuser:"@",projectstatus:"@",bidid:"@",biduser:"@",isprojectcancel:"@",isdispute:"@"},controller:function($scope,$rootScope,$state,$filter,$cookies,flash,ProjectStatusConstant,BiddingReviews){$scope.postReview=function($valid,data){if($valid){BiddingReviews.post(postReview,function(response){var flashmsg="";0===parseInt(response.error.code)?(flashmsg=$filter("translate")("Review posted successfully"),flash.set(flashmsg,"success",!1),$state.reload()):(flashmsg=$filter("translate")("Review posted failed"),flash.set(flashmsg,"error",!1))})}}}}}),angular.module("getlancerApp.Bidding.BiddingReview").factory("BiddingReviews",["$resource",function($resource){return $resource("/api/v1/reviews",{},{get:{method:"GET"},create:{method:"POST"}})}]).factory("BiddingReview",["$resource",function($resource){return $resource("/api/v1/reviews/:id",{},{get:{method:"GET",params:{id:"@id"}},update:{method:"PUT",params:{id:"@id"}},remove:{method:"DELETE",params:{id:"@id"}}})}]),angular.module("getlancerApp.Bidding.BiddingReview").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/BiddingReview/views/default/bidding_project_review.html",'
    {{\' Required \'| translate }} {{\'Required\'| translate }}
    {{\'Required\'| translate }}
    ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding.BiddingReview');"use strict";angular.module("getlancerApp.Bidding.ProjectFlag",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","vcRecaptcha","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngMap","chieffancypants.loadingBar","payment","ngFileUpload","angularMoment","720kb.socialshare"]),angular.module("getlancerApp.Bidding.ProjectFlag").directive("biddingFlag",function(){return{restrict:"EA",template:' ',scope:{classname:"@",foreignid:"@",appendhtml:"@"},controller:function($scope,$rootScope,$state,$filter,flash,$uibModal,$uibModalStack,ReportProjectCategories,ReportProject,$sce){"Project"===$scope.classname?$scope.modeltitle="Report Project":$scope.modeltitle="Report User",void 0!==$scope.appendhtml?$scope.templateBtn=$scope.appendhtml:$scope.templateBtn="Project"===$scope.classname?"Report Project":"Report User",$rootScope.closemodel=function(){$uibModalStack.dismissAll()},$scope.reportModal=function(){$rootScope.project_id=$scope.foreignid,$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Bidding/Bidding/views/default/bidding_report.html",animation:!1,controller:function($scope,$rootScope,$stateParams,$filter,$state,$uibModal,ReportProjectCategories,ReportProject,flash,flagdatas){$scope.flag=$scope.flags=[],$scope.ReportProjectCategories=function(){var params={};params["class"]="Project",ReportProjectCategories.get(params,function(response){$scope.flag=response.data})},$scope.ReportProjectCategories(),$scope.job_report=!1,$scope.submit=function($valid){if($valid){$scope.job_report=!0;var post_params={foreign_id:flagdatas.foreignid,"class":flagdatas.classname,flag_category_id:$scope.flags.flag_category_id,message:$scope.flags.message},flashMessage="";ReportProject.post(post_params,function(response){$scope.response=response,0===$scope.response.error.code?($scope.flags={},$rootScope.closemodel(),flashMessage=$filter("translate")("Report posted successfully."),flash.set(flashMessage,"success",!1)):(flashMessage=$filter("translate")($scope.response.error.message),flash.set(flashMessage,"error",!1),$scope.job_report=!1)})}}},size:"lg",resolve:{flagdatas:function(){var returnVal={foreignid:$scope.foreignid,classname:$scope.classname};return returnVal}}})}}}}),angular.module("getlancerApp.Bidding.ProjectFlag").factory("ReportProject",["$resource",function($resource){return $resource("/api/v1/flags",{},{get:{method:"GET"},post:{method:"POST"}})}]),angular.module("getlancerApp.Bidding.ProjectFlag").factory("ReportProjectCategories",["$resource",function($resource){return $resource("/api/v1/flag_categories",{},{get:{method:"GET"}})}]),angular.module("getlancerApp.Bidding.ProjectFlag").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/ProjectFlag/views/default/bidding_report.html",'')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding.ProjectFlag');"use strict";angular.module("getlancerApp.Bidding.ProjectFollow",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","vcRecaptcha","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngMap","chieffancypants.loadingBar","payment","ngFileUpload","angularMoment","720kb.socialshare"]),angular.module("getlancerApp.Bidding.ProjectFollow").controller("ProjectFollowController",["$scope","$rootScope","$stateParams","flash","$filter","$state","BookMarkProject","md5","$timeout",function($scope,$rootScope,$stateParams,flash,$filter,$state,BookMarkProject,md5,$timeout){$scope.$on("showisbook",function(event,data){$scope.is_book=data.isbook,$scope.foreignid=data.projectid}),$scope.projectBookmark=function(){var flashMessage="";$timeout(function(){BookMarkProject.post({foreign_id:$scope.foreignid,"class":$scope.classname},function(response){0===response.error.code?($rootScope.book_id=response.id,$scope.is_book=!0,flashMessage=$filter("translate")("Project bookmarked successfully"),flash.set(flashMessage,"success",!1)):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1)),$state.go("Bid_ProjectView",{},{reload:!0})})},1e3)},$scope.projectUnBookmark=function(book_id){var flashMessage="";$timeout(function(){if(null!==$rootScope.user&&void 0!==$rootScope.user){var params={};params.id=$rootScope.book_id,BookMarkProject["delete"]({id:$rootScope.book_id},function(response){0===response.error.code?($rootScope.book_id=0,$scope.is_book=!1,flashMessage=$filter("translate")("Project unbookmarked successfully."),flash.set(flashMessage,"success",!1)):(flashMessage=$filter("translate")(response.error.message),flash.set(flashMessage,"error",!1)),$state.go("Bid_ProjectView",{},{reload:!0})})}},1e3)}}]),angular.module("getlancerApp.Bidding.ProjectFollow").directive("bookmarkFollow",function(){return{restrict:"EA",templateUrl:"scripts/plugins/Bidding/ProjectFollow/views/default/project_follow.html",scope:{classname:"@"},controller:"ProjectFollowController"}}),angular.module("getlancerApp.Bidding.ProjectFollow").factory("BookMarkProject",["$resource",function($resource){return $resource("/api/v1/followers/:id",{},{post:{method:"POST"},"delete":{method:"DELETE"}})}]),angular.module("getlancerApp.Bidding.ProjectFollow").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Bidding/ProjectFollow/views/default/project_follow.html",'
    ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Bidding.ProjectFollow');angular.module("getlancerApp.Common.UserFlag",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","ngMessages","slugifier"]),angular.module("getlancerApp.Common.UserFlag").directive("profileViewFlag",function($uibModal,$rootScope){return{restrict:"EA",replace:!0,templateUrl:"scripts/plugins/Common/UserFlag/views/default/users_profile_flag.html",link:function(scope,element,attr){scope.flag={},scope.FlagModel=function(user_id){$rootScope.quote_user_id=user_id,scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Common/UserFlag/views/default/users_flag_model.html",backdrop:"true",controller:"UserFlagController"})}}}}),angular.module("getlancerApp.Common.UserFlag").controller("UserFlagController",["$rootScope","$scope","$stateParams","$state","flash","$uibModal","$uibModalStack","FlagCategoriesFactory","FlagsFactory","$filter",function($rootScope,$scope,$stateParams,$state,flash,$uibModal,$uibModalStack,FlagCategoriesFactory,FlagsFactory,$filter){$scope.user_id=$stateParams.id;$scope.init=function(){$scope.getFlagCategories()},$scope.getFlagCategories=function(){var params={};params.foreign_id=$scope.user_id,params["class"]="User",FlagCategoriesFactory.get(params,function(response){$scope.flagcategories=response.data})},$scope.flag_hide=!1,$scope.submit=function(){var params={};$scope.flagform.$valid&&($scope.flag_hide=!0,params.foreign_id=$state.params.id,params.flag_category_id=$scope.flag.flag_category_id,params.message=$scope.flag.message,params["class"]="User",FlagsFactory.create(params,function(response){0===response.error.code&&($scope.is_flag=!0,$scope.flag_hide=!1,flash.set($filter("translate")("Flagged successfully."),"success",!1),$state.reload(),$uibModalStack.dismissAll())}))},$scope.closeInstance=function(){$uibModalStack.dismissAll()},$scope.init()}]),angular.module("getlancerApp.Common.UserFlag").factory("FlagsFactory",["$resource",function($resource){return $resource("/api/v1/flags",{},{create:{method:"POST"}})}]).factory("FlagCategoriesFactory",["$resource",function($resource){return $resource("/api/v1/flag_categories",{},{get:{method:"GET"}})}]),angular.module("getlancerApp.Common.UserFlag").run(["$templateCache",function($templateCache){"use strict";$templateCache.put("scripts/plugins/Common/UserFlag/views/default/users_flag_model.html",''),$templateCache.put("scripts/plugins/Common/UserFlag/views/default/users_profile_flag.html",'
  • {{\'Report this User\'|translate}}? {{\'Report this User\'|translate}}?

  • ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Common.UserFlag');"use strict";angular.module("getlancerApp.Common.UserFollow",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","ui.select","http-auth-interceptor","vcRecaptcha","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngMap","chieffancypants.loadingBar","payment","builder","builder.components","validator.rules","angularMoment","ngFileUpload","720kb.socialshare","slugifier"]),angular.module("getlancerApp.Common.UserFollow").directive("profileViewFollower",function(){return{restrict:"EA",replace:!0,templateUrl:"scripts/plugins/Common/UserFollow/views/default/user_follow.html",controller:function($rootScope,$scope,$state,$filter,UnfollowFactory,FollowersFactory,$stateParams,flash){$scope.user_id=$stateParams.id;var flash;$scope.userFollow=function(){var follow={};follow.foreign_id=$scope.user_id,follow["class"]="User",FollowersFactory.create(follow,function(response){0===response.error.code?(flash.set($filter("translate")("Follow successfully."),"success",!1),$scope.follow_id=response.id,$scope.isfollow=!0):flash.set($filter("translate")("Follow failure."),"error",!1)})},$scope.UserUnFollow=function(follow_id){var follow={};follow.followerId=follow_id,UnfollowFactory.remove(follow,function(response){0===response.error.code?(flash.set($filter("translate")("UnFollow successfully."),"success",!1),$scope.follow_id=0,$scope.isfollow=!1):flash.set($filter("translate")("UnFollow failure."),"error",!1)})}}}}),angular.module("getlancerApp.Common.UserFollow").factory("FollowersFactory",["$resource",function($resource){return $resource("/api/v1/followers",{},{get:{method:"GET"},create:{method:"POST"}})}]).factory("UnfollowFactory",["$resource",function($resource){return $resource("/api/v1/followers/:followerId",{},{remove:{method:"DELETE",params:{followerId:"@followerId"}}})}]),angular.module("getlancerApp.Common.UserFollow").run(["$templateCache",function($templateCache){$templateCache.put("scripts/plugins/Common/UserFollow/views/default/user_follow.html",'')}]);angular.module('getlancerApp').requires.push('getlancerApp.Common.UserFollow');angular.module("getlancerApp.Portfolio",["ngResource","ngSanitize","satellizer","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","720kb.socialshare","ngMessages","slugifier"]).constant("PortfolioConstant",{ClassName:"Portfolio",ImagePath:"images/",Myportfolios:"my_portfolios",Myfollowing:"my_followings",StatePortfolios:"portfolios",StatePortfoliosType:"myportfolios",StatePortfolioView:"portfolio_view",StatePortfolioTags:"search_portfoliotags",StatePortfolioProfile:"Portfolio_Userprofile"}).config(function($stateProvider,$urlRouterProvider,PortfolioConstant){var getToken={TokenServiceData:function(TokenService,$q){return $q.all({AuthServiceData:TokenService.promise,SettingServiceData:TokenService.promiseSettings})}};$urlRouterProvider.otherwise("/"),$stateProvider.state(PortfolioConstant.StatePortfolios,{url:"/portfolios?skills&search",templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolioshome.html",controller:"PortfoliosController",resolve:getToken}).state(PortfolioConstant.StatePortfoliosType,{url:"/portfolios/:type",templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolioshome.html",controller:"PortfoliosController",resolve:getToken}).state(PortfolioConstant.StatePortfolioProfile,{url:"/portfolios/profile/:id",templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/profile.html",controller:"PortfoliosController",resolve:getToken}).state(PortfolioConstant.StatePortfolioView,{url:"/portfolios/:id/:slug",templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/photo.html",controller:"PortfoliosViewController",resolve:getToken}).state(PortfolioConstant.StatePortfolioTags,{url:"/portfolios/skill/:id/:slug",templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolioshome.html",controller:"PortfoliosController",resolve:getToken})}).filter("dateformat",function($filter){return function(input,format){return $filter("date")(new Date(input),format)}}).filter("unsafe",function($sce){return function(val){return $sce.trustAsHtml(val)}}).filter("words",function(){function isInteger(x){return x%1===0}return function(value){return value&&isInteger(value)?toWords(value):value}}).directive("portfolioHomeBlock",function(){return{restrict:"E",replace:!0,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio_home_block.html",controller:function($scope,$rootScope,$window,$filter,$state,$stateParams,$timeout,PortfoliosFactory,HelperFactory,$uibModal,md5,flash,Slug){function alertMessage(message,type){flash.set($filter("translate")(message),type,!1)}function createSlug(input){return Slug.slugify(input)}function getPortfolioData(){angular.isDefined($stateParams.id)?(params.user_id=$stateParams.id,PortfoliosFactory.getbyId(params,function(response){if(angular.isDefined(response.data)){$scope.showview=!1;var temp_photos=[],i=0;angular.forEach(response.data,function(photo){i++,photo.photos_url=HelperFactory.Portfoliodefaultimage(),angular.isDefined(photo.attachment)&&null!==photo.attachment&&(photo.photos_url=HelperFactory.generateimage("Portfolio",photo.id,"medium_thumb")),angular.isDefined(photo.follower)&&photo.follower.length>0?(photo.is_favorite=!0,angular.forEach(photo.follower,function(follower){photo.like_id=follower.id})):photo.is_favorite=!1,angular.isDefined(photo.flag)&&photo.flag.length>0?photo.is_flag=!0:photo.is_flag=!1,temp_photos.push(photo),(4===temp_photos.length||i===response.data.length)&&($scope.photos.push(temp_photos),temp_photos=[])})}},function(){$scope.scroll_flag=!0})):PortfoliosFactory.getall(params,function(response){if($scope.showview=!0,angular.isDefined(response.data)){var temp_photos=[],i=0;angular.forEach(response.data,function(photo){i++,photo.photos_url=HelperFactory.Portfoliodefaultimage(),angular.isDefined(photo.attachment)&&null!==photo.attachment&&(photo.photos_url=HelperFactory.generateimage("Portfolio",photo.id,"medium_thumb")),angular.isDefined(photo.follower)&&photo.follower.length>0?(photo.is_favorite=!0,angular.forEach(photo.follower,function(follower){photo.like_id=follower.id})):photo.is_favorite=!1,angular.isDefined(photo.flag)&&photo.flag.length>0?photo.is_flag=!0:photo.is_flag=!1,temp_photos.push(photo),(4===temp_photos.length||i===response.data.length)&&($scope.photos.push(temp_photos),temp_photos=[])})}},function(){$scope.scroll_flag=!0})}var params={};params.limit=8,$scope.photos=[],getPortfolioData(),$scope.openPhotoModal=function(id,title,index,size,key){var redirectto={statename:$state.current.name,params:$state.params.slug?$state.params.slug:$state.params.type};$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/modal_photo_view.html",animation:!1,controller:function($scope,$rootScope,photoid,photoindex,photoKey,photos,follow,redirect,$stateParams,$filter,md5,$location,$uibModalStack,$uibModal,$state,photoStatsFactory,userSettings,$timeout,HelperFactory){function portfolioModelLoad(){params.id=$scope.photo_id=photoid,$scope.index=photoindex,$scope.photoKey=photoKey,$scope.photos=photos,$scope.follow=follow,$scope.redirect=redirect,$scope.loadPhoto(),$scope.indexOfRowContainingId(),$state.go("portfolio_view",{slug:createSlug(title),id:params.id},{notify:!1})}$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1},$scope.viewphotos=[],$scope.flag={},$scope.taglabel=[],$scope.loadPhoto=function(){$scope.photos[$scope.photoKey][$scope.index].id===parseInt(params.id)?($scope.viewphotos=$scope.photos[$scope.photoKey][$scope.index],$scope.viewphotos.username=$scope.photos[$scope.photoKey][$scope.index].user.username,$scope.photoView($scope.viewphotos.id),$scope.viewphotos.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined($scope.viewphotos.user.attachment)&&null!==$scope.viewphotos.user.attachment&&($scope.viewphotos.user_avatar_url=HelperFactory.generateimage("UserAvatar",$scope.viewphotos.user.id,"small_thumb")),delete $scope.viewphotos.photo_url,$scope.viewphotos.photo_url=HelperFactory.generateimage("Portfolio",$scope.viewphotos.id,"large_thumb")):PortfoliosFactory.get(params,function(response){$scope.photos[$scope.photoKey][$scope.index]=response.data,$scope.viewphotos=response.data,$scope.photoView($scope.viewphotos.id)})},$scope.photoView=function(photo_id){params.id=photo_id,params.type="view",PortfoliosFactory.getbyId(params,function(response){$scope.Count()})},$scope.scrollPhoto=function(id,index){$uibModalStack.dismissAll(),$location.path("/discover/"+id+"/"+index)},$scope.indexOfRowContainingId=function(){$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1};for(var i=0,len=$scope.photos.length;len>i;i++)for(var j=0,len2=$scope.photos[i].length;len2>j;j++)if($scope.photos[i][j].id===$scope.photo_id)$scope.data.current_key=i,$scope.data.current_index=j,$scope.data.current_id=$scope.photos[i][j].id;else{if(-1!==$scope.data.current_key)return $scope.data.next_key=i,$scope.data.next_index=j,void($scope.data.next_id=$scope.photos[i][j].id);$scope.data.prev_key=i,$scope.data.prev_index=j,$scope.data.prev_id=$scope.photos[i][j].id}},$scope.slide_change=function(option){if("next"===option&&($scope.photo_id=$scope.data.next_id),"prev"===option&&($scope.photo_id=$scope.data.prev_id),$scope.indexOfRowContainingId(),-1!==$scope.data.current_id&&($scope.index=parseInt($scope.data.current_index),$scope.photoKey=parseInt($scope.data.current_key),$scope.photo_id=parseInt($scope.data.current_id),angular.isDefined($scope.photos[$scope.photoKey][$scope.index]))){params.id=$scope.photos[$scope.photoKey][$scope.index].id,params.slug=$scope.photos[$scope.photoKey][$scope.index].title,$state.go("portfolio_view",{slug:createSlug(params.slug),id:params.id},{notify:!1,location:"replace"});var myEl=angular.element(document.querySelector("img"));myEl.attr("src","//:0"),$timeout(function(){$scope.loadPhoto()},100)}},$rootScope.closemodel=function(){$uibModalStack.dismissAll(),$state.go("home",{},{notify:!1})},$scope.Login_func=function(){$uibModalStack.dismissAll(),$location.path("/users/login")},$scope.Count=function(){var params={};params.id=$scope.photos[$scope.photoKey][$scope.index].id,PortfoliosFactory.getbyId(params,function(response){var comment=response.data;$scope.viewphotos.follower_count=comment.follower_count,$scope.viewphotos.message_count=comment.message_count,$scope.viewphotos.view_count=comment.view_count})},portfolioModelLoad()},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{photoid:function(){return id},photoindex:function(){return index},photoKey:function(){return key},follow:function(){return $scope.follow},photos:function(){return $scope.photos},redirect:function(){return redirectto}}})},$scope.editPortfolio=function(title,size,portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user&&($scope.editPortfolioModel=$uibModal.open({animation:!1,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",controller:function($scope,$rootScope,$location,$window,PortfoliosFactory,flash,$filter,HelperFactory,Upload,portfolioId,userId,PortfolioSkillsFactory){function getPortfolioById(params){PortfoliosFactory.getbyId(params,function(response){0===response.error.code&&($scope.portfolio=response.data,$scope.tags=[],angular.forEach($scope.portfolio.portfolios_skill,function(tag){$scope.tags.push({text:tag.skill.name})}))})}$scope.loadTags=function(query){return PortfolioSkillsFactory.getall({q:query,fields:"name",limit:"all"}).$promise.then(function(response){return angular.isDefined(response.data)&&response.data.length>0&&($scope.newEntry=[],angular.forEach(response.data,function(tag){$scope.newEntry.push({text:tag.name})})),$scope.newEntry})},$scope.portfoliopage=1,$scope.newImage=null,params.id=portfolioId,getPortfolioById(params),$scope.uploadPortfolioImage=function(file){Upload.upload({url:"/api/v1/attachments?class=Portfolio",data:{file:file}}).then(function(response){0===response.data.error.code&&($scope.newImage=response.data.attachment)})},$scope.portfolio_submit=function(is_valid){if(is_valid===!0){var pdata={};null!==$scope.newImage&&(pdata.image=$scope.newImage),pdata.id=portfolioId,pdata.title=$scope.portfolio.title,pdata.description=$scope.portfolio.description;var value=[];angular.forEach($scope.tags,function(tag){value.push(tag.text),pdata.skills=value.join()}),PortfoliosFactory.update(pdata,function(response){0===response.error.code?(alertMessage("Portfolio updated successfully.","success"),$state.go("user_profile",{},{reload:!0})):alertMessage("Please try again","error")})}}},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{portfolioId:function(){return portfolio_id},userId:function(){return $rootScope.user.id}}}))},$scope.deletePortfolio=function(portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user?swal({title:$filter("translate")("Are you sure you want to delete?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var params={};params.id=portfolio_id,PortfoliosFactory["delete"](params,function(response){0===response.error.code&&(alertMessage("Portfolio deleted successfully.","success"),$state.go("user_profile",{},{reload:!0}))})}}):$state.go("user_profile")}}}});var th=["","thousand","million","billion","trillion"],dg=["zero","one","two","three","four","five","six","seven","eight","nine"],tn=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],tw=["twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];window.toWords=toWords,angular.module("getlancerApp.Portfolio").controller("PortfoliosDashboardController",["$scope","$rootScope","$location","$window","$filter","$state","md5","PortfoliosFactory","flash","$uibModal","$uibModalStack","HelperFactory","Upload","$stateParams","PortfolioConstant","PortfolioSkillsFactory","Slug","PortfolioAutocompleteUsers","ConstUserRole","mePortfoliosFactory",function($scope,$rootScope,$location,$window,$filter,$state,md5,PortfoliosFactory,flash,$uibModal,$uibModalStack,HelperFactory,Upload,$stateParams,PortfolioConstant,PortfolioSkillsFactory,Slug,PortfolioAutocompleteUsers,ConstUserRole,mePortfoliosFactory){function setRootHeader(pagename){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("My Portfolios")}function createSlug(input){return Slug.slugify(input)}function alertMessage(message,type){flash.set($filter("translate")(message),type,!1)}function chkLoginParams(name){var result=!1;return void 0!==$stateParams.type&&null!==$stateParams.type&&$stateParams.type===name&&null!==$rootScope.user&&void 0!==$rootScope.user&&(result=!0),result}function statusBarShow(){$scope.norecodeShow=!1,$("#search-loading-div").attr("style","display:block"),$("#loading").attr("style","display:block"),$("#search-result-div").attr("style","display:none")}function statusBarHide(){$scope.norecodeShow=!0,$("#search-loading-div").attr("style","display:none"),$("#loading").attr("style","display:none"),$("#search-result-div").attr("style","display:block")}function getPortfolioData(){statusBarShow(),params.sort="id",params.sortby="desc",params.limit=12,params.search=$state.params.search,params.page=$scope.currentpage,$scope.NoRecordMessage=!0,null!==$stateParams.slug&&void 0!==$stateParams.slug?params.skill=$stateParams.slug:chkLoginParams(PortfolioConstant.Myportfolios)===!0?($scope.NoRecordMessage=!1,params.user_id=$rootScope.user.id):chkLoginParams(PortfolioConstant.Myfollowing)===!0?($scope.NoRecordMessage=!1,params.filter=PortfolioConstant.Myfollowing):chkLoginParams(PortfolioConstant.StatePortfolioProfile)!==!0&&(params.user_id=$stateParams.id),mePortfoliosFactory.get(params,function(response){if($scope.scroll_flag=!0,angular.isDefined(response._metadata)&&($scope.lastpage=response._metadata.last_page,$scope.currentpage=response._metadata.current_page),angular.isDefined(response.data)){var temp_photos=[],i=0;angular.forEach(response.data,function(photo){i++,photo.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined(photo.user.attachment)&&null!==photo.user.attachment&&(photo.user_avatar_url=HelperFactory.generateimage("UserAvatar",photo.user.id,"small_thumb")),photo.photos_url=HelperFactory.generateimage("Portfolio",photo.id,"medium_thumb"),angular.isDefined(photo.follower)&&photo.follower.length>0?(photo.is_favorite=!0,angular.forEach(photo.follower,function(follower){photo.like_id=follower.id})):photo.is_favorite=!1,angular.isDefined(photo.user.user_follow)&&null!==photo.user.user_follow?angular.forEach(photo.user.user_follow,function(follow){$scope.follow[photo.user.id]={follow_id:follow.id,isfollow:!0}}):$scope.follow[photo.user.id]={follow_id:0,isfollow:!1},angular.isDefined(photo.flag)&&photo.flag.length>0?photo.is_flag=!0:photo.is_flag=!1,temp_photos.push(photo),(4===temp_photos.length||i===response.data.length)&&($scope.photos.push(temp_photos),temp_photos=[])})}$scope.loader=!1,statusBarHide()},function(error){$scope.scroll_flag=!0})}$uibModalStack.dismissAll(),$rootScope.cimage=function(foreign_id,thumb,classname){return HelperFactory.generateimage(classname,foreign_id,thumb)},$rootScope.closemodel=function(gotopage){$uibModalStack.dismissAll(),$state.go("user_dashboard",{type:"portfolios",status:"my_portfolios"},{notify:!1})},setRootHeader("Portfolios");var params={};$scope.enabled=!0,$scope.scroll_flag=!0,$scope.photos=[],$scope.follow=[],$scope.currentpage=1,$scope.lastpage=2,$scope.loader=!0,getPortfolioData(),$scope.loadMore=function(){$scope.currentpage+=1,getPortfolioData()},$scope.go=function(photo_user_id,photo_user_username){$location.path("profile/"+photo_user_id+"/"+photo_user_username)},$scope.openPhotoModal=function(id,title,index,size,key){setRootHeader(title);var redirectto={statename:$state.current.name,params:$state.params.slug?$state.params.slug:$state.params.type};$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/modal_photo_view.html",animation:!1,controller:function($scope,$rootScope,photoid,photoindex,photoKey,photos,follow,redirect,$stateParams,$filter,md5,$location,$uibModalStack,$uibModal,$state,photoStatsFactory,PortfoliosFactory,userSettings,$timeout,HelperFactory){function portfolioModelLoad(){params.id=$scope.photo_id=photoid,$scope.index=photoindex,$scope.photoKey=photoKey,$scope.photos=photos,$scope.follow=follow,$scope.redirect=redirect,$scope.loadPhoto(),$scope.indexOfRowContainingId(),$state.go(PortfolioConstant.StatePortfolioView,{slug:createSlug(title),id:params.id},{notify:!1})}$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1},$scope.viewphotos=[],$scope.flag={},$scope.taglabel=[],$scope.loadPhoto=function(){$scope.photos[$scope.photoKey][$scope.index].id===parseInt(params.id)?($scope.viewphotos=$scope.photos[$scope.photoKey][$scope.index],$scope.viewphotos.username=$scope.photos[$scope.photoKey][$scope.index].user.username,$scope.photoView($scope.viewphotos.id),$scope.viewphotos.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined($scope.viewphotos.user.attachment)&&null!==$scope.viewphotos.user.attachment&&($scope.viewphotos.user_avatar_url=HelperFactory.generateimage("UserAvatar",$scope.viewphotos.user.id,"small_thumb")),delete $scope.viewphotos.photo_url,$scope.viewphotos.photo_url=HelperFactory.generateimage("Portfolio",$scope.viewphotos.id,"large_thumb")):PortfoliosFactory.getbyId(params,function(response){$scope.photos[$scope.photoKey][$scope.index]=response.data,$scope.viewphotos=response.data,$scope.photoView($scope.viewphotos.id)})},$scope.photoView=function(photo_id){params.id=photo_id,params.type="view",PortfoliosFactory.getbyId(params,function(response){$scope.Count()})},$scope.scrollPhoto=function(id,index){$uibModalStack.dismissAll(),$location.path("/discover/"+id+"/"+index)},$scope.indexOfRowContainingId=function(){$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1};for(var i=0,len=$scope.photos.length;len>i;i++)for(var j=0,len2=$scope.photos[i].length;len2>j;j++)if($scope.photos[i][j].id===$scope.photo_id)$scope.data.current_key=i,$scope.data.current_index=j,$scope.data.current_id=$scope.photos[i][j].id;else{if(-1!==$scope.data.current_key)return $scope.data.next_key=i,$scope.data.next_index=j,void($scope.data.next_id=$scope.photos[i][j].id);$scope.data.prev_key=i,$scope.data.prev_index=j,$scope.data.prev_id=$scope.photos[i][j].id}},$scope.slide_change=function(option){if("next"===option&&($scope.photo_id=$scope.data.next_id),"prev"===option&&($scope.photo_id=$scope.data.prev_id),$scope.indexOfRowContainingId(),-1!==$scope.data.current_id&&($scope.index=parseInt($scope.data.current_index),$scope.photoKey=parseInt($scope.data.current_key),$scope.photo_id=parseInt($scope.data.current_id),angular.isDefined($scope.photos[$scope.photoKey][$scope.index]))){setRootHeader($scope.photos[$scope.photoKey][$scope.index].title),params.id=$scope.photos[$scope.photoKey][$scope.index].id,params.slug=createSlug($scope.photos[$scope.photoKey][$scope.index].title),$state.go(PortfolioConstant.StatePortfolioView,{slug:params.slug,id:params.id},{notify:!1,location:"replace"});var myEl=angular.element(document.querySelector("img"));myEl.attr("src","//:0"),$timeout(function(){$scope.loadPhoto()},100)}},$scope.Login_func=function(){$uibModalStack.dismissAll(),$location.path("/users/login")},$scope.Count=function(){var params={};params.id=$scope.photos[$scope.photoKey][$scope.index].id,PortfoliosFactory.get(params,function(response){var comment=response.data;$scope.viewphotos.follower_count=comment.follower_count,$scope.viewphotos.message_count=comment.message_count,$scope.viewphotos.view_count=comment.view_count})},portfolioModelLoad()},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{photoid:function(){return id},photoindex:function(){return index},photoKey:function(){return key},follow:function(){return $scope.follow},photos:function(){return $scope.photos},redirect:function(){return redirectto}}})},$scope.deletePortfolio=function(portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user?swal({title:$filter("translate")("Are you sure you want to delete?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var params={};params.id=portfolio_id,PortfoliosFactory["delete"](params,function(response){0===response.error.code&&(alertMessage("Portfolio deleted successfully.","success"),$state.go(PortfolioConstant.StatePortfolios,{},{reload:!0}))})}}):$state.go(PortfolioConstant.StatePortfolios)},$scope.editPortfolio=function(title,size,portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user&&(setRootHeader(title),$scope.editPortfolioModel=$uibModal.open({animation:!1,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",controller:function($scope,$rootScope,$location,$window,PortfoliosFactory,flash,$filter,HelperFactory,Upload,portfolioId,userId,PortfolioSkillsFactory,usertypeId,ConstUserRole,PortfolioAutocompleteUsers){function getPortfolioById(params){PortfoliosFactory.getbyId(params,function(response){0===response.error.code&&($scope.portfolio=response.data,selectedUser=response.data.user_id,$scope.tags=[],angular.forEach($scope.portfolio.portfolios_skill,function(tag){$scope.tags.push({text:tag.skill.name})}))})}var selectedUser=[];$scope.save_btn=!1,$scope.loadTags=function(query){return PortfolioSkillsFactory.getall({q:query,fields:"name",limit:"all"}).$promise.then(function(response){return angular.isDefined(response.data)&&response.data.length>0&&($scope.newEntry=[],angular.forEach(response.data,function(tag){$scope.newEntry.push({text:tag.name})})),$scope.newEntry})},PortfolioAutocompleteUsers.get(function(response){0===parseInt(response.error.code)?($scope.employerUser=[],$scope.employerUsers=response.data,$scope.portfolio.user_select=[],angular.forEach($scope.employerUsers,function(value){$scope.employerUser.push({id:value.id,text:value.username}),""!==selectedUser&&-1!=selectedUser.indexOf(value.id)&&$scope.portfolio.user_select.push({id:value.id,text:value.username})})):console.log("User Error")},function(error){console.log("Users Error",error)}),$scope.portfolioloadEmployers=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.employerUser,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.portfoliopage=1,$scope.newImage=null,params.id=portfolioId,getPortfolioById(params),$scope.uploadPortfolioImage=function(file){Upload.upload({url:"/api/v1/attachments?class=Portfolio",data:{file:file}}).then(function(response){0===response.data.error.code&&($scope.newImage=response.data.attachment)})},$scope.portfolio_submit=function(is_valid){if(is_valid===!0){$scope.save_btn=!0;var pdata={};null!==$scope.newImage&&(pdata.image=$scope.newImage),pdata.id=portfolioId,pdata.title=$scope.portfolio.title,pdata.description=$scope.portfolio.description;var value=[];angular.forEach($scope.tags,function(tag){value.push(tag.text),pdata.skills=value.join()}),angular.isUndefined($scope.portfolio.user_select)?pdata.user_id=ConstUserRole.Admin:pdata.user_id=$scope.portfolio.user_select,PortfoliosFactory.update(pdata,function(response){0===response.error.code?(alertMessage("Portfolio updated successfully.","success"),$state.go(PortfolioConstant.StatePortfolios,{},{reload:!0})):(alertMessage("Please try again","error"),$scope.save_btn=!1)})}}},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{portfolioId:function(){return portfolio_id},usertypeId:function(){return $rootScope.user.role_id},userId:function(){return $rootScope.user.id}}}))},$scope.addPortfolio=function(file,size){function uploadImage(file){angular.element("#custom-upload").val(file.name),Upload.upload({url:"/api/v1/attachments?class=Portfolio",data:{file:file}}).then(function(response){0===response.data.error.code?($rootScope.newImage=response.data.attachment,$rootScope.error_message=""):$rootScope.error_message=response.data.error.message})}null!==$rootScope.user&&void 0!==$rootScope.user&&(setRootHeader("Add New Portfolio"),$scope.addPortfolioModel=$uibModal.open({animation:!1,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",controller:function($scope,$rootScope,$location,$window,PortfoliosFactory,flash,$filter,HelperFactory,userId,uploadfile,PortfolioSkillsFactory,ConstUserRole,PortfolioAutocompleteUsers,usertypeId){$scope.loadTags=function(query){return PortfolioSkillsFactory.getall({q:query,fields:"name",limit:"all"}).$promise.then(function(response){return angular.isDefined(response.data)&&response.data.length>0&&($scope.newEntry=[],angular.forEach(response.data,function(tag){$scope.newEntry.push({text:tag.name})})),$scope.newEntry})},$scope.portfoliopage=0,$scope.file=uploadfile,uploadImage(uploadfile),$scope.portfolio_submit=function(is_valid){if(is_valid===!0&&!$rootScope.error_message){$scope.save_btn=!0;var pdata={};null!==$rootScope.newImage&&(pdata.image=$rootScope.newImage),pdata.title=$scope.portfolio.title,pdata.description=$scope.portfolio.description;var value=[];angular.forEach($scope.tags,function(tag){value.push(tag.text),pdata.skills=value.join()}),angular.isUndefined($scope.portfolio.user_id)?pdata.user_id=ConstUserRole.Admin:pdata.user_id=$scope.portfolio.user_id,PortfoliosFactory.create(pdata,function(response){0===response.error.code?(alertMessage("Portfolio added successfully.","success"),$state.go(PortfolioConstant.StatePortfolios,{},{reload:!0})):(alertMessage("Please try again","error"),$scope.save_btn=!1)})}}},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{userId:function(){return $rootScope.user.id},usertypeId:function(){return $rootScope.user.role_id},uploadfile:function(){return file}}}))}}]),angular.module("getlancerApp.Portfolio").controller("PortfoliosHomeController",["$scope","$rootScope","$location","$window","$filter","$state","md5","PortfoliosFactory","flash","$uibModal","$uibModalStack","HelperFactory","Upload","$stateParams","PortfolioConstant","PortfolioSkillsFactory","Slug","PortfolioAutocompleteUsers","ConstUserRole","$timeout",function($scope,$rootScope,$location,$window,$filter,$state,md5,PortfoliosFactory,flash,$uibModal,$uibModalStack,HelperFactory,Upload,$stateParams,PortfolioConstant,PortfolioSkillsFactory,Slug,PortfolioAutocompleteUsers,ConstUserRole,$timeout){function createSlug(input){return Slug.slugify(input)}function alertMessage(message,type){flash.set($filter("translate")(message),type,!1)}function chkLoginParams(name){var result=!1;return void 0!==$stateParams.type&&null!==$stateParams.type&&$stateParams.type===name&&null!==$rootScope.user&&void 0!==$rootScope.user&&(result=!0),result}function statusBarShow(){$scope.norecodeShow=!1,$("#search-loading-div").attr("style","display:block"),$("#loading").attr("style","display:block"),$("#search-result-div").attr("style","display:none")}function statusBarHide(){$scope.norecodeShow=!0,$("#search-loading-div").attr("style","display:none"),$("#loading").attr("style","display:none"),$("#search-result-div").attr("style","display:block")}function getPortfolioData(){statusBarShow(),params.sort="id",params.sortby="desc",params.limit=8,params.search=$state.params.search,params.page=$scope.currentpage,$scope.NoRecordMessage=!0,null!==$state.params.skills&&void 0!==$state.params.skills?(params.skill=$state.params.skills,$scope.NoRecordMessage=!1):chkLoginParams(PortfolioConstant.Myportfolios)===!0?($scope.NoRecordMessage=!1,params.user_id=$rootScope.user.id,$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("My Portfolios")):chkLoginParams(PortfolioConstant.Myfollowing)===!0?($scope.NoRecordMessage=!1,params.filter=PortfolioConstant.Myfollowing):chkLoginParams(PortfolioConstant.StatePortfolioProfile)!==!0&&(params.user_id=$stateParams.id),PortfoliosFactory.getall(params,function(response){if(chkLoginParams(PortfolioConstant.Myportfolios)===!1&&($rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Portfolios")),$scope.scroll_flag=!0,angular.isDefined(response._metadata)&&($scope.lastpage=response._metadata.last_page,$scope.currentpage=response._metadata.current_page),angular.isDefined(response.data)){var temp_photos=[],i=0;angular.forEach(response.data,function(photo){i++,photo.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined(photo.user.attachment)&&null!==photo.user.attachment&&(photo.user_avatar_url=HelperFactory.generateimage("UserAvatar",photo.user.id,"small_thumb")),photo.photos_url=HelperFactory.generateimage("Portfolio",photo.id,"medium_thumb"),angular.isDefined(photo.follower)&&photo.follower.length>0?(photo.is_favorite=!0,angular.forEach(photo.follower,function(follower){photo.like_id=follower.id})):photo.is_favorite=!1,angular.isDefined(photo.user.user_follow)&&null!==photo.user.user_follow?angular.forEach(photo.user.user_follow,function(follow){$scope.follow[photo.user.id]={follow_id:follow.id,isfollow:!0}}):$scope.follow[photo.user.id]={follow_id:0,isfollow:!1},angular.isDefined(photo.flag)&&photo.flag.length>0?photo.is_flag=!0:photo.is_flag=!1,temp_photos.push(photo),(4===temp_photos.length||i===response.data.length)&&($scope.photos.push(temp_photos),temp_photos=[])})}$scope.loader=!1,statusBarHide()},function(error){$scope.scroll_flag=!0})}$uibModalStack.dismissAll(),$rootScope.cimage=function(foreign_id,thumb,classname){return HelperFactory.generateimage(classname,foreign_id,thumb)},$rootScope.closemodel=function(){$uibModalStack.dismissAll(),$location.path("/")};var params={};$scope.enabled=!0,$scope.scroll_flag=!0,$scope.photos=[],$scope.follow=[],$scope.currentpage=1,$scope.lastpage=2,$scope.loader=!0,getPortfolioData(),$scope.loadMore=function(){$scope.currentpage+=1,getPortfolioData()},$scope.firstVisit=0,$scope.page=$scope.currentpage,$scope.pagination=function(){$scope.scrolloder=!0,$scope.scroll_load=!0,$timeout(function(){$scope.scrolloder=!1,$scope.enabled===!0&&$scope.scroll_flag===!0&&($scope.currentpage<=$scope.lastpage?(0!==$scope.firstVisit&&($scope.currentpage+=1,$scope.back_to_top=!0,$scope.scroll_flag=!1,getPortfolioData(),$scope.scroll_load=!1),$scope.firstVisit=1):$scope.enabled=!1)},1e3)},$scope.backAgain=function(){return $("html, body").animate({scrollTop:0},"slow"),!1},$scope.go=function(photo_user_id,photo_user_username){$location.path("profile/"+photo_user_id+"/"+photo_user_username)},$scope.openPhotoModal=function(id,title,index,size,key){var redirectto={statename:$state.current.name,params:$state.params.slug?$state.params.slug:$state.params.type};$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/modal_photo_view.html", animation:!1,controller:function($scope,$rootScope,photoid,photoindex,photoKey,photos,follow,redirect,$stateParams,$filter,md5,$location,$uibModalStack,$uibModal,$state,photoStatsFactory,PortfoliosFactory,userSettings,$timeout,HelperFactory){function portfolioModelLoad(){params.id=$scope.photo_id=photoid,$scope.index=photoindex,$scope.photoKey=photoKey,$scope.photos=photos,$scope.follow=follow,$scope.redirect=redirect,$scope.loadPhoto(),$scope.indexOfRowContainingId(),$state.go(PortfolioConstant.StatePortfolioView,{slug:createSlug(title),id:params.id},{notify:!1})}$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1},$scope.viewphotos=[],$scope.flag={},$scope.taglabel=[],$scope.$on("modal.closing",function(){$location.path("/")}),$scope.loadPhoto=function(){$scope.photos[$scope.photoKey][$scope.index].id===parseInt(params.id)?($scope.viewphotos=$scope.photos[$scope.photoKey][$scope.index],$scope.viewphotos.username=$scope.photos[$scope.photoKey][$scope.index].user.username,$scope.photoView($scope.viewphotos.id),$scope.viewphotos.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined($scope.viewphotos.user.attachment)&&null!==$scope.viewphotos.user.attachment&&($scope.viewphotos.user_avatar_url=HelperFactory.generateimage("UserAvatar",$scope.viewphotos.user.id,"small_thumb")),delete $scope.viewphotos.photo_url,$scope.viewphotos.photo_url=HelperFactory.generateimage("Portfolio",$scope.viewphotos.id,"large_thumb")):PortfoliosFactory.getbyId(params,function(response){$scope.photos[$scope.photoKey][$scope.index]=response.data,$scope.viewphotos=response.data,$scope.photoView($scope.viewphotos.id)})},$scope.photoView=function(photo_id){params.id=photo_id,params.type="view",PortfoliosFactory.getbyId(params,function(response){$scope.Count()})},$scope.scrollPhoto=function(id,index){$uibModalStack.dismissAll(),$location.path("/discover/"+id+"/"+index)},$scope.indexOfRowContainingId=function(){$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1};for(var i=0,len=$scope.photos.length;len>i;i++)for(var j=0,len2=$scope.photos[i].length;len2>j;j++)if($scope.photos[i][j].id===$scope.photo_id)$scope.data.current_key=i,$scope.data.current_index=j,$scope.data.current_id=$scope.photos[i][j].id;else{if(-1!==$scope.data.current_key)return $scope.data.next_key=i,$scope.data.next_index=j,void($scope.data.next_id=$scope.photos[i][j].id);$scope.data.prev_key=i,$scope.data.prev_index=j,$scope.data.prev_id=$scope.photos[i][j].id}},$rootScope.nextvalue=!1,$scope.slide_change=function(option){if($rootScope.nextvalue=!0,"next"===option&&($scope.photo_id=$scope.data.next_id),"prev"===option&&($scope.photo_id=$scope.data.prev_id),$scope.indexOfRowContainingId(),-1!==$scope.data.current_id&&($scope.index=parseInt($scope.data.current_index),$scope.photoKey=parseInt($scope.data.current_key),$scope.photo_id=parseInt($scope.data.current_id),angular.isDefined($scope.photos[$scope.photoKey][$scope.index]))){params.id=$scope.photos[$scope.photoKey][$scope.index].id,params.slug=createSlug($scope.photos[$scope.photoKey][$scope.index].title),$state.go(PortfolioConstant.StatePortfolioView,{slug:params.slug,id:params.id},{notify:!1,location:"replace"});var myEl=angular.element(document.querySelector("img"));myEl.attr("src","//:0"),$timeout(function(){$scope.loadPhoto()},100)}},$scope.Login_func=function(){$uibModalStack.dismissAll(),$location.path("/users/login")},$rootScope.Count=function(){var params={};params.id=$scope.photos[$scope.photoKey][$scope.index].id,PortfoliosFactory.get(params,function(response){var comment=response.data;$scope.viewphotos.follower_count=comment.follower_count,$scope.viewphotos.message_count=comment.message_count,$scope.viewphotos.view_count=comment.view_count})},portfolioModelLoad()},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{photoid:function(){return id},photoindex:function(){return index},photoKey:function(){return key},follow:function(){return $scope.follow},photos:function(){return $scope.photos},redirect:function(){return redirectto}}})},$scope.deletePortfolio=function(portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user?swal({title:$filter("translate")("Are you sure you want to delete?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var params={};params.id=portfolio_id,PortfoliosFactory["delete"](params,function(response){0===response.error.code&&(alertMessage("Portfolio deleted successfully.","success"),$state.go(PortfolioConstant.StatePortfolios,{},{reload:!0}))})}}):$state.go(PortfolioConstant.StatePortfolios)},$scope.editPortfolio=function(title,size,portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user&&($scope.editPortfolioModel=$uibModal.open({animation:!1,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",controller:function($scope,$rootScope,$location,$window,PortfoliosFactory,flash,$filter,HelperFactory,Upload,portfolioId,userId,PortfolioSkillsFactory,usertypeId,ConstUserRole,PortfolioAutocompleteUsers){function getPortfolioById(params){PortfoliosFactory.getbyId(params,function(response){0===response.error.code&&($scope.portfolio=response.data,selectedUser=response.data.user_id,$scope.tags=[],angular.forEach($scope.portfolio.portfolios_skill,function(tag){$scope.tags.push({text:tag.skill.name})}))})}var selectedUser=[];$scope.save_btn=!1,$scope.loadTags=function(query){return PortfolioSkillsFactory.getall({q:query,fields:"name",limit:"all"}).$promise.then(function(response){return angular.isDefined(response.data)&&response.data.length>0&&($scope.newEntry=[],angular.forEach(response.data,function(tag){$scope.newEntry.push({text:tag.name})})),$scope.newEntry})},PortfolioAutocompleteUsers.get(function(response){0===parseInt(response.error.code)?($scope.employerUser=[],$scope.employerUsers=response.data,$scope.portfolio.user_select=[],angular.forEach($scope.employerUsers,function(value){$scope.employerUser.push({id:value.id,text:value.username}),""!==selectedUser&&-1!=selectedUser.indexOf(value.id)&&$scope.portfolio.user_select.push({id:value.id,text:value.username})})):console.log("User Error")},function(error){console.log("Users Error",error)}),$scope.portfolioloadEmployers=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.employerUser,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.portfoliopage=1,$scope.newImage=null,params.id=portfolioId,getPortfolioById(params),$scope.uploadPortfolioImage=function(file){Upload.upload({url:"/api/v1/attachments?class=Portfolio",data:{file:file}}).then(function(response){0===response.data.error.code&&($scope.newImage=response.data.attachment)})},$scope.portfolio_submit=function(is_valid){if(is_valid===!0){$scope.save_btn=!0;var pdata={};null!==$scope.newImage&&(pdata.image=$scope.newImage),pdata.id=portfolioId,pdata.title=$scope.portfolio.title,pdata.description=$scope.portfolio.description;var value=[];angular.forEach($scope.tags,function(tag){value.push(tag.text),pdata.skills=value.join()}),angular.isUndefined($scope.portfolio.user_select)?pdata.user_id=ConstUserRole.Admin:pdata.user_id=$scope.portfolio.user_select,PortfoliosFactory.update(pdata,function(response){0===response.error.code?(alertMessage("Portfolio updated successfully.","success"),$state.go(PortfolioConstant.StatePortfolios,{},{reload:!0})):(alertMessage("Please try again","error"),$scope.save_btn=!1)})}}},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{portfolioId:function(){return portfolio_id},usertypeId:function(){return $rootScope.user.role_id},userId:function(){return $rootScope.user.id}}}))},$scope.addPortfolio=function(file,size){function uploadImage(file){angular.element("#custom-upload").val(file.name),Upload.upload({url:"/api/v1/attachments?class=Portfolio",data:{file:file}}).then(function(response){0===response.data.error.code?($rootScope.newImage=response.data.attachment,$rootScope.error_message=""):$rootScope.error_message=response.data.error.message})}null!==$rootScope.user&&void 0!==$rootScope.user&&($scope.addPortfolioModel=$uibModal.open({animation:!1,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",controller:function($scope,$rootScope,$location,$window,PortfoliosFactory,flash,$filter,HelperFactory,userId,uploadfile,PortfolioSkillsFactory,ConstUserRole,PortfolioAutocompleteUsers,usertypeId){$scope.loadTags=function(query){return PortfolioSkillsFactory.getall({q:query,fields:"name",limit:"all"}).$promise.then(function(response){return angular.isDefined(response.data)&&response.data.length>0&&($scope.newEntry=[],angular.forEach(response.data,function(tag){$scope.newEntry.push({text:tag.name})})),$scope.newEntry})},$scope.portfoliopage=0,$scope.file=uploadfile,uploadImage(uploadfile),$scope.portfolio_submit=function(is_valid){if(is_valid===!0&&!$rootScope.error_message){$scope.save_btn=!0;var pdata={};null!==$rootScope.newImage&&(pdata.image=$rootScope.newImage),pdata.title=$scope.portfolio.title,pdata.description=$scope.portfolio.description;var value=[];angular.forEach($scope.tags,function(tag){value.push(tag.text),pdata.skills=value.join()}),angular.isUndefined($scope.portfolio.user_id)?pdata.user_id=ConstUserRole.Admin:pdata.user_id=$scope.portfolio.user_id,PortfoliosFactory.create(pdata,function(response){0===response.error.code?(alertMessage("Portfolio added successfully.","success"),$state.go(PortfolioConstant.StatePortfolios,{},{reload:!0})):(alertMessage("Please try again","error"),$scope.save_btn=!1)})}}},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{userId:function(){return $rootScope.user.id},usertypeId:function(){return $rootScope.user.role_id},uploadfile:function(){return file}}}))}}]),angular.module("getlancerApp.Portfolio").controller("PortfoliosController",["$scope","$rootScope","$location","$window","$filter","$state","md5","PortfoliosFactory","flash","$uibModal","$uibModalStack","HelperFactory","Upload","$stateParams","PortfolioConstant","PortfolioSkillsFactory","Slug","PortfolioAutocompleteUsers","ConstUserRole","$timeout","mePortfoliosFactory","$cookies",function($scope,$rootScope,$location,$window,$filter,$state,md5,PortfoliosFactory,flash,$uibModal,$uibModalStack,HelperFactory,Upload,$stateParams,PortfolioConstant,PortfolioSkillsFactory,Slug,PortfolioAutocompleteUsers,ConstUserRole,$timeout,mePortfoliosFactory,$cookies){function setRootHeader(pagename){$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Portfolio")+" - "+pagename}function createSlug(input){return Slug.slugify(input)}function alertMessage(message,type){flash.set($filter("translate")(message),type,!1)}function chkLoginParams(name){var result=!1;return void 0!==$stateParams.type&&null!==$stateParams.type&&$stateParams.type===name&&null!==$rootScope.user&&void 0!==$rootScope.user&&(result=!0),result}function statusBarShow(){$scope.norecodeShow=!1,$("#search-loading-div").attr("style","display:block"),$("#loading").attr("style","display:block"),$("#search-result-div").attr("style","display:none")}function statusBarHide(){$scope.norecodeShow=!0,$("#search-loading-div").attr("style","display:none"),$("#loading").attr("style","display:none"),$("#search-result-div").attr("style","display:block")}function getPortfolioData(){statusBarShow(),params.sort="id",params.sortby="desc",params.limit=12,params.search=$state.params.search,params.page=$scope.currentpage,$scope.NoRecordMessage=!0,null!==$state.params.skills&&void 0!==$state.params.skills?(params.skill=$state.params.skills,$scope.NoRecordMessage=!1):"dashboard"===$scope.location_find?($scope.title_name="My Portfolios",$scope.NoRecordMessage=!1,$rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("My Portfolios")):chkLoginParams(PortfolioConstant.Myfollowing)===!0?($scope.NoRecordMessage=!1,params.filter=PortfolioConstant.Myfollowing):chkLoginParams(PortfolioConstant.StatePortfolioProfile)!==!0&&(params.user_id=$stateParams.id),"dashboard"===$scope.location_find?($cookies.put("portfolio_url",JSON.stringify("dashboard")),$scope.port_url=JSON.parse($cookies.get("portfolio_url")),$scope.NoRecordMessage=!1,mePortfoliosFactory.get(params,function(response){if("dashboard"!==$scope.location_find&&($rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Portfolios"),$scope.title_name="Portfolios"),$scope.scroll_flag=!0,angular.isDefined(response._metadata)&&($scope.lastpage=response._metadata.last_page,$scope.currentpage=response._metadata.current_page),angular.isDefined(response.data)){var temp_photos=[],i=0;angular.forEach(response.data,function(photo){i++,photo.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined(photo.user.attachment)&&null!==photo.user.attachment&&(photo.user_avatar_url=HelperFactory.generateimage("UserAvatar",photo.user.id,"small_thumb")),photo.photos_url=HelperFactory.generateimage("Portfolio",photo.id,"medium_thumb"),angular.isDefined(photo.follower)&&photo.follower.length>0?(photo.is_favorite=!0,angular.forEach(photo.follower,function(follower){photo.like_id=follower.id})):photo.is_favorite=!1,angular.isDefined(photo.user.user_follow)&&null!==photo.user.user_follow?angular.forEach(photo.user.user_follow,function(follow){$scope.follow[photo.user.id]={follow_id:follow.id,isfollow:!0}}):$scope.follow[photo.user.id]={follow_id:0,isfollow:!1},angular.isDefined(photo.flag)&&photo.flag.length>0?photo.is_flag=!0:photo.is_flag=!1,temp_photos.push(photo),(4===temp_photos.length||i===response.data.length)&&($scope.photos.push(temp_photos),temp_photos=[])})}$scope.loader=!1,statusBarHide()},function(error){$scope.scroll_flag=!0})):($cookies.put("portfolio_url",JSON.stringify("Portfolio")),$scope.port_url=JSON.parse($cookies.get("portfolio_url")),PortfoliosFactory.getall(params,function(response){if("dashboard"!==$scope.location_find&&($rootScope.header=$rootScope.settings.SITE_NAME+" | "+$filter("translate")("Portfolios"),$scope.title_name="Portfolios",$scope.NoRecordMessage=!0),$scope.scroll_flag=!0,angular.isDefined(response._metadata)&&($scope.lastpage=response._metadata.last_page,$scope.currentpage=response._metadata.current_page),angular.isDefined(response.data)){var temp_photos=[],i=0;angular.forEach(response.data,function(photo){i++,photo.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined(photo.user.attachment)&&null!==photo.user.attachment&&(photo.user_avatar_url=HelperFactory.generateimage("UserAvatar",photo.user.id,"small_thumb")),photo.photos_url=HelperFactory.generateimage("Portfolio",photo.id,"medium_thumb"),angular.isDefined(photo.follower)&&photo.follower.length>0?(photo.is_favorite=!0,angular.forEach(photo.follower,function(follower){photo.like_id=follower.id})):photo.is_favorite=!1,angular.isDefined(photo.user.user_follow)&&null!==photo.user.user_follow?angular.forEach(photo.user.user_follow,function(follow){$scope.follow[photo.user.id]={follow_id:follow.id,isfollow:!0}}):$scope.follow[photo.user.id]={follow_id:0,isfollow:!1},angular.isDefined(photo.flag)&&photo.flag.length>0?photo.is_flag=!0:photo.is_flag=!1,temp_photos.push(photo),(4===temp_photos.length||i===response.data.length)&&($scope.photos.push(temp_photos),temp_photos=[])})}$scope.loader=!1,statusBarHide()},function(error){$scope.scroll_flag=!0}))}$uibModalStack.dismissAll(),$rootScope.cimage=function(foreign_id,thumb,classname){return HelperFactory.generateimage(classname,foreign_id,thumb)},$rootScope.closemodel=function(){$uibModalStack.dismissAll(),$scope.port_url=JSON.parse($cookies.get("portfolio_url")),"dashboard"===$scope.port_url?$state.go("user_dashboard",{type:"portfolios",status:"my_portfolios"}):$location.path("/portfolios")},setRootHeader("Portfolios");var params={};$scope.enabled=!0,$scope.scroll_flag=!0,$scope.photos=[],$scope.follow=[],$scope.currentpage=1,$scope.lastpage=2,$scope.loader=!0,$scope.location_find=$location.path().split("/")[2],getPortfolioData(),$scope.loadMore=function(){$scope.currentpage+=1,getPortfolioData()},$scope.firstVisit=0,$scope.page=$scope.currentpage,$scope.pagination=function(){$scope.scrolloder=!0,$scope.scroll_load=!0,$timeout(function(){$scope.scrolloder=!1,$scope.enabled===!0&&$scope.scroll_flag===!0&&($scope.currentpage<=$scope.lastpage?(0!==$scope.firstVisit&&($scope.currentpage+=1,$scope.back_to_top=!0,$scope.scroll_flag=!1,getPortfolioData(),$scope.scroll_load=!1),$scope.firstVisit=1):$scope.enabled=!1)},1e3)},$scope.backAgain=function(){return $("html, body").animate({scrollTop:0},"slow"),!1},$scope.go=function(photo_user_id,photo_user_username){$location.path("profile/"+photo_user_id+"/"+photo_user_username)},$scope.openPhotoModal=function(id,title,index,size,key){setRootHeader(title);var redirectto={statename:$state.current.name,params:$state.params.slug?$state.params.slug:$state.params.type};$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/modal_photo_view.html",animation:!1,controller:function($scope,$rootScope,photoid,photoindex,photoKey,photos,follow,redirect,$stateParams,$filter,md5,$location,$uibModalStack,$uibModal,$state,photoStatsFactory,PortfoliosFactory,userSettings,$timeout,HelperFactory){function portfolioModelLoad(){params.id=$scope.photo_id=photoid,$scope.index=photoindex,$scope.photoKey=photoKey,$scope.photos=photos,$scope.follow=follow,$scope.redirect=redirect,$scope.loadPhoto(),$scope.indexOfRowContainingId(),$state.go(PortfolioConstant.StatePortfolioView,{slug:createSlug(title),id:params.id},{notify:!1})}$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1},$scope.viewphotos=[],$scope.flag={},$scope.taglabel=[],$scope.$on("modal.closing",function(){$scope.port_url=JSON.parse($cookies.get("portfolio_url")),"dashboard"===$scope.port_url?$state.go("user_dashboard",{type:"portfolios",status:"my_portfolios"}):$location.path("/portfolios")}),$scope.loadPhoto=function(){$scope.photos[$scope.photoKey][$scope.index].id===parseInt(params.id)?($scope.viewphotos=$scope.photos[$scope.photoKey][$scope.index],$scope.viewphotos.username=$scope.photos[$scope.photoKey][$scope.index].user.username,$scope.photoView($scope.viewphotos.id),$scope.viewphotos.user_avatar_url=HelperFactory.userdefaultimage(),angular.isDefined($scope.viewphotos.user.attachment)&&null!==$scope.viewphotos.user.attachment&&($scope.viewphotos.user_avatar_url=HelperFactory.generateimage("UserAvatar",$scope.viewphotos.user.id,"small_thumb")),delete $scope.viewphotos.photo_url,$scope.viewphotos.photo_url=HelperFactory.generateimage("Portfolio",$scope.viewphotos.id,"large_thumb")):PortfoliosFactory.getbyId(params,function(response){$scope.photos[$scope.photoKey][$scope.index]=response.data,$scope.viewphotos=response.data,$scope.photoView($scope.viewphotos.id)})},$scope.photoView=function(photo_id){params.id=photo_id,params.type="view",PortfoliosFactory.getbyId(params,function(response){$scope.Count()})},$scope.scrollPhoto=function(id,index){$uibModalStack.dismissAll(),$location.path("/discover/"+id+"/"+index)},$scope.indexOfRowContainingId=function(){$scope.data={prev_key:-1,prev_index:-1,prev_id:-1,current_key:-1,current_index:-1,current_id:-1,next_key:-1,next_index:-1,next_id:-1};for(var i=0,len=$scope.photos.length;len>i;i++)for(var j=0,len2=$scope.photos[i].length;len2>j;j++)if($scope.photos[i][j].id===$scope.photo_id)$scope.data.current_key=i,$scope.data.current_index=j,$scope.data.current_id=$scope.photos[i][j].id;else{if(-1!==$scope.data.current_key)return $scope.data.next_key=i,$scope.data.next_index=j,void($scope.data.next_id=$scope.photos[i][j].id);$scope.data.prev_key=i,$scope.data.prev_index=j,$scope.data.prev_id=$scope.photos[i][j].id}},$rootScope.nextvalue=!1,$scope.slide_change=function(option){if($rootScope.nextvalue=!0,"next"===option&&($scope.photo_id=$scope.data.next_id),"prev"===option&&($scope.photo_id=$scope.data.prev_id),$scope.indexOfRowContainingId(),-1!==$scope.data.current_id&&($scope.index=parseInt($scope.data.current_index),$scope.photoKey=parseInt($scope.data.current_key),$scope.photo_id=parseInt($scope.data.current_id),angular.isDefined($scope.photos[$scope.photoKey][$scope.index]))){setRootHeader($scope.photos[$scope.photoKey][$scope.index].title),params.id=$scope.photos[$scope.photoKey][$scope.index].id,params.slug=createSlug($scope.photos[$scope.photoKey][$scope.index].title),$state.go(PortfolioConstant.StatePortfolioView,{slug:params.slug,id:params.id},{notify:!1,location:"replace"});var myEl=angular.element(document.querySelector("img"));myEl.attr("src","//:0"),$timeout(function(){$scope.loadPhoto()},100)}},$scope.Login_func=function(){$uibModalStack.dismissAll(),$location.path("/users/login")},$rootScope.Count=function(){var params={};params.id=$scope.photos[$scope.photoKey][$scope.index].id,PortfoliosFactory.get(params,function(response){var comment=response.data;$scope.viewphotos.follower_count=comment.follower_count,$scope.viewphotos.message_count=comment.message_count,$scope.viewphotos.view_count=comment.view_count})},portfolioModelLoad()},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{photoid:function(){return id},photoindex:function(){return index},photoKey:function(){return key},follow:function(){return $scope.follow},photos:function(){return $scope.photos},redirect:function(){return redirectto}}})},$scope.deletePortfolio=function(portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user?swal({title:$filter("translate")("Are you sure you want to delete?"),text:"",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"OK",cancelButtonText:"Cancel",closeOnConfirm:!0,animation:!1}).then(function(isConfirm){if(isConfirm){var params={};params.id=portfolio_id,PortfoliosFactory["delete"](params,function(response){0===response.error.code&&(alertMessage("Portfolio deleted successfully.","success"),$scope.port_url=JSON.parse($cookies.get("portfolio_url")),"dashboard"===$scope.port_url?$state.go("user_dashboard",{type:"portfolios",status:"my_portfolios"},{reload:!0}):($location.path("/portfolios"),$state.reload()))})}}):$state.go(PortfolioConstant.StatePortfolios)},$scope.editPortfolio=function(title,size,portfolio_id){null!==$rootScope.user&&void 0!==$rootScope.user&&(setRootHeader(title),$scope.editPortfolioModel=$uibModal.open({animation:!1,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",controller:function($scope,$rootScope,$location,$window,PortfoliosFactory,flash,$filter,HelperFactory,Upload,portfolioId,userId,PortfolioSkillsFactory,usertypeId,ConstUserRole,PortfolioAutocompleteUsers){function getPortfolioById(params){PortfoliosFactory.getbyId(params,function(response){0===response.error.code&&($scope.portfolio=response.data,selectedUser=response.data.user_id,$scope.tags=[],angular.forEach($scope.portfolio.portfolios_skill,function(tag){$scope.tags.push({text:tag.skill.name})}))})}var selectedUser=[];$scope.save_btn=!1,$scope.loadTags=function(query){return PortfolioSkillsFactory.getall({q:query,fields:"name",limit:"all"}).$promise.then(function(response){return angular.isDefined(response.data)&&response.data.length>0&&($scope.newEntry=[],angular.forEach(response.data,function(tag){$scope.newEntry.push({text:tag.name})})),$scope.newEntry})},PortfolioAutocompleteUsers.get(function(response){0===parseInt(response.error.code)?($scope.employerUser=[],$scope.employerUsers=response.data,$scope.portfolio.user_select=[],angular.forEach($scope.employerUsers,function(value){$scope.employerUser.push({id:value.id,text:value.username}),""!==selectedUser&&Array.isArray(selectedUser)&&-1!=selectedUser.indexOf(value.id)&&$scope.portfolio.user_select.push({id:value.id,text:value.username})})):console.log("User Error")},function(error){console.log("Users Error",error)}),$scope.portfolioloadEmployers=function(qstr){qstr=qstr.toLowerCase();var items=[];return angular.forEach($scope.employerUser,function(value){name=value.text.toLowerCase(),name.indexOf(qstr)>=0&&items.push({id:value.id,text:value.text})}),items},$scope.portfoliopage=1,$scope.newImage=null,params.id=portfolioId,getPortfolioById(params),$scope.uploadPortfolioImage=function(file){Upload.upload({url:"/api/v1/attachments?class=Portfolio",data:{file:file}}).then(function(response){0===response.data.error.code&&($scope.newImage=response.data.attachment)})},$scope.portfolio_submit=function(is_valid){if(is_valid===!0){$scope.save_btn=!0;var pdata={};null!==$scope.newImage&&(pdata.image=$scope.newImage),pdata.id=portfolioId,pdata.title=$scope.portfolio.title,pdata.description=$scope.portfolio.description;var value=[];angular.forEach($scope.tags,function(tag){value.push(tag.text),pdata.skills=value.join()}),angular.isUndefined($scope.portfolio.user_select)?pdata.user_id=ConstUserRole.Admin:pdata.user_id=$scope.portfolio.user_select,PortfoliosFactory.update(pdata,function(response){0===response.error.code?(alertMessage("Portfolio updated successfully.","success"),$scope.port_url=JSON.parse($cookies.get("portfolio_url")),"dashboard"===$scope.port_url?$state.go("user_dashboard",{type:"portfolios",status:"my_portfolios"},{reload:!0}):($location.path("/portfolios"),$state.reload())):(alertMessage("Please try again","error"),$scope.save_btn=!1)})}}},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{portfolioId:function(){return portfolio_id},usertypeId:function(){return $rootScope.user.role_id},userId:function(){return $rootScope.user.id}}}))},$scope.addPortfolio=function(file,size){function uploadImage(file){angular.element("#custom-upload").val(file.name),Upload.upload({url:"/api/v1/attachments?class=Portfolio",data:{file:file}}).then(function(response){0===response.data.error.code?($rootScope.newImage=response.data.attachment,$rootScope.error_message=""):$rootScope.error_message=response.data.error.message})}null!==$rootScope.user&&void 0!==$rootScope.user&&(setRootHeader("Add New Portfolio"),$scope.addPortfolioModel=$uibModal.open({animation:!1,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",controller:function($scope,$rootScope,$location,$window,PortfoliosFactory,flash,$filter,HelperFactory,userId,uploadfile,PortfolioSkillsFactory,ConstUserRole,PortfolioAutocompleteUsers,usertypeId){$scope.loadTags=function(query){return PortfolioSkillsFactory.getall({q:query,fields:"name",limit:"all"}).$promise.then(function(response){return angular.isDefined(response.data)&&response.data.length>0&&($scope.newEntry=[],angular.forEach(response.data,function(tag){$scope.newEntry.push({text:tag.name})})),$scope.newEntry})},$scope.portfoliopage=0,$scope.file=uploadfile,uploadImage(uploadfile),$scope.portfolio_submit=function(is_valid){if(is_valid===!0&&!$rootScope.error_message){$scope.save_btn=!0;var pdata={};null!==$rootScope.newImage&&(pdata.image=$rootScope.newImage),pdata.title=$scope.portfolio.title,pdata.description=$scope.portfolio.description;var value=[];angular.forEach($scope.tags,function(tag){value.push(tag.text),pdata.skills=value.join()}),angular.isUndefined($scope.portfolio.user_id)?pdata.user_id=ConstUserRole.Admin:pdata.user_id=$scope.portfolio.user_id,PortfoliosFactory.create(pdata,function(response){0===response.error.code?(alertMessage("Portfolio added successfully.","success"),"portfolios"===$state.current.name?$state.go($state.current.name,{},{reload:!0}):$state.go("user_dashboard",{type:"portfolios",status:"my_portfolios"},{reload:!0})):(alertMessage("Please try again","error"),$scope.save_btn=!1)})}}},size:size,backdrop:"static",windowClass:"js-photo-view",resolve:{userId:function(){return $rootScope.user.id},usertypeId:function(){return $rootScope.user.role_id},uploadfile:function(){return file}}}))}}]),$(document).ready(function(){$(window).scroll(function(){$(document).scrollTop()>300?($(".scrolltop").css("bottom","50px"),$(".scrolltop").css("right","30px")):$(".scrolltop").css("right","-40px")}),$(".scrolltop").click(function(){return $("html, body").animate({scrollTop:0},800),!1})}),angular.module("getlancerApp.Portfolio").controller("PortfoliosViewController",["$scope","$rootScope","$location","$window","$filter","$state","$stateParams","md5","flash","$uibModal","PortfoliosFactory","$uibModalStack","HelperFactory","PortfolioConstant","Slug",function($scope,$rootScope,$location,$window,$filter,$state,$stateParams,md5,flash,$uibModal,PortfoliosFactory,$uibModalStack,HelperFactory,PortfolioConstant,Slug){$scope.closeInstance=function(){$uibModalStack.dismissAll()},$scope.init=function(){$scope.getphoto(),$scope.follow=[]},$scope.getphoto=function(){var params={};params.id=$stateParams.id,PortfoliosFactory.getbyId(params,function(response){angular.isDefined(response.data)?($scope.photo=response.data,$scope.photo.user_avatar_url=HelperFactory.userdefaultimage(),null!==$scope.photo.attachment?$scope.photo.photos_url=HelperFactory.generateimage("Portfolio",$scope.photo.attachment.foreign_id,"extra_large_thumb"):$scope.photo.photos_url="images/no-image.png",angular.isDefined($scope.photo.user.attachment)&&null!==$scope.photo.user.attachment&&($scope.photo.user_avatar_url=HelperFactory.generateimage("UserAvatar",$scope.photo.user.attachment.foreign_id,"small_thumb")),angular.isDefined($scope.photo.follower)&&$scope.photo.follower.length>0?($scope.photo.is_favorite=!0,angular.forEach($scope.photo.follower,function(follower){$scope.photo.like_id=follower.id})):$scope.photo.is_favorite=!1,angular.isDefined($scope.photo.flag)&&$scope.photo.flag.length>0?$scope.photo.is_flag=!0:$scope.photo.is_flag=!1):$scope.closemodel()})},$scope.ModelCancel=function(){$uibModalStack.dismissAll(),$location.path($scope.redirect)},$scope.Login_func=function(){$uibModalStack.dismissAll(),$location.path("/users/login")},$scope.Count=function(){var params={};params.id=$scope.photo.id,PortfoliosFactory.getbyId(params,function(response){var comment=response.data;$scope.photo.follower_count=comment.follower_count,$scope.photo.message_count=comment.message_count})},$scope.init()}]),angular.module("getlancerApp.Portfolio").directive("customScroll",function(){return{restrict:"A",link:function(scope,iElement){iElement.mCustomScrollbar({autoHideScrollbar:!1,theme:"rounded-dark",mouseWheel:{scrollAmount:188},autoExpandScrollbar:!0,snapAmount:188,snapOffset:65,advanced:{updateOnImageLoad:!0},keyboard:{scrollType:"stepped"},scrollButtons:{enable:!0,scrollType:"stepped"}})}}}).directive("portfolioHomeSkills",function(PortfolioSkillsFactory){return{restrict:"EA",replace:!0,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio_home_skills.html",link:function(scope,element,attrs){var params={limit:30,sort:"name",sortby:"DSC",field:"id,name,slug,description"};PortfolioSkillsFactory.get(params,function(response){scope.portfolio_skills=response.data})}}}).directive("portfolioHome",function(){return{restrict:"EA",replace:!0,templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolios_home_block.html",controller:"PortfoliosHomeController"}}),angular.module("getlancerApp.Portfolio").directive("portfolioViewShare",function($rootScope,md5,$window,$uibModal,$filter,$state){return{templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio_view_share.html",restrict:"EA",replace:"true",scope:"true",link:function(scope,element,attr){scope.ShareModel=function(isvalid){scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/portfolio_view_share_modal.html",backdrop:"true",controller:"PortfoliosViewController"})}}}}),angular.module("getlancerApp.Portfolio").factory("HelperFactory",function($rootScope,md5,$http,PortfolioConstant){var d=new Date;return{userdefaultimage:function(){ return PortfolioConstant.ImagePath+"default.png?"+d.getTime()},Portfoliodefaultimage:function(){return PortfolioConstant.ImagePath+"no-image.png?"+d.getTime()},generateimage:function(classname,foreign_id,thumb_type){var hash=md5.createHash(classname+foreign_id+"png"+thumb_type);return PortfolioConstant.ImagePath+thumb_type+"/"+classname+"/"+foreign_id+"."+hash+".png?"+d.getTime()},getdatetime:function(value){var nd=new Date(value);return nd.getFullYear()+"-"+(nd.getMonth()+parseInt(1))+"-"+nd.getDate()+" "+nd.getHours()+":"+nd.getMinutes()+":00"},getdate:function(value){var nd=new Date(value);return nd.getFullYear()+"-"+(nd.getMonth()+parseInt(1))+"-"+nd.getDate()},gettime:function(value){var nd=new Date(value);return nd.getHours()+":"+nd.getMinutes()+":00"},checkint:function(x){if(x%1!==0)throw new TypeError(x+" is not an integer");return x},Update:function(url,reqdata){return $http.put(url,reqdata)},Create:function(url,reqdata){return $http.post(url,reqdata)},Get:function(url){return $http.get(url)},GetbyId:function(url,id){return $http.get(url+id)},Delete:function(url){return $http["delete"](url)}}}).factory("PortfoliosFactory",["$resource",function($resource){return $resource("/api/v1/portfolios/:id",{},{getbyId:{method:"GET",params:{id:"@id"}},"delete":{method:"DELETE",params:{id:"@id"}},getall:{method:"GET"},create:{method:"POST"},update:{method:"PUT",params:{id:"@id"}}})}]).factory("PortfolioSkillsFactory",["$resource",function($resource){return $resource("/api/v1/skills",{},{getall:{method:"GET"}})}]).factory("SearchPhotoFactory",["$resource",function($resource){return $resource("/api/v1/photo_tags/:photoTagId/photos",{},{get:{method:"GET",params:{id:"@id"}}})}]).factory("PhotoUploadFactory",["$resource",function($resource){return $resource("/api/v1/portfolios",{},{create:{method:"POST"}})}]).factory("photoStatsFactory",["$resource",function($resource){return $resource("/api/v1/views",{},{create:{method:"POST"}})}]).factory("mePortfoliosFactory",["$resource",function($resource){return $resource("/api/v1/me/portfolios",{},{get:{method:"GET"}})}]).factory("userSettings",["$resource",function($resource){return $resource("/api/v1/users/:id",{},{update:{method:"PUT",params:{id:"@id"}},get:{method:"GET",params:{id:"@id"}},"delete":{method:"delete",params:{id:"@id"}}})}]).factory("PortfolioAutocompleteUsers",["$resource",function($resource){return $resource("/api/v1/users?type=employer",{},{get:{method:"GET"}})}]),angular.module("getlancerApp.Portfolio").run(["$templateCache",function($templateCache){"use strict";$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/flagmodal.html",' '),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/modal_photo_view.html",''),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/photo.html",'
    [Image: {{photo.title}}]
    '),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolio.html",''),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolio_dashboard.html",'

    {{photo.title}}

    {{\'No records available\'| translate }}

    {{\'You are the first to post portfolio\'| translate }}.

    '),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolio_home_block.html",'

    Portfolio

    {{\'No records available\'| translate }}

    • {{photo.title}}

      • {{photo.follower_count}}
      • {{photo.view_count}}
      • {{photo.message_count}}

      {{photo.title}}

      {{photo.title}}

    '),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolio_home_skills.html",'
    '),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolio_view_share.html",''),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolio_view_share_modal.html",''),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolios_home_block.html",''),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/portfolioshome.html",'

    {{\'Upload Your Portfolio\'| translate }}

    {{\'Allowed extensions:\'|translate}} {{$root.settings.ALLOWED_EXTENSIONS_OF_PORTFOLIO}}

    {{title_name}}

    {{photo.title}}

    {{\'No records available\'| translate }}

    {{\'You are the first to post portfolio\'| translate }}.

    '),$templateCache.put("scripts/plugins/Portfolio/Portfolio/views/default/profile.html",'

    {{photo.title}}

    {{photo.title}}

    {{\'No records available\'| translate }}

    '); }]);angular.module('getlancerApp').requires.push('getlancerApp.Portfolio');angular.module("getlancerApp.Portfolio.PortfolioComment",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","ngMessages","slugifier"]),angular.module("getlancerApp.Portfolio.PortfolioComment").controller("PortfolioCommentsViewController",function($scope,portfolioMessageFactory,PortfolioConstant,flash,$filter,$attrs,md5,$stateParams,$rootScope,PortfoliosFactory){function alertMessage(message,type){flash.set($filter("translate")(message),type,!1)}$scope.Messages=[],$scope.MessagePage=1,$scope.pagevalue=!1,$scope.getMessage=function(photo_id){$rootScope.nextvalue===!0&&$scope.pagevalue===!0&&($scope.MessagePage=1),portfolioMessageFactory.get({foreign_id:photo_id,"class":PortfolioConstant.ClassName,sortby:"desc",page:$scope.MessagePage,limit:5},function(response){angular.isDefined(response.data)&&(angular.isDefined(response._metadata)&&($scope.messageNoOfPages=response._metadata.last_page,$scope.messageTotal=response._metadata.total-response._metadata.current_page*response._metadata.per_page),0===parseInt(response.error.code)?($rootScope.nextvalue===!0&&($scope.Messages=[]),angular.forEach(response.data,function(message){angular.isDefined(message.user.attachment)&&null!==message.user.attachment?message.user_avatar_url="images/small_thumb/UserAvatar/"+message.user.id+"."+md5.createHash("UserAvatar"+message.user.id+"pngsmall_thumb")+".png":message.user_avatar_url="images/default.png",$scope.Messages.push(message)})):$scope.Messages=[])})},$scope.photo={},$rootScope.Count=function(){var params={};params.id=$stateParams.id,PortfoliosFactory.get(params,function(response){var comment=response.data;$scope.photo.follower_count=comment.follower_count,$scope.photo.message_count=comment.message_count,$scope.photo.view_count=comment.view_count})},$scope.saveComment=function(){$scope.photo={},$scope.portfoliomessage.subject=$stateParams.slug,$scope.portfoliomessage.foreign_id=$stateParams.id,$scope.portfoliomessage["class"]=PortfolioConstant.ClassName,null!==$scope.portfoliomessage.message&&""!==$scope.portfoliomessage.message&&portfolioMessageFactory.create($scope.portfoliomessage,function(response){0===response.error.code&&(alertMessage("Comment added successfully.","success"),$scope.portfoliomessage.message=null,$scope.getMessage(response.foreign_id),$scope.Messages=[],$rootScope.Count())})},$scope.MessagePage=1,$scope.message_pagination=function(){$scope.MessagePage=parseInt($scope.MessagePage)+1,$scope.getMessage($stateParams.id),$rootScope.nextvalue=!1,$scope.pagevalue=!0}}),angular.module("getlancerApp.Portfolio.PortfolioComment").directive("portfolioComments",function(){return{templateUrl:"scripts/plugins/Portfolio/PortfolioComment/views/default/portfolio_comments.html",restrict:"E",controller:"PortfolioCommentsController"}}).directive("portfolioCommentsView",function(){return{restrict:"E",scope:{photoId:"@",messageCount:"@"},controller:"PortfolioCommentsViewController",link:function(scope,element,attr){attr.$observe("photoId",function(value){value&&(scope.photoId=value)}),attr.$observe("messageCount",function(value){value&&scope.getMessage(scope.photoId)})},templateUrl:"scripts/plugins/Portfolio/PortfolioComment/views/default/portfolio_comments_view.html"}}).directive("portfolioCommentsAdd",function(){return{templateUrl:"scripts/plugins/Portfolio/PortfolioComment/views/default/portfolio_comments_add.html",restrict:"E",controller:"PortfolioCommentsController"}}).directive("portfolioCommentsAddView",function(){return{templateUrl:"scripts/plugins/Portfolio/PortfolioComment/views/default/portfolio_comments_add.html",restrict:"E",controller:"PortfolioCommentsViewController"}}),angular.module("getlancerApp.Portfolio.PortfolioComment").factory("portfolioMessageFactory",["$resource",function($resource){return $resource("/api/v1/messages",{},{create:{method:"POST"},get:{method:"GET",params:{foreign_id:"@foreign_id"}}})}]),angular.module("getlancerApp.Portfolio.PortfolioComment").run(["$templateCache",function($templateCache){"use strict";$templateCache.put("scripts/plugins/Portfolio/PortfolioComment/views/default/portfolio_comments_add.html",""),$templateCache.put("scripts/plugins/Portfolio/PortfolioComment/views/default/portfolio_comments_view.html",'
  • {{\' Comments\'|translate}} {{\'Load more...\' | translate}} ( {{messageTotal}} )

  • ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Portfolio.PortfolioComment');angular.module("getlancerApp.Portfolio.PortfolioFlag",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","ngMessages","slugifier"]),angular.module("getlancerApp.Portfolio.PortfolioFlag").controller("PortfolioFlagPhotoController",function($scope,$rootScope,$uibModal,$filter,flash){function alertMessage(message,type){flash.set($filter("translate")(message),type,!1)}$scope.openFlagModal=function(viewphotos){$scope.flagview=viewphotos.is_flag?"js-flagged-view":"js-flag-view",$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/flagmodal.html",animation:!1,controller:function($scope,$rootScope,FlagSaveFactory,viewphotos,photoindex,photoKey,photos,$uibModalInstance,$uibModalStack,$location,PortfolioConstant,FlagCategoryFactory){$scope.photos=photos;var params={};params["class"]="Portfolio",FlagCategoryFactory.get(params,function(response){$scope.flagcategories=response.data}),$scope.viewphotos=viewphotos,$scope.flag={},$scope.save_btn=!1,$scope.SaveFlag=function(isvalid){if(isvalid)if(null!==$rootScope.user&&void 0!==$rootScope.user&&isvalid===!0){$scope.save_btn=!0;var params={};params.user_id=$rootScope.user.id,params.foreign_id=$scope.viewphotos.id,params.flag_category_id=$scope.flag.flag_category_id,params.message=$scope.flag.message,params["class"]=PortfolioConstant.ClassName,FlagSaveFactory.create(params,function(response){0===response.error.code&&(alertMessage("Flagged successfully.","success"),$uibModalStack.dismissAll(),$scope.viewphotos.is_flag=!0)})}else $uibModalStack.dismissAll(),$location.path("/users/login")},$scope.closeInstance=function(){$uibModalInstance.close()}},windowClass:$scope.flagview,resolve:{viewphotos:function(){return viewphotos},photoindex:function(){return $scope.index},photoKey:function(){return $scope.photoKey},photos:function(){return $scope.photos}}})}}).controller("PortfolioFlagController",function($scope,$rootScope,$uibModal,$filter,flash){function alertMessage(message,type){flash.set($filter("translate")(message),type,!1)}$scope.openFlagModal=function(photo){$scope.flagview=photo.is_flag?"js-flagged-view":"js-flag-view",$scope.modalInstance=$uibModal.open({templateUrl:"scripts/plugins/Portfolio/Portfolio/views/default/flagmodal.html",animation:!1,controller:function($scope,$rootScope,FlagSaveFactory,photo,photoindex,photoKey,photos,$uibModalInstance,$uibModalStack,$location,PortfolioConstant,FlagCategoryFactory){$scope.photos=photos;var params={};params["class"]="Portfolio",FlagCategoryFactory.get(params,function(response){$scope.flagcategories=response.data}),$scope.viewphotos=photo,$scope.flag={},$scope.SaveFlag=function(isvalid){if(isvalid)if(null!==$rootScope.user&&void 0!==$rootScope.user){var params={};params.user_id=$rootScope.user.id,params.foreign_id=$scope.viewphotos.id,params.flag_category_id=$scope.flag.flag_category_id,params.message=$scope.flag.message,params["class"]=PortfolioConstant.ClassName,FlagSaveFactory.create(params,function(response){0===response.error.code&&(alertMessage("Flagged successfully.","success"),$scope.viewphotos.is_flag=!0,$uibModalInstance.close())})}else $uibModalStack.dismissAll(),$location.path("/users/login")},$scope.closeInstance=function(){$uibModalInstance.close()}},windowClass:$scope.flagview,resolve:{photo:function(){return photo},photoindex:function(){return $scope.index},photoKey:function(){return $scope.photoKey},photos:function(){return $scope.photo}}})}}),angular.module("getlancerApp.Portfolio.PortfolioFlag").directive("portfolioFlagViewPhoto",function(){return{templateUrl:"scripts/plugins/Portfolio/PortfolioFlag/views/default/flag_photo_view.html",restrict:"E",controller:"PortfolioFlagPhotoController"}}).directive("portfolioFlagView",function(){return{templateUrl:"scripts/plugins/Portfolio/PortfolioFlag/views/default/flag_view.html",restrict:"E",controller:"PortfolioFlagController"}}),angular.module("getlancerApp.Portfolio.PortfolioFlag").factory("FlagSaveFactory",["$resource",function($resource){return $resource("/api/v1/flags",{},{create:{method:"POST"}})}]).factory("FlagCategoryFactory",["$resource",function($resource){return $resource("/api/v1/flag_categories",{},{get:{method:"GET"}})}]),angular.module("getlancerApp.Portfolio.PortfolioFlag").run(["$templateCache",function($templateCache){"use strict";$templateCache.put("scripts/plugins/Portfolio/PortfolioFlag/views/default/flag_photo_view.html",''),$templateCache.put("scripts/plugins/Portfolio/PortfolioFlag/views/default/flag_view.html",''),$templateCache.put("scripts/plugins/Portfolio/PortfolioFlag/views/default/flagmodal.html",' ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Portfolio.PortfolioFlag');angular.module("getlancerApp.Portfolio.PortfolioFollow",["ngResource","ngSanitize","satellizer","ngAnimate","ui.bootstrap","ui.bootstrap.datetimepicker","ui.router","angular-growl","google.places","angular.filter","ngCookies","angular-md5","ui.select2","http-auth-interceptor","angulartics","pascalprecht.translate","angulartics.google.analytics","tmh.dynamicLocale","ngFileUpload","infinite-scroll","ngTagsInput","angularMoment","bc.Flickity","afkl.lazyImage","angular-loading-bar","ngAnimate","ngMessages","slugifier"]),angular.module("getlancerApp.Portfolio.PortfolioFollow").controller("PortfolioFollowPhotoController",function($scope,PortfolioFavoriteFactory,PortfolioUnFavoriteFactory){$scope.portfolioFavorite=function(){angular.isDefined($scope.photos[$scope.photoKey][$scope.index])&&PortfolioFavoriteFactory.create({foreign_id:$scope.photos[$scope.photoKey][$scope.index].id,"class":"Portfolio"},function(response){0===response.error.code&&($scope.photos[$scope.photoKey][$scope.index].is_favorite=!0,$scope.photos[$scope.photoKey][$scope.index].like_id=response.id,$scope.Count(),$scope.$emit("profileParent",{}))})},$scope.portfolioUnFavorite=function(){if(angular.isDefined($scope.photos[$scope.photoKey][$scope.index])){var params={};params.id=$scope.photos[$scope.photoKey][$scope.index].like_id,PortfolioUnFavoriteFactory.update(params,function(response){0===response.error.code&&($scope.photos[$scope.photoKey][$scope.index].is_favorite=!1,$scope.Count())})}}}).controller("PortfolioFollowViewPhotoController",function($scope,PortfolioFavoriteFactory,PortfolioUnFavoriteFactory,PortfolioConstant){$scope.portfolioFavorite=function(value,is_favorite){if(is_favorite){var params={};params.id=$scope.photo.like_id,PortfolioUnFavoriteFactory.update(params,function(response){0===response.error.code&&($scope.photo.is_favorite=!1,$scope.Count())})}else PortfolioFavoriteFactory.create({foreign_id:$scope.photo.id,"class":PortfolioConstant.ClassName},function(response){0===response.error.code&&($scope.photo.is_favorite=!0,$scope.photo.like_id=response.id,$scope.$emit("profileParent",{}),$scope.Count())})}}).controller("PortfolioFollowsController",function($scope,PortfolioUnFavoriteFactory){$scope.portfolioUnFavorite=function(){if(angular.isDefined($scope.photos[$scope.photoKey][$scope.index])){var params={};params.id=$scope.photos[$scope.photoKey][$scope.index].like_id,PortfolioUnFavoriteFactory.update(params,function(response){0===response.error.code&&($scope.photos[$scope.photoKey][$scope.index].is_favorite=!1,$scope.Count())})}}}),angular.module("getlancerApp.Portfolio.PortfolioFollow").directive("portfolioFollowPhotoModel",function(){return{templateUrl:"scripts/plugins/Portfolio/PortfolioFollow/views/default/follow_photo_model.html",restrict:"E",controller:"PortfolioFollowPhotoController"}}).directive("portfolioFollowPhotoView",function(){return{templateUrl:"scripts/plugins/Portfolio/PortfolioFollow/views/default/follow_photo_view.html",restrict:"E",controller:"PortfolioFollowViewPhotoController"}}),angular.module("getlancerApp.Portfolio.PortfolioFollow").factory("PortfolioFavoriteFactory",["$resource",function($resource){return $resource("/api/v1/followers",{},{create:{method:"POST"}})}]).factory("PortfolioUnFavoriteFactory",["$resource",function($resource){return $resource("/api/v1/followers/:id",{},{update:{method:"delete",params:{id:"@id"}}})}]),angular.module("getlancerApp.Portfolio.PortfolioFollow").run(["$templateCache",function($templateCache){"use strict";$templateCache.put("scripts/plugins/Portfolio/PortfolioFollow/views/default/follow_photo_model.html",' '),$templateCache.put("scripts/plugins/Portfolio/PortfolioFollow/views/default/follow_photo_view.html",' ')}]);angular.module('getlancerApp').requires.push('getlancerApp.Portfolio.PortfolioFollow');function toWords(s){if(s=s.toString(),s=s.replace(/[\, ]/g,""),s!=parseFloat(s))return"not a number";var x=s.indexOf(".");if(-1==x&&(x=s.length),x>15)return"too big";for(var n=s.split(""),str="",sk=0,i=0;x>i;i++)(x-i)%3==2?"1"==n[i]?(str+=tn[Number(n[i+1])]+" ",i++,sk=1):0!=n[i]&&(str+=tw[n[i]-2]+" ",sk=1):0!=n[i]&&(str+=dg[n[i]]+" ",(x-i)%3==0&&(str+="hundred "),sk=1),(x-i)%3==1&&(sk&&(str+=th[(x-i-1)/3]+" "),sk=0);if(x!=s.length){var y=s.length;str+="point ";for(var i=x+1;y>i;i++)str+=dg[n[i]]+" "}return str.replace(/\s+/g," ")}