Procházet zdrojové kódy

first commit

master
root před 6 roky
revize
5d9727bc81
42 změnil soubory, kde provedl 7744 přidání a 0 odebrání
  1. 21
    0
      .env
  2. 10
    0
      .gitignore
  3. 42
    0
      bin/console
  4. 73
    0
      composer.json
  5. 5077
    0
      composer.lock
  6. 23
    0
      config/bootstrap.php
  7. 10
    0
      config/bundles.php
  8. 19
    0
      config/packages/cache.yaml
  9. 7
    0
      config/packages/dev/jms_serializer.yaml
  10. 19
    0
      config/packages/dev/monolog.yaml
  11. 3
    0
      config/packages/dev/routing.yaml
  12. 16
    0
      config/packages/framework.yaml
  13. 13
    0
      config/packages/jms_serializer.yaml
  14. 6
    0
      config/packages/prod/jms_serializer.yaml
  15. 24
    0
      config/packages/prod/monolog.yaml
  16. 4
    0
      config/packages/routing.yaml
  17. 3
    0
      config/packages/sensio_framework_extra.yaml
  18. 4
    0
      config/packages/test/framework.yaml
  19. 12
    0
      config/packages/test/monolog.yaml
  20. 3
    0
      config/packages/test/routing.yaml
  21. 3
    0
      config/packages/test/validator.yaml
  22. 4
    0
      config/packages/twig.yaml
  23. 8
    0
      config/packages/validator.yaml
  24. 45
    0
      config/routes.yaml
  25. 3
    0
      config/routes/annotations.yaml
  26. 3
    0
      config/routes/dev/twig.yaml
  27. 27
    0
      config/services.yaml
  28. 0
    0
      src/Controller/.gitignore
  29. 121
    0
      src/Controller/Api/BarcodeController.php
  30. 45
    0
      src/Controller/Api/BaseController.php
  31. 226
    0
      src/Controller/Api/CompoundController.php
  32. 123
    0
      src/Controller/Api/ImportPDFController.php
  33. 70
    0
      src/Controller/Api/InvestigationController.php
  34. 101
    0
      src/Controller/Api/MemoController.php
  35. 363
    0
      src/Controller/Api/PdfController.php
  36. 53
    0
      src/Kernel.php
  37. 350
    0
      symfony.lock
  38. 12
    0
      templates/base.html.twig
  39. 507
    0
      templates/compound.html.twig
  40. 131
    0
      templates/inventori.html.twig
  41. 160
    0
      templates/memo.html.twig
  42. 0
    0
      templates/notis_peringatan.html.twig

+ 21
- 0
.env Zobrazit soubor

@@ -0,0 +1,21 @@
# In all environments, the following files are loaded if they exist,
# the later taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=04d49a5863e2fe70c62b75dbd13d7beb
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS='^localhost|example\.com$'
###< symfony/framework-bundle ###

+ 10
- 0
.gitignore Zobrazit soubor

@@ -0,0 +1,10 @@

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/public/
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

+ 42
- 0
bin/console Zobrazit soubor

@@ -0,0 +1,42 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
}

set_time_limit(0);

require dirname(__DIR__).'/vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);

+ 73
- 0
composer.json Zobrazit soubor

@@ -0,0 +1,73 @@
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"dompdf/dompdf": "^0.8.3",
"jms/serializer-bundle": "^3.4",
"rguedes/pdfmerger": "^1.0",
"sensio/framework-extra-bundle": "^5.4",
"symfony/asset": "4.3.*",
"symfony/console": "4.3.*",
"symfony/dotenv": "4.3.*",
"symfony/filesystem": "4.3.*",
"symfony/flex": "^1.3.1",
"symfony/form": "4.3.*",
"symfony/framework-bundle": "4.3.*",
"symfony/monolog-bundle": "^3.5",
"symfony/twig-pack": "^1.0",
"symfony/validator": "4.3.*",
"symfony/yaml": "4.3.*",
"zendframework/zend-barcode": "^2.7"
},
"require-dev": {
"symfony/var-dumper": "4.3.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.3.*"
}
}
}

+ 5077
- 0
composer.lock
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 23
- 0
config/bootstrap.php Zobrazit soubor

@@ -0,0 +1,23 @@
<?php

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__).'/vendor/autoload.php';

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}

$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

+ 10
- 0
config/bundles.php Zobrazit soubor

@@ -0,0 +1,10 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
];

+ 19
- 0
config/packages/cache.yaml Zobrazit soubor

@@ -0,0 +1,19 @@
framework:
cache:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name

# The app cache caches to the filesystem by default.
# Other options include:

# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost

# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu

# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null

+ 7
- 0
config/packages/dev/jms_serializer.yaml Zobrazit soubor

@@ -0,0 +1,7 @@
jms_serializer:
visitors:
json_serialization:
options:
- JSON_PRETTY_PRINT
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION

+ 19
- 0
config/packages/dev/monolog.yaml Zobrazit soubor

@@ -0,0 +1,19 @@
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]

+ 3
- 0
config/packages/dev/routing.yaml Zobrazit soubor

@@ -0,0 +1,3 @@
framework:
router:
strict_requirements: true

+ 16
- 0
config/packages/framework.yaml Zobrazit soubor

@@ -0,0 +1,16 @@
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
#http_method_override: true

# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax

#esi: true
#fragments: true
php_errors:
log: true

+ 13
- 0
config/packages/jms_serializer.yaml Zobrazit soubor

@@ -0,0 +1,13 @@
jms_serializer:
visitors:
xml_serialization:
format_output: '%kernel.debug%'
# metadata:
# auto_detection: false
# directories:
# any-name:
# namespace_prefix: "My\\FooBundle"
# path: "@MyFooBundle/Resources/config/serializer"
# another-name:
# namespace_prefix: "My\\BarBundle"
# path: "@MyBarBundle/Resources/config/serializer"

+ 6
- 0
config/packages/prod/jms_serializer.yaml Zobrazit soubor

@@ -0,0 +1,6 @@
jms_serializer:
visitors:
json_serialization:
options:
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION

+ 24
- 0
config/packages/prod/monolog.yaml Zobrazit soubor

@@ -0,0 +1,24 @@
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"
deprecation_filter:
type: filter
handler: deprecation
max_level: info
channels: ["php"]

+ 4
- 0
config/packages/routing.yaml Zobrazit soubor

@@ -0,0 +1,4 @@
framework:
router:
strict_requirements: null
utf8: true

+ 3
- 0
config/packages/sensio_framework_extra.yaml Zobrazit soubor

@@ -0,0 +1,3 @@
sensio_framework_extra:
router:
annotations: false

+ 4
- 0
config/packages/test/framework.yaml Zobrazit soubor

@@ -0,0 +1,4 @@
framework:
test: true
session:
storage_id: session.storage.mock_file

+ 12
- 0
config/packages/test/monolog.yaml Zobrazit soubor

@@ -0,0 +1,12 @@
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

+ 3
- 0
config/packages/test/routing.yaml Zobrazit soubor

@@ -0,0 +1,3 @@
framework:
router:
strict_requirements: true

+ 3
- 0
config/packages/test/validator.yaml Zobrazit soubor

@@ -0,0 +1,3 @@
framework:
validation:
not_compromised_password: false

+ 4
- 0
config/packages/twig.yaml Zobrazit soubor

@@ -0,0 +1,4 @@
twig:
default_path: '%kernel.project_dir%/templates'
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'

+ 8
- 0
config/packages/validator.yaml Zobrazit soubor

@@ -0,0 +1,8 @@
framework:
validation:
email_validation_mode: html5

# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []

+ 45
- 0
config/routes.yaml Zobrazit soubor

@@ -0,0 +1,45 @@
api_upload_compound_image:
path: /api/upload/compound/picture
controller: App\Controller\Api\CompoundController::uploadCompoundImage
methods: POST

api_upload_accaptance_compound:
path: /api/upload/acceptance/compound
controller: App\Controller\Api\CompoundController::uploadCompoundAcceptance
methods: POST

api_upload_investigation_file:
path: /api/upload/investigation/file
controller: App\Controller\Api\InvestigationController::uploadInvestigationFile
methods: POST

api_generate_barcode:
path: /api/generate/barcode
controller: App\Controller\Api\BarcodeController::uploadBarcodeImage
methods: POST

api_upload_memo_pdf:
path: /api/upload/memo/pdf
controller: App\Controller\Api\MemoController::uploadMemoPDF
methods: POST

api_upload_file_memo_pdf:
path: /api/upload/file/memo/pdf
controller: App\Controller\Api\MemoController::uploadConfidentialMemoPDF
methods: POST


api_compound_pdf:
path: /api/store/compound/pdf
controller: App\Controller\Api\PdfController::viewAllPDF
methods: POST

api_convert_compound_pdf:
path: /api/compound/pdf
controller: App\Controller\Api\PdfController::storeCompoundPDF
methods: POST

api_import_compound_pdf:
path: /api/import/compound/pdf
controller: App\Controller\Api\ImportPDFController::storeCompoundPDF
methods: POST

+ 3
- 0
config/routes/annotations.yaml Zobrazit soubor

@@ -0,0 +1,3 @@
controllers:
resource: ../../src/Controller/
type: annotation

+ 3
- 0
config/routes/dev/twig.yaml Zobrazit soubor

@@ -0,0 +1,3 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error

+ 27
- 0
config/services.yaml Zobrazit soubor

@@ -0,0 +1,27 @@
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:

services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'

# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

+ 0
- 0
src/Controller/.gitignore Zobrazit soubor


+ 121
- 0
src/Controller/Api/BarcodeController.php Zobrazit soubor

@@ -0,0 +1,121 @@
<?php
namespace App\Controller\Api;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use App\Controller\Api\BaseController;
use Zend\Barcode\Barcode;
class BarcodeController extends BaseController{
// *
// *
// * @Method({"GET"})
public function generateBarcodeImage($barcode){
$barcodeOptions = ['text' => $barcode];
// No required options.
$rendererOptions = [];
$renderer = Barcode::factory(
'code39',
'image',
$barcodeOptions,
$rendererOptions
)->draw();
return $renderer;
}
// *
// * /api/generate/barcode
// * @Method({"GET"})
public function uploadBarcodeImage(Request $request){
$filesystem = new Filesystem();
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$request->get('no_siri').'/barcode';
if(!$filesystem->exists('staging/document/'.$request->get('no_siri').'/barcode')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$request->get('no_siri').'/barcode';
if(!$filesystem->exists('production/document/'.$request->get('no_siri').'/barcode')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$request->get('no_siri').'/barcode';
if(!$filesystem->exists('proxy/'.$request->get('no_siri').'/barcode')){
$filesystem->mkdir($destinationPath, 0700);
}
}
$barcode = array();
$barcode_image = $this->generateBarcodeImage($request->get('barcode'));
if (imagepng($barcode_image, $destinationPath .'/'.$request->get('barcode').'.png')) {
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
$barcode_url = $urlPackage->getUrl('/'.$destinationPath .'/'.$request->get('barcode').'.png');
return $this->sendResponse($barcode_url, 'Berjaya memuatnaik generate barcode');
}else{
return $this->sendError('Gagal', 'Generate Barcode');
}
}
public function uploadInvestigationFile(Request $request){
$i = 1;
$filesystem = new Filesystem();
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$request->get('no_siri').'/investigation';
if(!$filesystem->exists('staging/document/'.$request->get('no_siri').'/investigation')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$request->get('no_siri').'/investigation';
if(!$filesystem->exists('production/document/'.$request->get('no_siri').'/investigation')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$request->get('no_siri').'/investigation';
if(!$filesystem->exists('proxy/'.$request->get('no_siri').'/investigation')){
$filesystem->mkdir($destinationPath, 0700);
}
}
$allowedfileExtension = ['pdf'];
$destinationPathImage = array();
if($request->files->has('attachment')){
$a = $request->files->get('attachment');
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
$extension = $a->getClientOriginalExtension();
$check=in_array($extension,$allowedfileExtension);
if($check) {
$filename = uniqid();
$a->move($destinationPath,$filename.'.'.$extension);
$pathPDF = $urlPackage->getUrl('/'.$destinationPath.'/'.$filename.'.'.$extension);
return $this->sendResponse($pathPDF, 'Berjaya memuatnaik lampiran');
}else{
return $this->sendError('Gagal', 'Format lampiran hendaklah PDF');
}
}else{
return $this->sendError('Gagal', 'Lampiran tidak dimuatnaik!');
}
}
}

+ 45
- 0
src/Controller/Api/BaseController.php Zobrazit soubor

@@ -0,0 +1,45 @@
<?php
namespace App\Controller\Api;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
class BaseController {
/**
* success response method.
*
* @return \Illuminate\Http\Response
*/
public function sendResponse($result, $message)
{
$response = [
'success' => true,
'data' => $result,
'message' => $message,
];
return new JsonResponse($response, 200);
}
/**
* return error response.
*
* @return \Illuminate\Http\Response
*/
public function sendError($error, $errorMessages = [])
{
$response = [
'success' => false,
'message' => $error,
];
if(!empty($errorMessages)){
$response['data'] = $errorMessages;
}
return new JsonResponse($response, 200);
}
}

+ 226
- 0
src/Controller/Api/CompoundController.php Zobrazit soubor

@@ -0,0 +1,226 @@
<?php
namespace App\Controller\Api;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Knp\Bundle\SnappyBundle\Snappy\Response\PdfResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use App\Controller\Api\BaseController;
use Dompdf\Dompdf;
use Dompdf\Options;
class CompoundController extends Controller{
/**
* success response method.
*
* @return \Illuminate\Http\Response
*/
public function sendResponse($result, $message)
{
$response = [
'success' => true,
'data' => $result,
'message' => $message,
];
return new JsonResponse($response, 200);
}
/**
* return error response.
*
* @return \Illuminate\Http\Response
*/
public function sendError($error, $errorMessages = [])
{
$response = [
'success' => false,
'message' => $error,
];
if(!empty($errorMessages)){
$response['data'] = $errorMessages;
}
return new JsonResponse($response, 200);
}
// *
// * @Route(/api/upload/compound/picture)
// * @Method({"POST"})
public function uploadCompoundImage(Request $request){
$i = 1; $success_upload = 0; $count_upload = 0;
$filesystem = new Filesystem();
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$request->get('no_siri').'/compound';
if(!$filesystem->exists('staging/document/'.$request->get('no_siri').'/compound')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$request->get('no_siri').'/compound';
if(!$filesystem->exists('production/document/'.$request->get('no_siri').'/compound')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$request->get('no_siri').'/compound';
if(!$filesystem->exists('proxy/'.$request->get('no_siri').'/compound')){
$filesystem->mkdir($destinationPath, 0700);
}
}
$allowedfileExtension = ['jpg','jpeg'];
$destinationPathImage = array();
if($request->files->has('file')){
$count_upload = count($request->files->get('file'));
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
foreach($request->files->get('file') as $f){
$extension = $f->getClientOriginalExtension();
$check=in_array($extension,$allowedfileExtension);
if($check) {
$name = $request->get('kp').'-'.$i++.'.'.$f->getClientOriginalExtension();
$destinationPathImage[] = $urlPackage->getUrl('/'.$destinationPath.'/'.$name);
$f->move($destinationPath, $name);
$success_upload++;
}
}
return $this->sendResponse($destinationPathImage, $success_upload.'/'.$count_upload.' berjaya memuatnaik gambar kompaun');
}else{
return $this->sendError('Gagal', 'Gambar kompaun tidak dimuatnaik!');
}
}
public function uploadCompoundAcceptance(Request $request){
$i = 1; $success_upload = 0; $count_upload = 0;
$filesystem = new Filesystem();
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$request->get('no_siri').'/compound';
if(!$filesystem->exists('staging/document/'.$request->get('no_siri').'/compound')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$request->get('no_siri').'/compound';
if(!$filesystem->exists('production/document/'.$request->get('no_siri').'/compound')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$request->get('no_siri').'/compound';
if(!$filesystem->exists('proxy/'.$request->get('no_siri').'/compound')){
$filesystem->mkdir($destinationPath, 0700);
}
}
$allowedfileExtension = ['jpg','jpeg'];
$destinationPathImage = array();
if($request->files->has('file')){
$count_upload = count($request->files->get('file'));
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
foreach($request->files->get('file') as $f){
$extension = $f->getClientOriginalExtension();
$check=in_array($extension,$allowedfileExtension);
if($check) {
$name = 'accepted_'.$request->get('kp').'-'.$i++.'.'.$f->getClientOriginalExtension();
$destinationPathImage[] = $urlPackage->getUrl('/'.$destinationPath.'/'.$name);
$f->move($destinationPath, $name);
$success_upload++;
}
}
return $this->sendResponse($destinationPathImage, $success_upload.'/'.$count_upload.' berjaya memuatnaik gambar kompaun');
}else{
return $this->sendError('Gagal', 'Gambar kompaun tidak dimuatnaik!');
}
}
public function storeCompoundPDF(Request $request)
{
//Decode Json
$compound = json_decode($request->get('compound'), true);
$staff = json_decode($request->get('staff'), true);
$department = json_decode($request->get('department'), true);
$faulty = json_decode($request->get('faulty'), true);
$site = json_decode($request->get('site'), true);
return $this->sendResponse($compound, ' berjaya memuatnaik gambar kompaun');
// Configure Dompdf according to your needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont', 'Arial');
// Instantiate Dompdf with our options
$dompdf = new Dompdf($pdfOptions);
// Retrieve the HTML generated in our twig file
$html = $this->render('compound.html.twig', [
'compound' => $compound,
'staff' => $staff,
'department' => $department,
'faulty' => $faulty,
'tawaran' => $request->get('tawaran'),
'site' => $request->get('site'),
]);
// Load HTML to Dompdf
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Store PDF Binary Data
$output = $dompdf->output();
// In this case, we want to write the file in the public directory
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$compound->ConfidentialFile->no_siri;
if(!File::exists(public_path().'/'.$destinationPath)) {
File::makeDirectory(public_path().'/'.$destinationPath, $mode = 0777, true, true);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$compound->ConfidentialFile->no_siri;
if(!File::exists(public_path().'/'.$destinationPath)) {
File::makeDirectory(public_path().'/'.$destinationPath, $mode = 0777, true, true);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/document/'.$compound->ConfidentialFile->no_siri;
if(!File::exists(public_path().'/'.$destinationPath)) {
File::makeDirectory(public_path().'/'.$destinationPath, $mode = 0777, true, true);
}
}
$publicDirectory = $this->get('kernel')->getProjectDir() . '/'.$destinationPath;
// e.g /var/www/project/public/mypdf.pdf
$pdfFilepath = $publicDirectory . '/'.$compound->kpd.'.pdf';
// Write file to the desired path
file_put_contents($pdfFilepath, $output);
// Send some text response
return $this->sendError('Gagal', 'Gambar kompaun tidak dimuatnaik!');
}
}

+ 123
- 0
src/Controller/Api/ImportPDFController.php Zobrazit soubor

@@ -0,0 +1,123 @@
<?php
namespace App\Controller\Api;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Knp\Bundle\SnappyBundle\Snappy\Response\PdfResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Dompdf\Dompdf;
use Dompdf\Options;
use PDFMerger;
class ImportPDFController extends Controller {
public function decodeCompoundJson(Request $request){
$compound = json_decode($request->get('compound'), true);
return $compound;
}
public function decodeStaffJson(Request $request){
$staff = json_decode($request->get('staff'), true);
return $staff;
}
public function decodeDepartmentJson(Request $request){
$department = json_decode($request->get('department'), true);
return $department;
}
public function decodeFaultyJson(Request $request){
$faulty = json_decode($request->get('faulty'), true);
return $faulty;
}
public function decodeSiteJson(Request $request){
$site = json_decode($request->get('site'), true);
return $site;
}
public function decodeFileJson(Request $request){
$file = json_decode($request->get('file'), true);
return $file;
}
public function storeCompoundPDF(Request $request)
{
//Decode Json
$compound = $this->decodeCompoundJson($request);
$staff = $this->decodeStaffJson($request);
$department = $this->decodeDepartmentJson($request);
$faulty = $this->decodeFaultyJson($request);
$site = $this->decodeSiteJson($request);
// return new JsonResponse(['success' => true, 'data'=> $request->get('faulty'), 'message' => ''], 200);
$tarikh = date('d/m/Y', strtotime($compound['created_at']));
$masa = date('h:i:s a', strtotime($compound['created_at']));
// Configure Dompdf according to your needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont','Times New Roman','sans-serif');
$pdfOptions->set('enable_remote', TRUE);
// Instantiate Dompdf with our options
$dompdf = new Dompdf($pdfOptions);
// Retrieve the HTML generated in our twig file
$html = $this->renderView('compound.html.twig', [
'tarikh' => $tarikh,
'masa' => $masa,
'compound' => $compound,
'staff' => $staff,
'department' => $department,
'faulty' => $faulty,
'tawaran' => $request->get('tawaran'),
'site' => $site,
]);
// Load HTML to Dompdf
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A5', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Store PDF Binary Data
$output = $dompdf->output();
$filesystem = new Filesystem();
// In this case, we want to write the file in the public directory
$destinationPath = 'proxy/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('proxy/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
$pdfFilepath = $destinationPath . '/'.$compound['kpd'].'.pdf';
// Write file to the desired path
file_put_contents($pdfFilepath, $output);
// Send some text response
if(file_exists($pdfFilepath)){
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
$url = $urlPackage->getUrl('/'.$pdfFilepath);
return new JsonResponse(['success' => true, 'data'=> $url, 'message' => ''], 200);
}else{
return new JsonResponse(['success' => false, 'data'=> '', 'message' => 'Tidak dapat generate PDF'], 404);
}
}
}

+ 70
- 0
src/Controller/Api/InvestigationController.php Zobrazit soubor

@@ -0,0 +1,70 @@
<?php
namespace App\Controller\Api;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use App\Controller\Api\BaseController;
class InvestigationController extends BaseController{
// *
// * @Route(/api/upload/investigation/file)
// * @Method({"POST"})
public function uploadInvestigationFile(Request $request){
$i = 1;
$filesystem = new Filesystem();
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$request->get('no_siri').'/investigation';
if(!$filesystem->exists('staging/document/'.$request->get('no_siri').'/investigation')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$request->get('no_siri').'/investigation';
if(!$filesystem->exists('production/document/'.$request->get('no_siri').'/investigation')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$request->get('no_siri').'/investigation';
if(!$filesystem->exists('proxy/'.$request->get('no_siri').'/investigation')){
$filesystem->mkdir($destinationPath, 0700);
}
}
$allowedfileExtension = ['pdf'];
$destinationPathImage = array();
if($request->files->has('attachment')){
$a = $request->files->get('attachment');
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
$extension = $a->getClientOriginalExtension();
$check=in_array($extension,$allowedfileExtension);
if($check) {
$filename = uniqid();
$a->move($destinationPath,$filename.'.'.$extension);
$pathPDF = $urlPackage->getUrl('/'.$destinationPath.'/'.$filename.'.'.$extension);
return $this->sendResponse($pathPDF, 'Berjaya memuatnaik lampiran');
}else{
return $this->sendError('Gagal', 'Format lampiran hendaklah PDF');
}
}else{
return $this->sendError('Gagal', 'Lampiran tidak dimuatnaik!');
}
}
}

+ 101
- 0
src/Controller/Api/MemoController.php Zobrazit soubor

@@ -0,0 +1,101 @@
<?php
namespace App\Controller\Api;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use App\Controller\Api\BaseController;
class MemoController extends BaseController{
// *
// * @Route(/api/upload/memo/pdf)
// * @Method({"POST"})
public function uploadMemoPDF(Request $request){
$filesystem = new Filesystem();
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/memo';
if(!$filesystem->exists('staging/document/memo')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/memo';
if(!$filesystem->exists('production/document/memo')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/memo';
if(!$filesystem->exists('proxy/memo')){
$filesystem->mkdir($destinationPath, 0700);
}
}
$destinationPathImage = array();
if($request->files->has('file')){
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
foreach($request->files->get('file') as $f){
$filename = uniqid().'.'.$f->getClientOriginalExtension();
$destinationPathImage[] = $urlPackage->getUrl('/'.$destinationPath.'/'.$filename);
$f->move($destinationPath,$filename);
}
return $this->sendResponse($destinationPathImage, 'Berjaya memuatnaik dokumen pdf');
}else{
return $this->sendError('Gagal', 'Gambar kompaun tidak dimuatnaik!');
}
}
public function uploadConfidentialMemoPDF(Request $request){
$filesystem = new Filesystem();
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$request->get('no_siri').'/memo';
if(!$filesystem->exists('staging/document/'.$request->get('no_siri').'/memo')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$request->get('no_siri').'/memo';
if(!$filesystem->exists('production/document/'.$request->get('no_siri').'/memo')){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$request->get('no_siri').'/memo';
if(!$filesystem->exists('proxy/'.$request->get('no_siri').'/memo')){
$filesystem->mkdir($destinationPath, 0700);
}
}
$destinationPathImage = array();
if($request->files->has('file')){
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
foreach($request->files->get('file') as $f){
$filename = uniqid().'.'.$f->getClientOriginalExtension();
$destinationPathImage[] = $urlPackage->getUrl('/'.$destinationPath.'/'.$filename);
$f->move($destinationPath,$filename);
}
return $this->sendResponse($destinationPathImage, 'Berjaya memuatnaik dokumen pdf');
}else{
return $this->sendError('Gagal', 'Gambar kompaun tidak dimuatnaik!');
}
}
}

+ 363
- 0
src/Controller/Api/PdfController.php Zobrazit soubor

@@ -0,0 +1,363 @@
<?php
namespace App\Controller\Api;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Asset\UrlPackage;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Knp\Bundle\SnappyBundle\Snappy\Response\PdfResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Dompdf\Dompdf;
use Dompdf\Options;
use PDFMerger;
class PdfController extends Controller {
public function decodeCompoundJson(Request $request){
$compound = json_decode($request->get('compound'), true);
return $compound;
}
public function decodeStaffJson(Request $request){
$staff = json_decode($request->get('staff'), true);
return $staff;
}
public function decodeDepartmentJson(Request $request){
$department = json_decode($request->get('department'), true);
return $department;
}
public function decodeFaultyJson(Request $request){
$faulty = json_decode($request->get('faulty'), true);
return $faulty;
}
public function decodeSiteJson(Request $request){
$site = json_decode($request->get('site'), true);
return $site;
}
public function decodeFileJson(Request $request){
$file = json_decode($request->get('file'), true);
return $file;
}
public function storeCompoundPDF(Request $request)
{
//Decode Json
$compound = $this->decodeCompoundJson($request);
$staff = $this->decodeStaffJson($request);
$department = $this->decodeDepartmentJson($request);
$faulty = $this->decodeFaultyJson($request);
$site = $this->decodeSiteJson($request);
// return new JsonResponse(['success' => true, 'data'=> $request->get('faulty'), 'message' => ''], 200);
$tarikh = date('d/m/Y', strtotime($compound['created_at']));
$masa = date('h:i:s a', strtotime($compound['created_at']));
// Configure Dompdf according to your needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont','Times New Roman','sans-serif');
$pdfOptions->set('enable_remote', TRUE);
// Instantiate Dompdf with our options
$dompdf = new Dompdf($pdfOptions);
// Retrieve the HTML generated in our twig file
$html = $this->renderView('compound.html.twig', [
'tarikh' => $tarikh,
'masa' => $masa,
'compound' => $compound,
'staff' => $staff,
'department' => $department,
'faulty' => $faulty,
'tawaran' => $request->get('tawaran'),
'site' => $site,
]);
// Load HTML to Dompdf
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A5', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Store PDF Binary Data
$output = $dompdf->output(['isRemoteEnabled' => true]);
$filesystem = new Filesystem();
// In this case, we want to write the file in the public directory
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('staging/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('production/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('proxy/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}
$pdfFilepath = $destinationPath . '/'.$compound['kpd'].'.pdf';
// dd($output);
// Write file to the desired path
file_put_contents($pdfFilepath, $output);
// Send some text response
if(file_exists($pdfFilepath)){
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
$url = $urlPackage->getUrl('/'.$pdfFilepath);
return new JsonResponse(['success' => true, 'data'=> $url, 'message' => ''], 200);
}else{
return new JsonResponse(['success' => false, 'data'=> '', 'message' => 'Tidak dapat generate PDF'], 200);
}
}
public function storeInvestigationPDF(Request $request)
{
$fileInvest = '-';
if($request->get('fileInvest') != null){
$fileInvest = json_decode($request->get('fileInvest'), true);
}
return $fileInvest;
}
public function storeMemoPDF(Request $request)
{
$fileMemo = '-';
$site = $this->decodeSiteJson($request);
$compound = $this->decodeCompoundJson($request);
$doneConvert = array();
// return $request->get('memo');
if($request->get('memo') != null){
$fileMemo = json_decode($request->get('memo'), true);
$filesystem = new Filesystem();
// In this case, we want to write the file in the public directory
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('staging/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('production/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('proxy/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}
foreach ($fileMemo as $i => $m) {
// Configure Dompdf according to your needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont','Times New Roman','sans-serif');
$pdfOptions->set('enable_remote', TRUE);
// Instantiate Dompdf with our options
$dompdf = new Dompdf($pdfOptions);
// Retrieve the HTML generated in our twig file
$html = $this->renderView('memo.html.twig', [
'memo' => $m['memo'],
'dikeluarkan' => $m['dikeluarkan'],
'disahkan' => $m['disahkan'],
'update' => $m['update'],
'mula' => $m['mula'],
'akhir' => $m['akhir'],
'faulty' => $m['faulty'],
'modul' => $m['modul'],
'site' => $site,
]);
// Load HTML to Dompdf
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Store PDF Binary Data
$output = $dompdf->output();
$pdfFilepath = $destinationPath . '/memo-'.$i.'.pdf';
// Write file to the desired path
file_put_contents($pdfFilepath, $output);
if(count($m['attachment']) > 0){
$pdf = new PDFMerger();
$pdf->addPDF($pdfFilepath, 'all');
foreach ($m['attachment'] as $key => $a) {
$pdf->addPDF(str_replace('http://filegoforce.sipadu.my/','',$a),'all');
}
$pdf->merge('file', $pdfFilepath);
}
$doneConvert[] = $pdfFilepath;
}
}
return $doneConvert;
}
public function storeInventoriPDF(Request $request)
{
$inventoryData = '-';
$compound = $this->decodeCompoundJson($request);
$inventori = json_decode($request->get('inventori'), true);
// return $inventori;
$site = $this->decodeSiteJson($request);
$now = $request->get('now');
$k = 0;
if($request->get('inventori') != null){
$filesystem = new Filesystem();
// In this case, we want to write the file in the public directory
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('staging/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('production/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('proxy/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}
// Configure Dompdf according to your needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont','Times New Roman','sans-serif');
$pdfOptions->set('enable_remote', TRUE);
// Instantiate Dompdf with our options
$dompdf = new Dompdf($pdfOptions);
// Retrieve the HTML generated in our twig file
$html = $this->renderView('inventori.html.twig', [
'compound' => $compound,
'inventori' => $inventori,
'site' => $site,
'now' => $now,
]);
// Load HTML to Dompdf
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A4', 'portrait');
// Render the HTML as PDF
$dompdf->render();
// Store PDF Binary Data
$output = $dompdf->output();
$pdfFilepath = $destinationPath . '/inventori'.'.pdf';
// Write file to the desired path
file_put_contents($pdfFilepath, $output);
$inventoryData = $pdfFilepath;
}
return $inventoryData;
}
public function viewAllPDF(Request $request){
$compound = $this->decodeCompoundJson($request);
$filesystem = new Filesystem();
$kpd = $compound['kpd'];
// In this case, we want to write the file in the public directory
if($request->get('type') == 'staging'){
$destinationPath = 'staging/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('staging/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'production'){
$destinationPath = 'production/document/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('production/document/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}else if($request->get('type') == 'proxy'){
$destinationPath = 'proxy/'.$compound['confidential_file']['no_siri'];
if(!$filesystem->exists('proxy/'.$compound['confidential_file']['no_siri'])){
$filesystem->mkdir($destinationPath, 0700);
}
}
$pdfFilepath = $destinationPath . '/'.$compound['confidential_file']['no_siri'].'.pdf';
// Create an instance of PDFMerger
$pdf = new PDFMerger();
// Add 2 PDFs to the final PDF
$pdf->addPDF($destinationPath.'/'.$compound['kpd'].'.pdf','all');
if($this->storeInvestigationPDF($request) != '-'){
foreach($this->storeInvestigationPDF($request) as $a) {
$pdf->addPDF(str_replace('http://filegoforce.sipadu.my/','',$a),'all');
}
}
if($this->storeMemoPDF($request) != '-'){
foreach($this->storeMemoPDF($request) as $a) {
$pdf->addPDF($a,'all');
}
}
if($this->storeInventoriPDF($request) != '-'){
$pdf->addPDF($this->storeInventoriPDF($request),'all');
}
// Merge the files into a file in some directory
$pdf->merge('file', $pdfFilepath);
// Send some text response
if(file_exists($pdfFilepath)){
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
$url = $urlPackage->getUrl('/'.$pdfFilepath);
return new JsonResponse(['success' => true, 'data'=> $url, 'message' => ''], 200);
}else{
return new JsonResponse(['success' => false, 'data'=> '', 'message' => 'Tidak dapat generate PDF'], 404);
}
}
}

+ 53
- 0
src/Kernel.php Zobrazit soubor

@@ -0,0 +1,53 @@
<?php

namespace App;

use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;

class Kernel extends BaseKernel
{
use MicroKernelTrait;

private const CONFIG_EXTS = '.{php,xml,yaml,yml}';

public function registerBundles(): iterable
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
}
}

public function getProjectDir(): string
{
return \dirname(__DIR__);
}

protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', true);
$confDir = $this->getProjectDir().'/config';

$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}

protected function configureRoutes(RouteCollectionBuilder $routes): void
{
$confDir = $this->getProjectDir().'/config';

$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
}
}

+ 350
- 0
symfony.lock Zobrazit soubor

@@ -0,0 +1,350 @@
{
"container-interop/container-interop": {
"version": "1.2.0"
},
"doctrine/annotations": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672"
},
"files": [
"config/routes/annotations.yaml"
]
},
"doctrine/cache": {
"version": "v1.8.0"
},
"doctrine/collections": {
"version": "v1.6.2"
},
"doctrine/event-manager": {
"version": "v1.0.0"
},
"doctrine/instantiator": {
"version": "1.2.0"
},
"doctrine/lexer": {
"version": "1.1.0"
},
"doctrine/persistence": {
"version": "1.1.1"
},
"doctrine/reflection": {
"version": "v1.0.0"
},
"dompdf/dompdf": {
"version": "v0.8.3"
},
"hoa/compiler": {
"version": "3.17.08.08"
},
"hoa/consistency": {
"version": "1.17.05.02"
},
"hoa/event": {
"version": "1.17.01.13"
},
"hoa/exception": {
"version": "1.17.01.16"
},
"hoa/file": {
"version": "1.17.07.11"
},
"hoa/iterator": {
"version": "2.17.01.10"
},
"hoa/math": {
"version": "1.17.05.16"
},
"hoa/protocol": {
"version": "1.17.01.14"
},
"hoa/regex": {
"version": "1.17.01.13"
},
"hoa/stream": {
"version": "1.17.02.21"
},
"hoa/ustring": {
"version": "4.17.01.16"
},
"hoa/visitor": {
"version": "2.17.01.16"
},
"hoa/zformat": {
"version": "1.17.01.10"
},
"jms/metadata": {
"version": "2.1.0"
},
"jms/serializer": {
"version": "3.3.0"
},
"jms/serializer-bundle": {
"version": "3.0",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "3.0",
"ref": "384cec52df45f3bfd46a09930d6960a58872b268"
},
"files": [
"config/packages/dev/jms_serializer.yaml",
"config/packages/jms_serializer.yaml",
"config/packages/prod/jms_serializer.yaml"
]
},
"monolog/monolog": {
"version": "1.25.3"
},
"phenx/php-font-lib": {
"version": "0.5.1"
},
"phenx/php-svg-lib": {
"version": "v0.3.3"
},
"psr/cache": {
"version": "1.0.1"
},
"psr/container": {
"version": "1.0.0"
},
"psr/log": {
"version": "1.1.0"
},
"rguedes/pdfmerger": {
"version": "1.0.4"
},
"sabberworm/php-css-parser": {
"version": "8.3.0"
},
"sensio/framework-extra-bundle": {
"version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.2",
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
},
"files": [
"config/packages/sensio_framework_extra.yaml"
]
},
"symfony/asset": {
"version": "v4.3.4"
},
"symfony/cache": {
"version": "v4.3.4"
},
"symfony/cache-contracts": {
"version": "v1.1.5"
},
"symfony/config": {
"version": "v4.3.4"
},
"symfony/console": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "482d233eb8de91ebd042992077bbd5838858890c"
},
"files": [
"bin/console",
"config/bootstrap.php"
]
},
"symfony/debug": {
"version": "v4.3.4"
},
"symfony/dependency-injection": {
"version": "v4.3.4"
},
"symfony/dotenv": {
"version": "v4.3.4"
},
"symfony/event-dispatcher": {
"version": "v4.3.4"
},
"symfony/event-dispatcher-contracts": {
"version": "v1.1.5"
},
"symfony/filesystem": {
"version": "v4.3.4"
},
"symfony/finder": {
"version": "v4.3.4"
},
"symfony/flex": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "dc3fc2e0334a4137c47cfd5a3ececc601fa61a0b"
},
"files": [
".env"
]
},
"symfony/form": {
"version": "v4.3.4"
},
"symfony/framework-bundle": {
"version": "4.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.2",
"ref": "61ad963f28c091b8bb9449507654b9c7d8bbb53c"
},
"files": [
"config/bootstrap.php",
"config/packages/cache.yaml",
"config/packages/framework.yaml",
"config/packages/test/framework.yaml",
"config/services.yaml",
"public/index.php",
"src/Controller/.gitignore",
"src/Kernel.php"
]
},
"symfony/http-foundation": {
"version": "v4.3.4"
},
"symfony/http-kernel": {
"version": "v4.3.4"
},
"symfony/inflector": {
"version": "v4.3.4"
},
"symfony/intl": {
"version": "v4.3.4"
},
"symfony/mime": {
"version": "v4.3.4"
},
"symfony/monolog-bridge": {
"version": "v4.3.11"
},
"symfony/monolog-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "877bdb4223245783d00ed1f7429aa7ebc606d914"
},
"files": [
"config/packages/dev/monolog.yaml",
"config/packages/prod/monolog.yaml",
"config/packages/test/monolog.yaml"
]
},
"symfony/options-resolver": {
"version": "v4.3.4"
},
"symfony/polyfill-intl-icu": {
"version": "v1.12.0"
},
"symfony/polyfill-intl-idn": {
"version": "v1.12.0"
},
"symfony/polyfill-mbstring": {
"version": "v1.12.0"
},
"symfony/polyfill-php72": {
"version": "v1.12.0"
},
"symfony/polyfill-php73": {
"version": "v1.12.0"
},
"symfony/property-access": {
"version": "v4.3.4"
},
"symfony/routing": {
"version": "4.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.2",
"ref": "4c107a8d23a16b997178fbd4103b8d2f54f688b7"
},
"files": [
"config/packages/dev/routing.yaml",
"config/packages/routing.yaml",
"config/packages/test/routing.yaml",
"config/routes.yaml"
]
},
"symfony/service-contracts": {
"version": "v1.1.6"
},
"symfony/translation-contracts": {
"version": "v1.1.6"
},
"symfony/twig-bridge": {
"version": "v4.3.5"
},
"symfony/twig-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "7e5911186d596214c14dd28305485a3c143ee746"
},
"files": [
"config/packages/twig.yaml",
"config/routes/dev/twig.yaml",
"templates/base.html.twig"
]
},
"symfony/twig-pack": {
"version": "v1.0.0"
},
"symfony/validator": {
"version": "4.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.3",
"ref": "d902da3e4952f18d3bf05aab29512eb61cabd869"
},
"files": [
"config/packages/test/validator.yaml",
"config/packages/validator.yaml"
]
},
"symfony/var-dumper": {
"version": "v4.3.4"
},
"symfony/var-exporter": {
"version": "v4.3.4"
},
"symfony/yaml": {
"version": "v4.3.4"
},
"twig/extra-bundle": {
"version": "v2.12.1"
},
"twig/twig": {
"version": "v2.12.1"
},
"zendframework/zend-barcode": {
"version": "2.7.1"
},
"zendframework/zend-servicemanager": {
"version": "3.4.0"
},
"zendframework/zend-stdlib": {
"version": "3.2.1"
},
"zendframework/zend-validator": {
"version": "2.12.0"
}
}

+ 12
- 0
templates/base.html.twig Zobrazit soubor

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>

+ 507
- 0
templates/compound.html.twig Zobrazit soubor

@@ -0,0 +1,507 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Kompaun - {{ compound['kpd'] }}</title>
<style type="text/css">
body{
font-family: "Times New Roman", Times,'sans-serif';
}
.fontStyle1 {
font-size: 8px;
line-height: 10px;
}
.fontStyle1 p{
margin-top: 0px;
margin-bottom: 0px;
}
.page-break {
page-break-after: always;
}
table {
border-collapse: collapse;
}
</style>
</head>
<body style="background-image: url('https://mdch.sipadu.my/{{site['bg_compound']}}');background-position:center;background-size: 100px 100px !important;background-repeat: no-repeat">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 10px">&nbsp;</td>
<td width="25%" style="text-align: left; font-size: 10px">&nbsp;</td>
<td width="25%" style="text-align: left; font-size: 10px">&nbsp;</td>
<td width="25%" style="text-align: left; font-size: 10px;">
<img style="width: 130px; height: 40px; margin-bottom: 3px" src="http://mpjbt.smsparkir.com/api/barcode?bcid=code39&text={{compound['kpd']}}">
</td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 10px">&nbsp;</td>
<td width="25%" style="text-align: left; font-size: 10px">&nbsp;</td>
<td style="text-align: left; font-size: 12px">&nbsp;</td>
<td style="text-align: left; font-size: 12px;letter-spacing: 2px;"><b>NO. KOMPAUN</b></td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 10px">&nbsp;</td>
<td width="25%" style="text-align: left; font-size: 10px">&nbsp;</td>
<td style="text-align: left; font-size: 12px">&nbsp;</td>
<td style="text-align: left; font-size: 12px;letter-spacing: 2px;"><b>{{ compound['kpd'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
{% if(compound['jenis'] == 'Pelbagai') %}
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left; font-size: 13px"><b>Kepada Tuan / Puan : </b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- <tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Tarikh</b></td>
<td width="25%" style="text-align: left; font-size: 12px;">: {{ tarikh }}</td>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Waktu</b></td>
<td width="25%" style="text-align: left; font-size: 12px;">: {{ masa }}</td>
</tr> -->
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Nama</b></td>
<td colspan="3" style="text-align: left; font-size: 12px;">: {{ compound['nama'] }}</td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 12px"><b>Identity</b></td>
<td width="25%" style="text-align: left; font-size: 12px">: {{ compound['identity'] }}</td>
<!-- <td style="text-align: left; font-size: 12px;"><b>No. Syarikat</b></td>
<td style="text-align: left; font-size: 12px;">: {{ compound['no_daftar_syarikat'] }}</td> -->
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Nama Syarikat</b></td>
<td colspan="3" style="text-align: left; font-size: 12px;">: {{ compound['nama_syarikat'] }}</td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Alamat</b></td>
<td colspan="3" style="text-align: left; font-size: 12px;">: {{ compound['alamat'] }}</td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>No Plat</b></td>
<td colspan="3" style="text-align: left; font-size: 12px;">: {{ compound['no_plate'] }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="15px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: justify; font-size: 12px;"><b>Dengan ini adalah diberitahu satu aduan dibuat terhadap anda bersabit dengan satu kesalahan di bawah : </b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="2px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 11px;"><b>Akta </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="74%" style="text-align: left; font-size: 12px;"><b> {{ faulty['deed_law']['nama'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 11px;"><b>Seksyen / Kaedah / Perintah </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="74%" style="text-align: left; font-size: 12px;"><b> {{faulty['sketr'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 11px;"><b>Kesalahan </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="74%" style="text-align: left; font-size: 12px;"><b> {{ faulty['nama'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td style="font-size: 10px">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Butiran Kesalahan </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="74%" style="text-align: left; font-size: 12px;"> {{ compound['catatan'] }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td style="font-size: 10px">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Tempat Kesalahan </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="74%" style="text-align: left; font-size: 12px;"> {{ compound['lokasi_kejadian'] }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td style="font-size: 10px">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Dikeluarkan Pada</b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="24%" style="text-align: left; font-size: 12px;">{{tarikh}}</td>
<td width="24%" style="text-align: left; font-size: 12px;"><b>Masa</b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="25%" style="text-align: left; font-size: 12px;">{{masa}}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td style="font-size: 10px">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Jumlah Kompaun</b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="74%" style="text-align: left; font-size: 12px;">RM {{ compound['jumlah_asal_kompaun'] }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="40%" style="text-align: left; font-size: 12px;"><b>Dikeluarkan Oleh</b></td>
<td width="60%"style="text-align: left; font-size: 12px;"><b>Bagi Pihak</b></td>
</tr>
<tr>
<td width="60%" style="text-align: left; font-size: 12px;">{{ staff['staff_detail']['no_badan'] }},</td>
<td width="40%"style="text-align: left; font-size: 12px;">Yang Dipertua,</td>
</tr>
<tr>
<td width="60%" style="text-align: left; font-size: 12px">({{ staff['roles_access'] }}),</td>
<td width="40%"style="text-align: left; font-size: 12px;">Majlis Daerah Cameron Highlands</td>
</tr>
<tr>
<td width="60%" style="text-align: left; font-size: 12px;">[{{department['jbkod']}}] {{ department['jnama'] }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: justify; font-size: 12px; border: 1px solid black; padding: 5px;"><b>Dengan ini dimaklumkan tuan/puan boleh menyelesaikan kesalahan ini tanpa perbicaraan di mahkamah dengan membayar kompaun ini di Pejabat Majlis Daerah Cameron Highlands pada waktu pejabat. Tawaran ini berkuatkuasa 30 hari dari tarikh dikompaun. Kegagalan menjelaskan bayaran kompaun mengakibatkan tindakan undang - undang diambil terhadap kesalahan yang dilakukan. </b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
{% elseif(compound['jenis'] == 'Parkir') %}
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left; font-size: 13px"><b>Notis Kesalahan Serta Tawaran Kompaun </b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Tarikh</b></td>
<td width="25%" style="text-align: left; font-size: 12px;">: {{ tarikh }}</td>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Waktu</b></td>
<td width="25%" style="text-align: left; font-size: 12px;">: {{ masa }}</td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 12px"><b>No Kenderaan</b></td>
<td width="25%" style="text-align: left; font-size: 12px">: {{ compound['no_plate'] }}</td>
<td style="text-align: left; font-size: 12px;"><b>Warna</b></td>
<td style="text-align: left; font-size: 12px;">: {{ compound['warna_kenderaan'] }}</td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>Jenis Kenderaan</b></td>
<td width="25%" style="text-align: left; font-size: 12px;">: {{ compound['jenis_kenderaan'] }}</td>
<td style="text-align: left; font-size: 12px;"><b>Model Kenderaan</b></td>
<td style="text-align: left; font-size: 12px;">: {{ compound['model_kenderaan'] }}</td>
</tr>
<tr>
<td width="25%" style="text-align: left; font-size: 12px;"><b>No Petak/Tiang</b></td>
<td width="25%" style="text-align: left; font-size: 12px;">: {{ compound['no_parking'] }}</td>
<td style="text-align: left; font-size: 12px;"><b>No Cukai Jalan</b></td>
<td style="text-align: left; font-size: 12px;">: {{ compound['no_cukai_jalan'] }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="15px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: justify; font-size: 12px;"><b>Kepada pemunya/ pemandu kenderaan tersebut diatas, tuan / puan didapati melakukan kesalahan seperti berikut</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="2px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: left; font-size: 12px;padding-left: 10px"><center><b>PERINTAH PENGANGKUTAN JALAN</b></center></td>
</tr>
<tr>
<td style="text-align: left; font-size: 12px;padding-left: 10px"><center><b>(PERUNTUKAN TEMPAT LETAK KERETA)</b></center></td>
</tr>
<tr>
<td style="text-align: left; font-size: 12px;padding-left: 10px"><center><b>MAJLIS DAERAH CAMERON HIGHLAND 2016</b></center></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" style="text-align: left; font-size: 11px;"><b>Akta</b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="79%" style="text-align: left; font-size: 12px;"><b> {{ faulty['deed_law']['nama'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" style="text-align: left; font-size: 11px;"><b>Seksyen / Kaedah / Perintah </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="79%" style="text-align: left; font-size: 12px;"><b> {{ faulty['sketr'] }}</b></td>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" style="text-align: left; font-size: 11px;"><b>Kesalahan </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="79%" style="text-align: left; font-size: 12px;padding-left: 10px"><b>{{ faulty['nama'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" style="text-align: left; font-size: 11px;"><b>Keterangan </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="79%" style="text-align: left; font-size: 12px;padding-left: 10px"><b> {{ compound['catatan'] }}</b></td>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" style="text-align: left; font-size: 11px;"><b>Tempat Dikompaun </b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="79%" style="text-align: left; font-size: 12px;padding-left: 10px"><b>{{ compound['lokasi_kejadian'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td style="font-size: 10px">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="21%" style="text-align: left; font-size: 12px;"><b>Jumlah Kompaun</b></td>
<td width="1%" style="text-align: left; font-size: 11px;"><b>:</b></td>
<td width="78%" style="text-align: left; font-size: 12px;"> <b>RM {{ compound['jumlah_asal_kompaun'] }}</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="1" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td style="font-size: 12px"><center><b>Bayaran Dalam Tempoh 7 Hari</b></center></td>
<td style="font-size: 12px"><center><b>Bayaran Dalam Tempoh 14 Hari</b></center></td>
<td style="font-size: 12px"><center><b>Bayaran Dalam Tempoh 30 Hari</b></center></td>
</tr>
<tr>
<td style="font-size: 12px"><center><b>{{ faulty['amount_before_14'] }}</b></center></td>
<td style="font-size: 12px"><center><b>{{ faulty['amount_before_30'] }}</b></center></td>
<td style="font-size: 12px"><center><b>{{ faulty['amount'] }}</b></center></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<!-- <td width="50%" style="text-align: left; font-size: 12px;">&n</td> -->
<td style="text-align: left; font-size: 12px;"><b>Dikeluarkan Oleh</b> <br> {{ staff['staff_detail']['no_badan'] }}, <br> ({{ staff['roles_access'] }}), <br> [{{department['jbkod']}}] {{ department['jnama'] }}</td>
</tr>
</table>
</td>
</tr>
{% endif %}
</table>
{% if(compound['attachment']|length > 0) %}
<div class="page-break"></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: center; font-size: 12px"><b>GAMBAR KOMPAUN</b></td>
</tr>
<tr>
<td height="10px">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<!-- <tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
{% for chunk in compound['attachment']|batch(2) %}
{% for p in chunk %}
<tr>
<td width="100%" height="50%" style="text-align: center; font-size: 12px;padding:5px">
<img src="{{ p['path'] }}" style="max-width: 800px !important; max-height: 500px !important">
</td>
</tr>
{% endfor %}
{% endfor %}
</table>
</td>
</tr> -->
{% for chunk in compound['attachment']|batch(2) %}
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
{% for p in chunk %}
<tr>
<td style="text-align: center; font-size: 12px; padding:10px 5px">
<img src="{{ p['path'] }}" style="max-width: 600px !important; height: 300px !important">
</td>
</tr>
{% endfor %}
</table>
</td>
</tr>
{% endfor %}
</table>
{% endif %}
</body>
</html>

+ 131
- 0
templates/inventori.html.twig Zobrazit soubor

@@ -0,0 +1,131 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Inventori - {{ compound['confidential_file']['no_siri'] }}</title>
<style type="text/css">
body{
font-family: 'Helvetica','sans-serif';
}
.fontStyle1 {
font-size: 8px;
line-height: 10px;
}
.fontStyle1 p{
margin-top: 0px;
margin-bottom: 0px;
}
.page-break {
page-break-after: always;
}
table {
border-collapse: collapse;
}
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">>
<tr>
<td rowspan="5" width="50%">
<img src="https://mdch1.sipadu.my/{{ site['letter_head'] }}" style="width:400px;max-height: 109px">
</td>
<td width="50%" style="text-align: right;font-size: 12px">
{{ site['building_name'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
{{ site['address'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
{{ site['state_code'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
Tel: {{ site['no_tel'] }} / Faks : {{ site['no_fax'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
Email: {{ site['email'] }}
</td>
</tr>
<tr>
<td colspan="2" height="2px">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30%">No.Kompaun / No. Siri</td>
<td width="70%">: {{ compound['kpd'] }} / {{ compound['confidential_file']['no_siri'] }}</td>
</tr>
<tr>
<td>Tarikh & Masa</td>
<td>: {{ now }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #ccc"></td>
</tr>
<tr>
<td height="25px">&nbsp;</td>
</tr>
<tr>
<td style="font-size: 11px">
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th width="20%" style="text-align: center">#</th>
<th width="20%" style="text-align: center">JENIS</th>
<th width="20%" style="text-align: center">BILANGAN</th>
<th width="20%" style="text-align: center">HARGA (per/item)</th>
<th width="20%" style="text-align: center">LOKASI GUDANG</th>
</tr>
</thead>
<tbody>
{% if(inventori|length > 0) %}
{% for i in inventori %}
<tr>
<td width="20%" style="text-align: center;">{{ i['barcode'][1:] }}</td>
<td width="20%" style="text-align: center">{{ i['item']['jenis'] }}</td>
<td width="20%" style="text-align: center">{{ i['item']['bilangan'] }}</td>
<td width="20%" style="text-align: center">{{ i['item']['harga'] }}</td>
<td width="20%" style="text-align: center;">{{ i['item']['lokasi_gudang'] }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="4">Tiada Data</td>
</tr>
{% endif %}
</tbody>
<tfoot>
<tr>
<th width="20%" style="text-align: center">#</th>
<th width="20%" style="text-align: center">JENIS</th>
<th width="20%" style="text-align: center">BILANGAN</th>
<th width="20%" style="text-align: center">HARGA (per/item)</th>
<th width="20%" style="text-align: center">LOKASI GUDANG</th>
</tr>
</tfoot>
</table>
</td>
</tr>
</table>
</body>
</html>

+ 160
- 0
templates/memo.html.twig Zobrazit soubor

@@ -0,0 +1,160 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Memo - {{ memo['no_rujukan'] }}</title>
<style type="text/css">
body{
font-family: 'Helvetica','sans-serif';
}
.fontStyle1 {
font-size: 8px;
line-height: 10px;
}
.fontStyle1 p{
margin-top: 0px;
margin-bottom: 0px;
}
.page-break {
page-break-after: always;
}
table {
border-collapse: collapse;
}
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">>
<tr>
<td rowspan="5" width="50%">
<img src="https://mdch1.sipadu.my/{{ site['letter_head'] }}" style="width:400px;max-height: 109px">
</td>
<td width="50%" style="text-align: right;font-size: 12px">
{{ site['building_name'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
{{ site['address'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
{{ site['state_code'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
Tel: {{ site['no_tel'] }} / Faks : {{ site['no_fax'] }}
</td>
</tr>
<tr>
<td width="50%" style="text-align: right;font-size: 12px">
Email: {{ site['email'] }}
</td>
</tr>
<tr>
<td colspan="2" height="2px">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5px">&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td width="20%">No. Rujukan</td>
<td width="3%"> : </td>
<td width="77%">{{ memo['no_rujukan'] }}</td>
</tr>
<tr>
<td>Tarikh</td>
<td width="3%"> : </td>
<td>{{ update }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #ccc"></td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td colspan="3"height="5px">&nbsp;</td>
</tr>
<tr>
<td width="25%">Subjek</td>
<td width="3%"> : </td>
<td width="72%">{{ memo['subjek'] }}</td>
</tr>
<tr>
<td colspan="3"height="5px">&nbsp;</td>
</tr>
<tr>
<td width="25%">Tawaran Kompaun</td>
<td width="3%"> : </td>
<td width="72%">{{ memo['tawaran_kompaun'] }} ({{ memo['jenis_memo'] }} Harga)</td>
</tr>
<tr>
<td colspan="3"height="5px">&nbsp;</td>
</tr>
<tr>
<td>Tarikh Mula & Akhir</td>
<td width="3%"> : </td>
<td>{{ mula }} - {{ akhir }}</td>
</tr>
<tr>
<td colspan="3"height="5px">&nbsp;</td>
</tr>
{% if(memo['modul'] == '-') %}
<tr>
<td>Akta Kesalahan</td>
<td width="3%"> : </td>
<td>{{ faulty }}</td>
</tr>
{% elseif(memo['modul'] != '-') %}
<tr>
<td>Kategori Modul</td>
<td width="3%"> : </td>
<td>{{ modul }}</td>
</tr>
{% endif %}
</table>
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td height="5px">&nbsp;</td>
</tr>
<tr>
<td style="text-align: justify;">{{ memo['penerangan'] }}</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td colspan="2" height="5px">&nbsp;</td>
</tr>
<tr>
<td width="50%"><i>Dikemaskini Oleh:</i> {{ dikeluarkan }}</td>
<td width="50%"><i>Disahkan Oleh:</i> {{ disahkan }}</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

+ 0
- 0
templates/notis_peringatan.html.twig Zobrazit soubor


Načítá se…
Zrušit
Uložit