public function init() { /* Form Elements & Other Definitions Here ... */ $this->setMethod('post'); $this->setElementDecorators($this->elementDecorators); $this->addElement('text', 'item_name', array('label' => 'Item Name', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Item Name", 'class' => 'mws-textinput')); $serviceMapper = new Application_Model_ServiceMasterMapper(); $services = $serviceMapper->getAllServiceMasters(); $service_options = array('Select Service'); if ($services) { foreach ($services as $service) { $service_options[$service->__get("service_id")] = $service->__get("service_name"); } } $categoryMapper = new Application_Model_CategoriesMapper(); $categories = $categoryMapper->getAllCategories(); $cat_options = array('Select Category'); if ($categories) { foreach ($categories as $category) { $cat_options[$category->__get("category_id")] = $category->__get("category_name"); } } $this->addElement('select', 'category_id', array('label' => 'Category', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Item Price", 'class' => 'mws-textinput', 'multiOptions' => $cat_options)); $this->addElement('select', 'service_id', array('label' => 'Service', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Item Price", 'class' => 'mws-textinput', 'multiOptions' => $service_options)); $this->addElement('text', 'item_description', array('label' => 'Item Description', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Item Description", 'class' => 'mws-textinput')); $this->addElement('select', 'is_live', array('label' => 'Is Live', 'required' => true, 'multiOptions' => array('1' => 'Yes', '0' => 'No'), 'filters' => array('StringTrim'), 'class' => 'mws-textinput')); $this->addElement('text', 'item_order', array('label' => 'Item Order', 'required' => true, 'placeholder' => "Enter Item Order", 'filters' => array('StringTrim'), 'class' => 'mws-textinput')); }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setMethod('post'); $this->setAttribs(array('novalidate' => 'novalidate', "role" => "form", 'enctype' => 'multipart/form-data')); $this->setElementDecorators($this->elementDecorators); $this->addElement('text', 'package_name', array('label' => 'Package Name', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Package Name", 'class' => 'mws-textinput')); $packagesMapper = new Application_Model_ServiceMasterMapper(); $allServices = $packagesMapper->getAllServiceMasters(); $activeServices = array(); foreach ($allServices as $service) { $activeServices[$service->service_id] = $service->service_name; } $this->addElement('select', 'package_service_type', array('label' => 'Package Service', 'required' => true, 'multiOptions' => $activeServices, 'filters' => array('StringTrim'), 'class' => 'mws-textinput')); $validity = array(); for ($i = 1; $i < 13; $i++) { $validity[$i] = $i . " Month"; } $this->addElement('select', 'validity', array('label' => 'Package Validity', 'required' => true, 'multiOptions' => $validity, 'filters' => array('StringTrim'), 'class' => 'mws-textinput')); $this->addElement('text', 'package_price', array('label' => 'Package Price', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Package Price", 'class' => 'mws-textinput', "validators" => array(array("Float", true, array("messages" => " Please enter a valid price ")), array("NotEmpty", true, array("messages" => " Price is required ")), array("GreaterThan", true, array('min' => 1, 'inclusive' => true, "messages" => " Percentage should be greater than 1 ")), array("LessThan", true, array('max' => 100000, 'inclusive' => true, "messages" => " Percentage should be less than 100000 "))))); $this->addElement('text', 'no_of_clothes', array('label' => 'No. of Clothes', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter No. of clothes in package", 'class' => 'mws-textinput', "filters" => array("StringTrim", "StripTags", "HtmlEntities", "StringToLower"), "validators" => array(array("Float", false, array("messages" => " Please enter a valid number of clothes ")), array("NotEmpty", true, array("messages" => " Number of clothes is required ")), array("GreaterThan", true, array('min' => 1, 'inclusive' => true, "messages" => " Number of clothes should be greater than 1 ")), array("LessThan", true, array('max' => 5000, 'inclusive' => true, "messages" => " Number of clothes should be less than 5000 "))))); $this->addElement('text', 'saving_percent', array('label' => 'Saving Percentage', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Saving Package", 'class' => 'mws-textinput', "filters" => array("StringTrim", "StripTags", "HtmlEntities", "StringToLower"), "validators" => array(array("Float", true, array("messages" => " Please enter a valid percentage ")), array("NotEmpty", true, array("messages" => " Saving percentage is required ")), array("GreaterThan", true, array('min' => 1, 'inclusive' => true, "messages" => " Percentage should be greater than 1 ")), array("LessThan", true, array('max' => 100, 'inclusive' => true, "messages" => " Percentage should be less than 100 "))))); $this->addElement('text', 'no_of_pickups', array('label' => 'No. of pickups', 'required' => true, 'placeholder' => "Enter No. of Pickups", 'class' => 'mws-textinput', "filters" => array("StringTrim", "StripTags", "HtmlEntities", "StringToLower"), "validators" => array(array("Float", false, array("messages" => " Please enter a valid number of pickups ")), array("NotEmpty", true, array("messages" => " Number of pickups is required ")), array("GreaterThan", true, array('min' => 1, 'inclusive' => true, "messages" => " Number of pickups should be greater than 1 ")), array("LessThan", true, array('max' => 22, 'inclusive' => true, "messages" => " Number of pickups should be less than 22 "))))); $this->addElement('file', 'package_icon', array("accept" => "image/*", "ignore" => true, "class" => " form-control", "label" => "Package Icon")); $this->package_icon->setDestination(WEBSITE_PATH . '/public/img/packages/')->addValidator('Extension', false, "jpg,jpeg,png,gif")->addValidator('Size', false, "1MB")->setDecorators(array('File', 'Errors', array('Description', array('tag' => 'p', 'class' => 'description')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'mws-form-item large')), array('Label', array('class' => 'control-label', 'requiredSuffix' => ' *')), array('Errors', array('class' => 'zend-error')))); $this->addElement('file', 'package_icon_hover', array("accept" => "image/*", "ignore" => true, "class" => " form-control", "label" => "Package Icon (view on hover)")); $this->package_icon_hover->setDestination(WEBSITE_PATH . '/public/img/packages/')->addValidator('Extension', false, "jpg,jpeg,png,gif")->addValidator('Size', false, "1MB")->setDecorators(array('File', 'Errors', array('Description', array('tag' => 'p', 'class' => 'description')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'mws-form-item large')), array('Label', array('class' => 'control-label', 'requiredSuffix' => ' *')), array('Errors', array('class' => 'zend-error')))); }
public function indexAction() { try { $service_form = new Application_Form_ServiceMasterForm(); $this->view->form = $service_form; $serviceMasterMapper = new Application_Model_ServiceMasterMapper(); $services = new Application_Model_ServiceMasters(); $request = $this->getRequest(); if ($request->isPost()) { $request_type = $request->getParam("request_type", false); if ($request_type) { if ($request_type == "add") { $params = $request->getParams(); if ($service_form->isValid($params)) { foreach ($params as $param => $value) { $services->__set($param, $value); } if ($serviceMasterMapper->addNewServiceMaster($services)) { $this->view->message = "Service added successfully"; $this->view->hasMessage = true; $this->view->messageType = "success"; } else { $this->view->message = "Error occured while adding. Please try again"; $this->view->hasMessage = true; $this->view->messageType = "danger"; } } else { $this->view->message = "Error occured while Adding. Please fill form correctly"; $this->view->hasMessage = true; $this->view->messageType = "danger"; } } elseif ($request_type == "delete") { $id = $request->getParam("id"); if ($serviceMasterMapper->deleteServiceMasterById($id)) { $this->view->hasMessage = true; $this->view->messageType = "success"; $this->view->message = "Service deleted successfully."; } else { $this->view->hasMessage = true; $this->view->messageType = "danger"; $this->view->message = "Error occured while deleting. Please try again."; } } } } $services = $serviceMasterMapper->getAllServiceMasters(); $this->view->services = $services; $this->authorised = true; } catch (Exception $ex) { $this->authorised = false; $this->view->hasMessage = true; $this->view->messageType = "danger"; $this->view->message = $ex->getMessage(); } }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setMethod('post'); $this->setAttribs(array('novalidate' => 'novalidate', "role" => "form", 'enctype' => 'multipart/form-data')); $this->setElementDecorators($this->elementDecorators); $this->addElement('text', 'offer_name', array('label' => 'Offer Name', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Promotion Name", 'class' => 'mws-textinput')); $packagesMapper = new Application_Model_ServiceMasterMapper(); $allServices = $packagesMapper->getAllServiceMasters(); $activeServices = array(); foreach ($allServices as $service) { $activeServices[$service->service_id] = $service->service_name; } $this->addElement('text', 'offer_clothes', array('label' => 'Clothes', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Clothes", 'class' => 'mws-textinput', "filters" => array("StringTrim", "StripTags", "HtmlEntities", "StringToLower"), "validators" => array(array("Float", false, array("messages" => " Please enter a valid number of clothes ")), array("NotEmpty", true, array("messages" => " Number of clothes is required ")), array("GreaterThan", true, array('min' => 1, 'inclusive' => true, "messages" => " Number of clothes should be greater than 1 ")), array("LessThan", true, array('max' => 5000, 'inclusive' => true, "messages" => " Number of clothes should be less than 5000 "))))); $this->addElement('select', 'offer_service_type', array('label' => 'Offer Service Type', 'required' => true, 'multiOptions' => $activeServices, 'filters' => array('StringTrim'), 'class' => 'mws-textinput')); $this->addElement('text', 'offer_amount', array('label' => 'Price', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Price", 'class' => 'mws-textinput', "validators" => array(array("Float", true, array("messages" => " Please enter a valid price ")), array("NotEmpty", true, array("messages" => " Price is required ")), array("GreaterThan", true, array('min' => 1, 'inclusive' => true, "messages" => " Price should be greater than 1 ")), array("LessThan", true, array('max' => 100000, 'inclusive' => true, "messages" => " Price should be less than 100000 "))))); $this->addElement('text', 'no_of_clothes', array('label' => 'No. of Clothes', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter No. of clothes in package", 'class' => 'mws-textinput', "filters" => array("StringTrim", "StripTags", "HtmlEntities", "StringToLower"), "validators" => array(array("Float", false, array("messages" => " Please enter a valid number of clothes ")), array("NotEmpty", true, array("messages" => " Number of clothes is required ")), array("GreaterThan", true, array('min' => 0, 'inclusive' => true, "messages" => " Number of clothes should be greater than 0 ")), array("LessThan", true, array('max' => 5000, 'inclusive' => true, "messages" => " Number of clothes should be less than 5000 "))))); $this->addElement('text', 'no_of_pickups', array('label' => 'No. of pickups', 'required' => true, 'placeholder' => "Enter No. of Pickups", 'class' => 'mws-textinput', "filters" => array("StringTrim", "StripTags", "HtmlEntities", "StringToLower"), "validators" => array(array("Float", false, array("messages" => " Please enter a valid number of pickups ")), array("NotEmpty", true, array("messages" => " Number of pickups is required ")), array("GreaterThan", true, array('min' => 0, 'inclusive' => true, "messages" => " Number of pickups should be greater than 0 ")), array("LessThan", true, array('max' => 22, 'inclusive' => true, "messages" => " Number of pickups should be less than 22 "))))); $this->addElement('select', 'offer_status', array('label' => 'Status', 'required' => true, 'multiOptions' => array("1" => "Active", "0" => "In-Active"), 'filters' => array('StringTrim'), 'class' => 'mws-textinput')); }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setMethod('post'); $this->setElementDecorators($this->elementDecorators); $itemMapper = new Application_Model_ItemsMapper(); $items = $itemMapper->getAllItems(); $item_options = array('Select Item'); $categoriesMapper = new Application_Model_CategoriesMapper(); $servicesMapper = new Application_Model_ServiceMasterMapper(); if ($items) { foreach ($items as $item) { $category = $categoriesMapper->getCategoryById($item->__get("category_id")); $service = $servicesMapper->getServiceMasterById($item->__get("service_id")); $item_options[$item->__get("item_id")] = $category->__get("category_name") . " > " . $item->__get("item_name") . " (" . $service->__get("service_name") . ")"; } } $this->addElement('select', 'item_id', array('label' => 'Item', 'required' => true, 'placeholder' => "Select Item", 'filters' => array('StringTrim'), 'class' => 'mws-textinput', 'multiOptions' => $item_options)); $serviceMapper = new Application_Model_ServiceMasterMapper(); $services = $serviceMapper->getAllServiceMasters(); $service_options = array('Select Service'); if ($services) { foreach ($services as $service) { $service_options[$service->__get("service_id")] = $service->__get("service_name"); } } $this->addElement('select', 'service_id', array('label' => 'Service', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Item Price", 'class' => 'mws-textinput', 'multiOptions' => $service_options)); $deliveryMapper = new Application_Model_DeliveryTypeMasterMapper(); $deliveries = $deliveryMapper->getAllDeliveryTypeMaster(); $delivery_options = array('Select Delivery Type'); if ($deliveries) { foreach ($deliveries as $delivery) { $delivery_options[$delivery->__get("delivery_type_name")] = $delivery->__get("delivery_type_name"); } } $this->addElement('select', 'delivery_type_name', array('label' => 'Delivery Type', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Item Price", 'class' => 'mws-textinput', 'multiOptions' => $delivery_options)); $this->addElement('text', 'price', array('label' => 'Price', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter Price", 'class' => 'mws-textinput')); }
public function orderlistAction() { $namespace = new Zend_Session_Namespace('userInfo'); $this->view->user_fname = $namespace->user_fname; $this->view->user_lname = $namespace->user_lname; $this->view->user_img = $namespace->user_img; if (isset($namespace->user_id)) { $orderModel = new Application_Model_OrdersMapper(); $serviceModel = new Application_Model_ServiceMasterMapper(); $orders = $orderModel->getOrdersByUserId(9); //get list of services $services = $serviceModel->getAllServiceMasters(); $servicesArr = array(); foreach ($services as $serviceKey => $service) { $servicesArr[$service->__get('service_id')]['service_name'] = $service->__get('service_name'); } $ordersArr = array(); foreach ($orders as $key => $item) { $ordersArr[$key]['order_id'] = $item->__get('order_id'); $ordersArr[$key]['order_pickup'] = $item->__get('order_pickup'); $serviceIds = $item->__get('order_service_type'); $serviceIds = explode(",", $serviceIds); $ordersArr[$key]['order_services'] = array_map(function ($val) use($servicesArr) { return @$servicesArr[$val]['service_name']; }, $serviceIds); $ordersArr[$key]['order_delivery'] = $item->__get('order_delivery'); } $this->view->orders = $ordersArr; $this->view->headlineText = 'My Orders'; } else { $this->_redirect(); } }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setMethod('post'); $this->setElementDecorators($this->elementDecorators); //get delivery types from delivery master $deliveryMapper = new Application_Model_DeliveryTypeMasterMapper(); //get service types list $serviceMaster = new Application_Model_ServiceMasterMapper(); $packageMaster = new Application_Model_PackagesMapper(); $this->addElement('text', 'order_mobile_number', array('label' => 'User\'s Phone Number', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter User's Contact number", 'class' => 'mws-textinput required')); $this->addElement('hidden', 'order_user_id', array()); $this->addElement('text', 'order_first_name', array('label' => 'User\'s First Name', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter User's First Name", 'class' => 'mws-textinput required')); $this->addElement('text', 'order_last_name', array('label' => 'User\'s Last Name', 'filters' => array('StringTrim'), 'placeholder' => "Enter User's Last Name", 'class' => 'mws-textinput')); $this->addElement('text', 'order_user_email', array('label' => 'User\'s Email', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter User's Email", 'class' => 'mws-textinput')); $this->addElement('text', 'order_address', array('label' => 'User\'s House/Apartment #', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter User's House/Apartment #", 'class' => 'mws-textinput')); $this->addElement('text', 'order_city', array('label' => 'City', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Enter City", 'class' => 'mws-textinput')); // $this->addElement('text', 'order_pincode', array( // 'label' => 'Pincode', // 'filters' => array('StringTrim'), // 'placeholder' => "Enter Pincode", // 'class' => 'mws-textinput', // )); $orderType = array('service' => 'service', 'package' => 'package'); $this->addElement('select', 'order_type', array('label' => 'Order Type', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Order type", 'class' => 'mws-textinput', 'multiOptions' => $orderType, 'onchange' => 'changeOrderType(this.value)')); //============== Service Type //get service list $serviceList = $serviceMaster->getAllServiceMasters(); foreach ($serviceList as $serviceVal) { $serviceType[$serviceVal->service_id] = $serviceVal->service_name; } // $serviceType = array(3=>"laundry",4=>"dryclean",5=>"ironing",6=>"washandfold",0=>"other"); $this->addElement('multiselect', 'order_service_type', array('label' => 'Service Type', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Service Type", 'class' => 'mws-textinput', 'multiOptions' => $serviceType, 'onchange' => 'updateDeliveryType(this.value)')); //=========== Delivery Type $deliveryTypes = $deliveryMapper->getAllDeliveryTypeMaster(); foreach ($deliveryTypes as $delVal) { $delivery_types[$delVal->delivery_type_id] = $delVal->delivery_type_name; } // $delivery_types = array("Regular", "Express"); $this->addElement('select', 'order_delivery_type', array('label' => 'Delivery Type', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Delivery type", 'class' => 'mws-textinput', 'multiOptions' => $delivery_types)); $packageList = $packageMaster->getAllPackages(); $packageArr = array(); foreach ($packageList as $packageVal) { $packageArr[$packageVal->package_id] = $packageVal->package_name; } // $delivery_types = array("Regular", "Express"); $this->addElement('select', 'order_package', array('label' => 'Package', 'required' => true, 'filters' => array('StringTrim'), 'placeholder' => "Select Package", 'class' => 'mws-textinput', 'multiOptions' => $packageArr)); // $payment_methods = array("Credit Card", "Debit Card", "Net Banking", "Cash On Delivery", "Wallet"); // $this->addElement('select', 'order_payment_type', array( // 'label' => 'Payment Method', // 'required' => true, // 'filters' => array('StringTrim'), // 'placeholder' => "Select Payment Method", // 'class' => 'mws-textinput', // 'multiOptions' => $payment_methods // )); // $payment_statuses = array("Paid","Unpaid"); // $this->addElement('select', 'order_payment_status', array( // 'label' => 'Payment Status', // 'required' => true, // 'filters' => array('StringTrim'), // 'placeholder' => "Select Payment Status", // 'class' => 'mws-textinput', // 'multiOptions' => $payment_statuses // )); // $order_statuses = array("New","Picked","Processed","Dispatched","Delivered"); // $this->addElement('select', 'order_status', array( // 'label' => 'Order Status', // 'required' => true, // 'filters' => array('StringTrim'), // 'placeholder' => "Select Order Status", // 'class' => 'mws-textinput', // 'multiOptions' => $order_statuses // )); // // TO DO - from db // $serviceType = array(3=>"laundry",4=>"dryclean",5=>"ironing",6=>"washandfold",0=>"other"); // $this->addElement('select', 'order_service_type', array( // 'label' => 'Service Type', // 'required' => true, // 'filters' => array('StringTrim'), // 'placeholder' => "Select Service Type", // 'class' => 'mws-textinput', // 'multiOptions' => $order_statuses // )); // $this->addElement('text', 'order_amount', array( // 'label' => 'Total Price', // 'required' => true, // 'filters' => array('StringTrim'), // 'placeholder' => "Enter Total Price", // 'class' => 'mws-textinput', // )); }
public function ratelistAction() { $requestParams = $this->getRequest()->getParams(); $ServiceMasterMapper = new Application_Model_ServiceMasterMapper(); $allServices = $ServiceMasterMapper->getAllServiceMasters(); $CategoriesMapper = new Application_Model_CategoriesMapper(); $allCategories = $CategoriesMapper->getAllCategories(); $this->view->selectedcity = $this->_getParam("city", "1"); $this->view->selectedService = $this->_getParam("service", $allServices[0]->service_id); $this->view->selectedCategory = $this->_getParam("category", $allCategories[0]->category_id); $this->view->cities = array('1' => "Noida"); $this->view->services = $allServices; $this->view->categories = $allCategories; $model = new Application_Model_ItemPriceMapper(); $items = $model->getItemPriceByServiceIdCatIdDelName($this->view->selectedService, "regular", $this->view->selectedCategory); $this->view->items = $items; }