Compare commits
29 Commits
renovate/a
...
d03dffad65
| Author | SHA1 | Date | |
|---|---|---|---|
| d03dffad65 | |||
|
|
c571e6a961 | ||
|
|
480d906e6b | ||
|
|
25a73256bf | ||
|
|
a9a3bcf1dc | ||
|
|
e23c493e59 | ||
| 860ee7ecf5 | |||
|
|
a6e7330275 | ||
| 936cdf5c21 | |||
|
|
ec517d01f2 | ||
| da0ff48347 | |||
|
|
6b02cb8c29 | ||
| f106cd1e1e | |||
|
|
33b02fbed7 | ||
| edd9048f0b | |||
|
|
fe7e5301c0 | ||
| ce084122a2 | |||
|
|
fee05e2388 | ||
| b21f68fc36 | |||
|
|
c45efba965 | ||
|
|
ef24ef8549 | ||
| 351bfb359b | |||
|
|
6f5bc9ad38 | ||
| 418a17ffb3 | |||
|
|
28503c0953 | ||
|
|
956f563203 | ||
|
|
f7d37a7c3f | ||
|
|
fe1be84743 | ||
|
|
8b01f91bf7 |
@@ -68,7 +68,7 @@ class SendVehicleReport extends Command
|
||||
'type',
|
||||
])
|
||||
->where('plant_id', $plant->id)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
->whereBetween('entry_time', [$startDate, $endDate])
|
||||
->get();
|
||||
|
||||
if ($vehicleEntries->isEmpty()) {
|
||||
|
||||
64
app/Filament/Exports/DealerVisitPlanExporter.php
Normal file
64
app/Filament/Exports/DealerVisitPlanExporter.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\DealerVisitPlan;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class DealerVisitPlanExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('name')
|
||||
->label('DEALER NAME'),
|
||||
ExportColumn::make('company')
|
||||
->label('DEALER COMPANY'),
|
||||
ExportColumn::make('visit_plan_date')
|
||||
->label('VISIT PLAN DATE'),
|
||||
ExportColumn::make('organizer')
|
||||
->label('ORGANIZER'),
|
||||
ExportColumn::make('employeeMaster.name')
|
||||
->label('RECIPIENT NAME'),
|
||||
ExportColumn::make('number_of_person')
|
||||
->label('NUMBER OF PERSON'),
|
||||
ExportColumn::make('purpose_of_visit')
|
||||
->label('PURPOSE OF VISIT'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your dealer visit plan export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
62
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
62
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerStructureDetailExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('sticker_id')
|
||||
->label('STICKER ID'),
|
||||
ExportColumn::make('sticker_width')
|
||||
->label('STICKER WIDTH'),
|
||||
ExportColumn::make('sticker_height')
|
||||
->label('STICKER HEIGHT'),
|
||||
ExportColumn::make('sticker_lmargin')
|
||||
->label('STICKER LEFT MARGIN'),
|
||||
ExportColumn::make('sticker_rmargin')
|
||||
->label('STICKER RIGHT MARGIN'),
|
||||
ExportColumn::make('sticker_tmargin')
|
||||
->label('STICKER TOP MARGIN'),
|
||||
ExportColumn::make('sticker_bmargin')
|
||||
->label('STICKER BOTTOM MARGIN'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker structure detail export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
127
app/Filament/Imports/DealerVisitPlanImporter.php
Normal file
127
app/Filament/Imports/DealerVisitPlanImporter.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\Plant;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DealerVisitPlanImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Dealer Name')
|
||||
->example('Suresh')
|
||||
->label('Dealer Name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('company')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Dealer Company')
|
||||
->example('Suresh Traders')
|
||||
->label('Dealer Company')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('visit_plan_date')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Visit Plan Date')
|
||||
->example('2026-07-20')
|
||||
->label('Visit Plan Date'),
|
||||
ImportColumn::make('organizer')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Organizer')
|
||||
->example('Ramesh')
|
||||
->label('Organizer'),
|
||||
ImportColumn::make('employee_master_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Receipient Employee Code')
|
||||
->example('RAS001234')
|
||||
->label('Receipient Employee Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('number_of_person')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Number Of Person')
|
||||
->example('10')
|
||||
->label('Number Of Person'),
|
||||
ImportColumn::make('purpose_of_visit')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Purpose Of Visit')
|
||||
->example('Meeting')
|
||||
->label('Purpose Of Visit'),
|
||||
ImportColumn::make('status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Status')
|
||||
->example('Planned/Completed')
|
||||
->label('Status'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?DealerVisitPlan
|
||||
{
|
||||
$warnMsg = [];
|
||||
|
||||
$user = null;
|
||||
$dealerName = trim($this->data['name']);
|
||||
$dealerCompany = trim($this->data['company']);
|
||||
$visitPlanDt = trim($this->data['visit_plan_date']);
|
||||
$organizer = trim($this->data['organizer']);
|
||||
$employeeCode = trim($this->data['employee_master_id']);
|
||||
$noOfPerson = trim($this->data['number_of_person']);
|
||||
$purposeOfVisit = trim($this->data['purpose_of_visit']);
|
||||
$status = trim($this->data['status']);
|
||||
$user = Filament::auth()->user()->name;
|
||||
|
||||
if (Str::length($employeeCode) < 5) {
|
||||
$warnMsg[] = 'Invalid receipient employee number found!';
|
||||
}
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
$employeeId = EmployeeMaster::where('code', $employeeCode)->first();
|
||||
|
||||
$eId = $employeeId->id;
|
||||
|
||||
DealerVisitPlan::updateOrCreate(
|
||||
[
|
||||
'name' => $dealerName,
|
||||
'company' => $dealerCompany,
|
||||
'visit_plan_date' => Carbon::createFromFormat('d-m-Y', $visitPlanDt)->format('Y-m-d'),
|
||||
'organizer' => $organizer,
|
||||
'employee_master_id' => $eId,
|
||||
'number_of_person' => $noOfPerson,
|
||||
'purpose_of_visit' => $purposeOfVisit,
|
||||
'status' => $status,
|
||||
'created_by' => $user,
|
||||
'updated_by' => $user,
|
||||
]
|
||||
);
|
||||
|
||||
return null;
|
||||
|
||||
// return new DealerVisitPlan();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your dealer visit plan import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
49
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
49
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class StickerStructureDetailImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('sticker_id'),
|
||||
ImportColumn::make('sticker_width'),
|
||||
ImportColumn::make('sticker_height'),
|
||||
ImportColumn::make('sticker_lmargin'),
|
||||
ImportColumn::make('sticker_rmargin'),
|
||||
ImportColumn::make('sticker_tmargin'),
|
||||
ImportColumn::make('sticker_bmargin'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerStructureDetail
|
||||
{
|
||||
// return StickerStructureDetail::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new StickerStructureDetail();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your sticker structure detail import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
209
app/Filament/Resources/DealerVisitPlanResource.php
Normal file
209
app/Filament/Resources/DealerVisitPlanResource.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
use App\Filament\Resources\DealerVisitPlanResource\RelationManagers;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use App\Filament\Exports\DealerVisitPlanExporter;
|
||||
use App\Filament\Imports\DealerVisitPlanImporter;
|
||||
|
||||
class DealerVisitPlanResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DealerVisitPlan::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Gate Entry';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('organizer')
|
||||
->label('Organizer'),
|
||||
Forms\Components\TextInput::make('mobile_number')
|
||||
->label('Mobile Number'),
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('Dealer Name'),
|
||||
Forms\Components\TextInput::make('company')
|
||||
->label('Dealer Company'),
|
||||
Forms\Components\DatePicker::make('visit_plan_date')
|
||||
->label('Visit Plan Date'),
|
||||
Forms\Components\Select::make('employee_master_id')
|
||||
->label('Recipient Employee')
|
||||
->relationship('employeeMaster', 'name')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('number_of_person')
|
||||
->label('Number Of Person'),
|
||||
Forms\Components\TextInput::make('purpose_of_visit')
|
||||
->label('Purpose Of Visit'),
|
||||
Forms\Components\Select::make('mode_of_travel')
|
||||
->label('Mode Of Travel')
|
||||
->options([
|
||||
'Rental' => 'Rental',
|
||||
'Car' => 'Car',
|
||||
'Bike' => 'Bike',
|
||||
])
|
||||
->reactive()
|
||||
->placeholder('Select Mode of Travel'),
|
||||
Forms\Components\Select::make('status')
|
||||
->label('Status')
|
||||
->options([
|
||||
'Planned' => 'Planned',
|
||||
'Completed' => 'Completed',
|
||||
])
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Dealer Name')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('company')
|
||||
->label('Dealer Company')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('visit_plan_date')
|
||||
->label('Visit Plan Date')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->date()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('organizer')
|
||||
->label('Organizer')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mobile_number')
|
||||
->label('Mobile Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('employeeMaster.name')
|
||||
->label('Recipient Employee')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('number_of_person')
|
||||
->label('No of Person')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('purpose_of_visit')
|
||||
->label('Purpose of Visit')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mode_of_travel')
|
||||
->label('Mode of travel')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Dealer Visit Plan')
|
||||
->color('warning')
|
||||
->importer(DealerVisitPlanImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import dealer visit plan');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Dealer Visit Plan')
|
||||
->color('warning')
|
||||
->exporter(DealerVisitPlanExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export dealer visit plan');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListDealerVisitPlans::route('/'),
|
||||
'create' => Pages\CreateDealerVisitPlan::route('/create'),
|
||||
'view' => Pages\ViewDealerVisitPlan::route('/{record}'),
|
||||
'edit' => Pages\EditDealerVisitPlan::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDealerVisitPlan extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDealerVisitPlan extends EditRecord
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDealerVisitPlans extends ListRecords
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DealerVisitPlanResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DealerVisitPlanResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewDealerVisitPlan extends ViewRecord
|
||||
{
|
||||
protected static string $resource = DealerVisitPlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
207
app/Filament/Resources/StickerStructureDetailResource.php
Normal file
207
app/Filament/Resources/StickerStructureDetailResource.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StickerStructureDetailExporter;
|
||||
use App\Filament\Imports\StickerStructureDetailImporter;
|
||||
use App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
use App\Filament\Resources\StickerStructureDetailResource\RelationManagers;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Filament\Forms\Components\Html;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
|
||||
class StickerStructureDetailResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('sticker_id')
|
||||
->label('Sticker ID')
|
||||
->reactive()
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
//\Log::info('Sticker ID typed:', ['sticker_id' => $state]);
|
||||
$set('sticker_id_live', $state);
|
||||
}),
|
||||
Forms\Components\TextInput::make('sticker_width')
|
||||
->label('Sticker Width')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_height')
|
||||
->label('Sticker Height')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_lmargin')
|
||||
->label('Sticker Left Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_rmargin')
|
||||
->label('Sticker Right Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_tmargin')
|
||||
->label('Sticker Top Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_bmargin')
|
||||
->label('Sticker Bottom Margin')
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('sticker_id_live')
|
||||
->default(fn ($get) => $get('sticker_id'))
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('sticker_id_live', $state);
|
||||
}),
|
||||
Forms\Components\ViewField::make('generate_template')
|
||||
->view('fields.generate-template')
|
||||
->reactive()
|
||||
//->key(fn ($get) => 'generate-template' . ($get('sticker_id_live') ?? 'empty'))
|
||||
->key(fn (Get $get) =>
|
||||
'generate-template-' .
|
||||
($get('sticker_id_live') ?? 'empty') . '-' .
|
||||
($get('plant_id') ?? 'empty') . '-' .
|
||||
($get('item_characteristic_id') ?? 'empty')
|
||||
)
|
||||
// ->viewData(fn (Get $get) => [
|
||||
// 'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
// ]),
|
||||
->viewData(fn (Get $get) => [
|
||||
'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
'plant_id' => $get('plant_id') ?? 'empty',
|
||||
'item_characteristic_id' => $get('item_characteristic_id') ?? 'empty',
|
||||
])
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('sticker_id')
|
||||
->label('Sticker ID')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_width')
|
||||
->label('Sticker Width')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_height')
|
||||
->label('Sticker Height')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_lmargin')
|
||||
->label('Sticker Left Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_rmargin')
|
||||
->label('Sticker Right Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_tmargin')
|
||||
->label('Sticker Top Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker_bmargin')
|
||||
->label('Sticker Bottom Margin')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Sticker Structure Details')
|
||||
->color('warning')
|
||||
->importer(StickerStructureDetailImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import sticker structure details');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Sticker Structure Details')
|
||||
->color('warning')
|
||||
->exporter(StickerStructureDetailExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export sticker structure details');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerStructureDetails::route('/'),
|
||||
'create' => Pages\CreateStickerStructureDetail::route('/create'),
|
||||
'view' => Pages\ViewStickerStructureDetail::route('/{record}'),
|
||||
'edit' => Pages\EditStickerStructureDetail::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerStructureDetail extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerStructureDetail extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerStructureDetails extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerStructureDetail extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use App\Filament\Resources\VisitorEntryResource\Pages;
|
||||
use App\Filament\Resources\VisitorEntryResource\RelationManagers;
|
||||
use App\Models\VisitorEntry;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -28,6 +29,7 @@ use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Radio;
|
||||
|
||||
class VisitorEntryResource extends Resource
|
||||
{
|
||||
@@ -95,11 +97,13 @@ class VisitorEntryResource extends Resource
|
||||
$set('mobile_number', $employeeExist->mobile_number);
|
||||
$set('company', $plant->name);
|
||||
$set('type', 'InterUnitStaff');
|
||||
$set('dealer', null);
|
||||
} else {
|
||||
$set('name', null);
|
||||
$set('mobile_number', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('dealer', null);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -109,6 +113,92 @@ class VisitorEntryResource extends Resource
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
|
||||
}
|
||||
}),
|
||||
Forms\Components\Select::make('dealer')
|
||||
->label('Dealer Visit')
|
||||
->options(
|
||||
DealerVisitPlan::where('status', 'Planned')
|
||||
->whereDate('visit_plan_date', today())
|
||||
->select('organizer', 'company', 'name')
|
||||
->distinct()
|
||||
->orderBy('organizer')
|
||||
->get()
|
||||
->mapWithKeys(function ($dealer) {
|
||||
$key = "{$dealer->organizer}|{$dealer->company}|{$dealer->name}";
|
||||
|
||||
return [
|
||||
$key => "{$dealer->organizer} ({$dealer->company}) ({$dealer->name})"
|
||||
];
|
||||
})
|
||||
)
|
||||
->searchable()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, $state) {
|
||||
|
||||
if(!$state){
|
||||
$set('name', null);
|
||||
$set('inter_unit', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('number_of_person', null);
|
||||
$set('purpose_of_visit', null);
|
||||
$set('department', null);
|
||||
$set('employee_master_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
[$organizer, $company, $name] = explode('|', $state);
|
||||
|
||||
|
||||
$dealer = DealerVisitPlan::where('organizer', $organizer)
|
||||
->where('company', $company)
|
||||
->where('name', $name)
|
||||
->where('status', 'Planned')
|
||||
->whereDate('visit_plan_date', today())
|
||||
->first();
|
||||
|
||||
if($dealer){
|
||||
|
||||
$organizerExist = DealerVisitPlan::where('organizer', $organizer)->where('name', $name)->where('company', $company)->latest()->first();
|
||||
|
||||
$empDepart = EmployeeMaster::where('id', $dealer->employee_master_id)->first();
|
||||
|
||||
if ($organizerExist) {
|
||||
$set('name', $organizerExist->name);
|
||||
$set('company', $organizerExist->company);
|
||||
$set('number_of_person', $organizerExist->number_of_person);
|
||||
$set('purpose_of_visit', $organizerExist->purpose_of_visit);
|
||||
$set('type', 'Dealers');
|
||||
$set('department', $empDepart->department);
|
||||
$set('organizer', $organizerExist->organizer);
|
||||
$set('inter_unit', null);
|
||||
$set('mobile_number', $organizerExist->mobile_number);
|
||||
$set('mode_of_travel', $organizerExist->mode_of_travel);
|
||||
} else {
|
||||
$set('name', null);
|
||||
$set('mobile_number', null);
|
||||
$set('inter_unit', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('number_of_person', null);
|
||||
$set('purpose_of_visit', null);
|
||||
$set('department', null);
|
||||
// $set('employee_master_id', null);
|
||||
$set('code', null);
|
||||
$set('mode_of_travel', null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$set('name', null);
|
||||
$set('company', null);
|
||||
$set('type', null);
|
||||
$set('number_of_person', null);
|
||||
$set('purpose_of_visit', null);
|
||||
$set('mode_of_travel', null);
|
||||
$set('mobile_number', null);
|
||||
|
||||
}
|
||||
}),
|
||||
Forms\Components\TextInput::make('mobile_number')
|
||||
@@ -148,7 +238,8 @@ class VisitorEntryResource extends Resource
|
||||
'Supplier' => 'Supplier',
|
||||
'InterUnitStaff' => 'Inter Unit Staff',
|
||||
'InterviewCandidates' => 'Interview Candidates',
|
||||
'Customers/Dealers' => 'Customers/Dealers',
|
||||
'Customers' => 'Customers',
|
||||
'Dealers' => 'Dealers',
|
||||
'Bankers' => 'Bankers',
|
||||
'ServiceProviders' => 'Service Providers',
|
||||
'GovermentOfficials' => 'Government Officials',
|
||||
@@ -271,6 +362,8 @@ class VisitorEntryResource extends Resource
|
||||
->validationMessages([
|
||||
'after' => 'Valid Upto must be after the In Time.',
|
||||
]),
|
||||
Forms\Components\Hidden::make('organizer')
|
||||
->label('Organizer'),
|
||||
Forms\Components\View::make('components.webcam-field')
|
||||
->columnSpanFull(),
|
||||
Forms\Components\Hidden::make('photo'),
|
||||
@@ -317,8 +410,13 @@ class VisitorEntryResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('organizer')
|
||||
->label('Organizer')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mobile_number')
|
||||
->label('Visitor Mobile Number')
|
||||
->label('Mobile Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->searchable()
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
namespace App\Filament\Resources\VisitorEntryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\VisitorEntryResource;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\VisitorEntry;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Actions;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
@@ -139,6 +141,18 @@ class CreateVisitorEntry extends CreateRecord
|
||||
else{
|
||||
\Log::warning('No email found for employee ID: ' . $visitor->employee_master_id);
|
||||
}
|
||||
|
||||
|
||||
if ($visitor->type == 'Dealers') {
|
||||
DealerVisitPlan::where('name', $visitor->name)
|
||||
->where('company', $visitor->company)
|
||||
->where('mobile_number', $visitor->mobile_number)
|
||||
->whereDate('visit_plan_date', today())
|
||||
->where('status', 'Planned')
|
||||
->update([
|
||||
'status' => 'Completed',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
|
||||
@@ -276,6 +276,123 @@ class StickerMasterController extends Controller
|
||||
return response()->json($output, 200);
|
||||
}
|
||||
|
||||
public function get_quality_master(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 403);
|
||||
}
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
$itemCode = $request->header('item-code');
|
||||
|
||||
if ($plantCode == null || $plantCode == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
], 400);
|
||||
} elseif (! is_numeric($plantCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant code should contain only numeric values!',
|
||||
], 400);
|
||||
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant code must be between 4 and 7 digits only!',
|
||||
], 400);
|
||||
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
], 400);
|
||||
} elseif ($itemCode == null || $itemCode == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code can't be empty!",
|
||||
], 400);
|
||||
} elseif (Str::length($itemCode) < 6 || ! ctype_alnum($itemCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid item code found!',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant Code not found!',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item Code not found in item table!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$item = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
|
||||
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code not found for the plant : '$plant->name' in item table!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemId = $item->id;
|
||||
|
||||
$description = $item ? $item->description : '';
|
||||
|
||||
$uom = $item ? $item->uom : '';
|
||||
|
||||
// $category = $item ? $item->category : '';
|
||||
|
||||
$stickerMaster = StickerMaster::where('item_id', $itemId)->first();
|
||||
|
||||
if (! $stickerMaster) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item Code not found in sticker master table!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$stickerMaster = StickerMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first();
|
||||
|
||||
if (! $stickerMaster) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code not found for the plant : '$plant->name' in sticker master table!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$output = [
|
||||
'item_description' => $description ?? '',
|
||||
'uom' => $uom ?? '',
|
||||
'Part_Validation_1' => $stickerMaster?->part_validation1 ?? '',
|
||||
'Part_Validation_2' => $stickerMaster?->part_validation2 ?? '',
|
||||
'Part_Validation_3' => $stickerMaster?->part_validation3 ?? '',
|
||||
'Part_Validation_4' => $stickerMaster?->part_validation4 ?? '',
|
||||
'Part_Validation_5' => $stickerMaster?->part_validation5 ?? '',
|
||||
];
|
||||
|
||||
return response()->json($output, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
|
||||
33
app/Models/DealerVisitPlan.php
Normal file
33
app/Models/DealerVisitPlan.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class DealerVisitPlan extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'employee_master_id',
|
||||
'name',
|
||||
'company',
|
||||
'visit_plan_date',
|
||||
'organizer',
|
||||
'mobile_number',
|
||||
'number_of_person',
|
||||
'purpose_of_visit',
|
||||
'mode_of_travel',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function employeeMaster(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EmployeeMaster::class);
|
||||
}
|
||||
|
||||
}
|
||||
28
app/Models/StickerStructureDetail.php
Normal file
28
app/Models/StickerStructureDetail.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerStructureDetail extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'sticker_id',
|
||||
'sticker_width',
|
||||
'sticker_height',
|
||||
'sticker_lmargin',
|
||||
'sticker_rmargin',
|
||||
'sticker_tmargin',
|
||||
'sticker_bmargin',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ class VisitorEntry extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'mobile_number',
|
||||
'organizer',
|
||||
'register_id',
|
||||
'name',
|
||||
'company',
|
||||
|
||||
106
app/Policies/DealerVisitPlanPolicy.php
Normal file
106
app/Policies/DealerVisitPlanPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\DealerVisitPlan;
|
||||
use App\Models\User;
|
||||
|
||||
class DealerVisitPlanPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, DealerVisitPlan $dealervisitplan): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete DealerVisitPlan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any DealerVisitPlan');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerStructureDetailPolicy.php
Normal file
106
app/Policies/StickerStructureDetailPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerStructureDetailPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerStructureDetail');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE dealer_visit_plans (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
employee_master_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT DEFAULT NULL,
|
||||
company TEXT DEFAULT NULL,
|
||||
visit_plan_date DATE DEFAULT NULL,
|
||||
organizer TEXT DEFAULT NULL,
|
||||
mobile_number TEXT DEFAULT NULL,
|
||||
number_of_person TEXT DEFAULT NULL,
|
||||
purpose_of_visit TEXT DEFAULT NULL,
|
||||
mode_of_travel TEXT DEFAULT NULL,
|
||||
status TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NULL,
|
||||
updated_by TEXT NULL,
|
||||
|
||||
FOREIGN KEY (employee_master_id) REFERENCES employee_masters (id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('dealer_visit_plans');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql3 = <<<'SQL'
|
||||
ALTER TABLE visitor_entries
|
||||
ADD COLUMN organizer TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('visitor_entries', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_structure_details (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
sticker_id TEXT DEFAULT NULL,
|
||||
sticker_width TEXT DEFAULT NULL,
|
||||
sticker_height TEXT DEFAULT NULL,
|
||||
sticker_lmargin TEXT DEFAULT NULL,
|
||||
sticker_rmargin TEXT DEFAULT NULL,
|
||||
sticker_tmargin TEXT DEFAULT NULL,
|
||||
sticker_bmargin TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_structure_details');
|
||||
}
|
||||
};
|
||||
@@ -76,9 +76,24 @@
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
|
||||
</p>
|
||||
{{-- <p class="text-lg font-medium text-gray-900">
|
||||
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p> --}}
|
||||
<p class="text-lg font-medium text-gray-900 flex items-center gap-2">
|
||||
<img
|
||||
src="https://www.zoho.com/favicon.ico"
|
||||
alt="Zoho"
|
||||
class="w-5 h-5"
|
||||
>
|
||||
|
||||
<span>Zoho Support:</span>
|
||||
|
||||
<a
|
||||
href="https://join.zoho.in"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="font-semibold text-blue-600 hover:underline"
|
||||
>
|
||||
https://join.zoho.in
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
|
||||
@@ -167,6 +167,10 @@ Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf
|
||||
|
||||
// ..Part Validation - Characteristics
|
||||
|
||||
Route::get('laser/item/get-quality-master-data', [StickerMasterController::class, 'get_quality_master']);
|
||||
|
||||
// ..Part Validation - Characteristics
|
||||
|
||||
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
||||
|
||||
// ..Laser Route to SAP
|
||||
@@ -235,6 +239,6 @@ Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'pri
|
||||
|
||||
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
||||
|
||||
//..Item Code
|
||||
// ..Item Code
|
||||
|
||||
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
||||
|
||||
Reference in New Issue
Block a user