├── dist ├── css │ └── field.css ├── js │ ├── field.js.LICENSE.txt │ └── field.js └── mix-manifest.json ├── resources ├── sass │ └── field.scss └── js │ ├── components │ ├── IndexField.vue │ ├── DetailField.vue │ ├── mixin.js │ └── FormField.vue │ └── field.js ├── mix-manifest.json ├── webpack.mix.js ├── package.json ├── composer.json ├── src ├── FieldServiceProvider.php └── Money.php ├── nova.mix.js └── README.md /dist/css/field.css: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /resources/sass/field.scss: -------------------------------------------------------------------------------- 1 | // Nova Tool CSS 2 | -------------------------------------------------------------------------------- /dist/js/field.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * vuex v4.0.2 3 | * (c) 2021 Evan You 4 | * @license MIT 5 | */ 6 | -------------------------------------------------------------------------------- /dist/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/field.js": "/js/field.js", 3 | "/css/field.css": "/css/field.css" 4 | } 5 | -------------------------------------------------------------------------------- /mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/dist/js/field.js": "/dist/js/field.js", 3 | "/dist/css/field.css": "/dist/css/field.css" 4 | } 5 | -------------------------------------------------------------------------------- /resources/js/components/IndexField.vue: -------------------------------------------------------------------------------- 1 | 2 | {{ formattedValue }} 3 | 4 | 5 | 13 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | let mix = require('laravel-mix') 2 | 3 | require('./nova.mix') 4 | 5 | mix 6 | .setPublicPath('dist') 7 | .js('resources/js/field.js', 'js') 8 | .sass('resources/sass/field.scss', 'css') 9 | .vue({ version: 3 }) 10 | .nova('vyuldashev/nova-money-field') 11 | -------------------------------------------------------------------------------- /resources/js/field.js: -------------------------------------------------------------------------------- 1 | Nova.booting((Vue, router) => { 2 | Vue.component('index-nova-money-field', require('./components/IndexField').default); 3 | Vue.component('detail-nova-money-field', require('./components/DetailField').default); 4 | Vue.component('form-nova-money-field', require('./components/FormField').default); 5 | }) 6 | -------------------------------------------------------------------------------- /resources/js/components/DetailField.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ formattedValue }} 5 | 6 | 7 | 8 | 9 | 17 | -------------------------------------------------------------------------------- /resources/js/components/mixin.js: -------------------------------------------------------------------------------- 1 | export default { 2 | computed: { 3 | fieldValue() { 4 | return this.field.displayedAs || this.field.value 5 | }, 6 | 7 | formattedValue() { 8 | if (this.fieldValue === undefined || this.fieldValue === null) { 9 | return '-'; 10 | } 11 | 12 | return this.fieldValue.toLocaleString(this.field.locale, { 13 | style: 'currency', 14 | currency: this.field.currency, 15 | minimumFractionDigits: 2, 16 | maximumFractionDigits: this.field.subUnits 17 | }); 18 | }, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "mix", 6 | "watch": "mix watch", 7 | "watch-poll": "mix watch -- --watch-options-poll=1000", 8 | "hot": "mix watch --hot", 9 | "prod": "npm run production", 10 | "production": "mix --production", 11 | "nova:install": "npm --prefix='../../vendor/laravel/nova' ci" 12 | }, 13 | "devDependencies": { 14 | "@vue/compiler-sfc": "^3.2.22", 15 | "laravel-mix": "^6.0.41", 16 | "resolve-url-loader": "^5.0.0", 17 | "sass": "^1.51.0", 18 | "sass-loader": "^12.6.0", 19 | "vue-loader": "^16.8.3" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vyuldashev/nova-money-field", 3 | "description": "A Laravel Nova field for Money.", 4 | "keywords": [ 5 | "laravel", 6 | "nova", 7 | "nova-4" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^8.0", 12 | "laravel/nova": "^4.0", 13 | "moneyphp/money": "^3.1|^4.0" 14 | }, 15 | "autoload": { 16 | "psr-4": { 17 | "Vyuldashev\\NovaMoneyField\\": "src/" 18 | } 19 | }, 20 | "extra": { 21 | "laravel": { 22 | "providers": [ 23 | "Vyuldashev\\NovaMoneyField\\FieldServiceProvider" 24 | ] 25 | } 26 | }, 27 | "config": { 28 | "sort-packages": true 29 | }, 30 | "minimum-stability": "dev", 31 | "prefer-stable": true 32 | } 33 | -------------------------------------------------------------------------------- /src/FieldServiceProvider.php: -------------------------------------------------------------------------------- 1 | locale('ru-RU'), 43 | ``` 44 | 45 | If you store money values in database in minor units use `storedInMinorUnits` method. Field will automatically convert minor units to base value for displaying and to minor units for storing: 46 | 47 | ```php 48 | Money::make('Balance', 'EUR')->storedInMinorUnits(), 49 | ``` 50 | 51 | If you need to use a name that doesn't convert to the column name (eg 'Balance' as name and `remaining_balance` as column) you can pass this as the 3rd argument to the make/constructor. 52 | 53 | Please Note: that this, along with all field column names, should be present and usable within your model class else you may encounter SQL errors. 54 | 55 | ```php 56 | Money::make('Balance', 'EUR', 'remaining_balance'), 57 | ``` 58 | 59 | -------------------------------------------------------------------------------- /src/Money.php: -------------------------------------------------------------------------------- 1 | withMeta([ 28 | 'currency' => $currency, 29 | 'subUnits' => $this->subunits($currency), 30 | ]); 31 | 32 | $this->step(1 / $this->minorUnit($currency)); 33 | 34 | $this 35 | ->resolveUsing(function ($value) use ($currency, $resolveCallback) { 36 | if ($resolveCallback !== null) { 37 | $value = call_user_func_array($resolveCallback, func_get_args()); 38 | } 39 | 40 | return $this->inMinorUnits ? $value / $this->minorUnit($currency) : (float) $value; 41 | }) 42 | ->displayUsing(function ($value) use ($currency) { 43 | return $this->inMinorUnits ? $value / $this->minorUnit($currency) : (float) $value; 44 | }) 45 | ->fillUsing(function (NovaRequest $request, $model, $attribute, $requestAttribute) use ($currency) { 46 | $value = $request[$requestAttribute]; 47 | 48 | if ($this->inMinorUnits) { 49 | $value *= $this->minorUnit($currency); 50 | } 51 | 52 | $model->{$attribute} = $value; 53 | }); 54 | } 55 | 56 | /** 57 | * The value in database is store in minor units (cents for dollars). 58 | */ 59 | public function storedInMinorUnits() 60 | { 61 | $this->inMinorUnits = true; 62 | 63 | return $this; 64 | } 65 | 66 | public function locale($locale) 67 | { 68 | return $this->withMeta(['locale' => $locale]); 69 | } 70 | 71 | public function subUnits(string $currency) 72 | { 73 | return (new AggregateCurrencies([ 74 | new ISOCurrencies(), 75 | new BitcoinCurrencies(), 76 | ]))->subunitFor(new Currency($currency)); 77 | } 78 | 79 | public function minorUnit($currency) 80 | { 81 | return 10 ** $this->subUnits($currency); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /resources/js/components/FormField.vue: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | {{ currentField.currency }} 11 | 12 | 21 | 22 | 23 | 24 | 25 | 26 | 88 | -------------------------------------------------------------------------------- /dist/js/field.js: -------------------------------------------------------------------------------- 1 | /*! For license information please see field.js.LICENSE.txt */ 2 | (()=>{var e,t={5691:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n={computed:{fieldValue:function(){return this.field.displayedAs||this.field.value},formattedValue:function(){return void 0===this.fieldValue||null===this.fieldValue?"-":this.fieldValue.toLocaleString(this.field.locale,{style:"currency",currency:this.field.currency,minimumFractionDigits:2,maximumFractionDigits:this.field.subUnits})}}}},5757:(e,t,r)=>{Nova.booting((function(e,t){e.component("index-nova-money-field",r(6009).Z),e.component("detail-nova-money-field",r(4365).Z),e.component("form-nova-money-field",r(4314).Z)}))},9129:()=>{},3744:(e,t)=>{"use strict";t.Z=(e,t)=>{const r=e.__vccOpts||e;for(const[e,n]of t)r[e]=n;return r}},4365:(e,t,r)=>{"use strict";r.d(t,{Z:()=>a});var n=r(311),o={class:"text-90"};const i={props:["resource","resourceName","resourceId","field"],mixins:[r(5691).Z]};const a=(0,r(3744).Z)(i,[["render",function(e,t,r,i,a,s){var u=(0,n.resolveComponent)("PanelItem");return(0,n.openBlock)(),(0,n.createBlock)(u,{field:r.field},{value:(0,n.withCtx)((function(){return[(0,n.createElementVNode)("p",o,(0,n.toDisplayString)(e.formattedValue),1)]})),_:1},8,["field"])}]])},4314:(e,t,r)=>{"use strict";r.d(t,{Z:()=>Ne});var n=r(311),o={class:"flex flex-wrap items-stretch w-full relative"},i={class:"flex -mr-px"},a={class:"flex items-center bg-gray-100 rounded rounded-r-none px-3 whitespace-no-wrap text-sm form-control form-input-bordered"},s=["value","id","disabled"];var u=r(3906),c=r.n(u),l={preventInitialLoading:{type:Boolean,default:!1},showHelpText:{type:Boolean,default:!1},shownViaNewRelationModal:{type:Boolean,default:!1},resourceId:{type:[Number,String]},resourceName:{type:String},relatedResourceId:{type:[Number,String]},relatedResourceName:{type:String},field:{type:Object,required:!0},viaResource:{type:String,required:!1},viaResourceId:{type:[String,Number],required:!1},viaRelationship:{type:String,required:!1},relationshipType:{type:String,default:""},shouldOverrideMeta:{type:Boolean,default:!1},disablePagination:{type:Boolean,default:!1},clickAction:{type:String,default:"view",validator:function(e){return["edit","select","ignore","detail"].includes(e)}},mode:{type:String,default:"form",validator:function(e){return["form","modal"].includes(e)}}};function f(e){return c()(l,e)}function p(){return"undefined"!=typeof navigator&&"undefined"!=typeof window?window:void 0!==r.g?r.g:{}}const d="function"==typeof Proxy;let h,y;function v(){return void 0!==h||("undefined"!=typeof window&&window.performance?(h=!0,y=window.performance):void 0!==r.g&&(null===(e=r.g.perf_hooks)||void 0===e?void 0:e.performance)?(h=!0,y=r.g.perf_hooks.performance):h=!1),h?y.now():Date.now();var e}class m{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const r={};if(e.settings)for(const t in e.settings){const n=e.settings[t];r[t]=n.defaultValue}const n=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},r);try{const e=localStorage.getItem(n),t=JSON.parse(e);Object.assign(o,t)}catch(e){}this.fallbacks={getSettings:()=>o,setSettings(e){try{localStorage.setItem(n,JSON.stringify(e))}catch(e){}o=e},now:()=>v()},t&&t.on("plugin:settings:set",((e,t)=>{e===this.plugin.id&&this.fallbacks.setSettings(t)})),this.proxiedOn=new Proxy({},{get:(e,t)=>this.target?this.target.on[t]:(...e)=>{this.onQueue.push({method:t,args:e})}}),this.proxiedTarget=new Proxy({},{get:(e,t)=>this.target?this.target[t]:"on"===t?this.proxiedOn:Object.keys(this.fallbacks).includes(t)?(...e)=>(this.targetQueue.push({method:t,args:e,resolve:()=>{}}),this.fallbacks[t](...e)):(...e)=>new Promise((r=>{this.targetQueue.push({method:t,args:e,resolve:r})}))})}async setRealTarget(e){this.target=e;for(const e of this.onQueue)this.target.on[e.method](...e.args);for(const e of this.targetQueue)e.resolve(await this.target[e.method](...e.args))}}function g(e,t){const r=e,n=p(),o=p().__VUE_DEVTOOLS_GLOBAL_HOOK__,i=d&&r.enableEarlyProxy;if(!o||!n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__&&i){const e=i?new m(r,o):null;(n.__VUE_DEVTOOLS_PLUGINS__=n.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:r,setupFn:t,proxy:e}),e&&t(e.proxiedTarget)}else o.emit("devtools-plugin:setup",e,t)}var b="store";function w(e,t){Object.keys(e).forEach((function(r){return t(e[r],r)}))}function O(e){return null!==e&&"object"==typeof e}function j(e,t,r){return t.indexOf(e)<0&&(r&&r.prepend?t.unshift(e):t.push(e)),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}}function x(e,t){e._actions=Object.create(null),e._mutations=Object.create(null),e._wrappedGetters=Object.create(null),e._modulesNamespaceMap=Object.create(null);var r=e.state;_(e,r,[],e._modules.root,!0),S(e,r,t)}function S(e,t,r){var o=e._state;e.getters={},e._makeLocalGettersCache=Object.create(null);var i=e._wrappedGetters,a={};w(i,(function(t,r){a[r]=function(e,t){return function(){return e(t)}}(t,e),Object.defineProperty(e.getters,r,{get:function(){return a[r]()},enumerable:!0})})),e._state=(0,n.reactive)({data:t}),e.strict&&function(e){(0,n.watch)((function(){return e._state.data}),(function(){0}),{deep:!0,flush:"sync"})}(e),o&&r&&e._withCommit((function(){o.data=null}))}function _(e,t,r,n,o){var i=!r.length,a=e._modules.getNamespace(r);if(n.namespaced&&(e._modulesNamespaceMap[a],e._modulesNamespaceMap[a]=n),!i&&!o){var s=E(t,r.slice(0,-1)),u=r[r.length-1];e._withCommit((function(){s[u]=n.state}))}var c=n.context=function(e,t,r){var n=""===t,o={dispatch:n?e.dispatch:function(r,n,o){var i=A(r,n,o),a=i.payload,s=i.options,u=i.type;return s&&s.root||(u=t+u),e.dispatch(u,a)},commit:n?e.commit:function(r,n,o){var i=A(r,n,o),a=i.payload,s=i.options,u=i.type;s&&s.root||(u=t+u),e.commit(u,a,s)}};return Object.defineProperties(o,{getters:{get:n?function(){return e.getters}:function(){return P(e,t)}},state:{get:function(){return E(e.state,r)}}}),o}(e,a,r);n.forEachMutation((function(t,r){!function(e,t,r,n){(e._mutations[t]||(e._mutations[t]=[])).push((function(t){r.call(e,n.state,t)}))}(e,a+r,t,c)})),n.forEachAction((function(t,r){var n=t.root?r:a+r,o=t.handler||t;!function(e,t,r,n){(e._actions[t]||(e._actions[t]=[])).push((function(t){var o,i=r.call(e,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:e.getters,rootState:e.state},t);return(o=i)&&"function"==typeof o.then||(i=Promise.resolve(i)),e._devtoolHook?i.catch((function(t){throw e._devtoolHook.emit("vuex:error",t),t})):i}))}(e,n,o,c)})),n.forEachGetter((function(t,r){!function(e,t,r,n){if(e._wrappedGetters[t])return void 0;e._wrappedGetters[t]=function(e){return r(n.state,n.getters,e.state,e.getters)}}(e,a+r,t,c)})),n.forEachChild((function(n,i){_(e,t,r.concat(i),n,o)}))}function P(e,t){if(!e._makeLocalGettersCache[t]){var r={},n=t.length;Object.keys(e.getters).forEach((function(o){if(o.slice(0,n)===t){var i=o.slice(n);Object.defineProperty(r,i,{get:function(){return e.getters[o]},enumerable:!0})}})),e._makeLocalGettersCache[t]=r}return e._makeLocalGettersCache[t]}function E(e,t){return t.reduce((function(e,t){return e[t]}),e)}function A(e,t,r){return O(e)&&e.type&&(r=t,t=e,e=e.type),{type:e,payload:t,options:r}}var k="vuex:mutations",F="vuex:actions",I="vuex",N=0;function T(e,t){g({id:"org.vuejs.vuex",app:e,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:["vuex bindings"]},(function(r){r.addTimelineLayer({id:k,label:"Vuex Mutations",color:C}),r.addTimelineLayer({id:F,label:"Vuex Actions",color:C}),r.addInspector({id:I,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),r.on.getInspectorTree((function(r){if(r.app===e&&r.inspectorId===I)if(r.filter){var n=[];L(n,t._modules.root,r.filter,""),r.rootNodes=n}else r.rootNodes=[D(t._modules.root,"")]})),r.on.getInspectorState((function(r){if(r.app===e&&r.inspectorId===I){var n=r.nodeId;P(t,n),r.state=function(e,t,r){t="root"===r?t:t[r];var n=Object.keys(t),o={state:Object.keys(e.state).map((function(t){return{key:t,editable:!0,value:e.state[t]}}))};if(n.length){var i=function(e){var t={};return Object.keys(e).forEach((function(r){var n=r.split("/");if(n.length>1){var o=t,i=n.pop();n.forEach((function(e){o[e]||(o[e]={_custom:{value:{},display:e,tooltip:"Module",abstract:!0}}),o=o[e]._custom.value})),o[i]=V((function(){return e[r]}))}else t[r]=V((function(){return e[r]}))})),t}(t);o.getters=Object.keys(i).map((function(e){return{key:e.endsWith("/")?M(e):e,editable:!1,value:V((function(){return i[e]}))}}))}return o}((o=t._modules,(a=(i=n).split("/").filter((function(e){return e}))).reduce((function(e,t,r){var n=e[t];if(!n)throw new Error('Missing module "'+t+'" for path "'+i+'".');return r===a.length-1?n:n._children}),"root"===i?o:o.root._children)),"root"===n?t.getters:t._makeLocalGettersCache,n)}var o,i,a})),r.on.editInspectorState((function(r){if(r.app===e&&r.inspectorId===I){var n=r.nodeId,o=r.path;"root"!==n&&(o=n.split("/").filter(Boolean).concat(o)),t._withCommit((function(){r.set(t._state.data,o,r.state.value)}))}})),t.subscribe((function(e,t){var n={};e.payload&&(n.payload=e.payload),n.state=t,r.notifyComponentUpdate(),r.sendInspectorTree(I),r.sendInspectorState(I),r.addTimelineEvent({layerId:k,event:{time:Date.now(),title:e.type,data:n}})})),t.subscribeAction({before:function(e,t){var n={};e.payload&&(n.payload=e.payload),e._id=N++,e._time=Date.now(),n.state=t,r.addTimelineEvent({layerId:F,event:{time:e._time,title:e.type,groupId:e._id,subtitle:"start",data:n}})},after:function(e,t){var n={},o=Date.now()-e._time;n.duration={_custom:{type:"duration",display:o+"ms",tooltip:"Action duration",value:o}},e.payload&&(n.payload=e.payload),n.state=t,r.addTimelineEvent({layerId:F,event:{time:Date.now(),title:e.type,groupId:e._id,subtitle:"end",data:n}})}})}))}var C=8702998,R={label:"namespaced",textColor:16777215,backgroundColor:6710886};function M(e){return e&&"root"!==e?e.split("/").slice(-2,-1)[0]:"Root"}function D(e,t){return{id:t||"root",label:M(t),tags:e.namespaced?[R]:[],children:Object.keys(e._children).map((function(r){return D(e._children[r],t+r+"/")}))}}function L(e,t,r,n){n.includes(r)&&e.push({id:n||"root",label:n.endsWith("/")?n.slice(0,n.length-1):n||"Root",tags:t.namespaced?[R]:[]}),Object.keys(t._children).forEach((function(o){L(e,t._children[o],r,n+o+"/")}))}function V(e){try{return e()}catch(e){return e}}var U=function(e,t){this.runtime=t,this._children=Object.create(null),this._rawModule=e;var r=e.state;this.state=("function"==typeof r?r():r)||{}},B={namespaced:{configurable:!0}};B.namespaced.get=function(){return!!this._rawModule.namespaced},U.prototype.addChild=function(e,t){this._children[e]=t},U.prototype.removeChild=function(e){delete this._children[e]},U.prototype.getChild=function(e){return this._children[e]},U.prototype.hasChild=function(e){return e in this._children},U.prototype.update=function(e){this._rawModule.namespaced=e.namespaced,e.actions&&(this._rawModule.actions=e.actions),e.mutations&&(this._rawModule.mutations=e.mutations),e.getters&&(this._rawModule.getters=e.getters)},U.prototype.forEachChild=function(e){w(this._children,e)},U.prototype.forEachGetter=function(e){this._rawModule.getters&&w(this._rawModule.getters,e)},U.prototype.forEachAction=function(e){this._rawModule.actions&&w(this._rawModule.actions,e)},U.prototype.forEachMutation=function(e){this._rawModule.mutations&&w(this._rawModule.mutations,e)},Object.defineProperties(U.prototype,B);var $=function(e){this.register([],e,!1)};function q(e,t,r){if(t.update(r),r.modules)for(var n in r.modules){if(!t.getChild(n))return void 0;q(e.concat(n),t.getChild(n),r.modules[n])}}$.prototype.get=function(e){return e.reduce((function(e,t){return e.getChild(t)}),this.root)},$.prototype.getNamespace=function(e){var t=this.root;return e.reduce((function(e,r){return e+((t=t.getChild(r)).namespaced?r+"/":"")}),"")},$.prototype.update=function(e){q([],this.root,e)},$.prototype.register=function(e,t,r){var n=this;void 0===r&&(r=!0);var o=new U(t,r);0===e.length?this.root=o:this.get(e.slice(0,-1)).addChild(e[e.length-1],o);t.modules&&w(t.modules,(function(t,o){n.register(e.concat(o),t,r)}))},$.prototype.unregister=function(e){var t=this.get(e.slice(0,-1)),r=e[e.length-1],n=t.getChild(r);n&&n.runtime&&t.removeChild(r)},$.prototype.isRegistered=function(e){var t=this.get(e.slice(0,-1)),r=e[e.length-1];return!!t&&t.hasChild(r)};var W=function(e){var t=this;void 0===e&&(e={});var r=e.plugins;void 0===r&&(r=[]);var n=e.strict;void 0===n&&(n=!1);var o=e.devtools;this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new $(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._devtools=o;var i=this,a=this.dispatch,s=this.commit;this.dispatch=function(e,t){return a.call(i,e,t)},this.commit=function(e,t,r){return s.call(i,e,t,r)},this.strict=n;var u=this._modules.root.state;_(this,u,[],this._modules.root),S(this,u),r.forEach((function(e){return e(t)}))},z={state:{configurable:!0}};W.prototype.install=function(e,t){e.provide(t||b,this),e.config.globalProperties.$store=this,void 0!==this._devtools&&this._devtools&&T(e,this)},z.state.get=function(){return this._state.data},z.state.set=function(e){0},W.prototype.commit=function(e,t,r){var n=this,o=A(e,t,r),i=o.type,a=o.payload,s=(o.options,{type:i,payload:a}),u=this._mutations[i];u&&(this._withCommit((function(){u.forEach((function(e){e(a)}))})),this._subscribers.slice().forEach((function(e){return e(s,n.state)})))},W.prototype.dispatch=function(e,t){var r=this,n=A(e,t),o=n.type,i=n.payload,a={type:o,payload:i},s=this._actions[o];if(s){try{this._actionSubscribers.slice().filter((function(e){return e.before})).forEach((function(e){return e.before(a,r.state)}))}catch(e){0}var u=s.length>1?Promise.all(s.map((function(e){return e(i)}))):s[0](i);return new Promise((function(e,t){u.then((function(t){try{r._actionSubscribers.filter((function(e){return e.after})).forEach((function(e){return e.after(a,r.state)}))}catch(e){0}e(t)}),(function(e){try{r._actionSubscribers.filter((function(e){return e.error})).forEach((function(t){return t.error(a,r.state,e)}))}catch(e){0}t(e)}))}))}},W.prototype.subscribe=function(e,t){return j(e,this._subscribers,t)},W.prototype.subscribeAction=function(e,t){return j("function"==typeof e?{before:e}:e,this._actionSubscribers,t)},W.prototype.watch=function(e,t,r){var o=this;return(0,n.watch)((function(){return e(o.state,o.getters)}),t,Object.assign({},r))},W.prototype.replaceState=function(e){var t=this;this._withCommit((function(){t._state.data=e}))},W.prototype.registerModule=function(e,t,r){void 0===r&&(r={}),"string"==typeof e&&(e=[e]),this._modules.register(e,t),_(this,this.state,e,this._modules.get(e),r.preserveState),S(this,this.state)},W.prototype.unregisterModule=function(e){var t=this;"string"==typeof e&&(e=[e]),this._modules.unregister(e),this._withCommit((function(){delete E(t.state,e.slice(0,-1))[e[e.length-1]]})),x(this)},W.prototype.hasModule=function(e){return"string"==typeof e&&(e=[e]),this._modules.isRegistered(e)},W.prototype.hotUpdate=function(e){this._modules.update(e),x(this,!0)},W.prototype._withCommit=function(e){var t=this._committing;this._committing=!0,e(),this._committing=t},Object.defineProperties(W.prototype,z);Q((function(e,t){var r={};return J(t).forEach((function(t){var n=t.key,o=t.val;r[n]=function(){var t=this.$store.state,r=this.$store.getters;if(e){var n=Z(this.$store,"mapState",e);if(!n)return;t=n.context.state,r=n.context.getters}return"function"==typeof o?o.call(this,t,r):t[o]},r[n].vuex=!0})),r}));var G=Q((function(e,t){var r={};return J(t).forEach((function(t){var n=t.key,o=t.val;r[n]=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];var n=this.$store.commit;if(e){var i=Z(this.$store,"mapMutations",e);if(!i)return;n=i.context.commit}return"function"==typeof o?o.apply(this,[n].concat(t)):n.apply(this.$store,[o].concat(t))}})),r})),H=Q((function(e,t){var r={};return J(t).forEach((function(t){var n=t.key,o=t.val;o=e+o,r[n]=function(){if(!e||Z(this.$store,"mapGetters",e))return this.$store.getters[o]},r[n].vuex=!0})),r}));Q((function(e,t){var r={};return J(t).forEach((function(t){var n=t.key,o=t.val;r[n]=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];var n=this.$store.dispatch;if(e){var i=Z(this.$store,"mapActions",e);if(!i)return;n=i.context.dispatch}return"function"==typeof o?o.apply(this,[n].concat(t)):n.apply(this.$store,[o].concat(t))}})),r}));function J(e){return function(e){return Array.isArray(e)||O(e)}(e)?Array.isArray(e)?e.map((function(e){return{key:e,val:e}})):Object.keys(e).map((function(t){return{key:t,val:e[t]}})):[]}function Q(e){return function(t,r){return"string"!=typeof t?(r=t,t=""):"/"!==t.charAt(t.length-1)&&(t+="/"),e(t,r)}}function Z(e,t,r){return e._modulesNamespaceMap[r]}var X=r(6649);function K(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 Y(e){for(var t=1;t{"use strict";r.d(t,{Z:()=>i});var n=r(311);const o={props:["resourceName","field"],mixins:[r(5691).Z]};const i=(0,r(3744).Z)(o,[["render",function(e,t,r,o,i,a){return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,(0,n.toDisplayString)(e.formattedValue),1)}]])},6649:(e,t,r)=>{function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var o=n(r(3950)),i=r(8009),a=n(r(6533));function s(){return(s=Object.assign||function(e){for(var t=1;t"+JSON.stringify(e));var r=document.createElement("html");r.innerHTML=e,r.querySelectorAll("a").forEach((function(e){return e.setAttribute("target","_top")})),this.modal=document.createElement("div"),this.modal.style.position="fixed",this.modal.style.width="100vw",this.modal.style.height="100vh",this.modal.style.padding="50px",this.modal.style.boxSizing="border-box",this.modal.style.backgroundColor="rgba(0, 0, 0, .6)",this.modal.style.zIndex=2e5,this.modal.addEventListener("click",(function(){return t.hide()}));var n=document.createElement("iframe");if(n.style.backgroundColor="white",n.style.borderRadius="5px",n.style.width="100%",n.style.height="100%",this.modal.appendChild(n),document.body.prepend(this.modal),document.body.style.overflow="hidden",!n.contentWindow)throw new Error("iframe not yet ready.");n.contentWindow.document.open(),n.contentWindow.document.write(r.outerHTML),n.contentWindow.document.close(),this.listener=this.hideOnEscape.bind(this),document.addEventListener("keydown",this.listener)},hide:function(){this.modal.outerHTML="",this.modal=null,document.body.style.overflow="visible",document.removeEventListener("keydown",this.listener)},hideOnEscape:function(e){27===e.keyCode&&this.hide()}};function l(e,t){var r;return function(){var n=arguments,o=this;clearTimeout(r),r=setTimeout((function(){return e.apply(o,[].slice.call(n))}),t)}}function f(e,t,r){for(var n in void 0===t&&(t=new FormData),void 0===r&&(r=null),e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&d(t,p(r,n),e[n]);return t}function p(e,t){return e?e+"["+t+"]":t}function d(e,t,r){return Array.isArray(r)?Array.from(r.keys()).forEach((function(n){return d(e,p(t,n.toString()),r[n])})):r instanceof Date?e.append(t,r.toISOString()):r instanceof File?e.append(t,r,r.name):r instanceof Blob?e.append(t,r):"boolean"==typeof r?e.append(t,r?"1":"0"):"string"==typeof r?e.append(t,r):"number"==typeof r?e.append(t,""+r):null==r?e.append(t,""):void f(r,e,t)}function h(e){return new URL(e.toString(),window.location.toString())}function y(e,r,n,o){void 0===o&&(o="brackets");var s=/^https?:\/\//.test(r.toString()),u=s||r.toString().startsWith("/"),c=!u&&!r.toString().startsWith("#")&&!r.toString().startsWith("?"),l=r.toString().includes("?")||e===t.n$.GET&&Object.keys(n).length,f=r.toString().includes("#"),p=new URL(r.toString(),"http://localhost");return e===t.n$.GET&&Object.keys(n).length&&(p.search=i.stringify(a(i.parse(p.search,{ignoreQueryPrefix:!0}),n),{encodeValuesOnly:!0,arrayFormat:o}),n={}),[[s?p.protocol+"//"+p.host:"",u?p.pathname:"",c?p.pathname.substring(1):"",l?p.search:"",f?p.hash:""].join(""),n]}function v(e){return(e=new URL(e.href)).hash="",e}function m(e,t){return document.dispatchEvent(new CustomEvent("inertia:"+e,t))}(u=t.n$||(t.n$={})).GET="get",u.POST="post",u.PUT="put",u.PATCH="patch",u.DELETE="delete";var g=function(e){return m("finish",{detail:{visit:e}})},b=function(e){return m("navigate",{detail:{page:e}})},w="undefined"==typeof window,O=function(){function e(){this.visitId=null}var r=e.prototype;return r.init=function(e){var t=e.resolveComponent,r=e.swapComponent;this.page=e.initialPage,this.resolveComponent=t,this.swapComponent=r,this.isBackForwardVisit()?this.handleBackForwardVisit(this.page):this.isLocationVisit()?this.handleLocationVisit(this.page):this.handleInitialPageVisit(this.page),this.setupEventListeners()},r.handleInitialPageVisit=function(e){this.page.url+=window.location.hash,this.setPage(e,{preserveState:!0}).then((function(){return b(e)}))},r.setupEventListeners=function(){window.addEventListener("popstate",this.handlePopstateEvent.bind(this)),document.addEventListener("scroll",l(this.handleScrollEvent.bind(this),100),!0)},r.scrollRegions=function(){return document.querySelectorAll("[scroll-region]")},r.handleScrollEvent=function(e){"function"==typeof e.target.hasAttribute&&e.target.hasAttribute("scroll-region")&&this.saveScrollPositions()},r.saveScrollPositions=function(){this.replaceState(s({},this.page,{scrollRegions:Array.from(this.scrollRegions()).map((function(e){return{top:e.scrollTop,left:e.scrollLeft}}))}))},r.resetScrollPositions=function(){var e;document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,this.scrollRegions().forEach((function(e){e.scrollTop=0,e.scrollLeft=0})),this.saveScrollPositions(),window.location.hash&&(null==(e=document.getElementById(window.location.hash.slice(1)))||e.scrollIntoView())},r.restoreScrollPositions=function(){var e=this;this.page.scrollRegions&&this.scrollRegions().forEach((function(t,r){var n=e.page.scrollRegions[r];n&&(t.scrollTop=n.top,t.scrollLeft=n.left)}))},r.isBackForwardVisit=function(){return window.history.state&&window.performance&&window.performance.getEntriesByType("navigation").length>0&&"back_forward"===window.performance.getEntriesByType("navigation")[0].type},r.handleBackForwardVisit=function(e){var t=this;window.history.state.version=e.version,this.setPage(window.history.state,{preserveScroll:!0,preserveState:!0}).then((function(){t.restoreScrollPositions(),b(e)}))},r.locationVisit=function(e,t){try{window.sessionStorage.setItem("inertiaLocationVisit",JSON.stringify({preserveScroll:t})),window.location.href=e.href,v(window.location).href===v(e).href&&window.location.reload()}catch(e){return!1}},r.isLocationVisit=function(){try{return null!==window.sessionStorage.getItem("inertiaLocationVisit")}catch(e){return!1}},r.handleLocationVisit=function(e){var t,r,n,o,i=this,a=JSON.parse(window.sessionStorage.getItem("inertiaLocationVisit")||"");window.sessionStorage.removeItem("inertiaLocationVisit"),e.url+=window.location.hash,e.rememberedState=null!=(t=null==(r=window.history.state)?void 0:r.rememberedState)?t:{},e.scrollRegions=null!=(n=null==(o=window.history.state)?void 0:o.scrollRegions)?n:[],this.setPage(e,{preserveScroll:a.preserveScroll,preserveState:!0}).then((function(){a.preserveScroll&&i.restoreScrollPositions(),b(e)}))},r.isLocationVisitResponse=function(e){return e&&409===e.status&&e.headers["x-inertia-location"]},r.isInertiaResponse=function(e){return null==e?void 0:e.headers["x-inertia"]},r.createVisitId=function(){return this.visitId={},this.visitId},r.cancelVisit=function(e,t){var r=t.cancelled,n=void 0!==r&&r,o=t.interrupted,i=void 0!==o&&o;!e||e.completed||e.cancelled||e.interrupted||(e.cancelToken.cancel(),e.onCancel(),e.completed=!1,e.cancelled=n,e.interrupted=i,g(e),e.onFinish(e))},r.finishVisit=function(e){e.cancelled||e.interrupted||(e.completed=!0,e.cancelled=!1,e.interrupted=!1,g(e),e.onFinish(e))},r.resolvePreserveOption=function(e,t){return"function"==typeof e?e(t):"errors"===e?Object.keys(t.props.errors||{}).length>0:e},r.visit=function(e,r){var n=this,i=void 0===r?{}:r,a=i.method,u=void 0===a?t.n$.GET:a,l=i.data,p=void 0===l?{}:l,d=i.replace,g=void 0!==d&&d,b=i.preserveScroll,w=void 0!==b&&b,O=i.preserveState,j=void 0!==O&&O,x=i.only,S=void 0===x?[]:x,_=i.headers,P=void 0===_?{}:_,E=i.errorBag,A=void 0===E?"":E,k=i.forceFormData,F=void 0!==k&&k,I=i.onCancelToken,N=void 0===I?function(){}:I,T=i.onBefore,C=void 0===T?function(){}:T,R=i.onStart,M=void 0===R?function(){}:R,D=i.onProgress,L=void 0===D?function(){}:D,V=i.onFinish,U=void 0===V?function(){}:V,B=i.onCancel,$=void 0===B?function(){}:B,q=i.onSuccess,W=void 0===q?function(){}:q,z=i.onError,G=void 0===z?function(){}:z,H=i.queryStringArrayFormat,J=void 0===H?"brackets":H,Q="string"==typeof e?h(e):e;if(!function e(t){return t instanceof File||t instanceof Blob||t instanceof FileList&&t.length>0||t instanceof FormData&&Array.from(t.values()).some((function(t){return e(t)}))||"object"==typeof t&&null!==t&&Object.values(t).some((function(t){return e(t)}))}(p)&&!F||p instanceof FormData||(p=f(p)),!(p instanceof FormData)){var Z=y(u,Q,p,J),X=Z[1];Q=h(Z[0]),p=X}var K={url:Q,method:u,data:p,replace:g,preserveScroll:w,preserveState:j,only:S,headers:P,errorBag:A,forceFormData:F,queryStringArrayFormat:J,cancelled:!1,completed:!1,interrupted:!1};if(!1!==C(K)&&function(e){return m("before",{cancelable:!0,detail:{visit:e}})}(K)){this.activeVisit&&this.cancelVisit(this.activeVisit,{interrupted:!0}),this.saveScrollPositions();var Y=this.createVisitId();this.activeVisit=s({},K,{onCancelToken:N,onBefore:C,onStart:M,onProgress:L,onFinish:U,onCancel:$,onSuccess:W,onError:G,queryStringArrayFormat:J,cancelToken:o.CancelToken.source()}),N({cancel:function(){n.activeVisit&&n.cancelVisit(n.activeVisit,{cancelled:!0})}}),function(e){m("start",{detail:{visit:e}})}(K),M(K),o({method:u,url:v(Q).href,data:u===t.n$.GET?{}:p,params:u===t.n$.GET?p:{},cancelToken:this.activeVisit.cancelToken.token,headers:s({},P,{Accept:"text/html, application/xhtml+xml","X-Requested-With":"XMLHttpRequest","X-Inertia":!0},S.length?{"X-Inertia-Partial-Component":this.page.component,"X-Inertia-Partial-Data":S.join(",")}:{},A&&A.length?{"X-Inertia-Error-Bag":A}:{},this.page.version?{"X-Inertia-Version":this.page.version}:{}),onUploadProgress:function(e){p instanceof FormData&&(e.percentage=Math.round(e.loaded/e.total*100),function(e){m("progress",{detail:{progress:e}})}(e),L(e))}}).then((function(e){var t;if(!n.isInertiaResponse(e))return Promise.reject({response:e});var r=e.data;S.length&&r.component===n.page.component&&(r.props=s({},n.page.props,r.props)),w=n.resolvePreserveOption(w,r),(j=n.resolvePreserveOption(j,r))&&null!=(t=window.history.state)&&t.rememberedState&&r.component===n.page.component&&(r.rememberedState=window.history.state.rememberedState);var o=Q,i=h(r.url);return o.hash&&!i.hash&&v(o).href===i.href&&(i.hash=o.hash,r.url=i.href),n.setPage(r,{visitId:Y,replace:g,preserveScroll:w,preserveState:j})})).then((function(){var e=n.page.props.errors||{};if(Object.keys(e).length>0){var t=A?e[A]?e[A]:{}:e;return function(e){m("error",{detail:{errors:e}})}(t),G(t)}return m("success",{detail:{page:n.page}}),W(n.page)})).catch((function(e){if(n.isInertiaResponse(e.response))return n.setPage(e.response.data,{visitId:Y});if(n.isLocationVisitResponse(e.response)){var t=h(e.response.headers["x-inertia-location"]),r=Q;r.hash&&!t.hash&&v(r).href===t.href&&(t.hash=r.hash),n.locationVisit(t,!0===w)}else{if(!e.response)return Promise.reject(e);m("invalid",{cancelable:!0,detail:{response:e.response}})&&c.show(e.response.data)}})).then((function(){n.activeVisit&&n.finishVisit(n.activeVisit)})).catch((function(e){if(!o.isCancel(e)){var t=m("exception",{cancelable:!0,detail:{exception:e}});if(n.activeVisit&&n.finishVisit(n.activeVisit),t)return Promise.reject(e)}}))}},r.setPage=function(e,t){var r=this,n=void 0===t?{}:t,o=n.visitId,i=void 0===o?this.createVisitId():o,a=n.replace,s=void 0!==a&&a,u=n.preserveScroll,c=void 0!==u&&u,l=n.preserveState,f=void 0!==l&&l;return Promise.resolve(this.resolveComponent(e.component)).then((function(t){i===r.visitId&&(e.scrollRegions=e.scrollRegions||[],e.rememberedState=e.rememberedState||{},(s=s||h(e.url).href===window.location.href)?r.replaceState(e):r.pushState(e),r.swapComponent({component:t,page:e,preserveState:f}).then((function(){c||r.resetScrollPositions(),s||b(e)})))}))},r.pushState=function(e){this.page=e,window.history.pushState(e,"",e.url)},r.replaceState=function(e){this.page=e,window.history.replaceState(e,"",e.url)},r.handlePopstateEvent=function(e){var t=this;if(null!==e.state){var r=e.state,n=this.createVisitId();Promise.resolve(this.resolveComponent(r.component)).then((function(e){n===t.visitId&&(t.page=r,t.swapComponent({component:e,page:r,preserveState:!1}).then((function(){t.restoreScrollPositions(),b(r)})))}))}else{var o=h(this.page.url);o.hash=window.location.hash,this.replaceState(s({},this.page,{url:o.href})),this.resetScrollPositions()}},r.get=function(e,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(e,s({},n,{method:t.n$.GET,data:r}))},r.reload=function(e){return void 0===e&&(e={}),this.visit(window.location.href,s({},e,{preserveScroll:!0,preserveState:!0}))},r.replace=function(e,t){var r;return void 0===t&&(t={}),console.warn("Inertia.replace() has been deprecated and will be removed in a future release. Please use Inertia."+(null!=(r=t.method)?r:"get")+"() instead."),this.visit(e,s({preserveState:!0},t,{replace:!0}))},r.post=function(e,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(e,s({preserveState:!0},n,{method:t.n$.POST,data:r}))},r.put=function(e,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(e,s({preserveState:!0},n,{method:t.n$.PUT,data:r}))},r.patch=function(e,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),this.visit(e,s({preserveState:!0},n,{method:t.n$.PATCH,data:r}))},r.delete=function(e,r){return void 0===r&&(r={}),this.visit(e,s({preserveState:!0},r,{method:t.n$.DELETE}))},r.remember=function(e,t){var r,n;void 0===t&&(t="default"),w||this.replaceState(s({},this.page,{rememberedState:s({},null==(r=this.page)?void 0:r.rememberedState,(n={},n[t]=e,n))}))},r.restore=function(e){var t,r;if(void 0===e&&(e="default"),!w)return null==(t=window.history.state)||null==(r=t.rememberedState)?void 0:r[e]},r.on=function(e,t){var r=function(e){var r=t(e);e.cancelable&&!e.defaultPrevented&&!1===r&&e.preventDefault()};return document.addEventListener("inertia:"+e,r),function(){return document.removeEventListener("inertia:"+e,r)}},e}(),j={buildDOMElement:function(e){var t=document.createElement("template");t.innerHTML=e;var r=t.content.firstChild;if(!e.startsWith("
{{ formattedValue }}