(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3c0c4c7b"],{"3ba2":function(e,t,o){"use strict";var n=function(){var e=this,t=e._self._c;return t("router-link",{attrs:{to:e.to},nativeOn:{click:function(t){return e.routeToAnchor.apply(null,arguments)}}},[e._t("default")],2)},r=[],a=(o("c5f6"),o("2b0e")),i=o("8c4f"),c=o("f13c"),s=o.n(c);a["default"].use(i["a"]),a["default"].use(s.a);var l={name:"vue-anchor-router-link",props:{to:Object,scrollOptions:{type:[Object,Number],default:1}},data:function(){return{previousRoute:this.$route}},methods:{routeToAnchor:function(){this.$route.fullPath===this.previousRoute.fullPath&&this.$scrollTo(this.to.hash,this.scrollOptions)}},watch:{$route:function(e,t){this.previousRoute=e}}},u=l,d=o("2877"),f=Object(d["a"])(u,n,r,!1,null,null,null),v=f.exports;t["a"]=v},"435d":function(e,t,o){"use strict";o.r(t);var n=function(){var e=this,t=e._self._c;return t("div",[t("v-container",{staticClass:"pt-0",attrs:{fluid:""}},[t("v-card",{attrs:{flat:""}},[t("v-toolbar",{attrs:{dense:"",flat:"",color:"grey lighten-2"}},[t("v-spacer"),e.form.fetching?[t("v-btn",{attrs:{depressed:"",color:"transparent",loading:e.form.fetching}})]:[e.allowedTo("approve")?t("v-btn",{attrs:{color:"info",depressed:"",loading:"save"==e.form.action},on:{click:e.approve}},[e._v(e._s(e.$t("message.approve")))]):e._e(),e.allowedTo("reject")?t("v-btn",{attrs:{color:"error",depressed:"",loading:"save"==e.form.action},on:{click:function(t){e.showRejectDialog=!0}}},[e._v(e._s(e.$t("message.reject")))]):e._e()]],2)],1),t("v-card",{attrs:{flat:""}},[t("v-toolbar",{staticClass:"primary lighten-2",attrs:{flat:"",dark:""}},[t("v-toolbar-title",{staticClass:"font-weight-light"},[e._v(e._s(e.$t("message.extensionPeriodForm")))])],1),t("v-layout",{attrs:{row:"",wrap:""}},[t("v-flex",{attrs:{xl8:"",lg8:"",md8:"",sm12:""}},[t("v-container",{staticClass:"pa-3"},[t("v-layout",{attrs:{row:"",wrap:""}},[t("v-chip",{attrs:{color:e.statusColor(e.getValue(e.record,"status_form")),"text-color":"white"}},[e._v(e._s(e.getValue(e.record.status_form,"label")))]),t("br")],1),t("v-layout",{attrs:{column:"",wrap:""}},[t("h6",[e._v(e._s(e.getStatusReason(e.getValue(e.record.status_form,"label"))))]),t("v-text-field",{attrs:{value:e.getValue(e.record,"ref_no"),label:e.$t("message.refNo"),readonly:!e.canEdit("ref_no"),placeholder:" "}}),t("v-text-field",{attrs:{value:e.getDateFromISO(e.getValue(e.record,"commencement_date")),label:e.$t("message.commencementDate"),readonly:!e.canEdit("commencement_date"),placeholder:" "}}),t("v-text-field",{attrs:{value:e.getDateFromISO(e.getValue(e.record,"completion_date")),label:e.$t("message.completionDate"),readonly:!e.canEdit("completion_date"),placeholder:" "}}),t("v-textarea",{attrs:{value:e.getValue(e.record,"extension_reason"),label:e.$t("message.extensionReason"),readonly:!e.canEdit("extension_reason"),placeholder:" "}})],1)],1)],1)],1)],1)],1),t("v-dialog",{attrs:{width:"500"},model:{value:e.showRejectDialog,callback:function(t){e.showRejectDialog=t},expression:"showRejectDialog"}},[t("v-card",[t("v-card-title",{staticClass:"headline error lighten-2 white--text"},[e._v(e._s(e.$t("message.reasonForReject")))]),t("v-card-text",{staticClass:"pb-0"},[t("v-textarea",{attrs:{required:"",box:"","error-messages":e.reasonForRejectErrors},on:{input:function(t){return e.$v.reasonForReject.$touch()},blur:function(t){return e.$v.reasonForReject.$touch()}},model:{value:e.reasonForReject,callback:function(t){e.reasonForReject=t},expression:"reasonForReject"}})],1),t("v-divider"),t("v-card-actions",[t("v-spacer"),t("v-btn",{attrs:{outline:""},on:{click:function(t){e.showRejectDialog=!1}}},[e._v(e._s(e.$t("message.cancel")))]),t("v-btn",{attrs:{color:"error",outline:"",loading:"save"==e.form.action},on:{click:e.reject}},[e._v(e._s(e.$t("message.reject")))])],1)],1)],1),t("snackbar",{attrs:{snackbar:e.snackbar}})],1)},r=[],a=(o("8e6e"),o("ac6a"),o("456d"),o("a481"),o("ade3")),i=o("365c"),c=o("2f62"),s=o("4da1"),l=o("323e"),u=o.n(l),d=o("7fb5"),f=o.n(d),v=o("1dce"),m=o("b5ae"),h=(o("c1df"),o("45a3")),p=o("5e44"),b=o("8106");function g(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function y(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?g(Object(o),!0).forEach((function(t){Object(a["a"])(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):g(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var w={mixins:[v["validationMixin"]],validations:{reasonForReject:{required:m["required"]}},constants:{STATUS_PENDING:0,STATUS_APPROVED:1,STATUS_REJECTED:2,STATUS_WITHDRAW:3},created:function(){this.record=this.defaultRecord,"new"==this.recordId&&(this.mode="new"),this.getApprover(),this.getData()},components:{Breadcrumbs:p["a"],Snackbar:b["a"],ConfirmDialog:h["a"]},computed:y(y({},Object(c["b"])(["adminScope","mySession"])),{},{defaultRecord:function(){return Object.assign({},{})},locked:function(){return this.record.locked},reasonForRejectErrors:function(){var e=[];return this.$v.reasonForReject.$dirty?(!this.$v.reasonForReject.required&&e.push(this.$t("message.reasonIsRequired")),e):e}}),watch:{$route:function(e,t){this.recordId=Object(s["j"])(e.params,"extensionId"),this.record={},"new"==this.recordId&&(this.mode="new"),this.getData()}},methods:{allowedMinutes:function(e){return e>=e%5},getValue:function(e,t){return Object(s["j"])(e,t)},getDateTimeFromISO:function(e,t){return Object(s["g"])(e,t)},getDateFromISO:function(e,t){return Object(s["e"])(e,t)},convertDateToISO:function(e,t){return Object(s["a"])(e,t)},allowedTo:function(e){switch(e){case"approve":if("edit"==this.mode)return!1;if(Object(s["j"])(this.record,"status_form.id")==this.STATUS_PENDING&&(this.approver.level1_user_id==this.mySession.id||this.approver.level2_user_id==this.mySession.id))return!0;break;case"reject":if("edit"==this.mode)return!1;if("new"!=this.recordId&&Object(s["j"])(this.record,"status_form.id")==this.STATUS_PENDING&&(this.approver.level1_user_id==this.mySession.id||this.approver.level2_user_id==this.mySession.id))return!0;break;case"add":return!this.$can.not("add","acl.admin.e-form.renovation-form");case"delete":if(this.$can.not("delete","acl.admin.e-form.renovation-form"))return!1;if("new"==this.mode)return!1;if("new"!=this.recordId)return!this.record.locked;break;case"save":if(this.$can.not("add","acl.admin.e-form.renovation-form")&&this.$can.not("edit","acl.admin.e-form.renovation-form"))return!1;if("new"==this.mode||"edit"==this.mode)return!0;break;case"edit":return!this.$can.not("edit","acl.admin.e-form.renovation-form")&&("new"!=this.recordId&&"edit"!=this.mode);case"cancel":if(this.$can.not("add","acl.admin.e-form.renovation-form")&&this.$can.not("edit","acl.admin.e-form.renovation-form"))return!1;if("new"!=this.recordId&&"edit"==this.mode)return!0;break}return!1},canEdit:function(e){var t=!1;switch(t="new"==this.mode,e){default:break}return t},onCancel:function(){this.errorMessages=null,this.getData(),this.mode="view"},statusColor:function(e){var t="primary";if(Object(s["j"])(e,"id"))switch(e.id){case this.STATUS_APPROVED:t="success";break;case this.STATUS_REJECTED:t="error";break;case this.STATUS_PENDING:default:t="primary";break}return t},getStatusReason:function(e){return"Rejected"==e?"Reason For Reject: "+this.record.reject_reason:"Withdraw"==e?"Reason For Withdraw: "+this.record.withdraw_reason:""},getData:function(){var e=this;"new"!=this.recordId&&(this.form.fetching=!0,u.a.start(),i["a"].get("admin/eform/spfm-renovation-form/"+this.renovationId+"/extension/"+this.recordId,{params:{project_id:this.adminScope.projectId,company_id:this.adminScope.companyId}}).then((function(t){e.record=Object(s["j"])(t,"data.data")})).catch((function(e){})).then((function(){u.a.done(),e.form.fetching=!1})))},getApprover:function(){var e=this;this.form.fetching=!0,u.a.start(),i["a"].get("admin/eform/data-setup/spfm-eform-approver",{params:{project_id:this.adminScope.projectId,company_id:this.adminScope.companyId}}).then((function(t){e.approver=Object(s["j"])(t,"data.data")})).catch((function(e){})).then((function(){u.a.done(),e.form.fetching=!1}))},approve:function(){this.saveData("approve")},reject:function(){this.$v.$touch(),this.$v.$invalid||(this.record.reject_reason=this.reasonForReject,this.saveData("reject"))},saveData:function(e){var t=this;u.a.start(),this.form.loading=!0,this.form.action="save",this.errorMessages=null,this.generate=!0,this.record.project_id||(this.record.project_id=this.adminScope.projectId),this.record.company_id||(this.record.company_id=this.adminScope.companyId),this.record.user_id||(this.record.user_id=this.mySession.id);var o="admin/eform/spfm-renovation-form/"+this.renovationId+"/extension";"new"!==this.recordId&&(o=o+"/"+this.recordId,this.record._method="PATCH",["approve","reject"].indexOf(e)>=0&&(o+="/"+e,this.record._method="PUT"));var n=f()(this.record);i["a"].post(o,n).then((function(e){var o=Object(s["j"])(e,"data.data.id");t.record=Object(s["j"])(e,"data.data"),t.snackbar.message=Object(s["j"])(e,"data.message"),t.snackbar.type="success",t.snackbar.show=!0,t.mode="view",t.$router.replace({name:"admin.e-form.renovation-form.extension.view",params:{renovationId:t.renovationId,extensionId:o}})})).catch((function(e){t.snackbar.message=Object(s["j"])(e,"response.data.message"),t.snackbar.type="error",t.snackbar.show=!0,t.errorMessages=Object(s["j"])(e,"response.data.errors")})).then((function(){u.a.done(),t.showRejectDialog=!1,t.form.loading=!1,t.form.action=null,t.generate=!1}))}},data:function(){return{renovationId:this.$route.params.renovationId,recordId:this.$route.params.extensionId,record:{},generate:!1,approver:{},document:null,reasonForReject:"",mode:"view",showConfirmDeleteRecord:!1,showRejectDialog:!1,form:{fetching:!1,loading:!1,action:null},snackbar:{show:!1,type:null,message:null},errorMessages:null}}},j=w,_=o("2877"),O=Object(_["a"])(j,n,r,!1,null,null,null);t["default"]=O.exports},"45a3":function(e,t,o){"use strict";var n=function(){var e=this,t=e._self._c;return t("v-dialog",{attrs:{"max-width":"500px",persistent:""},on:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.cancelAction()}},model:{value:e.value,callback:function(t){e.value=t},expression:"value"}},[t("v-card",[t("v-card-title",{staticClass:"headline"},[e._v("\n      "+e._s(e.title)+"\n    ")]),t("v-card-text",[e._v("\n      "+e._s(e.text)+"\n    ")]),t("v-card-actions",[t("v-spacer"),this.loading?e._e():t("v-btn",{attrs:{color:"red",flat:"",loading:this.loading},on:{click:e.cancelAction}},[e._v(e._s(e.cancelText))]),t("v-btn",{attrs:{color:"green",flat:"",loading:this.loading},on:{click:e.confirmAction,keydown:function(t){if(!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter"))return null;t.preventDefault()}}},[e._v(e._s(e.confirmText)+" ")])],1)],1)],1)},r=[],a={props:["title","text","cancelText","confirmText","value"],data:function(){return{loading:!1}},watch:{value:function(){this.resetState()}},methods:{resetState:function(){this.loading=!1},confirmAction:function(){this.loading=!0,this.$emit("confirmAction")},cancelAction:function(){this.loading=!0,this.$emit("cancelAction")}}},i=a,c=o("2877"),s=Object(c["a"])(i,n,r,!1,null,null,null);t["a"]=s.exports},"5e44":function(e,t,o){"use strict";var n=function(){var e=this,t=e._self._c;return t("v-toolbar",{attrs:{flat:"",color:e.color?e.color:"white"}},[t("v-breadcrumbs",{attrs:{divider:"/",items:e.breadcrumbs},scopedSlots:e._u([{key:"item",fn:function(o){return[o.item.to?[t("vue-anchor-router-link",{attrs:{to:o.item.to}},[e._v(e._s(o.item.text))])]:[e._v("\n        "+e._s(o.item.text)+"\n      ")]]}}])}),t("v-spacer"),e._t("default")],2)},r=[],a=o("3ba2"),i={props:["breadcrumbs","color"],computed:{},components:{VueAnchorRouterLink:a["a"]}},c=i,s=o("2877"),l=Object(s["a"])(c,n,r,!1,null,null,null);t["a"]=l.exports},"7fb5":function(e,t,o){var n,r;(function(o,a){o||(o={}),n=[],r=function(){return o.jsonToFormData=a()}.apply(t,n),void 0===r||(e.exports=r)})(this,(function(){function e(e,t){return[e,t].reduce((function(e,t){return Object.keys(t).forEach((function(o){e[o]=t[o]})),e}),{})}function t(e){return"[object Array]"==={}.toString.call(e)}function o(e){return!t(e)&&"object"===typeof e&&!!e&&!(e instanceof Blob)&&!(e instanceof Date)}function n(e){return"function"===typeof e.append}function r(){return"function"===typeof FormData}function a(){if(r())return new FormData}function i(t,o){if(o&&o.initialFormData){if(!n(o.initialFormData))throw"initialFormData must have an append function."}else if(!r())throw"This environment does not have global form data. options.initialFormData must be specified.";var i={initialFormData:a(),showLeafArrayIndexes:!0,includeNullValues:!1,mapping:function(e){return"boolean"===typeof e?+e?"1":"0":e}},s=e(i,o||{});return c(t,s,s.initialFormData)}function c(e,n,r,a){var i=0;for(var s in e){if(e.hasOwnProperty(s)){var l=a||s,u=n.mapping(e[s]);if(a&&o(e)&&(l=a+"["+s+"]"),a&&t(e)&&(l=t(u)||n.showLeafArrayIndexes?a+"["+i+"]":a+"[]"),t(u)||o(u))c(u,n,r,l);else if(u instanceof FileList)for(var d=0;d<u.length;d++)r.append(l+"["+d+"]",u.item(d));else u instanceof Blob?r.append(l,u,u.name):u instanceof Date?r.append(l,u.toISOString()):(null===u&&n.includeNullValues||null!==u)&&void 0!==u&&r.append(l,u)}i++}return r}return i}))},f13c:function(e,t,o){(function(t,o){e.exports=o()})(0,(function(){"use strict";var e=4,t=.001,o=1e-7,n=10,r=11,a=1/(r-1),i="function"===typeof Float32Array;function c(e,t){return 1-3*t+3*e}function s(e,t){return 3*t-6*e}function l(e){return 3*e}function u(e,t,o){return((c(t,o)*e+s(t,o))*e+l(t))*e}function d(e,t,o){return 3*c(t,o)*e*e+2*s(t,o)*e+l(t)}function f(e,t,r,a,i){var c,s,l=0;do{s=t+(r-t)/2,c=u(s,a,i)-e,c>0?r=s:t=s}while(Math.abs(c)>o&&++l<n);return s}function v(t,o,n,r){for(var a=0;a<e;++a){var i=d(o,n,r);if(0===i)return o;var c=u(o,n,r)-t;o-=c/i}return o}var m=function(e,o,n,c){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");var s=i?new Float32Array(r):new Array(r);if(e!==o||n!==c)for(var l=0;l<r;++l)s[l]=u(l*a,e,n);function m(o){for(var i=0,c=1,l=r-1;c!==l&&s[c]<=o;++c)i+=a;--c;var u=(o-s[c])/(s[c+1]-s[c]),m=i+u*a,h=d(m,e,n);return h>=t?v(o,m,e,n):0===h?m:f(o,i,i+a,e,n)}return function(t){return e===o&&n===c?t:0===t?0:1===t?1:u(m(t),o,c)}},h={ease:[.25,.1,.25,1],linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},p=!1;try{var b=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("test",null,b)}catch(F){}var g={$:function(e){return"string"!==typeof e?e:document.querySelector(e)},on:function(e,t,o){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{passive:!1};t instanceof Array||(t=[t]);for(var r=0;r<t.length;r++)e.addEventListener(t[r],o,!!p&&n)},off:function(e,t,o){t instanceof Array||(t=[t]);for(var n=0;n<t.length;n++)e.removeEventListener(t[n],o)},cumulativeOffset:function(e){var t=0,o=0;do{t+=e.offsetTop||0,o+=e.offsetLeft||0,e=e.offsetParent}while(e);return{top:t,left:o}}},y="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},j=["mousedown","wheel","DOMMouseScroll","mousewheel","keyup","touchmove"],_={container:"body",duration:500,easing:"ease",offset:0,force:!0,cancelable:!0,onStart:!1,onDone:!1,onCancel:!1,x:!1,y:!0};function O(e){_=w({},_,e)}var S=function(){var e=void 0,t=void 0,o=void 0,n=void 0,r=void 0,a=void 0,i=void 0,c=void 0,s=void 0,l=void 0,u=void 0,d=void 0,f=void 0,v=void 0,p=void 0,b=void 0,w=void 0,O=void 0,S=void 0,k=void 0,D=function(e){i&&(k=e,S=!0)},x=void 0,T=void 0,$=void 0,I=void 0;function R(e){var t=e.scrollTop;return"body"===e.tagName.toLowerCase()&&(t=t||document.documentElement.scrollTop),t}function A(e){var t=e.scrollLeft;return"body"===e.tagName.toLowerCase()&&(t=t||document.documentElement.scrollLeft),t}function F(e){if(S)return E();T||(T=e),$=e-T,I=Math.min($/o,1),I=x(I),P(t,p+O*I,f+w*I),$<o?window.requestAnimationFrame(F):E()}function E(){S||P(t,b,v),T=!1,g.off(t,j,D),S&&l&&l(k,e),!S&&s&&s(e)}function P(e,t,o){d&&(e.scrollTop=t),u&&(e.scrollLeft=o),"body"===e.tagName.toLowerCase()&&(d&&(document.documentElement.scrollTop=t),u&&(document.documentElement.scrollLeft=o))}function C(T,$){var I=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("object"===("undefined"===typeof $?"undefined":y($))?I=$:"number"===typeof $&&(I.duration=$),e=g.$(T),!e)return console.warn("[vue-scrollto warn]: Trying to scroll to an element that is not on the page: "+T);t=g.$(I.container||_.container),o=I.duration||_.duration,n=I.easing||_.easing,r=I.offset||_.offset,a=I.hasOwnProperty("force")?!1!==I.force:_.force,i=I.hasOwnProperty("cancelable")?!1!==I.cancelable:_.cancelable,c=I.onStart||_.onStart,s=I.onDone||_.onDone,l=I.onCancel||_.onCancel,u=void 0===I.x?_.x:I.x,d=void 0===I.y?_.y:I.y;var E=g.cumulativeOffset(t),P=g.cumulativeOffset(e);if("function"===typeof r&&(r=r()),p=R(t),b=P.top-E.top+r,f=A(t),v=P.left-E.left+r,S=!1,O=b-p,w=v-f,!a){var C=p,V=C+t.offsetHeight,L=b,N=L+e.offsetHeight;if(L>=C&&N<=V)return}return"string"===typeof n&&(n=h[n]||h["ease"]),x=m.apply(m,n),O||w?(c&&c(e),g.on(t,j,D,{passive:!0}),window.requestAnimationFrame(F),function(){k=null,S=!0}):void 0}return C},k=S(),D=[];function x(e){for(var t=0;t<D.length;++t)if(D[t].el===e)return D.splice(t,1),!0;return!1}function T(e){for(var t=0;t<D.length;++t)if(D[t].el===e)return D[t]}function $(e){var t=T(e);return t||(D.push(t={el:e,binding:{}}),t)}function I(e){e.preventDefault();var t=$(this).binding;if("string"===typeof t.value)return k(t.value);k(t.value.el||t.value.element,t.value)}var R={bind:function(e,t){$(e).binding=t,g.on(e,"click",I)},unbind:function(e){x(e),g.off(e,"click",I)},update:function(e,t){$(e).binding=t},scrollTo:k,bindings:D},A=function(e,t){t&&O(t),e.directive("scroll-to",R),e.prototype.$scrollTo=R.scrollTo};return"undefined"!==typeof window&&window.Vue&&(window.VueScrollTo=R,window.VueScrollTo.setDefaults=O,window.Vue.use(A)),R.install=A,R}))}}]);