Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

feat: ability to manage softwares #856

Merged
merged 48 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d8bbfe9
feat: ability to manage softwares
djaiss May 8, 2021
d5edf20
wip
djaiss May 8, 2021
7fa936e
wip
djaiss May 8, 2021
5735c7c
services should be done
djaiss May 8, 2021
c71f449
collection to software index
djaiss May 8, 2021
b4600f5
Update AdminSoftwareViewHelperTest.php
djaiss May 9, 2021
969445e
Merge branch 'main' into 2021-05-07-software
djaiss May 9, 2021
a8a8a5d
wip
djaiss May 10, 2021
aa6ce4e
Merge branch 'main' into 2021-05-07-software
djaiss May 11, 2021
376cde1
wip
djaiss May 11, 2021
71edb75
Merge branch 'main' into 2021-05-07-software
djaiss May 21, 2021
8596532
wip
djaiss May 23, 2021
b2a4b12
Merge branch 'main' into 2021-05-07-software
djaiss May 23, 2021
53c1857
wip
djaiss May 24, 2021
d416684
wip
djaiss May 25, 2021
719dbe7
wip
djaiss May 26, 2021
35d6474
Update Show.vue
djaiss May 26, 2021
bfd3840
wip
djaiss May 26, 2021
6dcb2d1
wip
djaiss May 26, 2021
2f5bcdb
Update GiveSeatToEveryEmployeeTest.php
djaiss May 26, 2021
2d3c7bf
Update GiveSeatToEveryEmployeeTest.php
djaiss May 26, 2021
f426c2c
wip
djaiss May 29, 2021
9c82666
wip
djaiss Jun 1, 2021
ec87d3c
Update account.php
djaiss Jun 1, 2021
e57c5ca
wip
djaiss Jun 1, 2021
5693c48
wip
djaiss Jun 1, 2021
23fd97d
Update Show.vue
djaiss Jun 4, 2021
d15437e
merge
djaiss Jun 5, 2021
c25d716
Optimised images with calibre/image-actions
github-actions[bot] Jun 5, 2021
d263d78
omg almost done
djaiss Jun 5, 2021
9cf4b6a
Update AdminSoftwareViewHelperTest.php
djaiss Jun 6, 2021
64ad700
Update phpstan.neon
djaiss Jun 6, 2021
a41f7f9
fucking hell
djaiss Jun 6, 2021
c80e50f
Merge branch 'main' into 2021-05-07-software
djaiss Jun 7, 2021
2298c18
fix
djaiss Jun 7, 2021
e683494
wiip
djaiss Jun 7, 2021
b7dfee6
Update app/Http/Controllers/Company/Adminland/AdminSoftwareController…
djaiss Jun 7, 2021
af6068a
Update routes/web.php
djaiss Jun 7, 2021
9253454
Update resources/js/Pages/Adminland/Software/Show.vue
djaiss Jun 7, 2021
29a4512
Update resources/js/Pages/Adminland/Software/Show.vue
djaiss Jun 7, 2021
ba3efe2
Update resources/js/Pages/Adminland/Software/Index.vue
djaiss Jun 7, 2021
37011ce
Update app/Http/ViewHelpers/Employee/EmployeeShowViewHelper.php
djaiss Jun 7, 2021
11b306e
Update app/Http/ViewHelpers/Adminland/AdminSoftwareViewHelper.php
djaiss Jun 7, 2021
92e6be5
Merge branch 'main' into 2021-05-07-software
djaiss Jun 7, 2021
5bd339e
git add . && git commit -m 'wip'
djaiss Jun 7, 2021
a2c51c8
Merge branch '2021-05-07-software' of github.com:officelifehq/officel…
djaiss Jun 7, 2021
2d7c0c9
Merge branch 'main' into 2021-05-07-software
djaiss Jun 8, 2021
01c312a
add help links
djaiss Jun 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions app/Console/Commands/Tests/SetupDummyAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
use App\Services\Company\Adminland\Hardware\CreateHardware;
use App\Services\Company\Adminland\Position\CreatePosition;
use App\Services\Company\Adminland\Question\CreateQuestion;
use App\Services\Company\Adminland\Software\CreateSoftware;
use App\Services\Company\Employee\HiringDate\SetHiringDate;
use App\Services\Company\Employee\Timesheet\RejectTimesheet;
use App\Services\Company\Employee\Timesheet\SubmitTimesheet;
Expand All @@ -64,6 +65,7 @@
use App\Services\Company\Team\Description\SetTeamDescription;
use App\Services\Company\Employee\OneOnOne\CreateOneOnOneNote;
use App\Services\Company\Employee\Skill\AttachEmployeeToSkill;
use App\Services\Company\Adminland\Software\GiveSeatToEmployee;
use App\Services\Company\Employee\OneOnOne\CreateOneOnOneEntry;
use App\Services\Company\Adminland\Employee\AddEmployeeToCompany;
use App\Services\Company\Employee\Timesheet\CreateOrGetTimesheet;
Expand Down Expand Up @@ -208,6 +210,7 @@ public function handle(): void
$this->addAnswers();
$this->addExpenses();
$this->createHardware();
$this->createSoftware();
$this->addRecentShips();
$this->addRateYourManagerSurveys();
$this->addOneOnOnes();
Expand Down Expand Up @@ -1384,6 +1387,44 @@ private function createHardware(): void
}
}

private function createSoftware(): void
{
$this->info('☐ Add softwares and associate them to employees');

$softwares = collect([
'Office 365',
'Sketch',
'Adobe Reader',
'Sublime Text 4',
'Powerpoint',
'Zoom',
'Teams',
]);

foreach ($softwares as $item) {
$newlyItem = (new CreateSoftware)->execute([
'company_id' => $this->company->id,
'author_id' => $this->michael->id,
'name' => $item,
'seats' => rand(3, 30),
'product_key' => $this->faker->uuid,
]);

foreach ($this->employees as $employee) {
if (rand(1, 2) == 1) {
continue;
}

(new GiveSeatToEmployee)->execute([
'company_id' => $this->company->id,
'author_id' => $this->michael->id,
'employee_id' => $employee->id,
'software_id' => $newlyItem->id,
]);
}
}
}

private function addRecentShips(): void
{
$this->info('☐ Add recent ships entries for teams');
Expand Down
9 changes: 9 additions & 0 deletions app/Exceptions/NotEnoughSoftwareSeat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace App\Exceptions;

use Exception;

class NotEnoughSoftwareSeat extends Exception
{
}
46 changes: 46 additions & 0 deletions app/Helpers/LogHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,52 @@ public static function processAuditLog(AuditLog $log): string
]);
break;

case 'software_created':
$sentence = trans('account.log_software_created', [
'software_id' => $log->object->{'software_id'},
'software_name' => $log->object->{'software_name'},
]);
break;

case 'software_updated':
$sentence = trans('account.log_software_updated', [
'software_id' => $log->object->{'software_id'},
'software_name' => $log->object->{'software_name'},
]);
break;

case 'software_destroyed':
$sentence = trans('account.log_software_destroyed', [
'software_id' => $log->object->{'software_id'},
'software_name' => $log->object->{'software_name'},
]);
break;

case 'software_seat_given_to_employee':
$sentence = trans('account.log_software_seat_given_to_employee', [
'software_id' => $log->object->{'software_id'},
'software_name' => $log->object->{'software_name'},
'employee_id' => $log->object->{'employee_id'},
'employee_name' => $log->object->{'employee_name'},
]);
break;

case 'software_seat_taken_from_employee':
$sentence = trans('account.log_software_seat_taken_from_employee', [
'software_id' => $log->object->{'software_id'},
'software_name' => $log->object->{'software_name'},
'employee_id' => $log->object->{'employee_id'},
'employee_name' => $log->object->{'employee_name'},
]);
break;

case 'software_seat_given_to_employees':
$sentence = trans('account.log_software_seat_given_to_employees', [
'software_id' => $log->object->{'software_id'},
'software_name' => $log->object->{'software_name'},
]);
break;

case 'employee_joined_company':
$sentence = trans('account.log_employee_joined_company', [
'company_name' => $log->object->{'company_name'},
Expand Down
Loading