form stuff done
This commit is contained in:
parent
1e4d4cf581
commit
b5e937b58d
@ -242,6 +242,20 @@ class Bills extends Controller
|
|||||||
'description' => trans('messages.success.added', ['type' => $bill->bill_number]),
|
'description' => trans('messages.success.added', ['type' => $bill->bill_number]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
$bill->recurring()->create([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['billed_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Fire the event to make it extendible
|
// Fire the event to make it extendible
|
||||||
event(new BillCreated($bill));
|
event(new BillCreated($bill));
|
||||||
|
|
||||||
@ -444,6 +458,28 @@ class Bills extends Controller
|
|||||||
$bill->totals()->delete();
|
$bill->totals()->delete();
|
||||||
$this->addTotals($bill, $request, $taxes, $sub_total, $discount_total, $tax_total);
|
$this->addTotals($bill, $request, $taxes, $sub_total, $discount_total, $tax_total);
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
if ($bill->has('recurring')->count()) {
|
||||||
|
$function = 'update';
|
||||||
|
} else {
|
||||||
|
$function = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
|
$bill->recurring()->$function([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['billed_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$bill->recurring()->delete();
|
||||||
|
}
|
||||||
|
|
||||||
// Fire the event to make it extendible
|
// Fire the event to make it extendible
|
||||||
event(new BillUpdated($bill));
|
event(new BillUpdated($bill));
|
||||||
|
|
||||||
|
@ -96,6 +96,20 @@ class Payments extends Controller
|
|||||||
$payment->attachMedia($media, 'attachment');
|
$payment->attachMedia($media, 'attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
$payment->recurring()->create([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['paid_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
|
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
|
||||||
|
|
||||||
flash($message)->success();
|
flash($message)->success();
|
||||||
@ -195,6 +209,28 @@ class Payments extends Controller
|
|||||||
$payment->attachMedia($media, 'attachment');
|
$payment->attachMedia($media, 'attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
if ($payment->has('recurring')->count()) {
|
||||||
|
$function = 'update';
|
||||||
|
} else {
|
||||||
|
$function = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
|
$payment->recurring()->$function([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['paid_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$payment->recurring()->delete();
|
||||||
|
}
|
||||||
|
|
||||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.payments', 1)]);
|
$message = trans('messages.success.updated', ['type' => trans_choice('general.payments', 1)]);
|
||||||
|
|
||||||
flash($message)->success();
|
flash($message)->success();
|
||||||
|
@ -260,6 +260,20 @@ class Invoices extends Controller
|
|||||||
// Update next invoice number
|
// Update next invoice number
|
||||||
$this->increaseNextInvoiceNumber();
|
$this->increaseNextInvoiceNumber();
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
$invoice->recurring()->create([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['invoiced_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Fire the event to make it extendible
|
// Fire the event to make it extendible
|
||||||
event(new InvoiceCreated($invoice));
|
event(new InvoiceCreated($invoice));
|
||||||
|
|
||||||
@ -465,6 +479,28 @@ class Invoices extends Controller
|
|||||||
$invoice->totals()->delete();
|
$invoice->totals()->delete();
|
||||||
$this->addTotals($invoice, $request, $taxes, $sub_total, $discount_total, $tax_total);
|
$this->addTotals($invoice, $request, $taxes, $sub_total, $discount_total, $tax_total);
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
if ($invoice->has('recurring')->count()) {
|
||||||
|
$function = 'update';
|
||||||
|
} else {
|
||||||
|
$function = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
|
$invoice->recurring()->$function([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['invoiced_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$invoice->recurring()->delete();
|
||||||
|
}
|
||||||
|
|
||||||
// Fire the event to make it extendible
|
// Fire the event to make it extendible
|
||||||
event(new InvoiceUpdated($invoice));
|
event(new InvoiceUpdated($invoice));
|
||||||
|
|
||||||
|
@ -98,6 +98,20 @@ class Revenues extends Controller
|
|||||||
$revenue->attachMedia($media, 'attachment');
|
$revenue->attachMedia($media, 'attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
$revenue->recurring()->create([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['paid_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$message = trans('messages.success.added', ['type' => trans_choice('general.revenues', 1)]);
|
$message = trans('messages.success.added', ['type' => trans_choice('general.revenues', 1)]);
|
||||||
|
|
||||||
flash($message)->success();
|
flash($message)->success();
|
||||||
@ -197,6 +211,28 @@ class Revenues extends Controller
|
|||||||
$revenue->attachMedia($media, 'attachment');
|
$revenue->attachMedia($media, 'attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recurring
|
||||||
|
if ($request->get('recurring_frequency') != 'no') {
|
||||||
|
$frequency = ($request['recurring_frequency'] != 'custom') ? $request['recurring_frequency'] : $request['recurring_custom_frequency'];
|
||||||
|
$interval = ($request['recurring_frequency'] != 'custom') ? 1 : (int) $request['recurring_interval'];
|
||||||
|
|
||||||
|
if ($revenue->has('recurring')->count()) {
|
||||||
|
$function = 'update';
|
||||||
|
} else {
|
||||||
|
$function = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
|
$revenue->recurring()->$function([
|
||||||
|
'company_id' => session('company_id'),
|
||||||
|
'frequency' => $frequency,
|
||||||
|
'interval' => $interval,
|
||||||
|
'started_at' => $request['paid_at'],
|
||||||
|
'count' => (int) $request['recurring_count'],
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$revenue->recurring()->delete();
|
||||||
|
}
|
||||||
|
|
||||||
$message = trans('messages.success.updated', ['type' => trans_choice('general.revenues', 1)]);
|
$message = trans('messages.success.updated', ['type' => trans_choice('general.revenues', 1)]);
|
||||||
|
|
||||||
flash($message)->success();
|
flash($message)->success();
|
||||||
|
36
app/Http/ViewComposers/Recurring.php
Normal file
36
app/Http/ViewComposers/Recurring.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\ViewComposers;
|
||||||
|
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class Recurring
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind data to the view.
|
||||||
|
*
|
||||||
|
* @param View $view
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function compose(View $view)
|
||||||
|
{
|
||||||
|
$recurring_frequencies = [
|
||||||
|
'no' => trans('general.no'),
|
||||||
|
'daily' => trans('recurring.daily'),
|
||||||
|
'weekly' => trans('recurring.weekly'),
|
||||||
|
'monthly' => trans('recurring.monthly'),
|
||||||
|
'yearly' => trans('recurring.yearly'),
|
||||||
|
'custom' => trans('recurring.custom'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$recurring_custom_frequencies = [
|
||||||
|
'daily' => trans('recurring.days'),
|
||||||
|
'weekly' => trans('recurring.weeks'),
|
||||||
|
'monthly' => trans('recurring.months'),
|
||||||
|
'yearly' => trans('recurring.years'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$view->with(['recurring_frequencies' => $recurring_frequencies, 'recurring_custom_frequencies' => $recurring_custom_frequencies]);
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,16 @@ use App\Models\Model;
|
|||||||
class Recurring extends Model
|
class Recurring extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected $table = 'recurrings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attributes that should be mass-assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = ['company_id', 'recurrable_id', 'recurrable_type', 'frequency', 'interval', 'started_at', 'count'];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all of the owning recurrable models.
|
* Get all of the owning recurrable models.
|
||||||
*/
|
*/
|
||||||
|
@ -58,26 +58,21 @@ class Bill extends Model
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $cloneable_relations = ['items', 'totals'];
|
protected $cloneable_relations = ['items', 'recurring', 'totals'];
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Setting\Category');
|
return $this->belongsTo('App\Models\Setting\Category');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function vendor()
|
|
||||||
{
|
|
||||||
return $this->belongsTo('App\Models\Expense\Vendor');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function currency()
|
public function currency()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
|
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function status()
|
public function histories()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Expense\BillStatus', 'bill_status_code', 'code');
|
return $this->hasMany('App\Models\Expense\BillHistory');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function items()
|
public function items()
|
||||||
@ -85,19 +80,29 @@ class Bill extends Model
|
|||||||
return $this->hasMany('App\Models\Expense\BillItem');
|
return $this->hasMany('App\Models\Expense\BillItem');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function totals()
|
|
||||||
{
|
|
||||||
return $this->hasMany('App\Models\Expense\BillTotal');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function payments()
|
public function payments()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\Expense\BillPayment');
|
return $this->hasMany('App\Models\Expense\BillPayment');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function histories()
|
public function recurring()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\Expense\BillHistory');
|
return $this->morphOne('App\Models\Common\Recurring', 'recurrable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function status()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\Expense\BillStatus', 'bill_status_code', 'code');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function totals()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\Expense\BillTotal');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function vendor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\Expense\Vendor');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeDue($query, $date)
|
public function scopeDue($query, $date)
|
||||||
|
@ -44,24 +44,31 @@ class Payment extends Model
|
|||||||
'description' ,
|
'description' ,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clonable relationships.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $cloneable_relations = ['recurring'];
|
||||||
|
|
||||||
public function account()
|
public function account()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Banking\Account');
|
return $this->belongsTo('App\Models\Banking\Account');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function currency()
|
|
||||||
{
|
|
||||||
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Setting\Category');
|
return $this->belongsTo('App\Models\Setting\Category');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function vendor()
|
public function currency()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Expense\Vendor');
|
return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function recurring()
|
||||||
|
{
|
||||||
|
return $this->morphOne('App\Models\Common\Recurring', 'recurrable');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transfers()
|
public function transfers()
|
||||||
@ -69,6 +76,11 @@ class Payment extends Model
|
|||||||
return $this->hasMany('App\Models\Banking\Transfer');
|
return $this->hasMany('App\Models\Banking\Transfer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vendor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\Expense\Vendor');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get only transfers.
|
* Get only transfers.
|
||||||
*
|
*
|
||||||
|
@ -59,7 +59,7 @@ class Invoice extends Model
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $cloneable_relations = ['items', 'totals'];
|
protected $cloneable_relations = ['items', 'recurring', 'totals'];
|
||||||
|
|
||||||
public function category()
|
public function category()
|
||||||
{
|
{
|
||||||
@ -91,9 +91,9 @@ class Invoice extends Model
|
|||||||
return $this->hasMany('App\Models\Income\InvoicePayment');
|
return $this->hasMany('App\Models\Income\InvoicePayment');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function recurrings()
|
public function recurring()
|
||||||
{
|
{
|
||||||
return $this->morphMany('App\Models\Common\Recurring', 'recurrable');
|
return $this->morphOne('App\Models\Common\Recurring', 'recurrable');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function status()
|
public function status()
|
||||||
|
@ -45,6 +45,13 @@ class Revenue extends Model
|
|||||||
'notes' => 2,
|
'notes' => 2,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clonable relationships.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $cloneable_relations = ['recurring'];
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Auth\User', 'customer_id', 'id');
|
return $this->belongsTo('App\Models\Auth\User', 'customer_id', 'id');
|
||||||
@ -70,6 +77,11 @@ class Revenue extends Model
|
|||||||
return $this->belongsTo('App\Models\Income\Customer');
|
return $this->belongsTo('App\Models\Income\Customer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function recurring()
|
||||||
|
{
|
||||||
|
return $this->morphOne('App\Models\Common\Recurring', 'recurrable');
|
||||||
|
}
|
||||||
|
|
||||||
public function transfers()
|
public function transfers()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\Banking\Transfer');
|
return $this->hasMany('App\Models\Banking\Transfer');
|
||||||
|
@ -62,6 +62,10 @@ class FormServiceProvider extends ServiceProvider
|
|||||||
Form::component('saveButtons', 'partials.form.save_buttons', [
|
Form::component('saveButtons', 'partials.form.save_buttons', [
|
||||||
'cancel', 'col' => 'col-md-12',
|
'cancel', 'col' => 'col-md-12',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Form::component('recurring', 'partials.form.recurring', [
|
||||||
|
'page', 'model' => null,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +39,11 @@ class ViewComposerServiceProvider extends ServiceProvider
|
|||||||
'modules.*', 'App\Http\ViewComposers\Modules'
|
'modules.*', 'App\Http\ViewComposers\Modules'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add recurring
|
||||||
|
View::composer(
|
||||||
|
['partials.form.recurring',], 'App\Http\ViewComposers\Recurring'
|
||||||
|
);
|
||||||
|
|
||||||
// Add logo
|
// Add logo
|
||||||
View::composer(
|
View::composer(
|
||||||
['incomes.invoices.invoice', 'expenses.bills.bill'], 'App\Http\ViewComposers\Logo'
|
['incomes.invoices.invoice', 'expenses.bills.bill'], 'App\Http\ViewComposers\Logo'
|
||||||
|
@ -19,7 +19,7 @@ class CreateRecurringsTable extends Migration
|
|||||||
$table->string('frequency');
|
$table->string('frequency');
|
||||||
$table->integer('interval')->default(1);
|
$table->integer('interval')->default(1);
|
||||||
$table->date('started_at');
|
$table->date('started_at');
|
||||||
$table->integer('count')->default(1);
|
$table->integer('count')->default(0);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->softDeletes();
|
$table->softDeletes();
|
||||||
});
|
});
|
||||||
|
@ -3,9 +3,17 @@
|
|||||||
return [
|
return [
|
||||||
|
|
||||||
'recurring' => 'Recurring',
|
'recurring' => 'Recurring',
|
||||||
|
'every' => 'Every',
|
||||||
|
'period' => 'Period',
|
||||||
|
'times' => 'Times',
|
||||||
|
'daily' => 'Daily',
|
||||||
'weekly' => 'Weekly',
|
'weekly' => 'Weekly',
|
||||||
'monthly' => 'Monthly',
|
'monthly' => 'Monthly',
|
||||||
'yearly' => 'Yearly',
|
'yearly' => 'Yearly',
|
||||||
'custom' => 'Custom',
|
'custom' => 'Custom',
|
||||||
|
'days' => 'Day(s)',
|
||||||
|
'weeks' => 'Week(s)',
|
||||||
|
'months' => 'Month(s)',
|
||||||
|
'years' => 'Year(s)',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -98,6 +98,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
||||||
|
|
||||||
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
||||||
{!! Form::label('category_id', trans_choice('general.categories', 1), ['class' => 'control-label']) !!}
|
{!! Form::label('category_id', trans_choice('general.categories', 1), ['class' => 'control-label']) !!}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -110,7 +112,7 @@
|
|||||||
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
{{ Form::recurring('create') }}
|
||||||
|
|
||||||
{{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
|
{{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -114,9 +114,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
||||||
|
|
||||||
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
{{ Form::recurring('edit', $bill) }}
|
||||||
|
|
||||||
{{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
|
{{ Form::fileGroup('attachment', trans('general.attachment'),[]) }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,6 +24,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
{!! Form::label('vendor_id', trans_choice('general.vendors', 1), ['class' => 'control-label']) !!}
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-addon"><i class="fa fa-user"></i></div>
|
||||||
|
{!! Form::select('vendor_id', $vendors, null, array_merge(['id' => 'vendor_id', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.vendors', 1)])])) !!}
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="button" onclick="createVendor();" class="btn btn-default btn-icon"><i class="fa fa-plus"></i></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||||
|
|
||||||
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
||||||
@ -38,16 +49,7 @@
|
|||||||
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-6">
|
{{ Form::recurring('create') }}
|
||||||
{!! Form::label('vendor_id', trans_choice('general.vendors', 1), ['class' => 'control-label']) !!}
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-addon"><i class="fa fa-user"></i></div>
|
|
||||||
{!! Form::select('vendor_id', $vendors, null, array_merge(['id' => 'vendor_id', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.vendors', 1)])])) !!}
|
|
||||||
<span class="input-group-btn">
|
|
||||||
<button type="button" onclick="createVendor();" class="btn btn-default btn-icon"><i class="fa fa-plus"></i></button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('general.default_payment_method')) }}
|
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('general.default_payment_method')) }}
|
||||||
|
|
||||||
|
@ -29,11 +29,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ Form::selectGroup('vendor_id', trans_choice('general.vendors', 1), 'user', $vendors, null, []) }}
|
||||||
|
|
||||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('vendor_id', trans_choice('general.vendors', 1), 'user', $vendors, null, []) }}
|
{{ Form::recurring('edit', $payment) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods) }}
|
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods) }}
|
||||||
|
|
||||||
|
@ -98,6 +98,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
||||||
|
|
||||||
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
||||||
{!! Form::label('category_id', trans_choice('general.categories', 1), ['class' => 'control-label']) !!}
|
{!! Form::label('category_id', trans_choice('general.categories', 1), ['class' => 'control-label']) !!}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -110,9 +112,7 @@
|
|||||||
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ Form::selectGroup('recurring_id', trans('recurring.recurring'), 'refresh', $recurrings, 0, []) }}
|
{{ Form::recurring('create') }}
|
||||||
|
|
||||||
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
|
||||||
|
|
||||||
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
|
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
|
||||||
</div>
|
</div>
|
||||||
@ -212,10 +212,6 @@
|
|||||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.categories', 1)]) }}"
|
placeholder: "{{ trans('general.form.select.field', ['field' => trans_choice('general.categories', 1)]) }}"
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#recurring_id").select2({
|
|
||||||
placeholder: "{{ trans('general.form.select.field', ['field' => trans('recurring.recurring')]) }}"
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#attachment').fancyfile({
|
$('#attachment').fancyfile({
|
||||||
text : '{{ trans('general.form.select.file') }}',
|
text : '{{ trans('general.form.select.file') }}',
|
||||||
style : 'btn-default',
|
style : 'btn-default',
|
||||||
|
@ -113,9 +113,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
||||||
|
|
||||||
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
|
{{ Form::recurring('edit', $invoice) }}
|
||||||
|
|
||||||
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
|
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,6 +24,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
{!! Form::label('customer_id', trans_choice('general.customers', 1), ['class' => 'control-label']) !!}
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-addon"><i class="fa fa-user"></i></div>
|
||||||
|
{!! Form::select('customer_id', $customers, null, array_merge(['class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.customers', 1)])])) !!}
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="button" onclick="createCustomer();" class="btn btn-default btn-icon"><i class="fa fa-plus"></i></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||||
|
|
||||||
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
<div class="form-group col-md-6 required {{ $errors->has('category_id') ? 'has-error' : ''}}">
|
||||||
@ -38,16 +49,7 @@
|
|||||||
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
{!! $errors->first('category_id', '<p class="help-block">:message</p>') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-6">
|
{{ Form::recurring('create') }}
|
||||||
{!! Form::label('customer_id', trans_choice('general.customers', 1), ['class' => 'control-label']) !!}
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-addon"><i class="fa fa-user"></i></div>
|
|
||||||
{!! Form::select('customer_id', $customers, null, array_merge(['class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.customers', 1)])])) !!}
|
|
||||||
<span class="input-group-btn">
|
|
||||||
<button type="button" onclick="createCustomer();" class="btn btn-default btn-icon"><i class="fa fa-plus"></i></button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('general.default_payment_method')) }}
|
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods, setting('general.default_payment_method')) }}
|
||||||
|
|
||||||
|
@ -29,11 +29,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ Form::selectGroup('customer_id', trans_choice('general.customers', 1), 'user', $customers, null, []) }}
|
||||||
|
|
||||||
{{ Form::textareaGroup('description', trans('general.description')) }}
|
{{ Form::textareaGroup('description', trans('general.description')) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
{{ Form::selectGroup('category_id', trans_choice('general.categories', 1), 'folder-open-o', $categories) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('customer_id', trans_choice('general.customers', 1), 'user', $customers, null, []) }}
|
{{ Form::recurring('edit', $revenue) }}
|
||||||
|
|
||||||
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods) }}
|
{{ Form::selectGroup('payment_method', trans_choice('general.payment_methods', 1), 'credit-card', $payment_methods) }}
|
||||||
|
|
||||||
|
43
resources/views/partials/form/recurring.blade.php
Normal file
43
resources/views/partials/form/recurring.blade.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
@php
|
||||||
|
if (($page == 'create') || !$model->has('recurring')->count()) {
|
||||||
|
$frequency = 'no';
|
||||||
|
$interval = 1;
|
||||||
|
$custom_frequency = 'monthly';
|
||||||
|
$count = 0;
|
||||||
|
} else {
|
||||||
|
$r = $model->recurring;
|
||||||
|
$frequency = $r->frequency;
|
||||||
|
$interval = $r->interval;
|
||||||
|
$custom_frequency = $r->frequency;
|
||||||
|
$count = $r->count;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="col-md-6" style="padding-left: 0; padding-right: 0;">
|
||||||
|
<div class="form-group col-md-12 {{ $errors->has('recurring_frequency') ? 'has-error' : ''}}">
|
||||||
|
{!! Form::label('recurring_frequency', trans('recurring.recurring'), ['class' => 'control-label']) !!}
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-addon"><i class="fa fa-refresh"></i></div>
|
||||||
|
{!! Form::select('recurring_frequency', $recurring_frequencies, $frequency, ['class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans('recurring.recurring')])]) !!}
|
||||||
|
</div>
|
||||||
|
{!! $errors->first('recurring_frequency', '<p class="help-block">:message</p>') !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-2 hidden {{ $errors->has('recurring_interval') ? 'has-error' : '' }}">
|
||||||
|
{!! Form::label('recurring_interval', trans('recurring.every'), ['class' => 'control-label']) !!}
|
||||||
|
{!! Form::number('recurring_interval', $interval, ['class' => 'form-control']) !!}
|
||||||
|
{!! $errors->first('recurring_interval', '<p class="help-block">:message</p>') !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4 hidden {{ $errors->has('recurring_custom_frequency') ? 'has-error' : ''}}">
|
||||||
|
{!! Form::label('recurring_custom_frequency', trans('recurring.period'), ['class' => 'control-label']) !!}
|
||||||
|
{!! Form::select('recurring_custom_frequency', $recurring_custom_frequencies, $custom_frequency, ['class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans('recurring.period')])]) !!}
|
||||||
|
{!! $errors->first('recurring_custom_frequency', '<p class="help-block">:message</p>') !!}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-2 hidden {{ $errors->has('recurring_count') ? 'has-error' : '' }}">
|
||||||
|
{!! Form::label('recurring_count', trans('recurring.times'), ['class' => 'control-label']) !!}
|
||||||
|
{!! Form::number('recurring_count', $count, ['class' => 'form-control']) !!}
|
||||||
|
{!! $errors->first('recurring_count', '<p class="help-block">:message</p>') !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
x
Reference in New Issue
Block a user