(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3343c8a7"],{4127:function(e,t,r){"use strict";var n=r("d233"),a=r("b313"),i={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},o=Date.prototype.toISOString,s={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(e){return o.call(e)},skipNulls:!1,strictNullHandling:!1},c=function e(t,r,a,i,o,c,l,u,p,d,f,h){var y=t;if("function"===typeof l)y=l(r,y);else if(y instanceof Date)y=d(y);else if(null===y){if(i)return c&&!h?c(r,s.encoder):r;y=""}if("string"===typeof y||"number"===typeof y||"boolean"===typeof y||n.isBuffer(y)){if(c){var m=h?r:c(r,s.encoder);return[f(m)+"="+f(c(y,s.encoder))]}return[f(r)+"="+f(String(y))]}var g,b=[];if("undefined"===typeof y)return b;if(Array.isArray(l))g=l;else{var v=Object.keys(y);g=u?v.sort(u):v}for(var O=0;O<g.length;++O){var j=g[O];o&&null===y[j]||(b=Array.isArray(y)?b.concat(e(y[j],a(r,j),a,i,o,c,l,u,p,d,f,h)):b.concat(e(y[j],r+(p?"."+j:"["+j+"]"),a,i,o,c,l,u,p,d,f,h)))}return b};e.exports=function(e,t){var r=e,o=t?n.assign({},t):{};if(null!==o.encoder&&void 0!==o.encoder&&"function"!==typeof o.encoder)throw new TypeError("Encoder has to be a function.");var l="undefined"===typeof o.delimiter?s.delimiter:o.delimiter,u="boolean"===typeof o.strictNullHandling?o.strictNullHandling:s.strictNullHandling,p="boolean"===typeof o.skipNulls?o.skipNulls:s.skipNulls,d="boolean"===typeof o.encode?o.encode:s.encode,f="function"===typeof o.encoder?o.encoder:s.encoder,h="function"===typeof o.sort?o.sort:null,y="undefined"!==typeof o.allowDots&&o.allowDots,m="function"===typeof o.serializeDate?o.serializeDate:s.serializeDate,g="boolean"===typeof o.encodeValuesOnly?o.encodeValuesOnly:s.encodeValuesOnly;if("undefined"===typeof o.format)o.format=a["default"];else if(!Object.prototype.hasOwnProperty.call(a.formatters,o.format))throw new TypeError("Unknown format option provided.");var b,v,O=a.formatters[o.format];"function"===typeof o.filter?(v=o.filter,r=v("",r)):Array.isArray(o.filter)&&(v=o.filter,b=v);var j,w=[];if("object"!==typeof r||null===r)return"";j=o.arrayFormat in i?o.arrayFormat:"indices"in o?o.indices?"indices":"repeat":"indices";var P=i[j];b||(b=Object.keys(r)),h&&b.sort(h);for(var x=0;x<b.length;++x){var S=b[x];p&&null===r[S]||(w=w.concat(c(r[S],S,P,u,p,d?f:null,v,h,y,m,O,g)))}var _=w.join(l),A=!0===o.addQueryPrefix?"?":"";return _.length>0?A+_:""}},4328:function(e,t,r){"use strict";var n=r("4127"),a=r("9e6a"),i=r("b313");e.exports={formats:i,parse:a,stringify:n}},"574e":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e._self._c;return t("div",[t("div",{directives:[{name:"show",rawName:"v-show",value:!e.hasGenerated,expression:"!hasGenerated"}]},[t("breadcrumbs",{staticClass:"mb-3",attrs:{breadcrumbs:e.breadcrumbs}}),t("v-container",{attrs:{fluid:"","pt-0":""}},[t("v-toolbar",{staticClass:"primary lighten-2",attrs:{flat:""}},[t("div",{staticClass:"pa-3",staticStyle:{"flex-basis":"35%"}},[t("v-autocomplete",{attrs:{label:e.$t("message.businessPartner"),placeholder:" ",box:"",items:e.businessPartnerOptions,dense:"","return-object":"","item-value":"id","item-text":"company_name"},on:{change:function(t){return e.onSupplierChange(t)}},model:{value:e.businessPartner,callback:function(t){e.businessPartner=t},expression:"businessPartner"}})],1),t("v-spacer"),e.hasSupplierSearch&&e.allowedTo("add")?t("v-btn",{on:{click:e.generate}},[e._v("\n          "+e._s(e.$t("message.generate"))+"\n        ")]):e._e()],1),t("v-data-table",{attrs:{headers:e.headers,items:e.records,loading:e.fetching,"hide-details":"","hide-actions":""},scopedSlots:e._u([{key:"items",fn:function(r){return[t("tr",[t("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[e._v(e._s(r.item.no))]),t("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[e._v("\n              "+e._s(r.item.item)+"\n              "),t("tr",[e._v("Product Name: "+e._s(r.item.product_name))]),t("tr",[e._v("Quantity: "+e._s(e.getValue(r.item,"quantity")?r.item.quantity:0))]),t("a",{attrs:{href:e.getValue(r.item.document,"url")}},[t("tr",[e._v(e._s(e.getValue(r.item.document,"filename")?"File: "+r.item.document.filename:"N/A"))])])]),t("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[e._v(e._s(r.item.vendor?e.getValue(r.item.vendor,"company_name"):"N/A"))]),t("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[e._v(e._s(r.item.tax_amount?e.formatMoney(r.item.tax_amount):0))]),t("td",{staticClass:"py-3",staticStyle:{"vertical-align":"top"}},[e._v(e._s(r.item.amount?e.formatMoney(r.item.amount):0))]),t("td",{staticClass:"py-3"},[e.hasSupplierSearch?t("v-checkbox",{model:{value:r.item.isChecked,callback:function(t){e.$set(r.item,"isChecked",t)},expression:"props.item.isChecked"}}):e._e()],1)])]}}])})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.hasGenerated,expression:"hasGenerated"}]},[t("generate-po-view",{attrs:{requestItems:e.requestItems,businessPartner:e.businessPartner},model:{value:e.hasGenerated,callback:function(t){e.hasGenerated=t},expression:"hasGenerated"}})],1)])},a=[],i=(r("8e6e"),r("456d"),r("ac6a"),r("ade3")),o=r("365c"),s=r("2f62"),c=r("4da1"),l=r("323e"),u=r.n(l),p=r("6612"),d=r.n(p),f=r("792c"),h=r("5e44");function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){Object(i["a"])(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var g=r("4328"),b={created:function(){this.fetching=!0,this.getTablesData()},components:{Breadcrumbs:h["a"],GeneratePoView:f["default"]},computed:m({},Object(s["b"])(["adminScope"])),watch:{pagination:function(){this.fetching=!0},$route:function(){this.fetching=!0},hasGenerated:function(e){0==e&&(this.hasSupplierSearch=!1,this.businessPartnerOptions=[{id:null,company_name:"All"}],this.requestItems=[],this.businessPartner={},this.record=[],this.fetching=!0,this.getTablesData())}},methods:{formatMoney:function(e){return d()(e).format("0,0.00")},getValue:function(e,t){return Object(c["j"])(e,t)},getDateTimeFromISO:function(e){return Object(c["g"])(e)},getDateFromISO:function(e){return Object(c["e"])(e)},changeSort:function(e,t){e&&(this.pagination.sortBy===t?this.pagination.descending=!this.pagination.descending:(this.pagination.sortBy=t,this.pagination.descending=!1),this.fetching=!0)},allowedTo:function(e){switch(e){case"add":return!this.$can.not("add","acl.admin.procurement.purchase-order.generate-po")}return!1},onSupplierChange:function(e){e.id?(this.hasSupplierSearch=!0,this.fetching=!0,this.getTablesData(e.id)):(this.hasSupplierSearch=!1,this.fetching=!0,this.getTablesData())},getTablesData:function(e){var t=this;console.log(e);var r=this.pagination,n=r.sortBy,a=r.descending,i=r.page;r.rowsPerPage;1==this.fetching&&(u.a.start(),o["a"].get("admin/procurement/request-order-items",{params:{page:i,sort_by:n,descending:a,project_id:this.adminScope.projectId,company_id:this.adminScope.companyId,status:"approved",vendor_id:e},paramsSerializer:function(e){return g.stringify(e,{indices:!1})}}).then((function(r){t.records=Object(c["j"])(r,"data.data"),e||t.getBusinessPartnerOptions()})).catch((function(e){})).then((function(){t.fetching=!1,u.a.done()})))},generate:function(){var e=this,t=[];this.records.forEach((function(r){1==r.isChecked&&t.push(r),e.requestItems=t})),this.requestItems.length>0&&(this.hasGenerated=!0)},getBusinessPartnerOptions:function(){var e=this;this.records.length>0&&this.records.forEach((function(t){e.isEmpty(t.vendor)||e.businessPartnerOptions.push({id:t.vendor.id,company_name:t.vendor.company_name})}))},isEmpty:function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},search:function(e){this.fetching=!0}},data:function(){return{hasGenerated:!1,hasSupplierSearch:!1,businessPartnerOptions:[{id:null,company_name:"All"}],requestItems:[],businessPartner:{},fetching:!1,records:[],totalRecords:0,filter:{},pagination:{sortBy:"no",descending:!1},headers:[{text:this.$t("message.orderNo"),value:"no"},{text:this.$t("message.item")},{text:this.$t("message.businessPartner")},{text:this.$t("message.tax")},{text:this.$t("message.amount")},{}],breadcrumbs:[{text:this.$t("message.generatePo"),disabled:!1}]}}},v=b,O=r("2877"),j=Object(O["a"])(v,n,a,!1,null,null,null);t["default"]=j.exports},"9e6a":function(e,t,r){"use strict";var n=r("d233"),a=Object.prototype.hasOwnProperty,i={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},o=function(e,t){for(var r={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,o=t.parameterLimit===1/0?void 0:t.parameterLimit,s=n.split(t.delimiter,o),c=0;c<s.length;++c){var l,u,p=s[c],d=p.indexOf("]="),f=-1===d?p.indexOf("="):d+1;-1===f?(l=t.decoder(p,i.decoder),u=t.strictNullHandling?null:""):(l=t.decoder(p.slice(0,f),i.decoder),u=t.decoder(p.slice(f+1),i.decoder)),a.call(r,l)?r[l]=[].concat(r[l]).concat(u):r[l]=u}return r},s=function(e,t,r){for(var n=t,a=e.length-1;a>=0;--a){var i,o=e[a];if("[]"===o)i=[],i=i.concat(n);else{i=r.plainObjects?Object.create(null):{};var s="["===o.charAt(0)&&"]"===o.charAt(o.length-1)?o.slice(1,-1):o,c=parseInt(s,10);!isNaN(c)&&o!==s&&String(c)===s&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(i=[],i[c]=n):i[s]=n}n=i}return n},c=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,c=i.exec(n),l=c?n.slice(0,c.index):n,u=[];if(l){if(!r.plainObjects&&a.call(Object.prototype,l)&&!r.allowPrototypes)return;u.push(l)}var p=0;while(null!==(c=o.exec(n))&&p<r.depth){if(p+=1,!r.plainObjects&&a.call(Object.prototype,c[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(c[1])}return c&&u.push("["+n.slice(c.index)+"]"),s(u,t,r)}};e.exports=function(e,t){var r=t?n.assign({},t):{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!==typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.ignoreQueryPrefix=!0===r.ignoreQueryPrefix,r.delimiter="string"===typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:i.delimiter,r.depth="number"===typeof r.depth?r.depth:i.depth,r.arrayLimit="number"===typeof r.arrayLimit?r.arrayLimit:i.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"===typeof r.decoder?r.decoder:i.decoder,r.allowDots="boolean"===typeof r.allowDots?r.allowDots:i.allowDots,r.plainObjects="boolean"===typeof r.plainObjects?r.plainObjects:i.plainObjects,r.allowPrototypes="boolean"===typeof r.allowPrototypes?r.allowPrototypes:i.allowPrototypes,r.parameterLimit="number"===typeof r.parameterLimit?r.parameterLimit:i.parameterLimit,r.strictNullHandling="boolean"===typeof r.strictNullHandling?r.strictNullHandling:i.strictNullHandling,""===e||null===e||"undefined"===typeof e)return r.plainObjects?Object.create(null):{};for(var a="string"===typeof e?o(e,r):e,s=r.plainObjects?Object.create(null):{},l=Object.keys(a),u=0;u<l.length;++u){var p=l[u],d=c(p,a[p],r);s=n.merge(s,d,r)}return n.compact(s)}},b313:function(e,t,r){"use strict";var n=String.prototype.replace,a=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,a,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},d233:function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),i=function(e){var t;while(e.length){var r=e.pop();if(t=r.obj[r.prop],Array.isArray(t)){for(var n=[],a=0;a<t.length;++a)"undefined"!==typeof t[a]&&n.push(t[a]);r.obj[r.prop]=n}}return t},o=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)"undefined"!==typeof e[n]&&(r[n]=e[n]);return r},s=function e(t,r,a){if(!r)return t;if("object"!==typeof r){if(Array.isArray(t))t.push(r);else{if("object"!==typeof t)return[t,r];(a.plainObjects||a.allowPrototypes||!n.call(Object.prototype,r))&&(t[r]=!0)}return t}if("object"!==typeof t)return[t].concat(r);var i=t;return Array.isArray(t)&&!Array.isArray(r)&&(i=o(t,a)),Array.isArray(t)&&Array.isArray(r)?(r.forEach((function(r,i){n.call(t,i)?t[i]&&"object"===typeof t[i]?t[i]=e(t[i],r,a):t.push(r):t[i]=r})),t):Object.keys(r).reduce((function(t,i){var o=r[i];return n.call(t,i)?t[i]=e(t[i],o,a):t[i]=o,t}),i)},c=function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},l=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},u=function(e){if(0===e.length)return e;for(var t="string"===typeof e?e:String(e),r="",n=0;n<t.length;++n){var i=t.charCodeAt(n);45===i||46===i||95===i||126===i||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?r+=t.charAt(n):i<128?r+=a[i]:i<2048?r+=a[192|i>>6]+a[128|63&i]:i<55296||i>=57344?r+=a[224|i>>12]+a[128|i>>6&63]+a[128|63&i]:(n+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(n)),r+=a[240|i>>18]+a[128|i>>12&63]+a[128|i>>6&63]+a[128|63&i])}return r},p=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var a=t[n],o=a.obj[a.prop],s=Object.keys(o),c=0;c<s.length;++c){var l=s[c],u=o[l];"object"===typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:o,prop:l}),r.push(u))}return i(t)},d=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},f=function(e){return null!==e&&"undefined"!==typeof e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))};e.exports={arrayToObject:o,assign:c,compact:p,decode:l,encode:u,isBuffer:f,isRegExp:d,merge:s}}}]);