Compare commits

...

27 Commits

Author SHA1 Message Date
edmondlang 1110838e35 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into permits-reminder 2024-02-06 10:55:32 +08:00
edmondlang 9d87987488 code update - permits reminder - send email only at production 2024-02-06 10:55:19 +08:00
Omair Saleh 4c0984c9b8 fix container reschedule component 2024-02-05 15:08:51 +08:00
Omair Saleh 5517f16684 fix container reschedule component 2024-02-05 13:24:25 +08:00
Omair Saleh 4b967981dd fix container reschedule component 2024-02-05 12:56:30 +08:00
Omair Saleh e63b959714 fix container reschedule component 2024-02-05 12:52:07 +08:00
Omair Saleh a1751f274d Merge remote-tracking branch 'origin/master' 2024-02-05 12:48:54 +08:00
Omair Saleh ef6538feca fix container reschedule component 2024-02-05 12:47:51 +08:00
edmondlang de61d9a9fd add anitha email for premits reminder 2024-01-30 12:41:51 +08:00
edmondlang 2c1b857255 update permits reminder view 2024-01-30 12:37:34 +08:00
edmondlang 5b4a3507a3 add cron job to send permits reminder at daily 9.30 am 2024-01-30 00:48:23 +08:00
edmondlang 3d6543e467 add sample file 2024-01-30 00:42:21 +08:00
edmondlang 006a327a5f Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into permits-reminder 2024-01-30 00:34:51 +08:00
edmondlang 295e6454b1 add cron job command to send permits reminder 2024-01-30 00:34:39 +08:00
edmondlang f389efa6af add permits edit 2024-01-30 00:07:31 +08:00
Dillon Ngo 4ea3132334 Merge branch 'dillon/51.3-vue-polling-experimental' into 'master'
Vue Polling - Solve a problem where query of packing list with contaienrs and...

See merge request CIEFWorldwideSdnBhd/shipping-portal!197
2024-01-25 19:19:45 +00:00
Dillon Ngo ed252e630b Merge branch 'dillon/51.3-vue-polling-experimental' into 'master'
Vue Polling - Solve a problem where query of packing list with contaienrs and...

See merge request CIEFWorldwideSdnBhd/shipping-portal!196
2024-01-25 18:21:17 +00:00
Dillon Ngo d80e996d02 Merge branch 'dillon/46.4-warehouse-storage-charges' into 'master'
Implement a solution to selectively waived a selected storage invoice

See merge request CIEFWorldwideSdnBhd/shipping-portal!195
2024-01-25 13:47:10 +00:00
Dillon Ngo 064ee3e41a Implement a solution to selectively waived a selected storage invoice 2024-01-24 06:50:18 +08:00
Dillon Ngo 3bda84dac5 Merge branch 'dillon/51.3-vue-polling-experimental' into 'master'
Vue Polling - Solve a problem where query of packing list with contaienrs and...

See merge request CIEFWorldwideSdnBhd/shipping-portal!194
2024-01-21 14:49:24 +00:00
Dillon Ngo 0f2e1297e1 Merge branch 'dillon/51.3-vue-polling-experimental' into 'master'
Vue Polling - Solve a problem where query of packing list with contaienrs and...

See merge request CIEFWorldwideSdnBhd/shipping-portal!193
2024-01-21 14:35:45 +00:00
Dillon Ngo ee94943d00 Merge branch 'dillon/51.3-vue-polling-experimental' into 'master'
Experimental solution (Vue Polling) to solve an AWS API Gateway problem limitation for Laravel Vapor in the event of a emergency rollback to Google

See merge request CIEFWorldwideSdnBhd/shipping-portal!192
2024-01-21 02:54:47 +00:00
Dillon Ngo f6b10b5763 Merge branch 'dillon/51.3-vue-polling-experimental' into 'master'
Experimental solution (Vue Polling) to solve an AWS API Gateway problem limitation for Laravel Vapor in the event of a emergency rollback to Google

See merge request CIEFWorldwideSdnBhd/shipping-portal!191
2024-01-21 02:32:55 +00:00
edmondlang b64b25ff05 code update 2024-01-17 17:06:31 +08:00
edmondlang d1426c7f05 all api and ui to create permits reminder 2024-01-17 00:43:17 +08:00
edmondlang 3375934651 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into permits-reminder
# Conflicts:
#	routes/api.php
2024-01-16 21:16:11 +08:00
edmondlang c79f58d246 permits reminder first commit 2024-01-16 21:15:29 +08:00
23 changed files with 1003 additions and 7 deletions
@@ -0,0 +1,23 @@
<?php
namespace App\Classes\Modules\Imports\Services;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
class GenericImport implements ToCollection, WithHeadingRow
{
function headingRow(): int { return 1; }
public $rows;
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$this->rows = $collection;
}
}
@@ -200,6 +200,11 @@ class CheckStorageInvoiceTransactionProcessor
$this->createStorageInvoiceTransactionDetails($storageInvoice, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded);
}
else if($storageInvoice){
//Additional handling for giving selected storage invoice a waiver
if(isset($storageInvoice->is_waived) && $storageInvoice->is_waived){
$pricePerCBM = 0;
$price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded;
}
//Additional handling for calculation of numberOfDaysExceeded in the event of the storage already paid
$paymentStorageTransaction = $storageInvoice->transactions()->where('transactions.type', TransactionType::PAYMENT)->where('transactions.status', ApprovalStatus::APPROVED)->first();
@@ -216,10 +221,12 @@ class CheckStorageInvoiceTransactionProcessor
Log::channel('storage_invoices')->info('Update $transaction->id: '.$transaction->id);
Log::channel('storage_invoices')->info('$storageInvoice->status: '.$storageInvoice->status);
Log::channel('storage_invoices')->info('price_cbm: '.$price_cbm."-".gettype($price_cbm));
Log::channel('storage_invoices')->info('amount: '.$amount);
$proceedToUpdate = false;
if(abs($price_cbm - $amount) > $epsilon && $storageInvoice->status !== ApprovalStatus::COMPLETED){
$paymentTransactions = $storageInvoice->transactions()->where('transactions.type', TransactionType::PAYMENT)->where('transactions.status', ApprovalStatus::PENDING_SUBMISSION)->get();
if(!$isBackDoorCheck){
if(count($paymentTransactions) > 0){
$this->updatePaymentTransactionViaNonGroupPayment($paymentTransactions);
@@ -229,6 +236,11 @@ class CheckStorageInvoiceTransactionProcessor
}
}
$proceedToUpdate = true;
}
if($proceedToUpdate || ($pricePerCBM == 0 && $amount != 0)){
Log::channel('storage_invoices')->info('proceedToUpdate');
$storageInvoice = $this->updateStorageInvoiceTransaction($storageInvoice, $price_cbm);
$invoiceTransactionDetails = $storageInvoice->transactionDetails()->first();
$this->updateStorageInvoiceTransactionDetails($invoiceTransactionDetails, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded);
@@ -0,0 +1,36 @@
<?php
namespace App\Classes\Notifications;
use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage;
class PermitsReminderEmail extends AbstractEmail
{
/** @var User */
private $user;
private $reminders;
/**
* SendResetPasswordEmail constructor.
* @param User $user
* @param PasswordReset $attempt
*/
public function __construct(User $user, $reminders)
{
$this->user = $user;
$this->reminders = $reminders;
}
public function toMail()
{
return (new MailMessage)
->subject('Permits Renew Remidner Email')
->view('emails.reminder.permits_reminder', ['user' => $this->user, 'reminders' => $this->reminders]);
}
}
@@ -0,0 +1,74 @@
<?php
namespace App\Console\Commands;
use App\Classes\Notifications\PermitsReminderEmail;
use App\Models\PermitsReminder;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Console\Command;
class SendPermitsReminderEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'permitsReminder:send';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send Permits Reminders Email';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$now = now();
$startRange = $now->subDays(3)->startOfDay();
$endRange = $now->copy()->addDays(6)->endOfDay();
$reminders = PermitsReminder::whereDate('reminder_date', '>=', $startRange)
->whereDate('reminder_date', '<=', $endRange)
->pluck('model');
$this->info($this->getTimeStamp() . json_encode($reminders));
$users = User::whereIn(
'email',
[
// 'edmond.wuiming2021@gmail.com',
'anithagurl96@gmail.com'
]
)->get();
foreach ($users as $user) {
$this->info($this->getTimeStamp() . 'Reminder email sent to ' . $user->email);
if (app()->environment('production')) {
$user->notify(new PermitsReminderEmail($user, $reminders));
}
}
}
public function getTimeStamp()
{
return '[' . Carbon::now()->format('Y-m-d H:i:s') . '] - ';
}
}
+5
View File
@@ -67,6 +67,11 @@ class Kernel extends ConsoleKernel
->dailyAt('0:01')
->withoutOverlapping()
->appendOutputTo(storage_path().'/logs/check_storage_invoices.log');
$schedule->command('permitsReminder:send')
->dailyAt('09:30')
->withoutOverlapping()
->appendOutputTo(storage_path().'/logs/permits-reminder-send.log');
}
/**
@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers\Imports;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Imports\Services\GenericImport;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\PermitsReminder;
use Carbon\Carbon;
use DateTime;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Maatwebsite\Excel\Facades\Excel;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class ImportPermitsReminderController
{
/**
* @param Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function import(Request $request)
{
$object = new DocumentObject('', $request->input('files'), '', ApprovalStatus::APPROVED, 'imports');
$file = json_decode($object->getFiles()[0])->file_info->original->file;
$file = storage_path('app/documents/' . $file);
$import = new GenericImport();
Excel::import($import, $file);
$excelRows = $import->rows->toArray();
$successRows = [];
$returnArray = []; // Initialize the return array
foreach ($excelRows as $row) {
if (is_null($row['expiry_date']) && is_null($row['reminder_date'])) {
continue;
}
$row['expiry_date'] = $this->changeExcelDate($row['expiry_date']);
$row['reminder_date'] = $this->changeExcelDate($row['reminder_date']);
$validator = Validator::make($row, [
'model' => 'required|unique:permits_reminders,model',
'expiry_date' => 'required|date|after_or_equal:today',
'reminder_date' => 'required|date|after_or_equal:today',
]);
if ($validator->fails()) {
$row['status'] = 'failed';
$row['message'] = $validator->errors()->all();
$returnArray[] = $row;
} else {
$row['created_at'] = Carbon::now();
$row['updated_at'] = Carbon::now();
$successRows[] = $row;
}
}
if (!empty($successRows)) {
PermitsReminder::insert($successRows); // Insert only if there are successful rows
}
$successCount = count($successRows);
return response()->json([
'completedRows' => $successCount,
'failedRows' => count($returnArray),
'remark' => "Successful Imported {$successCount} data.",
'data' => $returnArray
]);
}
public function changeExcelDate($date)
{
$formatedDate = DateTime::createFromFormat('d/m/Y', $date);
if ($formatedDate instanceof DateTime) {
return $formatedDate->format('Y-m-d');
}
$unixTime = (($date - 25569) * 86400);
return (new DateTime("@$unixTime"))->format('Y-m-d');
}
}
@@ -0,0 +1,59 @@
<?php
namespace App\Http\Controllers\PermitsReminder;
use App\Classes\Exceptions\RequestValidationException;
use App\Models\PermitsReminder;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class CreatePermitsReminderController
{
/**
* @param Request $request
* @return JsonResponse
*/
public function create(Request $request): JsonResponse
{
// Define validation rules
$rules = [
'model' => 'required|unique:permits_reminders,model',
'expiry_date' => 'required|date|after_or_equal:today',
'reminder_date' => 'required|date|after_or_equal:today',
];
// Perform validation
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
$validationErrors = $validator->errors()->all();
$validationError = implode("<br>", $validationErrors);
// Return validation error response
return response()->json([
'title' => 'Create Permits Reminder Failed',
'message' => $validationError,
"payload" => []
], 422); // 422 Unprocessable Entity status code for validation errors
}
// If validation passes, create the record
$record = PermitsReminder::create([
'expiry_date' => Carbon::parse($request->input('expiry_date'))->format('Y-m-d'),
'reminder_date' => Carbon::parse($request->input('reminder_date'))->format('Y-m-d'),
'model' => $request->input('model'),
]);
$response = [
"title" => "Create Permits Reminder Successful",
"message" => "You have successfully created a Permits Reminder",
"payload" => [
"data" => $record
]
];
return response()->json($response);
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers\PermitsReminder;
use App\Models\PermitsReminder;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class DeletePermitsReminderController
{
/**
* @param Request $request
* @return JsonResponse
*/
public function delete(Request $request): JsonResponse
{
$record = PermitsReminder::find($request->route('id'));
$record->delete();
$response = [
"title" => "Delete Permits Reminder Successful",
"message" => "You have successfully deleted a Permits Reminder",
"payload" => []
];
return response()->json($response);
}
}
@@ -0,0 +1,55 @@
<?php
namespace App\Http\Controllers\PermitsReminder;
use App\Models\PermitsReminder;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListPermitsReminderController
{
/**
* @param Request $request
* @return JsonResponse
*/
public function list(Request $request): JsonResponse
{
$perPage = 10; // Number of items per page
$page = request('page', 1); // Get the current page from the request
// Paginate the PermitsReminder model
$query = PermitsReminder::orderBy('id', 'desc');
$paginator = $query->paginate($perPage, ['*'], 'page', $page);
// Convert paginated data to an array
$data = $paginator->items();
// Create pagination links
$links = [
"first" => $paginator->url(1),
"last" => $paginator->url($paginator->lastPage()),
"prev" => $paginator->previousPageUrl(),
"next" => $paginator->nextPageUrl(),
];
$response = [
"title" => "List Permits Reminder",
"message" => "You have successfully retrieved a list of Permits Reminder",
"payload" => [
'data' => $data,
"links" => $links,
"meta" => [
"current_page" => $paginator->currentPage(),
"from" => $paginator->firstItem(),
"last_page" => $paginator->lastPage(),
"path" => $request->path(),
"per_page" => $paginator->perPage(),
"to" => $paginator->lastItem(),
"total" => $paginator->total(),
]
]
];
return response()->json($response);
}
}
@@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers\PermitsReminder;
use App\Models\PermitsReminder;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class UpdatePermitsReminderController
{
/**
* @param Request $request
* @return JsonResponse
*/
public function update(Request $request): JsonResponse
{
$rules = [
'model' => 'required|unique:permits_reminders,model,' . $request->route('id'),
'expiry_date' => 'required|date|after_or_equal:today',
'reminder_date' => 'required|date|after_or_equal:today',
];
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
$validationErrors = $validator->errors()->all();
$validationError = implode("<br>", $validationErrors);
return response()->json([
'title' => 'Update Permits Reminder Failed',
'message' => $validationError,
"payload" => []
], 422);
}
$record = PermitsReminder::findOrFail($request->route('id'));
$record->model = $request->input('model');
$record->expiry_date = Carbon::parse($request->input('expiry_date'))->format('Y-m-d');
$record->reminder_date = Carbon::parse($request->input('reminder_date'))->format('Y-m-d');
$record->save();
return response()->json([
'title' => 'Permits Reminder Updated',
'message' => 'The permits reminder has been successfully updated.',
"payload" => $record
]);
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
class PermitsReminder extends Model
{
use SoftDeletes;
protected $table = 'permits_reminders';
protected $dates = ['deleted_at'];
protected $fillable = ['model', 'expiry_date', 'reminder_date'];
public function getExpiryDateAttribute($value)
{
return $this->attributes['expiry_date'] === null ? NULL : Carbon::parse($this->attributes['expiry_date'])->format('d-m-Y');
}
public function getReminderDateAttribute($value)
{
return $this->attributes['reminder_date'] === null ? NULL : Carbon::parse($this->attributes['reminder_date'])->format('d-m-Y');
}
public function getCreatedAtAttribute($value)
{
return $this->attributes['created_at'] === null ? NULL : Carbon::parse($this->attributes['created_at'])->format('d-m-Y');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePermitsRemindersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('permits_reminders', function (Blueprint $table) {
$table->id();
$table->string('model')->nullable();
$table->timestamp('expiry_date')->nullable();
$table->timestamp('reminder_date')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('permits_reminders');
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsWaivedToTransactionsLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transaction_logs', function (Blueprint $table) {
$table->boolean('is_waived')->nullable()->after('status')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transaction_logs', function (Blueprint $table) {
$table->dropColumn('is_waived');
});
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsWaivedToTransactionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('transactions', function (Blueprint $table) {
$table->boolean('is_waived')->nullable()->after('status')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('transactions', function (Blueprint $table) {
$table->dropColumn('is_waived');
});
}
}
@@ -3,7 +3,7 @@
<div class="col bg-white padding-40 b-rad-lg">
<div class="row m-b-10">
<div class="col text-center">
<p>Plese set the approximate dates of below.</p>
<p>Please set the approximate dates of below.</p>
</div>
</div>
<div class="row">
@@ -12,13 +12,13 @@
<div class="col p-l-0 p-r-10">
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.etd">
<label class="text-primary">Etd</label>
<date-picker-component :parameters="parameters" :value="'etd'"></date-picker-component>
<date-picker-component v-model.lazy="parameters.etd"></date-picker-component>
</validation-wrapper-component>
</div>
<div class="col p-r-0 p-l-10">
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.eta">
<label class="text-primary">Eta</label>
<date-picker-component :parameters="parameters" :value="'eta'"></date-picker-component>
<date-picker-component v-model.lazy="parameters.eta"></date-picker-component>
</validation-wrapper-component>
</div>
</div>
@@ -43,8 +43,8 @@
data() {
return {
parameters: {
etd: this.etd,
eta: this.eta,
etd: this.data.transport.current_schedule.etd,
eta: this.data.transport.current_schedule.eta,
}
};
},
@@ -57,4 +57,4 @@
mixins: [modalFormHandler]
}
</script>
</script>
@@ -0,0 +1,138 @@
<template>
<div class="row parentContainer">
<div class="col">
<div class="row" v-if="!returnData">
<div class="col">
<div class="row m-b-20">
<div class="col">
<div class="btn btn-sm btn-primary rounded b-rad-none"
@click="isUploadingCsv = !isUploadingCsv">{{ isUploadingCsv ? "Cancel" : "Upload Excel" }}
</div>
<div class="btn btn-sm btn-primary rounded b-rad-none requestModal"
data-type="addPermitsReminder" v-if="!isUploadingCsv"><i class="fa fa-plus m-r-5"></i>Add
Permits</div>
<modal-component class="animate__animated animate__fast animate__fadeIn"
type="addPermitsReminder">
<add-permits-reminder-form-component
:section="section"></add-permits-reminder-form-component>
</modal-component>
<div class="btn btn-sm btn-default rounded b-rad-none" @click="refreshData"><i class="fa fa-refresh"></i></div>
</div>
</div>
<div class="row m-b-50" v-if="isUploadingCsv">
<div class="col-12 col-md-6">
<div class="row bg-white">
<div class="col">
<file-input-component :validator="$v.files" v-model="files">
<template slot="label">
<div class="font-heading fs-11 all-caps">Permits Reminder Csv</div>
<div class="fs-8 all-caps d-block m-t-10"><a :href="excelFileUrl" download>Click
HERE to download the template</a></div>
</template>
</file-input-component>
</div>
</div>
<div class="row m-t-20">
<div class="col">
<div class="row">
<div class="col">
<button type="button"
class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none"
@click="submitForm">Upload</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div v-else>
<div class="font-heading fs-16 all-caps bold m-b-15">Permits Reminder</div>
<list-component :key="key" :section="section" :endpoint="route('api.permits_reminder.list')">
<template slot="list" slot-scope="{data}">
<permits-reminder-item-component :data="data"
:section="section"></permits-reminder-item-component>
</template>
</list-component>
</div>
</div>
</div>
<div v-if="returnData">
<div class="font-heading fs-16 all-caps bold m-b-15">Upload Summary</div>
<div class="font-heading fs-12 all-caps bold">Total Completed Rows: {{ returnData.completedRows }}</div>
<div class="font-heading fs-12 all-caps bold m-b-15">Total Failed Rows: {{ returnData.failedRows }}</div>
<div v-if="returnData.failedRows">
<div class="font-heading fs-12 all-caps m-b-15">Please copy error below into a excel file and try again
after it has been corrected.</div>
<table class="w-100 table table-bordered">
<tr>
<th class="text-capitalize" v-for="key in returnDataKeys"> {{ key }}</th>
</tr>
<tr v-for="row in returnData.data">
<td v-for="col in row" :class="[{ 'text-danger': row['status'] == 'failed' }]">
{{ col }}
</td>
</tr>
</table>
</div>
<div class="fs-12 font-arial m-b-0 pointer bold m-t-20 text-primary" @click="refreshData()">Click here to
refresh</div>
</div>
</div>
</div>
</template>
<script>
import { required } from "vuelidate/lib/validators";
export default {
props: {
section: {
type: String,
required: true
}
},
data() {
return {
files: [],
parameters: {},
returnData: null,
data: null,
key: 1,
isUploadingCsv: false,
}
},
computed: {
returnDataKeys() {
return this.returnData ? Object.keys(Object.assign({}, this.returnData.data[0])) : 0;
},
excelFileUrl() {
return `${window.location.origin}/` + 'excel-templates/permits_reminder_template.xlsx';
}
},
validations: {
files: {
required
},
},
methods: {
submitForm() {
this.parameters = {
files: this.files,
};
this.submit(this.route('api.permits_reminder.upload'), 'post', this.section, true, true);
},
errorHandler(error) {
console.log(error);
},
successHandler(response) {
console.log(response);
this.returnData = response;
},
refreshData() {
this.returnData = null;
this.isUploadingCsv = false;
this.key++;
}
},
}
</script>
@@ -0,0 +1,122 @@
<template>
<div class="row parentContainer">
<div class="col">
<div class="row align-items-center">
<div class="col-auto p-r-0">
<div class="padding-5 bg-master-lightest rounded">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172"
style=" fill:#000000;">
<g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt"
stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0"
font-family="none" font-weight="none" font-size="none" text-anchor="none"
style="mix-blend-mode: normal">
<path d="M0,172v-172h172v172z" fill="none"></path>
<g fill="#333333">
<path
d="M15.05,25.8v105.35h4.3v2.15c0,3.53669 2.91331,6.45 6.45,6.45h50.5376c1.67444,3.75213 5.30105,6.45 9.6624,6.45c4.36203,0 7.98734,-2.69797 9.6624,-6.45h50.5376c3.53669,0 6.45,-2.91331 6.45,-6.45v-2.15h4.3v-105.35h-64.5c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643zM19.35,30.1h60.2c2.40083,0 4.3,1.89917 4.3,4.3c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-2.40083 1.89917,-4.3 4.3,-4.3h60.2v96.75h-60.2c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643h-60.2zM86,40.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,49.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,53.57363v4.12783c-8.0754,0.7482 -12.97979,5.32437 -12.97979,12.23232c0,5.8351 3.64818,9.8429 10.31748,11.54785l2.66231,0.68867v13.63906c-4.45695,-0.50955 -7.33113,-2.99253 -7.62998,-6.55078h-6.33662c0.0301,6.9402 5.41175,11.63533 13.9666,12.20293v3.88428h4.09844v-3.91367c8.7634,-0.7482 13.81963,-5.32289 13.81963,-12.65224c0,-6.192 -3.53195,-9.99125 -11.03975,-11.8166l-2.77988,-0.62568v-12.8958c3.9474,0.47945 6.64034,3.04917 6.76074,6.34082h6.24844c-0.1806,-6.67145 -5.26273,-11.39315 -13.00918,-12.08115v-4.12783zM86,58.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,63.4124v12.05596c-4.3086,-0.8686 -6.58018,-2.99112 -6.58018,-6.07207c0,-3.26155 2.75103,-5.77534 6.58018,-5.98389zM86,66.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,75.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM123.78037,82.94717c5.08475,1.01695 7.44521,3.07924 7.44521,6.52139c0,3.79905 -2.71951,6.12871 -7.44521,6.39961zM86,83.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,92.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,101.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,109.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,118.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM23.65,131.15h55.9c2.40083,0 4.3,1.89917 4.3,4.3h4.3c0,-2.40083 1.89917,-4.3 4.3,-4.3h55.9v2.15c0,1.21481 -0.93519,2.15 -2.15,2.15h-53.56523l-0.41992,1.6083c-0.72235,2.78276 -3.19533,4.8417 -6.21484,4.8417c-3.01952,0 -5.49455,-2.05645 -6.21484,-4.8375l-0.41992,-1.6125h-53.56523c-1.21481,0 -2.15,-0.93519 -2.15,-2.15z">
</path>
</g>
</g>
</svg>
</div>
</div>
<div class="col-2">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Model</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading all-caps">{{ data.model }}</div>
</div>
</div>
</div>
<div class="col-2">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Expiry Date</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading all-caps">{{ data.expiry_date }}</div>
</div>
</div>
</div>
<div class="col-2">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Reminder Date</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading all-caps">{{ data.reminder_date }}</div>
</div>
</div>
</div>
<div class="col-2">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Created At</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading all-caps">{{ data.created_at }}</div>
</div>
</div>
</div>
<div class="col-auto">
<div class="row">
<div class="col">
<div class="btn bg-grey no-border muted requestModal" data-type="deleteItem">
<i class="fa fa-trash"></i>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteItem">
<general-confirmation-form-component
contentText="Are you sure you want to delete this Item?"
modalType="delete"
buttonText="Delete"
class="text-center"
:apiRoute="route('api.permits_reminder.delete', data.id)"
apiMethod="delete"
:section="section">
</general-confirmation-form-component>
</modal-component>
<div class="btn bg-grey no-border muted requestModal" data-type="updateItem">
<i class="fa fa-edit"></i>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn"
type="updateItem">
<add-permits-reminder-form-component
:section="section" :existingData="data"></add-permits-reminder-form-component>
</modal-component>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import modalFormHandler from '../../../general/mixins/modalFormHandler';
import { required } from "vuelidate/lib/validators";
export default {
props: {
data: {
type: Object,
required: false,
parameters: {
}
},
},
mixins: [modalFormHandler]
}
</script>
@@ -0,0 +1,109 @@
<template>
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
<div class="col bg-white b-rad-lg">
<div class="row m-b-15">
<div class="col">
<h6 class="all-caps m-b-5 bold no-margin">{{ existingData ? 'Update' : 'Add' }} PERMITS REMINDER</h6>
</div>
</div>
<div class="row m-b-15 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
<div class="col">
<small class="bold fs-10 text-danger" v-html="error"></small>
</div>
</div>
<div class="row">
<div class="col">
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.model">
<label class="text-primary">Model</label>
<div class="controls">
<input type="text" class="form-control fs-12" v-model.trim="parameters.model">
</div>
</validation-wrapper-component>
<div class="row m-auto mt-10 mb-10">
<div class="col p-l-0 p-r-10">
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.expiry_date">
<label class="text-primary">Expiry Date</label>
<date-picker-component v-model="parameters.expiry_date"></date-picker-component>
</validation-wrapper-component>
</div>
</div>
<div class="row m-auto mt-10 mb-10">
<div class="col p-l-0 p-r-10">
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.reminder_date">
<label class="text-primary">Reminder Date</label>
<date-picker-component v-model="parameters.reminder_date"></date-picker-component>
</validation-wrapper-component>
</div>
</div>
</div>
</div>
<div class="row m-t-15">
<div class="col p-r-5">
<div class="btn btn-sm btn-default b-rad-none w-100" data-dismiss="modal">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-sm btn-primary w-100" @click="submitForm()">Confirm</div>
</div>
</div>
</div>
</div>
</template>
<script>
import FormHandler from '../../../general/mixins/formHandler';
import { required } from "vuelidate/lib/validators";
export default {
props: {
existingData: {
type: Object,
}
},
data() {
return {
parameters: {
expiry_date: '',
reminder_date: '',
model: ''
},
};
},
mounted() {
if (this.existingData) {
this.parameters.expiry_date = this.existingData.expiry_date;
this.parameters.reminder_date = this.existingData.reminder_date;
this.parameters.model = this.existingData.model;
}
},
validations: {
parameters: {
expiry_date: { required },
reminder_date: { required },
model: { required },
}
},
methods: {
submitForm() {
var apiRoute = this.existingData ? this.route('api.permits_reminder.update', this.existingData.id) : this.route('api.permits_reminder.create');
this.submit(apiRoute, 'post', this.section, true, true);
},
errorHandler(error) {
// this.formHandler(error.message);
console.log(error);
},
successHandler() {
this.closeModal();
// Reset the validation state of the parameters object
this.$v.parameters.$reset();
this.parameters = {
expiry_date: '',
reminder_date: '',
model: ''
};
},
},
mixins: [FormHandler]
}
</script>
@@ -0,0 +1,12 @@
@extends('emails.layout.base')
@section('content')
<h4 style="font-size: 1em;">Hello, {{ $user->first_name.' '.$user->last_name }}</h4>
<p style="font-size: 0.9em">The permits listed below either expiring within the period of the next 3 days or have already expired 3 days ago.</p>
<ul>
@foreach($reminders as $reminder)
<li>{{ $reminder }}</li>
@endforeach
</ul>
@endsection
+40
View File
@@ -46,6 +46,26 @@
</div>
</div>
</div>
<div class="row m-b-5" v-if="$store.getters.isSuperAdmin || ([2251]).includes($store.getters.getUserId)">
<div class="col">
<div class="row">
<div class="col">
<div class="row">
<div class="col bg-master-light tabButton" tab-name="permits">
<div class="row align-items-center">
<div class="col-auto p-t-10 p-b-10 b-r b-grey">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172" style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#333333"><path d="M15.05,25.8v105.35h4.3v2.15c0,3.53669 2.91331,6.45 6.45,6.45h50.5376c1.67444,3.75213 5.30105,6.45 9.6624,6.45c4.36203,0 7.98734,-2.69797 9.6624,-6.45h50.5376c3.53669,0 6.45,-2.91331 6.45,-6.45v-2.15h4.3v-105.35h-64.5c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643zM19.35,30.1h60.2c2.40083,0 4.3,1.89917 4.3,4.3c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-2.40083 1.89917,-4.3 4.3,-4.3h60.2v96.75h-60.2c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643h-60.2zM86,40.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,49.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,53.57363v4.12783c-8.0754,0.7482 -12.97979,5.32437 -12.97979,12.23232c0,5.8351 3.64818,9.8429 10.31748,11.54785l2.66231,0.68867v13.63906c-4.45695,-0.50955 -7.33113,-2.99253 -7.62998,-6.55078h-6.33662c0.0301,6.9402 5.41175,11.63533 13.9666,12.20293v3.88428h4.09844v-3.91367c8.7634,-0.7482 13.81963,-5.32289 13.81963,-12.65224c0,-6.192 -3.53195,-9.99125 -11.03975,-11.8166l-2.77988,-0.62568v-12.8958c3.9474,0.47945 6.64034,3.04917 6.76074,6.34082h6.24844c-0.1806,-6.67145 -5.26273,-11.39315 -13.00918,-12.08115v-4.12783zM86,58.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,63.4124v12.05596c-4.3086,-0.8686 -6.58018,-2.99112 -6.58018,-6.07207c0,-3.26155 2.75103,-5.77534 6.58018,-5.98389zM86,66.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,75.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM123.78037,82.94717c5.08475,1.01695 7.44521,3.07924 7.44521,6.52139c0,3.79905 -2.71951,6.12871 -7.44521,6.39961zM86,83.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,92.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,101.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,109.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,118.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM23.65,131.15h55.9c2.40083,0 4.3,1.89917 4.3,4.3h4.3c0,-2.40083 1.89917,-4.3 4.3,-4.3h55.9v2.15c0,1.21481 -0.93519,2.15 -2.15,2.15h-53.56523l-0.41992,1.6083c-0.72235,2.78276 -3.19533,4.8417 -6.21484,4.8417c-3.01952,0 -5.49455,-2.05645 -6.21484,-4.8375l-0.41992,-1.6125h-53.56523c-1.21481,0 -2.15,-0.93519 -2.15,-2.15z"></path></g></g></svg>
</div>
<div class="col">
<div class="fs-12 m-t-5 all-caps m-b-5">Permits</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<template v-if="$store.getters.isSuperAdmin">
<div class="row m-b-5">
<div class="col">
@@ -225,6 +245,26 @@
</div>
</div>
</div>
<div class="row tabsContainer hide tabContent" tab-name="permits">
<div class="col">
<div class="row">
<div class="col">
<div class="row p-b-5 m-b-20 b-b b-grey align-items-center parentContainer">
<div class="col">
<div class="font-heading all-caps fs-10 hint-text">
Permits
</div>
</div>
</div>
<div class="row m-b-20">
<div class="col">
<permits-reminder-component section="PermitsReminderComponent"></permits-reminder-component>
</div>
</div>
</div>
</div>
</div>
</div>
<template v-if="$store.getters.isSuperAdmin">
<div class="row tabsContainer hide tabContent" tab-name="team">
<div class="col">
+4
View File
@@ -34,6 +34,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
Route::post('/import/update-debtor/f614e339d7058904a831aad742e24d55', 'Imports\ImportUpdateDebtorController@import')->name('debtor.import');
Route::post('/import/upload-permits-reminder', 'Imports\ImportPermitsReminderController@import')->name('permits_reminder.upload');
require __DIR__ . '/company.php';
require __DIR__ . '/document.php';
@@ -70,6 +72,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
require __DIR__ . '/help_menu.php';
require __DIR__ . '/permits_reminder.php';
require __DIR__ . '/job.php';
});
+11
View File
@@ -0,0 +1,11 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group(['prefix' => 'permits-reminder', 'as' => 'permits_reminder.', 'namespace' => 'PermitsReminder'], function () {
Route::get('/list', 'ListPermitsReminderController@list')->name('list');
Route::post('/create', 'CreatePermitsReminderController@create')->name('create');
Route::delete('/{id}/delete', 'DeletePermitsReminderController@delete')->name('delete');
Route::post('/{id}/update', 'UpdatePermitsReminderController@update')->name('update');
});