diff --git a/.gitignore b/.gitignore index 86c249dff..7bf46a22a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ /node_modules Homestead.yaml Homestead.json -/nbproject/private/ \ No newline at end of file +/nbproject/private/ +.env +/app/Plugins/ServiceDesk/ +/app/config/ diff --git a/DB/dummy-data.sql b/DB/dummy-data.sql new file mode 100644 index 000000000..20758471d --- /dev/null +++ b/DB/dummy-data.sql @@ -0,0 +1,1867 @@ +-- phpMyAdmin SQL Dump +-- version 4.1.14 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Generation Time: May 16, 2016 at 12:18 PM +-- Server version: 5.6.17 +-- PHP Version: 5.5.12 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `demo_from_safraz` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `banlist` +-- + +CREATE TABLE IF NOT EXISTS `banlist` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `ban_status` tinyint(1) NOT NULL, + `email_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `internal_notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `canned_response` +-- + +CREATE TABLE IF NOT EXISTS `canned_response` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned NOT NULL, + `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `message` text COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; + +-- +-- Dumping data for table `canned_response` +-- + +INSERT INTO `canned_response` (`id`, `user_id`, `title`, `message`, `created_at`, `updated_at`) VALUES +(1, 1, 'Ticket accepted Reply', 'Hi %Client Name%,

We are looking into your issue

Thank You,
Kind Regards, 
Demo Admin,', '2016-05-16 03:02:43', '2016-05-16 03:03:18'), +(2, 1, 'Issue Fixed Reply', 'Hi %Client Name%

We have fixed your issue.

Thank You,
Kind Regards,
Demo Admin.', '2016-05-16 03:04:15', '2016-05-16 03:04:15'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `custom_forms` +-- + +CREATE TABLE IF NOT EXISTS `custom_forms` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `formname` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `custom_form_fields` +-- + +CREATE TABLE IF NOT EXISTS `custom_form_fields` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `forms_id` int(11) NOT NULL, + `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `type` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `required` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `date_format` +-- + +CREATE TABLE IF NOT EXISTS `date_format` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `format` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=10 ; + +-- +-- Dumping data for table `date_format` +-- + +INSERT INTO `date_format` (`id`, `format`) VALUES +(1, 'dd/mm/yyyy'), +(2, 'dd-mm-yyyy'), +(3, 'dd.mm.yyyy'), +(4, 'mm/dd/yyyy'), +(5, 'mm:dd:yyyy'), +(6, 'mm-dd-yyyy'), +(7, 'yyyy/mm/dd'), +(8, 'yyyy.mm.dd'), +(9, 'yyyy-mm-dd'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `date_time_format` +-- + +CREATE TABLE IF NOT EXISTS `date_time_format` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `format` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=10 ; + +-- +-- Dumping data for table `date_time_format` +-- + +INSERT INTO `date_time_format` (`id`, `format`) VALUES +(1, 'd/m/Y H:i:s'), +(2, 'd.m.Y H:i:s'), +(3, 'd-m-Y H:i:s'), +(4, 'm/d/Y H:i:s'), +(5, 'm.d.Y H:i:s'), +(6, 'm-d-Y H:i:s'), +(7, 'Y/m/d H:i:s'), +(8, 'Y.m.d H:i:s'), +(9, 'Y-m-d H:i:s'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `department` +-- + +CREATE TABLE IF NOT EXISTS `department` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `type` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `sla` int(10) unsigned DEFAULT NULL, + `manager` int(10) unsigned DEFAULT NULL, + `ticket_assignment` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `outgoing_email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `template_set` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `auto_ticket_response` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `auto_message_response` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `auto_response_email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `recipient` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `group_access` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `department_sign` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `sla` (`sla`), + KEY `manager_2` (`manager`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; + +-- +-- Dumping data for table `department` +-- + +INSERT INTO `department` (`id`, `name`, `type`, `sla`, `manager`, `ticket_assignment`, `outgoing_email`, `template_set`, `auto_ticket_response`, `auto_message_response`, `auto_response_email`, `recipient`, `group_access`, `department_sign`, `created_at`, `updated_at`) VALUES +(1, 'Support', '', 1, NULL, '', '', '', '', '', '', '', '', '', '2016-05-02 06:32:36', '2016-05-02 06:32:36'), +(2, 'Sales', '', 1, NULL, '', '', '', '', '', '', '', '', '', '2016-05-02 06:32:36', '2016-05-02 06:32:36'), +(3, 'Operation', '', 1, NULL, '', '', '', '', '', '', '', '', '', '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `emails` +-- + +CREATE TABLE IF NOT EXISTS `emails` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `email_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `email_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `department` int(10) unsigned DEFAULT NULL, + `priority` int(10) unsigned DEFAULT NULL, + `help_topic` int(10) unsigned DEFAULT NULL, + `user_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fetching_host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fetching_port` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fetching_protocol` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fetching_encryption` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mailbox_protocol` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `imap_config` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `folder` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `sending_host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `sending_port` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `sending_protocol` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `sending_encryption` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `internal_notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `auto_response` tinyint(1) NOT NULL, + `fetching_status` tinyint(1) NOT NULL, + `move_to_folder` tinyint(1) NOT NULL, + `delete_email` tinyint(1) NOT NULL, + `do_nothing` tinyint(1) NOT NULL, + `sending_status` tinyint(1) NOT NULL, + `authentication` tinyint(1) NOT NULL, + `header_spoofing` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `department` (`department`,`priority`,`help_topic`), + KEY `department_2` (`department`,`priority`,`help_topic`), + KEY `priority` (`priority`), + KEY `help_topic` (`help_topic`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `groups` +-- + +CREATE TABLE IF NOT EXISTS `groups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `group_status` tinyint(1) NOT NULL, + `can_create_ticket` tinyint(1) NOT NULL, + `can_edit_ticket` tinyint(1) NOT NULL, + `can_post_ticket` tinyint(1) NOT NULL, + `can_close_ticket` tinyint(1) NOT NULL, + `can_assign_ticket` tinyint(1) NOT NULL, + `can_transfer_ticket` tinyint(1) NOT NULL, + `can_delete_ticket` tinyint(1) NOT NULL, + `can_ban_email` tinyint(1) NOT NULL, + `can_manage_canned` tinyint(1) NOT NULL, + `can_manage_faq` tinyint(1) NOT NULL, + `can_view_agent_stats` tinyint(1) NOT NULL, + `department_access` tinyint(1) NOT NULL, + `admin_notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; + +-- +-- Dumping data for table `groups` +-- + +INSERT INTO `groups` (`id`, `name`, `group_status`, `can_create_ticket`, `can_edit_ticket`, `can_post_ticket`, `can_close_ticket`, `can_assign_ticket`, `can_transfer_ticket`, `can_delete_ticket`, `can_ban_email`, `can_manage_canned`, `can_manage_faq`, `can_view_agent_stats`, `department_access`, `admin_notes`, `created_at`, `updated_at`) VALUES +(1, 'Group A', 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, '', '2016-05-02 06:32:35', '2016-05-02 06:32:35'), +(2, 'Group B', 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, '', '2016-05-02 06:32:36', '2016-05-02 06:32:36'), +(3, 'Group C', 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, '', '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `group_assign_department` +-- + +CREATE TABLE IF NOT EXISTS `group_assign_department` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `group_id` int(10) unsigned NOT NULL, + `department_id` int(10) unsigned NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `group_id` (`group_id`), + KEY `department_id` (`department_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `help_topic` +-- + +CREATE TABLE IF NOT EXISTS `help_topic` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `topic` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parent_topic` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `custom_form` int(10) unsigned DEFAULT NULL, + `department` int(10) unsigned DEFAULT NULL, + `ticket_status` int(10) unsigned DEFAULT NULL, + `priority` int(10) unsigned DEFAULT NULL, + `sla_plan` int(10) unsigned DEFAULT NULL, + `thank_page` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `ticket_num_format` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `internal_notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `type` tinyint(1) NOT NULL, + `auto_assign` int(10) unsigned DEFAULT NULL, + `auto_response` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `custom_form` (`custom_form`), + KEY `department` (`department`), + KEY `ticket_status` (`ticket_status`), + KEY `priority` (`priority`), + KEY `sla_plan` (`sla_plan`), + KEY `auto_assign_2` (`auto_assign`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; + +-- +-- Dumping data for table `help_topic` +-- + +INSERT INTO `help_topic` (`id`, `topic`, `parent_topic`, `custom_form`, `department`, `ticket_status`, `priority`, `sla_plan`, `thank_page`, `ticket_num_format`, `internal_notes`, `status`, `type`, `auto_assign`, `auto_response`, `created_at`, `updated_at`) VALUES +(1, 'Support query', '', NULL, 1, 1, 2, 1, '', '1', '', 1, 1, NULL, 0, '2016-05-02 06:32:36', '2016-05-02 06:32:36'), +(2, 'Sales query', '', NULL, 2, 1, 2, 1, '', '1', '', 0, 1, NULL, 0, '2016-05-02 06:32:36', '2016-05-02 06:32:36'), +(3, 'Operational query', '', NULL, 3, 1, 2, 1, '', '1', '', 0, 1, NULL, 0, '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `kb_article` +-- + +CREATE TABLE IF NOT EXISTS `kb_article` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `description` text COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `type` tinyint(1) NOT NULL, + `publish_time` datetime DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ; + +-- +-- Dumping data for table `kb_article` +-- + +INSERT INTO `kb_article` (`id`, `name`, `slug`, `description`, `status`, `type`, `publish_time`, `created_at`, `updated_at`) VALUES +(2, 'RETURN & CANCELLATION', 'cloth', '

Size doesn’t fit you or the Apparel/ Product is damaged/ defective can be returned in its original packing within 7 days of delivery. Once we have verified the damage, defect and/or error, you shall receive a replacement or a full refund for the Product in the original means of payment.

\r\n\r\n


\r\nThe B Clothing reserves the right to refuse a payment on a return of product purchased from www.thebclothing.com if the product is not received in its original condition, or is received damaged or has been used. All products to be returned must be notified to The B Clothing within 7 Days of receipt of your order..

\r\n\r\n


\r\nIn case of International shipments, customers may return any products that they have a size issue with if they are willing to bear the shipping costs. In case of damaged or defective products, International customers would need to send images of the product in its original packaging to support@abcclothing.com to claim a refund. Also, for damages and defects, the customer must notify ABC Clothing within 2 days of receiving the product.

\r\n\r\n


\r\nIn case of any returns that are approved, the purchase amount will be refunded to the customer within 15 business days upon receipt of return package, deducting any applicable return-processing fee.

\r\n\r\n


\r\nThe following mode of refund payments will be used:
\r\n• If online payment, then amount will be refunded online.

\r\n\r\n


\r\nAny requests for cancellation of orders placed should be made immediately by contacting support@abc clothing.com. If the order has been processed or shipped, the applicable order cancellation charges will be applied.

\r\n\r\n

 

\r\n', 1, 1, '2015-05-03 23:56:00', '2016-05-03 12:57:11', '2016-05-04 01:32:24'), +(3, ' SHIPPING POLICY', 'hello', '

We ship worldwide. We use FedEx/DTDC for shipping.

\r\n\r\n

Standard Shipping is usually 3-7 Working days for orders within India and 12-15 Working days for International Orders, but usually faster. IF your order doesn’t reach you in time, you may write to us at support@abcclothing.com

\r\n\r\n

International Orders

\r\n\r\n

For international orders, please note, your shipping will be calculated at the time of Check out only, this is a System Generated amount, based on your Zip Code, Region and Order Weight. (Approx Costs Rs.1250-1500 for 500 gms – International Shipment, subject to region)

\r\n\r\n

Tracking

\r\n\r\n

For tracking your order go to the following website, it will require your tracking ID which is sent via mail in your invoice.

\r\n', 1, 1, '2015-05-03 23:58:00', '2016-05-03 13:01:10', '2016-05-16 03:08:03'), +(4, 'PRIVACY POLICY', 'policy', '

The ABC Clothing collects your basic information to service your requests. This basic information is gathered when you purchase products/Gift card vouchers or when you sign up for e-mail notifications. Information gathered from you includes your name, mailing address, e-mail and phone number. Only when you place an order, your card information is requested and is submitted via the highest level of encryption to make sure of the greatest amount of safety and security. Reason why we gather this information:

\r\n\r\n

To process your order.
\r\nShipping and Customer Service.
\r\nWe also use the information to upgrade our products, customer services, website content and navigation.

\r\n\r\n


\r\nInternal Record Keeping.
\r\nWe at The ABC Clothing respect that you do not want your personal information shared with other companies. The information you provide shall, therefore, be only used to process your order and customer support. The ABC Clothing does not share, sell or rent customer information to any other company.

\r\n', 1, 1, '2015-05-04 00:01:00', '2016-05-03 13:06:09', '2016-05-16 03:08:00'), +(5, 'SECURE SHOPPING GUARANTEE', 'abc', '

We accept all major Indian and International Credit/ Debit Cards, and Net Banking with over 40 Banks.

\r\n\r\n

NO Cash on Delivery (as random people order and share false addresses for fun)

\r\n\r\n

Yes, shopping at our e-store is 100% safe. All payment requests are directed to the secured PayU Payment Gateway. This gives you the highest level of protection possible whenever you use credit cards or make other financial or confidential transactions over the Internet.

\r\n\r\n

You can be assured that our e-store offers you the highest standards of security currently available on the net so as to ensure that your shopping experience is private, safe and secure.

\r\n', 1, 1, '2015-05-04 00:09:00', '2016-05-03 13:11:15', '2016-05-04 01:32:53'), +(8, 'TROUSER SKIRTS', 'tro', '

Paris takes its fashion very, very seriously. So seriously, in fact, that wearing the wrong thing has actually caused a riot.

\r\n\r\n

In 1911, two rival Parisian couture houses launched their "trouser skirts," an innovation in fashion that trod the very fixed line between the genders and seemed to promise greater flexibility for women in general. There were two different versions of the trouser skirt: One was a sort of baggy pant with a very low hanging crotch, described as "a sack with holes made for the legs to go through," not unlike the fashions on high streets today, and the other a pair of the same kind of pants topped with an over-skirt, again, not unlike high street fashions of today. Both versions were launched by models at the opening day of racing season to general revulsion and disgust, but thankfully, no violence.

\r\n\r\n

It wasn't until the ladies attempted to promenade their future fashions on the boulevards that the fisticuffs started—at the Place de l'Opera, the poor models were attacked by a jeering mob of fashion Philistines, who pulled their hair, trampled their hats, and reduced them to tears. A squad of police officers on bicycles were dispatched to rescue the girls and escort them to safety.

\r\n', 1, 1, '2015-05-04 11:54:00', '2016-05-04 00:56:06', '2016-05-04 00:56:06'), +(9, 'CUSTOM ORDER', 'cus', '

You saw, you liked but couldn’t see your size? We will custom make it for you.

\r\n\r\n

How it works:

\r\n\r\n
    \r\n
  1. You liked something and want to modify a little or have something else on mind, do pen it down and share it with us on Support@abcclothing.com
  2. \r\n
  3. We’ll work out the price depending on how detailed or intricate you want your garment.
  4. \r\n
  5. An advance would be required for any customized orders.
  6. \r\n
  7. Once you’ve placed a deposit, we’ll make you a sketch of the garment.
  8. \r\n
  9. We can complete your order in 15-20 days depending on the workload.
  10. \r\n
  11. We will also share some updates on the garment in case something needs to be changed.
  12. \r\n
  13. We finally ship it to your given address.
  14. \r\n
\r\n\r\n

Note: No returns and refunds.

\r\n', 1, 1, '2015-05-04 11:56:00', '2016-05-04 01:01:08', '2016-05-04 01:27:43'), +(10, 'DISCLAIMERS', 'dismiss', '

ABC clothing.com does not promise that the site will be inoffensive, error-free or uninterrupted, or that it will provide specific information from use of the site or any content, search, or link on it. The site and its content are delivered on an “as-is” and “as-available” basis. ABC clothing.com cannot ensure that files you download from the site will be free of viruses or contamination or destructive features.

\r\n\r\n

Thebclothing.com disclaims all warranties, express or implied, including any implied warranties of merchantability and fitness for a particular purpose. ABC clothing.com will not be liable for any damages of any kind arising from the use of this site, including, without limitation, direct, indirect, incidental, and punitive and consequential damages.

\r\n\r\n

ABC clothing.com disclaims any and all liability for the acts, omissions, and conduct of any third-party users, ABC clothing.com users, advertisers, and/or sponsors on the Site, in connection with the Site, or other-wise related to your use of the Site. ABC clothing.com is not responsible for the products, services, actions, or failure to act of any third party in connection with or referenced on the Site. Without limiting the fore-going, you may report the misconduct of users and/or third-party advertisers or service and/or product providers referenced on or included in the Site to ABC clothing.com at Support@abcclothing.com

\r\n\r\n

ABC clothing.com may investigate the claim and take appropriate action, at its sole discretion.

\r\n\r\n

For any query kindly drop mail us on  Support@abcclothing.com.

\r\n', 1, 1, '2015-05-04 12:02:00', '2016-05-04 01:06:37', '2016-05-16 03:07:58'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `kb_article_relationship` +-- + +CREATE TABLE IF NOT EXISTS `kb_article_relationship` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `article_id` int(10) unsigned NOT NULL, + `category_id` int(10) unsigned NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `article_relationship_article_id_foreign` (`article_id`), + KEY `article_relationship_category_id_foreign` (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=29 ; + +-- +-- Dumping data for table `kb_article_relationship` +-- + +INSERT INTO `kb_article_relationship` (`id`, `article_id`, `category_id`, `created_at`, `updated_at`) VALUES +(17, 8, 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00'), +(20, 9, 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00'), +(23, 2, 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00'), +(24, 5, 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00'), +(26, 10, 2, '0000-00-00 00:00:00', '0000-00-00 00:00:00'), +(27, 4, 2, '0000-00-00 00:00:00', '0000-00-00 00:00:00'), +(28, 3, 2, '0000-00-00 00:00:00', '0000-00-00 00:00:00'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `kb_category` +-- + +CREATE TABLE IF NOT EXISTS `kb_category` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `description` text COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `parent` int(11) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; + +-- +-- Dumping data for table `kb_category` +-- + +INSERT INTO `kb_category` (`id`, `name`, `slug`, `description`, `status`, `parent`, `created_at`, `updated_at`) VALUES +(1, 'Issue Handeling', 'issue-handling', 'These are the list of error handling issue.
', 1, 0, '2016-05-03 08:18:14', '2016-05-16 03:06:05'), +(2, 'Policy', 'policy', 'These are the policies defined by this organization

', 1, 0, '2016-05-16 03:07:28', '2016-05-16 03:07:28'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `kb_comment` +-- + +CREATE TABLE IF NOT EXISTS `kb_comment` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `article_id` int(10) unsigned NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `website` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `comment` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `comment_article_id_foreign` (`article_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `kb_pages` +-- + +CREATE TABLE IF NOT EXISTS `kb_pages` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `visibility` tinyint(1) NOT NULL, + `slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `description` text COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `kb_pages` +-- + +INSERT INTO `kb_pages` (`id`, `name`, `status`, `visibility`, `slug`, `description`, `created_at`, `updated_at`) VALUES +(1, 'About Us', 1, 1, 'about-us', '

At ABC, our vision is to be Earth''s most customer centric company; to build a place where people can come to find and discover virtually anything they want to buy online. With ABC.com, we endeavor to build that same destination over globally by giving customers more of what they want – vast selection, low prices, fast and reliable delivery, and a trusted and convenient online shopping experience – and provide sellers a world-class e-commerce platform. We are committed to ensure 100%  Purchase Protection for your shopping done on ABC.com so that you can benefit from a safe and secure online ordering experience, convenient payment options such as cash on delivery, easy returns and enjoy a completely hassle free online shopping experience. 


We launched with Books and Movies & TV shows and have expanded our offerings to include the Kindle family of E-Readers, the ABC store and various products under different categories. Customers can now buy products from popular brands across categories such as Samsung mobiles, Dell laptops, Canon cameras, Fastrack watches and many more at ABC.com. Don’t forget to check out the ABC Exclusives Store and also, shop for Today''s Deals on ABC and save big every day. On ABC, shopping is not only about buying, it''s also about gifting and through Gift a Smile you can give products online to charity through verified NGOs. 


Customers can also shop our full selection of products using the ABC App for Android, iOS and Windows which offers customers a convenient, fast and secure way to search, browse, compare offers, and shop online quickly and easily, at anytime from anywhere. 


It is still “Day 1” and we continue to relentlessly focus on using our investments in technology and innovation to transform the lives of our customers and all our partners. 

', '2016-05-16 03:10:14', '2016-05-16 03:20:47'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `kb_settings` +-- + +CREATE TABLE IF NOT EXISTS `kb_settings` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `pagination` int(11) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `kb_settings` +-- + +INSERT INTO `kb_settings` (`id`, `pagination`, `created_at`, `updated_at`) VALUES +(1, 10, '2016-05-02 06:32:38', '2016-05-02 06:32:38'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `languages` +-- + +CREATE TABLE IF NOT EXISTS `languages` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `locale` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=10 ; + +-- +-- Dumping data for table `languages` +-- + +INSERT INTO `languages` (`id`, `name`, `locale`) VALUES +(1, 'English', 'en'), +(2, 'Italian', 'it'), +(3, 'German', 'de'), +(4, 'French', 'fr'), +(5, 'Brazilian Portuguese', 'pt_BR'), +(6, 'Dutch', 'nl'), +(7, 'Spanish', 'es'), +(8, 'Norwegian', 'nb_NO'), +(9, 'Danish', 'da'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `log_notification` +-- + +CREATE TABLE IF NOT EXISTS `log_notification` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `log` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `log_notification` +-- + +INSERT INTO `log_notification` (`id`, `log`, `created_at`, `updated_at`) VALUES +(1, 'NOT-1', '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mailbox_protocol` +-- + +CREATE TABLE IF NOT EXISTS `mailbox_protocol` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; + +-- +-- Dumping data for table `mailbox_protocol` +-- + +INSERT INTO `mailbox_protocol` (`id`, `name`, `value`) VALUES +(1, 'IMAP', '/imap'), +(2, 'IMAP+SSL', '/imap/ssl'), +(3, 'IMAP+TLS', '/imap/tls'), +(4, 'IMAP+SSL/No-validate', '/imap/ssl/novalidate-cert'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `migrations` +-- + +CREATE TABLE IF NOT EXISTS `migrations` ( + `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `batch` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `migrations` +-- + +INSERT INTO `migrations` (`migration`, `batch`) VALUES +('2016_02_16_140450_create_banlist_table', 1), +('2016_02_16_140450_create_canned_response_table', 1), +('2016_02_16_140450_create_custom_form_fields_table', 1), +('2016_02_16_140450_create_custom_forms_table', 1), +('2016_02_16_140450_create_date_format_table', 1), +('2016_02_16_140450_create_date_time_format_table', 1), +('2016_02_16_140450_create_department_table', 1), +('2016_02_16_140450_create_emails_table', 1), +('2016_02_16_140450_create_group_assign_department_table', 1), +('2016_02_16_140450_create_groups_table', 1), +('2016_02_16_140450_create_help_topic_table', 1), +('2016_02_16_140450_create_kb_article_relationship_table', 1), +('2016_02_16_140450_create_kb_article_table', 1), +('2016_02_16_140450_create_kb_category_table', 1), +('2016_02_16_140450_create_kb_comment_table', 1), +('2016_02_16_140450_create_kb_pages_table', 1), +('2016_02_16_140450_create_kb_settings_table', 1), +('2016_02_16_140450_create_languages_table', 1), +('2016_02_16_140450_create_log_notification_table', 1), +('2016_02_16_140450_create_mailbox_protocol_table', 1), +('2016_02_16_140450_create_organization_table', 1), +('2016_02_16_140450_create_password_resets_table', 1), +('2016_02_16_140450_create_plugins_table', 1), +('2016_02_16_140450_create_send_mail_table', 1), +('2016_02_16_140450_create_settings_alert_notice_table', 1), +('2016_02_16_140450_create_settings_auto_response_table', 1), +('2016_02_16_140450_create_settings_company_table', 1), +('2016_02_16_140450_create_settings_email_table', 1), +('2016_02_16_140450_create_settings_ratings_table', 1), +('2016_02_16_140450_create_settings_system_table', 1), +('2016_02_16_140450_create_settings_ticket_table', 1), +('2016_02_16_140450_create_sla_plan_table', 1), +('2016_02_16_140450_create_team_assign_agent_table', 1), +('2016_02_16_140450_create_teams_table', 1), +('2016_02_16_140450_create_template_table', 1), +('2016_02_16_140450_create_ticket_attachment_table', 1), +('2016_02_16_140450_create_ticket_collaborator_table', 1), +('2016_02_16_140450_create_ticket_form_data_table', 1), +('2016_02_16_140450_create_ticket_priority_table', 1), +('2016_02_16_140450_create_ticket_source_table', 1), +('2016_02_16_140450_create_ticket_status_table', 1), +('2016_02_16_140450_create_ticket_thread_table', 1), +('2016_02_16_140450_create_tickets_table', 1), +('2016_02_16_140450_create_time_format_table', 1), +('2016_02_16_140450_create_timezone_table', 1), +('2016_02_16_140450_create_user_assign_organization_table', 1), +('2016_02_16_140450_create_users_table', 1), +('2016_02_16_140450_create_version_check_table', 1), +('2016_02_16_140450_create_widgets_table', 1), +('2016_02_16_140454_add_foreign_keys_to_canned_response_table', 1), +('2016_02_16_140454_add_foreign_keys_to_department_table', 1), +('2016_02_16_140454_add_foreign_keys_to_emails_table', 1), +('2016_02_16_140454_add_foreign_keys_to_group_assign_department_table', 1), +('2016_02_16_140454_add_foreign_keys_to_help_topic_table', 1), +('2016_02_16_140454_add_foreign_keys_to_kb_article_relationship_table', 1), +('2016_02_16_140454_add_foreign_keys_to_kb_comment_table', 1), +('2016_02_16_140454_add_foreign_keys_to_organization_table', 1), +('2016_02_16_140454_add_foreign_keys_to_settings_system_table', 1), +('2016_02_16_140454_add_foreign_keys_to_team_assign_agent_table', 1), +('2016_02_16_140454_add_foreign_keys_to_teams_table', 1), +('2016_02_16_140454_add_foreign_keys_to_ticket_attachment_table', 1), +('2016_02_16_140454_add_foreign_keys_to_ticket_collaborator_table', 1), +('2016_02_16_140454_add_foreign_keys_to_ticket_form_data_table', 1), +('2016_02_16_140454_add_foreign_keys_to_ticket_thread_table', 1), +('2016_02_16_140454_add_foreign_keys_to_tickets_table', 1), +('2016_02_16_140454_add_foreign_keys_to_user_assign_organization_table', 1), +('2016_02_16_140454_add_foreign_keys_to_users_table', 1), +('2016_03_31_061239_create_notifications_table', 1), +('2016_03_31_061534_create_notification_types_table', 1), +('2016_03_31_061740_create_user_notification_table', 1), +('2016_04_18_115852_create_workflow_name_table', 1), +('2016_04_18_115900_create_workflow_rule_table', 1), +('2016_04_18_115908_create_workflow_action_table', 1); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `notifications` +-- + +CREATE TABLE IF NOT EXISTS `notifications` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `model_id` int(11) NOT NULL, + `userid_created` int(11) NOT NULL, + `type_id` int(11) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ; + +-- +-- Dumping data for table `notifications` +-- + +INSERT INTO `notifications` (`id`, `model_id`, `userid_created`, `type_id`, `created_at`, `updated_at`) VALUES +(1, 1, 2, 3, '2016-05-03 00:16:13', '2016-05-03 00:16:13'), +(2, 2, 1, 3, '2016-05-03 00:27:13', '2016-05-03 00:27:13'), +(3, 3, 2, 3, '2016-05-03 01:03:59', '2016-05-03 01:03:59'), +(4, 4, 1, 3, '2016-05-03 01:07:15', '2016-05-03 01:07:15'), +(5, 5, 3, 3, '2016-05-03 01:14:11', '2016-05-03 01:14:11'), +(6, 6, 4, 3, '2016-05-03 01:19:19', '2016-05-03 01:19:19'), +(7, 7, 1, 3, '2016-05-03 01:25:15', '2016-05-03 01:25:15'), +(8, 3, 1, 2, '2016-05-16 02:49:22', '2016-05-16 02:49:22'), +(9, 6, 1, 2, '2016-05-16 02:52:18', '2016-05-16 02:52:18'), +(10, 6, 1, 2, '2016-05-16 03:00:29', '2016-05-16 03:00:29'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `notification_types` +-- + +CREATE TABLE IF NOT EXISTS `notification_types` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `type` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_class` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `organization` +-- + +CREATE TABLE IF NOT EXISTS `organization` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `website` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `head` int(10) unsigned DEFAULT NULL, + `internal_notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `head` (`head`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `organization` +-- + +INSERT INTO `organization` (`id`, `name`, `phone`, `website`, `address`, `head`, `internal_notes`, `created_at`, `updated_at`) VALUES +(1, 'XYZ Organization', '', '', '', NULL, '', '2016-05-16 03:21:30', '2016-05-16 03:21:30'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `password_resets` +-- + +CREATE TABLE IF NOT EXISTS `password_resets` ( + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + KEY `password_resets_email_index` (`email`), + KEY `password_resets_token_index` (`token`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `plugins` +-- + +CREATE TABLE IF NOT EXISTS `plugins` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `path` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` int(11) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `send_mail` +-- + +CREATE TABLE IF NOT EXISTS `send_mail` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `driver` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `port` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `encryption` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `send_mail` +-- + +INSERT INTO `send_mail` (`id`, `driver`, `host`, `port`, `encryption`, `name`, `email`, `password`) VALUES +(1, '', '', '', '', '', '', ''); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings_alert_notice` +-- + +CREATE TABLE IF NOT EXISTS `settings_alert_notice` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `ticket_status` tinyint(1) NOT NULL, + `ticket_admin_email` tinyint(1) NOT NULL, + `ticket_department_manager` tinyint(1) NOT NULL, + `ticket_department_member` tinyint(1) NOT NULL, + `ticket_organization_accmanager` tinyint(1) NOT NULL, + `message_status` tinyint(1) NOT NULL, + `message_last_responder` tinyint(1) NOT NULL, + `message_assigned_agent` tinyint(1) NOT NULL, + `message_department_manager` tinyint(1) NOT NULL, + `message_organization_accmanager` tinyint(1) NOT NULL, + `internal_status` tinyint(1) NOT NULL, + `internal_last_responder` tinyint(1) NOT NULL, + `internal_assigned_agent` tinyint(1) NOT NULL, + `internal_department_manager` tinyint(1) NOT NULL, + `assignment_status` tinyint(1) NOT NULL, + `assignment_assigned_agent` tinyint(1) NOT NULL, + `assignment_team_leader` tinyint(1) NOT NULL, + `assignment_team_member` tinyint(1) NOT NULL, + `transfer_status` tinyint(1) NOT NULL, + `transfer_assigned_agent` tinyint(1) NOT NULL, + `transfer_department_manager` tinyint(1) NOT NULL, + `transfer_department_member` tinyint(1) NOT NULL, + `overdue_status` tinyint(1) NOT NULL, + `overdue_assigned_agent` tinyint(1) NOT NULL, + `overdue_department_manager` tinyint(1) NOT NULL, + `overdue_department_member` tinyint(1) NOT NULL, + `system_error` tinyint(1) NOT NULL, + `sql_error` tinyint(1) NOT NULL, + `excessive_failure` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `settings_alert_notice` +-- + +INSERT INTO `settings_alert_notice` (`id`, `ticket_status`, `ticket_admin_email`, `ticket_department_manager`, `ticket_department_member`, `ticket_organization_accmanager`, `message_status`, `message_last_responder`, `message_assigned_agent`, `message_department_manager`, `message_organization_accmanager`, `internal_status`, `internal_last_responder`, `internal_assigned_agent`, `internal_department_manager`, `assignment_status`, `assignment_assigned_agent`, `assignment_team_leader`, `assignment_team_member`, `transfer_status`, `transfer_assigned_agent`, `transfer_department_manager`, `transfer_department_member`, `overdue_status`, `overdue_assigned_agent`, `overdue_department_manager`, `overdue_department_member`, `system_error`, `sql_error`, `excessive_failure`, `created_at`, `updated_at`) VALUES +(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings_auto_response` +-- + +CREATE TABLE IF NOT EXISTS `settings_auto_response` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `new_ticket` tinyint(1) NOT NULL, + `agent_new_ticket` tinyint(1) NOT NULL, + `submitter` tinyint(1) NOT NULL, + `participants` tinyint(1) NOT NULL, + `overlimit` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `settings_auto_response` +-- + +INSERT INTO `settings_auto_response` (`id`, `new_ticket`, `agent_new_ticket`, `submitter`, `participants`, `overlimit`, `created_at`, `updated_at`) VALUES +(1, 1, 1, 0, 0, 0, '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings_company` +-- + +CREATE TABLE IF NOT EXISTS `settings_company` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `company_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `website` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `landing_page` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `offline_page` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `thank_page` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `logo` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_logo` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `settings_company` +-- + +INSERT INTO `settings_company` (`id`, `company_name`, `website`, `phone`, `address`, `landing_page`, `offline_page`, `thank_page`, `logo`, `use_logo`, `created_at`, `updated_at`) VALUES +(1, 'ABC Company', '', '', '', '', '', '', '', '0', '2016-05-02 06:32:36', '2016-05-16 04:41:49'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings_email` +-- + +CREATE TABLE IF NOT EXISTS `settings_email` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `template` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `sys_email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `alert_email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `admin_email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mta` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `email_fetching` tinyint(1) NOT NULL, + `notification_cron` tinyint(1) NOT NULL, + `strip` tinyint(1) NOT NULL, + `separator` tinyint(1) NOT NULL, + `all_emails` tinyint(1) NOT NULL, + `email_collaborator` tinyint(1) NOT NULL, + `attachment` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `settings_email` +-- + +INSERT INTO `settings_email` (`id`, `template`, `sys_email`, `alert_email`, `admin_email`, `mta`, `email_fetching`, `notification_cron`, `strip`, `separator`, `all_emails`, `email_collaborator`, `attachment`, `created_at`, `updated_at`) VALUES +(1, 'default', NULL, '', '', '', 1, 0, 0, 0, 1, 1, 1, '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings_ratings` +-- + +CREATE TABLE IF NOT EXISTS `settings_ratings` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `rating_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `publish` int(11) NOT NULL, + `modify` int(11) NOT NULL, + `slug` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `settings_ratings_slug_unique` (`slug`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings_system` +-- + +CREATE TABLE IF NOT EXISTS `settings_system` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `status` tinyint(1) NOT NULL, + `url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `department` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `page_size` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `log_level` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `purge_log` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `api_enable` int(11) NOT NULL, + `api_key_mandatory` int(11) NOT NULL, + `api_key` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name_format` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `time_farmat` int(10) unsigned DEFAULT NULL, + `date_format` int(10) unsigned DEFAULT NULL, + `date_time_format` int(10) unsigned DEFAULT NULL, + `day_date_time` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `time_zone` int(10) unsigned DEFAULT NULL, + `content` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `time_farmat` (`time_farmat`), + KEY `date_format` (`date_format`), + KEY `date_time_format` (`date_time_format`), + KEY `time_zone` (`time_zone`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `settings_system` +-- + +INSERT INTO `settings_system` (`id`, `status`, `url`, `name`, `department`, `page_size`, `log_level`, `purge_log`, `api_enable`, `api_key_mandatory`, `api_key`, `name_format`, `time_farmat`, `date_format`, `date_time_format`, `day_date_time`, `time_zone`, `content`, `created_at`, `updated_at`) VALUES +(1, 1, '', '
ABC SUPPORT CENTER
', '1', '', '', '', 0, 0, '', '', NULL, NULL, 1, '', 79, '', '2016-05-02 06:32:38', '2016-05-16 04:44:53'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings_ticket` +-- + +CREATE TABLE IF NOT EXISTS `settings_ticket` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `num_format` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `num_sequence` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `priority` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `sla` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `help_topic` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `max_open_ticket` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `collision_avoid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `captcha` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `claim_response` tinyint(1) NOT NULL, + `assigned_ticket` tinyint(1) NOT NULL, + `answered_ticket` tinyint(1) NOT NULL, + `agent_mask` tinyint(1) NOT NULL, + `html` tinyint(1) NOT NULL, + `client_update` tinyint(1) NOT NULL, + `max_file_size` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `settings_ticket` +-- + +INSERT INTO `settings_ticket` (`id`, `num_format`, `num_sequence`, `priority`, `sla`, `help_topic`, `max_open_ticket`, `collision_avoid`, `captcha`, `status`, `claim_response`, `assigned_ticket`, `answered_ticket`, `agent_mask`, `html`, `client_update`, `max_file_size`, `created_at`, `updated_at`) VALUES +(1, '#ABCD 1234 1234567', '0', '1', '2', '1', '', '2', '', 1, 0, 0, 0, 0, 0, 0, 0, '2016-05-02 06:32:36', '2016-05-02 06:32:36'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sla_plan` +-- + +CREATE TABLE IF NOT EXISTS `sla_plan` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `grace_period` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `admin_note` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `transient` tinyint(1) NOT NULL, + `ticket_overdue` tinyint(1) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; + +-- +-- Dumping data for table `sla_plan` +-- + +INSERT INTO `sla_plan` (`id`, `name`, `grace_period`, `admin_note`, `status`, `transient`, `ticket_overdue`, `created_at`, `updated_at`) VALUES +(1, 'Sla 1', '6 Hours', '', 1, 0, 0, '2016-05-02 06:32:34', '2016-05-02 06:32:34'), +(2, 'Sla 2', '12 Hours', '', 1, 0, 0, '2016-05-02 06:32:34', '2016-05-02 06:32:34'), +(3, 'Sla 3', '24 Hours', '', 1, 0, 0, '2016-05-02 06:32:34', '2016-05-02 06:32:34'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `teams` +-- + +CREATE TABLE IF NOT EXISTS `teams` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `team_lead` int(10) unsigned DEFAULT NULL, + `assign_alert` tinyint(1) NOT NULL, + `admin_notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `team_lead` (`team_lead`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; + +-- +-- Dumping data for table `teams` +-- + +INSERT INTO `teams` (`id`, `name`, `status`, `team_lead`, `assign_alert`, `admin_notes`, `created_at`, `updated_at`) VALUES +(1, 'Level 1 Support', 1, NULL, 0, '', '2016-05-02 06:32:35', '2016-05-02 06:32:35'), +(2, 'Level 2 Support', 0, NULL, 0, '', '2016-05-02 06:32:35', '2016-05-02 06:32:35'), +(3, 'Developer', 0, NULL, 0, '', '2016-05-02 06:32:35', '2016-05-02 06:32:35'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `team_assign_agent` +-- + +CREATE TABLE IF NOT EXISTS `team_assign_agent` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `team_id` int(10) unsigned DEFAULT NULL, + `agent_id` int(10) unsigned DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `team_id` (`team_id`), + KEY `agent_id` (`agent_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `template` +-- + +CREATE TABLE IF NOT EXISTS `template` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` tinyint(1) NOT NULL, + `template_set_to_clone` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `language` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `internal_note` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `tickets` +-- + +CREATE TABLE IF NOT EXISTS `tickets` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `ticket_number` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `dept_id` int(10) unsigned DEFAULT NULL, + `team_id` int(10) unsigned DEFAULT NULL, + `priority_id` int(10) unsigned DEFAULT NULL, + `sla` int(10) unsigned DEFAULT NULL, + `help_topic_id` int(10) unsigned DEFAULT NULL, + `status` int(10) unsigned DEFAULT NULL, + `rating` tinyint(1) NOT NULL, + `ratingreply` tinyint(1) NOT NULL, + `flags` int(11) NOT NULL, + `ip_address` int(11) NOT NULL, + `assigned_to` int(10) unsigned DEFAULT NULL, + `lock_by` int(11) NOT NULL, + `lock_at` datetime DEFAULT NULL, + `source` int(10) unsigned DEFAULT NULL, + `isoverdue` int(11) NOT NULL, + `reopened` int(11) NOT NULL, + `isanswered` int(11) NOT NULL, + `html` int(11) NOT NULL, + `is_deleted` int(11) NOT NULL, + `closed` int(11) NOT NULL, + `is_transferred` tinyint(1) NOT NULL, + `transferred_at` datetime NOT NULL, + `reopened_at` datetime DEFAULT NULL, + `duedate` datetime DEFAULT NULL, + `closed_at` datetime DEFAULT NULL, + `last_message_at` datetime DEFAULT NULL, + `last_response_at` datetime DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `user_id` (`user_id`), + KEY `dept_id` (`dept_id`), + KEY `team_id` (`team_id`), + KEY `priority_id` (`priority_id`), + KEY `sla` (`sla`), + KEY `help_topic_id` (`help_topic_id`), + KEY `status` (`status`), + KEY `assigned_to` (`assigned_to`), + KEY `source` (`source`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=8 ; + +-- +-- Dumping data for table `tickets` +-- + +INSERT INTO `tickets` (`id`, `ticket_number`, `user_id`, `dept_id`, `team_id`, `priority_id`, `sla`, `help_topic_id`, `status`, `rating`, `ratingreply`, `flags`, `ip_address`, `assigned_to`, `lock_by`, `lock_at`, `source`, `isoverdue`, `reopened`, `isanswered`, `html`, `is_deleted`, `closed`, `is_transferred`, `transferred_at`, `reopened_at`, `duedate`, `closed_at`, `last_message_at`, `last_response_at`, `created_at`, `updated_at`) VALUES +(3, 'AAAD-0003-0000003', 2, 2, NULL, 1, 1, 2, 1, 0, 0, 0, 0, 1, 1, '2016-05-16 10:18:17', 3, 0, 0, 1, 0, 0, 0, 0, '0000-00-00 00:00:00', NULL, '2016-05-03 12:33:59', NULL, NULL, NULL, '2016-05-03 01:03:59', '2016-05-16 04:48:17'), +(4, 'AAAE-0004-0000004', 2, 1, NULL, 1, 1, 1, 1, 0, 0, 0, 0, NULL, 1, '2016-05-16 10:06:55', 3, 0, 0, 0, 0, 0, 0, 0, '0000-00-00 00:00:00', NULL, '2016-05-03 12:37:15', NULL, NULL, NULL, '2016-05-03 01:07:15', '2016-05-16 04:36:55'), +(5, 'AAAF-0005-0000005', 2, 1, NULL, 1, 1, 1, 1, 0, 0, 0, 0, NULL, 1, '2016-05-16 10:06:53', 3, 0, 0, 0, 0, 0, 0, 0, '0000-00-00 00:00:00', NULL, '2016-05-03 12:44:10', NULL, NULL, NULL, '2016-05-03 01:14:10', '2016-05-16 04:36:53'), +(6, 'AAAG-0006-0000006', 2, 1, NULL, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, '2016-05-16 10:06:48', 3, 0, 0, 1, 0, 0, 0, 0, '0000-00-00 00:00:00', NULL, '2016-05-03 12:49:19', NULL, NULL, NULL, '2016-05-03 01:19:19', '2016-05-16 04:36:48'), +(7, 'AAAH-0007-0000007', 2, 2, NULL, 1, 1, 2, 1, 0, 0, 0, 0, NULL, 1, '2016-05-16 10:06:50', 3, 0, 0, 0, 0, 0, 0, 0, '0000-00-00 00:00:00', NULL, '2016-05-03 12:55:15', NULL, NULL, NULL, '2016-05-03 01:25:15', '2016-05-16 04:36:50'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_attachment` +-- + +CREATE TABLE IF NOT EXISTS `ticket_attachment` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `thread_id` int(10) unsigned DEFAULT NULL, + `size` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `type` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `poster` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `file` mediumblob, + PRIMARY KEY (`id`), + KEY `thread_id` (`thread_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_collaborator` +-- + +CREATE TABLE IF NOT EXISTS `ticket_collaborator` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `isactive` tinyint(1) NOT NULL, + `ticket_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `role` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `ticket_id` (`ticket_id`), + KEY `user_id` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_form_data` +-- + +CREATE TABLE IF NOT EXISTS `ticket_form_data` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `ticket_id` int(10) unsigned DEFAULT NULL, + `title` text COLLATE utf8_unicode_ci NOT NULL, + `content` text COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `ticket_id` (`ticket_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_priority` +-- + +CREATE TABLE IF NOT EXISTS `ticket_priority` ( + `priority_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `priority` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `priority_desc` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `priority_color` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `priority_urgency` tinyint(1) NOT NULL, + `ispublic` tinyint(1) NOT NULL, + PRIMARY KEY (`priority_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; + +-- +-- Dumping data for table `ticket_priority` +-- + +INSERT INTO `ticket_priority` (`priority_id`, `priority`, `priority_desc`, `priority_color`, `priority_urgency`, `ispublic`) VALUES +(1, 'Low', 'Low', 'info', 4, 1), +(2, 'Normal', 'Normal', 'info', 3, 1), +(3, 'High', 'High', 'warning', 2, 1), +(4, 'Emergency', 'Emergency', 'danger', 1, 1); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_source` +-- + +CREATE TABLE IF NOT EXISTS `ticket_source` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ; + +-- +-- Dumping data for table `ticket_source` +-- + +INSERT INTO `ticket_source` (`id`, `name`, `value`) VALUES +(1, 'web', 'Web'), +(2, 'email', 'E-mail'), +(3, 'agent', 'Agent Panel'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_status` +-- + +CREATE TABLE IF NOT EXISTS `ticket_status` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `state` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mode` int(11) NOT NULL, + `message` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `flags` int(11) NOT NULL, + `sort` int(11) NOT NULL, + `properties` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ; + +-- +-- Dumping data for table `ticket_status` +-- + +INSERT INTO `ticket_status` (`id`, `name`, `state`, `mode`, `message`, `flags`, `sort`, `properties`, `created_at`, `updated_at`) VALUES +(1, 'Open', 'open', 3, 'Ticket have been Reopened by', 0, 1, 'Open tickets.', '2016-05-02 06:32:34', '2016-05-02 06:32:34'), +(2, 'Resolved', 'closed', 1, 'Ticket have been Resolved by', 0, 2, 'Resolved tickets.', '2016-05-02 06:32:34', '2016-05-02 06:32:34'), +(3, 'Closed', 'closed', 3, 'Ticket have been Closed by', 0, 3, 'Closed tickets. Tickets will still be accessible on client and staff panels.', '2016-05-02 06:32:34', '2016-05-02 06:32:34'), +(4, 'Archived', 'archived', 3, 'Ticket have been Archived by', 0, 4, 'Tickets only adminstratively available but no longer accessible on ticket queues and client panel.', '2016-05-02 06:32:34', '2016-05-02 06:32:34'), +(5, 'Deleted', 'deleted', 3, 'Ticket have been Deleted by', 0, 5, 'Tickets queued for deletion. Not accessible on ticket queues.', '2016-05-02 06:32:34', '2016-05-02 06:32:34'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_thread` +-- + +CREATE TABLE IF NOT EXISTS `ticket_thread` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `ticket_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `poster` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `source` int(10) unsigned DEFAULT NULL, + `reply_rating` int(11) NOT NULL, + `rating_count` int(11) NOT NULL, + `is_internal` tinyint(1) NOT NULL, + `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `body` text COLLATE utf8_unicode_ci NOT NULL, + `format` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `ip_address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `ticket_id_2` (`ticket_id`), + KEY `user_id` (`user_id`), + KEY `source` (`source`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=13 ; + +-- +-- Dumping data for table `ticket_thread` +-- + +INSERT INTO `ticket_thread` (`id`, `ticket_id`, `user_id`, `poster`, `source`, `reply_rating`, `rating_count`, `is_internal`, `title`, `body`, `format`, `ip_address`, `created_at`, `updated_at`) VALUES +(3, 3, 2, 'client', NULL, 0, 0, 0, 'Sewing defects ', 'Hi ABC Team,\n

\nWe have taken delivery of the consignment sent against B/No.123789 dated 3th May 2016.

\n\nOn opening the parcel, we have observed that 3 items of "Jake and jones T-shirt" are not there. We shall, therefore, appreciate your sending us the same through registered post. Alternatively please issue us the necessary credit note.

\n\nYours faithfully,\nFor Excel Packaging', '', '', '2016-05-03 01:03:59', '2016-05-03 01:03:59'), +(4, 4, 2, 'client', NULL, 0, 0, 0, 'Colour effects', 'Hi ABC Team,\n

\nWhen we placed our T-shirt order with your representative when he called on us last time, we were given an undertaking that we would be provided free delivery. After some time i get call charged with the cost of delivery.

\n\nThis is something new, strange and in total violation of business morality and so were constrained not to send our further orders. First we thought to keep silent over
\nthe matter but now we think that you should be informed about it. If you had been in our place, you too would have taken this matter as un-generous and unethical.

\n\n\n\nThank you', '', '', '2016-05-03 01:07:15', '2016-05-03 01:07:15'), +(5, 5, 2, 'client', NULL, 0, 0, 0, 'Sizing defects ', 'Hi ABC Team,\n

\n\nWhen we placed our trial order with your representative when he called on us last time, we were given an undertaking that we would be provided free delivery. But to our surprise and annoyance we were charged with the cost of delivery.

\n\nThis is something new, strange and in total violation of business morality and so were constrained not to send our further orders. First we thought to keep silent over\nthe matter but now we think that you should be informed about it. If you had been in our place, you too would have taken this matter as un-generous and unethical.

\n\nWe look forward to your views and comments at the earliest.\n

\nThank You\n', '', '', '2016-05-03 01:14:11', '2016-05-03 01:14:11'), +(6, 6, 2, 'client', NULL, 0, 0, 0, 'Garment defects', 'Hi ABC Team,\n

\nWe have recently received several complaints from customers about your T-shirt. The t-shirt are clearly not giving satisfaction and in some cases we have had to refund the purchase price.

\n\nThe T-shirt are part of the batch of 60 supplied against our order number 12345 dated 01 may. This order was placed on the basis of a sample Shirt left by your representative. We have ourselves compared the performance of this sample with that of a number of the pens from this batch, and there is little doubt that many of them are faulty - some of them leak and others blot when writing.

\n\nThe complaints we have received relate only to shirt from the batch mentioned. shirt supplied before these have always been satisfactory.\n\nWe therefore wish to return the unsold balance, amounting to 10 shirt. Please replace them with shirt of the quality which our earlier dealings with you have led us to expect.

\n\nPlease let us know what arrangements you wish us to make for the return of these unsuitable shirt.

\n\nYours faithfully', '', '', '2016-05-03 01:19:20', '2016-05-03 01:19:20'), +(7, 7, 2, 'client', NULL, 0, 0, 0, 'cash withdraw', 'Hi ABC Team,\n

\nI am writing to you to complain about the shipment of sweaters we received yesterday against the above order.\nThe boxes in which the sweaters were packed were damaged, and looked as if they had been broken open in transit.

\nFrom your invoice No.1234 we estimate that thirty garments have been stolen to the value of USD150. And because of\nthe rummaging in the boxes, quite a few other garments were crushed or stained and cannot be sold as new articles in our shops.\n

\nAs the sale was on a c.i.f. basis and the forwarding company your agents, we suggest you contact them with regard to compensation.\nYou will find a list of the damaged and missing articles attached, and the consignment will be put to one side until we receive your instructions.\n

\nThank You', '', '', '2016-05-03 01:25:15', '2016-05-03 01:25:15'), +(8, 3, 1, '', NULL, 0, 0, 1, '', 'This Ticket have been assigned to demo admin', '', '', '2016-05-16 02:49:22', '2016-05-16 02:49:22'), +(9, 3, 1, 'support', NULL, 0, 0, 0, '', 'Hi Client,

We will be looking into your issue. 

Thanks
Regards ABC team.', '', '', '2016-05-16 02:49:22', '2016-05-16 02:49:22'), +(10, 6, 1, '', NULL, 0, 0, 1, '', 'This Ticket have been assigned to demo admin', '', '', '2016-05-16 02:52:18', '2016-05-16 02:52:18'), +(11, 6, 1, 'support', NULL, 0, 0, 0, '', 'Hi Client,

We are looking into your issue.

Thanks,
Regards Team ABC.
', '', '', '2016-05-16 02:52:18', '2016-05-16 02:52:18'), +(12, 6, 1, 'support', NULL, 0, 0, 0, '', 'Hi Client,

We have Resend your orders

Thanks,
Regards Team ABC.
', '', '', '2016-05-16 03:00:29', '2016-05-16 03:00:29'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `timezone` +-- + +CREATE TABLE IF NOT EXISTS `timezone` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `location` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=114 ; + +-- +-- Dumping data for table `timezone` +-- + +INSERT INTO `timezone` (`id`, `name`, `location`) VALUES +(1, 'Pacific/Midway', '(GMT-11:00) Midway Island'), +(2, 'US/Samoa', '(GMT-11:00) Samoa'), +(3, 'US/Hawaii', '(GMT-10:00) Hawaii'), +(4, 'US/Alaska', '(GMT-09:00) Alaska'), +(5, 'US/Pacific', '(GMT-08:00) Pacific Time (US & Canada)'), +(6, 'America/Tijuana', '(GMT-08:00) Tijuana'), +(7, 'US/Arizona', '(GMT-07:00) Arizona'), +(8, 'US/Mountain', '(GMT-07:00) Mountain Time (US & Canada)'), +(9, 'America/Chihuahua', '(GMT-07:00) Chihuahua'), +(10, 'America/Mazatlan', '(GMT-07:00) Mazatlan'), +(11, 'America/Mexico_City', '(GMT-06:00) Mexico City'), +(12, 'America/Monterrey', '(GMT-06:00) Monterrey'), +(13, 'Canada/Saskatchewan', '(GMT-06:00) Saskatchewan'), +(14, 'US/Central', '(GMT-06:00) Central Time (US & Canada)'), +(15, 'US/Eastern', '(GMT-05:00) Eastern Time (US & Canada)'), +(16, 'US/East-Indiana', '(GMT-05:00) Indiana (East)'), +(17, 'America/Bogota', '(GMT-05:00) Bogota'), +(18, 'America/Lima', '(GMT-05:00) Lima'), +(19, 'America/Caracas', '(GMT-04:30) Caracas'), +(20, 'Canada/Atlantic', '(GMT-04:00) Atlantic Time (Canada)'), +(21, 'America/La_Paz', '(GMT-04:00) La Paz'), +(22, 'America/Santiago', '(GMT-04:00) Santiago'), +(23, 'Canada/Newfoundland', '(GMT-03:30) Newfoundland'), +(24, 'America/Buenos_Aires', '(GMT-03:00) Buenos Aires'), +(25, 'Greenland', '(GMT-03:00) Greenland'), +(26, 'Atlantic/Stanley', '(GMT-02:00) Stanley'), +(27, 'Atlantic/Azores', '(GMT-01:00) Azores'), +(28, 'Atlantic/Cape_Verde', '(GMT-01:00) Cape Verde Is.'), +(29, 'Africa/Casablanca', '(GMT) Casablanca'), +(30, 'Europe/Dublin', '(GMT) Dublin'), +(31, 'Europe/Lisbon', '(GMT) Lisbon'), +(32, 'Europe/London', '(GMT) London'), +(33, 'Africa/Monrovia', '(GMT) Monrovia'), +(34, 'Europe/Amsterdam', '(GMT+01:00) Amsterdam'), +(35, 'Europe/Belgrade', '(GMT+01:00) Belgrade'), +(36, 'Europe/Berlin', '(GMT+01:00) Berlin'), +(37, 'Europe/Bratislava', '(GMT+01:00) Bratislava'), +(38, 'Europe/Brussels', '(GMT+01:00) Brussels'), +(39, 'Europe/Budapest', '(GMT+01:00) Budapest'), +(40, 'Europe/Copenhagen', '(GMT+01:00) Copenhagen'), +(41, 'Europe/Ljubljana', '(GMT+01:00) Ljubljana'), +(42, 'Europe/Madrid', '(GMT+01:00) Madrid'), +(43, 'Europe/Paris', '(GMT+01:00) Paris'), +(44, 'Europe/Prague', '(GMT+01:00) Prague'), +(45, 'Europe/Rome', '(GMT+01:00) Rome'), +(46, 'Europe/Sarajevo', '(GMT+01:00) Sarajevo'), +(47, 'Europe/Skopje', '(GMT+01:00) Skopje'), +(48, 'Europe/Stockholm', '(GMT+01:00) Stockholm'), +(49, 'Europe/Vienna', '(GMT+01:00) Vienna'), +(50, 'Europe/Warsaw', '(GMT+01:00) Warsaw'), +(51, 'Europe/Zagreb', '(GMT+01:00) Zagreb'), +(52, 'Europe/Athens', '(GMT+02:00) Athens'), +(53, 'Europe/Bucharest', '(GMT+02:00) Bucharest'), +(54, 'Africa/Cairo', '(GMT+02:00) Cairo'), +(55, 'Africa/Harare', '(GMT+02:00) Harare'), +(56, 'Europe/Helsinki', '(GMT+02:00) Helsinki'), +(57, 'Europe/Istanbul', '(GMT+02:00) Istanbul'), +(58, 'Asia/Jerusalem', '(GMT+02:00) Jerusalem'), +(59, 'Europe/Kiev', '(GMT+02:00) Kyiv'), +(60, 'Europe/Minsk', '(GMT+02:00) Minsk'), +(61, 'Europe/Riga', '(GMT+02:00) Riga'), +(62, 'Europe/Sofia', '(GMT+02:00) Sofia'), +(63, 'Europe/Tallinn', '(GMT+02:00) Tallinn'), +(64, 'Europe/Vilnius', '(GMT+02:00) Vilnius'), +(65, 'Asia/Baghdad', '(GMT+03:00) Baghdad'), +(66, 'Asia/Kuwait', '(GMT+03:00) Kuwait'), +(67, 'Africa/Nairobi', '(GMT+03:00) Nairobi'), +(68, 'Asia/Riyadh', '(GMT+03:00) Riyadh'), +(69, 'Asia/Tehran', '(GMT+03:30) Tehran'), +(70, 'Europe/Moscow', '(GMT+04:00) Moscow'), +(71, 'Asia/Baku', '(GMT+04:00) Baku'), +(72, 'Europe/Volgograd', '(GMT+04:00) Volgograd'), +(73, 'Asia/Muscat', '(GMT+04:00) Muscat'), +(74, 'Asia/Tbilisi', '(GMT+04:00) Tbilisi'), +(75, 'Asia/Yerevan', '(GMT+04:00) Yerevan'), +(76, 'Asia/Kabul', '(GMT+04:30) Kabul'), +(77, 'Asia/Karachi', '(GMT+05:00) Karachi'), +(78, 'Asia/Tashkent', '(GMT+05:00) Tashkent'), +(79, 'Asia/Kolkata', '(GMT+05:30) Kolkata'), +(80, 'Asia/Kathmandu', '(GMT+05:45) Kathmandu'), +(81, 'Asia/Yekaterinburg', '(GMT+06:00) Ekaterinburg'), +(82, 'Asia/Almaty', '(GMT+06:00) Almaty'), +(83, 'Asia/Dhaka', '(GMT+06:00) Dhaka'), +(84, 'Asia/Novosibirsk', '(GMT+07:00) Novosibirsk'), +(85, 'Asia/Bangkok', '(GMT+07:00) Bangkok'), +(86, 'Asia/Ho_Chi_Minh', '(GMT+07.00) Ho Chi Minh'), +(87, 'Asia/Jakarta', '(GMT+07:00) Jakarta'), +(88, 'Asia/Krasnoyarsk', '(GMT+08:00) Krasnoyarsk'), +(89, 'Asia/Chongqing', '(GMT+08:00) Chongqing'), +(90, 'Asia/Hong_Kong', '(GMT+08:00) Hong Kong'), +(91, 'Asia/Kuala_Lumpur', '(GMT+08:00) Kuala Lumpur'), +(92, 'Australia/Perth', '(GMT+08:00) Perth'), +(93, 'Asia/Singapore', '(GMT+08:00) Singapore'), +(94, 'Asia/Taipei', '(GMT+08:00) Taipei'), +(95, 'Asia/Ulaanbaatar', '(GMT+08:00) Ulaan Bataar'), +(96, 'Asia/Urumqi', '(GMT+08:00) Urumqi'), +(97, 'Asia/Irkutsk', '(GMT+09:00) Irkutsk'), +(98, 'Asia/Seoul', '(GMT+09:00) Seoul'), +(99, 'Asia/Tokyo', '(GMT+09:00) Tokyo'), +(100, 'Australia/Adelaide', '(GMT+09:30) Adelaide'), +(101, 'Australia/Darwin', '(GMT+09:30) Darwin'), +(102, 'Asia/Yakutsk', '(GMT+10:00) Yakutsk'), +(103, 'Australia/Brisbane', '(GMT+10:00) Brisbane'), +(104, 'Australia/Canberra', '(GMT+10:00) Canberra'), +(105, 'Pacific/Guam', '(GMT+10:00) Guam'), +(106, 'Australia/Hobart', '(GMT+10:00) Hobart'), +(107, 'Australia/Melbourne', '(GMT+10:00) Melbourne'), +(108, 'Pacific/Port_Moresby', '(GMT+10:00) Port Moresby'), +(109, 'Australia/Sydney', '(GMT+10:00) Sydney'), +(110, 'Asia/Vladivostok', '(GMT+11:00) Vladivostok'), +(111, 'Asia/Magadan', '(GMT+12:00) Magadan'), +(112, 'Pacific/Auckland', '(GMT+12:00) Auckland'), +(113, 'Pacific/Fiji', '(GMT+12:00) Fiji'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `time_format` +-- + +CREATE TABLE IF NOT EXISTS `time_format` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `format` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; + +-- +-- Dumping data for table `time_format` +-- + +INSERT INTO `time_format` (`id`, `format`) VALUES +(1, 'H:i:s'), +(2, 'H.i.s'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +CREATE TABLE IF NOT EXISTS `users` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `first_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `last_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `gender` tinyint(1) NOT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `ban` tinyint(1) NOT NULL, + `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL, + `active` int(11) NOT NULL, + `ext` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `phone_number` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mobile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `agent_sign` text COLLATE utf8_unicode_ci NOT NULL, + `account_type` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `account_status` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `assign_group` int(10) unsigned DEFAULT NULL, + `primary_dpt` int(10) unsigned DEFAULT NULL, + `agent_tzone` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `daylight_save` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `limit_access` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `directory_listing` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `vacation_mode` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `company` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `role` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `internal_note` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `profile_pic` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `users_email_unique` (`email`), + KEY `assign_group_3` (`assign_group`), + KEY `primary_dpt_2` (`primary_dpt`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; + +-- +-- Dumping data for table `users` +-- + +INSERT INTO `users` (`id`, `user_name`, `first_name`, `last_name`, `gender`, `email`, `ban`, `password`, `active`, `ext`, `phone_number`, `mobile`, `agent_sign`, `account_type`, `account_status`, `assign_group`, `primary_dpt`, `agent_tzone`, `daylight_save`, `limit_access`, `directory_listing`, `vacation_mode`, `company`, `role`, `internal_note`, `profile_pic`, `remember_token`, `created_at`, `updated_at`) VALUES +(1, 'Admin', 'demo', 'admin', 0, 'demo@admin.com', 0, '$2y$10$YDp.gyUDTlZzcSyQ/APEB.Y.Y/2GJJ7ACkNhv9sCegvyhDCT7idEW', 1, '', '', '', '', '', '', 1, 1, '', '', '', '', '', '', 'admin', '', '', 'sKedQEtnNhcu73PmFv7HHJR2iAfHy6PuU1xEs7Lx2qctQjZ4xEs02tG9LkJ1', '2016-05-02 06:32:39', '2016-05-03 05:40:26'), +(2, 'Client', '', '', 0, 'demo@client.com', 0, '$2y$10$YDp.gyUDTlZzcSyQ/APEB.Y.Y/2GJJ7ACkNhv9sCegvyhDCT7idEW', 1, '', '9999999999', '', '', '', '', NULL, NULL, '', '', '', '', '', '', 'user', '', '', NULL, '2016-05-03 00:16:13', '2016-05-03 00:16:13'), +(3, 'Client', '', '', 0, 'demo@client2.com', 0, '$2y$10$YDp.gyUDTlZzcSyQ/APEB.Y.Y/2GJJ7ACkNhv9sCegvyhDCT7idEW', 1, '', '9999999999', '', '', '', '', NULL, NULL, '', '', '', '', '', '', 'user', '', '', NULL, '2016-05-03 01:14:10', '2016-05-03 01:14:10'), +(4, 'Client', '', '', 0, 'demo@client3.com', 0, '$2y$10$YDp.gyUDTlZzcSyQ/APEB.Y.Y/2GJJ7ACkNhv9sCegvyhDCT7idEW', 1, '', '9999999999', '', '', '', '', NULL, NULL, '', '', '', '', '', '', 'user', '', '', NULL, '2016-05-03 01:19:19', '2016-05-03 01:19:19'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_assign_organization` +-- + +CREATE TABLE IF NOT EXISTS `user_assign_organization` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `org_id` int(10) unsigned DEFAULT NULL, + `user_id` int(10) unsigned DEFAULT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `org_id` (`org_id`), + KEY `user_id` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; + +-- +-- Dumping data for table `user_assign_organization` +-- + +INSERT INTO `user_assign_organization` (`id`, `org_id`, `user_id`, `created_at`, `updated_at`) VALUES +(1, 1, 2, '2016-05-16 04:24:47', '2016-05-16 04:24:47'), +(2, 1, 3, '2016-05-16 04:25:13', '2016-05-16 04:25:13'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_notification` +-- + +CREATE TABLE IF NOT EXISTS `user_notification` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `notification_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + `is_read` int(11) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ; + +-- +-- Dumping data for table `user_notification` +-- + +INSERT INTO `user_notification` (`id`, `notification_id`, `user_id`, `is_read`, `created_at`, `updated_at`) VALUES +(1, 1, 1, 0, '2016-05-03 00:16:13', '2016-05-03 00:16:13'), +(2, 2, 1, 0, '2016-05-03 00:27:13', '2016-05-03 00:27:13'), +(3, 3, 1, 0, '2016-05-03 01:03:59', '2016-05-03 01:03:59'), +(4, 4, 1, 0, '2016-05-03 01:07:15', '2016-05-03 01:07:15'), +(5, 5, 1, 0, '2016-05-03 01:14:11', '2016-05-03 01:14:11'), +(6, 6, 1, 0, '2016-05-03 01:19:20', '2016-05-03 01:19:20'), +(7, 7, 1, 0, '2016-05-03 01:25:15', '2016-05-03 01:25:15'), +(8, 8, 1, 0, '2016-05-16 02:49:22', '2016-05-16 02:49:22'), +(9, 9, 1, 0, '2016-05-16 02:52:18', '2016-05-16 02:52:18'), +(10, 10, 1, 0, '2016-05-16 03:00:29', '2016-05-16 03:00:29'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `version_check` +-- + +CREATE TABLE IF NOT EXISTS `version_check` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `current_version` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `new_version` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `version_check` +-- + +INSERT INTO `version_check` (`id`, `current_version`, `new_version`, `created_at`, `updated_at`) VALUES +(1, '', '', '2016-05-02 06:32:37', '2016-05-02 06:32:37'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `widgets` +-- + +CREATE TABLE IF NOT EXISTS `widgets` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `title` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `value` text COLLATE utf8_unicode_ci, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=21 ; + +-- +-- Dumping data for table `widgets` +-- + +INSERT INTO `widgets` (`id`, `name`, `title`, `value`, `created_at`, `updated_at`) VALUES +(1, 'footer1', 'Products', '', '2016-05-02 06:32:37', '2016-05-04 01:38:33'), +(2, 'footer2', 'Company', '
', '2016-05-02 06:32:37', '2016-05-03 23:45:32'), +(3, 'footer3', 'Contact Us', '
BTM Layout, No: #28
9th Cross First Stage BTM Layout Near Water Tank
Bangalore – 560 029
Karnataka – India
Telephone: +91 8861529581
Email:    support@abcClothing.com

', '2016-05-02 06:32:37', '2016-05-04 01:40:32'), +(4, 'footer4', NULL, NULL, '2016-05-02 06:32:37', '2016-05-02 06:32:37'), +(5, 'side1', NULL, NULL, '2016-05-02 06:32:37', '2016-05-02 06:32:37'), +(6, 'side2', NULL, NULL, '2016-05-02 06:32:37', '2016-05-02 06:32:37'), +(7, 'linkedin', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:37', '2016-05-16 04:40:29'), +(8, 'stumble', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:37', '2016-05-16 04:40:39'), +(9, 'google', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:37', '2016-05-16 04:40:02'), +(10, 'deviantart', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:37', '2016-05-16 04:39:53'), +(11, 'flickr', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:07'), +(12, 'skype', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:20'), +(13, 'rss', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:25'), +(14, 'twitter', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:46'), +(15, 'facebook', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:11'), +(16, 'youtube', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:41:02'), +(17, 'vimeo', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:53'), +(18, 'pinterest', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:33'), +(19, 'dribbble', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:39:57'), +(20, 'instagram', NULL, 'http://www.faveohelpdesk.com', '2016-05-02 06:32:38', '2016-05-16 04:40:15'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `workflow_action` +-- + +CREATE TABLE IF NOT EXISTS `workflow_action` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `workflow_id` int(10) unsigned NOT NULL, + `condition` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `workflow_action_1` (`workflow_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `workflow_name` +-- + +CREATE TABLE IF NOT EXISTS `workflow_name` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `status` int(11) NOT NULL, + `order` int(11) NOT NULL, + `target` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `internal_note` text COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `workflow_rules` +-- + +CREATE TABLE IF NOT EXISTS `workflow_rules` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `workflow_id` int(10) unsigned NOT NULL, + `matching_criteria` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `matching_scenario` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `matching_relation` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `matching_value` text COLLATE utf8_unicode_ci NOT NULL, + `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `workflow_rules_1` (`workflow_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `canned_response` +-- +ALTER TABLE `canned_response` + ADD CONSTRAINT `canned_response_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- +-- Constraints for table `department` +-- +ALTER TABLE `department` + ADD CONSTRAINT `department_ibfk_2` FOREIGN KEY (`manager`) REFERENCES `users` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `department_ibfk_1` FOREIGN KEY (`sla`) REFERENCES `sla_plan` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `emails` +-- +ALTER TABLE `emails` + ADD CONSTRAINT `emails_ibfk_3` FOREIGN KEY (`help_topic`) REFERENCES `help_topic` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `emails_ibfk_1` FOREIGN KEY (`department`) REFERENCES `department` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `emails_ibfk_2` FOREIGN KEY (`priority`) REFERENCES `ticket_priority` (`priority_id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `group_assign_department` +-- +ALTER TABLE `group_assign_department` + ADD CONSTRAINT `group_assign_department_ibfk_2` FOREIGN KEY (`department_id`) REFERENCES `department` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `group_assign_department_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `help_topic` +-- +ALTER TABLE `help_topic` + ADD CONSTRAINT `help_topic_ibfk_6` FOREIGN KEY (`auto_assign`) REFERENCES `users` (`id`) ON DELETE SET NULL, + ADD CONSTRAINT `help_topic_ibfk_1` FOREIGN KEY (`custom_form`) REFERENCES `custom_forms` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `help_topic_ibfk_2` FOREIGN KEY (`department`) REFERENCES `department` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `help_topic_ibfk_3` FOREIGN KEY (`ticket_status`) REFERENCES `ticket_status` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `help_topic_ibfk_4` FOREIGN KEY (`priority`) REFERENCES `ticket_priority` (`priority_id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `help_topic_ibfk_5` FOREIGN KEY (`sla_plan`) REFERENCES `sla_plan` (`id`); + +-- +-- Constraints for table `kb_article_relationship` +-- +ALTER TABLE `kb_article_relationship` + ADD CONSTRAINT `article_relationship_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `kb_category` (`id`), + ADD CONSTRAINT `article_relationship_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `kb_article` (`id`); + +-- +-- Constraints for table `kb_comment` +-- +ALTER TABLE `kb_comment` + ADD CONSTRAINT `comment_article_id_foreign` FOREIGN KEY (`article_id`) REFERENCES `kb_article` (`id`); + +-- +-- Constraints for table `organization` +-- +ALTER TABLE `organization` + ADD CONSTRAINT `organization_ibfk_1` FOREIGN KEY (`head`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- +-- Constraints for table `settings_system` +-- +ALTER TABLE `settings_system` + ADD CONSTRAINT `settings_system_ibfk_4` FOREIGN KEY (`date_time_format`) REFERENCES `date_time_format` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `settings_system_ibfk_1` FOREIGN KEY (`time_zone`) REFERENCES `timezone` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `settings_system_ibfk_2` FOREIGN KEY (`time_farmat`) REFERENCES `time_format` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `settings_system_ibfk_3` FOREIGN KEY (`date_format`) REFERENCES `date_format` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `teams` +-- +ALTER TABLE `teams` + ADD CONSTRAINT `teams_ibfk_1` FOREIGN KEY (`team_lead`) REFERENCES `users` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `team_assign_agent` +-- +ALTER TABLE `team_assign_agent` + ADD CONSTRAINT `team_assign_agent_ibfk_2` FOREIGN KEY (`agent_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `team_assign_agent_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `tickets` +-- +ALTER TABLE `tickets` + ADD CONSTRAINT `tickets_ibfk_9` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_2` FOREIGN KEY (`dept_id`) REFERENCES `department` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_4` FOREIGN KEY (`priority_id`) REFERENCES `ticket_priority` (`priority_id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_5` FOREIGN KEY (`sla`) REFERENCES `sla_plan` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_6` FOREIGN KEY (`help_topic_id`) REFERENCES `help_topic` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_7` FOREIGN KEY (`status`) REFERENCES `ticket_status` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `tickets_ibfk_8` FOREIGN KEY (`source`) REFERENCES `ticket_source` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `ticket_attachment` +-- +ALTER TABLE `ticket_attachment` + ADD CONSTRAINT `ticket_attachment_ibfk_1` FOREIGN KEY (`thread_id`) REFERENCES `ticket_thread` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `ticket_collaborator` +-- +ALTER TABLE `ticket_collaborator` + ADD CONSTRAINT `ticket_collaborator_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `ticket_collaborator_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `ticket_form_data` +-- +ALTER TABLE `ticket_form_data` + ADD CONSTRAINT `ticket_form_data_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `ticket_thread` +-- +ALTER TABLE `ticket_thread` + ADD CONSTRAINT `ticket_thread_ibfk_3` FOREIGN KEY (`source`) REFERENCES `ticket_source` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `ticket_thread_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `ticket_thread_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `users` +-- +ALTER TABLE `users` + ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`primary_dpt`) REFERENCES `department` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`assign_group`) REFERENCES `groups` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `user_assign_organization` +-- +ALTER TABLE `user_assign_organization` + ADD CONSTRAINT `user_assign_organization_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION, + ADD CONSTRAINT `user_assign_organization_ibfk_1` FOREIGN KEY (`org_id`) REFERENCES `organization` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `workflow_action` +-- +ALTER TABLE `workflow_action` + ADD CONSTRAINT `workflow_action_1` FOREIGN KEY (`workflow_id`) REFERENCES `workflow_name` (`id`) ON UPDATE NO ACTION; + +-- +-- Constraints for table `workflow_rules` +-- +ALTER TABLE `workflow_rules` + ADD CONSTRAINT `workflow_rules_1` FOREIGN KEY (`workflow_id`) REFERENCES `workflow_name` (`id`) ON UPDATE NO ACTION; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/README.md b/README.md index 04c36ed2f..d5e75f509 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -

About Faveo

-
   StyleCI  
+

About Faveo

+
   StyleCI  

Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.

The word Faveo comes from Latin which means to be favourable. Which truly highlights vision and the scope as well as the functionality of the product that Faveo is. It is specifically designed to cater the needs of startups and SME’s empowering them with state of art, ticket based support system. In today’s competitive startup scenario customer retention is one of the major challenges. Handling client query diligently is all the difference between retaining or losing a long lasting relationship. The company is driven with passion of providing tools for managing consumer queries for strategic insights and helping companies take those decisive decisions. @@ -28,8 +28,6 @@ Faveo is designed & developed by Ladybird Web Host Offers hosting with minimum requirement to host Faveo web application. Faveo has been tested on Ladybird Web Host servers & works very well in their server environment. All web hosting packages offered by Ladybird Web Host come with 30 day money back gurantee.

diff --git a/app/Handlers/Commands/.gitkeep b/__construct() similarity index 100% rename from app/Handlers/Commands/.gitkeep rename to __construct() diff --git a/app/BaseModel.php b/app/BaseModel.php new file mode 100644 index 000000000..5321d9e92 --- /dev/null +++ b/app/BaseModel.php @@ -0,0 +1,33 @@ + + */ +class BaseModel extends Model +{ + public function setAttribute($property, $value) + { + require_once base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier.auto.php'); + $path = base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier'.DIRECTORY_SEPARATOR.'DefinitionCache'.DIRECTORY_SEPARATOR.'Serializer'); + if (!File::exists($path)) { + File::makeDirectory($path, $mode = 0777, true, true); + } + $config = \HTMLPurifier_Config::createDefault(); + //dd($config); + $purifier = new \HTMLPurifier($config); + if ($value != strip_tags($value)) { + $value = $purifier->purify($value); + } + parent::setAttribute($property, $value); + } +} diff --git a/app/Commands/Command.php b/app/Commands/Command.php deleted file mode 100644 index c9b0a33a6..000000000 --- a/app/Commands/Command.php +++ /dev/null @@ -1,8 +0,0 @@ -hourly(); $schedule->call(function () { - $user = new User(); $user->save(); - - })->everyFiveMinutes(); + })->everyFiveMinutes(); } } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index de7122f6f..0496485b6 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,13 +3,19 @@ namespace App\Exceptions; // controller -use App\Http\Controllers\Common\PhpMailController; use Exception; -use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +//use Illuminate\Validation\ValidationException; +use Illuminate\Foundation\Validation\ValidationException; +use Illuminate\Auth\Access\AuthorizationException; +use Illuminate\Database\Eloquent\ModelNotFoundException; +// use Symfony\Component\HttpKernel\Exception\HttpException; +// use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Bugsnag\BugsnagLaravel\BugsnagExceptionHandler as ExceptionHandler; +use Bugsnag; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -class Handler extends ExceptionHandler -{ - public $phpmailer; +class Handler extends ExceptionHandler { /** * A list of the exception types that should not be reported. @@ -17,9 +23,27 @@ class Handler extends ExceptionHandler * @var array */ protected $dontReport = [ - 'Symfony\Component\HttpKernel\Exception\HttpException', +// 'Symfony\Component\HttpKernel\Exception\HttpException', +// 'Illuminate\Http\Exception\HttpResponseException', + ValidationException::class, + AuthorizationException::class, + HttpResponseException ::class, + ModelNotFoundException::class, + \Symfony\Component\HttpKernel\Exception\HttpException::class, ]; + /** + * Create a new controller instance. + * constructor to check + * 1. php mailer. + * + * @return void + */ + // public function __construct(PhpMailController $PhpMailController) + // { + // $this->PhpMailController = $PhpMailController; + // } + /** * Report or log an exception. * @@ -29,8 +53,14 @@ class Handler extends ExceptionHandler * * @return void */ - public function report(Exception $e) - { + public function report(Exception $e) { + $debug = \Config::get('app.bugsnag_reporting'); + $debug = ($debug) ? 'true' : 'false'; + if ($debug == 'false') { + Bugsnag::setBeforeNotifyFunction(function ($error) { + return false; + }); + } return parent::report($e); } @@ -42,51 +72,42 @@ class Handler extends ExceptionHandler * * @return \Illuminate\Http\Response */ - public function render($request, Exception $e) - { - //dd($e); - $phpmail = new PhpMailController(); - $this->PhpMailController = $phpmail; - if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { - return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); - } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { - return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); - } - // This is to check if the debug is true or false - if (config('app.debug') == false) { - // checking if the error is actually an error page or if its an system error page - if ($this->isHttpException($e) && $e->getStatusCode() == 404) { - return response()->view('errors.404', []); - } else { - // checking if the application is installed - if (\Config::get('database.install') == 1) { - // checking if the error log send to Ladybirdweb is enabled or not - if (\Config::get('app.ErrorLog') == '1') { - try { - $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['system_error' => "
 Message:".$e->getMessage().'
Code:'.$e->getCode().'
File:'.$e->getFile().'
Line:'.$e->getLine().'
']); - } catch (Exception $exx) { - } - } - } - - return response()->view('errors.500', []); - } - } - // returns non oops error message - return parent::render($request, $e); - // checking if the error is related to http error i.e. page not found - if ($this->isHttpException($e)) { - // returns error for page not found - return $this->renderHttpException($e); - } - // checking if the config app sebug is enabled or not - if (config('app.debug')) { - // returns oops error page i.e. colour full error page - return $this->renderExceptionWithWhoops($e); - } - - return parent::render($request, $e); - } +// public function render($request, Exception $e) { +// if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { +// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); +// } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { +// return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); +// } + // This is to check if the debug is true or false +// if (config('app.debug') == false) { +// // checking if the error is actually an error page or if its an system error page +// if ($this->isHttpException($e) && $e->getStatusCode() == 404) { +// return response()->view('errors.404', []); +// } else { +// // checking if the application is installed +// if (\Config::get('database.install') == 1) { +// // checking if the error log send to Ladybirdweb is enabled or not +// if (\Config::get('app.ErrorLog') == '1') { +// +// } +// } +// return response()->view('errors.500', []); +// } +// } + // returns non oops error message +// return parent::render($request, $e); + // checking if the error is related to http error i.e. page not found +// if ($this->isHttpException($e)) { +// // returns error for page not found +// return $this->renderHttpException($e); +// } +// // checking if the config app sebug is enabled or not +// if (config('app.debug')) { +// // returns oops error page i.e. colour full error page +// return $this->renderExceptionWithWhoops($e); +// } + //return parent::render($request, $e); +// } /** * function to generate oops error page. @@ -95,14 +116,78 @@ class Handler extends ExceptionHandler * * @return \Illuminate\Http\Response */ - protected function renderExceptionWithWhoops(Exception $e) - { - // new instance of whoops class to display customized error page - $whoops = new \Whoops\Run(); - $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); +// protected function renderExceptionWithWhoops(Exception $e) { +// // new instance of whoops class to display customized error page +// $whoops = new \Whoops\Run(); +// $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); +// +// return new \Illuminate\Http\Response( +// $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders() +// ); +// } - return new \Illuminate\Http\Response( - $whoops->handleException($e), $e->getStatusCode(), $e->getHeaders() - ); + /** + * Render an exception into an HTTP response. + * @param type $request + * @param Exception $e + * @return type mixed + */ + public function render($request, Exception $e) { + + switch ($e) { + case $e instanceof \Illuminate\Http\Exception\HttpResponseException : + return parent::render($request, $e); + case $e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException : + return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); + case $e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException : + return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); + default : + return $this->common($request, $e); + } } + + /** + * Function to render 500 error page + * @param type $request + * @param type $e + * @return type mixed + */ + public function render500($request, $e) { + if (config('app.debug') == true) { + return parent::render($request, $e); + } + return redirect()->route('error500', []); + } + + /** + * Function to render 404 error page + * @param type $request + * @param type $e + * @return type mixed + */ + public function render404($request, $e) { + if (config('app.debug') == true) { + return parent::render($request, $e); + } + return redirect()->route('error404', []); + } + + /** + * Common finction to render both types of codes + * @param type $request + * @param type $e + * @return type mixed + */ + public function common($request, $e) { + switch ($e) { + case $e instanceof HttpException : + return $this->render404($request, $e); + case $e instanceof NotFoundHttpException : + return $this->render404($request, $e); + default : + return $this->render500($request, $e); + } + return parent::render($request, $e); + } + } diff --git a/app/Http/Controllers/Admin/helpdesk/AgentController.php b/app/Http/Controllers/Admin/helpdesk/AgentController.php index 202e83ecd..71de27ccd 100644 --- a/app/Http/Controllers/Admin/helpdesk/AgentController.php +++ b/app/Http/Controllers/Admin/helpdesk/AgentController.php @@ -13,12 +13,15 @@ use App\Model\helpdesk\Agent\Assign_team_agent; use App\Model\helpdesk\Agent\Department; use App\Model\helpdesk\Agent\Groups; use App\Model\helpdesk\Agent\Teams; +use App\Model\helpdesk\Utility\CountryCode; use App\Model\helpdesk\Utility\Timezones; use App\User; // classes use DB; use Exception; +use GeoIP; use Hash; +use Lang; /** * AgentController @@ -72,7 +75,7 @@ class AgentController extends Controller * * @return type view */ - public function create(Timezones $timezone, Groups $group, Department $department, Teams $team_all) + public function create(Timezones $timezone, Groups $group, Department $department, Teams $team_all, CountryCode $code) { try { // gte all the teams @@ -84,9 +87,11 @@ class AgentController extends Controller // get all department $departments = $department->get(); // list all the teams in a single variable - $teams = $team->lists('id', 'name'); + $teams = $team->lists('id', 'name')->toArray(); + $location = GeoIP::getLocation(''); + $phonecode = $code->where('iso', '=', $location['isoCode'])->first(); // returns to the page with all the variables and their datas - return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team')); + return view('themes.default1.admin.helpdesk.agent.agents.create', compact('assign', 'teams', 'agents', 'timezones', 'groups', 'departments', 'team'))->with('phonecode', $phonecode->phonecode); } catch (Exception $e) { // returns if try fails with exception meaagse return redirect()->back()->with('fails', $e->getMessage()); @@ -104,13 +109,24 @@ class AgentController extends Controller */ public function store(User $user, AgentRequest $request) { + if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) { + return redirect()->back()->with(['fails2' => Lang::get('lang.country-code-required-error'), 'country_code' => 1])->withInput(); + } else { + $code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get(); + if (!count($code)) { + return redirect()->back()->with(['fails2' => Lang::get('lang.incorrect-country-code-error'), 'country_code' => 1])->withInput(); + } + } // fixing the user role to agent - $user->fill($request->input())->save(); + $user->fill($request->except(['group', 'primary_department', 'agent_time_zone']))->save(); + $user->assign_group = $request->group; + $user->primary_dpt = $request->primary_department; + $user->agent_tzone = $request->agent_time_zone; // generate password and has immediately to store $password = $this->generateRandomString(); $user->password = Hash::make($password); // fetching all the team details checked for this user - $requests = $request->input('team_id'); + $requests = $request->input('team'); // get user id of the inserted user detail $id = $user->id; // insert team @@ -128,13 +144,13 @@ class AgentController extends Controller $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $email], $message = ['subject' => 'Password', 'scenario' => 'registration-notification'], $template_variables = ['user' => $name, 'email_address' => $email, 'user_password' => $password]); } catch (Exception $e) { // returns if try fails - return redirect('agents')->with('fails', 'Some error occurred while sending mail to the agent. Please check email settings and try again'); + return redirect('agents')->with('warning', Lang::get('lang.agent_send_mail_error_on_agent_creation')); } // returns for the success case - return redirect('agents')->with('success', 'Agent Created sucessfully'); + return redirect('agents')->with('success', Lang::get('lang.agent_creation_success')); } else { // returns if fails - return redirect('agents')->with('fails', 'Agent can not Create'); + return redirect('agents')->with('fails', Lang::get('lang.failed_to_create_agent')); } } @@ -151,9 +167,11 @@ class AgentController extends Controller * * @return type Response */ - public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team) + public function edit($id, User $user, Assign_team_agent $team_assign_agent, Timezones $timezone, Groups $group, Department $department, Teams $team, CountryCode $code) { try { + $location = GeoIP::getLocation(''); + $phonecode = $code->where('iso', '=', $location['isoCode'])->first(); $user = $user->whereId($id)->first(); $team = $team->get(); $teams1 = $team->lists('name', 'id'); @@ -161,12 +179,12 @@ class AgentController extends Controller $groups = $group->get(); $departments = $department->get(); $table = $team_assign_agent->where('agent_id', $id)->first(); - $teams = $team->lists('id', 'name'); - $assign = $team_assign_agent->where('agent_id', $id)->lists('team_id'); + $teams = $team->lists('id', 'name')->toArray(); + $assign = $team_assign_agent->where('agent_id', $id)->lists('team_id')->toArray(); - return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted')); + return view('themes.default1.admin.helpdesk.agent.agents.edit', compact('teams', 'assign', 'table', 'teams1', 'selectedTeams', 'user', 'timezones', 'groups', 'departments', 'team', 'exp', 'counted'))->with('phonecode', $phonecode->phonecode); } catch (Exception $e) { - return redirect('agents')->with('fail', 'No such file'); + return redirect('agents')->with('fail', Lang::get('lang.failed_to_edit_agent')); } } @@ -182,7 +200,14 @@ class AgentController extends Controller */ public function update($id, User $user, AgentUpdate $request, Assign_team_agent $team_assign_agent) { - + if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) { + return redirect()->back()->with(['fails2' => Lang::get('lang.country-code-required-error'), 'country_code' => 1])->withInput(); + } else { + $code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get(); + if (!count($code)) { + return redirect()->back()->with(['fails2' => Lang::get('lang.incorrect-country-code-error'), 'country_code' => 1])->withInput(); + } + } // storing all the details $user = $user->whereId($id)->first(); $daylight_save = $request->input('daylight_save'); @@ -192,18 +217,25 @@ class AgentController extends Controller //============================================== $table = $team_assign_agent->where('agent_id', $id); $table->delete(); - $requests = $request->input('team_id'); + $requests = $request->input('team'); // inserting team details foreach ($requests as $req) { DB::insert('insert into team_assign_agent (team_id, agent_id) values (?,?)', [$req, $id]); } //Todo For success and failure conditions try { + if ($request->input('country_code') != '' or $request->input('country_code') != null) { + $user->country_code = $request->input('country_code'); + } $user->fill($request->except('daylight_save', 'limit_access', 'directory_listing', 'vocation_mode', 'assign_team'))->save(); + $user->assign_group = $request->group; + $user->primary_dpt = $request->primary_department; + $user->agent_tzone = $request->agent_time_zone; + $user->save(); - return redirect('agents')->with('success', 'Agent Updated sucessfully'); + return redirect('agents')->with('success', Lang::get('lang.agent_updated_sucessfully')); } catch (Exception $e) { - return redirect('agents')->with('fails', 'Agent did not update'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('agents')->with('fails', Lang::get('lang.unable_to_update_agent').'
  • '.$e->errorInfo[2].'
  • '); } } @@ -226,12 +258,12 @@ class AgentController extends Controller $team_assign_agent->delete(); $user = $user->whereId($id)->first(); try { - $error = 'This staff is related to some tickets'; + $error = Lang::get('lang.this_staff_is_related_to_some_tickets'); $user->id; $user->delete(); throw new \Exception($error); - return redirect('agents')->with('success', 'Agent Deleted sucessfully'); + return redirect('agents')->with('success', Lang::get('lang.agent_deleted_sucessfully')); } catch (\Exception $e) { return redirect('agents')->with('fails', $error); } diff --git a/app/Http/Controllers/Admin/helpdesk/BanlistController.php b/app/Http/Controllers/Admin/helpdesk/BanlistController.php index e55849dfc..890a89775 100644 --- a/app/Http/Controllers/Admin/helpdesk/BanlistController.php +++ b/app/Http/Controllers/Admin/helpdesk/BanlistController.php @@ -12,6 +12,7 @@ use App\Model\helpdesk\Email\Banlist; use App\User; //classes use Exception; +use Lang; /** * BanlistController @@ -50,7 +51,7 @@ class BanlistController extends Controller return view('themes.default1.admin.helpdesk.emails.banlist.index', compact('bans')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -64,7 +65,7 @@ class BanlistController extends Controller try { return view('themes.default1.admin.helpdesk.emails.banlist.create'); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -88,7 +89,7 @@ class BanlistController extends Controller $use->internal_note = $request->input('internal_note'); $use->save(); // $user->create($request->input())->save(); - return redirect('banlist')->with('success', 'Email Banned sucessfully'); + return redirect('banlist')->with('success', Lang::get('lang.email_banned_sucessfully')); } else { $user = new User(); $user->email = $adban; @@ -96,10 +97,10 @@ class BanlistController extends Controller $user->internal_note = $request->input('internal_note'); $user->save(); - return redirect('banlist')->with('success', 'Email Banned sucessfully'); + return redirect('banlist')->with('success', Lang::get('lang.email_banned_sucessfully')); } } catch (Exception $e) { - return redirect('banlist')->with('fails', 'Email can not Ban'); + return redirect('banlist')->with('fails', Lang::get('lang.email_can_not_ban')); } } @@ -118,7 +119,7 @@ class BanlistController extends Controller return view('themes.default1.admin.helpdesk.emails.banlist.edit', compact('bans')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -138,12 +139,33 @@ class BanlistController extends Controller $bans->internal_note = $request->input('internal_note'); $bans->ban = $request->input('ban'); if ($bans->save()) { - return redirect('banlist')->with('success', 'Banned Email Updated sucessfully'); + return redirect('banlist')->with('success', Lang::get('lang.banned_email_updated_sucessfully')); } else { - return redirect('banlist')->with('fails', 'Banned Email not Updated'); + return redirect('banlist')->with('fails', Lang::get('lang.banned_email_not_updated')); } } catch (Exception $e) { - return redirect('banlist')->with('fails', 'Banned Email not Updated'); + return redirect('banlist')->with('fails', Lang::get('lang.banned_email_not_updated')); + } + } + + /** + * delete the banned users. + * + * @param type $id + * @param \App\User $ban + * + * @return type view + */ + public function delete($id, User $ban) + { + try { + $ban_user = $ban->where('id', '=', $id)->first(); + $ban_user->ban = 0; + $ban_user->save(); + + return redirect('banlist')->with('success', Lang::get('lang.banned_removed_sucessfully')); + } catch (Exception $ex) { + return redirect('banlist')->with('fails', $ex->getMessage()); } } } diff --git a/app/Http/Controllers/Admin/helpdesk/CloseWrokflowController.php b/app/Http/Controllers/Admin/helpdesk/CloseWrokflowController.php new file mode 100644 index 000000000..6ce31f246 --- /dev/null +++ b/app/Http/Controllers/Admin/helpdesk/CloseWrokflowController.php @@ -0,0 +1,67 @@ +security = $security; + } + + /** + * get the workflow settings page. + * + * @param \App\Model\helpdesk\Workflow\WorkflowClose $securitys + * + * @return type view + */ + public function index(WorkflowClose $securitys) + { + try { + $security = $securitys->whereId('1')->first(); + + return view('themes.default1.admin.helpdesk.settings.close-workflow.index', compact('security')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } + + /** + * updating the workflow settings for closing ticket. + * + * @param type $id + * @param \App\Http\Requests\helpdesk\WorkflowCloseRequest $request + * + * @return type redirect + */ + public function update($id, WorkflowCloseRequest $request) + { + try { + $security = new WorkflowClose(); + $securitys = $security->whereId($id)->first(); + $securitys->days = $request->input('days'); + $securitys->condition = $request->input('condition'); + $securitys->send_email = $request->input('send_email'); + $securitys->status = $request->input('status'); + $securitys->save(); + + return \Redirect::back()->with('success', Lang::get('lang.successfully_saved_your_settings')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } +} diff --git a/app/Http/Controllers/Admin/helpdesk/DepartmentController.php b/app/Http/Controllers/Admin/helpdesk/DepartmentController.php index 749eb942f..95dadf0a4 100644 --- a/app/Http/Controllers/Admin/helpdesk/DepartmentController.php +++ b/app/Http/Controllers/Admin/helpdesk/DepartmentController.php @@ -22,6 +22,7 @@ use App\User; // classes use DB; use Exception; +use Lang; /** * DepartmentController. @@ -76,7 +77,7 @@ class DepartmentController extends Controller { try { $slas = $sla->get(); - $user = $user->where('role', 'agent')->get(); + $user = $user->where('role', 'agent2')->get(); $emails = $email->get(); $templates = $template->get(); $department = $department->get(); @@ -84,7 +85,7 @@ class DepartmentController extends Controller return view('themes.default1.admin.helpdesk.agent.departments.create', compact('department', 'templates', 'slas', 'user', 'emails', 'groups')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -99,7 +100,12 @@ class DepartmentController extends Controller public function store(Department $department, DepartmentRequest $request) { try { - $department->fill($request->except('group_id', 'manager'))->save(); + $department->fill($request->except('group_id', 'manager', 'sla'))->save(); + if ($request->sla) { + $department->sla = $request->input('sla'); + } else { + $department->sla = null; + } $requests = $request->input('group_id'); $id = $department->id; if ($request->manager) { @@ -107,18 +113,15 @@ class DepartmentController extends Controller } else { $department->manager = null; } - // foreach ($requests as $req) { - // DB::insert('insert into group_assign_department(group_id, department_id) values (?,?)', [$req, $id]); - // } /* Succes And Failure condition */ /* Check Whether the function Success or Fail */ if ($department->save() == true) { - return redirect('departments')->with('success', 'Department Created sucessfully'); + return redirect('departments')->with('success', Lang::get('lang.department_created_sucessfully')); } else { - return redirect('departments')->with('fails', 'Department can not Create'); + return redirect('departments')->with('fails', Lang::get('lang.failed_to_create_department')); } } catch (Exception $e) { - return redirect('departments')->with('fails', 'Department can not Create'); + return redirect('departments')->with('fails', Lang::get('lang.failed_to_create_department')); } } @@ -140,17 +143,21 @@ class DepartmentController extends Controller public function edit($id, User $user, Group_assign_department $group_assign_department, Template $template, Teams $team, Department $department, Sla_plan $sla, Emails $email, Groups $group) { try { + $sys_department = \DB::table('settings_system') + ->select('department') + ->where('id', '=', 1) + ->first(); $slas = $sla->get(); - $user = $user->where('role', 'agent')->get(); + $user = $user->where('primary_dpt', $id)->get(); $emails = $email->get(); $templates = $template->get(); $departments = $department->whereId($id)->first(); $groups = $group->lists('id', 'name'); $assign = $group_assign_department->where('department_id', $id)->lists('group_id'); - return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'groups')); + return view('themes.default1.admin.helpdesk.agent.departments.edit', compact('assign', 'team', 'templates', 'departments', 'slas', 'user', 'emails', 'groups', 'sys_department')); } catch (Exception $e) { - return view('404'); + return redirect('departments')->with('fails', $e->getMessage()); } } @@ -168,6 +175,7 @@ class DepartmentController extends Controller { // dd($id); try { + $table = $group_assign_department->where('department_id', $id); $table->delete(); $requests = $request->input('group_id'); @@ -182,14 +190,25 @@ class DepartmentController extends Controller $departments->manager = null; } $departments->save(); - - if ($departments->fill($request->except('group_access', 'manager'))->save()) { - return redirect('departments')->with('success', 'Department Updated sucessfully'); + if ($request->sla) { + $departments->sla = $request->input('sla'); + $departments->save(); } else { - return redirect('departments')->with('fails', 'Department not Updated'); + $departments->sla = null; + $departments->save(); + } + if ($request->input('sys_department') == 'on') { + DB::table('settings_system') + ->where('id', 1) + ->update(['department' => $id]); + } + if ($departments->fill($request->except('group_access', 'manager', 'sla'))->save()) { + return redirect('departments')->with('success', Lang::get('lang.department_updated_sucessfully')); + } else { + return redirect('departments')->with('fails', Lang::get('lang.department_not_updated')); } } catch (Exception $e) { - return redirect('departments')->with('fails', 'Department not Updated'); + return redirect('departments')->with('fails', Lang::get('lang.department_not_updated')); } } @@ -207,7 +226,7 @@ class DepartmentController extends Controller // try { $system = $system->where('id', '=', '1')->first(); if ($system->department == $id) { - return redirect('departments')->with('fails', 'You cannot delete default department'); + return redirect('departments')->with('fails', Lang::get('lang.you_cannot_delete_default_department')); } else { $tickets = DB::table('tickets')->where('dept_id', '=', $id)->update(['dept_id' => $system->department]); if ($tickets > 0) { @@ -216,7 +235,7 @@ class DepartmentController extends Controller } else { $text_tickets = 'Ticket'; } - $ticket = '
  • '.$tickets.' '.$text_tickets.' have been moved to default department
  • '; + $ticket = '
  • '.$tickets.' '.$text_tickets.Lang::get('lang.have_been_moved_to_default_department').'
  • '; } else { $ticket = ''; } @@ -227,7 +246,7 @@ class DepartmentController extends Controller } else { $text_user = 'User'; } - $user = '
  • '.$users.' '.$text_user.' have been moved to default department
  • '; + $user = '
  • '.$users.' '.$text_user.Lang::get('lang.have_been_moved_to_default_department').'
  • '; } else { $user = ''; } @@ -238,13 +257,13 @@ class DepartmentController extends Controller } else { $text_emails = 'Email'; } - $email = '
  • '.$emails.' System '.$text_emails.' have been moved to default department
  • '; + $email = '
  • '.$emails.' System '.$text_emails.Lang::get('lang.have_been_moved_to_default_department').'
  • '; } else { $email = ''; } $helptopic = DB::table('help_topic')->where('department', '=', $id)->update(['department' => null], ['status' => '1']); if ($helptopic > 0) { - $helptopic = '
  • The associated helptopic has been deactivated
  • '; + $helptopic = '
  • '.Lang::get('lang.the_associated_helptopic_has_been_deactivated').'
  • '; } else { $helptopic = ''; } @@ -255,9 +274,9 @@ class DepartmentController extends Controller $departments = $department->whereId($id)->first(); /* Check the function is Success or Fail */ if ($departments->delete() == true) { - return redirect('departments')->with('success', 'Department Deleted sucessfully'.$message); + return redirect('departments')->with('success', Lang::get('lang.department_deleted_sucessfully').$message); } else { - return redirect('departments')->with('fails', 'Department can not Delete'); + return redirect('departments')->with('fails', Lang::get('lang.department_can_not_delete')); } } } diff --git a/app/Http/Controllers/Admin/helpdesk/EmailsController.php b/app/Http/Controllers/Admin/helpdesk/EmailsController.php index 19a2202ad..e4b767aef 100644 --- a/app/Http/Controllers/Admin/helpdesk/EmailsController.php +++ b/app/Http/Controllers/Admin/helpdesk/EmailsController.php @@ -18,6 +18,7 @@ use Crypt; // classes use Exception; use Illuminate\Http\Request; +use Lang; /** * ====================================== @@ -27,15 +28,14 @@ use Illuminate\Http\Request; * * @author Ladybird */ -class EmailsController extends Controller -{ +class EmailsController extends Controller { + /** * Defining constructor variables. * * @return type */ - public function __construct() - { + public function __construct() { $this->middleware('auth'); $this->middleware('roles'); } @@ -47,8 +47,7 @@ class EmailsController extends Controller * * @return type view */ - public function index(Emails $email) - { + public function index(Emails $email) { try { // fetch all the emails from emails table $emails = $email->get(); @@ -69,8 +68,7 @@ class EmailsController extends Controller * * @return type Response */ - public function create(Department $department, Help_topic $help, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) - { + public function create(Department $department, Help_topic $help, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) { try { // fetch all the departments from the department table $departments = $department->get(); @@ -95,18 +93,16 @@ class EmailsController extends Controller * * @return int */ - public function validatingEmailSettings(Request $request) - { + public function validatingEmailSettings(Request $request) { $validator = \Validator::make( - [ - 'email_address' => $request->email_address, - 'email_name' => $request->email_name, - 'password' => $request->password, - ], - [ + [ + 'email_address' => $request->input('email_address'), + 'email_name' => $request->input('email_name'), + 'password' => $request->input('password'), + ], [ 'email_address' => 'required|email|unique:emails', - 'email_name' => 'required', - 'password' => 'required', + 'email_name' => 'required', + 'password' => 'required', ] ); if ($validator->fails()) { @@ -119,32 +115,31 @@ class EmailsController extends Controller return $return_data; } - if ($request->validate == 'on') { + if ($request->input('imap_validate') == 'on') { $validate = '/validate-cert'; - } else { + } elseif (!$request->input('imap_validate')) { $validate = '/novalidate-cert'; } - if ($request->fetching_status == 'on') { + if ($request->input('fetching_status') == 'on') { $imap_check = $this->getImapStream($request, $validate); if ($imap_check[0] == 0) { - return 'Incoming email connection failed'; + return Lang::get('lang.incoming_email_connection_failed_please_check_email_credentials_or_imap_settings'); } $need_to_check_imap = 1; } else { $imap_check = 0; $need_to_check_imap = 0; } - if ($request->sending_status == 'on') { + if ($request->input('sending_status') == 'on') { $smtp_check = $this->getSmtp($request); if ($smtp_check == 0) { - return 'Outgoing email connection failed'; + return Lang::get('lang.outgoing_email_connection_failed'); } $need_to_check_smtp = 1; } else { $smtp_check = 0; $need_to_check_smtp = 0; } - if ($need_to_check_imap == 1 && $need_to_check_smtp == 1) { if ($imap_check != 0 && $smtp_check != 0) { $this->store($request, $imap_check[1]); @@ -178,55 +173,69 @@ class EmailsController extends Controller * * @return type Redirect */ - public function store($request, $imap_check) - { - // dd($request); + public function store($request, $imap_check) { $email = new Emails(); try { - // getConnection($request->input('email_name'), $request->input('email_address'), $request->input('email_address')) // saving all the fields to the database - if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'fetching_encryption', 'sending_status', 'auto_response'))->save() == true) { - if ($request->fetching_status == 'on') { - $email->fetching_status = 1; - } else { - $email->fetching_status = 0; - } - if ($request->sending_status == 'on') { - $email->sending_status = 1; - } else { - $email->sending_status = 0; - } - if ($request->auto_response == 'on') { - $email->auto_response = 1; - } else { - $email->auto_response = 0; - } - if ($imap_check !== null) { - $email->fetching_encryption = $imap_check; - } else { - $email->fetching_encryption = $request->fetching_encryption; - } - // fetching department value - $email->department = $this->departmentValue($request->input('department')); - // fetching priority value - $email->priority = $this->priorityValue($request->input('priority')); - // fetching helptopic value - $email->help_topic = $this->helpTopicValue($request->input('help_topic')); - // inserting the encrypted value of password - $email->password = Crypt::encrypt($request->input('password')); - $email->save(); // run save - // Creating a default system email as the first email is inserted to the system - $email_settings = Email::where('id', '=', '1')->first(); - $email_settings->sys_email = $email->id; - $email_settings->save(); - // returns success message for successful email creation -// return redirect('emails')->with('success', 'Email Created sucessfully'); - return 1; - } else { - // returns fail message for unsuccessful save execution -// return redirect('emails')->with('fails', 'Email can not Create'); - return 0; +// if ($email->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'fetching_encryption', 'sending_status', 'auto_response'))->save() == true) { + $email->email_address = $request->email_address; + $email->email_name = $request->email_name; + $email->fetching_host = $request->fetching_host; + $email->fetching_port = $request->fetching_port; + $email->fetching_protocol = $request->fetching_protocol; + $email->sending_host = $request->sending_host; + $email->sending_port = $request->sending_port; + $email->sending_protocol = $request->sending_protocol; + $email->sending_encryption = $request->sending_encryption; + + if ($request->smtp_validate == 'on') { + $email->smtp_validate = $request->smtp_validate; } + + if ($request->input('password')) { + $email->password = Crypt::encrypt($request->input('password')); + } + if ($request->input('fetching_status') == 'on') { + $email->fetching_status = 1; + } else { + $email->fetching_status = 0; + } + if ($request->input('sending_status') == 'on') { + $email->sending_status = 1; + } else { + $email->sending_status = 0; + } + if ($request->input('auto_response') == 'on') { + $email->auto_response = 1; + } else { + $email->auto_response = 0; + } + if ($imap_check !== null) { + $email->fetching_encryption = $imap_check; + } else { + $email->fetching_encryption = $request->input('fetching_encryption'); + } + // fetching department value + $email->department = $this->departmentValue($request->input('department')); + // fetching priority value + $email->priority = $this->priorityValue($request->input('priority')); + // fetching helptopic value + $email->help_topic = $this->helpTopicValue($request->input('help_topic')); + // inserting the encrypted value of password + $email->password = Crypt::encrypt($request->input('password')); + $email->save(); // run save + // Creating a default system email as the first email is inserted to the system + $email_settings = Email::where('id', '=', '1')->first(); + $email_settings->sys_email = $email->id; + $email_settings->save(); + // returns success message for successful email creation +// return redirect('emails')->with('success', 'Email Created sucessfully'); + return 1; +// } else { + // returns fail message for unsuccessful save execution +// return redirect('emails')->with('fails', 'Email can not Create'); +// return 0; +// } } catch (Exception $e) { // returns if try fails // return redirect()->back()->with('fails', $e->getMessage()); @@ -246,13 +255,16 @@ class EmailsController extends Controller * * @return type Response */ - public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) - { + public function edit($id, Department $department, Help_topic $help, Emails $email, Ticket_Priority $ticket_priority, MailboxProtocol $mailbox_protocol) { try { + $sys_email = \DB::table('settings_email')->select('sys_email')->where('id', '=', 1)->first(); + // dd($sys_email); // fetch the selected emails $emails = $email->whereId($id)->first(); // get all the departments $departments = $department->get(); + //get count of emails + $count = $email->count(); // get all the helptopic $helps = $help->get(); // get all the priority @@ -260,7 +272,7 @@ class EmailsController extends Controller // get all the mailbox protocols $mailbox_protocols = $mailbox_protocol->get(); // return if the execution is succeeded - return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails')); + return view('themes.default1.admin.helpdesk.emails.emails.edit', compact('mailbox_protocols', 'priority', 'departments', 'helps', 'emails', 'sys_email'))->with('count', $count); } catch (Exception $e) { // return if try fails return redirect()->back()->with('fails', $e->getMessage()); @@ -274,18 +286,16 @@ class EmailsController extends Controller * * @return int */ - public function validatingEmailSettingsUpdate($id, Request $request) - { + public function validatingEmailSettingsUpdate($id, Request $request) { $validator = \Validator::make( - [ - 'email_address' => $request->email_address, - 'email_name' => $request->email_name, - 'password' => $request->password, - ], - [ + [ + 'email_address' => $request->input('email_address'), + 'email_name' => $request->input('email_name'), + 'password' => $request->input('password'), + ], [ 'email_address' => 'email', - 'email_name' => 'required', - 'password' => 'required', + 'email_name' => 'required', + 'password' => 'required', ] ); if ($validator->fails()) { @@ -299,32 +309,31 @@ class EmailsController extends Controller return $return_data; } // return $request; - if ($request->validate == 'on') { + if ($request->input('imap_validate') == 'on') { $validate = '/validate-cert'; - } else { + } elseif (!$request->input('imap_validate')) { $validate = '/novalidate-cert'; } - if ($request->fetching_status == 'on') { + if ($request->input('fetching_status') == 'on') { $imap_check = $this->getImapStream($request, $validate); if ($imap_check[0] == 0) { - return 'Incoming email connection failed'; + return Lang::get('lang.incoming_email_connection_failed_please_check_email_credentials_or_imap_settings'); } $need_to_check_imap = 1; } else { $imap_check = 0; $need_to_check_imap = 0; } - if ($request->sending_status == 'on') { + if ($request->input('sending_status') == 'on') { $smtp_check = $this->getSmtp($request); if ($smtp_check == 0) { - return 'Outgoing email connection failed'; + return Lang::get('lang.outgoing_email_connection_failed'); } $need_to_check_smtp = 1; } else { $smtp_check = 0; $need_to_check_smtp = 0; } - if ($need_to_check_imap == 1 && $need_to_check_smtp == 1) { if ($imap_check != 0 && $smtp_check != 0) { $this->update($id, $request, $imap_check[1]); @@ -359,36 +368,45 @@ class EmailsController extends Controller * * @return type Response */ - public function update($id, $request, $imap_check) - { - // try { - // dd($id); - // dd($request); - // dd($imap_check); + public function update($id, $request, $imap_check) { + try { // fetch the selected emails $emails = Emails::whereId($id)->first(); // insert all the requested parameters with except - $emails->fill($request->except('password', 'department', 'priority', 'help_topic', 'fetching_status', 'fetching_encryption', 'sending_status', 'auto_response'))->save(); - if ($request->fetching_status == 'on') { - $emails->fetching_status = 1; - } else { - $emails->fetching_status = 0; - } - if ($request->sending_status == 'on') { - $emails->sending_status = 1; - } else { - $emails->sending_status = 0; - } - if ($request->auto_response == 'on') { - $emails->auto_response = 1; - } else { - $emails->auto_response = 0; - } - if ($imap_check !== null) { - $emails->fetching_encryption = $imap_check; - } else { - $emails->fetching_encryption = $request->fetching_encryption; - } + $emails->email_address = $request->email_address; + $emails->email_name = $request->email_name; + $emails->fetching_host = $request->fetching_host; + $emails->fetching_port = $request->fetching_port; + $emails->fetching_protocol = $request->fetching_protocol; + $emails->sending_host = $request->sending_host; + $emails->sending_port = $request->sending_port; + $emails->sending_protocol = $request->sending_protocol; + $emails->sending_encryption = $request->sending_encryption; + if ($request->smtp_validate == 'on') { + $emails->smtp_validate = $request->smtp_validate; + } + + if ($request->input('fetching_status') == 'on') { + $emails->fetching_status = 1; + } else { + $emails->fetching_status = 0; + } + if ($request->input('sending_status') == 'on') { + $emails->sending_status = 1; + } else { + $emails->sending_status = 0; + } + if ($request->input('auto_response') == 'on') { + $emails->auto_response = 1; + } else { + $emails->auto_response = 0; + } + if ($imap_check !== null) { + $emails->fetching_encryption = $imap_check; + } else { + $emails->fetching_encryption = $request->fetching_encryption; + } + $emails->password = Crypt::encrypt($request->input('password')); // dd($email->fetching_encryption); // fetching department value $emails->department = $this->departmentValue($request->input('department')); @@ -397,14 +415,25 @@ class EmailsController extends Controller // fetching helptopic value $emails->help_topic = $this->helpTopicValue($request->input('help_topic')); // inserting the encrypted value of password - $emails->password = Crypt::encrypt($request->input('password')); - $emails->save(); +// $emails->password = Crypt::encrypt($request->input('password')); + $emails->save(); + //dd($request->sys_email); + if($request->sys_email == 'on') { + $system = \DB::table('settings_email') + ->where('id', '=', 1) + ->update(['sys_email' => $id]); + } elseif ($request->input('count') <= 1 && $request->sys_email == null) { + $system = \DB::table('settings_email') + ->where('id', '=', 1) + ->update(['sys_email' => null]); + } // returns success message for successful email update $return = 1; - // } catch (Exception $e) { - // // returns if try fails - // $return = $e->getMessage(); - // } + } catch (Exception $e) { + // // returns if try fails + $return = $e->getMessage(); + } + return $return; } @@ -416,14 +445,13 @@ class EmailsController extends Controller * * @return type Redirect */ - public function destroy($id, Emails $email) - { + public function destroy($id, Emails $email) { // fetching the details on the basis of the $id passed to the function $default_system_email = Email::where('id', '=', '1')->first(); if ($default_system_email->sys_email) { // checking if the default system email is the passed email if ($id == $default_system_email->sys_email) { - return redirect('emails')->with('fails', 'You cannot delete system default Email'); + return redirect('emails')->with('fails', Lang::get('lang.you_cannot_delete_system_default_email')); } } try { @@ -431,9 +459,9 @@ class EmailsController extends Controller $emails = $email->whereId($id)->first(); // checking if deleting the email is success or if it's carrying any dependencies if ($emails->delete() == true) { - return redirect('emails')->with('success', 'Email Deleted sucessfully'); + return redirect('emails')->with('success', Lang::get('lang.email_deleted_sucessfully')); } else { - return redirect('emails')->with('fails', 'Email can not Delete '); + return redirect('emails')->with('fails', Lang::get('lang.email_can_not_delete')); } } catch (Exception $e) { // returns if the try fails @@ -448,28 +476,26 @@ class EmailsController extends Controller * * @return type int */ - public function getImapStream($request, $validate) - { + public function getImapStream($request, $validate) { $fetching_status = $request->input('fetching_status'); $username = $request->input('email_address'); $password = $request->input('password'); $protocol_id = $request->input('mailbox_protocol'); - $fetching_protocol = '/'.$request->input('fetching_protocol'); - $fetching_encryption = '/'.$request->input('fetching_encryption'); + $fetching_protocol = '/' . $request->input('fetching_protocol'); + $fetching_encryption = '/' . $request->input('fetching_encryption'); if ($fetching_encryption == '/none') { $fetching_encryption2 = '/novalidate-cert'; $mailbox_protocol = $fetching_encryption2; $host = $request->input('fetching_host'); $port = $request->input('fetching_port'); - $mailbox = '{'.$host.':'.$port.$mailbox_protocol.'}INBOX'; + $mailbox = '{' . $host . ':' . $port . $mailbox_protocol . '}INBOX'; } else { - $mailbox_protocol = $fetching_protocol.$fetching_encryption; + $mailbox_protocol = $fetching_protocol . $fetching_encryption; $host = $request->input('fetching_host'); $port = $request->input('fetching_port'); - $mailbox = '{'.$host.':'.$port.$mailbox_protocol.$validate.'}INBOX'; - $mailbox_protocol = $fetching_encryption.$validate; + $mailbox = '{' . $host . ':' . $port . $mailbox_protocol . $validate . '}INBOX'; + $mailbox_protocol = $fetching_encryption . $validate; } - try { $imap_stream = imap_open($mailbox, $username, $password); } catch (\Exception $ex) { @@ -492,8 +518,7 @@ class EmailsController extends Controller * * @return type int */ - public function checkImapStream($imap_stream) - { + public function checkImapStream($imap_stream) { $check_imap_stream = imap_check($imap_stream); if ($check_imap_stream) { $imap_stream = 1; @@ -511,22 +536,43 @@ class EmailsController extends Controller * * @return int */ - public function getSmtp($request) - { + public function getSmtp($request) { $sending_status = $request->input('sending_status'); - $mail = new \PHPMailer(); - $mail->isSMTP(); - $mail->Host = $request->input('sending_host'); - $mail->SMTPAuth = true; // Enable SMTP authentication - $mail->Username = $request->input('email_address'); - $mail->Password = $request->input('password'); - $mail->SMTPSecure = $request->input('sending_encryption'); - $mail->Port = $request->input('sending_port'); - if ($mail->smtpConnect() == true) { - $mail->smtpClose(); + // cheking for the sending protocol + if ($request->input('sending_protocol') == 'smtp') { + $mail = new \PHPMailer(); + $mail->isSMTP(); + $mail->Host = $request->input('sending_host'); // Specify main and backup SMTP servers + //$mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = $request->input('email_address'); // SMTP username + $mail->Password = $request->input('password'); // SMTP password + $mail->SMTPSecure = $request->input('sending_encryption'); // Enable TLS encryption, `ssl` also accepted + $mail->Port = $request->input('sending_port'); // TCP port to connect to + if (!$request->input('smtp_validate')) { + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->SMTPOptions = [ + 'ssl' => [ + 'verify_peer' => false, + 'verify_peer_name' => false, + 'allow_self_signed' => true, + ], + ]; + if ($mail->smtpConnect($mail->SMTPOptions) == true) { + $mail->smtpClose(); + $return = 1; + } else { + $return = 0; + } + } else { + if ($mail->smtpConnect()) { + $mail->smtpClose(); + $return = 1; + } else { + $return = 0; + } + } + } elseif ($request->input('sending_protocol') == 'mail') { $return = 1; - } else { - $return = 0; } return $return; @@ -539,8 +585,7 @@ class EmailsController extends Controller * * @return type string or null */ - public function departmentValue($dept) - { + public function departmentValue($dept) { if ($dept) { $email_department = $dept; } else { @@ -557,8 +602,7 @@ class EmailsController extends Controller * * @return type string or null */ - public function priorityValue($priority) - { + public function priorityValue($priority) { if ($priority) { $email_priority = $priority; } else { @@ -575,8 +619,7 @@ class EmailsController extends Controller * * @return type string or null */ - public function helpTopicValue($help_topic) - { + public function helpTopicValue($help_topic) { if ($help_topic) { $email_help_topic = $help_topic; } else { @@ -585,4 +628,5 @@ class EmailsController extends Controller return $email_help_topic; } + } diff --git a/app/Http/Controllers/Admin/helpdesk/ErrorAndDebuggingController.php b/app/Http/Controllers/Admin/helpdesk/ErrorAndDebuggingController.php new file mode 100644 index 000000000..d826cf07c --- /dev/null +++ b/app/Http/Controllers/Admin/helpdesk/ErrorAndDebuggingController.php @@ -0,0 +1,102 @@ + + */ +class ErrorAndDebuggingController extends Controller +{ + /** + * Create a new controller instance. + * + * @return void + */ + public function __construct() + { + // $this->smtp(); + $this->middleware('auth'); + $this->middleware('roles'); + } + + /** + * function to show error and debugging setting page + * @param void + * @return response + */ + public function showSettings() + { + $debug = \Config::get('app.debug'); + $bugsnag = \Config::get('app.bugsnag_reporting'); + return view('themes.default1.admin.helpdesk.settings.error-and-logs.error-debug')->with(['debug'=> $debug, 'bugsnag' => $bugsnag]); + } + + /** + * funtion to update error and debugging settings + * @param void + * @return + */ + public function postSettings() + { + try{ + $debug = \Config::get('app.debug'); + $debug = ($debug) ? 'true' : 'false'; + $bugsnag_debug = \Config::get('app.bugsnag_reporting'); + $bugsnag_debug = ($bugsnag_debug) ? 'true' : 'false'; + if ($debug != \Input::get('debug') || $bugsnag_debug != \Input::get('bugsnag')) { + // dd($request->input()); + $debug_new = base_path() + .DIRECTORY_SEPARATOR. + 'config' + .DIRECTORY_SEPARATOR. + 'app.php'; + $datacontent = File::get($debug_new); + $datacontent = str_replace("'debug' => ".$debug, + "'debug' => ".\Input::get('debug'), + $datacontent); + File::put($debug_new, $datacontent); + + // dd($request->input()); + $bugsnag_debug_new = base_path() + .DIRECTORY_SEPARATOR. + 'config' + .DIRECTORY_SEPARATOR. + 'app.php'; + $datacontent2 = File::get($bugsnag_debug_new); + $datacontent2 = str_replace("'bugsnag_reporting' => ".$bugsnag_debug, + "'bugsnag_reporting' => ".\Input::get('bugsnag'), + $datacontent2); + File::put($bugsnag_debug_new, $datacontent2); + return redirect()->back()->with('success', + Lang::get('lang.error-debug-settings-saved-message')); + } else { + return redirect()->back()->with('fails', + Lang::get('lang.error-debug-settings-error-message')); + } + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * function to show error log table page + * @param void + * @return response view + */ + public function showErrorLogs() + { + return view('themes.default1.admin.helpdesk.settings.error-and-logs.log-table'); + } +} diff --git a/app/Http/Controllers/Admin/helpdesk/FormController.php b/app/Http/Controllers/Admin/helpdesk/FormController.php index 786c87546..0353d528b 100644 --- a/app/Http/Controllers/Admin/helpdesk/FormController.php +++ b/app/Http/Controllers/Admin/helpdesk/FormController.php @@ -12,6 +12,7 @@ use App\Model\helpdesk\Manage\Help_topic; use Illuminate\Http\Request; // Class use Input; +use Lang; use Redirect; /** @@ -29,7 +30,7 @@ class FormController extends Controller { $this->fields = $fields; $this->forms = $forms; - // $this->middleware('auth'); + $this->middleware('auth'); } /** @@ -51,21 +52,29 @@ class FormController extends Controller */ public function index(Forms $forms) { - return view('themes.default1.admin.helpdesk.manage.form.index', compact('forms')); + try { + return view('themes.default1.admin.helpdesk.manage.form.index', compact('forms')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } } /** - * Show the form for creating a new resource. + * create a new form. * * @return Response */ public function create() { - return view('themes.default1.admin.helpdesk.manage.form.form'); + try { + return view('themes.default1.admin.helpdesk.manage.form.form'); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $e->getMessage()); + } } /** - * Display the specified resource. + * Show a new form. * * @param int $id * @@ -73,18 +82,22 @@ class FormController extends Controller */ public function show($id) { - return view('themes.default1.admin.helpdesk.manage.form.preview', compact('id')); + try { + return view('themes.default1.admin.helpdesk.manage.form.preview', compact('id')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $e->getMessage()); + } } /** - * Store a newly created resource in storage. + * Store a new form. * * @return Response */ public function store(Forms $forms) { if (!Input::get('formname')) { - return Redirect::back()->with('fails', 'Please fill Form name'); + return Redirect::back()->with('fails', Lang::get('lang.please_fill_form_name')); } $required = Input::get('required'); $count = count($required); @@ -112,9 +125,19 @@ class FormController extends Controller } Fields::insert($fields); - return Redirect::back()->with('success', 'Successfully created Form'); + return Redirect::back()->with('success', Lang::get('lang.successfully_created_form')); } + /** + * Delete Form. + * + * @param type $id + * @param \App\Model\helpdesk\Form\Forms $forms + * @param type $field + * @param type $help_topic + * + * @return type redirect + */ public function delete($id, Forms $forms, Fields $field, Help_topic $help_topic) { $fields = $field->where('forms_id', $id)->get(); @@ -129,6 +152,6 @@ class FormController extends Controller $forms = $forms->where('id', $id)->first(); $forms->delete(); - return redirect()->back()->with('success', 'Deleted Successfully'); + return redirect()->back()->with('success', Lang::get('lang.form_deleted_successfully')); } } diff --git a/app/Http/Controllers/Admin/helpdesk/GroupController.php b/app/Http/Controllers/Admin/helpdesk/GroupController.php index a89bc1cfb..6786eb813 100644 --- a/app/Http/Controllers/Admin/helpdesk/GroupController.php +++ b/app/Http/Controllers/Admin/helpdesk/GroupController.php @@ -6,6 +6,7 @@ namespace App\Http\Controllers\Admin\helpdesk; use App\Http\Controllers\Controller; // requests use App\Http\Requests\helpdesk\GroupRequest; +use App\Http\Requests\helpdesk\GroupUpdateRequest; use App\Model\helpdesk\Agent\Department; // models use App\Model\helpdesk\Agent\Group_assign_department; @@ -15,6 +16,7 @@ use Exception; // classes use Illuminate\Http\Request; use Illuminate\Support\Facades\Input; +use Lang; /** * GroupController. @@ -51,7 +53,7 @@ class GroupController extends Controller return view('themes.default1.admin.helpdesk.agent.groups.index', compact('departments', 'group_assign_department', 'groups')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', Lang::get('lang.failed_to_load_the_page')); } } @@ -65,7 +67,7 @@ class GroupController extends Controller try { return view('themes.default1.admin.helpdesk.agent.groups.create'); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', Lang::get('lang.failed_to_load_the_page')); } } @@ -83,10 +85,10 @@ class GroupController extends Controller /* Check Whether function success or not */ $group->fill($request->input())->save(); - return redirect('groups')->with('success', 'Group Created Successfully'); + return redirect('groups')->with('success', Lang::get('lang.group_created_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('groups')->with('fails', 'Groups can not Create'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('groups')->with('fails', Lang::get('lang.group_can_not_create').'
  • '.$e->getMessage().'
  • '); } } @@ -105,7 +107,7 @@ class GroupController extends Controller return view('themes.default1.admin.helpdesk.agent.groups.edit', compact('groups')); } catch (Exception $e) { - return redirect('groups')->with('fails', 'Groups can not Create'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('groups')->with('fails', Lang::get('lang.group_can_not_update').'
  • '.$e->getMessage().'
  • '); } } @@ -118,56 +120,59 @@ class GroupController extends Controller * * @return type Response */ - public function update($id, Groups $group, Request $request) + public function update($id, Groups $group, GroupUpdateRequest $request) { + // Database instannce to the current id $var = $group->whereId($id)->first(); + // Updating Name + $var->name = $request->input('name'); //Updating Status - $status = $request->Input('group_status'); + $status = $request->input('group_status'); $var->group_status = $status; //Updating can_create_ticket field - $createTicket = $request->Input('can_create_ticket'); + $createTicket = $request->input('can_create_ticket'); $var->can_create_ticket = $createTicket; //Updating can_edit_ticket field - $editTicket = $request->Input('can_edit_ticket'); + $editTicket = $request->input('can_edit_ticket'); $var->can_edit_ticket = $editTicket; //Updating can_post_ticket field - $postTicket = $request->Input('can_post_ticket'); + $postTicket = $request->input('can_post_ticket'); $var->can_post_ticket = $postTicket; //Updating can_close_ticket field - $closeTicket = $request->Input('can_close_ticket'); + $closeTicket = $request->input('can_close_ticket'); $var->can_close_ticket = $closeTicket; //Updating can_assign_ticket field - $assignTicket = $request->Input('can_assign_ticket'); + $assignTicket = $request->input('can_assign_ticket'); $var->can_assign_ticket = $assignTicket; //Updating can_delete_ticket field - $deleteTicket = $request->Input('can_delete_ticket'); + $deleteTicket = $request->input('can_delete_ticket'); $var->can_delete_ticket = $deleteTicket; //Updating can_ban_email field - $banEmail = $request->Input('can_ban_email'); + $banEmail = $request->input('can_ban_email'); $var->can_ban_email = $banEmail; //Updating can_manage_canned field - $manageCanned = $request->Input('can_manage_canned'); + $manageCanned = $request->input('can_manage_canned'); $var->can_manage_canned = $manageCanned; //Updating can_manage_faq field - $manageFaq = $request->Input('can_manage_faq'); + $manageFaq = $request->input('can_manage_faq'); $var->can_manage_faq = $manageFaq; //Updating can_view_agent_stats field - $viewAgentStats = $request->Input('can_view_agent_stats'); + $viewAgentStats = $request->input('can_view_agent_stats'); $var->can_view_agent_stats = $viewAgentStats; //Updating department_access field - $departmentAccess = $request->Input('department_access'); + $departmentAccess = $request->input('department_access'); $var->department_access = $departmentAccess; //Updating admin_notes field - $adminNotes = $request->Input('admin_notes'); + $adminNotes = $request->input('admin_notes'); $var->admin_notes = $adminNotes; /* Check whether function success or not */ try { $var->save(); /* redirect to Index page with Success Message */ - return redirect('groups')->with('success', 'Group Updated Successfully'); + return redirect('groups')->with('success', Lang::get('lang.group_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('groups')->with('fails', 'Groups can not Create'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('groups')->with('fails', Lang::get('lang.group_can_not_update').'
  • '.$e->getMessage().'
  • '); } } @@ -184,9 +189,9 @@ class GroupController extends Controller { $users = User::where('assign_group', '=', $id)->first(); if ($users) { - $user = '
  • There are agents assigned to this group. Please unassign them from this group to delete
  • '; + $user = '
  • '.Lang::get('lang.there_are_agents_assigned_to_this_group_please_unassign_them_from_this_group_to_delete').'
  • '; - return redirect('groups')->with('fails', 'Group cannot Delete '.$user); + return redirect('groups')->with('fails', Lang('lang.group_cannot_delete').$user); } $group_assign_department->where('group_id', $id)->delete(); $groups = $group->whereId($id)->first(); @@ -194,10 +199,10 @@ class GroupController extends Controller try { $groups->delete(); /* redirect to Index page with Success Message */ - return redirect('groups')->with('success', 'Group Deleted Successfully'); + return redirect('groups')->with('success', Lang::get('lang.group_deleted_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('groups')->with('fails', 'Groups cannot Create'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('groups')->with('fails', Lang::get('lang.group_cannot_delete').'
  • '.$e->getMessage().'
  • '); } } } diff --git a/app/Http/Controllers/Admin/helpdesk/HelptopicController.php b/app/Http/Controllers/Admin/helpdesk/HelptopicController.php index 31f3d825d..f96afb703 100644 --- a/app/Http/Controllers/Admin/helpdesk/HelptopicController.php +++ b/app/Http/Controllers/Admin/helpdesk/HelptopicController.php @@ -19,6 +19,7 @@ use App\User; // classes use DB; use Exception; +use Lang; /** * HelptopicController. @@ -52,7 +53,7 @@ class HelptopicController extends Controller return view('themes.default1.admin.helpdesk.manage.helptopic.index', compact('topics')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -90,7 +91,7 @@ class HelptopicController extends Controller return view('themes.default1.admin.helpdesk.manage.helptopic.create', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -119,10 +120,10 @@ class HelptopicController extends Controller $topic->fill($request->except('custom_form', 'auto_assign'))->save(); // $topics->fill($request->except('custom_form','auto_assign'))->save(); /* redirect to Index page with Success Message */ - return redirect('helptopic')->with('success', 'Helptopic Created Successfully'); + return redirect('helptopic')->with('success', Lang::get('lang.helptopic_created_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('helptopic')->with('fails', 'Helptopic can not Create'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('helptopic')->with('fails', Lang::get('lang.helptopic_can_not_create').'
  • '.$e->getMessage().'
  • '); } } @@ -148,10 +149,13 @@ class HelptopicController extends Controller $forms = $form->get(); $slas = $sla->get(); $priority = $priority->get(); - - return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas')); + $sys_help_topic = \DB::table('settings_ticket') + ->select('help_topic') + ->where('id', '=', 1)->first(); + + return view('themes.default1.admin.helpdesk.manage.helptopic.edit', compact('priority', 'departments', 'topics', 'forms', 'agents', 'slas', 'sys_help_topic')); } catch (Exception $e) { - return redirect('helptopic')->with('fails', '
  • '.$e->errorInfo[2].'
  • '); + return redirect('helptopic')->with('fails', '
  • '.$e->getMessage().'
  • '); } } @@ -166,7 +170,6 @@ class HelptopicController extends Controller */ public function update($id, Help_topic $topic, HelptopicUpdate $request) { - // dd($request); try { $topics = $topic->whereId($id)->first(); if ($request->custom_form) { @@ -184,11 +187,16 @@ class HelptopicController extends Controller $topics->custom_form = $custom_form; $topics->auto_assign = $auto_assign; $topics->save(); + if ($request->input('sys_help_tpoic') == 'on') { + \DB::table('settings_ticket') + ->where('id', '=', 1) + ->update(['help_topic' => $id]); + } /* redirect to Index page with Success Message */ - return redirect('helptopic')->with('success', 'Helptopic Updated Successfully'); + return redirect('helptopic')->with('success', Lang::get('lang.helptopic_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('helptopic')->with('fails', 'Helptopic can not Update'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('helptopic')->with('fails', Lang::get('lang.helptopic_can_not_update').'
  • '.$e->getMessage().'
  • '); } } @@ -204,45 +212,40 @@ class HelptopicController extends Controller { $ticket_settings = $ticket_setting->where('id', '=', '1')->first(); if ($ticket_settings->help_topic == $id) { - return redirect('departments')->with('fails', 'You cannot delete default department'); + return redirect('departments')->with('fails', Lang::get('lang.you_cannot_delete_default_department')); } else { $tickets = DB::table('tickets')->where('help_topic_id', '=', $id)->update(['help_topic_id' => $ticket_settings->help_topic]); - if ($tickets > 0) { if ($tickets > 1) { $text_tickets = 'Tickets'; } else { $text_tickets = 'Ticket'; } - $ticket = '
  • '.$tickets.' '.$text_tickets.' have been moved to default Help Topic
  • '; + $ticket = '
  • '.$tickets.' '.$text_tickets.Lang::get('lang.have_been_moved_to_default_help_topic').'
  • '; } else { $ticket = ''; } - $emails = DB::table('emails')->where('help_topic', '=', $id)->update(['help_topic' => $ticket_settings->help_topic]); - if ($emails > 0) { if ($emails > 1) { $text_emails = 'Emails'; } else { $text_emails = 'Email'; } - $email = '
  • '.$emails.' System '.$text_emails.' have been moved to default Help Topic
  • '; + $email = '
  • '.$emails.' System '.$text_emails.Lang::get('lang.have_been_moved_to_default_help_topic').'
  • '; } else { $email = ''; } - $message = $ticket.$email; - $topics = $topic->whereId($id)->first(); /* Check whether function success or not */ try { $topics->delete(); /* redirect to Index page with Success Message */ - return redirect('helptopic')->with('success', 'Helptopic Deleted Successfully'.$message); + return redirect('helptopic')->with('success', Lang::get('lang.helptopic_deleted_successfully').$message); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('helptopic')->with('fails', 'Helptopic can not Delete'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('helptopic')->with('fails', Lang::get('lang.helptopic_can_not_update').'
  • '.$e->getMessage().'
  • '); } } } diff --git a/app/Http/Controllers/Admin/helpdesk/SecurityController.php b/app/Http/Controllers/Admin/helpdesk/SecurityController.php new file mode 100644 index 000000000..f8fb3e1b7 --- /dev/null +++ b/app/Http/Controllers/Admin/helpdesk/SecurityController.php @@ -0,0 +1,121 @@ + + */ +class SecurityController extends Controller +{ + private $security; + + public function __construct(Security $security) + { + $this->security = $security; + } + + /** + * list of securitys. + * + * @param type Security $securitys + * + * @return Response + */ + public function index(Security $securitys) + { + try { + $security = $securitys->whereId('1')->first(); + + return view('themes.default1.admin.helpdesk.settings.security.index', compact('security')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } + + /** + * Create security setting. + * + * @return Response + */ + public function create() + { + return view('themes.default1.admin.helpdesk.setting.security.security'); + } + + /** + * Show security. + * + * @param int $id + * + * @return Response + */ + public function show($id) + { + return view('themes.default1.admin.helpdesk.setting.security.preview', compact('id')); + } + + /** + * Update security details. + * + * @return Response + */ + public function update($id, SecurityRequest $request) + { + try { + $security = new Security(); + $securitys = $security->whereId($id)->first(); + $securitys->lockout_message = $request->input('lockout_message'); + $securitys->backlist_offender = $request->input('backlist_offender'); + $securitys->backlist_threshold = $request->input('backlist_threshold'); + $securitys->lockout_period = $request->input('lockout_period'); + $securitys->days_to_keep_logs = $request->input('days_to_keep_logs'); + $securitys->save(); + + return Redirect::back()->with('success', Lang::get('lang.security_settings_saved_successfully')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } + + /** + * Delete security details. + * + * @param type $id + * @param \App\Model\helpdesk\Settings\Security $securitys + * @param type $field + * @param \App\Http\Controllers\Admin\helpdesk\Help_topic $help_topic + * + * @return type redirect + */ + public function delete($id, Security $securitys, Fields $field, Help_topic $help_topic) + { + $fields = $field->where('securitys_id', $id)->get(); + $help_topics = $help_topic->where('custom_security', '=', $id)->get(); + foreach ($help_topics as $help_topic) { + $help_topic->custom_security = null; + $help_topic->save(); + } + foreach ($fields as $field) { + $field->delete(); + } + $securitys = $securitys->where('id', $id)->first(); + $securitys->delete(); + + return redirect()->back()->with('success', 'Deleted Successfully'); + } +} diff --git a/app/Http/Controllers/Admin/helpdesk/SettingsController.php b/app/Http/Controllers/Admin/helpdesk/SettingsController.php index 8402b6c4b..1b8d66e41 100644 --- a/app/Http/Controllers/Admin/helpdesk/SettingsController.php +++ b/app/Http/Controllers/Admin/helpdesk/SettingsController.php @@ -7,6 +7,8 @@ use App\Http\Controllers\Controller; // requests use App\Http\Requests\helpdesk\CompanyRequest; use App\Http\Requests\helpdesk\EmailRequest; +use App\Http\Requests\helpdesk\RatingUpdateRequest; +use App\Http\Requests\helpdesk\StatusRequest; use App\Http\Requests\helpdesk\SystemRequest; // models use App\Model\helpdesk\Agent\Department; @@ -14,7 +16,8 @@ use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Email\Template; use App\Model\helpdesk\Manage\Help_topic; use App\Model\helpdesk\Manage\Sla_plan; -use App\Model\helpdesk\Settings\Access; +use App\Model\helpdesk\Notification\UserNotification; +use App\Model\helpdesk\Ratings\Rating; use App\Model\helpdesk\Settings\Alert; use App\Model\helpdesk\Settings\Company; use App\Model\helpdesk\Settings\Email; @@ -26,9 +29,11 @@ use App\Model\helpdesk\Utility\Date_format; use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Time_format; use App\Model\helpdesk\Utility\Timezones; +use DateTime; // classes use DB; use Exception; +use File; use Illuminate\Http\Request; use Input; use Lang; @@ -52,16 +57,6 @@ class SettingsController extends Controller $this->middleware('roles'); } - /** - * Main Settings Page. - * - * @return type view - */ - public function settings() - { - return view('themes.default1.admin.helpdesk.setting'); - } - /** * @param int $id * @param $compant instance of company table @@ -109,10 +104,10 @@ class SettingsController extends Controller try { $companys->fill($request->except('logo'))->save(); /* redirect to Index page with Success Message */ - return redirect('getcompany')->with('success', 'Company Updated Successfully'); + return redirect('getcompany')->with('success', Lang::get('lang.company_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('getcompany')->with('fails', 'Company can not Updated'.'
  • '.$e->getMessage().'
  • '); + return redirect('getcompany')->with('fails', Lang::get('lang.company_can_not_updated').'
  • '.$e->getMessage().'
  • '); } } @@ -158,6 +153,9 @@ class SettingsController extends Controller $departments = $department->get(); /* Fetch the values from Timezones table */ $timezones = $timezone->get(); + + //$debug = \Config::get('app.debug'); + //dd($value); /* Direct to System Settings Page */ return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time')); } catch (Exception $e) { @@ -184,10 +182,13 @@ class SettingsController extends Controller /* Check whether function success or not */ $systems->fill($request->input())->save(); /* redirect to Index page with Success Message */ - return redirect('getsystem')->with('success', 'System Updated Successfully'); + + // dd($datacontent); + //\Config::set('app.debug', $request->input('debug')); + return redirect('getsystem')->with('success', Lang::get('lang.system_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('getsystem')->with('fails', 'System can not Updated'.'
  • '.$e->getMessage().'
  • '); + return redirect('getsystem')->with('fails', Lang::get('lang.system_can_not_updated').'
    '.$e->getMessage()); } } @@ -245,10 +246,10 @@ class SettingsController extends Controller /* Check whether function success or not */ $tickets->save(); /* redirect to Index page with Success Message */ - return redirect('getticket')->with('success', 'Ticket Updated Successfully'); + return redirect('getticket')->with('success', Lang::get('lang.ticket_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('getticket')->with('fails', 'Ticket can not Updated'.'
  • '.$e->getMessage().'
  • '); + return redirect('getticket')->with('fails', Lang::get('lang.ticket_can_not_updated').'
  • '.$e->getMessage().'
  • '); } } @@ -303,10 +304,10 @@ class SettingsController extends Controller /* Check whether function success or not */ $emails->save(); /* redirect to Index page with Success Message */ - return redirect('getemail')->with('success', 'Email Updated Successfully'); + return redirect('getemail')->with('success', Lang::get('lang.email_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('getemail')->with('fails', 'Email can not Updated'.'
  • '.$e->getMessage().'
  • '); + return redirect('getemail')->with('fails', Lang::get('lang.email_can_not_updated').'
  • '.$e->getMessage().'
  • '); } } @@ -322,16 +323,15 @@ class SettingsController extends Controller public function getSchedular(Email $email, Template $template, Emails $email1) { // try { - /* fetch the values of email from Email table */ - $emails = $email->whereId('1')->first(); - /* Fetch the values from Template table */ - $templates = $template->get(); - /* Fetch the values from Emails table */ - $emails1 = $email1->get(); + /* fetch the values of email from Email table */ + $emails = $email->whereId('1')->first(); + /* Fetch the values from Template table */ + $templates = $template->get(); + /* Fetch the values from Emails table */ + $emails1 = $email1->get(); return view('themes.default1.admin.helpdesk.settings.crone', compact('emails', 'templates', 'emails1')); // } catch { - // } } @@ -368,57 +368,6 @@ class SettingsController extends Controller } } - /** - * get the form for Access setting page. - * - * @param type Access $access - * - * @return type Response - */ - // public function getaccess(Access $access) { - // try { - // /* fetch the values of access from access table */ - // $accesses = $access->whereId('1')->first(); -// // Direct to Access Settings Page - // return view('themes.default1.admin.helpdesk.settings.access', compact('accesses')); - // } catch (Exception $e) { - // return view('404'); - // } - // } - - /** - * Update the specified resource in storage. - * - * @param type Access $access - * @param type Request $request - * - * @return type Response - */ - // public function postaccess(Access $access, Request $request) { - // try { - // /* fetch the values of access request */ - // $accesses = $access->whereId('1')->first(); - // /* fill the values to access table */ - // $accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save(); - // /* insert checkbox value to DB */ - // $accesses->password_reset = $request->input('password_reset'); - // $accesses->bind_agent_ip = $request->input('bind_agent_ip'); - // $accesses->reg_require = $request->input('reg_require'); - // $accesses->quick_access = $request->input('quick_access'); - // /* Check whether function success or not */ - // if ($accesses->save() == true) { - // /* redirect to Index page with Success Message */ - // return redirect('getaccess')->with('success', 'Access Updated Successfully'); - // } else { - // /* redirect to Index page with Fails Message */ - // return redirect('getaccess')->with('fails', 'Access can not Updated'); - // } - // } catch (Exception $e) { - // /* redirect to Index page with Fails Message */ - // return redirect('getaccess')->with('fails', 'Access can not Updated'); - // } - // } - /** * get the form for Responder setting page. * @@ -461,10 +410,10 @@ class SettingsController extends Controller /* Check whether function success or not */ $responders->save(); /* redirect to Index page with Success Message */ - return redirect('getresponder')->with('success', 'Responder Updated Successfully'); + return redirect('getresponder')->with('success', Lang::get('lang.auto_response_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('getresponder')->with('fails', 'Responder can not Updated'.'
  • '.$e->getMessage().'
  • '); + return redirect('getresponder')->with('fails', Lang::get('lang.auto_response_can_not_updated').'
  • '.$e->getMessage().'
  • '); } } @@ -549,52 +498,13 @@ class SettingsController extends Controller /* Check whether function success or not */ $alerts->save(); /* redirect to Index page with Success Message */ - return redirect('getalert')->with('success', 'Alert Updated Successfully'); + return redirect('getalert')->with('success', Lang::get('lang.alert_&_notices_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('getalert')->with('fails', 'Alert can not Updated'.'
  • '.$e->getMessage().'
  • '); + return redirect('getalert')->with('fails', Lang::get('lang.alert_&_notices_can_not_updated').'
  • '.$e->getMessage().'
  • '); } } - /** - * To display the list of ratings in the system. - * - * @return type View - */ - public function RatingSettings() - { - $ratings = DB::table('settings_ratings')->get(); - - return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings')); - } - - /** - * To store rating data. - * - * @return type Redirect - */ - public function PostRatingSettings($slug) - { - $name = Input::get('rating_name'); - $publish = Input::get('publish'); - $modify = Input::get('modify'); - DB::table('settings_ratings')->whereSlug($slug)->update(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]); - - return redirect()->back()->with('success', 'Successfully updated'); - } - - /** - * To delete a type of rating. - * - * @return type Redirect - */ - public function RatingDelete($slug) - { - DB::table('settings_ratings')->whereSlug($slug)->delete(); - - return redirect()->back()->with('success', 'Successfully Deleted'); - } - /** * Generate Api key. * @@ -606,4 +516,297 @@ class SettingsController extends Controller return $key; } + + /** + * Main Settings Page. + * + * @return type view + */ + public function settings() + { + return view('themes.default1.admin.helpdesk.setting'); + } + + /** + * @param int $id + * @param $compant instance of company table + * + * get the form for company setting page + * + * @return Response + */ + public function getStatuses() + { + try { + /* fetch the values of company from company table */ + $statuss = \DB::table('ticket_status')->get(); + /* Direct to Company Settings Page */ + return view('themes.default1.admin.helpdesk.settings.status', compact('statuss')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * @param int $id + * @param $compant instance of company table + * + * get the form for company setting page + * + * @return Response + */ + public function getEditStatuses($id) + { + try { + /* fetch the values of company from company table */ + $status = \DB::table('ticket_status')->where('id', '=', $id)->first(); + /* Direct to Company Settings Page */ + return view('themes.default1.admin.helpdesk.settings.status-edit', compact('status')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * @param int $id + * @param $compant instance of company table + * + * get the form for company setting page + * + * @return Response + */ + public function editStatuses($id, StatusRequest $request) + { + try { + /* fetch the values of company from company table */ + $statuss = \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->first(); + $statuss->name = $request->input('name'); + $statuss->icon_class = $request->input('icon_class'); + $statuss->email_user = $request->input('email_user'); + $statuss->sort = $request->input('sort'); + $delete = $request->input('deleted'); + if ($delete == 'yes') { + $statuss->state = 'delete'; + } else { + $statuss->state = $request->input('state'); + } + $statuss->sort = $request->input('sort'); + $statuss->save(); + /* Direct to Company Settings Page */ + return redirect()->back()->with('success', Lang::get('lang.status_has_been_updated_successfully')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * create a status. + * + * @param \App\Model\helpdesk\Ticket\Ticket_Status $statuss + * @param \App\Http\Requests\helpdesk\StatusRequest $request + * + * @return type redirect + */ + public function createStatuses(\App\Model\helpdesk\Ticket\Ticket_Status $statuss, StatusRequest $request) + { + try { + /* fetch the values of company from company table */ + $statuss->name = $request->input('name'); + $statuss->icon_class = $request->input('icon_class'); + $statuss->email_user = $request->input('email_user'); + $statuss->sort = $request->input('sort'); + $delete = $request->input('delete'); + if ($delete == 'yes') { + $statuss->state = 'deleted'; + } else { + $statuss->state = $request->input('state'); + } + $statuss->sort = $request->input('sort'); + $statuss->save(); + /* Direct to Company Settings Page */ + return redirect()->back()->with('success', Lang::get('lang.status_has_been_created_successfully')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } + + /** + * delete a status. + * + * @param type $id + * + * @return type redirect + */ + public function deleteStatuses($id) + { + try { + if ($id > 5) { + /* fetch the values of company from company table */ + \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->delete(); + /* Direct to Company Settings Page */ + return redirect()->back()->with('success', Lang::get('lang.status_has_been_deleted')); + } else { + return redirect()->back()->with('failed', Lang::get('lang.you_cannot_delete_this_status')); + } + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * get the page of notification settings. + * + * @return type view + */ + public function notificationSettings() + { + return view('themes.default1.admin.helpdesk.settings.notification'); + } + + /** + * delete a notification. + * + * @return type redirect + */ + public function deleteReadNoti() + { + $markasread = UserNotification::where('is_read', '=', 1)->get(); + foreach ($markasread as $mark) { + $mark->delete(); + \App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete(); + } + + return redirect()->back()->with('success', Lang::get('lang.you_have_deleted_all_the_read_notifications')); + } + + /** + * delete a notification log. + * + * @return type redirect + */ + public function deleteNotificationLog() + { + $days = Input::get('no_of_days'); + if ($days == null) { + return redirect()->back()->with('fails', 'Please enter valid no of days'); + } + $date = new DateTime(); + $date->modify($days.' day'); + $formatted_date = $date->format('Y-m-d H:i:s'); + $markasread = UserNotification::where('created_at', '<=', $formatted_date)->get(); + foreach ($markasread as $mark) { + $mark->delete(); + \App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete(); + } + + return redirect()->back()->with('success', Lang::get('lang.you_have_deleted_all_the_notification_records_since').$days.' days.'); + } + + /** + * To display the list of ratings in the system. + * + * @return type View + */ + public function RatingSettings() + { + try { + $ratings = Rating::orderBy('display_order', 'asc')->get(); + + return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } + + /** + * edit a rating. + * + * @param type $id + * + * @return type view + */ + public function editRatingSettings($id) + { + try { + $rating = Rating::whereId($id)->first(); + + return view('themes.default1.admin.helpdesk.settings.edit-ratings', compact('rating')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } + + /** + * To store rating data. + * + * @return type Redirect + */ + public function PostRatingSettings($id, Rating $ratings, RatingUpdateRequest $request) + { + try { + $rating = $ratings->whereId($id)->first(); + $rating->name = $request->input('name'); + $rating->display_order = $request->input('display_order'); + $rating->allow_modification = $request->input('allow_modification'); + $rating->rating_scale = $request->input('rating_scale'); +// $rating->rating_area = $request->input('rating_area'); + $rating->restrict = $request->input('restrict'); + $rating->save(); + + return redirect()->back()->with('success', Lang::get('lang.ratings_updated_successfully')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } + } + + /** + * get the create rating page. + * + * @return type redirect + */ + public function createRating() + { + try { + return view('themes.default1.admin.helpdesk.settings.create-ratings'); + } catch (Exception $ex) { + return redirect('getratings')->with('fails', Lang::get('lang.ratings_can_not_be_created').'
  • '.$ex->getMessage().'
  • '); + } + } + + /** + * store a rating value. + * + * @param \App\Model\helpdesk\Ratings\Rating $rating + * @param \App\Model\helpdesk\Ratings\RatingRef $ratingrefs + * @param \App\Http\Requests\helpdesk\RatingRequest $request + * + * @return type redirect + */ + public function storeRating(Rating $rating, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs, \App\Http\Requests\helpdesk\RatingRequest $request) + { + $rating->name = $request->input('name'); + $rating->display_order = $request->input('display_order'); + $rating->allow_modification = $request->input('allow_modification'); + $rating->rating_scale = $request->input('rating_scale'); + $rating->rating_area = $request->input('rating_area'); + $rating->restrict = $request->input('restrict'); + $rating->save(); + $ratingrefs->rating_id = $rating->id; + $ratingrefs->save(); + + return redirect()->back()->with('success', Lang::get('lang.successfully_created_this_rating')); + } + + /** + * To delete a type of rating. + * + * @return type Redirect + */ + public function RatingDelete($slug, \App\Model\helpdesk\Ratings\RatingRef $ratingrefs) + { + $ratingrefs->where('rating_id', '=', $slug)->delete(); + Rating::whereId($slug)->delete(); + + return redirect()->back()->with('success', Lang::get('lang.rating_deleted_successfully')); + } } diff --git a/app/Http/Controllers/Admin/helpdesk/SettingsController2.php b/app/Http/Controllers/Admin/helpdesk/SettingsController2.php new file mode 100644 index 000000000..9fc11288e --- /dev/null +++ b/app/Http/Controllers/Admin/helpdesk/SettingsController2.php @@ -0,0 +1,743 @@ + + */ +class SettingsController2 extends Controller +{ + /** + * Create a new controller instance. + * + * @return void + */ + public function __construct() + { + // $this->smtp(); + $this->middleware('auth'); + $this->middleware('roles'); + } + + /** + * Main Settings Page. + * + * @return type view + */ + public function settings() + { + return view('themes.default1.admin.helpdesk.setting'); + } + + public function notificationSettings() + { + return view('themes.default1.admin.helpdesk.settings.notification'); + } + + public function deleteReadNoti() + { + $markasread = UserNotification::where('is_read', '=', 1)->get(); + foreach ($markasread as $mark) { + $mark->delete(); + \App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete(); + } + + return redirect()->back()->with('success', 'You have deleted all the read notifications'); + } + + public function deleteNotificationLog() + { + $days = Input::get('no_of_days'); + $date = new DateTime(); + $date->modify($days.' day'); + $formatted_date = $date->format('Y-m-d H:i:s'); + $markasread = DB::table('user_notification')->where('created_at', '<=', $formatted_date)->get(); + foreach ($markasread as $mark) { + $mark->delete(); + \App\Model\helpdesk\Notification\Notification::whereId($mark->notification_id)->delete(); + } + + return redirect()->back()->with('success', 'You have deleted all the notification records since '.$days.' days.'); + } + + /** + * @param int $id + * @param $compant instance of company table + * + * get the form for company setting page + * + * @return Response + */ + public function getStatuses() + { + try { + /* fetch the values of company from company table */ + $statuss = \DB::table('ticket_status')->get(); + /* Direct to Company Settings Page */ + return view('themes.default1.admin.helpdesk.settings.status', compact('statuss')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * @param int $id + * @param $compant instance of company table + * + * get the form for company setting page + * + * @return Response + */ + public function editStatuses($id) + { + try { + /* fetch the values of company from company table */ + $statuss = \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->first(); + $statuss->name = Input::get('name'); + $statuss->icon_class = Input::get('icon_class'); + $statuss->email_user = Input::get('email_user'); + $statuss->sort = Input::get('sort'); + $delete = Input::get('delete'); + if ($delete == 'yes') { + $statuss->state = 'delete'; + } else { + $statuss->state = Input::get('state'); + } + $statuss->sort = Input::get('sort'); + $statuss->save(); + /* Direct to Company Settings Page */ + return redirect()->back()->with('success', 'Status has been updated!'); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + public function createStatuses(\App\Model\helpdesk\Ticket\Ticket_Status $statuss) + { + // try { + /* fetch the values of company from company table */ + $statuss->name = Input::get('name'); + $statuss->icon_class = Input::get('icon_class'); + $statuss->email_user = Input::get('email_user'); + $statuss->sort = Input::get('sort'); + $delete = Input::get('delete'); + if ($delete == 'yes') { + $statuss->state = 'delete'; + } else { + $statuss->state = Input::get('state'); + } + $statuss->sort = Input::get('sort'); + $statuss->save(); + /* Direct to Company Settings Page */ + return redirect()->back()->with('success', 'Status has been created!'); +// } catch (Exception $ex) { +// return redirect()->back()->with('fails', $ex->errorInfo[2]); +// } + } + + public function deleteStatuses($id) + { + try { + if ($id > 5) { + /* fetch the values of company from company table */ + \App\Model\helpdesk\Ticket\Ticket_Status::whereId($id)->delete(); + /* Direct to Company Settings Page */ + return redirect()->back()->with('success', 'Status has been deleted'); + } else { + return redirect()->back()->with('failed', 'You cannot delete this status'); + } + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * @param int $id + * @param $compant instance of company table + * + * get the form for company setting page + * + * @return Response + */ + public function getcompany(Company $company) + { + try { + /* fetch the values of company from company table */ + $companys = $company->whereId('1')->first(); + /* Direct to Company Settings Page */ + return view('themes.default1.admin.helpdesk.settings.company', compact('companys')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * Update the specified resource in storage. + * + * @param type int $id + * @param type Company $company + * @param type CompanyRequest $request + * + * @return Response + */ + public function postcompany($id, Company $company, CompanyRequest $request) + { + /* fetch the values of company request */ + $companys = $company->whereId('1')->first(); + if (Input::file('logo')) { + $name = Input::file('logo')->getClientOriginalName(); + $destinationPath = 'lb-faveo/media/company/'; + $fileName = rand(0000, 9999).'.'.$name; + Input::file('logo')->move($destinationPath, $fileName); + $companys->logo = $fileName; + } + if ($request->input('use_logo') == null) { + $companys->use_logo = '0'; + } + /* Check whether function success or not */ + try { + $companys->fill($request->except('logo'))->save(); + /* redirect to Index page with Success Message */ + return redirect('getcompany')->with('success', 'Company Updated Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('getcompany')->with('fails', 'Company can not Updated'.'
  • '.$e->getMessage().'
  • '); + } + } + + /** + * function to delete system logo. + * + * @return type string + */ + public function deleteLogo() + { + $path = $_GET['data1']; //get file path of logo image + if (!unlink($path)) { + return 'false'; + } else { + $companys = Company::where('id', '=', 1)->first(); + $companys->logo = null; + $companys->use_logo = '0'; + $companys->save(); + + return 'true'; + } + // return $res; + } + + /** + * get the form for System setting page. + * + * @param type System $system + * @param type Department $department + * @param type Timezones $timezone + * @param type Date_format $date + * @param type Date_time_format $date_time + * @param type Time_format $time + * + * @return type Response + */ + public function getsystem(System $system, Department $department, Timezones $timezone, Date_format $date, Date_time_format $date_time, Time_format $time) + { + try { + /* fetch the values of system from system table */ + $systems = $system->whereId('1')->first(); + /* Fetch the values from Department table */ + $departments = $department->get(); + /* Fetch the values from Timezones table */ + $timezones = $timezone->get(); + /* Direct to System Settings Page */ + return view('themes.default1.admin.helpdesk.settings.system', compact('systems', 'departments', 'timezones', 'time', 'date', 'date_time')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * Update the specified resource in storage. + * + * @param type int $id + * @param type System $system + * @param type SystemRequest $request + * + * @return type Response + */ + public function postsystem($id, System $system, SystemRequest $request) + { + try { + // dd($request); + /* fetch the values of system request */ + $systems = $system->whereId('1')->first(); + /* fill the values to coompany table */ + /* Check whether function success or not */ + $systems->fill($request->input())->save(); + /* redirect to Index page with Success Message */ + return redirect('getsystem')->with('success', 'System Updated Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('getsystem')->with('fails', 'System can not Updated'.'
  • '.$e->getMessage().'
  • '); + } + } + + /** + * get the form for Ticket setting page. + * + * @param type Ticket $ticket + * @param type Sla_plan $sla + * @param type Help_topic $topic + * @param type Priority $priority + * + * @return type Response + */ + public function getticket(Ticket $ticket, Sla_plan $sla, Help_topic $topic, Ticket_Priority $priority) + { + try { + /* fetch the values of ticket from ticket table */ + $tickets = $ticket->whereId('1')->first(); + /* Fetch the values from SLA Plan table */ + $slas = $sla->get(); + /* Fetch the values from Help_topic table */ + $topics = $topic->get(); + /* Direct to Ticket Settings Page */ + return view('themes.default1.admin.helpdesk.settings.ticket', compact('tickets', 'slas', 'topics', 'priority')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * Update the specified resource in storage. + * + * @param type int $id + * @param type Ticket $ticket + * @param type Request $request + * + * @return type Response + */ + public function postticket($id, Ticket $ticket, Request $request) + { + try { + /* fetch the values of ticket request */ + $tickets = $ticket->whereId('1')->first(); + /* fill the values to coompany table */ + $tickets->fill($request->except('captcha', 'claim_response', 'assigned_ticket', 'answered_ticket', 'agent_mask', 'html', 'client_update'))->save(); + /* insert checkbox to Database */ + $tickets->captcha = $request->input('captcha'); + $tickets->claim_response = $request->input('claim_response'); + $tickets->assigned_ticket = $request->input('assigned_ticket'); + $tickets->answered_ticket = $request->input('answered_ticket'); + $tickets->agent_mask = $request->input('agent_mask'); + $tickets->html = $request->input('html'); + $tickets->client_update = $request->input('client_update'); + $tickets->collision_avoid = $request->input('collision_avoid'); + /* Check whether function success or not */ + $tickets->save(); + /* redirect to Index page with Success Message */ + return redirect('getticket')->with('success', 'Ticket Updated Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('getticket')->with('fails', 'Ticket can not Updated'.'
  • '.$e->getMessage().'
  • '); + } + } + + /** + * get the form for Email setting page. + * + * @param type Email $email + * @param type Template $template + * @param type Emails $email1 + * + * @return type Response + */ + public function getemail(Email $email, Template $template, Emails $email1) + { + try { + /* fetch the values of email from Email table */ + $emails = $email->whereId('1')->first(); + /* Fetch the values from Template table */ + $templates = $template->get(); + /* Fetch the values from Emails table */ + $emails1 = $email1->get(); + /* Direct to Email Settings Page */ + return view('themes.default1.admin.helpdesk.settings.email', compact('emails', 'templates', 'emails1')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * Update the specified resource in storage. + * + * @param type int $id + * @param type Email $email + * @param type EmailRequest $request + * + * @return type Response + */ + public function postemail($id, Email $email, EmailRequest $request) + { + try { + /* fetch the values of email request */ + $emails = $email->whereId('1')->first(); + /* fill the values to email table */ + $emails->fill($request->except('email_fetching', 'all_emails', 'email_collaborator', 'strip', 'attachment'))->save(); + /* insert checkboxes to database */ + // $emails->email_fetching = $request->input('email_fetching'); + // $emails->notification_cron = $request->input('notification_cron'); + $emails->all_emails = $request->input('all_emails'); + $emails->email_collaborator = $request->input('email_collaborator'); + $emails->strip = $request->input('strip'); + $emails->attachment = $request->input('attachment'); + /* Check whether function success or not */ + $emails->save(); + /* redirect to Index page with Success Message */ + return redirect('getemail')->with('success', 'Email Updated Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('getemail')->with('fails', 'Email can not Updated'.'
  • '.$e->getMessage().'
  • '); + } + } + + /** + * get the form for cron job setting page. + * + * @param type Email $email + * @param type Template $template + * @param type Emails $email1 + * + * @return type Response + */ + public function getSchedular(Email $email, Template $template, Emails $email1) + { + // try { + /* fetch the values of email from Email table */ + $emails = $email->whereId('1')->first(); + /* Fetch the values from Template table */ + $templates = $template->get(); + /* Fetch the values from Emails table */ + $emails1 = $email1->get(); + + return view('themes.default1.admin.helpdesk.settings.crone', compact('emails', 'templates', 'emails1')); + // } catch { + + // } + } + + /** + * Update the specified resource in storage for cron job. + * + * @param type Email $email + * @param type EmailRequest $request + * + * @return type Response + */ + public function postSchedular(Email $email, Template $template, Emails $email1, Request $request) + { + // dd($request); + try { + /* fetch the values of email request */ + $emails = $email->whereId('1')->first(); + if ($request->email_fetching) { + $emails->email_fetching = $request->email_fetching; + } else { + $emails->email_fetching = 0; + } + if ($request->notification_cron) { + $emails->notification_cron = $request->notification_cron; + } else { + $emails->notification_cron = 0; + } + $emails->save(); + /* redirect to Index page with Success Message */ + return redirect('job-scheduler')->with('success', Lang::get('lang.job-scheduler-success')); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('job-scheduler')->with('fails', Lang::get('lang.job-scheduler-error').'
  • '.$e->getMessage().'
  • '); + } + } + + /** + * get the form for Access setting page. + * + * @param type Access $access + * + * @return type Response + */ + // public function getaccess(Access $access) { + // try { + // /* fetch the values of access from access table */ + // $accesses = $access->whereId('1')->first(); +// // Direct to Access Settings Page + // return view('themes.default1.admin.helpdesk.settings.access', compact('accesses')); + // } catch (Exception $e) { + // return view('404'); + // } + // } + + /** + * Update the specified resource in storage. + * + * @param type Access $access + * @param type Request $request + * + * @return type Response + */ + // public function postaccess(Access $access, Request $request) { + // try { + // /* fetch the values of access request */ + // $accesses = $access->whereId('1')->first(); + // /* fill the values to access table */ + // $accesses->fill($request->except('password_reset', 'bind_agent_ip', 'reg_require', 'quick_access'))->save(); + // /* insert checkbox value to DB */ + // $accesses->password_reset = $request->input('password_reset'); + // $accesses->bind_agent_ip = $request->input('bind_agent_ip'); + // $accesses->reg_require = $request->input('reg_require'); + // $accesses->quick_access = $request->input('quick_access'); + // /* Check whether function success or not */ + // if ($accesses->save() == true) { + // /* redirect to Index page with Success Message */ + // return redirect('getaccess')->with('success', 'Access Updated Successfully'); + // } else { + // /* redirect to Index page with Fails Message */ + // return redirect('getaccess')->with('fails', 'Access can not Updated'); + // } + // } catch (Exception $e) { + // /* redirect to Index page with Fails Message */ + // return redirect('getaccess')->with('fails', 'Access can not Updated'); + // } + // } + + /** + * get the form for Responder setting page. + * + * @param type Responder $responder + * + * @return type Response + */ + public function getresponder(Responder $responder) + { + try { + /* fetch the values of responder from responder table */ + $responders = $responder->whereId('1')->first(); + /* Direct to Responder Settings Page */ + return view('themes.default1.admin.helpdesk.settings.responder', compact('responders')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * Update the specified resource in storage. + * + * @param type Responder $responder + * @param type Request $request + * + * @return type + */ + public function postresponder(Responder $responder, Request $request) + { + try { + /* fetch the values of responder request */ + $responders = $responder->whereId('1')->first(); + /* insert Checkbox value to DB */ + $responders->new_ticket = $request->input('new_ticket'); + $responders->agent_new_ticket = $request->input('agent_new_ticket'); + $responders->submitter = $request->input('submitter'); + $responders->participants = $request->input('participants'); + $responders->overlimit = $request->input('overlimit'); + /* fill the values to coompany table */ + /* Check whether function success or not */ + $responders->save(); + /* redirect to Index page with Success Message */ + return redirect('getresponder')->with('success', 'Responder Updated Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('getresponder')->with('fails', 'Responder can not Updated'.'
  • '.$e->getMessage().'
  • '); + } + } + + /** + * get the form for Alert setting page. + * + * @param type Alert $alert + * + * @return type Response + */ + public function getalert(Alert $alert) + { + try { + /* fetch the values of alert from alert table */ + $alerts = $alert->whereId('1')->first(); + /* Direct to Alert Settings Page */ + return view('themes.default1.admin.helpdesk.settings.alert', compact('alerts')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); + } + } + + /** + * Update the specified resource in storage. + * + * @param type $id + * @param type Alert $alert + * @param type Request $request + * + * @return type Response + */ + public function postalert($id, Alert $alert, Request $request) + { + try { + /* fetch the values of alert request */ + $alerts = $alert->whereId('1')->first(); + /* Insert Checkbox to DB */ + $alerts->assignment_status = $request->input('assignment_status'); + $alerts->ticket_status = $request->input('ticket_status'); + $alerts->overdue_department_member = $request->input('overdue_department_member'); + $alerts->sql_error = $request->input('sql_error'); + $alerts->excessive_failure = $request->input('excessive_failure'); + $alerts->overdue_status = $request->input('overdue_status'); + $alerts->overdue_assigned_agent = $request->input('overdue_assigned_agent'); + $alerts->overdue_department_manager = $request->input('overdue_department_manager'); + $alerts->internal_status = $request->input('internal_status'); + $alerts->internal_last_responder = $request->input('internal_last_responder'); + $alerts->internal_assigned_agent = $request->input('internal_assigned_agent'); + $alerts->internal_department_manager = $request->input('internal_department_manager'); + $alerts->assignment_assigned_agent = $request->input('assignment_assigned_agent'); + $alerts->assignment_team_leader = $request->input('assignment_team_leader'); + $alerts->assignment_team_member = $request->input('assignment_team_member'); + $alerts->system_error = $request->input('system_error'); + $alerts->transfer_department_member = $request->input('transfer_department_member'); + $alerts->transfer_department_manager = $request->input('transfer_department_manager'); + $alerts->transfer_assigned_agent = $request->input('transfer_assigned_agent'); + $alerts->transfer_status = $request->input('transfer_status'); + $alerts->message_organization_accmanager = $request->input('message_organization_accmanager'); + $alerts->message_department_manager = $request->input('message_department_manager'); + $alerts->message_assigned_agent = $request->input('message_assigned_agent'); + $alerts->message_last_responder = $request->input('message_last_responder'); + $alerts->message_status = $request->input('message_status'); + $alerts->ticket_organization_accmanager = $request->input('ticket_organization_accmanager'); + $alerts->ticket_department_manager = $request->input('ticket_department_manager'); + $alerts->ticket_department_member = $request->input('ticket_department_member'); + $alerts->ticket_admin_email = $request->input('ticket_admin_email'); + + if ($request->input('system_error') == null) { + $str = '%0%'; + $path = app_path('../config/app.php'); + $content = \File::get($path); + $content = str_replace('%1%', $str, $content); + \File::put($path, $content); + } else { + $str = '%1%'; + $path = app_path('../config/app.php'); + $content = \File::get($path); + $content = str_replace('%0%', $str, $content); + \File::put($path, $content); + } + /* fill the values to coompany table */ + /* Check whether function success or not */ + $alerts->save(); + /* redirect to Index page with Success Message */ + return redirect('getalert')->with('success', 'Alert Updated Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('getalert')->with('fails', 'Alert can not Updated'.'
  • '.$e->getMessage().'
  • '); + } + } + + /** + * To display the list of ratings in the system. + * + * @return type View + */ + public function RatingSettings() + { + $ratings = DB::table('settings_ratings')->get(); + + return view('themes.default1.admin.helpdesk.settings.ratings', compact('ratings')); + } + + /** + * To store rating data. + * + * @return type Redirect + */ + public function PostRatingSettings($slug) + { + $name = Input::get('rating_name'); + $publish = Input::get('publish'); + $modify = Input::get('modify'); + DB::table('settings_ratings')->whereSlug($slug)->update(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]); + + return redirect()->back()->with('success', 'Successfully updated'); + } + + public function createRating() + { + $name = Input::get('rating_name'); + $publish = Input::get('publish'); + $modify = Input::get('modify'); + DB::table('settings_ratings')->insert(['rating_name' => $name, 'publish' => $publish, 'modify' => $modify]); + + return redirect()->back()->with('success', 'Successfully created this rating'); + } + + /** + * To delete a type of rating. + * + * @return type Redirect + */ + public function RatingDelete($slug) + { + DB::table('settings_ratings')->whereSlug($slug)->delete(); + + return redirect()->back()->with('success', 'Successfully Deleted'); + } + + /** + * Generate Api key. + * + * @return type json + */ + public function generateApiKey() + { + $key = str_random(32); + + return $key; + } +} diff --git a/app/Http/Controllers/Admin/helpdesk/SlaController.php b/app/Http/Controllers/Admin/helpdesk/SlaController.php index 7dee75a9c..8ddab22da 100644 --- a/app/Http/Controllers/Admin/helpdesk/SlaController.php +++ b/app/Http/Controllers/Admin/helpdesk/SlaController.php @@ -13,6 +13,7 @@ use App\Model\helpdesk\Settings\Ticket; //classes use DB; use Exception; +use Lang; /** * SlaController. @@ -47,7 +48,7 @@ class SlaController extends Controller /* Listing the values From Sla_plan Table */ return view('themes.default1.admin.helpdesk.manage.sla.index', compact('slas')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -62,7 +63,7 @@ class SlaController extends Controller /* Direct to Create Page */ return view('themes.default1.admin.helpdesk.manage.sla.create'); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -81,10 +82,10 @@ class SlaController extends Controller /* Check whether function success or not */ $sla->fill($request->input())->save(); /* redirect to Index page with Success Message */ - return redirect('sla')->with('success', 'SLA Plan Created Successfully'); + return redirect('sla')->with('success', Lang::get('lang.sla_plan_created_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('sla')->with('fails', 'SLA Plan can not Create'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('sla')->with('fails', Lang::get('lang.sla_plan_can_not_create').'
  • '.$e->getMessage().'
  • '); } } @@ -96,16 +97,16 @@ class SlaController extends Controller * * @return type Response */ - public function edit($id, Sla_plan $sla) + public function edit($id) { try { /* Direct to edit page along values of perticular field using Id */ - $slas = $sla->whereId($id)->first(); + $slas = Sla_plan::whereId($id)->first(); $slas->get(); - - return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas')); + $sla = \DB::table('settings_ticket')->select('sla')->where('id', '=', 1)->first(); + return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas','sla')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -118,11 +119,11 @@ class SlaController extends Controller * * @return type Response */ - public function update($id, Sla_plan $sla, SlaUpdate $request) + public function update($id, SlaUpdate $request) { try { /* Fill values to selected field using Id except Check box */ - $slas = $sla->whereId($id)->first(); + $slas = Sla_plan::whereId($id)->first(); $slas->fill($request->except('transient', 'ticket_overdue'))->save(); /* Update transient checkox field */ $slas->transient = $request->input('transient'); @@ -131,10 +132,15 @@ class SlaController extends Controller /* Check whether function success or not */ $slas->save(); /* redirect to Index page with Success Message */ - return redirect('sla')->with('success', 'SLA Plan Updated Successfully'); + if ($request->input('sys_sla') == 'on') { + \DB::table('settings_ticket') + ->where('id', '=', 1) + ->update(['sla' => $id]); + } + return redirect('sla')->with('success', Lang::get('lang.sla_plan_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('sla')->with('fails', 'SLA Plan can not Update'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('sla')->with('fails', Lang::get('lang.sla_plan_can_not_update').'
  • '.$e->getMessage().'
  • '); } } @@ -146,11 +152,11 @@ class SlaController extends Controller * * @return type Response */ - public function destroy($id, Sla_plan $sla) + public function destroy($id) { $default_sla = Ticket::where('id', '=', '1')->first(); if ($default_sla->sla == $id) { - return redirect('departments')->with('fails', 'You cannot delete default department'); + return redirect('departments')->with('fails', Lang::get('lang.you_cannot_delete_default_department')); } else { $tickets = DB::table('tickets')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]); if ($tickets > 0) { @@ -159,7 +165,7 @@ class SlaController extends Controller } else { $text_tickets = 'Ticket'; } - $ticket = '
  • '.$tickets.' '.$text_tickets.' have been moved to default SLA
  • '; + $ticket = '
  • '.$tickets.' '.$text_tickets.Lang::get('lang.have_been_moved_to_default_sla').'
  • '; } else { $ticket = ''; } @@ -170,7 +176,7 @@ class SlaController extends Controller } else { $text_dept = 'Email'; } - $dept = '
  • Associated department have been moved to default SLA
  • '; + $dept = '
  • '.Lang::get('lang.associated_department_have_been_moved_to_default_sla').'
  • '; } else { $dept = ''; } @@ -181,21 +187,21 @@ class SlaController extends Controller } else { $text_topic = 'Email'; } - $topic = '
  • Associated Help Topic have been moved to default SLA
  • '; + $topic = '
  • '.Lang::get('lang.associated_help_topic_have_been_moved_to_default_sla').'
  • '; } else { $topic = ''; } $message = $ticket.$dept.$topic; /* Delete a perticular field from the database by delete() using Id */ - $slas = $sla->whereId($id)->first(); + $slas = Sla_plan::whereId($id)->first(); /* Check whether function success or not */ try { $slas->delete(); /* redirect to Index page with Success Message */ - return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$message); + return redirect('sla')->with('success', Lang::get('lang.sla_plan_deleted_successfully').$message); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('sla')->with('fails', 'SLA Plan can not Delete'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('sla')->with('fails', Lang::get('lang.sla_plan_can_not_delete').'
  • '.$e->getMessage().'
  • '); } } } diff --git a/app/Http/Controllers/Admin/helpdesk/TeamController.php b/app/Http/Controllers/Admin/helpdesk/TeamController.php index 0af3a5d77..11ffbcdd6 100644 --- a/app/Http/Controllers/Admin/helpdesk/TeamController.php +++ b/app/Http/Controllers/Admin/helpdesk/TeamController.php @@ -14,6 +14,7 @@ use App\User; // classes use DB; use Exception; +use Lang; /** * TeamController. @@ -51,7 +52,7 @@ class TeamController extends Controller return view('themes.default1.admin.helpdesk.agent.teams.index', compact('assign_team_agent', 'teams')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -69,7 +70,7 @@ class TeamController extends Controller return view('themes.default1.admin.helpdesk.agent.teams.create', compact('user')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -93,10 +94,10 @@ class TeamController extends Controller /* Check whether function success or not */ $team->fill($request->except('team_lead'))->save(); /* redirect to Index page with Success Message */ - return redirect('teams')->with('success', 'Teams Created Successfully'); + return redirect('teams')->with('success', Lang::get('lang.teams_created_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('teams')->with('fails', 'Teams can not Create'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('teams')->with('fails', Lang::get('lang.teams_can_not_create').'
  • '.$e->getMessage().'
  • '); } } @@ -120,7 +121,7 @@ class TeamController extends Controller return view('themes.default1.admin.helpdesk.agent.teams.edit', compact('agent_id', 'user', 'teams', 'allagents')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -153,10 +154,10 @@ class TeamController extends Controller try { $teams->fill($request->except('team_lead'))->save(); /* redirect to Index page with Success Message */ - return redirect('teams')->with('success', 'Teams Updated Successfully'); + return redirect('teams')->with('success', Lang::get('lang.teams_updated_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('teams')->with('fails', 'Teams can not Update'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('teams')->with('fails', Lang::get('lang.teams_can_not_update').'
  • '.$e->getMessage().'
  • '); } } @@ -178,10 +179,10 @@ class TeamController extends Controller /* Check whether function success or not */ $teams->delete(); /* redirect to Index page with Success Message */ - return redirect('teams')->with('success', 'Teams Deleted Successfully'); + return redirect('teams')->with('success', Lang::get('lang.teams_deleted_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('teams')->with('fails', 'Teams can not Delete'.'
  • '.$e->errorInfo[2].'
  • '); + return redirect('teams')->with('fails', Lang::get('lang.teams_can_not_delete').'
  • '.$e->getMessage().'
  • '); } } } diff --git a/app/Http/Controllers/Admin/helpdesk/TemplateController.php b/app/Http/Controllers/Admin/helpdesk/TemplateController.php index cf41444e7..6b7600cd1 100644 --- a/app/Http/Controllers/Admin/helpdesk/TemplateController.php +++ b/app/Http/Controllers/Admin/helpdesk/TemplateController.php @@ -4,9 +4,9 @@ namespace App\Http\Controllers\Admin\helpdesk; // controllers use App\Http\Controllers\Common\PhpMailController; -use App\Http\Controllers\Common\SettingsController; use App\Http\Controllers\Controller; // requests +use App\Http\Requests\helpdesk\DiagnosRequest; use App\Http\Requests\helpdesk\TemplateRequest; use App\Http\Requests\helpdesk\TemplateUdate; // models @@ -17,24 +17,22 @@ use App\Model\helpdesk\Utility\Languages; use Exception; use Illuminate\Http\Request; use Input; -use Mail; +use Lang; /** * TemplateController. * * @author Ladybird */ -class TemplateController extends Controller -{ +class TemplateController extends Controller { + /** * Create a new controller instance. * * @return type void */ - public function __construct(PhpMailController $PhpMailController) - { + public function __construct(PhpMailController $PhpMailController) { $this->PhpMailController = $PhpMailController; - SettingsController::smtp(); $this->middleware('auth'); $this->middleware('roles'); } @@ -46,14 +44,13 @@ class TemplateController extends Controller * * @return type Response */ - public function index(Template $template) - { + public function index(Template $template) { try { $templates = $template->get(); return view('themes.default1.admin.helpdesk.emails.template.index', compact('templates')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -65,8 +62,7 @@ class TemplateController extends Controller * * @return type Response */ - public function create(Languages $language, Template $template) - { + public function create(Languages $language, Template $template) { try { $templates = $template->get(); $languages = $language->get(); @@ -85,8 +81,7 @@ class TemplateController extends Controller * * @return type Response */ - public function store(Template $template, TemplateRequest $request) - { + public function store(Template $template, TemplateRequest $request) { try { /* Check whether function success or not */ if ($template->fill($request->input())->save() == true) { @@ -109,8 +104,7 @@ class TemplateController extends Controller * * @return Response */ - public function show($id) - { + public function show($id) { // } @@ -123,41 +117,37 @@ class TemplateController extends Controller * * @return type Response */ - public function listdirectories() - { - $path = \Config::get('view.paths')[0].'/emails/'; + public function listdirectories() { + $path = \Config::get('view.paths')[0] . '/emails/'; $directories = scandir($path); $directory = str_replace('/', '-', $path); return view('themes.default1.admin.helpdesk.emails.template.listdirectories', compact('directories', 'directory')); } - public function listtemplates($template, $path) - { + public function listtemplates($template, $path) { $paths = str_replace('-', '/', $path); - $directory2 = $paths.$template; + $directory2 = $paths . $template; $templates = scandir($directory2); - $directory = str_replace('/', '-', $directory2.'/'); + $directory = str_replace('/', '-', $directory2 . '/'); return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates', 'directory')); } - public function readtemplate($template, $path) - { + public function readtemplate($template, $path) { $directory = str_replace('-', '/', $path); - $handle = fopen($directory.$template, 'r'); - $contents = fread($handle, filesize($directory.$template)); + $handle = fopen($directory . $template, 'r'); + $contents = fread($handle, filesize($directory . $template)); fclose($handle); return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents', 'template', 'path')); } - public function createtemplate() - { + public function createtemplate() { $directory = '../resources/views/emails/'; $fname = Input::get('folder_name'); - $filename = $directory.$fname; + $filename = $directory . $fname; // images folder creation using php // $mydir = dirname( __FILE__ )."/html/images"; @@ -169,7 +159,7 @@ class TemplateController extends Controller if (!file_exists($filename)) { mkdir($filename, 0777); } - $files = array_filter(scandir($directory.'default')); + $files = array_filter(scandir($directory . 'default')); foreach ($files as $file) { if ($file === '.' or $file === '..') { @@ -177,29 +167,27 @@ class TemplateController extends Controller } if (!is_dir($file)) { // $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file); - $destination = $directory.$fname.'/'; + $destination = $directory . $fname . '/'; - copy($directory.'default/'.$file, $destination.$file); + copy($directory . 'default/' . $file, $destination . $file); } } return \Redirect::back()->with('success', 'Successfully copied'); } - public function writetemplate($template, $path) - { + public function writetemplate($template, $path) { $directory = str_replace('-', '/', $path); $b = Input::get('templatedata'); - file_put_contents($directory.$template, print_r($b, true)); + file_put_contents($directory . $template, print_r($b, true)); return \Redirect::back()->with('success', 'Successfully updated'); } - public function deletetemplate($template, $path) - { + public function deletetemplate($template, $path) { $directory = str_replace('-', '/', $path); - $dir = $directory.$template; + $dir = $directory . $template; $status = \DB::table('settings_email')->first(); if ($template == 'default' or $template == $status->template) { return \Redirect::back()->with('fails', 'You cannot delete a default or active directory!'); @@ -208,7 +196,7 @@ class TemplateController extends Controller $objects = scandir($dir); foreach ($objects as $object) { if ($object != '.' && $object != '..') { - unlink($dir.'/'.$object); + unlink($dir . '/' . $object); } } rmdir($dir); @@ -219,15 +207,13 @@ class TemplateController extends Controller return \Redirect::back()->with('success', 'Successfully Deleted'); } - public function activateset($setname) - { + public function activateset($setname) { \DB::table('settings_email')->update(['template' => $setname]); return \Redirect::back()->with('success', 'You have Successfully Activated this Set'); } - public function edit($id, Template $template, Languages $language) - { + public function edit($id, Template $template, Languages $language) { try { $templates = $template->whereId($id)->first(); $languages = $language->get(); @@ -247,8 +233,7 @@ class TemplateController extends Controller * * @return type Response */ - public function update($id, Template $template, TemplateUdate $request) - { + public function update($id, Template $template, TemplateUdate $request) { try { //TODO validation $templates = $template->whereId($id)->first(); @@ -274,8 +259,7 @@ class TemplateController extends Controller * * @return type Response */ - public function destroy($id, Template $template) - { + public function destroy($id, Template $template) { try { $templates = $template->whereId($id)->first(); /* Check whether function success or not */ @@ -299,14 +283,13 @@ class TemplateController extends Controller * * @return type Response */ - public function formDiagno(Emails $email) - { + public function formDiagno(Emails $email) { try { $emails = $email->get(); return view('themes.default1.admin.helpdesk.emails.template.formDiagno', compact('emails')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -317,19 +300,56 @@ class TemplateController extends Controller * * @return type */ - public function postDiagno(Request $request) - { - $email = $request->input('to'); - if ($email == null) { - return redirect('getdiagno')->with('fails', 'Please provide E-mail address !'); - } - // sending mail via php mailer - $mail = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['email' => $email], $message = ['subject' => 'Checking the connection', 'scenario' => 'error-report', 'content' => 'Email Received Successfully'], $template_variables = ['system_error' => 'Email Received Successfully']); - - if ($mail == null) { - return redirect('getdiagno')->with('fails', 'Please check your E-mail settings. Unable to send mails'); - } else { - return redirect('getdiagno')->with('success', 'Please check your mail. An E-mail has been sent to your E-mail address'); + public function postDiagno(DiagnosRequest $request) { + try { + $email_details = Emails::where('id', '=', $request->from)->first(); + if ($email_details->sending_protocol == 'mail') { + $mail = new \PHPMailer(); // defaults to using php "mail()" + $mail->IsSendmail(); // telling the class to use SendMail transport + $mail->SetFrom($email_details->email_address, $email_details->email_name); // sender details + $address = $request->to; // receiver email + $mail->AddAddress($address); + $mail->Subject = $request->subject; // subject of the email + $body = $request->message; // body of the email + $mail->MsgHTML($body); + if (!$mail->Send()) { + $return = Lang::get('lang.mailer_error') . ': ' . $mail->ErrorInfo; + } else { + $return = Lang::get('lang.message_has_been_sent'); + } + } elseif ($email_details->sending_protocol == 'smtp') { + $mail = new \PHPMailer(); + $mail->isSMTP(); // Set mailer to use SMTP + if ($email_details->smtp_validate == '1') { + $mail->SMTPOptions = [ + 'ssl' => [ + 'verify_peer' => false, + 'verify_peer_name' => false, + 'allow_self_signed' => true, + ], + ]; + } + $mail->Host = $email_details->sending_host; // Specify main and backup SMTP servers + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = $email_details->email_address; // SMTP username + $mail->Password = \Crypt::decrypt($email_details->password); // SMTP password + $mail->SMTPSecure = $email_details->sending_encryption; // Enable TLS encryption, `ssl` also accepted + $mail->Port = $email_details->sending_port; // TCP port to connect to + $mail->setFrom($email_details->email_address, $email_details->email_name); + $mail->addAddress($request->to, ''); // Add a recipient + $mail->isHTML(true); // Set email format to HTML + $mail->Subject = $request->subject; + $mail->Body = utf8_decode($request->message); + if (!$mail->send()) { + $return = Lang::get('lang.mailer_error') . ': ' . $mail->ErrorInfo; + } else { + $return = Lang::get('lang.message_has_been_sent'); + } + } + return redirect()->back()->with('success', $return); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->getMessage()); } } + } diff --git a/app/Http/Controllers/Admin/helpdesk/WorkflowController.php b/app/Http/Controllers/Admin/helpdesk/WorkflowController.php index e83970caa..7583525b4 100644 --- a/app/Http/Controllers/Admin/helpdesk/WorkflowController.php +++ b/app/Http/Controllers/Admin/helpdesk/WorkflowController.php @@ -24,6 +24,7 @@ use Datatable; //classes use Exception; use Illuminate\Http\Request; +use Lang; /** * WorkflowController @@ -60,7 +61,7 @@ class WorkflowController extends Controller try { return view('themes.default1.admin.helpdesk.manage.workflow.index'); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -143,18 +144,14 @@ class WorkflowController extends Controller */ public function create(Emails $emails) { - // dd($emails); foreach ($emails->lists('email_address', 'id') as $key => $email) { $email_data["E-$key"] = $email; } -// dd($email_data); -// dd($emails->lists('email_address' , 'id')); $emails = $email_data; try { - // $emails = $emails->get(); return view('themes.default1.admin.helpdesk.manage.workflow.create', compact('emails')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -167,10 +164,9 @@ class WorkflowController extends Controller */ public function store(WorkflowCreateRequest $request) { - //dd($request); try { // store a new workflow credentials in to the system - $workflow_name = new WorkflowName(); + $workflow_name = new WorkflowName; $workflow_name->name = $request->name; $workflow_name->status = $request->status; $workflow_name->order = $request->execution_order; @@ -198,7 +194,7 @@ class WorkflowController extends Controller $workflow_action->save(); } - return redirect('workflow')->with('success', 'Workflow Created Successfully'); + return redirect('workflow')->with('success', Lang::get('lang.workflow_created_successfully')); } catch (Exception $e) { return redirect()->back()->with('fails', $e->getMessage()); } @@ -222,7 +218,7 @@ class WorkflowController extends Controller return view('themes.default1.admin.helpdesk.manage.workflow.edit', compact('id', 'workflow', 'emails', 'workflow_rules', 'workflow_actions')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -269,7 +265,7 @@ class WorkflowController extends Controller $workflow_action->save(); } - return redirect('workflow')->with('success', 'Workflow Updated Successfully'); + return redirect('workflow')->with('success', Lang::get('lang.workflow_updated_successfully')); } catch (Exception $e) { return redirect()->back()->with('fails', $e->getMessage()); } @@ -288,7 +284,7 @@ class WorkflowController extends Controller $workflow_rules = WorkflowRules::where('workflow_id', '=', $id)->delete(); $workflow = WorkflowName::whereId($id)->delete(); - return redirect('workflow')->with('success', 'Workflow Deleted Successfully'); + return redirect('workflow')->with('success', Lang::get('lang.workflow_deleted_successfully')); } catch (Exception $e) { return redirect()->back()->with('fails', $e->getMessage()); } diff --git a/app/Http/Controllers/Agent/helpdesk/CannedController.php b/app/Http/Controllers/Agent/helpdesk/CannedController.php index f2924280e..76c13de1e 100644 --- a/app/Http/Controllers/Agent/helpdesk/CannedController.php +++ b/app/Http/Controllers/Agent/helpdesk/CannedController.php @@ -12,6 +12,7 @@ use App\Model\helpdesk\Agent_panel\Canned; use App\User; // classes use Exception; +use Lang; /** * CannedController. @@ -46,7 +47,11 @@ class CannedController extends Controller */ public function index() { - return view('themes.default1.agent.helpdesk.canned.index'); + try { + return view('themes.default1.agent.helpdesk.canned.index'); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } } /** @@ -56,7 +61,11 @@ class CannedController extends Controller */ public function create() { - return view('themes.default1.agent.helpdesk.canned.create'); + try { + return view('themes.default1.agent.helpdesk.canned.create'); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } } /** @@ -69,17 +78,17 @@ class CannedController extends Controller */ public function store(CannedRequest $request, Canned $canned) { - // fetching all the requested inputs - $canned->user_id = \Auth::user()->id; - $canned->title = $request->input('title'); - $canned->message = $request->input('message'); try { + // fetching all the requested inputs + $canned->user_id = \Auth::user()->id; + $canned->title = $request->input('title'); + $canned->message = $request->input('message'); // saving inputs $canned->save(); - return redirect()->route('canned.list')->with('success', 'Added Successfully'); + return redirect()->route('canned.list')->with('success', Lang::get('lang.added_successfully')); } catch (Exception $e) { - return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]); + return redirect()->route('canned.list')->with('fails', $e->getMessage()); } } @@ -93,10 +102,14 @@ class CannedController extends Controller */ public function edit($id, Canned $canned) { - // fetching requested canned response - $canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first(); + try { + // fetching requested canned response + $canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first(); - return view('themes.default1.agent.helpdesk.canned.edit', compact('canned')); + return view('themes.default1.agent.helpdesk.canned.edit', compact('canned')); + } catch (Exception $ex) { + return redirect()->back()->with('fails', $ex->getMessage()); + } } /** @@ -110,19 +123,19 @@ class CannedController extends Controller */ public function update($id, CannedUpdateRequest $request, Canned $canned) { - /* select the field where id = $id(request Id) */ - $canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first(); - // fetching all the requested inputs - $canned->user_id = \Auth::user()->id; - $canned->title = $request->input('title'); - $canned->message = $request->input('message'); try { + /* select the field where id = $id(request Id) */ + $canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first(); + // fetching all the requested inputs + $canned->user_id = \Auth::user()->id; + $canned->title = $request->input('title'); + $canned->message = $request->input('message'); // saving inputs $canned->save(); - return redirect()->route('canned.list')->with('success', 'Updated Successfully'); + return redirect()->route('canned.list')->with('success', Lang::get('lang.updated_successfully')); } catch (Exception $e) { - return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]); + return redirect()->route('canned.list')->with('fails', $e->getMessage()); } } @@ -136,17 +149,17 @@ class CannedController extends Controller */ public function destroy($id, Canned $canned) { - /* select the field where id = $id(request Id) */ - $canned = $canned->whereId($id)->first(); - /* delete the selected field */ - /* Check whether function success or not */ try { + /* select the field where id = $id(request Id) */ + $canned = $canned->whereId($id)->first(); + /* delete the selected field */ + /* Check whether function success or not */ $canned->delete(); /* redirect to Index page with Success Message */ - return redirect()->route('canned.list')->with('success', 'User Deleted Successfully'); + return redirect()->route('canned.list')->with('success', Lang::get('lang.user_deleted_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]); + return redirect()->route('canned.list')->with('fails', $e->getMessage()); } } diff --git a/app/Http/Controllers/Agent/helpdesk/DashboardController.php b/app/Http/Controllers/Agent/helpdesk/DashboardController.php index 55a95c3ff..7ca17659e 100644 --- a/app/Http/Controllers/Agent/helpdesk/DashboardController.php +++ b/app/Http/Controllers/Agent/helpdesk/DashboardController.php @@ -100,4 +100,52 @@ class DashboardController extends Controller // ->get(); // return $ticketlist; } + + public function userChartData($id, $date111 = '', $date122 = '') + { + $date11 = strtotime($date122); + $date12 = strtotime($date111); + if ($date11 && $date12) { + $date2 = $date12; + $date1 = $date11; + } else { + // generating current date + $date2 = strtotime(date('Y-m-d')); + $date3 = date('Y-m-d'); + $format = 'Y-m-d'; + // generating a date range of 1 month + $date1 = strtotime(date($format, strtotime('-1 month'.$date3))); + } + $return = ''; + $last = ''; + for ($i = $date1; $i <= $date2; $i = $i + 86400) { + $thisDate = date('Y-m-d', $i); + $user = User::whereId($id)->first(); + if ($user->role == 'user') { + $created = \DB::table('tickets')->select('created_at')->where('user_id', '=', $id)->where('created_at', 'LIKE', '%'.$thisDate.'%')->count(); + $closed = \DB::table('tickets')->select('closed_at')->where('user_id', '=', $id)->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count(); + $reopened = \DB::table('tickets')->select('reopened_at')->where('user_id', '=', $id)->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count(); + } else { + $created = \DB::table('tickets')->select('created_at')->where('assigned_to', '=', $id)->where('created_at', 'LIKE', '%'.$thisDate.'%')->count(); + $closed = \DB::table('tickets')->select('closed_at')->where('assigned_to', '=', $id)->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count(); + $reopened = \DB::table('tickets')->select('reopened_at')->where('assigned_to', '=', $id)->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count(); + } + $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; + $array = array_map('htmlentities', $value); + $json = html_entity_decode(json_encode($array)); + $return .= $json.','; + } + $last = rtrim($return, ','); + $users = User::whereId($id)->first(); + + return '['.$last.']'; + + // $ticketlist = DB::table('tickets') + // ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),DB::raw('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'), + // DB::raw('count(*) as totaltickets')) + // ->groupBy('month') + // ->orderBy('month', 'asc') + // ->get(); + // return $ticketlist; + } } diff --git a/app/Http/Controllers/Agent/helpdesk/DashboardController2.php b/app/Http/Controllers/Agent/helpdesk/DashboardController2.php new file mode 100644 index 000000000..721f61392 --- /dev/null +++ b/app/Http/Controllers/Agent/helpdesk/DashboardController2.php @@ -0,0 +1,103 @@ + + */ +class DashboardController2 extends Controller +{ + /** + * Create a new controller instance. + * constructor to check + * 1. authentication + * 2. user roles + * 3. roles must be agent. + * + * @return void + */ + public function __construct() + { + // checking for authentication + $this->middleware('auth'); + // checking if the role is agent + $this->middleware('role.agent'); + } + + /** + * Get the dashboard page. + * + * @return type view + */ + public function index() + { + // if(Auth::user()->role == "user"){ + // return \Redirect::route('home'); + // } + try { + return View::make('themes.default1.agent.helpdesk.dashboard.dashboard'); + } catch (Exception $e) { + return View::make('themes.default1.agent.helpdesk.dashboard.dashboard'); + } + } + + /** + * Fetching dashboard graph data to implement graph. + * + * @return type Json + */ + public function ChartData($date111 = '', $date122 = '') + { + $date11 = strtotime($date122); + $date12 = strtotime($date111); + if ($date11 && $date12) { + $date2 = $date12; + $date1 = $date11; + } else { + // generating current date + $date2 = strtotime(date('Y-m-d')); + $date3 = date('Y-m-d'); + $format = 'Y-m-d'; + // generating a date range of 1 month + $date1 = strtotime(date($format, strtotime('-1 month'.$date3))); + } + $return = ''; + $last = ''; + for ($i = $date1; $i <= $date2; $i = $i + 86400) { + $thisDate = date('Y-m-d', $i); + + $created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%'.$thisDate.'%')->count(); + $closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count(); + $reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count(); + + $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; + $array = array_map('htmlentities', $value); + $json = html_entity_decode(json_encode($array)); + $return .= $json.','; + } + $last = rtrim($return, ','); + + return '['.$last.']'; + + // $ticketlist = DB::table('tickets') + // ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),DB::raw('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'), + // DB::raw('count(*) as totaltickets')) + // ->groupBy('month') + // ->orderBy('month', 'asc') + // ->get(); + // return $ticketlist; + } +} diff --git a/app/Http/Controllers/Agent/helpdesk/MailController.php b/app/Http/Controllers/Agent/helpdesk/MailController.php index 76c6f1ced..1095246ac 100644 --- a/app/Http/Controllers/Agent/helpdesk/MailController.php +++ b/app/Http/Controllers/Agent/helpdesk/MailController.php @@ -27,16 +27,16 @@ use PhpImap\Mailbox as ImapMailbox; * * @author Ladybird */ -class MailController extends Controller -{ +class MailController extends Controller { + /** * constructor * Create a new controller instance. * * @param type TicketController $TicketController */ - public function __construct(TicketWorkflowController $TicketWorkflowController) - { + public function __construct(TicketWorkflowController $TicketWorkflowController) { + $this->middleware('board'); $this->TicketWorkflowController = $TicketWorkflowController; } @@ -45,8 +45,7 @@ class MailController extends Controller * * @return type */ - public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) - { + public function readmails(Emails $emails, Email $settings_email, System $system, Ticket $ticket) { // $path_url = $system->first()->url; if ($settings_email->first()->email_fetching == 1) { if ($settings_email->first()->all_emails == 1) { @@ -81,7 +80,7 @@ class MailController extends Controller $protocol = $fetching_encryption2; } else { if ($e_mail->fetching_protocol) { - $fetching_protocol = '/'.$e_mail->fetching_protocol; + $fetching_protocol = '/' . $e_mail->fetching_protocol; } else { $fetching_protocol = ''; } @@ -90,13 +89,13 @@ class MailController extends Controller } else { $fetching_encryption = ''; } - $protocol = $fetching_protocol.$fetching_encryption; + $protocol = $fetching_protocol . $fetching_encryption; } - $imap_config = '{'.$host.':'.$port.$protocol.'}INBOX'; + $imap_config = '{' . $host . ':' . $port . $protocol . '}INBOX'; $password = Crypt::decrypt($e_mail->password); $mailbox = new ImapMailbox($imap_config, $e_mail->email_address, $password, __DIR__); $mails = []; - $mailsIds = $mailbox->searchMailBox('SINCE '.date('d-M-Y', strtotime('-1 day'))); + $mailsIds = $mailbox->searchMailBox('SINCE ' . date('d-M-Y', strtotime('-1 day'))); if (!$mailsIds) { die('Mailbox is empty'); } @@ -111,14 +110,32 @@ class MailController extends Controller $collaborator = null; } $body = $mail->textHtml; - if ($body == null) { - $body = $mailbox->backup_getmail($mailId); - $body = str_replace('\r\n', '
    ', $body); + if ($body != null) { + $body = self::trimTableTag($body); } + // if mail body has no messages fetch backup mail + if ($body == null) { + $body = $mail->textPlain; + } + if ($body == null) { + $attach = $mail->getAttachments(); + $path = $attach['html-body']->filePath; + if ($path == null) { + $path = $attach['text-body']->filePath; + } + + $body = file_get_contents($path); + //dd($body); + $body = self::trimTableTag($body); + } +// if ($body == null) { +// $body = $mailbox->backup_getmail($mailId); +// $body = str_replace('\r\n', '
    ', $body); +// } $date = $mail->date; $datetime = $overview[0]->date; $date_time = explode(' ', $datetime); - $date = $date_time[1].'-'.$date_time[2].'-'.$date_time[3].' '.$date_time[4]; + $date = $date_time[1] . '-' . $date_time[2] . '-' . $date_time[3] . ' ' . $date_time[4]; $date = date('Y-m-d H:i:s', strtotime($date)); if (isset($mail->subject)) { $subject = $mail->subject; @@ -130,19 +147,19 @@ class MailController extends Controller $ticket_source = Ticket_source::where('name', '=', 'email')->first(); $source = $ticket_source->id; $phone = ''; - + $phonecode = ''; + $mobile_number = ''; $assign = $get_helptopic->auto_assign; $form_data = null; $team_assign = null; $ticket_status = null; - $result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response); + $result = $this->TicketWorkflowController->workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response); // dd($result); if ($result[1] == true) { $ticket_table = Tickets::where('ticket_number', '=', $result[0])->first(); $thread_id = Ticket_Thread::where('ticket_id', '=', $ticket_table->id)->max('id'); // $thread_id = Ticket_Thread::whereRaw('id = (select max(`id`) from ticket_thread)')->first(); $thread_id = $thread_id; - foreach ($mail->getAttachments() as $attachment) { $support = 'support'; // echo $_SERVER['DOCUMENT_ROOT']; @@ -153,7 +170,7 @@ class MailController extends Controller // var_dump($attachment->filePath); // dd($filepath); // $path = $dir_img_path[0]."/code/public/".$filepath[1]; - $path = public_path().$filepath[1]; + $path = public_path() . $filepath[1]; // dd($path); $filesize = filesize($path); $file_data = file_get_contents($path); @@ -162,9 +179,8 @@ class MailController extends Controller $string = str_replace('-', '', $attachment->name); $filename = explode('src', $attachment->filePath); $filename = str_replace('\\', '', $filename); - $body = str_replace('cid:'.$imageid, $filepath[1], $body); + $body = str_replace('cid:' . $imageid, $filepath[1], $body); $pos = strpos($body, $filepath[1]); - if ($pos == false) { if ($settings_email->first()->attachment == 1) { $upload = new Ticket_attachments(); @@ -208,8 +224,7 @@ class MailController extends Controller * * @return type string */ - public function separate_reply($body) - { + public function separate_reply($body) { $body2 = explode('---Reply above this line---', $body); $body3 = $body2[0]; @@ -223,8 +238,7 @@ class MailController extends Controller * * @return type string */ - public function decode_imap_text($str) - { + public function decode_imap_text($str) { $result = ''; $decode_header = imap_mime_header_decode($str); foreach ($decode_header as $obj) { @@ -239,8 +253,7 @@ class MailController extends Controller * * @return type */ - public function fetch_attachments() - { + public function fetch_attachments() { $uploads = Upload::all(); foreach ($uploads as $attachment) { $image = @imagecreatefromstring($attachment->file); @@ -248,8 +261,8 @@ class MailController extends Controller imagejpeg($image, null, 80); $data = ob_get_contents(); ob_end_clean(); - $var = ''; - echo '
    '.$var.''; + $var = ''; + echo '
    ' . $var . ''; } } @@ -260,14 +273,42 @@ class MailController extends Controller * * @return type file */ - public function get_data($id) - { + public function get_data($id) { $attachments = App\Model\helpdesk\Ticket\Ticket_attachments::where('id', '=', $id)->get(); foreach ($attachments as $attachment) { - header('Content-type: application/'.$attachment->type.''); - header('Content-Disposition: inline; filename='.$attachment->name.''); + header('Content-type: application/' . $attachment->type . ''); + header('Content-Disposition: inline; filename=' . $attachment->name . ''); header('Content-Transfer-Encoding: binary'); echo $attachment->file; } } + + public static function trimTableTag($html) { + if (strpos('', $html) != false) { + $first_pos = strpos($html, '', -1); + $total = strlen($fist_string); + $diff = $total - $last_pos; + $str = substr_replace($fist_string, '', $last_pos, -1); + $final_str = str_finish($str, '
    '); + return $final_str; + } + return $html; + } + + public static function trim3D($html) { + $body = str_replace('=3D', '', $html); + return $body; + } + + public static function trimInjections($html, $tags = ['', '', '']) { + $replace = []; + foreach ($tags as $key => $tag) { + $replace[$key] = htmlspecialchars($tag); + } + $body = str_replace($tags, $replace, $html); + return $body; + } + } diff --git a/app/Http/Controllers/Agent/helpdesk/OrganizationController.php b/app/Http/Controllers/Agent/helpdesk/OrganizationController.php index bfb5a1c98..94c11c29f 100644 --- a/app/Http/Controllers/Agent/helpdesk/OrganizationController.php +++ b/app/Http/Controllers/Agent/helpdesk/OrganizationController.php @@ -11,10 +11,12 @@ use App\Http\Requests\helpdesk\OrganizationUpdate; // models /* Define OrganizationRequest to validate the create form */ use App\Model\helpdesk\Agent_panel\Organization; -/* Define OrganizationUpdate to validate the create form */ use App\Model\helpdesk\Agent_panel\User_org; +/* Define OrganizationUpdate to validate the create form */ +use App\User; // classes use Exception; +use Lang; /** * OrganizationController @@ -54,7 +56,7 @@ class OrganizationController extends Controller /* get all values of table organization */ return view('themes.default1.agent.helpdesk.organization.index'); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -131,7 +133,7 @@ class OrganizationController extends Controller try { return view('themes.default1.agent.helpdesk.organization.create'); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -150,14 +152,14 @@ class OrganizationController extends Controller /* Check whether function success or not */ if ($org->fill($request->input())->save() == true) { /* redirect to Index page with Success Message */ - return redirect('organizations')->with('success', 'Organization Created Successfully'); + return redirect('organizations')->with('success', Lang::get('lang.organization_created_successfully')); } else { /* redirect to Index page with Fails Message */ - return redirect('organizations')->with('fails', 'Organization can not Create'); + return redirect('organizations')->with('fails', Lang::get('lang.organization_can_not_create')); } } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('organizations')->with('fails', 'Organization can not Create'); + return redirect('organizations')->with('fails', Lang::get('lang.organization_can_not_create')); } } @@ -177,7 +179,7 @@ class OrganizationController extends Controller /* To view page */ return view('themes.default1.agent.helpdesk.organization.show', compact('orgs')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -197,7 +199,7 @@ class OrganizationController extends Controller /* To view page */ return view('themes.default1.agent.helpdesk.organization.edit', compact('orgs')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -212,22 +214,22 @@ class OrganizationController extends Controller */ public function update($id, Organization $org, OrganizationUpdate $request) { - - /* select the field by id */ - $orgs = $org->whereId($id)->first(); - /* update the organization table */ - /* Check whether function success or not */ try { + /* select the field by id */ + $orgs = $org->whereId($id)->first(); + /* update the organization table */ + /* Check whether function success or not */ if ($orgs->fill($request->input())->save() == true) { /* redirect to Index page with Success Message */ - return redirect('organizations')->with('success', 'Organization Updated Successfully'); + return redirect('organizations')->with('success', Lang::get('lang.organization_updated_successfully')); } else { /* redirect to Index page with Fails Message */ - return redirect('organizations')->with('fails', 'Organization can not Update'); + return redirect('organizations')->with('fails', Lang::get('lang.organization_can_not_update')); } } catch (Exception $e) { + // dd($e); /* redirect to Index page with Fails Message */ - return redirect('organizations')->with('fails', $e->errorInfo[2]); + return redirect('organizations')->with('fails', $e->getMessage()); } } @@ -240,22 +242,21 @@ class OrganizationController extends Controller */ public function destroy($id, Organization $org, User_org $user_org) { - - /* select the field by id */ - $orgs = $org->whereId($id)->first(); - $user_orgs = $user_org->where('org_id', '=', $id)->get(); - foreach ($user_orgs as $user_org) { - $user_org->delete(); - } - /* Delete the field selected from the table */ - /* Check whether function success or not */ try { + /* select the field by id */ + $orgs = $org->whereId($id)->first(); + $user_orgs = $user_org->where('org_id', '=', $id)->get(); + foreach ($user_orgs as $user_org) { + $user_org->delete(); + } + /* Delete the field selected from the table */ + /* Check whether function success or not */ $orgs->delete(); /* redirect to Index page with Success Message */ - return redirect('organizations')->with('success', 'Organization Deleted Successfully'); + return redirect('organizations')->with('success', Lang::get('lang.organization_deleted_successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('organizations')->with('fails', $e->errorInfo[2]); + return redirect('organizations')->with('fails', $e->getMessage()); } } @@ -278,4 +279,53 @@ class OrganizationController extends Controller return 1; } + + /** + * get the report of organizations. + * + * @param type $id + * @param type $date111 + * @param type $date122 + * + * @return type array + */ + public function orgChartData($id, $date111 = '', $date122 = '') + { + $date11 = strtotime($date122); + $date12 = strtotime($date111); + if ($date11 && $date12) { + $date2 = $date12; + $date1 = $date11; + } else { + // generating current date + $date2 = strtotime(date('Y-m-d')); + $date3 = date('Y-m-d'); + $format = 'Y-m-d'; + // generating a date range of 1 month + $date1 = strtotime(date($format, strtotime('-1 month'.$date3))); + } + $return = ''; + $last = ''; + for ($i = $date1; $i <= $date2; $i = $i + 86400) { + $thisDate = date('Y-m-d', $i); + + $user_orga_relation_id = ''; + $user_orga_relations = User_org::where('org_id', '=', $id)->get(); + foreach ($user_orga_relations as $user_orga_relation) { + $user_orga_relation_id[] = $user_orga_relation->user_id; + } + $created = \DB::table('tickets')->select('created_at')->whereIn('user_id', $user_orga_relation_id)->where('created_at', 'LIKE', '%'.$thisDate.'%')->count(); + $closed = \DB::table('tickets')->select('closed_at')->whereIn('user_id', $user_orga_relation_id)->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count(); + $reopened = \DB::table('tickets')->select('reopened_at')->whereIn('user_id', $user_orga_relation_id)->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count(); + + $value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; + $array = array_map('htmlentities', $value); + $json = html_entity_decode(json_encode($array)); + $return .= $json.','; + } + $last = rtrim($return, ','); + $users = User::whereId($id)->first(); + + return '['.$last.']'; + } } diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 1f2618807..a6a19d201 100644 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -9,8 +9,8 @@ use App\Http\Controllers\Controller; // requests use App\Http\Requests\helpdesk\CreateTicketRequest; use App\Http\Requests\helpdesk\TicketRequest; -// models use App\Model\helpdesk\Agent\Department; +// models use App\Model\helpdesk\Agent\Teams; use App\Model\helpdesk\Email\Emails; use App\Model\helpdesk\Form\Fields; @@ -28,14 +28,18 @@ use App\Model\helpdesk\Ticket\Ticket_source; use App\Model\helpdesk\Ticket\Ticket_Status; use App\Model\helpdesk\Ticket\Ticket_Thread; use App\Model\helpdesk\Ticket\Tickets; +use App\Model\helpdesk\Utility\CountryCode; use App\Model\helpdesk\Utility\Date_time_format; use App\Model\helpdesk\Utility\Timezones; use App\User; use Auth; use DB; use Exception; +use ForceUTF8\Encoding; +use GeoIP; // classes use Hash; +use Illuminate\Http\Request; use Illuminate\support\Collection; use Input; use Lang; @@ -160,6 +164,11 @@ class TicketController extends Controller return view('themes.default1.agent.helpdesk.ticket.overdue'); } + /** + * Ajax response overdue tickets. + * + * @return type json + */ public function getOverdueTickets() { if (Auth::user()->role == 'agent') { @@ -242,9 +251,12 @@ class TicketController extends Controller * * @return type response */ - public function newticket() + public function newticket(CountryCode $code) { - return view('themes.default1.agent.helpdesk.ticket.new'); + $location = GeoIP::getLocation(); + $phonecode = $code->where('iso', '=', $location['isoCode'])->first(); + + return view('themes.default1.agent.helpdesk.ticket.new')->with('phonecode', $phonecode->phonecode); } /** @@ -254,7 +266,7 @@ class TicketController extends Controller * * @return type response */ - public function post_newticket(CreateTicketRequest $request) + public function post_newticket(CreateTicketRequest $request, CountryCode $code) { try { $email = $request->input('email'); @@ -271,15 +283,41 @@ class TicketController extends Controller $body = $request->input('body'); $priority = $request->input('priority'); $phone = $request->input('phone'); + $phonecode = $request->input('code'); + $mobile_number = $request->input('mobile'); $source = Ticket_source::where('name', '=', 'agent')->first(); $headers = null; $help = Help_topic::where('id', '=', $helptopic)->first(); $form_data = null; $auto_response = 0; $status = 1; + if ($phone != null || $mobile_number != null) { + $location = GeoIP::getLocation(); + $geoipcode = $code->where('iso', '=', $location['isoCode'])->first(); + if ($phonecode == null) { + $data = [ + 'fails' => Lang::get('lang.country-code-required-error'), + 'phonecode' => $geoipcode->phonecode, + 'country_code_error' => 1, + ]; + + return Redirect()->back()->with($data)->withInput($request->except('password')); + } else { + $code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get(); + if (!count($code)) { + $data = [ + 'fails' => Lang::get('lang.incorrect-country-code-error'), + 'phonecode' => $geoipcode->phonecode, + 'country_code_error' => 1, + ]; + + return Redirect()->back()->with($data)->withInput($request->except('password')); + } + } + } //create user - if ($this->create_user($email, $fullname, $subject, $body, $phone, $helptopic, $sla, $priority, $source->id, $headers, $help->department, $assignto, $form_data, $auto_response, $status)) { - return Redirect('newticket')->with('success', 'Ticket created successfully!'); + if ($this->create_user($email, $fullname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source->id, $headers, $help->department, $assignto, $form_data, $auto_response, $status)) { + return Redirect('newticket')->with('success', Lang::get('lang.Ticket-created-successfully')); } else { return Redirect('newticket')->with('fails', 'fails'); } @@ -549,12 +587,11 @@ class TicketController extends Controller * * @return type bool */ - public function create_user($emailadd, $username, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $auto_response, $status) + public function create_user($emailadd, $username, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $from_data, $auto_response, $status) { // define global variables $email; $username; - // check emails $ticket_creator = $username; $checkemail = $this->checkEmail($emailadd); @@ -571,6 +608,7 @@ class TicketController extends Controller $user->email = $emailadd; $user->password = Hash::make($password); $user->phone_number = $phone; + $user->country_code = $phonecode; $user->role = 'user'; $user->active = '1'; // mail user his/her password @@ -607,7 +645,6 @@ class TicketController extends Controller } else { $sign = $company; } - if ($source == 3) { try { if ($auto_response == 0) { @@ -667,7 +704,7 @@ class TicketController extends Controller $emails_to_be_sent = array_unique($set_mails, SORT_REGULAR); foreach ($emails_to_be_sent as $email_data) { try { - $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $email_data['to_user'], 'email' => $email_data['to_email']], $message = ['subject' => $updated_subject, 'body' => $body, 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $email_data['to_user_name'], 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $email_data['to_user_name'], 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]); + $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $ticketdata->dept_id), $to = ['user' => $email_data['to_user'], 'email' => $email_data['to_email']], $message = ['subject' => $updated_subject, 'body' => Encoding::fixUTF8($body), 'scenario' => $mail], $template_variables = ['ticket_agent_name' => $email_data['to_user_name'], 'ticket_client_name' => $username, 'ticket_client_email' => $emailadd, 'user' => $email_data['to_user_name'], 'ticket_number' => $ticket_number2, 'email_address' => $emailadd, 'name' => $ticket_creator]); } catch (\Exception $e) { } } @@ -870,6 +907,7 @@ class TicketController extends Controller $thread->title = $subject; $thread->body = $body; if ($thread->save()) { + \Event::fire('ticket.details', ['ticket' => $thread]); //get the ticket details return true; } } @@ -925,7 +963,6 @@ class TicketController extends Controller $ticket_number = $ticket_status->ticket_number; $system_from = $this->company(); - $sending_emails = Emails::where('department', '=', $ticket_status->dept_id)->first(); if ($sending_emails == null) { $from_email = $this->system_mail(); @@ -1409,9 +1446,9 @@ class TicketController extends Controller $ticket_collaborator->role = 'ccc'; $ticket_collaborator->save(); - return '

    Success!

    '.$data->user_name.'

    '.$data->email.'
    '; + return '

    Success!

    '.$data->user_name.'

    '.$data->email.'
    '; } else { - return '

    '.$data->user_name.'

    '.$data->email.'
    This user already Collaborated
    '; + return '

    '.$data->user_name.'

    '.$data->email.'
    This user already Collaborated
    '; } } @@ -1429,7 +1466,7 @@ class TicketController extends Controller $ticket_id = Input::get('ticket_id'); $user_search = User::where('email', '=', $email)->first(); if (isset($user_serach)) { - return '

    Alert!

    This user already Exists
    '; + return '

    Alert!

    This user already Exists
    '; } else { $company = $this->company(); $user = new User(); @@ -1451,7 +1488,7 @@ class TicketController extends Controller $ticket_collaborator->role = 'ccc'; $ticket_collaborator->save(); - return '

    '.$user->user_name.'

    '.$user->email.'
    '; + return '

    '.$user->user_name.'

    '.$user->email.'
    '; } } @@ -1495,7 +1532,7 @@ class TicketController extends Controller $ticket->closed = 0; $ticket->closed_at = null; $ticket->save(); - } elseif ($value == 'Clean up') { + } elseif ($value == 'Delete forever') { $thread = Ticket_Thread::where('ticket_id', '=', $ticket->id)->get(); foreach ($thread as $th_id) { // echo $th_id->id." "; @@ -1560,9 +1597,9 @@ class TicketController extends Controller } /** - *adding offset to updated_at time. + * adding offset to updated_at time. * - *@return date + * @return date */ public static function timeOffset($utc) { @@ -1578,7 +1615,7 @@ class TicketController extends Controller /** * to get user date time format. * - *@return string + * @return string */ public static function getDateTimeFormat() { @@ -1664,9 +1701,32 @@ class TicketController extends Controller * * @return type Redirect */ - public function rating($id, $rating) + public function rating($id, Request $request, \App\Model\helpdesk\Ratings\RatingRef $rating_ref) { - Tickets::where('id', $id)->update(['rating' => $rating]); + foreach ($request->all() as $key => $value) { + if (strpos($key, '_') !== false) { + $ratName = str_replace('_', ' ', $key); + } else { + $ratName = $key; + } + $ratID = \App\Model\helpdesk\Ratings\Rating::where('name', '=', $ratName)->first(); + $ratingrefs = $rating_ref->where('rating_id', '=', $ratID->id)->where('ticket_id', '=', $id)->first(); + if ($ratingrefs !== null) { + $ratingrefs->rating_id = $ratID->id; + $ratingrefs->ticket_id = $id; + + $ratingrefs->thread_id = '0'; + $ratingrefs->rating_value = $value; + $ratingrefs->save(); + } else { + $rating_ref->rating_id = $ratID->id; + $rating_ref->ticket_id = $id; + + $rating_ref->thread_id = '0'; + $rating_ref->rating_value = $value; + $rating_ref->save(); + } + } return redirect()->back()->with('Success', 'Thank you for your rating!'); } @@ -1676,17 +1736,37 @@ class TicketController extends Controller * * @return type Redirect */ - public function ratingReply($id, $rating) + public function ratingReply($id, Request $request, \App\Model\helpdesk\Ratings\RatingRef $rating_ref) { - $thread = Ticket_Thread::whereId($id)->first(); -// $last_average = $thread->reply_rating; -//$total_numbers = $thread->rating_count; -//$new_number = $rating; -//$new_average = (($last_average * $total_numbers) + $new_number) / ($total_numbers + 1); -//$thread->rating_count += 1; -$thread->reply_rating = $rating; - $thread->save(); -// $thread->set('rating_count', 'rating_count+1', FALSE)->update(['ratingreply' => $new_average]); + foreach ($request->all() as $key => $value) { + $key1 = explode(',', $key); + if (strpos($key1[0], '_') !== false) { + $ratName = str_replace('_', ' ', $key1[0]); + } else { + $ratName = $key1[0]; + } + + $ratID = \App\Model\helpdesk\Ratings\Rating::where('name', '=', $ratName)->first(); + $ratingrefs = $rating_ref->where('rating_id', '=', $ratID->id)->where('thread_id', '=', $key1[1])->first(); + + if ($ratingrefs !== null) { + $ratingrefs->rating_id = $ratID->id; + $ratingrefs->ticket_id = $id; + + $ratingrefs->thread_id = $key1[1]; + $ratingrefs->rating_value = $value; + $ratingrefs->save(); + } else { + $rating_ref->rating_id = $ratID->id; + $rating_ref->ticket_id = $id; + + $rating_ref->thread_id = $key1[1]; + $rating_ref->rating_value = $value; + $rating_ref->save(); + } + } + + return redirect()->back()->with('Success', 'Thank you for your rating!'); } @@ -1721,7 +1801,14 @@ $thread->reply_rating = $rating; $diff = round(abs($to_time - $from_time) / 60, 2); if ($diff < $cad && Auth::user()->id != $ticket->lock_by) { - return 0; //ticket is locked + $user_data = User::select('user_name', 'first_name', 'last_name')->where('id', '=', $ticket->lock_by)->first(); + if ($user_data->first_name != '') { + $name = $user_data->first_name.' '.$user_data->last_name; + } else { + $name = $user_data->username; + } + + return Lang::get('lang.locked-ticket')." lock_by)."'>".$name.' '.$diff.' '.Lang::get('lang.minutes-ago'); //ticket is locked } elseif ($diff < $cad && Auth::user()->id == $ticket->lock_by) { $ticket = Tickets::where('id', '=', $id)->first(); $ticket->lock_at = date('Y-m-d H:i:s'); @@ -1798,8 +1885,8 @@ $thread->reply_rating = $rating; if (Alert::first()->internal_status == 1 || Alert::first()->internal_assigned_agent == 1) { // ticket assigned send mail Mail::send('emails.Ticket_assign', ['agent' => $agent, 'ticket_number' => $ticket_number, 'from' => $company, 'master' => $master, 'system' => $system], function ($message) use ($agent_email, $agent, $ticket_number, $ticket_subject) { - $message->to($agent_email, $agent)->subject($ticket_subject.'[#'.$ticket_number.']'); - }); + $message->to($agent_email, $agent)->subject($ticket_subject.'[#'.$ticket_number.']'); + }); } return 1; @@ -1821,15 +1908,14 @@ $thread->reply_rating = $rating; $email = $email; $ticket_id = $ticket_id; $validator = \Validator::make( - ['email' => $email, - 'name' => $name, ], - ['email' => 'required|email', - ] + ['email' => $email, + 'name' => $name, ], ['email' => 'required|email', + ] ); $user = User::where('email', '=', $email)->first(); $count = count($user); if ($count === 1) { - return 0; + return 0; } elseif ($validator->fails()) { return 2; } else { @@ -1863,7 +1949,7 @@ $thread->reply_rating = $rating; } else { $ticket = Tickets::select('user_id')->where('id', '=', $id)->first(); $ticket_data = Tickets::select('ticket_number', 'id') - ->where('user_id', '=', $ticket->user_id)->where('id', '!=', $id)->where('status', '=', 1)->get(); + ->where('user_id', '=', $ticket->user_id)->where('id', '!=', $id)->where('status', '=', 1)->get(); foreach ($ticket_data as $value) { $title = Ticket_Thread::select('title')->where('ticket_id', '=', $value->id)->first(); echo "'; @@ -1896,9 +1982,9 @@ $thread->reply_rating = $rating; } else { $ticket = Tickets::select('user_id')->where('id', '=', $id)->first(); $ticket_data = Tickets::select('ticket_number', 'id') - ->where('user_id', '=', $ticket->user_id) - ->where('id', '!=', $id) - ->where('status', '=', 1)->get(); + ->where('user_id', '=', $ticket->user_id) + ->where('id', '!=', $id) + ->where('status', '=', 1)->get(); if (isset($ticket_data) && count($ticket_data) >= 1) { return 1; } else { @@ -1936,13 +2022,13 @@ $thread->reply_rating = $rating; $thread = Ticket_thread::where('ticket_id', '=', $value)->first(); $ticket = Tickets::select('ticket_number')->where('id', '=', $value)->first(); Ticket_thread::where('ticket_id', '=', $value) - ->update(['ticket_id' => $p_id]); + ->update(['ticket_id' => $p_id]); Ticket_Form_Data::where('ticket_id', '=', $value) - ->update(['ticket_id' => $p_id]); + ->update(['ticket_id' => $p_id]); Ticket_Collaborator::where('ticket_id', '=', $value) - ->update(['ticket_id' => $p_id]); + ->update(['ticket_id' => $p_id]); Tickets::where('id', '=', $value) - ->update(['status' => 3]); + ->update(['status' => 3]); if (!empty(Input::get('reason'))) { $reason = Input::get('reason'); } else { @@ -1950,7 +2036,7 @@ $thread->reply_rating = $rating; } if (!empty(Input::get('title'))) { Ticket_thread::where('ticket_id', '=', $p_id)->first() - ->update(['title' => Input::get('title')]); + ->update(['title' => Input::get('title')]); } $new_thread = new Ticket_thread(); @@ -1961,8 +2047,8 @@ $thread->reply_rating = $rating; $new_thread->is_internal = 0; $new_thread->title = $thread->title; $new_thread->body = Lang::get('lang.get_merge_message'). - "  #".$parent_ticket->ticket_number.'

    '.Lang::get('lang.merge-reason').''.$reason; + "  #".$parent_ticket->ticket_number.'

    '.Lang::get('lang.merge-reason').':  '.$reason; $new_thread->format = $thread->format; $new_thread->ip_address = $thread->ip_address; @@ -1973,7 +2059,7 @@ $thread->reply_rating = $rating; $new_parent_thread->source = $parent_thread->source; $new_parent_thread->is_internal = 1; $new_parent_thread->title = $thread->title; - $new_parent_thread->body = Lang::get('lang.ticket')." #".$ticket->ticket_number.' '.Lang::get('lang.ticket_merged').'

    '.Lang::get('lang.merge-reason').''.$reason; + $new_parent_thread->body = Lang::get('lang.ticket')." #".$ticket->ticket_number.' '.Lang::get('lang.ticket_merged').'

    '.Lang::get('lang.merge-reason').':  '.$reason; $new_parent_thread->format = $parent_thread->format; $new_parent_thread->ip_address = $parent_thread->ip_address; if ($new_thread->save() && $new_parent_thread->save()) { @@ -1998,16 +2084,17 @@ $thread->reply_rating = $rating; } /* - *chumper's function to return data to chumper datatable. - *@param Array-object $tickets + * chumper's function to return data to chumper datatable. + * @param Array-object $tickets * - *@return Array-object + * @return Array-object */ + public static function getTable($tickets) { return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { - return ""; + return ""; }) ->addColumn('subject', function ($ticket) { $subject = DB::table('ticket_thread')->select('title')->where('ticket_id', '=', $ticket->id)->first(); @@ -2063,8 +2150,9 @@ $thread->reply_rating = $rating; }) ->addColumn('from', function ($ticket) { $from = DB::table('users')->select('user_name')->where('id', '=', $ticket->user_id)->first(); + $url = route('user.show', $ticket->user_id); - return "user_name).'''.Lang::get('lang.see-profile2')."'>".ucfirst($from->user_name).''; + return "user_name).'''.Lang::get('lang.see-profile2')."'>".ucfirst($from->user_name).''; }) // ->addColumn('Last Replier', function ($ticket) { // $TicketData = Ticket_Thread::where('ticket_id', '=', $ticket->id)->where('is_internal', '=', 0)->max('id'); @@ -2080,7 +2168,6 @@ $thread->reply_rating = $rating; // $username = $LastResponse->user_name; // } // } - // return "".ucfirst($username).''; // }) ->addColumn('assigned_to', function ($ticket) { @@ -2088,8 +2175,9 @@ $thread->reply_rating = $rating; return "Unassigned"; } else { $assign = DB::table('users')->where('id', '=', $ticket->assigned_to)->first(); + $url = route('user.show', $ticket->assigned_to); - return "first_name).'''.Lang::get('lang.see-profile2')."'>".ucfirst($assign->first_name).' '.ucfirst($assign->last_name).''; + return "first_name).'''.Lang::get('lang.see-profile2')."'>".ucfirst($assign->first_name).' '.ucfirst($assign->last_name).''; } }) ->addColumn('Last', function ($ticket) { @@ -2103,4 +2191,42 @@ $thread->reply_rating = $rating; ->orderColumns('subject', 'from', 'assigned_to', 'Last Replier', 'ticket_number', 'priority', 'Last') ->make(); } + + //Auto-close tickets + public function autoCloseTickets() + { + $workflow = \App\Model\helpdesk\Workflow\WorkflowClose::whereId(1)->first(); + + if ($workflow->condition == 1) { + $overdues = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->orderBy('id', 'DESC')->get(); + if (count($overdues) == 0) { + $tickets = null; + } else { + $i = 0; + foreach ($overdues as $overdue) { + // $sla_plan = Sla_plan::where('id', '=', $overdue->sla)->first(); + + $ovadate = $overdue->created_at; + $new_date = date_add($ovadate, date_interval_create_from_date_string($workflow->days.' days')).'

    '; + if (date('Y-m-d H:i:s') > $new_date) { + $i++; + $overdue->status = 3; + $overdue->closed = 1; + $overdue->closed_at = date('Y-m-d H:i:s'); + $overdue->save(); +// if($workflow->send_email == 1) { +// $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('0', $overdue->dept_id), $to = ['name' => $user_name, 'email' => $email], $message = ['subject' => $ticket_subject.'[#'.$ticket_number.']', 'scenario' => 'close-ticket'], $template_variables = ['ticket_number' => $ticket_number]); +// } + } + } + // dd(count($value)); +// if ($i > 0) { +// $tickets = new collection($value); +// } else { +// $tickets = null; +// } + } + } else { + } + } } diff --git a/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php b/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php index 93ed3f1f1..15b8611d5 100644 --- a/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketWorkflowController.php @@ -40,7 +40,7 @@ class TicketWorkflowController extends Controller * * @return type response */ - public function workflow($fromaddress, $fromname, $subject, $body, $phone, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response) + public function workflow($fromaddress, $fromname, $subject, $body, $phone, $phonecode, $mobile_number, $helptopic, $sla, $priority, $source, $collaborator, $dept, $assign, $team_assign, $ticket_status, $form_data, $auto_response) { $contact_details = ['email' => $fromaddress, 'email_name' => $fromname, 'subject' => $subject, 'message' => $body]; $ticket_settings_details = ['help_topic' => $helptopic, 'sla' => $sla, 'priority' => $priority, 'source' => $source, 'dept' => $dept, 'assign' => $assign, 'team' => $team_assign, 'status' => $ticket_status, 'reject' => false]; @@ -169,7 +169,7 @@ class TicketWorkflowController extends Controller if ($ticket_settings_details['reject'] == true) { return ['0' => false, '1' => false]; } else { - $create_ticket = $this->TicketController->create_user($contact_details['email'], $contact_details['email_name'], $contact_details['subject'], $contact_details['message'], $phone, $ticket_settings_details['help_topic'], $ticket_settings_details['sla'], $ticket_settings_details['priority'], $source, $collaborator, $ticket_settings_details['dept'], $ticket_settings_details['assign'], $form_data, $auto_response, $ticket_settings_details['status']); + $create_ticket = $this->TicketController->create_user($contact_details['email'], $contact_details['email_name'], $contact_details['subject'], $contact_details['message'], $phone, $phonecode, $mobile_number, $ticket_settings_details['help_topic'], $ticket_settings_details['sla'], $ticket_settings_details['priority'], $source, $collaborator, $ticket_settings_details['dept'], $ticket_settings_details['assign'], $form_data, $auto_response, $ticket_settings_details['status']); return $create_ticket; } diff --git a/app/Http/Controllers/Agent/helpdesk/UserController.php b/app/Http/Controllers/Agent/helpdesk/UserController.php index 0aa9df39b..46e9b5d18 100644 --- a/app/Http/Controllers/Agent/helpdesk/UserController.php +++ b/app/Http/Controllers/Agent/helpdesk/UserController.php @@ -16,12 +16,15 @@ use App\Http\Requests\helpdesk\Sys_userUpdate; // models use App\Model\helpdesk\Agent_panel\Organization; use App\Model\helpdesk\Agent_panel\User_org; +use App\Model\helpdesk\Utility\CountryCode; use App\User; // classes use Auth; use Exception; +use GeoIP; use Hash; use Input; +use Lang; use Redirect; /** @@ -62,7 +65,7 @@ class UserController extends Controller /* get all values in Sys_user */ return view('themes.default1.agent.helpdesk.user.index'); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -75,24 +78,24 @@ class UserController extends Controller { // displaying list of users with chumper datatables return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) - /* searchable column username and email*/ + /* searchable column username and email */ ->searchColumns('user_name', 'email', 'phone') /* order column username and email */ ->orderColumns('user_name', 'email') /* column username */ ->addColumn('user_name', function ($model) { - if (strlen($model->user_name) > 20) { - $username = substr($model->user_name, 0, 30); - $username = substr($username, 0, strrpos($username, ' ')).' ...'; + $string = strip_tags($model->user_name); + if (strlen($string) > 10) { + // truncate string + $stringCut = substr($string, 0, 10); } else { - $username = "id)."'>".$model->user_name.''; + $stringCut = $model->user_name; } - - return $username; + return $stringCut; }) /* column email */ ->addColumn('email', function ($model) { - $email = "id)."'>".$model->email.''; + $email = "id)."'>".$model->email.''; return $email; }) @@ -150,10 +153,13 @@ class UserController extends Controller * * @return type view */ - public function create() + public function create(CountryCode $code) { try { - return view('themes.default1.agent.helpdesk.user.create'); + $location = GeoIP::getLocation(''); + $phonecode = $code->where('iso', '=', $location['isoCode'])->first(); + + return view('themes.default1.agent.helpdesk.user.create')->with('phonecode', $phonecode->phonecode); } catch (Exception $e) { return redirect()->back()->with('fails', $e->errorInfo[2]); } @@ -176,16 +182,25 @@ class UserController extends Controller $user->mobile = $request->input('mobile'); $user->ext = $request->input('ext'); $user->phone_number = $request->input('phone_number'); + $user->country_code = $request->input('country_code'); $user->active = $request->input('active'); $user->internal_note = $request->input('internal_note'); $user->role = 'user'; try { + if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) { + return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput(); + } else { + $code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get(); + if (!count($code)) { + return redirect()->back()->with(['fails' => Lang::get('lang.incorrect-country-code-error'), 'country_code_error' => 1])->withInput(); + } + } $user->save(); /* redirect to Index page with Success Message */ - return redirect('user')->with('success', 'User Created Successfully'); + return redirect('user')->with('success', Lang::get('lang.User-Created-Successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect('user')->with('fails', $e->errorInfo[2]); + return redirect('user')->with('fails', $e->getMessage()); } } @@ -197,15 +212,16 @@ class UserController extends Controller * * @return type view */ - public function show($id, User $user) + public function show($id) { try { + $user = new User(); /* select the field where id = $id(request Id) */ $users = $user->whereId($id)->first(); return view('themes.default1.agent.helpdesk.user.show', compact('users')); } catch (Exception $e) { - return view('404'); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -217,15 +233,18 @@ class UserController extends Controller * * @return type Response */ - public function edit($id, User $user) + public function edit($id, CountryCode $code) { try { + $user = new User(); /* select the field where id = $id(request Id) */ $users = $user->whereId($id)->first(); + $location = GeoIP::getLocation(''); + $phonecode = $code->where('iso', '=', $location['isoCode'])->first(); - return view('themes.default1.agent.helpdesk.user.edit', compact('users')); + return view('themes.default1.agent.helpdesk.user.edit', compact('users'))->with('phonecode', $phonecode->phonecode); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -238,19 +257,31 @@ class UserController extends Controller * * @return type Response */ - public function update($id, User $user, Sys_userUpdate $request) + public function update($id, Sys_userUpdate $request) { + $user = new User(); /* select the field where id = $id(request Id) */ $users = $user->whereId($id)->first(); /* Update the value by selected field */ /* Check whether function success or not */ try { + if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) { + return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput(); + } else { + $code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get(); + if (!count($code)) { + return redirect()->back()->with(['fails' => Lang::get('lang.incorrect-country-code-error'), 'country_code_error' => 1])->withInput(); + } else { + $users->country_code = $request->country_code; + } + } + // dd($request->input()); $users->fill($request->input())->save(); /* redirect to Index page with Success Message */ - return redirect('user')->with('success', 'User Updated Successfully'); + return redirect('user')->with('success', Lang::get('lang.User-profile-Updated-Successfully')); } catch (Exception $e) { /* redirect to Index page with Fails Message */ - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -265,7 +296,7 @@ class UserController extends Controller try { return view('themes.default1.agent.helpdesk.user.profile', compact('user')); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -274,13 +305,15 @@ class UserController extends Controller * * @return type view */ - public function getProfileedit() + public function getProfileedit(CountryCode $code) { $user = Auth::user(); + $location = GeoIP::getLocation(''); + $phonecode = $code->where('iso', '=', $location['isoCode'])->first(); try { - return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user')); + return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user'))->with('phonecode', $phonecode->phonecode); } catch (Exception $e) { - return redirect()->back()->with('fails', $e->errorInfo[2]); + return redirect()->back()->with('fails', $e->getMessage()); } } @@ -324,15 +357,24 @@ class UserController extends Controller $user->profile_pic = $fileName; } else { try { + if ($request->get('country_code') == '' && ($request->get('phone_number') != '' || $request->get('mobile') != '')) { + return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput(); + } else { + $code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get(); + if (!count($code)) { + return redirect()->back()->with(['fails' => Lang::get('lang.incorrect-country-code-error'), 'country_code_error' => 1])->withInput(); + } + $user->country_code = $request->country_code; + } $user->fill($request->except('profile_pic', 'gender'))->save(); - return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); + return Redirect::route('profile')->with('success', Lang::get('lang.Profile-Updated-sucessfully')); } catch (Exception $e) { - return Redirect::route('profile')->with('success', $e->errorInfo[2]); + return Redirect::route('profile')->with('success', $e->getMessage()); } } if ($user->fill($request->except('profile_pic'))->save()) { - return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); + return Redirect::route('profile')->with('success', Lang::get('lang.Profile-Updated-sucessfully')); } } @@ -354,12 +396,12 @@ class UserController extends Controller try { $user->save(); - return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); + return redirect('profile-edit')->with('success1', Lang::get('lang.password_updated_sucessfully')); } catch (Exception $e) { - return redirect('profile-edit')->with('fails', $e->errorInfo[2]); + return redirect('profile-edit')->with('fails', $e->getMessage()); } } else { - return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password'); + return redirect('profile-edit')->with('fails1', Lang::get('lang.password_was_not_updated_incorrect_old_password')); } } @@ -381,6 +423,25 @@ class UserController extends Controller return 1; } + public function orgAssignUser($id) + { + $org = Input::get('org'); + $user_org = new User_org(); + $user_org->org_id = $id; + $user_org->user_id = $org; + $user_org->save(); + + return 1; + } + + public function removeUserOrg($id) + { + $user_org = User_org::where('org_id', '=', $id)->first(); + $user_org->delete(); + + return redirect()->back()->with('success1', Lang::get('lang.the_user_has_been_removed_from_this_organization')); + } + /** * creating an organization in user profile page via modal popup. * diff --git a/app/Http/Controllers/Agent/helpdesk/UserController2.php b/app/Http/Controllers/Agent/helpdesk/UserController2.php new file mode 100644 index 000000000..345288039 --- /dev/null +++ b/app/Http/Controllers/Agent/helpdesk/UserController2.php @@ -0,0 +1,427 @@ + + */ +class UserController2 extends Controller +{ + /** + * Create a new controller instance. + * constructor to check + * 1. authentication + * 2. user roles + * 3. roles must be agent. + * + * @return void + */ + public function __construct() + { + // checking authentication + $this->middleware('auth'); + // checking if role is agent + $this->middleware('role.agent'); + } + + /** + * Display all list of the users. + * + * @param type User $user + * + * @return type view + */ + public function index() + { + try { + /* get all values in Sys_user */ + return view('themes.default1.agent.helpdesk.user.index'); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * This function is used to display the list of users using chumper datatables. + * + * @return datatable + */ + public function user_list() + { + // displaying list of users with chumper datatables + return \Datatable::collection(User::where('role', '!=', 'admin')->where('role', '!=', 'agent')->get()) + /* searchable column username and email*/ + ->searchColumns('user_name', 'email', 'phone') + /* order column username and email */ + ->orderColumns('user_name', 'email') + /* column username */ + ->addColumn('user_name', function ($model) { + if (strlen($model->user_name) > 20) { + $username = substr($model->user_name, 0, 30); + $username = substr($username, 0, strrpos($username, ' ')).' ...'; + } else { + $username = "id)."'>".$model->user_name.''; + } + + return $username; + }) + /* column email */ + ->addColumn('email', function ($model) { + $email = "id)."'>".$model->email.''; + + return $email; + }) + /* column phone */ + ->addColumn('phone', function ($model) { + $phone = ''; + if ($model->phone_number) { + $phone = $model->ext.' '.$model->phone_number; + } + $mobile = ''; + if ($model->mobile) { + $mobile = $model->mobile; + } + $phone = $phone.'   '.$mobile; + + return $phone; + }) + /* column account status */ + ->addColumn('status', function ($model) { + $status = $model->active; + if ($status == 1) { + $stat = ''; + } else { + $stat = ''; + } + + return $stat; + }) + /* column ban status */ + ->addColumn('ban', function ($model) { + $status = $model->ban; + if ($status == 1) { + $stat = ''; + } else { + $stat = ''; + } + + return $stat; + }) + /* column last login date */ + ->addColumn('lastlogin', function ($model) { + $t = $model->updated_at; + + return TicketController::usertimezone($t); + }) + /* column actions */ + ->addColumn('Actions', function ($model) { + return ''.\Lang::get('lang.edit').'  '.\Lang::get('lang.view').''; + }) + ->make(); + } + + /** + * Show the form for creating a new users. + * + * @return type view + */ + public function create() + { + try { + return view('themes.default1.agent.helpdesk.user.create'); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * Store a newly created users in storage. + * + * @param type User $user + * @param type Sys_userRequest $request + * + * @return type redirect + */ + public function store(User $user, Sys_userRequest $request) + { + /* insert the input request to sys_user table */ + /* Check whether function success or not */ + $user->email = $request->input('email'); + $user->user_name = $request->input('full_name'); + $user->mobile = $request->input('mobile'); + $user->ext = $request->input('ext'); + $user->phone_number = $request->input('phone_number'); + $user->active = $request->input('active'); + $user->internal_note = $request->input('internal_note'); + $user->role = 'user'; + try { + $user->save(); + /* redirect to Index page with Success Message */ + return redirect('user')->with('success', 'User Created Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect('user')->with('fails', $e->errorInfo[2]); + } + } + + /** + * Display the specified users. + * + * @param type int $id + * @param type User $user + * + * @return type view + */ + public function show($id, User $user) + { + try { + /* select the field where id = $id(request Id) */ + $users = $user->whereId($id)->first(); + + return view('themes.default1.agent.helpdesk.user.show', compact('users')); + } catch (Exception $e) { + return view('404'); + } + } + + /** + * Show the form for editing the specified resource. + * + * @param type int $id + * @param type User $user + * + * @return type Response + */ + public function edit($id, User $user) + { + try { + /* select the field where id = $id(request Id) */ + $users = $user->whereId($id)->first(); + + return view('themes.default1.agent.helpdesk.user.edit', compact('users')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * Update the specified user in storage. + * + * @param type int $id + * @param type User $user + * @param type Sys_userUpdate $request + * + * @return type Response + */ + public function update($id, User $user, Sys_userUpdate $request) + { + /* select the field where id = $id(request Id) */ + $users = $user->whereId($id)->first(); + /* Update the value by selected field */ + /* Check whether function success or not */ + try { + $users->fill($request->input())->save(); + /* redirect to Index page with Success Message */ + return redirect('user')->with('success', 'User Updated Successfully'); + } catch (Exception $e) { + /* redirect to Index page with Fails Message */ + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * get agent profile page. + * + * @return type view + */ + public function getProfile() + { + $user = Auth::user(); + try { + return view('themes.default1.agent.helpdesk.user.profile', compact('user')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * get profile edit page. + * + * @return type view + */ + public function getProfileedit() + { + $user = Auth::user(); + try { + return view('themes.default1.agent.helpdesk.user.profile-edit', compact('user')); + } catch (Exception $e) { + return redirect()->back()->with('fails', $e->errorInfo[2]); + } + } + + /** + * post profile edit. + * + * @param type int $id + * @param type ProfileRequest $request + * + * @return type Redirect + */ + public function postProfileedit(ProfileRequest $request) + { + // geet authenticated user details + $user = Auth::user(); + $user->gender = $request->input('gender'); + $user->save(); + // checking availability of agent profile ppicture + if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') { + if ($request->input('gender') == 1) { + $name = 'avatar5.png'; + $destinationPath = 'lb-faveo/media/profilepic'; + $user->profile_pic = $name; + } elseif ($request->input('gender') == 0) { + $name = 'avatar2.png'; + $destinationPath = 'lb-faveo/media/profilepic'; + $user->profile_pic = $name; + } + } + // checking if the post system includes agent profile picture upload + if (Input::file('profile_pic')) { + // fetching picture name + $name = Input::file('profile_pic')->getClientOriginalName(); + // fetching upload destination path + $destinationPath = 'lb-faveo/media/profilepic'; + // adding a random value to profile picture filename + $fileName = rand(0000, 9999).'.'.$name; + // moving the picture to a destination folder + Input::file('profile_pic')->move($destinationPath, $fileName); + // saving filename to database + $user->profile_pic = $fileName; + } else { + try { + $user->fill($request->except('profile_pic', 'gender'))->save(); + + return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); + } catch (Exception $e) { + return Redirect::route('profile')->with('success', $e->errorInfo[2]); + } + } + if ($user->fill($request->except('profile_pic'))->save()) { + return Redirect::route('profile')->with('success', 'Profile Updated sucessfully'); + } + } + + /** + * Post profile password. + * + * @param type int $id + * @param type ProfilePassword $request + * + * @return type Redirect + */ + public function postProfilePassword($id, ProfilePassword $request) + { + // get authenticated user + $user = Auth::user(); + // checking if the old password matches the new password + if (Hash::check($request->input('old_password'), $user->getAuthPassword())) { + $user->password = Hash::make($request->input('new_password')); + try { + $user->save(); + + return redirect('profile-edit')->with('success1', 'Password Updated sucessfully'); + } catch (Exception $e) { + return redirect('profile-edit')->with('fails', $e->errorInfo[2]); + } + } else { + return redirect('profile-edit')->with('fails1', 'Password was not Updated. Incorrect old password'); + } + } + + /** + * Assigning an user to an organization. + * + * @param type $id + * + * @return type boolean + */ + public function UserAssignOrg($id) + { + $org = Input::get('org'); + $user_org = new User_org(); + $user_org->org_id = $org; + $user_org->user_id = $id; + $user_org->save(); + + return 1; + } + + /** + * creating an organization in user profile page via modal popup. + * + * @param type $id + * + * @return type + */ + public function User_Create_Org($id) + { + // checking if the entered value for website is available in database + if (Input::get('website') != null) { + // checking website + $check = Organization::where('website', '=', Input::get('website'))->first(); + } else { + $check = null; + } + // checking if the name is unique + $check2 = Organization::where('name', '=', Input::get('name'))->first(); + // if any of the fields is not available then return false + if (\Input::get('name') == null) { + return 'Name is required'; + } elseif ($check2 != null) { + return 'Name should be Unique'; + } elseif ($check != null) { + return 'Website should be Unique'; + } else { + // storing organization details and assigning the current user to that organization + $org = new Organization(); + $org->name = Input::get('name'); + $org->phone = Input::get('phone'); + $org->website = Input::get('website'); + $org->address = Input::get('address'); + $org->internal_notes = Input::get('internal'); + $org->save(); + + $user_org = new User_org(); + $user_org->org_id = $org->id; + $user_org->user_id = $id; + $user_org->save(); + // for success return 0 + return 0; + } + } +} diff --git a/app/Http/Controllers/Agent/kb/ArticleController.php b/app/Http/Controllers/Agent/kb/ArticleController.php index 2a99cb213..c890f8899 100644 --- a/app/Http/Controllers/Agent/kb/ArticleController.php +++ b/app/Http/Controllers/Agent/kb/ArticleController.php @@ -3,7 +3,6 @@ namespace App\Http\Controllers\Agent\kb; // Controllers -use App\Http\Controllers\Agent\helpdesk\TicketController; use App\Http\Controllers\Controller; // Requests use App\Http\Requests\kb\ArticleRequest; @@ -21,16 +20,17 @@ use Datatable; use DB; use Exception; use Illuminate\Http\Request; +use Lang; use Redirect; /** * ArticleController * This controller is used to CRUD Articles. * - * @author Ladybird + * @author Ladybird */ -class ArticleController extends Controller -{ +class ArticleController extends Controller { + /** * Create a new controller instance. * constructor to check @@ -40,8 +40,7 @@ class ArticleController extends Controller * * @return void */ - public function __construct() - { + public function __construct() { // checking authentication $this->middleware('auth'); // checking roles @@ -49,8 +48,7 @@ class ArticleController extends Controller SettingsController::language(); } - public function test() - { + public function test() { //$table = $this->setDatatable(); return view('themes.default1.agent.kb.article.test'); } @@ -60,29 +58,37 @@ class ArticleController extends Controller * * @return type void */ - public function getData() - { + public function getData() { + $article = new Article(); // returns chumper datatable - return Datatable::collection(Article::All()) + return Datatable::query($article) /* searcable column name */ ->searchColumns('name') /* order column name and description */ ->orderColumns('name', 'description') /* add column name */ ->addColumn('name', function ($model) { - return $model->name; + + $string = strip_tags($model->name); + if (strlen($string) > 40) { + // truncate string + $stringCut = substr($string, 0, 40); + } else { + $stringCut = $model->name; + } + return $stringCut . '...'; }) /* add column Created */ - ->addColumn('Created', function ($model) { - $t = $model->created_at; + ->addColumn('publish_time', function ($model) { + $t = $model->publish_time; - return TicketController::usertimezone($t); + return $t; }) /* add column action */ ->addColumn('Actions', function ($model) { /* here are all the action buttons and modal popup to delete articles with confirmations */ - return ' id.'/edit class="btn btn-warning btn-xs">'.\Lang::get('lang.edit').' slug.' class="btn btn-primary btn-xs">'.\Lang::get('lang.view').' -