Recurring component development sent automatically send email feature..
This commit is contained in:
@ -23,6 +23,7 @@ trait Recurring
|
|||||||
$limit_by = !empty($request['recurring_limit']) ? $request['recurring_limit'] : 'count';
|
$limit_by = !empty($request['recurring_limit']) ? $request['recurring_limit'] : 'count';
|
||||||
$limit_count = isset($request['recurring_limit_count']) ? (int) $request['recurring_limit_count'] : 0;
|
$limit_count = isset($request['recurring_limit_count']) ? (int) $request['recurring_limit_count'] : 0;
|
||||||
$limit_date = !empty($request['recurring_limit_date']) ? $request['recurring_limit_date'] : null;
|
$limit_date = !empty($request['recurring_limit_date']) ? $request['recurring_limit_date'] : null;
|
||||||
|
$auto_send = !empty($request['recurring_send_email']) ? $request['recurring_send_email'] : 0;
|
||||||
$source = !empty($request['created_from']) ? $request['created_from'] : source_name();
|
$source = !empty($request['created_from']) ? $request['created_from'] : source_name();
|
||||||
$owner = !empty($request['created_by']) ? $request['created_by'] : user_id();
|
$owner = !empty($request['created_by']) ? $request['created_by'] : user_id();
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ trait Recurring
|
|||||||
'limit_by' => $limit_by,
|
'limit_by' => $limit_by,
|
||||||
'limit_count' => $limit_count,
|
'limit_count' => $limit_count,
|
||||||
'limit_date' => $limit_date,
|
'limit_date' => $limit_date,
|
||||||
|
'auto_send' => $auto_send,
|
||||||
'created_from' => $source,
|
'created_from' => $source,
|
||||||
'created_by' => $owner,
|
'created_by' => $owner,
|
||||||
]);
|
]);
|
||||||
@ -54,6 +56,7 @@ trait Recurring
|
|||||||
$limit_by = !empty($request['recurring_limit']) ? $request['recurring_limit'] : 'count';
|
$limit_by = !empty($request['recurring_limit']) ? $request['recurring_limit'] : 'count';
|
||||||
$limit_count = isset($request['recurring_limit_count']) ? (int) $request['recurring_limit_count'] : 0;
|
$limit_count = isset($request['recurring_limit_count']) ? (int) $request['recurring_limit_count'] : 0;
|
||||||
$limit_date = !empty($request['recurring_limit_date']) ? $request['recurring_limit_date'] : null;
|
$limit_date = !empty($request['recurring_limit_date']) ? $request['recurring_limit_date'] : null;
|
||||||
|
$auto_send = !empty($request['recurring_send_email']) ? $request['recurring_send_email'] : 0;
|
||||||
|
|
||||||
$recurring = $this->recurring();
|
$recurring = $this->recurring();
|
||||||
$model_exists = $recurring->count();
|
$model_exists = $recurring->count();
|
||||||
@ -66,6 +69,7 @@ trait Recurring
|
|||||||
'limit_by' => $limit_by,
|
'limit_by' => $limit_by,
|
||||||
'limit_count' => $limit_count,
|
'limit_count' => $limit_count,
|
||||||
'limit_date' => $limit_date,
|
'limit_date' => $limit_date,
|
||||||
|
'auto_send' => $auto_send,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (! empty($request['recurring_status'])) {
|
if (! empty($request['recurring_status'])) {
|
||||||
|
@ -22,6 +22,9 @@ class Recurring extends Component
|
|||||||
public $limitCount = '';
|
public $limitCount = '';
|
||||||
public $limitDateValue = '';
|
public $limitDateValue = '';
|
||||||
|
|
||||||
|
public $sendEmailShow;
|
||||||
|
public $sendEmail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new component instance.
|
* Create a new component instance.
|
||||||
*
|
*
|
||||||
@ -41,6 +44,9 @@ class Recurring extends Component
|
|||||||
$startedValue = '',
|
$startedValue = '',
|
||||||
$limitCount = '',
|
$limitCount = '',
|
||||||
$limitDateValue = '',
|
$limitDateValue = '',
|
||||||
|
|
||||||
|
$sendEmailShow = true,
|
||||||
|
$sendEmail = false
|
||||||
) {
|
) {
|
||||||
$this->type = $this->getType($type);
|
$this->type = $this->getType($type);
|
||||||
$this->frequency = $this->getFrequency($frequency);
|
$this->frequency = $this->getFrequency($frequency);
|
||||||
@ -55,6 +61,9 @@ class Recurring extends Component
|
|||||||
$this->startedValue = $this->getStartedValue($startedValue);
|
$this->startedValue = $this->getStartedValue($startedValue);
|
||||||
$this->limitCount = $this->getLimitCount($limitCount);
|
$this->limitCount = $this->getLimitCount($limitCount);
|
||||||
$this->limitDateValue = $this->getLimitDateValue($limitDateValue);
|
$this->limitDateValue = $this->getLimitDateValue($limitDateValue);
|
||||||
|
|
||||||
|
$this->sendEmailShow = $this->getSendEmailShow($sendEmailShow);
|
||||||
|
$this->sendEmail = $this->getSendEmail($sendEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,4 +180,22 @@ class Recurring extends Component
|
|||||||
|
|
||||||
return Date::now()->toDateString();
|
return Date::now()->toDateString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getSendEmailShow($sendEmailShow)
|
||||||
|
{
|
||||||
|
if (! empty($sendEmailShow)) {
|
||||||
|
return $sendEmailShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getSendEmail($sendEmail)
|
||||||
|
{
|
||||||
|
if (! empty($sendEmail)) {
|
||||||
|
return $sendEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,22 @@
|
|||||||
<div class="text-red text-sm mt-1 ml-2 block" v-if="limitDateError" v-html="limitDateError"></div>
|
<div class="text-red text-sm mt-1 ml-2 block" v-if="limitDateError" v-html="limitDateError"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="sendEmailShow" class="flex flex-wrap lg:flex-nowrap items-center space-y-1 lg:space-y-0">
|
||||||
|
<div class="w-24 sm:w-60 px-0 sm:px-2 text-sm">
|
||||||
|
{{ sendEmailText }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center mt-1">
|
||||||
|
<label @click="sendEmail=1;change();" v-bind:class="[sendEmail == 1 ? ['bg-green-500','text-white'] : 'bg-black-100']" class="relative w-10 ltr:rounded-tl-lg ltr:rounded-bl-lg rtl:rounded-tr-lg rtl:rounded-br-lg py-2 px-1 text-sm text-center transition-all cursor-pointer">
|
||||||
|
{{ sendEmailYesText }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label @click="sendEmail=0;change();"v-bind:class="[sendEmail == 0 ? ['bg-red-500','text-white'] : 'bg-black-100']" class="relative w-10 ltr:rounded-tr-lg ltr:rounded-br-lg rtl:rounded-tl-lg rtl:rounded-bl-lg py-2 px-1 text-sm text-center transition-all cursor-pointer">
|
||||||
|
{{ sendEmailNoText }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -246,6 +262,32 @@ export default {
|
|||||||
default: 'dd MM yyyy',
|
default: 'dd MM yyyy',
|
||||||
description: "Default date format"
|
description: "Default date format"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sendEmailShow: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
|
description: "Created recurring model send automatically option"
|
||||||
|
},
|
||||||
|
sendEmailText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Send email automatically',
|
||||||
|
description: "Created recurring model send automatically option"
|
||||||
|
},
|
||||||
|
sendEmailYesText: {
|
||||||
|
type: String,
|
||||||
|
default: 'Yes',
|
||||||
|
description: "Send email option yes text"
|
||||||
|
},
|
||||||
|
sendEmailNoText: {
|
||||||
|
type: String,
|
||||||
|
default: 'No',
|
||||||
|
description: "Send email option no text"
|
||||||
|
},
|
||||||
|
sendEmailValue: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
description: "Send Email value"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@ -258,6 +300,7 @@ export default {
|
|||||||
limitCount: 0,
|
limitCount: 0,
|
||||||
limitDate: '',
|
limitDate: '',
|
||||||
formatDate: 'dd MM YYYY',
|
formatDate: 'dd MM YYYY',
|
||||||
|
sendEmail: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -284,6 +327,8 @@ export default {
|
|||||||
this.limit = 'on';
|
this.limit = 'on';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sendEmail = this.sendEmailValue;
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
this.change();
|
this.change();
|
||||||
}.bind(this), 800);
|
}.bind(this), 800);
|
||||||
@ -315,6 +360,8 @@ export default {
|
|||||||
this.$emit('limit_count', 0);
|
this.$emit('limit_count', 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$emit('send_email', this.sendEmail);
|
||||||
},
|
},
|
||||||
|
|
||||||
convertToDarteFormat(format) {
|
convertToDarteFormat(format) {
|
||||||
|
@ -29,6 +29,7 @@ return [
|
|||||||
'child' => ':url was automatically created on :date',
|
'child' => ':url was automatically created on :date',
|
||||||
'message' => 'This is a recurring :type and the next :type will be automatically generated on :date',
|
'message' => 'This is a recurring :type and the next :type will be automatically generated on :date',
|
||||||
'message_parent' => 'This :type was automatically generated from :link',
|
'message_parent' => 'This :type was automatically generated from :link',
|
||||||
|
'send_email_auto' => 'Send email automatically',
|
||||||
|
|
||||||
'frequency_type' => 'Repeat this :type',
|
'frequency_type' => 'Repeat this :type',
|
||||||
'limit_date' => 'Create first :type on',
|
'limit_date' => 'Create first :type on',
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
:date-range-text="{{ json_encode(trans('general.date_range')) }}"
|
:date-range-text="{{ json_encode(trans('general.date_range')) }}"
|
||||||
middle-text="{!! trans('recurring.limit_middle') !!}"
|
middle-text="{!! trans('recurring.limit_middle') !!}"
|
||||||
end-text="{{ Str::plural(Str::replace('-recurring', '', $type)) }}"
|
end-text="{{ Str::plural(Str::replace('-recurring', '', $type)) }}"
|
||||||
|
send-email-text="{{ trans('recurring.send_email_auto') }}"
|
||||||
|
send-email-yes-text="{{ trans('general.yes') }}"
|
||||||
|
send-email-no-text="{{ trans('general.no') }}"
|
||||||
|
|
||||||
:frequencies="{{ json_encode($frequencies) }}"
|
:frequencies="{{ json_encode($frequencies) }}"
|
||||||
frequency-text="{!! trans('recurring.frequency_type', ['type' => Str::replace('-recurring', '', $type)]) !!}"
|
frequency-text="{!! trans('recurring.frequency_type', ['type' => Str::replace('-recurring', '', $type)]) !!}"
|
||||||
@ -65,6 +68,15 @@
|
|||||||
@endif
|
@endif
|
||||||
:limit-date-error="form.errors.get('recurring_limit_date')"
|
:limit-date-error="form.errors.get('recurring_limit_date')"
|
||||||
|
|
||||||
|
send-email-show="{{ $sendEmailShow }}"
|
||||||
|
send-email-value="{{ $sendEmail }}"
|
||||||
|
@if ($attributes->has('@send_email'))
|
||||||
|
@send_email="form.recurring_send_email = $event;{{ $attributes['@send_email'] }}"
|
||||||
|
@else
|
||||||
|
@send_email="form.recurring_send_email = $event"
|
||||||
|
@endif
|
||||||
|
:send-email-error="form.errors.get('recurring_send_email')"
|
||||||
|
|
||||||
date-format="{{ company_date_format() }}"
|
date-format="{{ company_date_format() }}"
|
||||||
|
|
||||||
{{ $attributes }}
|
{{ $attributes }}
|
||||||
|
Reference in New Issue
Block a user