wip trial
This commit is contained in:
@@ -29,6 +29,7 @@ class SettingController extends Controller
|
||||
'rotate_logs_after' => setting('rotate_logs_after') ? setting('rotate_logs_after') : null,
|
||||
'default_language' => setting('default_language', 'en'),
|
||||
'has_logo' => (bool)setting('logo'),
|
||||
'trial' => setting('trial'),
|
||||
];
|
||||
|
||||
$packages = Package::pluck('name', 'id');
|
||||
@@ -57,6 +58,7 @@ class SettingController extends Controller
|
||||
'api_token',
|
||||
'default_language',
|
||||
'rotate_logs_after',
|
||||
'trial',
|
||||
]) as $key => $value) {
|
||||
if ($key === 'api_token') {
|
||||
$value = encrypt($value);
|
||||
|
||||
@@ -134,6 +134,10 @@ class User extends Authenticatable implements HasLocalePreference
|
||||
if (!$user->language) {
|
||||
$user->language = setting('default_language', 'en');
|
||||
}
|
||||
|
||||
if($days = setting('trial')){
|
||||
$user->trial_ends_at = now()->addDays($days);
|
||||
}
|
||||
});
|
||||
|
||||
static::created(function (self $user) {
|
||||
|
||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
@@ -19,7 +19,9 @@
|
||||
<SettingsSegment>
|
||||
<template #title>{{ __('Overview') }}</template>
|
||||
<template #subtitle>
|
||||
{{ __('Change all the system settings here. All changes are in effect immediately.') }}
|
||||
{{
|
||||
__('Change all the system settings here. All changes are in effect immediately.')
|
||||
}}
|
||||
</template>
|
||||
<template #form>
|
||||
<form class="space-y-4" @submit.prevent="submit">
|
||||
@@ -33,7 +35,9 @@
|
||||
:errors="$page.props.errors.logo"
|
||||
v-model="form.logo"/>
|
||||
|
||||
<Button v-if="company_settings.has_logo" variant="danger" type="button" class="ml-2 px-4 py-1 bg-gray-500 hover:bg-gray-700 rounded-sm text-xs font-medium text-white" @click="removeLogo">
|
||||
<Button v-if="company_settings.has_logo" variant="danger" type="button"
|
||||
class="ml-2 px-4 py-1 bg-gray-500 hover:bg-gray-700 rounded-sm text-xs font-medium text-white"
|
||||
@click="removeLogo">
|
||||
Remove logo
|
||||
</Button>
|
||||
|
||||
@@ -69,6 +73,21 @@
|
||||
<option value="years-4">Older than 4 years</option>
|
||||
</FormSelect>
|
||||
|
||||
<div>
|
||||
<input id="trial" class="form-checkbox" type="checkbox"
|
||||
v-model="form.trialEnabled">
|
||||
<label for="trial" class="ml-2 text-sm">{{
|
||||
__('Enable trial')
|
||||
}}</label>
|
||||
<p class="text-small mt-1 text-medium-emphasis">
|
||||
{{ __('This will allow you to have users with trials.') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<FormInput v-if="form.trialEnabled" type="number" :label="__('Trial days')"
|
||||
:errors="$page.props.errors.trial"
|
||||
v-model="form.trial"/>
|
||||
|
||||
<div>
|
||||
<input id="support" class="form-checkbox" type="checkbox"
|
||||
v-model="form.support">
|
||||
@@ -141,7 +160,8 @@
|
||||
{{
|
||||
__('This will allow you to interact with your system via the API.')
|
||||
}} <a href="https://docs.ploi-core.io/core-api/introduction"
|
||||
class="text-primary" target="_blank">{{ __('More information')}}</a>
|
||||
class="text-primary"
|
||||
target="_blank">{{ __('More information') }}</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -252,10 +272,16 @@ export default {
|
||||
default_language: this.company_settings.default_language,
|
||||
logo: null,
|
||||
rotate_logs_after: this.company_settings.rotate_logs_after,
|
||||
trialEnabled: false,
|
||||
trial: this.company_settings.trial
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.form.trialEnabled = !!this.company_settings.trial;
|
||||
},
|
||||
|
||||
props: {
|
||||
company_settings: Object,
|
||||
packages: {},
|
||||
@@ -282,6 +308,7 @@ export default {
|
||||
data.append('default_language', this.form.default_language || 'en')
|
||||
data.append('logo', this.form.logo || '')
|
||||
data.append('rotate_logs_after', this.form.rotate_logs_after || '')
|
||||
data.append('trial', this.form.trial || '')
|
||||
data.append('_method', 'patch')
|
||||
|
||||
this.$inertia.post(this.route('admin.settings.update'), data, {
|
||||
|
||||
Reference in New Issue
Block a user