adds declined msg to mail notif, updates lang files and checkout acceptance controller

This commit is contained in:
Godfrey M 2024-03-18 10:25:55 -07:00
parent 0fd99d410e
commit 4588393b76
8 changed files with 56 additions and 9 deletions

View file

@ -306,10 +306,12 @@ class AcceptanceController extends Controller
$assigned_to = User::find($acceptance->assigned_to_id)->present()->fullName;
break;
}
$data = [
'item_tag' => $item->asset_tag,
'item_model' => $display_model,
'item_serial' => $item->serial,
'declined_msg' => $request->input('declined_msg'),
'declined_date' => Carbon::parse($acceptance->declined_at)->format('Y-m-d'),
'signature' => ($sig_filename) ? storage_path() . '/private_uploads/signatures/' . $sig_filename : null,
'assigned_to' => $assigned_to,

View file

@ -99,9 +99,10 @@ class CheckoutAcceptance extends Model
*
* @param string $signature_filename
*/
public function decline($signature_filename)
public function decline($signature_filename, $declined_msg = null)
{
$this->declined_at = now();
$this->declined_msg = $declined_msg;
$this->signature_filename = $signature_filename;
$this->save();

View file

@ -25,6 +25,7 @@ class AcceptanceAssetDeclinedNotification extends Notification
$this->item_model = $params['item_model'];
$this->item_serial = $params['item_serial'];
$this->declined_date = Helper::getFormattedDateObject($params['declined_date'], 'date', false);
$this->declined_msg = $params['declined_msg'];
$this->assigned_to = $params['assigned_to'];
$this->company_name = $params['company_name'];
$this->settings = Setting::getSettings();
@ -62,6 +63,7 @@ class AcceptanceAssetDeclinedNotification extends Notification
'item_tag' => $this->item_tag,
'item_model' => $this->item_model,
'item_serial' => $this->item_serial,
'declined_msg' => $this->declined_msg,
'declined_date' => $this->declined_date,
'assigned_to' => $this->assigned_to,
'company_name' => $this->company_name,

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDeclineMsgToCheckoutAcceptanceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('checkout_acceptances', function (Blueprint $table) {
$table->string('declined_msg')->after('signature_filename');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('checkout_acceptances', function (Blueprint $table) {
$table->dropColumn('declined_msg');
});
}
}

View file

@ -49,6 +49,7 @@ return [
'default_eula_text' => 'Default EULA',
'default_language' => 'Default Language',
'default_eula_help_text' => 'You can also associate custom EULAs to specific asset categories.',
'decline_msg' => 'Add details to why you cant accept this (Optional)',
'display_asset_name' => 'Display Asset Name',
'display_checkout_date' => 'Display Checkout Date',
'display_eol' => 'Display EOL in table view',

View file

@ -293,6 +293,7 @@ return [
'user' => 'User',
'accepted' => 'accepted',
'declined' => 'declined',
'declined_notes' => 'Declined Notes',
'unassigned' => 'Unassigned',
'unaccepted_asset_report' => 'Unaccepted Assets',
'users' => 'Users',

View file

@ -64,12 +64,13 @@
</label>
</div>
<div class="form-group">
<div class="col-md-3" style="display:block; text-align:center;">
{{ Form::label('decline_msg', trans('admin/settings/general.decling_msg')) }}
<div class="col-md-12">
<br>
<div class="col-md-12" style="display:block;">
<label id="declined_msg_label" for="declined_msg" style="text-align:center;">{{trans('admin/settings/general.decline_msg')}}</label>
</div>
<div class="col-md-8">
<textarea id="decline_msg" name="decline_msg" rows="4" cols="50"></textarea>
<div class="col-md-12">
<textarea id="declined_msg" name="declined_msg" rows="4" cols="50" value="decline_msg"></textarea>
</div>
</div>
@ -140,15 +141,19 @@
});
$(document).ready(function(){
// Initially hide the div
$('#decline_msg').hide();
$('#declined_msg').hide();
$('#declined_msg_label').hide();
$('input[id="declined"]').change(function(){
if($(this).is(':checked')){
$('#decline_msg').show();
$('#declined_msg_label').show();
$('#declined_msg').show();
}
else {
$('#decline_msg').hide();
$('#declined_msg_label').hide();
$('#declined_msg').hide();
}
});
});

View file

@ -13,6 +13,9 @@
@if (isset($declined_date))
| **{{ ucfirst(trans('general.declined')) }}** | {{ $declined_date }} |
@endif
@if (isset($declined_msg))
| **{{ trans('mail.declined_note') }}** | {{ $declined_msg }} |
@endif
@if ((isset($item_tag)) && ($item_tag!=''))
| **{{ trans('mail.asset_tag') }}** | {{ $item_tag }} |
@endif