tips.230be0b8538b47cf6c7a.js 3.93 KB
(window.webpackJsonp=window.webpackJsonp||[]).push([["fad1"],{l9Vy:function(t,n,o){"use strict";o.r(n);o("tlwP");angular.module("footyroom").controller("TipController",["$uibModal","dateFormat",function(t,n){n($(".btip")),this.editTip=function(n){t.open({template:'<tip-editor id="'.concat(n||"",'" dismiss="$dismiss()"></tip-editor>')})}}])},tlwP:function(t,n){angular.module("footyroom").component("tipEditor",{template:'\n            <div fr-litelay="$ctrl.isSaving || $ctrl.isLoading">\n                <div class="modal-body">\n                    <div class="form-group">\n                        <label>Match ID</label>\n                        <input class="form-control" type="text" ng-model="$ctrl.tip.matchId" placeholder="Example: 123456789">\n                        <span class="help-block">\n                            You can get match ID from the URL of a match to which this tip belongs.\n                            Checkout Live Scores to get a list of upcoming matches and their URLs.\n                        </span>\n                    </div>\n                    <div class="form-group">\n                        <label>Prediction</label>\n                        <input class="form-control" type="text" ng-model="$ctrl.tip.prediction" placeholder="Example: Both teams to score - Yes">\n                    </div>\n                    <div class="form-group">\n                        <label>Odds</label>\n                        <input class="form-control" type="text" ng-model="$ctrl.tip.odds" placeholder="Example: 1.99">\n                    </div>\n                    <div class="form-group">\n                        <label>Status</label>\n                        <select class="form-control" ng-model="$ctrl.tip.status">\n                            <option value="pending">Pending</option>\n                            <option value="correct">Correct</option>\n                            <option value="wrong">Wrong</option>\n                            <option value="neutral">Neutral</option>\n                        </select>\n                        <span class="help-block">\n                            All tips start as "Pending", but when it\'s settled you will have to update its outcome here.\n                        </span>\n                    </div>\n                    <div class="form-group">\n                        <label>Actual Result (optional)</label>\n                        <input class="form-control" type="text" ng-model="$ctrl.tip.result" placeholder="Examples: 1 : 2, Yes, Neymar">\n                        <span class="help-block">\n                            This is usually the final score of the game or some other outcome.\n                            If this field is left empty final score will be shown automatically.\n                        </span>\n                    </div>\n                </div>\n                <div class="modal-footer">\n                    <div class="pull-left">\n                        <button ng-click="$ctrl.remove()" ng-if="$ctrl.tip.id" class="btn btn-default">Delete</button>\n                    </div>\n                    <div class="pull-right">\n                        <button class="btn btn-default" ng-click="$ctrl.dismiss()">Cancel</button>\n                        <button class="btn btn-primary" ng-click="$ctrl.save()">Save</button>\n                    </div>\n                </div>\n            </div>\n        ',bindings:{id:"@",dismiss:"&"},controller:["$http",function(t){var n=this;n.$onInit=function(){n.id?(n.isLoading=!0,t.get("/tips/".concat(this.id,".json")).then(function(t){n.tip=t.data,n.isLoading=!1})):n.tip={status:"pending"}},n.save=function(){n.isSaving=!0,(n.tip.id?t.put("/tips/".concat(n.tip.id),n.tip):t.post("/tips",n.tip)).then(function(){window.location.reload()}).catch(function(){n.isSaving=!1})},n.remove=function(){n.isSaving=!0,t.delete("/tips/".concat(this.id)).then(function(){window.location.reload()}).catch(function(){n.isSaving=!1})}}]})}},[["l9Vy","d41d"]]]);