├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .idea ├── misc.xml ├── modules.xml ├── php.xml ├── saleserp.iml └── workspace.xml ├── .styleci.yml ├── app ├── Category.php ├── Console │ └── Kernel.php ├── Customer.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── RegisterController.php │ │ │ ├── ResetPasswordController.php │ │ │ └── VerificationController.php │ │ ├── CategoryController.php │ │ ├── Controller.php │ │ ├── CustomerController.php │ │ ├── HomeController.php │ │ ├── InvoiceController.php │ │ ├── ProductController.php │ │ ├── PurchaseController.php │ │ ├── SupplierController.php │ │ ├── TaxController.php │ │ └── UnitController.php │ ├── Kernel.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php ├── Invoice.php ├── Product.php ├── ProductSale.php ├── ProductSupplier.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Purchase.php ├── Sale.php ├── Supplier.php ├── Tax.php ├── Unit.php └── User.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── queue.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_09_14_134301_create_categories_table.php │ ├── 2019_09_15_053453_create_taxes_table.php │ ├── 2019_09_15_055531_create_units_table.php │ ├── 2019_09_15_061238_create_suppliers_table.php │ ├── 2019_09_15_065207_create_customers_table.php │ ├── 2019_09_15_101601_create_products_table.php │ ├── 2019_09_17_043116_create_product_suppliers_table.php │ ├── 2019_09_18_180122_create_invoices_table.php │ ├── 2019_09_24_071816_create_sales_table.php │ └── 2019_09_25_123326_create_purchases_table.php └── seeds │ ├── DatabaseSeeder.php │ └── UsersTableSeeder.php ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── css │ ├── app.css │ └── main.css ├── favicon.ico ├── images │ ├── product │ │ ├── Greg-Emerson-edit-2.jpg │ │ └── user.png │ └── user │ │ └── avatar1.png ├── index.php ├── js │ ├── app.js │ ├── bootstrap.min.js │ ├── jquery-3.2.1.min.js │ ├── main.js │ ├── multifield │ │ ├── Gruntfile.js │ │ ├── jquery.multifield.js │ │ └── jquery.multifield.min.js │ ├── plugins │ │ ├── bootstrap-datepicker.min.js │ │ ├── bootstrap-notify.min.js │ │ ├── chart.js │ │ ├── dataTables.bootstrap.min.js │ │ ├── fullcalendar.min.js │ │ ├── jquery-ui.custom.min.js │ │ ├── jquery.dataTables.min.js │ │ ├── jquery.vmap.min.js │ │ ├── jquery.vmap.sampledata.js │ │ ├── jquery.vmap.world.js │ │ ├── moment.min.js │ │ ├── pace.min.js │ │ ├── select2.min.js │ │ └── sweetalert.min.js │ └── popper.min.js ├── robots.txt └── web.config ├── readme.md ├── resources ├── js │ ├── app.js │ ├── bootstrap.js │ └── components │ │ └── ExampleComponent.vue ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php ├── sass │ ├── _variables.scss │ └── app.scss └── views │ ├── auth │ ├── login.blade.php │ ├── passwords │ │ ├── email.blade.php │ │ └── reset.blade.php │ ├── register.blade.php │ └── verify.blade.php │ ├── category │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── customer │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── home.blade.php │ ├── invoice │ ├── create.blade.php │ ├── edit.blade.php │ ├── index.blade.php │ └── show.blade.php │ ├── layouts │ ├── app.blade.php │ └── master.blade.php │ ├── partials │ ├── content.blade.php │ ├── header.blade.php │ └── sidebar.blade.php │ ├── product │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── profile │ ├── edit_profile.blade.php │ └── password.blade.php │ ├── purchase │ ├── create.blade.php │ ├── edit.blade.php │ ├── index.blade.php │ └── show.blade.php │ ├── supplier │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── tax │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ ├── unit │ ├── create.blade.php │ ├── edit.blade.php │ └── index.blade.php │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── saleserp.png ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── webpack.mix.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.yml] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=laravel 13 | DB_USERNAME=root 14 | DB_PASSWORD= 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | QUEUE_CONNECTION=sync 19 | SESSION_DRIVER=file 20 | SESSION_LIFETIME=120 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_DRIVER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | 33 | AWS_ACCESS_KEY_ID= 34 | AWS_SECRET_ACCESS_KEY= 35 | AWS_DEFAULT_REGION=us-east-1 36 | AWS_BUCKET= 37 | 38 | PUSHER_APP_ID= 39 | PUSHER_APP_KEY= 40 | PUSHER_APP_SECRET= 41 | PUSHER_APP_CLUSTER=mt1 42 | 43 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 44 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 45 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | .env 7 | .env.backup 8 | .phpunit.result.cache 9 | Homestead.json 10 | Homestead.yaml 11 | npm-debug.log 12 | yarn-error.log 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | disabled: 4 | - unused_use 5 | finder: 6 | not-name: 7 | - index.php 8 | - server.php 9 | js: 10 | finder: 11 | not-name: 12 | - webpack.mix.js 13 | css: true 14 | -------------------------------------------------------------------------------- /app/Category.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Product'); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | 31 | /** 32 | * Register the commands for the application. 33 | * 34 | * @return void 35 | */ 36 | protected function commands() 37 | { 38 | $this->load(__DIR__.'/Commands'); 39 | 40 | require base_path('routes/console.php'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Customer.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Invoice'); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 41 | } 42 | 43 | /** 44 | * Get a validator for an incoming registration request. 45 | * 46 | * @param array $data 47 | * @return \Illuminate\Contracts\Validation\Validator 48 | */ 49 | protected function validator(array $data) 50 | { 51 | return Validator::make($data, [ 52 | 'name' => ['required', 'string', 'max:255'], 53 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 54 | 'password' => ['required', 'string', 'min:8', 'confirmed'], 55 | ]); 56 | } 57 | 58 | /** 59 | * Create a new user instance after a valid registration. 60 | * 61 | * @param array $data 62 | * @return \App\User 63 | */ 64 | protected function create(array $data) 65 | { 66 | return User::create([ 67 | 'name' => $data['name'], 68 | 'email' => $data['email'], 69 | 'password' => Hash::make($data['password']), 70 | ]); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerificationController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 38 | $this->middleware('signed')->only('verify'); 39 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Controllers/CategoryController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 20 | } 21 | 22 | 23 | public function index() 24 | { 25 | $categories = Category::all(); 26 | return view('category.index', compact('categories')); 27 | } 28 | 29 | /** 30 | * Show the form for creating a new resource. 31 | * 32 | * @return \Illuminate\Http\Response 33 | */ 34 | public function create() 35 | { 36 | return view('category.create'); 37 | } 38 | 39 | /** 40 | * Store a newly created resource in storage. 41 | * 42 | * @param \Illuminate\Http\Request $request 43 | * @return \Illuminate\Http\Response 44 | */ 45 | public function store(Request $request) 46 | { 47 | $request->validate([ 48 | 'name' => 'required|min:3|unique:categories|regex:/^[a-zA-Z ]+$/', 49 | ]); 50 | 51 | $category = new Category(); 52 | $category->name = $request->name; 53 | $category->slug = str_slug($request->name); 54 | $category->status = 1; 55 | $category->save(); 56 | 57 | return redirect()->back()->with('message', 'Category Created Successfully'); 58 | } 59 | 60 | /** 61 | * Display the specified resource. 62 | * 63 | * @param int $id 64 | * @return \Illuminate\Http\Response 65 | */ 66 | public function show($id) 67 | { 68 | // 69 | } 70 | 71 | /** 72 | * Show the form for editing the specified resource. 73 | * 74 | * @param int $id 75 | * @return \Illuminate\Http\Response 76 | */ 77 | public function edit($id) 78 | { 79 | $category = Category::findOrFail($id); 80 | return view('category.edit', compact('category')); 81 | } 82 | 83 | /** 84 | * Update the specified resource in storage. 85 | * 86 | * @param \Illuminate\Http\Request $request 87 | * @param int $id 88 | * @return \Illuminate\Http\Response 89 | */ 90 | public function update(Request $request, $id) 91 | { 92 | $request->validate([ 93 | 'name' => 'required|min:3|regex:/^[a-zA-Z ]+$/', 94 | ]); 95 | 96 | $category = Category::findOrFail($id); 97 | $category->name = $request->name; 98 | $category->slug = str_slug($request->name); 99 | $category->save(); 100 | 101 | return redirect()->back()->with('message', 'Category Updated Successfully'); 102 | } 103 | 104 | /** 105 | * Remove the specified resource from storage. 106 | * 107 | * @param int $id 108 | * @return \Illuminate\Http\Response 109 | */ 110 | public function destroy($id) 111 | { 112 | $category = Category::find($id); 113 | $category->delete(); 114 | return redirect()->back(); 115 | 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 14 | } 15 | 16 | 17 | public function index() 18 | { 19 | $customers = Customer::all(); 20 | return view('customer.index', compact('customers')); 21 | } 22 | 23 | /** 24 | * Show the form for creating a new resource. 25 | * 26 | * @return \Illuminate\Http\Response 27 | */ 28 | public function create() 29 | { 30 | return view('customer.create'); 31 | } 32 | 33 | /** 34 | * Store a newly created resource in storage. 35 | * 36 | * @param \Illuminate\Http\Request $request 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function store(Request $request) 40 | { 41 | $request->validate([ 42 | 'name' => 'required|min:3|unique:customers|regex:/^[a-zA-Z ]+$/', 43 | 'address' => 'required|min:3', 44 | 'mobile' => 'required|min:3|digits:11', 45 | 'details' => 'required|min:3|', 46 | 'previous_balance' => 'min:3', 47 | 48 | ]); 49 | 50 | $customer = new Customer(); 51 | $customer->name = $request->name; 52 | $customer->address = $request->address; 53 | $customer->mobile = $request->mobile; 54 | $customer->details = $request->details; 55 | $customer->previous_balance = $request->previous_balance; 56 | $customer->save(); 57 | 58 | return redirect()->back()->with('message', 'Customer Created Successfully'); 59 | } 60 | 61 | /** 62 | * Display the specified resource. 63 | * 64 | * @param int $id 65 | * @return \Illuminate\Http\Response 66 | */ 67 | public function show($id) 68 | { 69 | // 70 | } 71 | 72 | /** 73 | * Show the form for editing the specified resource. 74 | * 75 | * @param int $id 76 | * @return \Illuminate\Http\Response 77 | */ 78 | public function edit($id) 79 | { 80 | $customer = Customer::findOrFail($id); 81 | return view('customer.edit', compact('customer')); 82 | } 83 | 84 | /** 85 | * Update the specified resource in storage. 86 | * 87 | * @param \Illuminate\Http\Request $request 88 | * @param int $id 89 | * @return \Illuminate\Http\Response 90 | */ 91 | public function update(Request $request, $id) 92 | { 93 | $request->validate([ 94 | 'name' => 'required|min:3|regex:/^[a-zA-Z ]+$/', 95 | 'address' => 'required|min:3', 96 | 'mobile' => 'required|min:3|digits:11', 97 | 'details' => 'required|min:3|', 98 | 'previous_balance' => 'min:3', 99 | ]); 100 | 101 | $customer = Customer::findOrFail($id); 102 | $customer->name = $request->name; 103 | $customer->address = $request->address; 104 | $customer->mobile = $request->mobile; 105 | $customer->details = $request->details; 106 | $customer->previous_balance = $request->previous_balance; 107 | $customer->save(); 108 | 109 | return redirect()->back()->with('message', 'Customer Updated Successfully'); 110 | } 111 | 112 | /** 113 | * Remove the specified resource from storage. 114 | * 115 | * @param int $id 116 | * @return \Illuminate\Http\Response 117 | */ 118 | public function destroy($id) 119 | { 120 | $customer = Customer::find($id); 121 | $customer->delete(); 122 | return redirect()->back(); 123 | 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /app/Http/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 19 | } 20 | 21 | /** 22 | * Show the application dashboard. 23 | * 24 | * @return \Illuminate\Contracts\Support\Renderable 25 | */ 26 | public function index() 27 | { 28 | return view('home'); 29 | } 30 | 31 | public function edit_profile(){ 32 | return view('profile.edit_profile'); 33 | } 34 | 35 | public function update_profile(Request $request, $id){ 36 | 37 | 38 | $user = User::find($id); 39 | $user->f_name = $request->f_name; 40 | $user->l_name = $request->l_name; 41 | $user->email = $request->email; 42 | 43 | if ($request->hasFile('image')){ 44 | $image_path ="images/user/".$user->image; 45 | if (file_exists($image_path)){ 46 | unlink($image_path); 47 | } 48 | $imageName =request()->image->getClientOriginalName(); 49 | request()->image->move(public_path('images/user/'), $imageName); 50 | $user->image = $imageName; 51 | } 52 | 53 | 54 | 55 | $user->save(); 56 | 57 | return redirect()->back(); 58 | } 59 | 60 | 61 | public function update_password(){ 62 | return view('profile.password'); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/Http/Controllers/SupplierController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 14 | } 15 | 16 | 17 | public function index() 18 | { 19 | $suppliers = Supplier::all(); 20 | return view('supplier.index', compact('suppliers')); 21 | } 22 | 23 | /** 24 | * Show the form for creating a new resource. 25 | * 26 | * @return \Illuminate\Http\Response 27 | */ 28 | public function create() 29 | { 30 | return view('supplier.create'); 31 | } 32 | 33 | /** 34 | * Store a newly created resource in storage. 35 | * 36 | * @param \Illuminate\Http\Request $request 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function store(Request $request) 40 | { 41 | $request->validate([ 42 | 'name' => 'required|min:3|unique:suppliers|regex:/^[a-zA-Z ]+$/', 43 | 'address' => 'required|min:3', 44 | 'mobile' => 'required|min:3|digits:11', 45 | 'details' => 'required|min:3|', 46 | 'previous_balance' => 'min:3', 47 | 48 | ]); 49 | 50 | $supplier = new Supplier(); 51 | $supplier->name = $request->name; 52 | $supplier->address = $request->address; 53 | $supplier->mobile = $request->mobile; 54 | $supplier->details = $request->details; 55 | $supplier->previous_balance = $request->previous_balance; 56 | $supplier->save(); 57 | 58 | return redirect()->back()->with('message', 'Supplier Created Successfully'); 59 | } 60 | 61 | /** 62 | * Display the specified resource. 63 | * 64 | * @param int $id 65 | * @return \Illuminate\Http\Response 66 | */ 67 | public function show($id) 68 | { 69 | // 70 | } 71 | 72 | /** 73 | * Show the form for editing the specified resource. 74 | * 75 | * @param int $id 76 | * @return \Illuminate\Http\Response 77 | */ 78 | public function edit($id) 79 | { 80 | $supplier = Supplier::findOrFail($id); 81 | return view('supplier.edit', compact('supplier')); 82 | } 83 | 84 | /** 85 | * Update the specified resource in storage. 86 | * 87 | * @param \Illuminate\Http\Request $request 88 | * @param int $id 89 | * @return \Illuminate\Http\Response 90 | */ 91 | public function update(Request $request, $id) 92 | { 93 | $request->validate([ 94 | 'name' => 'required|min:3|regex:/^[a-zA-Z ]+$/', 95 | 'address' => 'required|min:3', 96 | 'mobile' => 'required|min:3|digits:11', 97 | 'details' => 'required|min:3|', 98 | 'previous_balance' => 'min:3', 99 | ]); 100 | 101 | $supplier = Supplier::findOrFail($id); 102 | $supplier->name = $request->name; 103 | $supplier->address = $request->address; 104 | $supplier->mobile = $request->mobile; 105 | $supplier->details = $request->details; 106 | $supplier->previous_balance = $request->previous_balance; 107 | $supplier->save(); 108 | 109 | return redirect()->back()->with('message', 'Suppler Updated Successfully'); 110 | } 111 | 112 | /** 113 | * Remove the specified resource from storage. 114 | * 115 | * @param int $id 116 | * @return \Illuminate\Http\Response 117 | */ 118 | public function destroy($id) 119 | { 120 | $supplier = Supplier::find($id); 121 | $supplier->delete(); 122 | return redirect()->back(); 123 | 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /app/Http/Controllers/TaxController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 14 | } 15 | 16 | 17 | public function index() 18 | { 19 | $taxes = Tax::all(); 20 | return view('tax.index', compact('taxes')); 21 | } 22 | 23 | /** 24 | * Show the form for creating a new resource. 25 | * 26 | * @return \Illuminate\Http\Response 27 | */ 28 | public function create() 29 | { 30 | return view('tax.create'); 31 | } 32 | 33 | /** 34 | * Store a newly created resource in storage. 35 | * 36 | * @param \Illuminate\Http\Request $request 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function store(Request $request) 40 | { 41 | $request->validate([ 42 | 'name' => 'required|unique:taxes|numeric', 43 | ]); 44 | 45 | $tax = new Tax(); 46 | $tax->name = $request->name; 47 | $tax->slug = str_slug($request->name); 48 | $tax->status = 1; 49 | $tax->save(); 50 | 51 | return redirect()->back()->with('message', 'Tax Created Successfully'); 52 | } 53 | 54 | /** 55 | * Display the specified resource. 56 | * 57 | * @param int $id 58 | * @return \Illuminate\Http\Response 59 | */ 60 | public function show($id) 61 | { 62 | // 63 | } 64 | 65 | /** 66 | * Show the form for editing the specified resource. 67 | * 68 | * @param int $id 69 | * @return \Illuminate\Http\Response 70 | */ 71 | public function edit($id) 72 | { 73 | $tax = Tax::findOrFail($id); 74 | return view('tax.edit', compact('tax')); 75 | } 76 | 77 | /** 78 | * Update the specified resource in storage. 79 | * 80 | * @param \Illuminate\Http\Request $request 81 | * @param int $id 82 | * @return \Illuminate\Http\Response 83 | */ 84 | public function update(Request $request, $id) 85 | { 86 | $request->validate([ 87 | 'name' => 'required|numeric', 88 | ]); 89 | 90 | $tax = Tax::findOrFail($id); 91 | $tax->name = $request->name; 92 | $tax->slug = str_slug($request->name); 93 | $tax->save(); 94 | 95 | return redirect()->back()->with('message', 'Tax Updated Successfully'); 96 | } 97 | 98 | /** 99 | * Remove the specified resource from storage. 100 | * 101 | * @param int $id 102 | * @return \Illuminate\Http\Response 103 | */ 104 | public function destroy($id) 105 | { 106 | $tax = Tax::find($id); 107 | $tax->delete(); 108 | return redirect()->back(); 109 | 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /app/Http/Controllers/UnitController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 14 | } 15 | 16 | 17 | public function index() 18 | { 19 | $units = Unit::all(); 20 | return view('unit.index', compact('units')); 21 | } 22 | 23 | /** 24 | * Show the form for creating a new resource. 25 | * 26 | * @return \Illuminate\Http\Response 27 | */ 28 | public function create() 29 | { 30 | return view('unit.create'); 31 | } 32 | 33 | /** 34 | * Store a newly created resource in storage. 35 | * 36 | * @param \Illuminate\Http\Request $request 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function store(Request $request) 40 | { 41 | $request->validate([ 42 | 'name' => 'required|min:2|unique:units|regex:/^[a-zA-Z ]+$/', 43 | ]); 44 | 45 | $unit = new Unit(); 46 | $unit->name = $request->name; 47 | $unit->slug = str_slug($request->name); 48 | $unit->status = 1; 49 | $unit->save(); 50 | 51 | return redirect()->back()->with('message', 'Unite Created Successfully'); 52 | } 53 | 54 | /** 55 | * Display the specified resource. 56 | * 57 | * @param int $id 58 | * @return \Illuminate\Http\Response 59 | */ 60 | public function show($id) 61 | { 62 | // 63 | } 64 | 65 | /** 66 | * Show the form for editing the specified resource. 67 | * 68 | * @param int $id 69 | * @return \Illuminate\Http\Response 70 | */ 71 | public function edit($id) 72 | { 73 | $unit = Unit::findOrFail($id); 74 | return view('unit.edit', compact('unit')); 75 | } 76 | 77 | /** 78 | * Update the specified resource in storage. 79 | * 80 | * @param \Illuminate\Http\Request $request 81 | * @param int $id 82 | * @return \Illuminate\Http\Response 83 | */ 84 | public function update(Request $request, $id) 85 | { 86 | $request->validate([ 87 | 'name' => 'required|min:2|regex:/^[a-zA-Z ]+$/', 88 | ]); 89 | 90 | $unit = Unit::findOrFail($id); 91 | $unit->name = $request->name; 92 | $unit->slug = str_slug($request->name); 93 | $unit->save(); 94 | 95 | return redirect()->back()->with('message', 'Unit Updated Successfully'); 96 | } 97 | 98 | /** 99 | * Remove the specified resource from storage. 100 | * 101 | * @param int $id 102 | * @return \Illuminate\Http\Response 103 | */ 104 | public function destroy($id) 105 | { 106 | $unit = Unit::find($id); 107 | $unit->delete(); 108 | return redirect()->back(); 109 | 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 31 | \App\Http\Middleware\EncryptCookies::class, 32 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 33 | \Illuminate\Session\Middleware\StartSession::class, 34 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 35 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 40 | 'api' => [ 41 | 'throttle:60,1', 42 | 'bindings', 43 | ], 44 | ]; 45 | 46 | /** 47 | * The application's route middleware. 48 | * 49 | * These middleware may be assigned to groups or used individually. 50 | * 51 | * @var array 52 | */ 53 | protected $routeMiddleware = [ 54 | 'auth' => \App\Http\Middleware\Authenticate::class, 55 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 56 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 57 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 58 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 59 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 60 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 62 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 63 | ]; 64 | 65 | /** 66 | * The priority-sorted list of middleware. 67 | * 68 | * This forces non-global middleware to always be in the given order. 69 | * 70 | * @var array 71 | */ 72 | protected $middlewarePriority = [ 73 | \Illuminate\Session\Middleware\StartSession::class, 74 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 75 | \App\Http\Middleware\Authenticate::class, 76 | \Illuminate\Session\Middleware\AuthenticateSession::class, 77 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 78 | \Illuminate\Auth\Middleware\Authorize::class, 79 | ]; 80 | } 81 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForMaintenanceMode.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Sales'); 12 | } 13 | 14 | public function customer(){ 15 | return $this->belongsTo('App\Customer'); 16 | } 17 | 18 | 19 | 20 | 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/Product.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Category'); 11 | } 12 | public function unit(){ 13 | return $this->belongsTo('App\Unit'); 14 | } 15 | public function tax(){ 16 | return $this->belongsTo('App\Tax'); 17 | } 18 | 19 | public function additionalProduct(){ 20 | return $this->hasMany('App\ProductSupplier'); 21 | } 22 | 23 | public function sale(){ 24 | return $this->hasMany('App\Sale'); 25 | } 26 | 27 | public function invoice(){ 28 | return $this->belongsToMany('App\Invoice'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/ProductSale.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Product'); 11 | } 12 | 13 | public function sale(){ 14 | return $this->belongsTo('App\Sale'); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/ProductSupplier.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Product'); 12 | } 13 | 14 | public function supplier(){ 15 | return $this->belongsTo('App\Supplier'); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::prefix('api') 69 | ->middleware('api') 70 | ->namespace($this->namespace) 71 | ->group(base_path('routes/api.php')); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Purchase.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Invoice'); 11 | } 12 | 13 | public function product(){ 14 | return $this->belongsTo('App\Product'); 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/Supplier.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Product'); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/Tax.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Product'); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/Unit.php: -------------------------------------------------------------------------------- 1 | hasMany('App\Product'); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | 'datetime', 38 | ]; 39 | 40 | public function getFullNameAttribute() { 41 | return ucfirst($this->f_name) . ' ' . ucfirst($this->l_name); 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^7.1.3", 12 | "fideloper/proxy": "^4.0", 13 | "laravel/framework": "5.8.*", 14 | "laravel/tinker": "^1.0" 15 | }, 16 | "require-dev": { 17 | "beyondcode/laravel-dump-server": "^1.0", 18 | "filp/whoops": "^2.0", 19 | "fzaninotto/faker": "^1.4", 20 | "mockery/mockery": "^1.0", 21 | "nunomaduro/collision": "^3.0", 22 | "phpunit/phpunit": "^7.5" 23 | }, 24 | "config": { 25 | "optimize-autoloader": true, 26 | "preferred-install": "dist", 27 | "sort-packages": true 28 | }, 29 | "extra": { 30 | "laravel": { 31 | "dont-discover": [] 32 | } 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "App\\": "app/" 37 | }, 38 | "classmap": [ 39 | "database/seeds", 40 | "database/factories" 41 | ] 42 | }, 43 | "autoload-dev": { 44 | "psr-4": { 45 | "Tests\\": "tests/" 46 | } 47 | }, 48 | "minimum-stability": "dev", 49 | "prefer-stable": true, 50 | "scripts": { 51 | "post-autoload-dump": [ 52 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 53 | "@php artisan package:discover --ansi" 54 | ], 55 | "post-root-package-install": [ 56 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 57 | ], 58 | "post-create-project-cmd": [ 59 | "@php artisan key:generate --ansi" 60 | ] 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | 'hash' => false, 48 | ], 49 | ], 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | User Providers 54 | |-------------------------------------------------------------------------- 55 | | 56 | | All authentication drivers have a user provider. This defines how the 57 | | users are actually retrieved out of your database or other storage 58 | | mechanisms used by this application to persist your user's data. 59 | | 60 | | If you have multiple user tables or models you may configure multiple 61 | | sources which represent each model / table. These sources may then 62 | | be assigned to any extra authentication guards you have defined. 63 | | 64 | | Supported: "database", "eloquent" 65 | | 66 | */ 67 | 68 | 'providers' => [ 69 | 'users' => [ 70 | 'driver' => 'eloquent', 71 | 'model' => App\User::class, 72 | ], 73 | 74 | // 'users' => [ 75 | // 'driver' => 'database', 76 | // 'table' => 'users', 77 | // ], 78 | ], 79 | 80 | /* 81 | |-------------------------------------------------------------------------- 82 | | Resetting Passwords 83 | |-------------------------------------------------------------------------- 84 | | 85 | | You may specify multiple password reset configurations if you have more 86 | | than one user table or model in the application and you want to have 87 | | separate password reset settings based on the specific user types. 88 | | 89 | | The expire time is the number of minutes that the reset token should be 90 | | considered valid. This security feature keeps tokens short-lived so 91 | | they have less time to be guessed. You may change this as needed. 92 | | 93 | */ 94 | 95 | 'passwords' => [ 96 | 'users' => [ 97 | 'provider' => 'users', 98 | 'table' => 'password_resets', 99 | 'expire' => 60, 100 | ], 101 | ], 102 | 103 | ]; 104 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'useTLS' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Cache Stores 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may define all of the cache "stores" for your application as 29 | | well as their drivers. You may even define multiple stores for the 30 | | same cache driver to group types of items stored in your caches. 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | ], 43 | 44 | 'database' => [ 45 | 'driver' => 'database', 46 | 'table' => 'cache', 47 | 'connection' => null, 48 | ], 49 | 50 | 'file' => [ 51 | 'driver' => 'file', 52 | 'path' => storage_path('framework/cache/data'), 53 | ], 54 | 55 | 'memcached' => [ 56 | 'driver' => 'memcached', 57 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 58 | 'sasl' => [ 59 | env('MEMCACHED_USERNAME'), 60 | env('MEMCACHED_PASSWORD'), 61 | ], 62 | 'options' => [ 63 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 64 | ], 65 | 'servers' => [ 66 | [ 67 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 68 | 'port' => env('MEMCACHED_PORT', 11211), 69 | 'weight' => 100, 70 | ], 71 | ], 72 | ], 73 | 74 | 'redis' => [ 75 | 'driver' => 'redis', 76 | 'connection' => 'cache', 77 | ], 78 | 79 | 'dynamodb' => [ 80 | 'driver' => 'dynamodb', 81 | 'key' => env('AWS_ACCESS_KEY_ID'), 82 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 83 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 84 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 85 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 86 | ], 87 | 88 | ], 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Cache Key Prefix 93 | |-------------------------------------------------------------------------- 94 | | 95 | | When utilizing a RAM based store such as APC or Memcached, there might 96 | | be other applications utilizing the same cache. So, we'll specify a 97 | | value to get prefixed to all our keys so we can avoid collisions. 98 | | 99 | */ 100 | 101 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 102 | 103 | ]; 104 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | ], 66 | 67 | ], 68 | 69 | ]; 70 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Log Channels 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may configure the log channels for your application. Out of 27 | | the box, Laravel uses the Monolog PHP logging library. This gives 28 | | you a variety of powerful log handlers / formatters to utilize. 29 | | 30 | | Available Drivers: "single", "daily", "slack", "syslog", 31 | | "errorlog", "monolog", 32 | | "custom", "stack" 33 | | 34 | */ 35 | 36 | 'channels' => [ 37 | 'stack' => [ 38 | 'driver' => 'stack', 39 | 'channels' => ['daily'], 40 | 'ignore_exceptions' => false, 41 | ], 42 | 43 | 'single' => [ 44 | 'driver' => 'single', 45 | 'path' => storage_path('logs/laravel.log'), 46 | 'level' => 'debug', 47 | ], 48 | 49 | 'daily' => [ 50 | 'driver' => 'daily', 51 | 'path' => storage_path('logs/laravel.log'), 52 | 'level' => 'debug', 53 | 'days' => 14, 54 | ], 55 | 56 | 'slack' => [ 57 | 'driver' => 'slack', 58 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 59 | 'username' => 'Laravel Log', 60 | 'emoji' => ':boom:', 61 | 'level' => 'critical', 62 | ], 63 | 64 | 'papertrail' => [ 65 | 'driver' => 'monolog', 66 | 'level' => 'debug', 67 | 'handler' => SyslogUdpHandler::class, 68 | 'handler_with' => [ 69 | 'host' => env('PAPERTRAIL_URL'), 70 | 'port' => env('PAPERTRAIL_PORT'), 71 | ], 72 | ], 73 | 74 | 'stderr' => [ 75 | 'driver' => 'monolog', 76 | 'handler' => StreamHandler::class, 77 | 'formatter' => env('LOG_STDERR_FORMATTER'), 78 | 'with' => [ 79 | 'stream' => 'php://stderr', 80 | ], 81 | ], 82 | 83 | 'syslog' => [ 84 | 'driver' => 'syslog', 85 | 'level' => 'debug', 86 | ], 87 | 88 | 'errorlog' => [ 89 | 'driver' => 'errorlog', 90 | 'level' => 'debug', 91 | ], 92 | ], 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | 'block_for' => 0, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => env('AWS_ACCESS_KEY_ID'), 55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 58 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 59 | ], 60 | 61 | 'redis' => [ 62 | 'driver' => 'redis', 63 | 'connection' => 'default', 64 | 'queue' => env('REDIS_QUEUE', 'default'), 65 | 'retry_after' => 90, 66 | 'block_for' => null, 67 | ], 68 | 69 | ], 70 | 71 | /* 72 | |-------------------------------------------------------------------------- 73 | | Failed Queue Jobs 74 | |-------------------------------------------------------------------------- 75 | | 76 | | These options configure the behavior of failed queue job logging so you 77 | | can control which database and table are used to store the jobs that 78 | | have failed. You may change them to any database / table you wish. 79 | | 80 | */ 81 | 82 | 'failed' => [ 83 | 'database' => env('DB_CONNECTION', 'mysql'), 84 | 'table' => 'failed_jobs', 85 | ], 86 | 87 | ]; 88 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | ], 22 | 23 | 'postmark' => [ 24 | 'token' => env('POSTMARK_TOKEN'), 25 | ], 26 | 27 | 'ses' => [ 28 | 'key' => env('AWS_ACCESS_KEY_ID'), 29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 31 | ], 32 | 33 | 'sparkpost' => [ 34 | 'secret' => env('SPARKPOST_SECRET'), 35 | ], 36 | 37 | ]; 38 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | *.sqlite-journal 3 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(User::class, function (Faker $faker) { 20 | return [ 21 | 'name' => $faker->name, 22 | 'email' => $faker->unique()->safeEmail, 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | }); 28 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('f_name'); 19 | $table->string('l_name'); 20 | $table->string('email')->unique(); 21 | $table->string('image'); 22 | $table->timestamp('email_verified_at')->nullable(); 23 | $table->string('password'); 24 | $table->rememberToken(); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('users'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_09_14_134301_create_categories_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->string('slug'); 20 | $table->boolean('status'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('categories'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2019_09_15_053453_create_taxes_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->string('slug'); 20 | $table->boolean('status'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('taxes'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2019_09_15_055531_create_units_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->string('slug'); 20 | $table->boolean('status'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('units'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2019_09_15_061238_create_suppliers_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->string('mobile'); 20 | $table->string('address'); 21 | $table->text('details'); 22 | $table->text('previous_balance'); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('suppliers'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2019_09_15_065207_create_customers_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->string('mobile'); 20 | $table->string('address'); 21 | $table->text('details'); 22 | $table->text('previous_balance'); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('customers'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2019_09_15_101601_create_products_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('name'); 19 | $table->integer('serial_number'); 20 | $table->string('model'); 21 | $table->integer('category_id'); 22 | $table->string('sales_price'); 23 | $table->integer('unit_id'); 24 | $table->string('image'); 25 | $table->string('tax_id'); 26 | $table->timestamps(); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('products'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/migrations/2019_09_17_043116_create_product_suppliers_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->integer('product_id'); 19 | $table->integer('supplier_id'); 20 | $table->integer('price'); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('product_suppliers'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2019_09_18_180122_create_invoices_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->bigInteger('customer_id')->unsigned(); 19 | $table->string('total'); 20 | $table->foreign('customer_id') 21 | ->references('id')->on('customers') 22 | ->onDelete('cascade'); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('invoices'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2019_09_24_071816_create_sales_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->bigInteger('invoice_id')->unsigned(); 19 | $table->bigInteger('product_id')->unsigned(); 20 | $table->integer('qty'); 21 | $table->integer('price'); 22 | $table->integer('dis'); 23 | $table->integer('amount'); 24 | $table->foreign('invoice_id') 25 | ->references('id')->on('invoices') 26 | ->onDelete('cascade'); 27 | $table->foreign('product_id') 28 | ->references('id')->on('products') 29 | ->onDelete('cascade'); 30 | $table->timestamps(); 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::dropIfExists('sales'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /database/migrations/2019_09_25_123326_create_purchases_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::dropIfExists('purchases'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /database/seeds/UsersTableSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 15 | 'f_name' => "Admin", 16 | 'l_name' => "User", 17 | 'image' => "user.jpg", 18 | 'email' => 'admin@example.com', 19 | 'password' => bcrypt('password'), 20 | ]); 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.19", 14 | "bootstrap": "^4.1.0", 15 | "cross-env": "^5.1", 16 | "jquery": "^3.2", 17 | "laravel-mix": "^4.0.7", 18 | "lodash": "^4.17.13", 19 | "popper.js": "^1.12", 20 | "resolve-url-loader": "^2.3.1", 21 | "sass": "^1.15.2", 22 | "sass-loader": "^7.1.0", 23 | "vue": "^2.5.17" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Unit 14 | 15 | 16 | 17 | ./tests/Feature 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AshrafulRasel/SalesERP/62091eb4c0d634edbd8c434a11a8e2e7243fdaeb/public/favicon.ico -------------------------------------------------------------------------------- /public/images/product/Greg-Emerson-edit-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AshrafulRasel/SalesERP/62091eb4c0d634edbd8c434a11a8e2e7243fdaeb/public/images/product/Greg-Emerson-edit-2.jpg -------------------------------------------------------------------------------- /public/images/product/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AshrafulRasel/SalesERP/62091eb4c0d634edbd8c434a11a8e2e7243fdaeb/public/images/product/user.png -------------------------------------------------------------------------------- /public/images/user/avatar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AshrafulRasel/SalesERP/62091eb4c0d634edbd8c434a11a8e2e7243fdaeb/public/images/user/avatar1.png -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /public/js/main.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | "use strict"; 3 | 4 | var treeviewMenu = $('.app-menu'); 5 | 6 | // Toggle Sidebar 7 | $('[data-toggle="sidebar"]').click(function(event) { 8 | event.preventDefault(); 9 | $('.app').toggleClass('sidenav-toggled'); 10 | }); 11 | 12 | // Activate sidebar treeview toggle 13 | $("[data-toggle='treeview']").click(function(event) { 14 | event.preventDefault(); 15 | if(!$(this).parent().hasClass('is-expanded')) { 16 | treeviewMenu.find("[data-toggle='treeview']").parent().removeClass('is-expanded'); 17 | } 18 | $(this).parent().toggleClass('is-expanded'); 19 | }); 20 | 21 | // Set initial active toggle 22 | $("[data-toggle='treeview.'].is-expanded").parent().toggleClass('is-expanded'); 23 | 24 | //Activate bootstrip tooltips 25 | $("[data-toggle='tooltip']").tooltip(); 26 | 27 | })(); 28 | -------------------------------------------------------------------------------- /public/js/multifield/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | grunt.initConfig({ 3 | pkg: grunt.file.readJSON('package.json'), 4 | 5 | jshint: { 6 | options: { 7 | curly: true, 8 | eqeqeq: true, 9 | immed: true, 10 | latedef: true, 11 | newcap: true, 12 | noarg: true, 13 | sub: true, 14 | undef: true, 15 | eqnull: true, 16 | browser: true, 17 | globals: { 18 | jQuery: true, 19 | $: true, 20 | console: true 21 | } 22 | }, 23 | '<%= pkg.name %>': { 24 | src: [ 'src/js/**/*.js' ] 25 | } 26 | }, 27 | 28 | uglify: { 29 | options: { 30 | stripBanners: true, 31 | banner: '/* <%= pkg.name %> - v<%= pkg.version %> - <%= pkg.homepage %> */\n' 32 | }, 33 | 34 | build: { 35 | src: 'jquery.multifield.js', 36 | dest: 'jquery.multifield.min.js' 37 | } 38 | }, 39 | 40 | 41 | }); 42 | 43 | 44 | grunt.loadNpmTasks('grunt-contrib-jshint'); 45 | grunt.loadNpmTasks('grunt-contrib-uglify'); 46 | 47 | 48 | grunt.registerTask('default', ['jshint', 'uglify']); 49 | }; -------------------------------------------------------------------------------- /public/js/multifield/jquery.multifield.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery Multifield plugin 3 | * 4 | * https://github.com/maxkostinevich/jquery-multifield 5 | */ 6 | 7 | 8 | // the semi-colon before function invocation is a safety net against concatenated 9 | // scripts and/or other plugins which may not be closed properly. 10 | ;(function ( $, window, document, undefined ) { 11 | 12 | /* 13 | * Plugin Options 14 | * section (string) - selector of the section which is located inside of the parent wrapper 15 | * max (int) - Maximum sections 16 | * btnAdd (string) - selector of the "Add section" button - can be located everywhere on the page 17 | * btnRemove (string) - selector of the "Remove section" button - should be located INSIDE of the "section" 18 | * locale (string) - language to use, default is english 19 | */ 20 | 21 | // our plugin constructor 22 | var multiField = function( elem, options ){ 23 | this.elem = elem; 24 | this.$elem = $(elem); 25 | this.options = options; 26 | // Localization 27 | this.localize_i18n={ 28 | "multiField": { 29 | "messages": { 30 | "removeConfirmation": "Are you sure you want to remove this section?" 31 | } 32 | } 33 | }; 34 | 35 | // This next line takes advantage of HTML5 data attributes 36 | // to support customization of the plugin on a per-element 37 | // basis. For example, 38 | //
39 | this.metadata = this.$elem.data( 'mfield-options' ); 40 | }; 41 | 42 | // the plugin prototype 43 | multiField.prototype = { 44 | 45 | defaults: { 46 | max: 0, 47 | locale: 'default' 48 | }, 49 | 50 | 51 | init: function() { 52 | var $this = this; //Plugin object 53 | // Introduce defaults that can be extended either 54 | // globally or using an object literal. 55 | this.config = $.extend({}, this.defaults, this.options, 56 | this.metadata); 57 | 58 | // Load localization object 59 | if(this.config.locale !== 'default'){ 60 | $this.localize_i18n = this.config.locale; 61 | } 62 | 63 | // Hide 'Remove' buttons if only one section exists 64 | if(this.getSectionsCount()<2) { 65 | $(this.config.btnRemove, this.$elem).hide(); 66 | } 67 | 68 | // Add section 69 | this.$elem.on('click',this.config.btnAdd,function(e){ 70 | e.preventDefault(); 71 | $this.cloneSection(); 72 | }); 73 | 74 | // Remove section 75 | this.$elem.on('click',this.config.btnRemove,function(e){ 76 | e.preventDefault(); 77 | var currentSection=$(e.target.closest($this.config.section)); 78 | $this.removeSection(currentSection); 79 | }); 80 | 81 | return this; 82 | }, 83 | 84 | 85 | /* 86 | * Add new section 87 | */ 88 | cloneSection : function() { 89 | // Allow to add only allowed max count of sections 90 | if((this.config.max!==0)&&(this.getSectionsCount()+1)>this.config.max){ 91 | return false; 92 | } 93 | 94 | // Clone last section 95 | var newChild = $(this.config.section, this.$elem).last().clone().attr('style', '').attr('id', '').fadeIn('fast'); 96 | 97 | 98 | // Clear input values 99 | $('input[type!="radio"],textarea', newChild).each(function () { 100 | $(this).val(''); 101 | }); 102 | 103 | // Fix radio buttons: update name [i] to [i+1] 104 | newChild.find('input[type="radio"]').each(function(){var name=$(this).attr('name');$(this).attr('name',name.replace(/([0-9]+)/g,1*(name.match(/([0-9]+)/g))+1));}); 105 | // Reset radio button selection 106 | $('input[type=radio]',newChild).attr('checked', false); 107 | 108 | // Clear images src with reset-image-src class 109 | $('img.reset-image-src', newChild).each(function () { 110 | $(this).attr('src', ''); 111 | }); 112 | 113 | // Append new section 114 | this.$elem.append(newChild); 115 | 116 | // Show 'remove' button 117 | $(this.config.btnRemove, this.$elem).show(); 118 | }, 119 | 120 | /* 121 | * Remove existing section 122 | */ 123 | removeSection : function(section){ 124 | if (confirm(this.localize_i18n.multiField.messages.removeConfirmation)){ 125 | var sectionsCount = this.getSectionsCount(); 126 | 127 | if(sectionsCount<=2){ 128 | $(this.config.btnRemove,this.$elem).hide(); 129 | } 130 | section.slideUp('fast', function () {$(this).detach();}); 131 | } 132 | }, 133 | 134 | /* 135 | * Get sections count 136 | */ 137 | getSectionsCount: function(){ 138 | return this.$elem.children(this.config.section).length; 139 | } 140 | 141 | }; 142 | 143 | multiField.defaults = multiField.prototype.defaults; 144 | 145 | $.fn.multifield = function(options) { 146 | return this.each(function() { 147 | new multiField(this, options).init(); 148 | }); 149 | }; 150 | 151 | 152 | 153 | })( jQuery, window, document ); 154 | -------------------------------------------------------------------------------- /public/js/multifield/jquery.multifield.min.js: -------------------------------------------------------------------------------- 1 | /* jquery-multifield - v2.0.0 - https://github.com/maxkostinevich/jquery-multifield */ 2 | !function(a,b,c,d){var e=function(b,c){this.elem=b,this.$elem=a(b),this.options=c,this.localize_i18n={multiField:{messages:{removeConfirmation:"Are you sure you want to remove this section?"}}},this.metadata=this.$elem.data("mfield-options")};e.prototype={defaults:{max:0,locale:"default"},init:function(){var b=this;return this.config=a.extend({},this.defaults,this.options,this.metadata),"default"!==this.config.locale&&(b.localize_i18n=this.config.locale),this.getSectionsCount()<2&&a(this.config.btnRemove,this.$elem).hide(),this.$elem.on("click",this.config.btnAdd,function(a){a.preventDefault(),b.cloneSection()}),this.$elem.on("click",this.config.btnRemove,function(c){c.preventDefault();var d=a(c.target.closest(b.config.section));b.removeSection(d)}),this},cloneSection:function(){if(0!==this.config.max&&this.getSectionsCount()+1>this.config.max)return!1;var b=a(this.config.section,this.$elem).last().clone().attr("style","").attr("id","").fadeIn("fast");a('input[type!="radio"],textarea',b).each(function(){a(this).val("")}),b.find('input[type="radio"]').each(function(){var b=a(this).attr("name");a(this).attr("name",b.replace(/([0-9]+)/g,1*b.match(/([0-9]+)/g)+1))}),a("input[type=radio]",b).attr("checked",!1),a("img.reset-image-src",b).each(function(){a(this).attr("src","")}),this.$elem.append(b),a(this.config.btnRemove,this.$elem).show()},removeSection:function(b){if(confirm(this.localize_i18n.multiField.messages.removeConfirmation)){var c=this.getSectionsCount();c<=2&&a(this.config.btnRemove,this.$elem).hide(),b.slideUp("fast",function(){a(this).detach()})}},getSectionsCount:function(){return this.$elem.children(this.config.section).length}},e.defaults=e.prototype.defaults,a.fn.multifield=function(a){return this.each(function(){new e(this,a).init()})}}(jQuery,window,document); 3 | -------------------------------------------------------------------------------- /public/js/plugins/dataTables.bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 3 integration 3 | ©2011-2015 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a,d){a||(a=window);if(!d||!d.fn.dataTable)d=require("datatables.net")(a,d).$;return b(d,a,a.document)}:b(jQuery,window,document)})(function(b,a,d,m){var f=b.fn.dataTable;b.extend(!0,f.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", 6 | renderer:"bootstrap"});b.extend(f.ext.classes,{sWrapper:"dataTables_wrapper container-fluid dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});f.ext.renderer.pageButton.bootstrap=function(a,h,r,s,j,n){var o=new f.Api(a),t=a.oClasses,k=a.oLanguage.oPaginate,u=a.oLanguage.oAria.paginate||{},e,g,p=0,q=function(d,f){var l,h,i,c,m=function(a){a.preventDefault();!b(a.currentTarget).hasClass("disabled")&& 7 | o.page()!=a.data.action&&o.page(a.data.action).draw("page")};l=0;for(h=f.length;l",{"class":t.sPageButton+" "+g,id:0===r&& 8 | "string"===typeof c?a.sTableId+"_"+c:null}).append(b("",{href:"#","aria-controls":a.sTableId,"aria-label":u[c],"data-dt-idx":p,tabindex:a.iTabIndex,"class":"page-link"}).html(e)).appendTo(d),a.oApi._fnBindAction(i,{action:c},m),p++)}},i;try{i=b(h).find(d.activeElement).data("dt-idx")}catch(v){}q(b(h).empty().html('